@veevarts/design-system 0.1.17 → 0.1.19
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/index.cjs +106 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +17284 -153
- package/dist/patterns/RichText/RichText.d.ts +105 -0
- package/dist/patterns/RichText/RichText.test.d.ts +1 -0
- package/dist/patterns/RichText/TipTapArea/TipTapArea.d.ts +60 -0
- package/dist/patterns/RichText/commands/index.d.ts +5 -0
- package/dist/patterns/RichText/commands/registry.d.ts +14 -0
- package/dist/patterns/RichText/config/colors.d.ts +39 -0
- package/dist/patterns/RichText/config/defaults.d.ts +34 -0
- package/dist/patterns/RichText/config/icons.d.ts +26 -0
- package/dist/patterns/RichText/config/index.d.ts +7 -0
- package/dist/patterns/RichText/core/TipTapEditor.d.ts +7 -0
- package/dist/patterns/RichText/core/TipTapEditor.test.d.ts +1 -0
- package/dist/patterns/RichText/examples/ControlledExample.d.ts +1 -0
- package/dist/patterns/RichText/examples/FormWithValidationExample.d.ts +1 -0
- package/dist/patterns/RichText/extensions/index.d.ts +22 -0
- package/dist/patterns/RichText/extensions/registry.d.ts +19 -0
- package/dist/patterns/RichText/index.d.ts +11 -0
- package/dist/patterns/RichText/presets.d.ts +36 -0
- package/dist/patterns/RichText/toolbar/Toolbar.d.ts +34 -0
- package/dist/patterns/RichText/toolbar/ToolbarDivider.d.ts +15 -0
- package/dist/patterns/RichText/toolbar/ToolbarSection.d.ts +29 -0
- package/dist/patterns/RichText/toolbar/components/ColorPalette.d.ts +28 -0
- package/dist/patterns/RichText/toolbar/components/ColorPicker.d.ts +29 -0
- package/dist/patterns/RichText/toolbar/components/CustomColorInput.d.ts +28 -0
- package/dist/patterns/RichText/toolbar/components/HeadingDropdown.d.ts +21 -0
- package/dist/patterns/RichText/toolbar/components/ListDropdown.d.ts +20 -0
- package/dist/patterns/RichText/toolbar/components/ToolbarButton.d.ts +40 -0
- package/dist/patterns/RichText/toolbar/components/ZoomControls.d.ts +35 -0
- package/dist/patterns/RichText/toolbar/components/index.d.ts +17 -0
- package/dist/patterns/RichText/toolbar/hooks/index.d.ts +6 -0
- package/dist/patterns/RichText/toolbar/hooks/useToolbarCommands.d.ts +14 -0
- package/dist/patterns/RichText/toolbar/hooks/useToolbarState.d.ts +14 -0
- package/dist/patterns/RichText/toolbar/hooks/useZoomState.d.ts +21 -0
- package/dist/patterns/RichText/toolbar/index.d.ts +12 -0
- package/dist/patterns/RichText/toolbar/sections/TextFormattingSection.d.ts +7 -0
- package/dist/patterns/RichText/types/commands.d.ts +68 -0
- package/dist/patterns/RichText/types/extensions.d.ts +71 -0
- package/dist/patterns/RichText/types/index.d.ts +14 -0
- package/dist/patterns/RichText/types/marks.d.ts +86 -0
- package/dist/patterns/RichText/types/modifiers.d.ts +125 -0
- package/dist/patterns/RichText/types/nodes.d.ts +80 -0
- package/dist/patterns/RichText/types/props.d.ts +151 -0
- package/dist/patterns/RichText/types/toolbar.d.ts +88 -0
- package/dist/patterns/Stepper/Stepper.d.ts +2 -2
- package/dist/patterns/index.d.ts +2 -0
- package/package.json +15 -3
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import { Textarea } from '@heroui/react';
|
|
3
|
+
import { ModifierIdentifier } from './modifiers';
|
|
4
|
+
/**
|
|
5
|
+
* Editor content configuration props
|
|
6
|
+
*/
|
|
7
|
+
export interface EditorContentProps {
|
|
8
|
+
/**
|
|
9
|
+
* Whether the textarea should automatically grow vertically to accommodate content
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
disableAutosize?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Minimum number of rows to show for textarea
|
|
15
|
+
* @default 10
|
|
16
|
+
*/
|
|
17
|
+
minRows?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Maximum number of rows up to which the textarea can grow
|
|
20
|
+
* @default 30
|
|
21
|
+
*/
|
|
22
|
+
maxRows?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Reuse previously computed measurements when computing height of textarea
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
cacheMeasurements?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Function invoked on textarea height change
|
|
30
|
+
*/
|
|
31
|
+
onHeightChange?: (height: number, meta: {
|
|
32
|
+
rowHeight: number;
|
|
33
|
+
}) => void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Editor counter configuration props
|
|
37
|
+
*/
|
|
38
|
+
export interface EditorCounterProps {
|
|
39
|
+
/**
|
|
40
|
+
* Show character count below editor
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
43
|
+
showCharacterCount?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Show word count below editor
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
showWordCount?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Maximum character limit
|
|
51
|
+
*/
|
|
52
|
+
maxCharacters?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Maximum word limit
|
|
55
|
+
*/
|
|
56
|
+
maxWords?: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Editor content data structure
|
|
60
|
+
*/
|
|
61
|
+
export interface EditorContent {
|
|
62
|
+
/**
|
|
63
|
+
* HTML representation of content
|
|
64
|
+
*/
|
|
65
|
+
html: string;
|
|
66
|
+
/**
|
|
67
|
+
* JSON representation of content (ProseMirror document)
|
|
68
|
+
*/
|
|
69
|
+
json: any;
|
|
70
|
+
/**
|
|
71
|
+
* Plain text content (stripped of formatting)
|
|
72
|
+
*/
|
|
73
|
+
text: string;
|
|
74
|
+
/**
|
|
75
|
+
* Character count
|
|
76
|
+
*/
|
|
77
|
+
characters: number;
|
|
78
|
+
/**
|
|
79
|
+
* Word count
|
|
80
|
+
*/
|
|
81
|
+
words: number;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Main RichTextArea props interface
|
|
85
|
+
* This is a breaking change from the old API
|
|
86
|
+
*/
|
|
87
|
+
export interface RichTextAreaProps extends Omit<ComponentProps<typeof Textarea>, 'children'>, EditorContentProps, EditorCounterProps {
|
|
88
|
+
/**
|
|
89
|
+
* Editor adapter (future-proofing for other adapters)
|
|
90
|
+
* @default 'tiptap'
|
|
91
|
+
*/
|
|
92
|
+
adapter?: 'tiptap';
|
|
93
|
+
/**
|
|
94
|
+
* Active modifiers configuration (type-safe)
|
|
95
|
+
* Replaces the old `activeModifiers` string array
|
|
96
|
+
*
|
|
97
|
+
* @default RICH_TEXT_PRESETS.full (all modifiers enabled)
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* // Simple modifiers
|
|
101
|
+
* modifiers={['bold', 'italic', 'underline']}
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* // Complex modifiers with configuration
|
|
105
|
+
* modifiers={[
|
|
106
|
+
* 'bold',
|
|
107
|
+
* { type: 'heading', level: 2 },
|
|
108
|
+
* { type: 'textColor', color: '#FF0000' }
|
|
109
|
+
* ]}
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* // Using presets
|
|
113
|
+
* import { RICH_TEXT_PRESETS } from '@veevarts/design-system';
|
|
114
|
+
* modifiers={RICH_TEXT_PRESETS.blog}
|
|
115
|
+
*/
|
|
116
|
+
modifiers?: ModifierIdentifier[];
|
|
117
|
+
/**
|
|
118
|
+
* Whether to show the toolbar
|
|
119
|
+
* @default true
|
|
120
|
+
*/
|
|
121
|
+
showToolbar?: boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Callback when content changes
|
|
124
|
+
* Provides HTML, JSON, and text representations
|
|
125
|
+
*/
|
|
126
|
+
onContentChange?: (content: EditorContent) => void;
|
|
127
|
+
/**
|
|
128
|
+
* Initial content (HTML or JSON)
|
|
129
|
+
* Replaces `defaultValue` and `value` with a unified prop
|
|
130
|
+
*/
|
|
131
|
+
initialContent?: string | object;
|
|
132
|
+
/**
|
|
133
|
+
* Controlled content value (HTML)
|
|
134
|
+
* For controlled component usage
|
|
135
|
+
*/
|
|
136
|
+
content?: string;
|
|
137
|
+
/**
|
|
138
|
+
* Callback when editor content changes (controlled mode)
|
|
139
|
+
*/
|
|
140
|
+
onUpdate?: (content: EditorContent) => void;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Internal TipTap editor props (for core/TipTapEditor.tsx)
|
|
144
|
+
*/
|
|
145
|
+
export interface TipTapEditorProps extends RichTextAreaProps {
|
|
146
|
+
/**
|
|
147
|
+
* Editor variant style
|
|
148
|
+
* @default 'bordered'
|
|
149
|
+
*/
|
|
150
|
+
variant?: 'flat' | 'bordered' | 'faded' | 'underlined';
|
|
151
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { ModifierIdentifier, ModifierType } from './modifiers';
|
|
2
|
+
/**
|
|
3
|
+
* Toolbar section configuration
|
|
4
|
+
* Groups related modifiers together in the toolbar
|
|
5
|
+
*/
|
|
6
|
+
export interface ToolbarSectionConfig {
|
|
7
|
+
/**
|
|
8
|
+
* Unique section identifier
|
|
9
|
+
*/
|
|
10
|
+
id: string;
|
|
11
|
+
/**
|
|
12
|
+
* Modifiers to display in this section
|
|
13
|
+
*/
|
|
14
|
+
modifiers: ModifierIdentifier[];
|
|
15
|
+
/**
|
|
16
|
+
* Whether to show a divider after this section
|
|
17
|
+
* @default true
|
|
18
|
+
*/
|
|
19
|
+
showDivider?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Optional section label (for accessibility)
|
|
22
|
+
*/
|
|
23
|
+
label?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Complete toolbar configuration
|
|
27
|
+
*/
|
|
28
|
+
export interface ToolbarConfig {
|
|
29
|
+
/**
|
|
30
|
+
* Toolbar sections in order
|
|
31
|
+
*/
|
|
32
|
+
sections: ToolbarSectionConfig[];
|
|
33
|
+
/**
|
|
34
|
+
* Whether to show zoom controls
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
showZoom?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Whether toolbar should stick to top on scroll
|
|
40
|
+
* @default true
|
|
41
|
+
*/
|
|
42
|
+
stickyPosition?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Custom toolbar class names
|
|
45
|
+
*/
|
|
46
|
+
className?: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Individual toolbar button state
|
|
50
|
+
*/
|
|
51
|
+
export interface ToolbarButtonState {
|
|
52
|
+
/**
|
|
53
|
+
* Whether the button represents an active state
|
|
54
|
+
* (e.g., bold is active when cursor is in bold text)
|
|
55
|
+
*/
|
|
56
|
+
isActive: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Whether the button is disabled
|
|
59
|
+
*/
|
|
60
|
+
isDisabled: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Whether the command can be executed
|
|
63
|
+
*/
|
|
64
|
+
canExecute: boolean;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Complete toolbar state for all modifiers
|
|
68
|
+
*/
|
|
69
|
+
export type ToolbarState = Record<ModifierType, ToolbarButtonState>;
|
|
70
|
+
/**
|
|
71
|
+
* Toolbar layout preset names
|
|
72
|
+
*/
|
|
73
|
+
export type ToolbarPreset = 'simple' | 'blog' | 'documentation' | 'comment' | 'full';
|
|
74
|
+
/**
|
|
75
|
+
* Default toolbar section IDs
|
|
76
|
+
*/
|
|
77
|
+
export declare const TOOLBAR_SECTION_IDS: {
|
|
78
|
+
readonly TEXT_FORMATTING: "text-formatting";
|
|
79
|
+
readonly COLOR: "color";
|
|
80
|
+
readonly BLOCK_TYPE: "block-type";
|
|
81
|
+
readonly HEADING: "heading";
|
|
82
|
+
readonly ALIGNMENT: "alignment";
|
|
83
|
+
readonly LIST: "list";
|
|
84
|
+
readonly INSERT: "insert";
|
|
85
|
+
readonly HISTORY: "history";
|
|
86
|
+
readonly VIEW: "view";
|
|
87
|
+
};
|
|
88
|
+
export type ToolbarSectionId = (typeof TOOLBAR_SECTION_IDS)[keyof typeof TOOLBAR_SECTION_IDS];
|
|
@@ -6,7 +6,7 @@ import { default as React } from 'react';
|
|
|
6
6
|
* @interface StepperProps
|
|
7
7
|
* @extends {React.HTMLAttributes<HTMLButtonElement>}
|
|
8
8
|
*/
|
|
9
|
-
export interface StepperProps extends React.HTMLAttributes<
|
|
9
|
+
export interface StepperProps extends React.HTMLAttributes<HTMLElement> {
|
|
10
10
|
/**
|
|
11
11
|
* Optional label displayed before the stepper to provide context.
|
|
12
12
|
*
|
|
@@ -206,4 +206,4 @@ export interface StepperProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
|
206
206
|
* @see {@link StepperProps} for all available props
|
|
207
207
|
* @see {@link https://storybook.heroui.com Storybook} for interactive examples
|
|
208
208
|
*/
|
|
209
|
-
export declare const Stepper: React.ForwardRefExoticComponent<StepperProps & React.RefAttributes<
|
|
209
|
+
export declare const Stepper: React.ForwardRefExoticComponent<StepperProps & React.RefAttributes<HTMLElement>>;
|
package/dist/patterns/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { Navbar } from './Navbar';
|
|
2
2
|
export { Stepper } from './Stepper';
|
|
3
3
|
export { Footer } from './Footer';
|
|
4
|
+
export type { RichTextAreaProps } from './RichText';
|
|
5
|
+
export { RichTextArea, RICH_TEXT_PRESETS } from './RichText';
|
|
4
6
|
export type { NavbarProps, NavbarLink, NavbarLanguage } from './Navbar';
|
|
5
7
|
export type { StepperProps } from './Stepper';
|
|
6
8
|
export type { FooterProps, FooterSection, FooterLink, SocialLink } from './Footer';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veevarts/design-system",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.19",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -31,8 +31,20 @@
|
|
|
31
31
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"
|
|
35
|
-
"
|
|
34
|
+
"@tiptap/extension-color": "^2.27.0",
|
|
35
|
+
"@tiptap/extension-highlight": "^2.27.2",
|
|
36
|
+
"@tiptap/extension-link": "^2.27.2",
|
|
37
|
+
"@tiptap/extension-placeholder": "^2.27.2",
|
|
38
|
+
"@tiptap/extension-task-item": "^2.27.2",
|
|
39
|
+
"@tiptap/extension-task-list": "^2.27.2",
|
|
40
|
+
"@tiptap/extension-text-align": "^2.27.2",
|
|
41
|
+
"@tiptap/extension-underline": "^2.27.2",
|
|
42
|
+
"@tiptap/pm": "^2.27.0",
|
|
43
|
+
"@tiptap/react": "^2.27.0",
|
|
44
|
+
"@tiptap/starter-kit": "^2.27.0",
|
|
45
|
+
"lucide-react": "^0.562.0",
|
|
46
|
+
"vite-plugin-css-injected-by-js": "3.5.2",
|
|
47
|
+
"vite-plugin-dts": "4.5.4"
|
|
36
48
|
},
|
|
37
49
|
"devDependencies": {
|
|
38
50
|
"@chromatic-com/storybook": "^4.1.3",
|