@veevarts/design-system 0.1.16 → 0.1.18

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 (57) hide show
  1. package/dist/components/Button/Button.d.ts +3 -0
  2. package/dist/components/Button/index.d.ts +2 -0
  3. package/dist/components/index.d.ts +2 -0
  4. package/dist/index.cjs +106 -1
  5. package/dist/index.d.ts +4 -2
  6. package/dist/index.js +17316 -48
  7. package/dist/patterns/RichText/RichText.d.ts +33 -0
  8. package/dist/patterns/RichText/RichText.test.d.ts +1 -0
  9. package/dist/patterns/RichText/TipTapArea/TipTapArea.d.ts +60 -0
  10. package/dist/patterns/RichText/commands/index.d.ts +5 -0
  11. package/dist/patterns/RichText/commands/registry.d.ts +14 -0
  12. package/dist/patterns/RichText/config/colors.d.ts +39 -0
  13. package/dist/patterns/RichText/config/defaults.d.ts +34 -0
  14. package/dist/patterns/RichText/config/icons.d.ts +26 -0
  15. package/dist/patterns/RichText/config/index.d.ts +7 -0
  16. package/dist/patterns/RichText/core/TipTapEditor.d.ts +7 -0
  17. package/dist/patterns/RichText/core/TipTapEditor.test.d.ts +1 -0
  18. package/dist/patterns/RichText/examples/ControlledExample.d.ts +1 -0
  19. package/dist/patterns/RichText/examples/FormWithValidationExample.d.ts +1 -0
  20. package/dist/patterns/RichText/extensions/index.d.ts +22 -0
  21. package/dist/patterns/RichText/extensions/registry.d.ts +19 -0
  22. package/dist/patterns/RichText/index.d.ts +11 -0
  23. package/dist/patterns/RichText/presets.d.ts +36 -0
  24. package/dist/patterns/RichText/toolbar/Toolbar.d.ts +34 -0
  25. package/dist/patterns/RichText/toolbar/ToolbarDivider.d.ts +15 -0
  26. package/dist/patterns/RichText/toolbar/ToolbarSection.d.ts +29 -0
  27. package/dist/patterns/RichText/toolbar/components/ColorPalette.d.ts +28 -0
  28. package/dist/patterns/RichText/toolbar/components/ColorPicker.d.ts +29 -0
  29. package/dist/patterns/RichText/toolbar/components/CustomColorInput.d.ts +28 -0
  30. package/dist/patterns/RichText/toolbar/components/HeadingDropdown.d.ts +21 -0
  31. package/dist/patterns/RichText/toolbar/components/ListDropdown.d.ts +20 -0
  32. package/dist/patterns/RichText/toolbar/components/ToolbarButton.d.ts +40 -0
  33. package/dist/patterns/RichText/toolbar/components/ZoomControls.d.ts +35 -0
  34. package/dist/patterns/RichText/toolbar/components/index.d.ts +17 -0
  35. package/dist/patterns/RichText/toolbar/hooks/index.d.ts +6 -0
  36. package/dist/patterns/RichText/toolbar/hooks/useToolbarCommands.d.ts +14 -0
  37. package/dist/patterns/RichText/toolbar/hooks/useToolbarState.d.ts +14 -0
  38. package/dist/patterns/RichText/toolbar/hooks/useZoomState.d.ts +21 -0
  39. package/dist/patterns/RichText/toolbar/index.d.ts +12 -0
  40. package/dist/patterns/RichText/toolbar/sections/TextFormattingSection.d.ts +7 -0
  41. package/dist/patterns/RichText/types/commands.d.ts +68 -0
  42. package/dist/patterns/RichText/types/extensions.d.ts +71 -0
  43. package/dist/patterns/RichText/types/index.d.ts +14 -0
  44. package/dist/patterns/RichText/types/marks.d.ts +86 -0
  45. package/dist/patterns/RichText/types/modifiers.d.ts +125 -0
  46. package/dist/patterns/RichText/types/nodes.d.ts +80 -0
  47. package/dist/patterns/RichText/types/props.d.ts +157 -0
  48. package/dist/patterns/RichText/types/toolbar.d.ts +88 -0
  49. package/dist/patterns/Stepper/Stepper.d.ts +206 -25
  50. package/dist/patterns/Stepper/Stepper.test.d.ts +4 -0
  51. package/dist/patterns/Stepper/examples/FormExampleStepper.d.ts +1 -0
  52. package/dist/patterns/Stepper/examples/InteractiveStepper.d.ts +2 -0
  53. package/dist/patterns/Stepper/examples/ValidationStepper.d.ts +1 -0
  54. package/dist/patterns/Stepper/examples/index.d.ts +3 -0
  55. package/dist/patterns/Stepper/index.d.ts +1 -1
  56. package/dist/patterns/index.d.ts +3 -1
  57. package/package.json +29 -7
@@ -0,0 +1,14 @@
1
+ import { Editor } from '@tiptap/react';
2
+ import { ModifierType, ModifierConfig } from '../../types';
3
+ /**
4
+ * Hook to execute toolbar commands
5
+ *
6
+ * @param editor - TipTap editor instance
7
+ * @returns Command execution functions
8
+ */
9
+ export declare function useToolbarCommands(editor: Editor | null): {
10
+ executeCommand: (modifierType: ModifierType, config?: ModifierConfig) => void;
11
+ toggleModifier: (modifierType: ModifierType) => void;
12
+ canExecute: (modifierType: ModifierType, config?: ModifierConfig) => boolean;
13
+ isActive: (modifierType: ModifierType, config?: ModifierConfig) => boolean;
14
+ };
@@ -0,0 +1,14 @@
1
+ import { Editor } from '@tiptap/react';
2
+ import { ModifierIdentifier, ModifierType, ToolbarState } from '../../types';
3
+ /**
4
+ * Hook to manage toolbar state for all modifiers
5
+ *
6
+ * @param editor - TipTap editor instance
7
+ * @param modifiers - Array of active modifiers
8
+ * @returns Toolbar state object with button states
9
+ */
10
+ export declare function useToolbarState(editor: Editor | null, modifiers: ModifierIdentifier[]): Partial<ToolbarState>;
11
+ /**
12
+ * Get state for a specific modifier
13
+ */
14
+ export declare function getModifierState(toolbarState: Partial<ToolbarState>, modifierType: ModifierType): import('../../types').ToolbarButtonState;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Rich Text Editor - Zoom State Hook
3
+ *
4
+ * Manages zoom level state independently of editor content.
5
+ */
6
+ /**
7
+ * Hook to manage zoom state
8
+ *
9
+ * @param initialZoom - Initial zoom percentage
10
+ * @returns Zoom state and setters
11
+ */
12
+ export declare function useZoomState(initialZoom?: number): {
13
+ zoom: number;
14
+ setZoom: (newZoom: number) => void;
15
+ zoomIn: (step?: number) => void;
16
+ zoomOut: (step?: number) => void;
17
+ resetZoom: () => void;
18
+ isMinZoom: boolean;
19
+ isMaxZoom: boolean;
20
+ isDefaultZoom: boolean;
21
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Rich Text Editor - Toolbar Exports
3
+ */
4
+ export { Toolbar } from './Toolbar';
5
+ export type { ToolbarProps } from './Toolbar';
6
+ export { ToolbarDivider } from './ToolbarDivider';
7
+ export type { ToolbarDividerProps } from './ToolbarDivider';
8
+ export { ToolbarSection } from './ToolbarSection';
9
+ export type { ToolbarSectionProps } from './ToolbarSection';
10
+ export * from './components';
11
+ export * from './hooks';
12
+ export * from './sections/TextFormattingSection';
@@ -0,0 +1,7 @@
1
+ import { Editor } from '@tiptap/react';
2
+ import { ModifierIdentifier } from '../../types';
3
+ export interface TextFormattingSectionProps {
4
+ editor: Editor | null;
5
+ modifiers: ModifierIdentifier[];
6
+ }
7
+ export declare function TextFormattingSection({ editor, modifiers }: TextFormattingSectionProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,68 @@
1
+ import { Editor } from '@tiptap/react';
2
+ import { ModifierConfig, ModifierType } from './modifiers';
3
+ /**
4
+ * Command execution context
5
+ * Provides editor instance and optional configuration
6
+ */
7
+ export interface CommandContext {
8
+ editor: Editor;
9
+ config?: ModifierConfig;
10
+ }
11
+ /**
12
+ * Command function signature
13
+ * Takes a context and executes a command on the editor
14
+ */
15
+ export type CommandFunction = (context: CommandContext) => void;
16
+ /**
17
+ * Command check function signature
18
+ * Returns whether a command can be executed or is active
19
+ */
20
+ export type CommandCheckFunction = (editor: Editor, config?: ModifierConfig) => boolean;
21
+ /**
22
+ * Complete command definition
23
+ * Includes execution, availability check, and active state check
24
+ */
25
+ export interface CommandDefinition {
26
+ /**
27
+ * Execute the command
28
+ */
29
+ execute: CommandFunction;
30
+ /**
31
+ * Check if command can be executed
32
+ * Returns false if command is disabled
33
+ */
34
+ canExecute?: CommandCheckFunction;
35
+ /**
36
+ * Check if command is currently active
37
+ * Used for button highlighting in toolbar
38
+ */
39
+ isActive?: CommandCheckFunction;
40
+ /**
41
+ * Optional keyboard shortcut
42
+ */
43
+ shortcut?: string;
44
+ /**
45
+ * Optional command label
46
+ */
47
+ label?: string;
48
+ }
49
+ /**
50
+ * Command registry mapping modifier types to their command definitions
51
+ */
52
+ export type CommandRegistry = {
53
+ [K in ModifierType]?: CommandDefinition;
54
+ };
55
+ /**
56
+ * Command execution result
57
+ */
58
+ export interface CommandResult {
59
+ success: boolean;
60
+ error?: string;
61
+ }
62
+ /**
63
+ * Command state for a specific modifier
64
+ */
65
+ export interface CommandState {
66
+ canExecute: boolean;
67
+ isActive: boolean;
68
+ }
@@ -0,0 +1,71 @@
1
+ import { Extension, Mark, Node } from '@tiptap/core';
2
+ import { ModifierType } from './modifiers';
3
+ /**
4
+ * Extension category
5
+ * Determines how the extension integrates with the editor
6
+ */
7
+ export type ExtensionCategory = 'node' | 'mark' | 'extension';
8
+ /**
9
+ * Extension configuration
10
+ * Defines how a modifier maps to a TipTap extension
11
+ */
12
+ export interface ExtensionConfig<TOptions = any> {
13
+ /**
14
+ * Extension category
15
+ */
16
+ category: ExtensionCategory;
17
+ /**
18
+ * TipTap extension class or instance
19
+ */
20
+ extension: Node | Mark | Extension;
21
+ /**
22
+ * Default options for the extension
23
+ */
24
+ defaultOptions?: TOptions;
25
+ /**
26
+ * Required extensions that must be loaded alongside this one
27
+ * (e.g., 'textColor' requires 'textStyle')
28
+ */
29
+ requiredExtensions?: ModifierType[];
30
+ /**
31
+ * Optional dependencies (extensions that enhance this one but aren't required)
32
+ */
33
+ optionalExtensions?: ModifierType[];
34
+ /**
35
+ * Priority order for loading (higher loads first)
36
+ * @default 100
37
+ */
38
+ priority?: number;
39
+ }
40
+ /**
41
+ * Extension registry map
42
+ * Maps modifier types to their extension configurations
43
+ */
44
+ export type ExtensionRegistry = {
45
+ [K in ModifierType]?: ExtensionConfig;
46
+ };
47
+ /**
48
+ * Extension factory function
49
+ * Creates an array of TipTap extensions from modifier identifiers
50
+ */
51
+ export type ExtensionFactory = (modifiers: ModifierType[]) => Array<Node | Mark | Extension>;
52
+ /**
53
+ * Extension load result
54
+ */
55
+ export interface ExtensionLoadResult {
56
+ /**
57
+ * Successfully loaded extensions
58
+ */
59
+ loaded: ModifierType[];
60
+ /**
61
+ * Extensions that failed to load
62
+ */
63
+ failed: Array<{
64
+ modifier: ModifierType;
65
+ error: string;
66
+ }>;
67
+ /**
68
+ * Extensions that were automatically added as dependencies
69
+ */
70
+ dependencies: ModifierType[];
71
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Rich Text Editor - Type System Exports
3
+ *
4
+ * Centralized exports for all type definitions.
5
+ */
6
+ export type { BlockNodeType, InlineMarkType, UtilityModifierType, ModifierType, HeadingLevel, TextAlignment, HeadingModifier, TextAlignModifier, TextColorModifier, HighlightModifier, LinkModifier, SimpleModifier, ModifierConfig, ModifierIdentifier, } from './modifiers';
7
+ export { isHeadingModifier, isTextAlignModifier, isTextColorModifier, isHighlightModifier, isLinkModifier, getModifierType, isSameModifierType, } from './modifiers';
8
+ export type { ParagraphNode, HeadingNode, BulletListNode, OrderedListNode, TaskListNode, CodeBlockNode, BlockquoteNode, HorizontalRuleNode, BlockNode, BlockNodeMap, GetBlockNode, } from './nodes';
9
+ export type { BoldMark, ItalicMark, StrikeMark, UnderlineMark, CodeMark, TextColorMark, HighlightMark, LinkMark, InlineMark, InlineMarkMap, GetInlineMark, MarkAttributes, } from './marks';
10
+ export type { CommandContext, CommandFunction, CommandCheckFunction, CommandDefinition, CommandRegistry, CommandResult, CommandState, } from './commands';
11
+ export type { ToolbarSectionConfig, ToolbarConfig, ToolbarButtonState, ToolbarState, ToolbarPreset, ToolbarSectionId, } from './toolbar';
12
+ export { TOOLBAR_SECTION_IDS } from './toolbar';
13
+ export type { ExtensionCategory, ExtensionConfig, ExtensionRegistry, ExtensionFactory, ExtensionLoadResult, } from './extensions';
14
+ export type { EditorContentProps, EditorCounterProps, EditorContent, RichTextAreaProps, TipTapEditorProps, } from './props';
@@ -0,0 +1,86 @@
1
+ import { InlineMarkType } from './modifiers';
2
+ /**
3
+ * Bold mark configuration
4
+ */
5
+ export interface BoldMark {
6
+ type: 'bold';
7
+ }
8
+ /**
9
+ * Italic mark configuration
10
+ */
11
+ export interface ItalicMark {
12
+ type: 'italic';
13
+ }
14
+ /**
15
+ * Strike mark configuration
16
+ */
17
+ export interface StrikeMark {
18
+ type: 'strike';
19
+ }
20
+ /**
21
+ * Underline mark configuration
22
+ */
23
+ export interface UnderlineMark {
24
+ type: 'underline';
25
+ }
26
+ /**
27
+ * Inline code mark configuration
28
+ */
29
+ export interface CodeMark {
30
+ type: 'code';
31
+ }
32
+ /**
33
+ * Text color mark configuration
34
+ */
35
+ export interface TextColorMark {
36
+ type: 'textColor';
37
+ attrs: {
38
+ color: string;
39
+ };
40
+ }
41
+ /**
42
+ * Highlight/background color mark configuration
43
+ */
44
+ export interface HighlightMark {
45
+ type: 'highlight';
46
+ attrs: {
47
+ color: string;
48
+ };
49
+ }
50
+ /**
51
+ * Link mark configuration
52
+ */
53
+ export interface LinkMark {
54
+ type: 'link';
55
+ attrs: {
56
+ href: string;
57
+ target?: '_blank' | '_self';
58
+ rel?: string;
59
+ class?: string;
60
+ };
61
+ }
62
+ /**
63
+ * Union of all inline mark types
64
+ */
65
+ export type InlineMark = BoldMark | ItalicMark | StrikeMark | UnderlineMark | CodeMark | TextColorMark | HighlightMark | LinkMark;
66
+ /**
67
+ * Map of inline mark type to its configuration
68
+ */
69
+ export type InlineMarkMap = {
70
+ bold: BoldMark;
71
+ italic: ItalicMark;
72
+ strike: StrikeMark;
73
+ underline: UnderlineMark;
74
+ code: CodeMark;
75
+ textColor: TextColorMark;
76
+ highlight: HighlightMark;
77
+ link: LinkMark;
78
+ };
79
+ /**
80
+ * Extract mark configuration by type
81
+ */
82
+ export type GetInlineMark<T extends InlineMarkType> = InlineMarkMap[T];
83
+ /**
84
+ * Mark attributes by type
85
+ */
86
+ export type MarkAttributes<T extends InlineMarkType> = T extends 'textColor' ? TextColorMark['attrs'] : T extends 'highlight' ? HighlightMark['attrs'] : T extends 'link' ? LinkMark['attrs'] : never;
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Rich Text Editor - Type-Safe Modifier System
3
+ *
4
+ * This file defines the core type system for the RichText editor,
5
+ * implementing strict separation between:
6
+ * - Block-level nodes (Nodos): Document structure elements
7
+ * - Inline-level marks (Marcas): Text formatting elements
8
+ * - Utility modifiers: Editor actions and behaviors
9
+ */
10
+ /**
11
+ * Block-level node types (Nodos)
12
+ * These define document structure and cannot be arbitrarily nested
13
+ */
14
+ export type BlockNodeType = 'paragraph' | 'heading' | 'bulletList' | 'orderedList' | 'taskList' | 'codeBlock' | 'blockquote' | 'horizontalRule';
15
+ /**
16
+ * Inline-level mark types (Marcas)
17
+ * These can be combined and applied to text content
18
+ */
19
+ export type InlineMarkType = 'bold' | 'italic' | 'strike' | 'underline' | 'code' | 'textColor' | 'highlight' | 'link';
20
+ /**
21
+ * Utility modifier types
22
+ * Actions that modify editor state or behavior
23
+ */
24
+ export type UtilityModifierType = 'clearMarks' | 'clearNodes' | 'undo' | 'redo' | 'hardBreak' | 'textAlign';
25
+ /**
26
+ * All possible modifier types
27
+ */
28
+ export type ModifierType = BlockNodeType | InlineMarkType | UtilityModifierType;
29
+ /**
30
+ * Heading levels (H1-H6)
31
+ */
32
+ export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
33
+ /**
34
+ * Text alignment options
35
+ */
36
+ export type TextAlignment = 'left' | 'center' | 'right' | 'justify';
37
+ /**
38
+ * Heading modifier with level specification
39
+ */
40
+ export interface HeadingModifier {
41
+ type: 'heading';
42
+ level: HeadingLevel;
43
+ }
44
+ /**
45
+ * Text alignment modifier
46
+ */
47
+ export interface TextAlignModifier {
48
+ type: 'textAlign';
49
+ alignment: TextAlignment;
50
+ }
51
+ /**
52
+ * Text color modifier
53
+ */
54
+ export interface TextColorModifier {
55
+ type: 'textColor';
56
+ color: string;
57
+ }
58
+ /**
59
+ * Highlight/background color modifier
60
+ */
61
+ export interface HighlightModifier {
62
+ type: 'highlight';
63
+ color: string;
64
+ }
65
+ /**
66
+ * Link modifier with URL and optional attributes
67
+ */
68
+ export interface LinkModifier {
69
+ type: 'link';
70
+ href: string;
71
+ target?: '_blank' | '_self';
72
+ rel?: string;
73
+ }
74
+ /**
75
+ * Simple modifier (no additional configuration needed)
76
+ */
77
+ export interface SimpleModifier {
78
+ type: Exclude<ModifierType, 'heading' | 'textAlign' | 'textColor' | 'highlight' | 'link'>;
79
+ }
80
+ /**
81
+ * Discriminated union of all modifier configurations
82
+ * This ensures type safety when working with modifiers that need configuration
83
+ */
84
+ export type ModifierConfig = HeadingModifier | TextAlignModifier | TextColorModifier | HighlightModifier | LinkModifier | SimpleModifier;
85
+ /**
86
+ * Modifier identifier - allows both simple strings and complex configurations
87
+ * This is the main type used in the component API
88
+ *
89
+ * @example
90
+ * // Simple string modifier
91
+ * 'bold'
92
+ *
93
+ * @example
94
+ * // Complex modifier with configuration
95
+ * { type: 'heading', level: 2 }
96
+ */
97
+ export type ModifierIdentifier = ModifierType | ModifierConfig;
98
+ /**
99
+ * Type guard to check if a modifier is a heading
100
+ */
101
+ export declare function isHeadingModifier(modifier: ModifierIdentifier): modifier is HeadingModifier;
102
+ /**
103
+ * Type guard to check if a modifier is text alignment
104
+ */
105
+ export declare function isTextAlignModifier(modifier: ModifierIdentifier): modifier is TextAlignModifier;
106
+ /**
107
+ * Type guard to check if a modifier is text color
108
+ */
109
+ export declare function isTextColorModifier(modifier: ModifierIdentifier): modifier is TextColorModifier;
110
+ /**
111
+ * Type guard to check if a modifier is highlight
112
+ */
113
+ export declare function isHighlightModifier(modifier: ModifierIdentifier): modifier is HighlightModifier;
114
+ /**
115
+ * Type guard to check if a modifier is a link
116
+ */
117
+ export declare function isLinkModifier(modifier: ModifierIdentifier): modifier is LinkModifier;
118
+ /**
119
+ * Extract the modifier type from a ModifierIdentifier
120
+ */
121
+ export declare function getModifierType(modifier: ModifierIdentifier): ModifierType;
122
+ /**
123
+ * Check if two modifiers are the same type
124
+ */
125
+ export declare function isSameModifierType(a: ModifierIdentifier, b: ModifierIdentifier): boolean;
@@ -0,0 +1,80 @@
1
+ import { BlockNodeType } from './modifiers';
2
+ /**
3
+ * Paragraph node configuration
4
+ */
5
+ export interface ParagraphNode {
6
+ type: 'paragraph';
7
+ }
8
+ /**
9
+ * Heading node configuration
10
+ */
11
+ export interface HeadingNode {
12
+ type: 'heading';
13
+ attrs: {
14
+ level: 1 | 2 | 3 | 4 | 5 | 6;
15
+ textAlign?: 'left' | 'center' | 'right' | 'justify';
16
+ };
17
+ }
18
+ /**
19
+ * Bullet list node configuration
20
+ */
21
+ export interface BulletListNode {
22
+ type: 'bulletList';
23
+ }
24
+ /**
25
+ * Ordered list node configuration
26
+ */
27
+ export interface OrderedListNode {
28
+ type: 'orderedList';
29
+ attrs?: {
30
+ start?: number;
31
+ };
32
+ }
33
+ /**
34
+ * Task list node configuration
35
+ */
36
+ export interface TaskListNode {
37
+ type: 'taskList';
38
+ }
39
+ /**
40
+ * Code block node configuration
41
+ */
42
+ export interface CodeBlockNode {
43
+ type: 'codeBlock';
44
+ attrs?: {
45
+ language?: string;
46
+ };
47
+ }
48
+ /**
49
+ * Blockquote node configuration
50
+ */
51
+ export interface BlockquoteNode {
52
+ type: 'blockquote';
53
+ }
54
+ /**
55
+ * Horizontal rule node configuration
56
+ */
57
+ export interface HorizontalRuleNode {
58
+ type: 'horizontalRule';
59
+ }
60
+ /**
61
+ * Union of all block node types
62
+ */
63
+ export type BlockNode = ParagraphNode | HeadingNode | BulletListNode | OrderedListNode | TaskListNode | CodeBlockNode | BlockquoteNode | HorizontalRuleNode;
64
+ /**
65
+ * Map of block node type to its configuration
66
+ */
67
+ export type BlockNodeMap = {
68
+ paragraph: ParagraphNode;
69
+ heading: HeadingNode;
70
+ bulletList: BulletListNode;
71
+ orderedList: OrderedListNode;
72
+ taskList: TaskListNode;
73
+ codeBlock: CodeBlockNode;
74
+ blockquote: BlockquoteNode;
75
+ horizontalRule: HorizontalRuleNode;
76
+ };
77
+ /**
78
+ * Extract node configuration by type
79
+ */
80
+ export type GetBlockNode<T extends BlockNodeType> = BlockNodeMap[T];
@@ -0,0 +1,157 @@
1
+ import { ComponentProps } from 'react';
2
+ import { Textarea } from '@heroui/react';
3
+ import { ModifierIdentifier } from './modifiers';
4
+ import { ToolbarConfig } from './toolbar';
5
+ /**
6
+ * Editor content configuration props
7
+ */
8
+ export interface EditorContentProps {
9
+ /**
10
+ * Whether the textarea should automatically grow vertically to accommodate content
11
+ * @default false
12
+ */
13
+ disableAutosize?: boolean;
14
+ /**
15
+ * Minimum number of rows to show for textarea
16
+ * @default 10
17
+ */
18
+ minRows?: number;
19
+ /**
20
+ * Maximum number of rows up to which the textarea can grow
21
+ * @default 30
22
+ */
23
+ maxRows?: number;
24
+ /**
25
+ * Reuse previously computed measurements when computing height of textarea
26
+ * @default false
27
+ */
28
+ cacheMeasurements?: boolean;
29
+ /**
30
+ * Function invoked on textarea height change
31
+ */
32
+ onHeightChange?: (height: number, meta: {
33
+ rowHeight: number;
34
+ }) => void;
35
+ }
36
+ /**
37
+ * Editor counter configuration props
38
+ */
39
+ export interface EditorCounterProps {
40
+ /**
41
+ * Show character count below editor
42
+ * @default false
43
+ */
44
+ showCharacterCount?: boolean;
45
+ /**
46
+ * Show word count below editor
47
+ * @default false
48
+ */
49
+ showWordCount?: boolean;
50
+ /**
51
+ * Maximum character limit
52
+ */
53
+ maxCharacters?: number;
54
+ /**
55
+ * Maximum word limit
56
+ */
57
+ maxWords?: number;
58
+ }
59
+ /**
60
+ * Editor content data structure
61
+ */
62
+ export interface EditorContent {
63
+ /**
64
+ * HTML representation of content
65
+ */
66
+ html: string;
67
+ /**
68
+ * JSON representation of content (ProseMirror document)
69
+ */
70
+ json: any;
71
+ /**
72
+ * Plain text content (stripped of formatting)
73
+ */
74
+ text: string;
75
+ /**
76
+ * Character count
77
+ */
78
+ characters: number;
79
+ /**
80
+ * Word count
81
+ */
82
+ words: number;
83
+ }
84
+ /**
85
+ * Main RichTextArea props interface
86
+ * This is a breaking change from the old API
87
+ */
88
+ export interface RichTextAreaProps extends Omit<ComponentProps<typeof Textarea>, 'children'>, EditorContentProps, EditorCounterProps {
89
+ /**
90
+ * Editor adapter (future-proofing for other adapters)
91
+ * @default 'tiptap'
92
+ */
93
+ adapter?: 'tiptap';
94
+ /**
95
+ * Active modifiers configuration (type-safe)
96
+ * Replaces the old `activeModifiers` string array
97
+ *
98
+ * @default RICH_TEXT_PRESETS.full (all modifiers enabled)
99
+ *
100
+ * @example
101
+ * // Simple modifiers
102
+ * modifiers={['bold', 'italic', 'underline']}
103
+ *
104
+ * @example
105
+ * // Complex modifiers with configuration
106
+ * modifiers={[
107
+ * 'bold',
108
+ * { type: 'heading', level: 2 },
109
+ * { type: 'textColor', color: '#FF0000' }
110
+ * ]}
111
+ *
112
+ * @example
113
+ * // Using presets
114
+ * import { RICH_TEXT_PRESETS } from '@veevarts/design-system';
115
+ * modifiers={RICH_TEXT_PRESETS.blog}
116
+ */
117
+ modifiers?: ModifierIdentifier[];
118
+ /**
119
+ * Toolbar configuration (optional custom layout)
120
+ * If not provided, a default layout will be generated from modifiers
121
+ */
122
+ toolbarConfig?: ToolbarConfig;
123
+ /**
124
+ * Whether to show the toolbar
125
+ * @default true
126
+ */
127
+ showToolbar?: boolean;
128
+ /**
129
+ * Callback when content changes
130
+ * Provides HTML, JSON, and text representations
131
+ */
132
+ onContentChange?: (content: EditorContent) => void;
133
+ /**
134
+ * Initial content (HTML or JSON)
135
+ * Replaces `defaultValue` and `value` with a unified prop
136
+ */
137
+ initialContent?: string | object;
138
+ /**
139
+ * Controlled content value (HTML)
140
+ * For controlled component usage
141
+ */
142
+ content?: string;
143
+ /**
144
+ * Callback when editor content changes (controlled mode)
145
+ */
146
+ onUpdate?: (content: EditorContent) => void;
147
+ }
148
+ /**
149
+ * Internal TipTap editor props (for core/TipTapEditor.tsx)
150
+ */
151
+ export interface TipTapEditorProps extends RichTextAreaProps {
152
+ /**
153
+ * Editor variant style
154
+ * @default 'bordered'
155
+ */
156
+ variant?: 'flat' | 'bordered' | 'faded' | 'underlined';
157
+ }