@bizapps/design-system-testing 1.6.0 → 1.7.1

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/editor.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { Editor } from '@tiptap/react';
3
+ import { Editor, JSONContent, EditorOptions } from '@tiptap/react';
4
4
  import * as _tiptap_core from '@tiptap/core';
5
5
  import { ImageOptions } from '@tiptap/extension-image';
6
6
 
@@ -164,6 +164,89 @@ interface InsertImageDialogProps {
164
164
  */
165
165
  declare function InsertImageDialog({ open, onOpenChange, labels, url, onUrlChange, alt, onAltChange, file, onFileChange, uploading, onApply, onCancel, removable, onRemove, maxSizeBytes, accept, }: InsertImageDialogProps): react.JSX.Element;
166
166
 
167
+ /**
168
+ * Whatever `useEditor` accepts in its `extensions` array.
169
+ *
170
+ * Derived from Tiptap's own option rather than imported as AnyExtension: the
171
+ * name resolves to a structurally different declaration depending on which copy
172
+ * of @tiptap/core is in scope, and the two do not assign to each other.
173
+ */
174
+ type EditorExtension = EditorOptions['extensions'][number];
175
+ /** Every string the built-in toolbar and menus need. All already translated. */
176
+ interface RichTextEditorLabels {
177
+ /** Names the editable area for assistive tech. Required — it has no visible label. */
178
+ editor: string;
179
+ bold: string;
180
+ italic: string;
181
+ heading: string;
182
+ underline: string;
183
+ strikethrough: string;
184
+ quote: string;
185
+ insertLink: string;
186
+ insertImage: string;
187
+ resizeImage: string;
188
+ lists: {
189
+ trigger: string;
190
+ bullet: string;
191
+ ordered: string;
192
+ };
193
+ table: TableMenuLabels;
194
+ highlight: string;
195
+ }
196
+ interface UseRichTextEditorOptions {
197
+ labels: RichTextEditorLabels;
198
+ /** Fires on every document change, with the current ProseMirror JSON. */
199
+ onUpdate?: (doc: JSONContent) => void;
200
+ /** Initial document. */
201
+ content?: JSONContent | string;
202
+ /** Opens the consumer's link dialog. Wire the toolbar's link button to it. */
203
+ onInsertLink?: () => void;
204
+ /** Opens the consumer's image dialog. */
205
+ onInsertImage?: () => void;
206
+ /**
207
+ * Marks and nodes this product's document contract requires — a brand font,
208
+ * a colour palette, anything a server-side whitelist validates. They are
209
+ * appended to the built-in set rather than replacing it.
210
+ */
211
+ extraExtensions?: EditorExtension[];
212
+ /**
213
+ * Extra toolbar entries, and where they go. `after` names a built-in id
214
+ * (`heading`, `highlight`, `strike`, `image`…); omit it to append at the end.
215
+ */
216
+ extraToolbar?: {
217
+ after?: string;
218
+ items: ToolbarItem[];
219
+ }[];
220
+ /** Merged on top of the built-in content styles. */
221
+ contentClassName?: string;
222
+ /** Allows data: URIs in images. Off by default: uploads belong in storage. */
223
+ allowBase64Images?: boolean;
224
+ }
225
+ interface UseRichTextEditorResult {
226
+ editor: Editor | null;
227
+ /** Ready for `<RichTextEditor items={...} />`. */
228
+ toolbar: ToolbarItem[];
229
+ /** True when the caret has no selection, so a new link needs its own text. */
230
+ linkNeedsText: boolean;
231
+ /** Reads the caret's current href — pre-fill the dialog with it. */
232
+ currentLinkHref: () => string;
233
+ /** Applies a link, inserting `text` when there is no selection to wrap. */
234
+ applyLink: (href: string, text?: string) => void;
235
+ }
236
+ /**
237
+ * Builds a configured Tiptap editor and its toolbar.
238
+ *
239
+ * Everything a rich text editor needs to behave correctly is set up here —
240
+ * Ctrl/Cmd-click on links, the accessible name for the editable area, the
241
+ * repaint-on-transaction the toolbar's pressed state depends on, the content
242
+ * styles — so a consumer cannot end up with a subtly different editor by
243
+ * forgetting one of them.
244
+ *
245
+ * What stays with the consumer is what only it can know: the marks its document
246
+ * contract allows, and the copy. Both arrive as options.
247
+ */
248
+ declare function useRichTextEditor({ labels, onUpdate, content, onInsertLink, onInsertImage, extraExtensions, extraToolbar, contentClassName, allowBase64Images, }: UseRichTextEditorOptions): UseRichTextEditorResult;
249
+
167
250
  /**
168
251
  * One entry in the palette.
169
252
  *
@@ -315,4 +398,4 @@ interface ResizableImageOptions {
315
398
  */
316
399
  declare function createResizableImage(options: ResizableImageOptions): _tiptap_core.Node<ImageOptions & ResizableImageOptions, any>;
317
400
 
318
- export { ColorMenu, type ColorMenuLabels, type ColorMenuProps, type ColorSwatch, EDITOR_CONTENT_STYLE, InsertImageDialog, type InsertImageDialogLabels, type InsertImageDialogProps, InsertLinkDialog, type InsertLinkDialogLabels, type InsertLinkDialogProps, LinkBubbleMenu, type LinkBubbleMenuLabels, type LinkBubbleMenuProps, ListMenu, type ListMenuProps, type ListOption, type ResizableImageOptions, RichTextEditor, type RichTextEditorProps, RichTextToolbar, type RichTextToolbarProps, TableMenu, type TableMenuLabels, type TableMenuProps, type ToolbarItem, createResizableImage };
401
+ export { ColorMenu, type ColorMenuLabels, type ColorMenuProps, type ColorSwatch, EDITOR_CONTENT_STYLE, InsertImageDialog, type InsertImageDialogLabels, type InsertImageDialogProps, InsertLinkDialog, type InsertLinkDialogLabels, type InsertLinkDialogProps, LinkBubbleMenu, type LinkBubbleMenuLabels, type LinkBubbleMenuProps, ListMenu, type ListMenuProps, type ListOption, type ResizableImageOptions, RichTextEditor, type RichTextEditorLabels, type RichTextEditorProps, RichTextToolbar, type RichTextToolbarProps, TableMenu, type TableMenuLabels, type TableMenuProps, type ToolbarItem, type UseRichTextEditorOptions, type UseRichTextEditorResult, createResizableImage, useRichTextEditor };
package/dist/editor.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { Editor } from '@tiptap/react';
3
+ import { Editor, JSONContent, EditorOptions } from '@tiptap/react';
4
4
  import * as _tiptap_core from '@tiptap/core';
5
5
  import { ImageOptions } from '@tiptap/extension-image';
6
6
 
@@ -164,6 +164,89 @@ interface InsertImageDialogProps {
164
164
  */
165
165
  declare function InsertImageDialog({ open, onOpenChange, labels, url, onUrlChange, alt, onAltChange, file, onFileChange, uploading, onApply, onCancel, removable, onRemove, maxSizeBytes, accept, }: InsertImageDialogProps): react.JSX.Element;
166
166
 
167
+ /**
168
+ * Whatever `useEditor` accepts in its `extensions` array.
169
+ *
170
+ * Derived from Tiptap's own option rather than imported as AnyExtension: the
171
+ * name resolves to a structurally different declaration depending on which copy
172
+ * of @tiptap/core is in scope, and the two do not assign to each other.
173
+ */
174
+ type EditorExtension = EditorOptions['extensions'][number];
175
+ /** Every string the built-in toolbar and menus need. All already translated. */
176
+ interface RichTextEditorLabels {
177
+ /** Names the editable area for assistive tech. Required — it has no visible label. */
178
+ editor: string;
179
+ bold: string;
180
+ italic: string;
181
+ heading: string;
182
+ underline: string;
183
+ strikethrough: string;
184
+ quote: string;
185
+ insertLink: string;
186
+ insertImage: string;
187
+ resizeImage: string;
188
+ lists: {
189
+ trigger: string;
190
+ bullet: string;
191
+ ordered: string;
192
+ };
193
+ table: TableMenuLabels;
194
+ highlight: string;
195
+ }
196
+ interface UseRichTextEditorOptions {
197
+ labels: RichTextEditorLabels;
198
+ /** Fires on every document change, with the current ProseMirror JSON. */
199
+ onUpdate?: (doc: JSONContent) => void;
200
+ /** Initial document. */
201
+ content?: JSONContent | string;
202
+ /** Opens the consumer's link dialog. Wire the toolbar's link button to it. */
203
+ onInsertLink?: () => void;
204
+ /** Opens the consumer's image dialog. */
205
+ onInsertImage?: () => void;
206
+ /**
207
+ * Marks and nodes this product's document contract requires — a brand font,
208
+ * a colour palette, anything a server-side whitelist validates. They are
209
+ * appended to the built-in set rather than replacing it.
210
+ */
211
+ extraExtensions?: EditorExtension[];
212
+ /**
213
+ * Extra toolbar entries, and where they go. `after` names a built-in id
214
+ * (`heading`, `highlight`, `strike`, `image`…); omit it to append at the end.
215
+ */
216
+ extraToolbar?: {
217
+ after?: string;
218
+ items: ToolbarItem[];
219
+ }[];
220
+ /** Merged on top of the built-in content styles. */
221
+ contentClassName?: string;
222
+ /** Allows data: URIs in images. Off by default: uploads belong in storage. */
223
+ allowBase64Images?: boolean;
224
+ }
225
+ interface UseRichTextEditorResult {
226
+ editor: Editor | null;
227
+ /** Ready for `<RichTextEditor items={...} />`. */
228
+ toolbar: ToolbarItem[];
229
+ /** True when the caret has no selection, so a new link needs its own text. */
230
+ linkNeedsText: boolean;
231
+ /** Reads the caret's current href — pre-fill the dialog with it. */
232
+ currentLinkHref: () => string;
233
+ /** Applies a link, inserting `text` when there is no selection to wrap. */
234
+ applyLink: (href: string, text?: string) => void;
235
+ }
236
+ /**
237
+ * Builds a configured Tiptap editor and its toolbar.
238
+ *
239
+ * Everything a rich text editor needs to behave correctly is set up here —
240
+ * Ctrl/Cmd-click on links, the accessible name for the editable area, the
241
+ * repaint-on-transaction the toolbar's pressed state depends on, the content
242
+ * styles — so a consumer cannot end up with a subtly different editor by
243
+ * forgetting one of them.
244
+ *
245
+ * What stays with the consumer is what only it can know: the marks its document
246
+ * contract allows, and the copy. Both arrive as options.
247
+ */
248
+ declare function useRichTextEditor({ labels, onUpdate, content, onInsertLink, onInsertImage, extraExtensions, extraToolbar, contentClassName, allowBase64Images, }: UseRichTextEditorOptions): UseRichTextEditorResult;
249
+
167
250
  /**
168
251
  * One entry in the palette.
169
252
  *
@@ -315,4 +398,4 @@ interface ResizableImageOptions {
315
398
  */
316
399
  declare function createResizableImage(options: ResizableImageOptions): _tiptap_core.Node<ImageOptions & ResizableImageOptions, any>;
317
400
 
318
- export { ColorMenu, type ColorMenuLabels, type ColorMenuProps, type ColorSwatch, EDITOR_CONTENT_STYLE, InsertImageDialog, type InsertImageDialogLabels, type InsertImageDialogProps, InsertLinkDialog, type InsertLinkDialogLabels, type InsertLinkDialogProps, LinkBubbleMenu, type LinkBubbleMenuLabels, type LinkBubbleMenuProps, ListMenu, type ListMenuProps, type ListOption, type ResizableImageOptions, RichTextEditor, type RichTextEditorProps, RichTextToolbar, type RichTextToolbarProps, TableMenu, type TableMenuLabels, type TableMenuProps, type ToolbarItem, createResizableImage };
401
+ export { ColorMenu, type ColorMenuLabels, type ColorMenuProps, type ColorSwatch, EDITOR_CONTENT_STYLE, InsertImageDialog, type InsertImageDialogLabels, type InsertImageDialogProps, InsertLinkDialog, type InsertLinkDialogLabels, type InsertLinkDialogProps, LinkBubbleMenu, type LinkBubbleMenuLabels, type LinkBubbleMenuProps, ListMenu, type ListMenuProps, type ListOption, type ResizableImageOptions, RichTextEditor, type RichTextEditorLabels, type RichTextEditorProps, RichTextToolbar, type RichTextToolbarProps, TableMenu, type TableMenuLabels, type TableMenuProps, type ToolbarItem, type UseRichTextEditorOptions, type UseRichTextEditorResult, createResizableImage, useRichTextEditor };