@veevarts/design-system 0.1.18 → 0.1.21
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/README.md +11 -1
- package/dist/index.cjs +15 -98
- package/dist/index.js +8520 -14960
- package/dist/patterns/RichText/RichText.d.ts +87 -15
- package/dist/patterns/RichText/extensions/index.d.ts +3 -1
- package/dist/patterns/RichText/index.d.ts +2 -2
- package/dist/patterns/RichText/types/props.d.ts +2 -7
- package/dist/patterns/Stepper/Stepper.d.ts +2 -2
- package/dist/patterns/index.d.ts +1 -1
- package/package.json +24 -12
|
@@ -1,33 +1,105 @@
|
|
|
1
1
|
import { RichTextAreaProps } from './types';
|
|
2
2
|
/**
|
|
3
|
-
* RichTextArea
|
|
3
|
+
* @module RichTextArea
|
|
4
|
+
* @description A powerful WYSIWYG rich text editor built on TipTap/ProseMirror.
|
|
4
5
|
*
|
|
5
|
-
*
|
|
6
|
+
* The RichTextArea component provides a flexible and customizable rich text editing experience,
|
|
7
|
+
* allowing users to format content with various modifiers like bold, italic, headings, lists, and more.
|
|
8
|
+
* It's built with a modular architecture, type-safe modifiers, and integrates with HeroUI components.
|
|
9
|
+
*
|
|
10
|
+
* @component
|
|
11
|
+
*
|
|
12
|
+
* @features
|
|
13
|
+
* - **Modular architecture**: Easily enable/disable formatting options (modifiers).
|
|
14
|
+
* - **Type-safe modifiers**: Ensures correct usage and configuration of formatting tools.
|
|
15
|
+
* - **Extensible**: Built on TipTap, allowing for custom extensions and functionality.
|
|
16
|
+
* - **Controlled & uncontrolled modes**: Supports both controlled and uncontrolled usage patterns.
|
|
17
|
+
* - **Customizable UI**: Integrates with HeroUI for consistent styling and theming.
|
|
18
|
+
* - **Word and character count**: Optional display of content statistics.
|
|
19
|
+
* - **Zoom controls**: Adjust editor font size for better readability.
|
|
20
|
+
*
|
|
21
|
+
* @accessibility
|
|
22
|
+
* - Semantic HTML structure for editor content.
|
|
23
|
+
* - Keyboard navigation support for toolbar and editor content.
|
|
24
|
+
* - ARIA attributes for enhanced screen reader compatibility (inherited from TipTap/ProseMirror).
|
|
25
|
+
*
|
|
26
|
+
* @performance
|
|
27
|
+
* - Lazy loading of animations (if applicable, though not directly in this wrapper).
|
|
28
|
+
* - Efficient rendering due to TipTap's ProseMirror foundation.
|
|
29
|
+
* - Memoization for extension creation and other heavy computations.
|
|
6
30
|
*
|
|
7
31
|
* @example
|
|
8
|
-
* //
|
|
32
|
+
* // Basic usage with default modifiers
|
|
33
|
+
* ```tsx
|
|
9
34
|
* <RichTextArea
|
|
10
|
-
* modifiers={['bold', 'italic', 'underline']}
|
|
11
35
|
* label="Content"
|
|
12
36
|
* placeholder="Start typing..."
|
|
13
37
|
* />
|
|
38
|
+
* ```
|
|
14
39
|
*
|
|
15
40
|
* @example
|
|
16
|
-
* // With
|
|
41
|
+
* // With specific modifiers
|
|
42
|
+
* ```tsx
|
|
17
43
|
* <RichTextArea
|
|
18
|
-
* modifiers={[
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* { type: 'heading', level: 3 },
|
|
22
|
-
* ]}
|
|
44
|
+
* modifiers={['bold', 'italic', { type: 'heading', level: 2 }, 'bulletList']}
|
|
45
|
+
* label="Blog Post"
|
|
46
|
+
* placeholder="Write your blog post here..."
|
|
23
47
|
* />
|
|
48
|
+
* ```
|
|
24
49
|
*
|
|
25
50
|
* @example
|
|
26
|
-
* // Using
|
|
51
|
+
* // Using a preset (e.g., for a blog)
|
|
52
|
+
* ```tsx
|
|
27
53
|
* import { RICH_TEXT_PRESETS } from '@veevarts/design-system';
|
|
28
54
|
*
|
|
29
|
-
* <RichTextArea
|
|
55
|
+
* <RichTextArea
|
|
56
|
+
* modifiers={RICH_TEXT_PRESETS.blog}
|
|
57
|
+
* label="Article Body"
|
|
58
|
+
* placeholder="Compose your article..."
|
|
59
|
+
* />
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* // Controlled component
|
|
64
|
+
* ```tsx
|
|
65
|
+
* import React, { useState } from 'react';
|
|
66
|
+
* import { RichTextArea } from '@veevarts/design-system';
|
|
67
|
+
*
|
|
68
|
+
* function MyControlledEditor() {
|
|
69
|
+
* const [content, setContent] = useState('<p>Hello <strong>world</strong>!</p>');
|
|
70
|
+
*
|
|
71
|
+
* return (
|
|
72
|
+
* <RichTextArea
|
|
73
|
+
* content={content}
|
|
74
|
+
* onContentChange={(editorContent) => setContent(editorContent.html)}
|
|
75
|
+
* label="Controlled Content"
|
|
76
|
+
* />
|
|
77
|
+
* );
|
|
78
|
+
* }
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* // With word and character count
|
|
83
|
+
* ```tsx
|
|
84
|
+
* <RichTextArea
|
|
85
|
+
* label="Description"
|
|
86
|
+
* showWordCount
|
|
87
|
+
* showCharacterCount
|
|
88
|
+
* minRows={5}
|
|
89
|
+
* />
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* // Read-only mode
|
|
94
|
+
* ```tsx
|
|
95
|
+
* <RichTextArea
|
|
96
|
+
* isReadOnly
|
|
97
|
+
* initialContent="<p>This is <strong>read-only</strong> content.</p>"
|
|
98
|
+
* label="Preview"
|
|
99
|
+
* />
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* @see {@link RichTextAreaProps} for all available props
|
|
103
|
+
* @see {@link https://tiptap.dev/docs/editor/api/editor Tiptap Editor API} for underlying editor functionality
|
|
30
104
|
*/
|
|
31
|
-
declare const RichTextArea: import('react').ForwardRefExoticComponent<Omit<RichTextAreaProps, "ref"> & import('react').RefAttributes<HTMLTextAreaElement>>;
|
|
32
|
-
export default RichTextArea;
|
|
33
|
-
export type { RichTextAreaProps };
|
|
105
|
+
export declare const RichTextArea: import('react').ForwardRefExoticComponent<Omit<RichTextAreaProps, "ref"> & import('react').RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Extension, Node, Mark } from '@tiptap/core';
|
|
2
2
|
import { ModifierIdentifier, ModifierType } from '../types';
|
|
3
|
+
type AnyExtension = Extension<unknown, unknown> | Node<unknown, unknown> | Mark<unknown, unknown>;
|
|
4
|
+
type Extensions = AnyExtension[];
|
|
3
5
|
/**
|
|
4
6
|
* Creates TipTap extensions array from modifier identifiers
|
|
5
7
|
*
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Rich Text Editor - Public API Exports
|
|
3
3
|
*/
|
|
4
|
-
export {
|
|
5
|
-
export type { RichTextAreaProps } from './
|
|
4
|
+
export { RichTextArea } from './RichText';
|
|
5
|
+
export type { RichTextAreaProps, EditorContentProps, EditorCounterProps, TipTapEditorProps } from './types';
|
|
6
6
|
export { RICH_TEXT_PRESETS, getPreset } from './presets';
|
|
7
7
|
export type { PresetName } from './presets';
|
|
8
8
|
export type { ModifierIdentifier, ModifierType, HeadingLevel, TextAlignment, HeadingModifier, TextAlignModifier, TextColorModifier, HighlightModifier, LinkModifier, EditorContent, } from './types';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentProps } from 'react';
|
|
2
2
|
import { Textarea } from '@heroui/react';
|
|
3
|
+
import { JSONContent } from '@tiptap/core';
|
|
3
4
|
import { ModifierIdentifier } from './modifiers';
|
|
4
|
-
import { ToolbarConfig } from './toolbar';
|
|
5
5
|
/**
|
|
6
6
|
* Editor content configuration props
|
|
7
7
|
*/
|
|
@@ -67,7 +67,7 @@ export interface EditorContent {
|
|
|
67
67
|
/**
|
|
68
68
|
* JSON representation of content (ProseMirror document)
|
|
69
69
|
*/
|
|
70
|
-
json:
|
|
70
|
+
json: JSONContent;
|
|
71
71
|
/**
|
|
72
72
|
* Plain text content (stripped of formatting)
|
|
73
73
|
*/
|
|
@@ -115,11 +115,6 @@ export interface RichTextAreaProps extends Omit<ComponentProps<typeof Textarea>,
|
|
|
115
115
|
* modifiers={RICH_TEXT_PRESETS.blog}
|
|
116
116
|
*/
|
|
117
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
118
|
/**
|
|
124
119
|
* Whether to show the toolbar
|
|
125
120
|
* @default true
|
|
@@ -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,8 +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';
|
|
4
5
|
export { RichTextArea, RICH_TEXT_PRESETS } from './RichText';
|
|
5
6
|
export type { NavbarProps, NavbarLink, NavbarLanguage } from './Navbar';
|
|
6
7
|
export type { StepperProps } from './Stepper';
|
|
7
8
|
export type { FooterProps, FooterSection, FooterLink, SocialLink } from './Footer';
|
|
8
|
-
export type { RichTextAreaProps } from './RichText';
|
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.21",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -26,12 +26,31 @@
|
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@heroui/react": ">=2.7.0",
|
|
29
|
+
"@tiptap/extension-color": "^2.27.0",
|
|
30
|
+
"@tiptap/extension-highlight": "^2.27.0",
|
|
31
|
+
"@tiptap/extension-link": "^2.27.0",
|
|
32
|
+
"@tiptap/extension-placeholder": "^2.27.0",
|
|
33
|
+
"@tiptap/extension-task-item": "^2.27.0",
|
|
34
|
+
"@tiptap/extension-task-list": "^2.27.0",
|
|
35
|
+
"@tiptap/extension-text-align": "^2.27.0",
|
|
36
|
+
"@tiptap/extension-underline": "^2.27.0",
|
|
37
|
+
"@tiptap/pm": "^2.27.0",
|
|
38
|
+
"@tiptap/react": "^2.27.0",
|
|
39
|
+
"@tiptap/starter-kit": "^2.27.0",
|
|
29
40
|
"framer-motion": ">=11.5.6",
|
|
41
|
+
"lucide-react": "^0.562.0",
|
|
30
42
|
"react": "^18.0.0 || ^19.0.0",
|
|
31
43
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
32
44
|
},
|
|
33
45
|
"dependencies": {
|
|
34
|
-
"
|
|
46
|
+
"vite-plugin-css-injected-by-js": "3.5.2",
|
|
47
|
+
"vite-plugin-dts": "4.5.4"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@chromatic-com/storybook": "^4.1.3",
|
|
51
|
+
"@eslint/js": "^9.39.1",
|
|
52
|
+
"@heroui/react": "^2.8.7",
|
|
53
|
+
"@tiptap/extension-color": "^2.27.0",
|
|
35
54
|
"@tiptap/extension-highlight": "^2.27.2",
|
|
36
55
|
"@tiptap/extension-link": "^2.27.2",
|
|
37
56
|
"@tiptap/extension-placeholder": "^2.27.2",
|
|
@@ -39,17 +58,10 @@
|
|
|
39
58
|
"@tiptap/extension-task-list": "^2.27.2",
|
|
40
59
|
"@tiptap/extension-text-align": "^2.27.2",
|
|
41
60
|
"@tiptap/extension-underline": "^2.27.2",
|
|
42
|
-
"@tiptap/pm": "^2.
|
|
43
|
-
"@tiptap/react": "^2.
|
|
44
|
-
"@tiptap/starter-kit": "^2.
|
|
61
|
+
"@tiptap/pm": "^2.27.0",
|
|
62
|
+
"@tiptap/react": "^2.27.0",
|
|
63
|
+
"@tiptap/starter-kit": "^2.27.0",
|
|
45
64
|
"lucide-react": "^0.562.0",
|
|
46
|
-
"vite-plugin-css-injected-by-js": "latest",
|
|
47
|
-
"vite-plugin-dts": "latest"
|
|
48
|
-
},
|
|
49
|
-
"devDependencies": {
|
|
50
|
-
"@chromatic-com/storybook": "^4.1.3",
|
|
51
|
-
"@eslint/js": "^9.39.1",
|
|
52
|
-
"@heroui/react": "^2.8.7",
|
|
53
65
|
"@storybook/addon-a11y": "^10.0.8",
|
|
54
66
|
"@storybook/addon-docs": "^10.0.8",
|
|
55
67
|
"@storybook/addon-onboarding": "^10.0.8",
|