@tumaet/prompt-ui-components 0.0.3 → 0.0.5
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/dist/components/DatePicker.js +18 -0
- package/dist/components/DatePicker.js.map +1 -0
- package/dist/components/DateRangePicker.js +12 -0
- package/dist/components/DateRangePicker.js.map +1 -0
- package/dist/components/DeleteConfirmationDialog.js +13 -0
- package/dist/components/DeleteConfirmationDialog.js.map +1 -0
- package/dist/components/ErrorPage.js +9 -0
- package/dist/components/ErrorPage.js.map +1 -0
- package/dist/components/LoadingPage.js +6 -0
- package/dist/components/LoadingPage.js.map +1 -0
- package/dist/components/ManagementPageHeader.js +5 -0
- package/dist/components/ManagementPageHeader.js.map +1 -0
- package/dist/components/MultiSelect.js +96 -0
- package/dist/components/MultiSelect.js.map +1 -0
- package/dist/components/SaveChangesAlert.js +31 -0
- package/dist/components/SaveChangesAlert.js.map +1 -0
- package/dist/components/UnauthorizedPage.js +13 -0
- package/dist/components/UnauthorizedPage.js.map +1 -0
- package/dist/components/index.js +9 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/minimal-tiptap/components/bubble-menu/link-bubble-menu.js +65 -0
- package/dist/components/minimal-tiptap/components/bubble-menu/link-bubble-menu.js.map +1 -0
- package/dist/components/minimal-tiptap/components/image/image-edit-block.js +38 -0
- package/dist/components/minimal-tiptap/components/image/image-edit-block.js.map +1 -0
- package/dist/components/minimal-tiptap/components/image/image-edit-dialog.js +12 -0
- package/dist/components/minimal-tiptap/components/image/image-edit-dialog.js.map +1 -0
- package/dist/components/minimal-tiptap/components/link/link-edit-block.js +34 -0
- package/dist/components/minimal-tiptap/components/link/link-edit-block.js.map +1 -0
- package/dist/components/minimal-tiptap/components/link/link-edit-popover.js +38 -0
- package/dist/components/minimal-tiptap/components/link/link-edit-popover.js.map +1 -0
- package/dist/components/minimal-tiptap/components/link/link-popover-block.js +28 -0
- package/dist/components/minimal-tiptap/components/link/link-popover-block.js.map +1 -0
- package/dist/components/minimal-tiptap/components/measured-container.js +16 -0
- package/dist/components/minimal-tiptap/components/measured-container.js.map +1 -0
- package/dist/components/minimal-tiptap/components/section/five.js +39 -0
- package/dist/components/minimal-tiptap/components/section/five.js.map +1 -0
- package/dist/components/minimal-tiptap/components/section/four.js +29 -0
- package/dist/components/minimal-tiptap/components/section/four.js.map +1 -0
- package/dist/components/minimal-tiptap/components/section/mailingPlaceholders.js +23 -0
- package/dist/components/minimal-tiptap/components/section/mailingPlaceholders.js.map +1 -0
- package/dist/components/minimal-tiptap/components/section/one.js +77 -0
- package/dist/components/minimal-tiptap/components/section/one.js.map +1 -0
- package/dist/components/minimal-tiptap/components/section/three.js +79 -0
- package/dist/components/minimal-tiptap/components/section/three.js.map +1 -0
- package/dist/components/minimal-tiptap/components/section/two.js +65 -0
- package/dist/components/minimal-tiptap/components/section/two.js.map +1 -0
- package/dist/components/minimal-tiptap/components/shortcut-key.js +11 -0
- package/dist/components/minimal-tiptap/components/shortcut-key.js.map +1 -0
- package/dist/components/minimal-tiptap/components/spinner.js +9 -0
- package/dist/components/minimal-tiptap/components/spinner.js.map +1 -0
- package/dist/components/minimal-tiptap/components/toolbar-button.js +15 -0
- package/dist/components/minimal-tiptap/components/toolbar-button.js.map +1 -0
- package/dist/components/minimal-tiptap/components/toolbar-section.js +27 -0
- package/dist/components/minimal-tiptap/components/toolbar-section.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/code-block-lowlight/code-block-lowlight.js +16 -0
- package/dist/components/minimal-tiptap/extensions/code-block-lowlight/code-block-lowlight.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/code-block-lowlight/index.js +2 -0
- package/dist/components/minimal-tiptap/extensions/code-block-lowlight/index.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/color/color.js +20 -0
- package/dist/components/minimal-tiptap/extensions/color/color.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/color/index.js +2 -0
- package/dist/components/minimal-tiptap/extensions/color/index.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/file-handler/index.js +74 -0
- package/dist/components/minimal-tiptap/extensions/file-handler/index.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/horizontal-rule/horizontal-rule.js +16 -0
- package/dist/components/minimal-tiptap/extensions/horizontal-rule/horizontal-rule.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/horizontal-rule/index.js +2 -0
- package/dist/components/minimal-tiptap/extensions/horizontal-rule/index.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/image/components/image-actions.js +39 -0
- package/dist/components/minimal-tiptap/extensions/image/components/image-actions.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/image/components/image-overlay.js +9 -0
- package/dist/components/minimal-tiptap/extensions/image/components/image-overlay.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/image/components/image-view-block.js +167 -0
- package/dist/components/minimal-tiptap/extensions/image/components/image-view-block.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/image/components/resize-handle.js +11 -0
- package/dist/components/minimal-tiptap/extensions/image/components/resize-handle.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/image/hooks/use-drag-resize.js +88 -0
- package/dist/components/minimal-tiptap/extensions/image/hooks/use-drag-resize.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/image/hooks/use-image-actions.js +32 -0
- package/dist/components/minimal-tiptap/extensions/image/hooks/use-image-actions.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/image/image.js +225 -0
- package/dist/components/minimal-tiptap/extensions/image/image.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/image/index.js +2 -0
- package/dist/components/minimal-tiptap/extensions/image/index.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/index.js +10 -0
- package/dist/components/minimal-tiptap/extensions/index.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/link/index.js +2 -0
- package/dist/components/minimal-tiptap/extensions/link/index.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/link/link.js +74 -0
- package/dist/components/minimal-tiptap/extensions/link/link.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/reset-marks-on-enter/index.js +2 -0
- package/dist/components/minimal-tiptap/extensions/reset-marks-on-enter/index.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/reset-marks-on-enter/reset-marks-on-enter.js +20 -0
- package/dist/components/minimal-tiptap/extensions/reset-marks-on-enter/reset-marks-on-enter.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/selection/index.js +2 -0
- package/dist/components/minimal-tiptap/extensions/selection/index.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/selection/selection.js +31 -0
- package/dist/components/minimal-tiptap/extensions/selection/selection.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/unset-all-marks/index.js +2 -0
- package/dist/components/minimal-tiptap/extensions/unset-all-marks/index.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/unset-all-marks/unset-all-marks.js +9 -0
- package/dist/components/minimal-tiptap/extensions/unset-all-marks/unset-all-marks.js.map +1 -0
- package/dist/components/minimal-tiptap/form-description-tiptap.js +26 -0
- package/dist/components/minimal-tiptap/form-description-tiptap.js.map +1 -0
- package/dist/components/minimal-tiptap/hooks/use-container-size.js +44 -0
- package/dist/components/minimal-tiptap/hooks/use-container-size.js.map +1 -0
- package/dist/components/minimal-tiptap/hooks/use-minimal-tiptap.js +160 -0
- package/dist/components/minimal-tiptap/hooks/use-minimal-tiptap.js.map +1 -0
- package/dist/components/minimal-tiptap/hooks/use-theme.js +19 -0
- package/dist/components/minimal-tiptap/hooks/use-theme.js.map +1 -0
- package/dist/components/minimal-tiptap/hooks/use-throttle.js +24 -0
- package/dist/components/minimal-tiptap/hooks/use-throttle.js.map +1 -0
- package/dist/components/minimal-tiptap/index.js +2 -0
- package/dist/components/minimal-tiptap/index.js.map +1 -0
- package/dist/components/minimal-tiptap/mailing-tiptap.js +30 -0
- package/dist/components/minimal-tiptap/mailing-tiptap.js.map +1 -0
- package/dist/components/minimal-tiptap/minimal-tiptap.js +29 -0
- package/dist/components/minimal-tiptap/minimal-tiptap.js.map +1 -0
- package/dist/components/minimal-tiptap/types.js +2 -0
- package/dist/components/minimal-tiptap/types.js.map +1 -0
- package/dist/components/minimal-tiptap/utils.js +156 -0
- package/dist/components/minimal-tiptap/utils.js.map +1 -0
- package/dist/components/table/GroupActionDialog.js +8 -0
- package/dist/components/table/GroupActionDialog.js.map +1 -0
- package/dist/components/table/SortableHeader.js +7 -0
- package/dist/components/table/SortableHeader.js.map +1 -0
- package/dist/components/ui/accordion.js +1 -1
- package/dist/components/ui/alert-dialog.js +2 -2
- package/dist/components/ui/alert.js +1 -1
- package/dist/components/ui/avatar.js +1 -1
- package/dist/components/ui/badge.js +1 -1
- package/dist/components/ui/breadcrumb.js +1 -1
- package/dist/components/ui/button.js +1 -1
- package/dist/components/ui/calendar.js +2 -2
- package/dist/components/ui/card.js +1 -1
- package/dist/components/ui/chart.js +1 -1
- package/dist/components/ui/checkbox.js +1 -1
- package/dist/components/ui/command.js +2 -2
- package/dist/components/ui/dialog.js +1 -1
- package/dist/components/ui/dropdown-menu.js +1 -1
- package/dist/components/ui/form.js +2 -2
- package/dist/components/ui/input.js +1 -1
- package/dist/components/ui/label.js +1 -1
- package/dist/components/ui/popover.js +1 -1
- package/dist/components/ui/progress.js +1 -1
- package/dist/components/ui/radio-group.js +1 -1
- package/dist/components/ui/scroll-area.js +1 -1
- package/dist/components/ui/select.js +1 -1
- package/dist/components/ui/separator.js +1 -1
- package/dist/components/ui/sheet.js +1 -1
- package/dist/components/ui/sidebar.js +8 -8
- package/dist/components/ui/skeleton.js +1 -1
- package/dist/components/ui/switch.js +1 -1
- package/dist/components/ui/table.js +1 -1
- package/dist/components/ui/tabs.js +1 -1
- package/dist/components/ui/textarea.js +1 -1
- package/dist/components/ui/toast.js +1 -1
- package/dist/components/ui/toaster.js +2 -2
- package/dist/components/ui/toggle-group.js +2 -2
- package/dist/components/ui/toggle.js +1 -1
- package/dist/components/ui/tooltip.js +1 -1
- package/dist/index.css +2 -3
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/types/components/DatePicker.d.ts +6 -0
- package/dist/types/components/DateRangePicker.d.ts +8 -0
- package/dist/types/components/DeleteConfirmationDialog.d.ts +9 -0
- package/dist/types/components/ErrorPage.d.ts +9 -0
- package/dist/types/components/LoadingPage.d.ts +1 -0
- package/dist/types/components/ManagementPageHeader.d.ts +5 -0
- package/dist/types/components/MultiSelect.d.ts +68 -0
- package/dist/types/components/SaveChangesAlert.d.ts +8 -0
- package/dist/types/components/UnauthorizedPage.d.ts +7 -0
- package/dist/types/components/index.d.ts +9 -0
- package/dist/types/components/minimal-tiptap/components/bubble-menu/link-bubble-menu.d.ts +7 -0
- package/dist/types/components/minimal-tiptap/components/image/image-edit-block.d.ts +8 -0
- package/dist/types/components/minimal-tiptap/components/image/image-edit-dialog.d.ts +8 -0
- package/dist/types/components/minimal-tiptap/components/link/link-edit-block.d.ts +9 -0
- package/dist/types/components/minimal-tiptap/components/link/link-edit-popover.d.ts +8 -0
- package/dist/types/components/minimal-tiptap/components/link/link-popover-block.d.ts +8 -0
- package/dist/types/components/minimal-tiptap/components/measured-container.d.ts +2 -0
- package/dist/types/components/minimal-tiptap/components/section/five.d.ts +12 -0
- package/dist/types/components/minimal-tiptap/components/section/four.d.ts +12 -0
- package/dist/types/components/minimal-tiptap/components/section/mailingPlaceholders.d.ts +10 -0
- package/dist/types/components/minimal-tiptap/components/section/one.d.ts +11 -0
- package/dist/types/components/minimal-tiptap/components/section/three.d.ts +9 -0
- package/dist/types/components/minimal-tiptap/components/section/two.d.ts +12 -0
- package/dist/types/components/minimal-tiptap/components/shortcut-key.d.ts +5 -0
- package/dist/types/components/minimal-tiptap/components/spinner.d.ts +5 -0
- package/dist/types/components/minimal-tiptap/components/toolbar-button.d.ts +10 -0
- package/dist/types/components/minimal-tiptap/components/toolbar-section.d.ts +16 -0
- package/dist/types/components/minimal-tiptap/extensions/code-block-lowlight/code-block-lowlight.d.ts +2 -0
- package/dist/types/components/minimal-tiptap/extensions/code-block-lowlight/index.d.ts +1 -0
- package/dist/types/components/minimal-tiptap/extensions/color/color.d.ts +1 -0
- package/dist/types/components/minimal-tiptap/extensions/color/index.d.ts +1 -0
- package/dist/types/components/minimal-tiptap/extensions/file-handler/index.d.ts +12 -0
- package/dist/types/components/minimal-tiptap/extensions/horizontal-rule/horizontal-rule.d.ts +2 -0
- package/dist/types/components/minimal-tiptap/extensions/horizontal-rule/index.d.ts +1 -0
- package/dist/types/components/minimal-tiptap/extensions/image/components/image-actions.d.ts +17 -0
- package/dist/types/components/minimal-tiptap/extensions/image/components/image-overlay.d.ts +2 -0
- package/dist/types/components/minimal-tiptap/extensions/image/components/image-view-block.d.ts +3 -0
- package/dist/types/components/minimal-tiptap/extensions/image/components/resize-handle.d.ts +6 -0
- package/dist/types/components/minimal-tiptap/extensions/image/hooks/use-drag-resize.d.ts +24 -0
- package/dist/types/components/minimal-tiptap/extensions/image/hooks/use-image-actions.d.ts +24 -0
- package/dist/types/components/minimal-tiptap/extensions/image/image.d.ts +52 -0
- package/dist/types/components/minimal-tiptap/extensions/image/index.d.ts +1 -0
- package/dist/types/components/minimal-tiptap/extensions/index.d.ts +9 -0
- package/dist/types/components/minimal-tiptap/extensions/link/index.d.ts +1 -0
- package/dist/types/components/minimal-tiptap/extensions/link/link.d.ts +2 -0
- package/dist/types/components/minimal-tiptap/extensions/reset-marks-on-enter/index.d.ts +1 -0
- package/dist/types/components/minimal-tiptap/extensions/reset-marks-on-enter/reset-marks-on-enter.d.ts +2 -0
- package/dist/types/components/minimal-tiptap/extensions/selection/index.d.ts +1 -0
- package/dist/types/components/minimal-tiptap/extensions/selection/selection.d.ts +3 -0
- package/dist/types/components/minimal-tiptap/extensions/unset-all-marks/index.d.ts +1 -0
- package/dist/types/components/minimal-tiptap/extensions/unset-all-marks/unset-all-marks.d.ts +2 -0
- package/dist/types/components/minimal-tiptap/form-description-tiptap.d.ts +4 -0
- package/dist/types/components/minimal-tiptap/hooks/use-container-size.d.ts +1 -0
- package/dist/types/components/minimal-tiptap/hooks/use-minimal-tiptap.d.ts +13 -0
- package/dist/types/components/minimal-tiptap/hooks/use-theme.d.ts +2 -0
- package/dist/types/components/minimal-tiptap/hooks/use-throttle.d.ts +1 -0
- package/dist/types/components/minimal-tiptap/index.d.ts +1 -0
- package/dist/types/components/minimal-tiptap/mailing-tiptap.d.ts +13 -0
- package/dist/types/components/minimal-tiptap/minimal-tiptap.d.ts +12 -0
- package/dist/types/components/minimal-tiptap/types.d.ts +25 -0
- package/dist/types/components/minimal-tiptap/utils.d.ts +38 -0
- package/dist/types/components/table/GroupActionDialog.d.ts +11 -0
- package/dist/types/components/table/SortableHeader.d.ts +4 -0
- package/dist/types/components/ui/sidebar.d.ts +2 -2
- package/dist/types/hooks/use-toast.d.ts +1 -1
- package/dist/types/index.d.ts +1 -0
- package/package.json +24 -2
- package/src/index.css +1 -2
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { TooltipContentProps } from '@radix-ui/react-tooltip';
|
|
3
|
+
import { Toggle } from '../../../../components/ui/toggle';
|
|
4
|
+
interface ToolbarButtonProps extends React.ComponentPropsWithoutRef<typeof Toggle> {
|
|
5
|
+
isActive?: boolean;
|
|
6
|
+
tooltip?: string;
|
|
7
|
+
tooltipOptions?: TooltipContentProps;
|
|
8
|
+
}
|
|
9
|
+
export declare const ToolbarButton: React.ForwardRefExoticComponent<ToolbarButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
10
|
+
export default ToolbarButton;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { Editor } from '@tiptap/react';
|
|
3
|
+
import type { FormatAction } from '../types';
|
|
4
|
+
import type { VariantProps } from 'class-variance-authority';
|
|
5
|
+
import type { toggleVariants } from '../../../../components/ui/toggle';
|
|
6
|
+
interface ToolbarSectionProps extends VariantProps<typeof toggleVariants> {
|
|
7
|
+
editor: Editor;
|
|
8
|
+
actions: FormatAction[];
|
|
9
|
+
activeActions?: string[];
|
|
10
|
+
mainActionCount?: number;
|
|
11
|
+
dropdownIcon?: React.ReactNode;
|
|
12
|
+
dropdownTooltip?: string;
|
|
13
|
+
dropdownClassName?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const ToolbarSection: React.FC<ToolbarSectionProps>;
|
|
16
|
+
export default ToolbarSection;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './code-block-lowlight';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Color: import("@tiptap/core").Extension<import("@tiptap/extension-color").ColorOptions, any>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './color';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Editor, Extension } from '@tiptap/react';
|
|
2
|
+
import { PluginKey } from '@tiptap/pm/state';
|
|
3
|
+
import type { FileError, FileValidationOptions } from '../../utils';
|
|
4
|
+
type FileHandlePluginOptions = {
|
|
5
|
+
key?: PluginKey;
|
|
6
|
+
editor: Editor;
|
|
7
|
+
onPaste?: (editor: Editor, files: File[], pasteContent?: string) => void;
|
|
8
|
+
onDrop?: (editor: Editor, files: File[], pos: number) => void;
|
|
9
|
+
onValidationError?: (errors: FileError[]) => void;
|
|
10
|
+
} & FileValidationOptions;
|
|
11
|
+
export declare const FileHandler: Extension<Omit<FileHandlePluginOptions, "key" | "editor">, any>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './horizontal-rule';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface ImageActionsProps {
|
|
3
|
+
shouldMerge?: boolean;
|
|
4
|
+
isLink?: boolean;
|
|
5
|
+
onView?: () => void;
|
|
6
|
+
onDownload?: () => void;
|
|
7
|
+
onCopy?: () => void;
|
|
8
|
+
onCopyLink?: () => void;
|
|
9
|
+
}
|
|
10
|
+
interface ActionButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
11
|
+
icon: React.ReactNode;
|
|
12
|
+
tooltip: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const ActionWrapper: React.MemoExoticComponent<React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>>;
|
|
15
|
+
export declare const ActionButton: React.MemoExoticComponent<React.ForwardRefExoticComponent<ActionButtonProps & React.RefAttributes<HTMLButtonElement>>>;
|
|
16
|
+
export declare const ImageActions: React.FC<ImageActionsProps>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
type ResizeDirection = 'left' | 'right';
|
|
2
|
+
export type ElementDimensions = {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
};
|
|
6
|
+
type HookParams = {
|
|
7
|
+
initialWidth?: number;
|
|
8
|
+
initialHeight?: number;
|
|
9
|
+
contentWidth?: number;
|
|
10
|
+
contentHeight?: number;
|
|
11
|
+
gridInterval: number;
|
|
12
|
+
minWidth: number;
|
|
13
|
+
minHeight: number;
|
|
14
|
+
maxWidth: number;
|
|
15
|
+
onDimensionsChange?: (dimensions: ElementDimensions) => void;
|
|
16
|
+
};
|
|
17
|
+
export declare function useDragResize({ initialWidth, initialHeight, contentWidth, contentHeight, gridInterval, minWidth, minHeight, maxWidth, onDimensionsChange }: HookParams): {
|
|
18
|
+
initiateResize: (direction: ResizeDirection) => (event: React.PointerEvent<HTMLDivElement>) => void;
|
|
19
|
+
isResizing: boolean;
|
|
20
|
+
updateDimensions: import("react").Dispatch<import("react").SetStateAction<ElementDimensions>>;
|
|
21
|
+
currentWidth: number;
|
|
22
|
+
currentHeight: number;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/react';
|
|
2
|
+
import type { Node } from '@tiptap/pm/model';
|
|
3
|
+
interface UseImageActionsProps {
|
|
4
|
+
editor: Editor;
|
|
5
|
+
node: Node;
|
|
6
|
+
src: string;
|
|
7
|
+
onViewClick: (value: boolean) => void;
|
|
8
|
+
}
|
|
9
|
+
export type ImageActionHandlers = {
|
|
10
|
+
onView?: () => void;
|
|
11
|
+
onDownload?: () => void;
|
|
12
|
+
onCopy?: () => void;
|
|
13
|
+
onCopyLink?: () => void;
|
|
14
|
+
onRemoveImg?: () => void;
|
|
15
|
+
};
|
|
16
|
+
export declare const useImageActions: ({ editor, node, src, onViewClick }: UseImageActionsProps) => {
|
|
17
|
+
isLink: boolean;
|
|
18
|
+
onView: () => void;
|
|
19
|
+
onDownload: () => void;
|
|
20
|
+
onCopy: () => void;
|
|
21
|
+
onCopyLink: () => void;
|
|
22
|
+
onRemoveImg: () => void;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ImageOptions } from '@tiptap/extension-image';
|
|
2
|
+
import type { Editor } from '@tiptap/react';
|
|
3
|
+
import { type FileError, type FileValidationOptions } from '../../utils';
|
|
4
|
+
import type { Attrs } from '@tiptap/pm/model';
|
|
5
|
+
type ImageAction = 'download' | 'copyImage' | 'copyLink';
|
|
6
|
+
interface DownloadImageCommandProps {
|
|
7
|
+
src: string;
|
|
8
|
+
alt?: string;
|
|
9
|
+
}
|
|
10
|
+
interface ImageActionProps extends DownloadImageCommandProps {
|
|
11
|
+
action: ImageAction;
|
|
12
|
+
}
|
|
13
|
+
export type UploadReturnType = string | {
|
|
14
|
+
id: string | number;
|
|
15
|
+
src: string;
|
|
16
|
+
};
|
|
17
|
+
interface CustomImageOptions extends ImageOptions, Omit<FileValidationOptions, 'allowBase64'> {
|
|
18
|
+
uploadFn?: (file: File, editor: Editor) => Promise<UploadReturnType>;
|
|
19
|
+
onImageRemoved?: (props: Attrs) => void;
|
|
20
|
+
onActionSuccess?: (props: ImageActionProps) => void;
|
|
21
|
+
onActionError?: (error: Error, props: ImageActionProps) => void;
|
|
22
|
+
downloadImage?: (props: ImageActionProps, options: CustomImageOptions) => Promise<void>;
|
|
23
|
+
copyImage?: (props: ImageActionProps, options: CustomImageOptions) => Promise<void>;
|
|
24
|
+
copyLink?: (props: ImageActionProps, options: CustomImageOptions) => Promise<void>;
|
|
25
|
+
onValidationError?: (errors: FileError[]) => void;
|
|
26
|
+
onToggle?: (editor: Editor, files: File[], pos: number) => void;
|
|
27
|
+
}
|
|
28
|
+
declare module '@tiptap/react' {
|
|
29
|
+
interface Commands<ReturnType> {
|
|
30
|
+
setImages: {
|
|
31
|
+
setImages: (attrs: {
|
|
32
|
+
src: string | File;
|
|
33
|
+
alt?: string;
|
|
34
|
+
title?: string;
|
|
35
|
+
}[]) => ReturnType;
|
|
36
|
+
};
|
|
37
|
+
downloadImage: {
|
|
38
|
+
downloadImage: (attrs: DownloadImageCommandProps) => ReturnType;
|
|
39
|
+
};
|
|
40
|
+
copyImage: {
|
|
41
|
+
copyImage: (attrs: DownloadImageCommandProps) => ReturnType;
|
|
42
|
+
};
|
|
43
|
+
copyLink: {
|
|
44
|
+
copyLink: (attrs: DownloadImageCommandProps) => ReturnType;
|
|
45
|
+
};
|
|
46
|
+
toggleImage: {
|
|
47
|
+
toggleImage: () => ReturnType;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export declare const Image: import("@tiptap/react").Node<CustomImageOptions, any>;
|
|
52
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './image';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './code-block-lowlight';
|
|
2
|
+
export * from './color';
|
|
3
|
+
export * from './horizontal-rule';
|
|
4
|
+
export * from './image';
|
|
5
|
+
export * from './link';
|
|
6
|
+
export * from './selection';
|
|
7
|
+
export * from './unset-all-marks';
|
|
8
|
+
export * from './reset-marks-on-enter';
|
|
9
|
+
export * from './file-handler';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './link';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './reset-marks-on-enter';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './selection';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './unset-all-marks';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useContainerSize(element: HTMLElement | null): DOMRect;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/react';
|
|
2
|
+
import type { Content, UseEditorOptions } from '@tiptap/react';
|
|
3
|
+
export interface UseMinimalTiptapEditorProps extends UseEditorOptions {
|
|
4
|
+
value?: Content;
|
|
5
|
+
output?: 'html' | 'json' | 'text';
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
editorClassName?: string;
|
|
8
|
+
throttleDelay?: number;
|
|
9
|
+
onUpdate?: (content: Content) => void;
|
|
10
|
+
onBlur?: (content: Content) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const useMinimalTiptapEditor: ({ value, output, placeholder, editorClassName, throttleDelay, onUpdate, onBlur, ...props }: UseMinimalTiptapEditorProps) => Editor | null;
|
|
13
|
+
export default useMinimalTiptapEditor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useThrottle<T extends (...args: any[]) => void>(callback: T, delay: number): (...args: Parameters<T>) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './minimal-tiptap';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import './styles/index.css';
|
|
3
|
+
import type { Content } from '@tiptap/react';
|
|
4
|
+
import type { UseMinimalTiptapEditorProps } from './hooks/use-minimal-tiptap';
|
|
5
|
+
export interface MailingTiptapProps extends Omit<UseMinimalTiptapEditorProps, 'onUpdate'> {
|
|
6
|
+
value?: Content;
|
|
7
|
+
onChange?: (value: Content) => void;
|
|
8
|
+
className?: string;
|
|
9
|
+
editorContentClassName?: string;
|
|
10
|
+
placeholders: string[];
|
|
11
|
+
}
|
|
12
|
+
export declare const MailingTiptapEditor: React.ForwardRefExoticComponent<MailingTiptapProps & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
export default MailingTiptapEditor;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import './styles/index.css';
|
|
3
|
+
import type { Content } from '@tiptap/react';
|
|
4
|
+
import type { UseMinimalTiptapEditorProps } from './hooks/use-minimal-tiptap';
|
|
5
|
+
export interface MinimalTiptapProps extends Omit<UseMinimalTiptapEditorProps, 'onUpdate'> {
|
|
6
|
+
value?: Content;
|
|
7
|
+
onChange?: (value: Content) => void;
|
|
8
|
+
className?: string;
|
|
9
|
+
editorContentClassName?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const MinimalTiptapEditor: React.ForwardRefExoticComponent<MinimalTiptapProps & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
export default MinimalTiptapEditor;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/react';
|
|
2
|
+
import type { EditorView } from '@tiptap/pm/view';
|
|
3
|
+
import type { EditorState } from '@tiptap/pm/state';
|
|
4
|
+
export interface LinkProps {
|
|
5
|
+
url: string;
|
|
6
|
+
text?: string;
|
|
7
|
+
openInNewTab?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface ShouldShowProps {
|
|
10
|
+
editor: Editor;
|
|
11
|
+
view: EditorView;
|
|
12
|
+
state: EditorState;
|
|
13
|
+
oldState?: EditorState;
|
|
14
|
+
from: number;
|
|
15
|
+
to: number;
|
|
16
|
+
}
|
|
17
|
+
export interface FormatAction {
|
|
18
|
+
label: string;
|
|
19
|
+
icon?: React.ReactNode;
|
|
20
|
+
action: (editor: Editor) => void;
|
|
21
|
+
isActive: (editor: Editor) => boolean;
|
|
22
|
+
canExecute: (editor: Editor) => boolean;
|
|
23
|
+
shortcuts: string[];
|
|
24
|
+
value: string;
|
|
25
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/react';
|
|
2
|
+
import type { MinimalTiptapProps } from './minimal-tiptap';
|
|
3
|
+
type ShortcutKeyResult = {
|
|
4
|
+
symbol: string;
|
|
5
|
+
readable: string;
|
|
6
|
+
};
|
|
7
|
+
export type FileError = {
|
|
8
|
+
file: File | string;
|
|
9
|
+
reason: 'type' | 'size' | 'invalidBase64' | 'base64NotAllowed';
|
|
10
|
+
};
|
|
11
|
+
export type FileValidationOptions = {
|
|
12
|
+
allowedMimeTypes: string[];
|
|
13
|
+
maxFileSize?: number;
|
|
14
|
+
allowBase64: boolean;
|
|
15
|
+
};
|
|
16
|
+
type FileInput = File | {
|
|
17
|
+
src: string | File;
|
|
18
|
+
alt?: string;
|
|
19
|
+
title?: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const isClient: () => boolean;
|
|
22
|
+
export declare const isServer: () => boolean;
|
|
23
|
+
export declare const isMacOS: () => boolean;
|
|
24
|
+
export declare const getShortcutKey: (key: string) => ShortcutKeyResult;
|
|
25
|
+
export declare const getShortcutKeys: (keys: string[]) => ShortcutKeyResult[];
|
|
26
|
+
export declare const getOutput: (editor: Editor, format: MinimalTiptapProps["output"]) => object | string;
|
|
27
|
+
export declare const isUrl: (text: string, options?: {
|
|
28
|
+
requireHostname: boolean;
|
|
29
|
+
allowBase64?: boolean;
|
|
30
|
+
}) => boolean;
|
|
31
|
+
export declare const sanitizeUrl: (url: string | null | undefined, options?: {
|
|
32
|
+
allowBase64?: boolean;
|
|
33
|
+
}) => string | undefined;
|
|
34
|
+
export declare const blobUrlToBase64: (blobUrl: string) => Promise<string>;
|
|
35
|
+
export declare const randomId: () => string;
|
|
36
|
+
export declare const fileToBase64: (file: File | Blob) => Promise<string>;
|
|
37
|
+
export declare const filterFiles: <T extends FileInput>(files: T[], options: FileValidationOptions) => [T[], FileError[]];
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface ActionDialogProps {
|
|
2
|
+
title: string;
|
|
3
|
+
description: string;
|
|
4
|
+
confirmLabel: string;
|
|
5
|
+
confirmVariant?: 'default' | 'destructive';
|
|
6
|
+
isOpen: boolean;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
onConfirm: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const ActionDialog: ({ title, description, confirmLabel, confirmVariant, isOpen, onClose, onConfirm, }: ActionDialogProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { VariantProps } from 'class-variance-authority';
|
|
3
|
-
import { TooltipContent } from '
|
|
3
|
+
import { TooltipContent } from '../../../components/ui/tooltip';
|
|
4
4
|
type SidebarContext = {
|
|
5
5
|
state: 'expanded' | 'collapsed';
|
|
6
6
|
open: boolean;
|
|
@@ -22,7 +22,7 @@ declare const Sidebar: React.ForwardRefExoticComponent<Omit<React.ClassAttribute
|
|
|
22
22
|
variant?: "sidebar" | "floating" | "inset";
|
|
23
23
|
collapsible?: "offcanvas" | "icon" | "none";
|
|
24
24
|
}, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
25
|
-
declare const SidebarTrigger: React.ForwardRefExoticComponent<Omit<import("
|
|
25
|
+
declare const SidebarTrigger: React.ForwardRefExoticComponent<Omit<import("../../../components/ui/button").ButtonProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
26
26
|
declare const SidebarRail: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
27
27
|
declare const SidebarInset: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
28
28
|
declare const SidebarInput: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { ToastActionElement, ToastProps } from '
|
|
2
|
+
import type { ToastActionElement, ToastProps } from '../../components/ui/toast';
|
|
3
3
|
type ToasterToast = ToastProps & {
|
|
4
4
|
id: string;
|
|
5
5
|
title?: React.ReactNode;
|
package/dist/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tumaet/prompt-ui-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/ls1intum/prompt-lib.git"
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"src/index.css"
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
|
-
"build:esm": "tsc --project tsconfig.json",
|
|
24
|
+
"build:esm": "tsc --project tsconfig.json && tsc-alias",
|
|
25
25
|
"build:css": "postcss src/index.css -o dist/index.css",
|
|
26
26
|
"build": "yarn build:esm && yarn build:css",
|
|
27
27
|
"lint": "eslint \"**/*.{js,jsx,ts,tsx}\""
|
|
@@ -50,10 +50,28 @@
|
|
|
50
50
|
"@radix-ui/react-toggle": "^1.1.0",
|
|
51
51
|
"@radix-ui/react-toggle-group": "^1.1.0",
|
|
52
52
|
"@radix-ui/react-tooltip": "^1.1.4",
|
|
53
|
+
"@tiptap/core": "^2.11.7",
|
|
54
|
+
"@tiptap/extension-code-block": "^2.11.7",
|
|
55
|
+
"@tiptap/extension-code-block-lowlight": "^2.11.7",
|
|
56
|
+
"@tiptap/extension-color": "^2.11.7",
|
|
57
|
+
"@tiptap/extension-heading": "^2.11.7",
|
|
58
|
+
"@tiptap/extension-horizontal-rule": "^2.11.7",
|
|
59
|
+
"@tiptap/extension-image": "^2.11.7",
|
|
60
|
+
"@tiptap/extension-link": "^2.11.7",
|
|
61
|
+
"@tiptap/extension-placeholder": "^2.11.7",
|
|
62
|
+
"@tiptap/extension-text-style": "^2.11.7",
|
|
63
|
+
"@tiptap/extension-typography": "^2.11.7",
|
|
64
|
+
"@tiptap/extension-underline": "^2.11.7",
|
|
65
|
+
"@tiptap/pm": "^2.11.7",
|
|
66
|
+
"@tiptap/react": "^2.11.7",
|
|
67
|
+
"@tiptap/starter-kit": "^2.11.7",
|
|
68
|
+
"@tumaet/prompt-shared-state": "^0.0.21",
|
|
53
69
|
"class-variance-authority": "^0.7.0",
|
|
54
70
|
"clsx": "^2.1.1",
|
|
55
71
|
"cmdk": "1.0.0",
|
|
56
72
|
"date-fns": "^4.1.0",
|
|
73
|
+
"highlight.js": "^11.11.1",
|
|
74
|
+
"lowlight": "^3.3.0",
|
|
57
75
|
"lucide-react": "^0.503.0",
|
|
58
76
|
"postcss": "^8.5.3",
|
|
59
77
|
"postcss-preset-env": "^10.1.6",
|
|
@@ -61,8 +79,12 @@
|
|
|
61
79
|
"react-day-picker": "8.10.1",
|
|
62
80
|
"react-dom": "^18.3.1",
|
|
63
81
|
"react-hook-form": "^7.53.2",
|
|
82
|
+
"react-medium-image-zoom": "^5.2.14",
|
|
83
|
+
"react-router-dom": "^7.5.2",
|
|
64
84
|
"recharts": "^2.15.3",
|
|
85
|
+
"sonner": "^2.0.3",
|
|
65
86
|
"tailwind-merge": "^2.5.4",
|
|
87
|
+
"tsc-alias": "^1.8.15",
|
|
66
88
|
"typescript": "^5.7.3"
|
|
67
89
|
},
|
|
68
90
|
"devDependencies": {
|