@blue-patterns/richtext 0.0.0-stage → 0.7.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 (201) hide show
  1. package/CHANGELOG.md +275 -0
  2. package/LICENSE +22 -0
  3. package/README.md +88 -2
  4. package/astryx.integration.mjs +11 -0
  5. package/blocks/RichTextEditorShowcase.template.mjs +13 -0
  6. package/blocks/RichTextEditorShowcase.tsx +19 -0
  7. package/dist/RichTextEditor.d.ts +282 -0
  8. package/dist/RichTextEditor.d.ts.map +1 -0
  9. package/dist/RichTextEditor.js +657 -0
  10. package/dist/RichTextEditorAutoLinkPlugin.d.ts +83 -0
  11. package/dist/RichTextEditorAutoLinkPlugin.d.ts.map +1 -0
  12. package/dist/RichTextEditorAutoLinkPlugin.js +99 -0
  13. package/dist/RichTextEditorToolbar.d.ts +186 -0
  14. package/dist/RichTextEditorToolbar.d.ts.map +1 -0
  15. package/dist/RichTextEditorToolbar.js +688 -0
  16. package/dist/RichTextView.d.ts +92 -0
  17. package/dist/RichTextView.d.ts.map +1 -0
  18. package/dist/RichTextView.js +267 -0
  19. package/dist/codeLanguages.d.ts +14 -0
  20. package/dist/codeLanguages.d.ts.map +1 -0
  21. package/dist/codeLanguages.js +34 -0
  22. package/dist/codeLineTokens.d.ts +53 -0
  23. package/dist/codeLineTokens.d.ts.map +1 -0
  24. package/dist/codeLineTokens.js +188 -0
  25. package/dist/editorNodes.d.ts +8 -0
  26. package/dist/editorNodes.d.ts.map +1 -0
  27. package/dist/editorNodes.js +30 -0
  28. package/dist/editorTheme.d.ts +7 -0
  29. package/dist/editorTheme.d.ts.map +1 -0
  30. package/dist/editorTheme.js +328 -0
  31. package/dist/index.d.ts +31 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +28 -0
  34. package/dist/internal/CodeBackspacePlugin.d.ts +2 -0
  35. package/dist/internal/CodeBackspacePlugin.d.ts.map +1 -0
  36. package/dist/internal/CodeBackspacePlugin.js +70 -0
  37. package/dist/internal/CodeBlockHeaderPlugin.d.ts +11 -0
  38. package/dist/internal/CodeBlockHeaderPlugin.d.ts.map +1 -0
  39. package/dist/internal/CodeBlockHeaderPlugin.js +204 -0
  40. package/dist/internal/CodePastePlugin.d.ts +5 -0
  41. package/dist/internal/CodePastePlugin.d.ts.map +1 -0
  42. package/dist/internal/CodePastePlugin.js +104 -0
  43. package/dist/internal/CodeSyntaxPlugin.d.ts +8 -0
  44. package/dist/internal/CodeSyntaxPlugin.d.ts.map +1 -0
  45. package/dist/internal/CodeSyntaxPlugin.js +397 -0
  46. package/dist/internal/CodeTabPlugin.d.ts +2 -0
  47. package/dist/internal/CodeTabPlugin.d.ts.map +1 -0
  48. package/dist/internal/CodeTabPlugin.js +256 -0
  49. package/dist/internal/DisabledLinkGuardPlugin.d.ts +4 -0
  50. package/dist/internal/DisabledLinkGuardPlugin.d.ts.map +1 -0
  51. package/dist/internal/DisabledLinkGuardPlugin.js +93 -0
  52. package/dist/internal/ImageSourceCaretPlugin.d.ts +3 -0
  53. package/dist/internal/ImageSourceCaretPlugin.d.ts.map +1 -0
  54. package/dist/internal/ImageSourceCaretPlugin.js +105 -0
  55. package/dist/internal/ListItemShortcutsPlugin.d.ts +6 -0
  56. package/dist/internal/ListItemShortcutsPlugin.d.ts.map +1 -0
  57. package/dist/internal/ListItemShortcutsPlugin.js +314 -0
  58. package/dist/internal/MarkdownExtensionsPlugin.d.ts +17 -0
  59. package/dist/internal/MarkdownExtensionsPlugin.d.ts.map +1 -0
  60. package/dist/internal/MarkdownExtensionsPlugin.js +185 -0
  61. package/dist/internal/SelectAllScopePlugin.d.ts +2 -0
  62. package/dist/internal/SelectAllScopePlugin.d.ts.map +1 -0
  63. package/dist/internal/SelectAllScopePlugin.js +67 -0
  64. package/dist/internal/TableColumnFloorPlugin.d.ts +12 -0
  65. package/dist/internal/TableColumnFloorPlugin.d.ts.map +1 -0
  66. package/dist/internal/TableColumnFloorPlugin.js +84 -0
  67. package/dist/internal/TablePastePlugin.d.ts +9 -0
  68. package/dist/internal/TablePastePlugin.d.ts.map +1 -0
  69. package/dist/internal/TablePastePlugin.js +183 -0
  70. package/dist/internal/TableScrollRegionPlugin.d.ts +9 -0
  71. package/dist/internal/TableScrollRegionPlugin.d.ts.map +1 -0
  72. package/dist/internal/TableScrollRegionPlugin.js +95 -0
  73. package/dist/internal/TaskCheckboxPlugin.d.ts +7 -0
  74. package/dist/internal/TaskCheckboxPlugin.d.ts.map +1 -0
  75. package/dist/internal/TaskCheckboxPlugin.js +193 -0
  76. package/dist/internal/ToolbarLinkPopover.d.ts +74 -0
  77. package/dist/internal/ToolbarLinkPopover.d.ts.map +1 -0
  78. package/dist/internal/ToolbarLinkPopover.js +292 -0
  79. package/dist/linkEditing.d.ts +6 -0
  80. package/dist/linkEditing.d.ts.map +1 -0
  81. package/dist/linkEditing.js +20 -0
  82. package/dist/linkForm.d.ts +28 -0
  83. package/dist/linkForm.d.ts.map +1 -0
  84. package/dist/linkForm.js +137 -0
  85. package/dist/linkUtils.d.ts +27 -0
  86. package/dist/linkUtils.d.ts.map +1 -0
  87. package/dist/linkUtils.js +101 -0
  88. package/dist/markdown.d.ts +17 -0
  89. package/dist/markdown.d.ts.map +1 -0
  90. package/dist/markdown.js +17 -0
  91. package/dist/markdownCharacterReferences.d.ts +135 -0
  92. package/dist/markdownCharacterReferences.d.ts.map +1 -0
  93. package/dist/markdownCharacterReferences.js +1127 -0
  94. package/dist/markdownCodeFence.d.ts +4 -0
  95. package/dist/markdownCodeFence.d.ts.map +1 -0
  96. package/dist/markdownCodeFence.js +167 -0
  97. package/dist/markdownExtensionNode.d.ts +88 -0
  98. package/dist/markdownExtensionNode.d.ts.map +1 -0
  99. package/dist/markdownExtensionNode.js +248 -0
  100. package/dist/markdownExtensions.d.ts +115 -0
  101. package/dist/markdownExtensions.d.ts.map +1 -0
  102. package/dist/markdownExtensions.js +392 -0
  103. package/dist/markdownHardLineBreak.d.ts +25 -0
  104. package/dist/markdownHardLineBreak.d.ts.map +1 -0
  105. package/dist/markdownHardLineBreak.js +59 -0
  106. package/dist/markdownHeading.d.ts +20 -0
  107. package/dist/markdownHeading.d.ts.map +1 -0
  108. package/dist/markdownHeading.js +30 -0
  109. package/dist/markdownLink.d.ts +5 -0
  110. package/dist/markdownLink.d.ts.map +1 -0
  111. package/dist/markdownLink.js +80 -0
  112. package/dist/markdownListExport.d.ts +3 -0
  113. package/dist/markdownListExport.d.ts.map +1 -0
  114. package/dist/markdownListExport.js +68 -0
  115. package/dist/markdownListIndentation.d.ts +8 -0
  116. package/dist/markdownListIndentation.d.ts.map +1 -0
  117. package/dist/markdownListIndentation.js +101 -0
  118. package/dist/markdownOrderedList.d.ts +3 -0
  119. package/dist/markdownOrderedList.d.ts.map +1 -0
  120. package/dist/markdownOrderedList.js +51 -0
  121. package/dist/markdownQuote.d.ts +22 -0
  122. package/dist/markdownQuote.d.ts.map +1 -0
  123. package/dist/markdownQuote.js +32 -0
  124. package/dist/markdownSerializers.d.ts +49 -0
  125. package/dist/markdownSerializers.d.ts.map +1 -0
  126. package/dist/markdownSerializers.js +83 -0
  127. package/dist/markdownSource.d.ts +71 -0
  128. package/dist/markdownSource.d.ts.map +1 -0
  129. package/dist/markdownSource.js +804 -0
  130. package/dist/markdownSpaceRuns.d.ts +24 -0
  131. package/dist/markdownSpaceRuns.d.ts.map +1 -0
  132. package/dist/markdownSpaceRuns.js +147 -0
  133. package/dist/markdownTable.d.ts +35 -0
  134. package/dist/markdownTable.d.ts.map +1 -0
  135. package/dist/markdownTable.js +227 -0
  136. package/dist/markdownTaskList.d.ts +48 -0
  137. package/dist/markdownTaskList.d.ts.map +1 -0
  138. package/dist/markdownTaskList.js +166 -0
  139. package/dist/markdownThematicBreak.d.ts +3 -0
  140. package/dist/markdownThematicBreak.d.ts.map +1 -0
  141. package/dist/markdownThematicBreak.js +55 -0
  142. package/dist/privateAttributes/layerPortalBoundary.stylex.d.ts +12 -0
  143. package/dist/privateAttributes/layerPortalBoundary.stylex.d.ts.map +1 -0
  144. package/dist/privateAttributes/layerPortalBoundary.stylex.js +16 -0
  145. package/dist/richtext.css +213 -0
  146. package/dist/textSemantics.d.ts +3 -0
  147. package/dist/textSemantics.d.ts.map +1 -0
  148. package/dist/textSemantics.js +87 -0
  149. package/package.json +158 -3
  150. package/src/RichTextEditor.doc.mjs +308 -0
  151. package/src/RichTextEditor.tsx +1109 -0
  152. package/src/RichTextEditorAutoLinkPlugin.doc.mjs +43 -0
  153. package/src/RichTextEditorAutoLinkPlugin.tsx +126 -0
  154. package/src/RichTextEditorToolbar.doc.mjs +92 -0
  155. package/src/RichTextEditorToolbar.tsx +871 -0
  156. package/src/RichTextView.doc.mjs +101 -0
  157. package/src/RichTextView.tsx +351 -0
  158. package/src/codeLanguages.ts +42 -0
  159. package/src/codeLineTokens.ts +241 -0
  160. package/src/doc-mjs.d.ts +23 -0
  161. package/src/editorNodes.ts +44 -0
  162. package/src/editorTheme.ts +550 -0
  163. package/src/index.ts +59 -0
  164. package/src/internal/CodeBackspacePlugin.tsx +96 -0
  165. package/src/internal/CodeBlockHeaderPlugin.tsx +282 -0
  166. package/src/internal/CodePastePlugin.tsx +144 -0
  167. package/src/internal/CodeSyntaxPlugin.tsx +493 -0
  168. package/src/internal/CodeTabPlugin.tsx +298 -0
  169. package/src/internal/DisabledLinkGuardPlugin.tsx +93 -0
  170. package/src/internal/ImageSourceCaretPlugin.tsx +159 -0
  171. package/src/internal/ListItemShortcutsPlugin.tsx +404 -0
  172. package/src/internal/MarkdownExtensionsPlugin.tsx +289 -0
  173. package/src/internal/SelectAllScopePlugin.tsx +86 -0
  174. package/src/internal/TableColumnFloorPlugin.tsx +99 -0
  175. package/src/internal/TablePastePlugin.tsx +223 -0
  176. package/src/internal/TableScrollRegionPlugin.tsx +107 -0
  177. package/src/internal/TaskCheckboxPlugin.tsx +246 -0
  178. package/src/internal/ToolbarLinkPopover.tsx +392 -0
  179. package/src/linkEditing.ts +20 -0
  180. package/src/linkForm.tsx +156 -0
  181. package/src/linkUtils.ts +106 -0
  182. package/src/markdown.ts +25 -0
  183. package/src/markdownCharacterReferences.ts +1137 -0
  184. package/src/markdownCodeFence.ts +216 -0
  185. package/src/markdownExtensionNode.ts +339 -0
  186. package/src/markdownExtensions.ts +496 -0
  187. package/src/markdownHardLineBreak.ts +73 -0
  188. package/src/markdownHeading.ts +33 -0
  189. package/src/markdownLink.ts +86 -0
  190. package/src/markdownListExport.ts +85 -0
  191. package/src/markdownListIndentation.ts +105 -0
  192. package/src/markdownOrderedList.ts +60 -0
  193. package/src/markdownQuote.ts +35 -0
  194. package/src/markdownSerializers.ts +108 -0
  195. package/src/markdownSource.ts +1045 -0
  196. package/src/markdownSpaceRuns.ts +164 -0
  197. package/src/markdownTable.ts +309 -0
  198. package/src/markdownTaskList.ts +222 -0
  199. package/src/markdownThematicBreak.ts +66 -0
  200. package/src/privateAttributes/layerPortalBoundary.stylex.ts +18 -0
  201. package/src/textSemantics.ts +104 -0
@@ -0,0 +1,282 @@
1
+ /**
2
+ * @file RichTextEditor.tsx
3
+ * @input Uses React, useId, a declared DOM boundary, Lexical (lexical + @lexical/react, composed through
4
+ * LexicalExtensionComposer), Field, VisuallyHidden, useInputStatusIcon,
5
+ * mergeProps, design tokens
6
+ * @output Exports an accessibly labelled RichTextEditor component with a flush
7
+ * top toolbar slot, configurable editable-surface minimum height, and distinct
8
+ * read-only and disabled states that follow prop changes, RichTextEditorProps,
9
+ * RichTextEditorStatus, RichTextEditorStatusType, RichTextEditorSize
10
+ * @position @blue-patterns/richtext implementation; consumed by the package index.ts and
11
+ * re-exported from @blue-patterns/richtext. Tested by RichTextEditor.test.tsx.
12
+ *
13
+ * SYNC: When modified, update these files to stay in sync:
14
+ * - /packages/richtext/src/RichTextEditor.doc.mjs (props table, features, implementation notes)
15
+ * - /packages/richtext/src/RichTextEditor.test.tsx (tests for new/changed behavior)
16
+ * - /packages/richtext/src/index.ts (exports if types change)
17
+ * - /apps/storybook/stories/RichTextEditor.stories.tsx (storybook stories)
18
+ *
19
+ * NOTE: `lexical` and `@lexical/*` are OPTIONAL peer dependencies — install them to
20
+ * use this component.
21
+ */
22
+ import { type ReactNode, type Ref } from 'react';
23
+ import { type FieldStatusVariant } from '@blue-patterns/core/Field';
24
+ import type { BaseProps } from '@blue-patterns/core';
25
+ import { type SizeValue } from '@blue-patterns/core/utils';
26
+ import type { RichTextMarkdownExtension } from './markdownExtensions.js';
27
+ import type { CodeLanguage } from '@blue-patterns/core/CodeBlock';
28
+ import { type Transformer } from '@lexical/markdown';
29
+ import { type EditorState, type Klass, type LexicalEditor, type LexicalNode } from 'lexical';
30
+ export type RichTextEditorStatusType = 'warning' | 'error' | 'success';
31
+ export type RichTextEditorSize = 'sm' | 'md' | 'lg';
32
+ export interface RichTextEditorStatus {
33
+ /** The type of status to display. */
34
+ type: RichTextEditorStatusType;
35
+ /** Optional message to display below the editor. */
36
+ message?: string;
37
+ }
38
+ /**
39
+ * Imperative handle exposed via `ref`. Lets callers focus, clear, and read the
40
+ * editor without wiring a custom plugin. Available after mount.
41
+ */
42
+ export interface RichTextEditorRef {
43
+ /**
44
+ * Move focus into the editor's editable surface. No-op when the editor is
45
+ * read-only or disabled.
46
+ */
47
+ focus: () => void;
48
+ /**
49
+ * Remove all content, resetting the editor to a single empty paragraph.
50
+ * No-op when the editor is read-only or disabled.
51
+ */
52
+ clear: () => void;
53
+ /** Read the current `EditorState`. Serialize with `.toJSON()` to persist. */
54
+ getEditorState: () => EditorState;
55
+ /**
56
+ * Serialize the current content to a Markdown string, using the same
57
+ * `transformers` the editor is configured with (so custom transformers
58
+ * layered in via the `transformers` prop are honored). Content imported
59
+ * with `markdownToEditorStateJSON` comes back as written: blocks nobody
60
+ * changed byte for byte, and only edited or added blocks in canonical
61
+ * Markdown.
62
+ */
63
+ getMarkdown: () => string;
64
+ /**
65
+ * Serialize the current content to an HTML string via
66
+ * `$generateHtmlFromNodes`. Requires a DOM (available in the browser and in
67
+ * jsdom-based tests). Useful for copy/paste, email, or non-Lexical consumers.
68
+ */
69
+ getHTML: () => string;
70
+ /**
71
+ * Access the underlying `LexicalEditor` instance for advanced use cases
72
+ * (custom commands, listeners, node transforms).
73
+ */
74
+ getEditor: () => LexicalEditor;
75
+ }
76
+ export interface RichTextEditorProps extends Omit<BaseProps, 'onChange' | 'defaultValue'> {
77
+ /**
78
+ * Imperative handle for callers that manage the editor from outside. In
79
+ * React 19 `ref` is an ordinary prop, so it is declared here rather than
80
+ * supplied by a `forwardRef` wrapper.
81
+ */
82
+ ref?: Ref<RichTextEditorRef>;
83
+ /** Label text for the editor (always rendered for accessibility). */
84
+ label: string;
85
+ /**
86
+ * Whether to visually hide the label (still accessible to screen readers).
87
+ * @default false
88
+ */
89
+ isLabelHidden?: boolean;
90
+ /** Description text displayed between the label and editor. */
91
+ description?: string;
92
+ /**
93
+ * Whether the field is optional. Mutually exclusive with isRequired.
94
+ * @default false
95
+ */
96
+ isOptional?: boolean;
97
+ /**
98
+ * Whether the field is required. Mutually exclusive with isOptional.
99
+ * @default false
100
+ */
101
+ isRequired?: boolean;
102
+ /**
103
+ * Initial serialized editor state (a JSON string produced by
104
+ * `JSON.stringify(editorState.toJSON())`), used to seed the editor on mount.
105
+ * The editor is uncontrolled: this is read once.
106
+ */
107
+ defaultValue?: string;
108
+ /**
109
+ * Callback fired when the editor content changes. Receives the current
110
+ * `EditorState` and the `LexicalEditor` instance. Serialize with
111
+ * `editorState.toJSON()` for persistence.
112
+ */
113
+ onChange?: (editorState: EditorState, editor: LexicalEditor) => void;
114
+ /** Placeholder text shown when the editor is empty. */
115
+ placeholder?: string;
116
+ /**
117
+ * Whether the editor is read-only (non-editable). The content stays at full
118
+ * opacity, in the tab order, and announced as read-only, so people can still
119
+ * reach, read, and copy it. Takes effect when changed after mount.
120
+ * @default false
121
+ */
122
+ isReadOnly?: boolean;
123
+ /**
124
+ * Whether the editor is disabled: non-editable, dimmed, out of the tab
125
+ * order, and announced as disabled. Its links do not navigate and are not
126
+ * tab stops. Wins when `isReadOnly` is also set.
127
+ * Takes effect when changed after mount.
128
+ * @default false
129
+ */
130
+ isDisabled?: boolean;
131
+ /**
132
+ * Status indicator. When set, displays a colored border. If message is
133
+ * provided, displays a message box below the editor.
134
+ */
135
+ status?: RichTextEditorStatus;
136
+ /**
137
+ * How the status message is placed relative to the editor.
138
+ * - 'attached': message overlaps directly below the editor and the status
139
+ * icon remains inside the editing surface
140
+ * - 'detached': message floats below with its own leading status icon
141
+ * - 'tooltip': no message box; the in-editor status icon becomes a focusable
142
+ * info-tip button that reveals the message
143
+ * @default 'attached'
144
+ */
145
+ statusVariant?: FieldStatusVariant | 'tooltip';
146
+ /**
147
+ * Width of the field. Numbers are treated as pixels, strings are used as-is
148
+ * (e.g. `'100%'`).
149
+ */
150
+ width?: SizeValue;
151
+ /**
152
+ * Minimum height of the editable content surface. Numbers are treated as
153
+ * pixels, strings are used as CSS lengths.
154
+ * @default '4.5rem'
155
+ */
156
+ minHeight?: SizeValue;
157
+ /** Tooltip text to display in an info icon at the end of the label. */
158
+ labelTooltip?: string;
159
+ /**
160
+ * The size of the editor, affecting internal padding.
161
+ * @default 'md'
162
+ */
163
+ size?: RichTextEditorSize;
164
+ /**
165
+ * Additional Lexical nodes to register beyond the default OSS set
166
+ * (Heading, Quote, List, Link, Code). Use this extension point to plug in
167
+ * custom nodes (e.g. mentions, images) without forking the editor.
168
+ */
169
+ nodes?: ReadonlyArray<Klass<LexicalNode>>;
170
+ /**
171
+ * Toolbar content rendered edge-to-edge at the top of the field, before the
172
+ * padded editing surface. Pass `<RichTextEditorToolbar />` here so the
173
+ * toolbar stays inside the Lexical composer while retaining correct visual
174
+ * and keyboard order.
175
+ */
176
+ toolbar?: ReactNode;
177
+ /**
178
+ * Additional Lexical plugins to render inside the composer. Use this to
179
+ * compose extra behaviour (mentions, autolink, etc.) on top of the base
180
+ * editor. Plugins receive the editor via `useLexicalComposerContext()`.
181
+ */
182
+ plugins?: ReactNode;
183
+ /**
184
+ * Whether to enable Markdown shortcut typing (e.g. `# ` for a heading,
185
+ * `- ` for a list). Uses the `transformers` prop (defaults to the standard
186
+ * `@lexical/markdown` transformers plus GFM tables). At the start of a list
187
+ * item, `- `, `1. `, or `[ ] ` switches its list between bullets, numbers,
188
+ * and tasks, and `# ` or `> ` takes a top-level item out of its list as a
189
+ * heading or a quote.
190
+ * @default true
191
+ */
192
+ hasMarkdownShortcuts?: boolean;
193
+ /**
194
+ * Markdown transformers — the single source of truth for markdown behaviour.
195
+ * Defaults to the standard `@lexical/markdown` `TRANSFORMERS` plus GFM
196
+ * tables. A custom array replaces the default, tables included.
197
+ *
198
+ * The same array drives all three markdown operations in Lexical (see the
199
+ * lexical-playground reference, where one `PLAYGROUND_TRANSFORMERS` array
200
+ * feeds each):
201
+ * - shortcut typing — `registerMarkdownShortcuts` (wired here today)
202
+ * - markdown -> state — `$convertFromMarkdownString` (future import API)
203
+ * - state -> markdown — `$convertToMarkdownString` (future `getMarkdown`)
204
+ *
205
+ * Pass a custom array to support additional node types (e.g. custom
206
+ * transformers layered in via the `nodes` extension point) consistently
207
+ * across all three. Shortcut typing is only applied when
208
+ * `hasMarkdownShortcuts` is true; the array is still the intended input for
209
+ * the serialization APIs added in later phases.
210
+ */
211
+ transformers?: ReadonlyArray<Transformer>;
212
+ /**
213
+ * Markdown plugins whose nodes this surface draws, each adopted with
214
+ * `createRichTextExtension` (spec:AST-064). A plugin node renders exactly as
215
+ * core `Markdown` renders it, and one whose plugin is not given here shows
216
+ * its source. Pass the extensions the content was converted with. Create
217
+ * them in a client module: they hold the plugins' functions, so they are not
218
+ * serializable props.
219
+ */
220
+ markdownExtensions?: ReadonlyArray<RichTextMarkdownExtension>;
221
+ /**
222
+ * CodeBlock language values a fence may name, each imported on its own,
223
+ * such as `graphql` from `@blue-patterns/core/CodeBlock/languages/graphql`,
224
+ * or made with `createCodeLanguage`. Pass the same list as `Markdown`'s
225
+ * `codeLanguages`, so reading and editing paint and label the same
226
+ * languages (spec:AST-061).
227
+ */
228
+ codeLanguages?: ReadonlyArray<CodeLanguage>;
229
+ /** Whether to automatically focus the editor on mount. @default false */
230
+ hasAutoFocus?: boolean;
231
+ /**
232
+ * Screen-reader hint describing how to move focus out of the editor, since
233
+ * Tab is bound to indentation (press Escape, then Tab). Rendered visually
234
+ * hidden and referenced from the editor's `aria-describedby`. Override it
235
+ * to change the text, or pass an empty string to omit the hint entirely
236
+ * (e.g. when the host app provides its own instructions).
237
+ * @default 'Press Escape then Tab to move focus out of the editor.', translated for the active locale
238
+ */
239
+ tabEscapeHint?: string;
240
+ /**
241
+ * Maximum number of characters. When set, a character counter
242
+ * (current/max) is displayed below the editor. Like TextArea, this does
243
+ * NOT enforce the limit natively — the counter shows error styling when the
244
+ * plain-text length exceeds the limit. Count is the editor's plain-text
245
+ * content length.
246
+ */
247
+ maxLength?: number;
248
+ /**
249
+ * The Lexical composer namespace, used for editor identity.
250
+ * @default 'astryx-editor'
251
+ */
252
+ namespace?: string;
253
+ }
254
+ /**
255
+ * A WYSIWYG rich-text editor built on Lexical, styled with Astryx design
256
+ * tokens. Ships from `@blue-patterns/richtext`. `lexical` and `@lexical/*` are
257
+ * optional peer dependencies — install them to use this component.
258
+ *
259
+ * The editor is intentionally minimal and extensible: pass `toolbar`, `nodes`,
260
+ * and `plugins` to layer richer behaviour (formatting, mentions, hover cards)
261
+ * on top without forking.
262
+ *
263
+ * The forwarded `RichTextEditorRef` exposes imperative `focus()` and `clear()`
264
+ * methods for callers that manage the editor from outside.
265
+ *
266
+ * @example
267
+ * ```
268
+ * import {RichTextEditor, type RichTextEditorRef} from '@blue-patterns/richtext';
269
+ * const ref = useRef<RichTextEditorRef>(null);
270
+ * <RichTextEditor
271
+ * ref={ref}
272
+ * label="Notes"
273
+ * placeholder="Write something..."
274
+ * onChange={state => save(JSON.stringify(state.toJSON()))}
275
+ * />
276
+ * ```
277
+ */
278
+ export declare const RichTextEditor: {
279
+ ({ label, isLabelHidden, description, isOptional, isRequired, defaultValue, onChange, placeholder, isReadOnly, isDisabled, status, statusVariant, width, minHeight, labelTooltip, size: sizeProp, nodes, toolbar, plugins, hasMarkdownShortcuts, transformers, markdownExtensions, codeLanguages, hasAutoFocus, tabEscapeHint: tabEscapeHintFromProps, maxLength, namespace, xstyle, className, style, ref, ...rest }: RichTextEditorProps): import("react").JSX.Element;
280
+ displayName: string;
281
+ };
282
+ //# sourceMappingURL=RichTextEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RichTextEditor.d.ts","sourceRoot":"","sources":["../src/RichTextEditor.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAOL,KAAK,SAAS,EACd,KAAK,GAAG,EACT,MAAM,OAAO,CAAC;AASf,OAAO,EAML,KAAK,kBAAkB,EACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAInD,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,2BAA2B,CAAC;AAyBnC,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,sBAAsB,CAAC;AACpE,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,+BAA+B,CAAC;AAMhE,OAAO,EAAC,KAAK,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAKnD,OAAO,EASL,KAAK,WAAW,EAChB,KAAK,KAAK,EACV,KAAK,aAAa,EAClB,KAAK,WAAW,EAEjB,MAAM,SAAS,CAAC;AAyJjB,MAAM,MAAM,wBAAwB,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAEvE,MAAM,MAAM,kBAAkB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEpD,MAAM,WAAW,oBAAoB;IACnC,qCAAqC;IACrC,IAAI,EAAE,wBAAwB,CAAC;IAC/B,oDAAoD;IACpD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB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