@astryxdesign/richtext 0.7.2-canary.b69b2df → 0.7.2-canary.c5f72ea

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@astryxdesign/richtext",
3
3
  "displayName": "Rich Text",
4
- "version": "0.7.2-canary.b69b2df",
4
+ "version": "0.7.2-canary.c5f72ea",
5
5
  "description": "Astryx rich text — a Lexical-based rich text editor and viewer, styled with Astryx design tokens.",
6
6
  "author": "Meta Open Source",
7
7
  "license": "MIT",
@@ -53,7 +53,7 @@
53
53
  },
54
54
  "peerDependencies": {
55
55
  "@stylexjs/stylex": ">=0.10.0",
56
- "@astryxdesign/core": "0.7.2-canary.b69b2df",
56
+ "@astryxdesign/core": "0.7.2-canary.c5f72ea",
57
57
  "react": ">=19.0.0",
58
58
  "react-dom": ">=19.0.0",
59
59
  "lexical": "^0.52.0",
@@ -112,8 +112,8 @@
112
112
  }
113
113
  },
114
114
  "devDependencies": {
115
- "@astryxdesign/a11y-spec": "0.7.2-canary.b69b2df",
116
- "@astryxdesign/cli": "0.7.2-canary.b69b2df",
115
+ "@astryxdesign/a11y-spec": "0.7.2-canary.c5f72ea",
116
+ "@astryxdesign/cli": "0.7.2-canary.c5f72ea",
117
117
  "@babel/cli": "^7.29.7",
118
118
  "@babel/core": "^7.29.7",
119
119
  "@babel/preset-react": "^7.29.7",
@@ -36,6 +36,26 @@ export const docs = {
36
36
  type: 'string',
37
37
  description: 'Description text displayed between the label and editor.',
38
38
  },
39
+ {
40
+ name: 'isOptional',
41
+ type: 'boolean',
42
+ description:
43
+ 'Displays an "Optional" indicator next to the label. Mutually exclusive with isRequired.',
44
+ default: 'false',
45
+ },
46
+ {
47
+ name: 'isRequired',
48
+ type: 'boolean',
49
+ description:
50
+ 'Displays a "Required" indicator next to the label and sets aria-required on the editable surface. Mutually exclusive with isOptional.',
51
+ default: 'false',
52
+ },
53
+ {
54
+ name: 'labelTooltip',
55
+ type: 'string',
56
+ description:
57
+ 'Tooltip text displayed in an info icon at the end of the label.',
58
+ },
39
59
  {
40
60
  name: 'defaultValue',
41
61
  type: 'string',
@@ -158,6 +178,12 @@ export const docs = {
158
178
  'Minimum height of the editable content surface. Numbers are pixels; strings are used as CSS lengths. Content continues growing beyond this height.',
159
179
  default: "'4.5rem'",
160
180
  },
181
+ {
182
+ name: 'namespace',
183
+ type: 'string',
184
+ description: 'The Lexical composer namespace, used for editor identity.',
185
+ default: "'astryx-editor'",
186
+ },
161
187
  {
162
188
  name: 'xstyle',
163
189
  type: 'StyleXStyles',
@@ -33,7 +33,11 @@ import {
33
33
  } from 'lexical';
34
34
  import {HeadingNode} from '@lexical/rich-text';
35
35
  import {TRANSFORMERS, $convertFromMarkdownString} from '@lexical/markdown';
36
- import {RichTextEditor, type RichTextEditorRef} from './RichTextEditor';
36
+ import {
37
+ RichTextEditor,
38
+ type RichTextEditorProps,
39
+ type RichTextEditorRef,
40
+ } from './RichTextEditor';
37
41
  import {RichTextView} from './RichTextView';
38
42
  import {
39
43
  markdownToEditorStateJSON,
@@ -42,6 +46,7 @@ import {
42
46
  import {RichTextEditorToolbar} from './RichTextEditorToolbar';
43
47
  import {registerIcons, resetIcons} from '@astryxdesign/core/Icon';
44
48
  import {EDGE_COMP_ATTR} from '@astryxdesign/core/Layout';
49
+ import type {BaseProps} from '@astryxdesign/core';
45
50
  import {Theme, defineTheme} from '@astryxdesign/core/theme';
46
51
  import {rtlStyles} from '@astryxdesign/core/utils';
47
52
  import {InternationalizationProvider} from '@astryxdesign/core/i18n';
@@ -289,6 +294,52 @@ const HELLO_STATE = JSON.stringify({
289
294
  });
290
295
 
291
296
  describe('RichTextEditor', () => {
297
+ it('documents every prop the editor declares', () => {
298
+ // The doc file is what `astryx component RichTextEditor` and the docsite
299
+ // read, so a prop missing from it is invisible to builders. The compile-time
300
+ // check below fails when RichTextEditorProps gains a prop this list lacks;
301
+ // the runtime check fails when the doc file lacks a listed prop.
302
+ const ownProps = [
303
+ 'label',
304
+ 'isLabelHidden',
305
+ 'description',
306
+ 'isOptional',
307
+ 'isRequired',
308
+ 'defaultValue',
309
+ 'onChange',
310
+ 'placeholder',
311
+ 'isReadOnly',
312
+ 'isDisabled',
313
+ 'status',
314
+ 'statusVariant',
315
+ 'size',
316
+ 'nodes',
317
+ 'toolbar',
318
+ 'plugins',
319
+ 'hasMarkdownShortcuts',
320
+ 'markdownExtensions',
321
+ 'transformers',
322
+ 'hasAutoFocus',
323
+ 'tabEscapeHint',
324
+ 'maxLength',
325
+ 'width',
326
+ 'minHeight',
327
+ 'labelTooltip',
328
+ 'namespace',
329
+ ] as const satisfies ReadonlyArray<keyof RichTextEditorProps>;
330
+ type Unlisted = Exclude<
331
+ keyof RichTextEditorProps,
332
+ keyof BaseProps | 'ref' | (typeof ownProps)[number]
333
+ >;
334
+ const everyPropListed: [Unlisted] extends [never] ? true : Unlisted = true;
335
+ expect(everyPropListed).toBe(true);
336
+
337
+ const docProps =
338
+ 'props' in richTextEditorDoc ? richTextEditorDoc.props : [];
339
+ const documented = new Set(docProps.map(({name}) => name));
340
+ expect(ownProps.filter(name => !documented.has(name))).toEqual([]);
341
+ });
342
+
292
343
  it('declares exactly the visual props its theme target reflects', () => {
293
344
  // The core theming guards walk packages/core/src (and Lab) only, so
294
345
  // nothing else compares this package's doc metadata with its