@baseline-ui/mcp 0.62.0 → 0.63.0
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/CHANGELOG.md +2 -0
- package/dist/index.cjs +363 -108
- package/dist/index.js +363 -108
- package/package.json +6 -4
- package/sbom.json +2730 -1
package/dist/index.js
CHANGED
|
@@ -6696,7 +6696,7 @@ export const DrawerWithActionExample: React.FC<{
|
|
|
6696
6696
|
Drawer Content
|
|
6697
6697
|
</Drawer>
|
|
6698
6698
|
);
|
|
6699
|
-
};`},similarTo:[],figmaUrl:null},Editor:{id:"core-miscellaneous-editor",breadcrumb:"Core/Miscellaneous/Editor",importStatement:'import { ActionButton, Box, Editor, EditorAutoFocusOnMount, NumberInput, Separator } from "@baseline-ui/core";',description:"`Editor` is a text input area that supports either plain text or rich text with formatting, links, and @-mentions. Use it for comments, notes, descriptions, or any free-form content where users need more than a single-line input.",documentation:'`Editor` is a text input area that supports either plain text or rich text with formatting, links, and @-mentions. Use it for comments, notes, descriptions, or any free-form content where users need more than a single-line input.\n\n* supports rich text editing, including bold, italic and underline formatting.\n* supports font color and background color formatting\n* supports link creation, editing and removal\n* supports plain text editing\n* supports mouse, keyboard and touch interactions.\n* Exposed to the screen-readers and other assistive technologies using ARIA.\n* Mention support with user search and keyboard navigation\n* Keyboard shortcuts for common actions (submit, toolbar focus, help)\n* Imperative handle API (`editorHandle`) for programmatic focus and caret positioning\n* Custom footer buttons (action and toggle types)\n* Clear on save/cancel behavior\n* Auto-focus with configurable caret position\n\n```jsx\nimport { Editor } from "../../utils";\n\nfunction MyComponent() {\n return <Editor />;\n}\n```\n\nThe `Editor` component has multiple variants that can be used to customize the appearance and behavior of the component.\n\n* `default` - the default variant\n* `minimal` - a minimal variant that removes the toolbar and only allows plain text editing.\n\nIn the example above, the `variant` prop is used to set the variant to `minimal`. This removes the toolbar and only allows plain text editing.\nIn the right example, the `isInline` prop is used to set the editor to be inline.\n\nYou can enable rich text editing by setting the `enableRichText` prop to `true`. This will enable the rich text toolbar and allow users to format the text. The default value is `false`.\n\nYou can set a placeholder for the editor by using the `placeholder` prop. This will display a placeholder when the editor is empty.\n\nThe `Editor` component can be controlled by using the `value` and `onChange` props. This allows you to control the value of the editor from the parent component.\n\nThe `Editor` component can be disabled by using the `isDisabled` prop. This will disable the editor and prevent users from editing the content.\n\nThe `Editor` component supports mentions. You can enable mentions by passing `mentionableUsers` prop. This prop should be an array of objects with `id` and `name` properties. The `id` should be unique for each user and the `name` should be the name of the user.\nThe mentions feature only works when `enableRichText` is set to `true`.\n\nYou can add custom buttons to the footer by using the `footerButtons` prop. This prop should be an array of objects with `aria-label`, `icon` and `onPress` properties.\n\n| Key | Function |\n| ------------------------------ | ----------------------------------- |\n| `Ctrl+B` / `Cmd+B` | Toggle bold (rich text mode) |\n| `Ctrl+I` / `Cmd+I` | Toggle italic (rich text mode) |\n| `Ctrl+U` / `Cmd+U` | Toggle underline (rich text mode) |\n| `Alt+F10` | Focus toolbar (rich text mode) |\n| `Ctrl+Enter` / `Cmd+Enter` | Submit (always) |\n| `Enter` | Submit (when `saveOnEnter` is true) |\n| `Shift+Enter` | New line |\n| `Ctrl+Shift+H` / `Cmd+Shift+H` | Open help dialog (rich text mode) |\n| `Escape` | Close mention input / help dialog |\n| `Tab` | Focus next |\n| `Shift+Tab` | Focus previous |\n\nWhen `saveOnEnter` is set to `true`, pressing the `Enter` key will submit the editor instead of creating a new line. This is useful for single-line text inputs or quick note-taking scenarios.\n\nThe `clearOnSave` and `clearOnCancel` props clear the editor content after the respective action completes. These are useful for resetting the editor after submission or cancellation.\n\nThe `autoFocus` prop allows you to focus the editor on mount with optional caret positioning:\n\n* `true` - Focus on mount, caret at default position\n* `"start"` - Focus on mount, caret at position 0\n* `"end"` - Focus on mount, caret at end of text\n\nThe `editorHandle` ref provides imperative methods for programmatic control:\n\n* `focus()` - Focus the editor\n* `setCaretPosition(index)` - Position the caret at a specific index\n\nThe `isSaveDisabled` prop disables only the save button while keeping the editor content functional. This is different from `isDisabled`, which disables both the editor and buttons.\n\nThe `maxMentionableUsersSuggestions` prop controls how many mention suggestions are displayed when the user types `@`. This is useful for large user lists where you want to limit the visible suggestions.\n\nThe `spellCheck` prop enables or disables browser spell checking in the editor.\n\n| Selector | Description |\n| ------------------------------------------- | ---------------------------------------- |\n| `.BaselineUI-Editor` | Root container element |\n| `.BaselineUI-Editor-Save` | Save/submit button |\n| `.BaselineUI-Editor-Cancel` | Cancel button |\n| `.BaselineUI-Editor-Footer` | Footer toolbar containing action buttons |\n| `.BaselineUI-Editor-Mention` | Mention (@) button in footer |\n| `.BaselineUI-Editor-RichEditorToolbar` | Rich text formatting toolbar |\n| `.BaselineUI-Editor-RichEditorEditingArea` | Rich text contenteditable area |\n| `.BaselineUI-Editor-PlainEditorEditingArea` | Plain text textarea element |',props:`interface EditorProps {
|
|
6699
|
+
};`},similarTo:[],figmaUrl:null},Editor:{id:"core-miscellaneous-editor-rich-text",breadcrumb:"Core/Miscellaneous/Editor",importStatement:'import { Box, Editor, EditorAutoFocusOnMount, Separator } from "@baseline-ui/core";',description:"`Editor` is a text input area that supports either plain text or rich text with formatting, links, and @-mentions. Use it for comments, notes, descriptions, or any free-form content where users need more than a single-line input.",documentation:'`Editor` is a text input area that supports either plain text or rich text with formatting, links, and @-mentions. Use it for comments, notes, descriptions, or any free-form content where users need more than a single-line input.\n\n* supports rich text editing, including bold, italic and underline formatting.\n* supports font color and background color formatting\n* supports link creation, editing and removal\n* supports plain text editing\n* supports mouse, keyboard and touch interactions.\n* Exposed to the screen-readers and other assistive technologies using ARIA.\n* Mention support with user search and keyboard navigation\n* Keyboard shortcuts for common actions (submit, toolbar focus, help)\n* Imperative handle API (`editorHandle`) for programmatic focus and caret positioning\n* Custom footer buttons (action and toggle types)\n* Clear on save/cancel behavior\n* Auto-focus with configurable caret position\n\nYou can import the Editor component like so:\n\n```jsx\nimport { Editor } from "@baseline-ui/core";\n\nexport default function App() {\n return (\n <Editor\n aria-label="Comment"\n placeholder="Write a comment..."\n onSave={(value) => {\n console.log(value);\n }}\n />\n );\n}\n```\n\nIf you only need a single-line plain text input, use the `TextInput` component instead.\n\nThe `Editor` component has multiple variants that can be used to customize the appearance and behavior of the component.\n\n* `default` - the default variant\n* `minimal` - a minimal variant that removes the toolbar and only allows plain text editing.\n\n```jsx\n<Editor\n aria-label="Editor"\n variant="minimal"\n avatarName="John Doe"\n spellCheck={false}\n placeholder="Type something..."\n defaultValue="This is a minimal editor"\n/>\n```\n\nIn the example above, the `variant` prop is used to set the variant to `minimal`. This removes the toolbar and only allows plain text editing.\nThe first editor passes `isInline={false}`; the second one keeps the default inline rendering, which shows the avatar (set via `avatarName`) next to the input.\n\nYou can enable rich text editing by setting the `enableRichText` prop to `true`. This will enable the rich text toolbar and allow users to format the text. The default value is `false`.\n\n```jsx\n<Editor\n aria-label="Editor"\n placeholder="Placeholder"\n enableRichText\n defaultValue="<p>This is a rich editor. It supports <b>bold</b>, <i>italic</i>, and <u>underline</u>. <a href=\'https://example.com\'>Links</a> are also supported.</p><br/><p>You can set both <span style=\'color: #ac0000; background-color: #ffffff;\'>font color</span> and <span style=\'background-color: #ffff00; color: #000000;\'>background color</span>.</p>"\n/>\n```\n\nYou can set a placeholder for the editor by using the `placeholder` prop. This will display a placeholder when the editor is empty.\n\nThe `Editor` component can be controlled by using the `value` and `onChange` props together. This allows you to control the value of the editor from the parent component, in both plain text and rich text mode.\n\nFor uncontrolled usage, set the initial content with `defaultValue` and read edits via `onChange` or `onSave` \u2014 the editor manages its own state afterwards.\n\nFor backwards compatibility, passing `value` without `onChange` in rich text mode sets the initial content only (it behaves like `defaultValue`), matching the behavior of earlier versions.\n\nThe same pattern works in rich text mode \u2014 controlled rich text requires both `value` and `onChange`:\n\n```jsx\nfunction ControlledRichTextEditor() {\n const [value, setValue] = React.useState(\n "<p>This is a <b>controlled</b> rich text editor</p>",\n );\n\n return (\n <Editor\n aria-label="Editor"\n enableRichText\n placeholder="Type something..."\n value={value}\n onChange={(newValue) => {\n setValue(newValue);\n }}\n />\n );\n}\n```\n\nThe `Editor` component can be disabled by using the `isDisabled` prop. This will disable the editor and prevent users from editing the content.\n\nThe `Editor` component supports mentions. You can enable mentions by passing the `mentionableUsers` prop, an array of `MentionableUser` objects with required `id`, `name`, and `displayName` properties, plus optional `avatar` and `description`. The `id` should be unique for each user, `name` is the username matched while typing, and `displayName` is the label rendered for the mention.\nThe mentions feature only works when `enableRichText` is set to `true`. Users can start a mention by typing `@` in the editor or by pressing the mention (@) button in the footer.\n\n```jsx\n<Editor\n aria-label="Editor"\n placeholder="Placeholder"\n enableRichText\n defaultValue="Mentioning <span data-user-id=\'john-doe\'>John Doe</span>."\n mentionableUsers={[\n {\n id: "1",\n name: "john.doe",\n displayName: "John Doe",\n description: "john@gmail.com",\n },\n {\n id: "2",\n name: "jane.doe",\n displayName: "Jane Doe",\n description: "jane@gmail.com",\n },\n ]}\n/>\n```\n\nYou can add custom buttons to the footer by using the `footerButtons` prop. This prop is an array of objects of the shape `{ type: "action" | "toggle", props: {...} }`, where `props` accepts the `ActionIconButton` props (for `type: "action"`) or the `ToggleIconButton` props (for `type: "toggle"`), except `size` and `variant`, which are set by the editor.\n\n```jsx\nimport { AnonymousIcon } from "@baseline-ui/icons/16";\n\n<Editor\n aria-label="Editor"\n enableRichText\n footerButtons={[\n {\n type: "toggle",\n props: {\n "aria-label": "Save",\n icon: AnonymousIcon,\n onPress: () => {\n alert("Save");\n },\n },\n },\n ]}\n/>;\n```\n\n| Key | Function |\n| ------------------------------ | -------------------------------------------------------- |\n| `Ctrl+B` / `Cmd+B` | Toggle bold (rich text mode) |\n| `Ctrl+I` / `Cmd+I` | Toggle italic (rich text mode) |\n| `Ctrl+U` / `Cmd+U` | Toggle underline (rich text mode) |\n| `Ctrl+Z` / `Cmd+Z` | Undo (rich text mode) |\n| `Ctrl+Shift+Z` / `Cmd+Shift+Z` | Redo (rich text mode) |\n| `Ctrl+Y` | Redo (rich text mode) |\n| `@` | Start a mention (rich text mode with `mentionableUsers`) |\n| `Alt+F10` | Focus toolbar (rich text mode) |\n| `Ctrl+Enter` / `Cmd+Enter` | Submit (always) |\n| `Enter` | Submit (when `saveOnEnter` is true) |\n| `Shift+Enter` | New line |\n| `Ctrl+Shift+H` / `Cmd+Shift+H` | Open help dialog (rich text mode) |\n| `Escape` | Close mention input / help dialog |\n| `Tab` | Focus next |\n| `Shift+Tab` | Focus previous |\n\nWhen `saveOnEnter` is set to `true`, pressing the `Enter` key will submit the editor instead of creating a new line. This is useful for single-line text inputs or quick note-taking scenarios.\n\nThe `clearOnSave` and `clearOnCancel` props clear the editor content after the respective action completes. These are useful for resetting the editor after submission or cancellation.\n\nThe `autoFocus` prop allows you to focus the editor on mount with optional caret positioning:\n\n* `true` - Focus on mount, caret at default position\n* `"start"` - Focus on mount, caret at position 0\n* `"end"` - Focus on mount, caret at end of text\n\nThe `editorHandle` ref provides imperative methods for programmatic control:\n\n* `focus()` - Focus the editor\n* `setCaretPosition(index)` - Position the caret at a specific index\n\nThe `isSaveDisabled` prop disables only the save button while keeping the editor content functional. This is different from `isDisabled`, which disables both the editor and buttons.\n\nThe `maxMentionableUsersSuggestions` prop controls how many mention suggestions are displayed when the user types `@`. This is useful for large user lists where you want to limit the visible suggestions.\n\nThe `spellCheck` prop enables or disables browser spell checking in the editor.\n\nIn rich text mode, the editor includes a built-in help dialog that lists all available keyboard shortcuts (formatting, clipboard, undo/redo, submit). It opens as a modal overlay when the user presses `Ctrl+Shift+H` / `Cmd+Shift+H` while the editor has focus, and closes with `Escape` or the close button.\n\nUse the headless editor APIs when you need the rich-text engine without the default `Editor` chrome. This is useful for custom toolbars, inline editors embedded in other components, or experiences that need to render their own controls while reusing Baseline UI\'s rich-text model, keyboard shortcuts, selection handling, undo/redo, and HTML serialization.\n\n```jsx\nimport {\n EditorProvider,\n useEditable,\n useEditor,\n useEditorContext,\n} from "@baseline-ui/core";\n\nfunction FormattingToolbar() {\n const editor = useEditorContext();\n\n return (\n <button\n aria-pressed={editor.isMarkActive("bold")}\n onClick={() => editor.toggleMark("bold")}\n type="button"\n >\n Bold\n </button>\n );\n}\n\nfunction CustomRichTextEditor() {\n const editor = useEditor({\n defaultValue: "<p>Hello <b>world</b></p>",\n onChange: (html) => {\n console.log(html);\n },\n });\n const { editableProps } = useEditable(editor);\n\n return (\n <EditorProvider editor={editor}>\n <FormattingToolbar />\n <div {...editableProps} style={{ whiteSpace: "pre-wrap" }} />\n </EditorProvider>\n );\n}\n```\n\nThe headless API is split into these parts:\n\n| API | Purpose |\n| ------------------ | ------------------------------------------------------------------------ |\n| `useEditor` | Creates one rich-text editor instance and returns the `EditorState` API. |\n| `useEditable` | Attaches an `EditorState` to a `contenteditable` element. |\n| `EditorProvider` | Provides an editor instance to nested toolbar controls. |\n| `useEditorContext` | Reads the nearest provided editor instance. |\n| `EditorCore` | Framework-free engine escape hatch for advanced integrations. |\n\n`EditorState` exposes reactive state (`value`, `isEmpty`, `selectionState`, `canUndo`, `canRedo`, `isDisabled`) and imperative methods (`focus`, `setValue`, `getValue`, `undo`, `redo`, `exec`, `toggleMark`, `setMark`). For custom keyboard behavior, pass `onKeyDown` to `useEditable`; return `true` when you handled the event to skip the built-in shortcuts.\n\nStyle the editable element with `white-space: pre-wrap` (the built-in `Editor` does this internally). This preserves significant whitespace \u2014 leading, trailing, and consecutive spaces \u2014 which would otherwise collapse when the editor re-renders from its model, making a trailing space appear not to be inserted.\n\n| Selector | Description |\n| ------------------------------------------- | ----------------------------------------- |\n| `.BaselineUI-Editor` | Root container element |\n| `.BaselineUI-Editor-Save` | Save/submit button |\n| `.BaselineUI-Editor-Cancel` | Cancel button |\n| `.BaselineUI-Editor-Footer` | Footer toolbar containing action buttons |\n| `.BaselineUI-Editor-Mention` | Mention (@) button in footer |\n| `.BaselineUI-Editor-RichEditorToolbar` | Rich text formatting toolbar |\n| `.BaselineUI-Editor-RichEditorEditingArea` | Rich text contenteditable area |\n| `.BaselineUI-Editor-RichEditorPlaceholder` | Rich text empty-state placeholder overlay |\n| `.BaselineUI-Editor-PlainEditorEditingArea` | Plain text textarea element |\n\n`@baseline-ui/test-utils` ships a Playwright tester for the Editor so component and E2E specs don\'t have to relearn its markup. Build one from a frame and use its locators instead of hand-rolled selectors or translated labels:\n\n```ts\nimport { testers } from "@baseline-ui/test-utils";\n\nconst editor = testers(frame).editor();\n\nawait editor.textbox.fill("Hello");\nawait editor.boldButton.click();\nawait editor.openLinkDialog();\nawait editor.linkInput.fill("https://example.com");\nawait editor.linkAddButton.click();\nawait editor.startMention();\nawait editor.mentionOption("John Doe").click();\n```\n\nThe tester works in both modes \u2014 `textbox` resolves to the rich text contenteditable or the plain-mode `<textarea>` (both expose `role="textbox"`), and the rich-text-only surface (toolbar, link dialog, mention dropdown, help dialog) simply won\'t match when `enableRichText` is off. Pass a `root` locator when more than one Editor is mounted in the same frame:\n\n```ts\nconst editor = testers(frame).editor({\n root: frame.locator(".BaselineUI-Editor").first(),\n});\n```\n\nLocators are backed by stable `data-testid`s on the component (e.g. `editor-bold-button`, `editor-link-input`, `editor-help-dialog-close-button`) rather than accessible names, so they stay reliable across translations. The disclosure helpers (`openFontColorPicker`, `openBackgroundColorPicker`, `openLinkDialog`, `openHelpDialog`, `startMention`) are idempotent and no-op when the target surface is already open.',props:`interface EditorProps {
|
|
6700
6700
|
/**
|
|
6701
6701
|
* The unique identifier for the block. This is used to identify the block in
|
|
6702
6702
|
* the DOM and in the block map. It is added as a data attribute
|
|
@@ -6731,11 +6731,17 @@ onSave?: (value: string) => void
|
|
|
6731
6731
|
*/
|
|
6732
6732
|
onCancel?: () => void
|
|
6733
6733
|
/**
|
|
6734
|
-
* The
|
|
6734
|
+
* The initial value of the editor (uncontrolled). The editor manages its
|
|
6735
|
+
* own state afterwards; later changes to this prop are ignored.
|
|
6735
6736
|
*/
|
|
6736
6737
|
defaultValue?: string
|
|
6737
6738
|
/**
|
|
6738
|
-
* The value of the editor.
|
|
6739
|
+
* The value of the editor (controlled). Provide together with \`onChange\`;
|
|
6740
|
+
* later changes to this prop update the editor content.
|
|
6741
|
+
*
|
|
6742
|
+
* Backwards compatibility: in rich text mode, \`value\` without \`onChange\`
|
|
6743
|
+
* behaves like \`defaultValue\` (initial content only), matching the
|
|
6744
|
+
* behavior of earlier versions.
|
|
6739
6745
|
*/
|
|
6740
6746
|
value?: string
|
|
6741
6747
|
/**
|
|
@@ -6880,29 +6886,47 @@ autoFocus?: boolean | "start" | "end"
|
|
|
6880
6886
|
* @default false
|
|
6881
6887
|
*/
|
|
6882
6888
|
saveOnEnter?: boolean
|
|
6883
|
-
}`,stories:{usage:[{id:"core-miscellaneous-editor
|
|
6889
|
+
}`,stories:{usage:[{id:"core-miscellaneous-editor-rich-text--default",name:"Default",snippet:`const Default = () => <Editor
|
|
6890
|
+
placeholder="Placeholder"
|
|
6891
|
+
aria-label="Editor"
|
|
6892
|
+
enableRichText
|
|
6893
|
+
defaultValue="<p>This is a rich editor. It supports <b>bold</b>, <i>italic</i>, and <u>underline</u>. <a href='https://example.com'>Links</a> are also supported.</p><br/><p>You can set both <span style='color: #ac0000; background-color: #ffffff;'>font color</span> and <span style='background-color: #ffff00; color: #000000;'>background color</span>.</p>" />;`},{id:"core-miscellaneous-editor-rich-text--controlled",name:"Controlled",snippet:`const Controlled = () => {
|
|
6884
6894
|
const [value, setValue] = React.useState(args.value);
|
|
6885
6895
|
|
|
6886
6896
|
return (
|
|
6887
6897
|
<Editor
|
|
6888
6898
|
placeholder="Type something..."
|
|
6889
6899
|
aria-label="Editor"
|
|
6890
|
-
enableRichText
|
|
6891
|
-
spellCheck={false}
|
|
6900
|
+
enableRichText
|
|
6892
6901
|
value={value}
|
|
6893
6902
|
onChange={(newValue) => {
|
|
6894
6903
|
setValue(newValue);
|
|
6895
6904
|
}} />
|
|
6896
6905
|
);
|
|
6897
|
-
};`},{id:"core-miscellaneous-editor
|
|
6906
|
+
};`},{id:"core-miscellaneous-editor-rich-text--long-content",name:"Long Content",snippet:`const LongContent = () => <Editor
|
|
6907
|
+
placeholder="Placeholder"
|
|
6908
|
+
aria-label="Editor"
|
|
6909
|
+
enableRichText
|
|
6910
|
+
defaultValue={[
|
|
6911
|
+
"<p>This is a rich editor with a lot of content to exercise scrolling and overflow.</p>",
|
|
6912
|
+
"<p>It supports <b>bold</b>, <i>italic</i>, and <u>underline</u> formatting, as well as <a href='https://example.com'>links</a>.</p>",
|
|
6913
|
+
"<p>You can set both <span style='color: #ac0000; background-color: #ffffff;'>font color</span> and <span style='background-color: #ffff00; color: #000000;'>background color</span>.</p>",
|
|
6914
|
+
"<p>Supercalifragilisticexpialidociousantidisestablishmentarianismpneumonoultramicroscopicsilicovolcanoconiosis</p>",
|
|
6915
|
+
"<p><b>Bold</b> <i>italic</i> <u>underline</u> <b><i>bold italic</i></b> <b><u>bold underline</u></b> <i><u>italic underline</u></i> <b><i><u>all three</u></i></b>.</p>",
|
|
6916
|
+
"<p>Paragraph five with some more plain text content.</p>",
|
|
6917
|
+
"<p>Paragraph six with some more plain text content.</p>",
|
|
6918
|
+
"<p>Paragraph seven with some more plain text content.</p>",
|
|
6919
|
+
"<p>Paragraph eight with some more plain text content.</p>",
|
|
6920
|
+
"<p>Paragraph nine, the last paragraph of this long document.</p>",
|
|
6921
|
+
].join("")} />;`},{id:"core-miscellaneous-editor-rich-text--with-placeholder",name:"With Placeholder",snippet:'const WithPlaceholder = () => <Editor placeholder="Type something..." aria-label="Editor" enableRichText />;'},{id:"core-miscellaneous-editor-rich-text--variants",name:"Variants",snippet:`const Variants = () => <Box display="flex" gap="3xl" flexDirection="column">
|
|
6898
6922
|
<div style={{ width: 260 }}>
|
|
6899
6923
|
<Editor
|
|
6900
6924
|
placeholder="Type something..."
|
|
6901
6925
|
aria-label="Editor"
|
|
6902
|
-
enableRichText={false}
|
|
6903
6926
|
variant="minimal"
|
|
6904
6927
|
spellCheck={false}
|
|
6905
|
-
|
|
6928
|
+
enableRichText
|
|
6929
|
+
defaultValue="This is a rich editor"
|
|
6906
6930
|
isInline={false} />
|
|
6907
6931
|
</div>
|
|
6908
6932
|
<Separator />
|
|
@@ -6910,37 +6934,19 @@ saveOnEnter?: boolean
|
|
|
6910
6934
|
<Editor
|
|
6911
6935
|
placeholder="Type something..."
|
|
6912
6936
|
aria-label="Editor"
|
|
6913
|
-
enableRichText={false}
|
|
6914
6937
|
variant="minimal"
|
|
6915
6938
|
spellCheck={false}
|
|
6916
|
-
|
|
6939
|
+
enableRichText
|
|
6940
|
+
defaultValue="This is a rich editor" />
|
|
6917
6941
|
</div>
|
|
6918
|
-
</Box>;`},{id:"core-miscellaneous-editor--
|
|
6919
|
-
placeholder="Placeholder"
|
|
6920
|
-
aria-label="Editor"
|
|
6921
|
-
defaultValue="This is a minimal editor\\nwith multiple lines of text \\n\\nSome more text." />;`},{id:"core-miscellaneous-editor--plain-text-minimal-disabled",name:"Plain Text Minimal Disabled",snippet:'const PlainTextMinimalDisabled = () => <Editor placeholder="Placeholder" aria-label="Editor" isDisabled />;'},{id:"core-miscellaneous-editor--plain-text-minimal-save-disabled",name:"Plain Text Minimal Save Disabled",snippet:'const PlainTextMinimalSaveDisabled = () => <Editor placeholder="Placeholder" aria-label="Editor" isSaveDisabled />;'},{id:"core-miscellaneous-editor--plain-text-variants",name:"Plain Text Variants",snippet:'const PlainTextVariants = () => <Editor placeholder="Placeholder" aria-label="Editor" variant={undefined} />;'},{id:"core-miscellaneous-editor--plain-text-disabled",name:"Plain Text Disabled",snippet:'const PlainTextDisabled = () => <Editor placeholder="Placeholder" aria-label="Editor" isDisabled />;'},{id:"core-miscellaneous-editor--plain-text-auto-focus",name:"Plain Text Auto Focus",snippet:'const PlainTextAutoFocus = () => <EditorAutoFocusOnMount placeholder="Placeholder" aria-label="Editor" autoFocus />;'},{id:"core-miscellaneous-editor--rich-text",name:"Rich Text",snippet:`const RichText = () => <Editor
|
|
6922
|
-
placeholder="Placeholder"
|
|
6923
|
-
aria-label="Editor"
|
|
6924
|
-
enableRichText
|
|
6925
|
-
defaultValue="<p>This is a rich editor. It supports <b>bold</b>, <i>italic</i>, and <u>underline</u>. <a href='https://example.com'>Links</a> are also supported.</p><br/><p>You can set both <span style='color: #ac0000; background-color: #ffffff;'>font color</span> and <span style='background-color: #ffff00; color: #000000;'>background color</span>.</p>" />;`},{id:"core-miscellaneous-editor--rich-text-with-placeholder",name:"Rich Text With Placeholder",snippet:'const RichTextWithPlaceholder = () => <Editor placeholder="Type something..." aria-label="Editor" enableRichText />;'},{id:"core-miscellaneous-editor--rich-text-variants",name:"Rich Text Variants",snippet:`const RichTextVariants = () => <Editor
|
|
6926
|
-
placeholder="Placeholder"
|
|
6927
|
-
aria-label="Editor"
|
|
6928
|
-
enableRichText
|
|
6929
|
-
defaultValue="This is a rich editor" />;`},{id:"core-miscellaneous-editor--rich-text-disabled",name:"Rich Text Disabled",snippet:'const RichTextDisabled = () => <Editor placeholder="Placeholder" aria-label="Editor" isDisabled />;'},{id:"core-miscellaneous-editor--rich-text-save-disabled",name:"Rich Text Save Disabled",snippet:'const RichTextSaveDisabled = () => <Editor placeholder="Placeholder" aria-label="Editor" isSaveDisabled />;'},{id:"core-miscellaneous-editor--rich-text-auto-focus",name:"Rich Text Auto Focus",error:{name:"SyntaxError",message:`Expected render to be an arrow function or function expression
|
|
6930
|
-
172 |
|
|
6931
|
-
173 | export const RichTextAutoFocus: Story = {
|
|
6932
|
-
> 174 | render: PlainTextAutoFocus.render,
|
|
6933
|
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
6934
|
-
175 | args: {
|
|
6935
|
-
176 | ...RichText.args,
|
|
6936
|
-
177 | autoFocus: true,`}},{id:"core-miscellaneous-editor--rich-text-mentions",name:"Rich Text Mentions",snippet:`const RichTextMentions = () => <Editor
|
|
6942
|
+
</Box>;`},{id:"core-miscellaneous-editor-rich-text--disabled",name:"Disabled",snippet:'const Disabled = () => <Editor placeholder="Placeholder" aria-label="Editor" isDisabled />;'},{id:"core-miscellaneous-editor-rich-text--save-disabled",name:"Save Disabled",snippet:'const SaveDisabled = () => <Editor placeholder="Placeholder" aria-label="Editor" isSaveDisabled />;'},{id:"core-miscellaneous-editor-rich-text--auto-focus",name:"Auto Focus",snippet:'const AutoFocus = () => <EditorAutoFocusOnMount placeholder="Placeholder" aria-label="Editor" autoFocus />;'},{id:"core-miscellaneous-editor-rich-text--mentions",name:"Mentions",snippet:`const Mentions = () => <Editor
|
|
6937
6943
|
placeholder="Placeholder"
|
|
6938
6944
|
aria-label="Editor"
|
|
6939
6945
|
defaultValue="Mentioning <span data-user-id='john-doe'>John Doe</span>."
|
|
6940
|
-
mentionableUsers={mentionableUsers} />;`},{id:"core-miscellaneous-editor
|
|
6946
|
+
mentionableUsers={mentionableUsers} />;`},{id:"core-miscellaneous-editor-rich-text--mentions-max-suggestions",name:"Mentions Max Suggestions",snippet:`const MentionsMaxSuggestions = () => <Editor
|
|
6941
6947
|
placeholder="Placeholder"
|
|
6942
6948
|
aria-label="Editor"
|
|
6943
|
-
maxMentionableUsersSuggestions={2} />;`},{id:"core-miscellaneous-editor--with-custom-footer-buttons",name:"With Custom Footer Buttons",snippet:`const WithCustomFooterButtons = () => <Editor
|
|
6949
|
+
maxMentionableUsersSuggestions={2} />;`},{id:"core-miscellaneous-editor-rich-text--with-custom-footer-buttons",name:"With Custom Footer Buttons",snippet:`const WithCustomFooterButtons = () => <Editor
|
|
6944
6950
|
placeholder="Placeholder"
|
|
6945
6951
|
aria-label="Editor"
|
|
6946
6952
|
footerButtons={[
|
|
@@ -6954,104 +6960,50 @@ saveOnEnter?: boolean
|
|
|
6954
6960
|
},
|
|
6955
6961
|
},
|
|
6956
6962
|
},
|
|
6957
|
-
]} />;`},{id:"core-miscellaneous-editor--
|
|
6958
|
-
const editorHandleRef = React.useRef<EditorHandle>(null);
|
|
6959
|
-
|
|
6960
|
-
const [value, setValue] = React.useState(2);
|
|
6961
|
-
|
|
6962
|
-
return (
|
|
6963
|
-
<>
|
|
6964
|
-
<Box display="flex" gap="md" paddingBlockEnd="md">
|
|
6965
|
-
<NumberInput
|
|
6966
|
-
label="Caret position"
|
|
6967
|
-
minValue={0}
|
|
6968
|
-
maxValue={args.value?.length ?? 0}
|
|
6969
|
-
value={value}
|
|
6970
|
-
onChange={setValue} />
|
|
6971
|
-
<Box display="flex" alignItems="flex-end">
|
|
6972
|
-
<ActionButton
|
|
6973
|
-
label="Set caret"
|
|
6974
|
-
onPress={() => {
|
|
6975
|
-
editorHandleRef.current?.setCaretPosition(value);
|
|
6976
|
-
}} />
|
|
6977
|
-
</Box>
|
|
6978
|
-
</Box>
|
|
6979
|
-
<Editor
|
|
6980
|
-
editorHandle={editorHandleRef}
|
|
6981
|
-
placeholder="Type something..."
|
|
6982
|
-
aria-label="Editor"
|
|
6983
|
-
enableRichText={false}
|
|
6984
|
-
spellCheck={false}
|
|
6985
|
-
value="This is a some text" />
|
|
6986
|
-
</>
|
|
6987
|
-
);
|
|
6988
|
-
};`},{id:"core-miscellaneous-editor--auto-focus-at-start",name:"Auto Focus At Start",snippet:`const AutoFocusAtStart = () => <Editor
|
|
6989
|
-
placeholder="Placeholder"
|
|
6990
|
-
aria-label="Editor"
|
|
6991
|
-
autoFocus="start"
|
|
6992
|
-
defaultValue="Caret will be at the start"
|
|
6993
|
-
enableRichText={false} />;`},{id:"core-miscellaneous-editor--auto-focus-at-end",name:"Auto Focus At End",snippet:`const AutoFocusAtEnd = () => <Editor
|
|
6994
|
-
placeholder="Placeholder"
|
|
6995
|
-
aria-label="Editor"
|
|
6996
|
-
autoFocus="end"
|
|
6997
|
-
defaultValue="Caret will be at the end"
|
|
6998
|
-
enableRichText={false} />;`},{id:"core-miscellaneous-editor--rich-text-auto-focus-at-end",name:"Rich Text Auto Focus At End",snippet:`const RichTextAutoFocusAtEnd = () => <Editor
|
|
6963
|
+
]} />;`},{id:"core-miscellaneous-editor-rich-text--auto-focus-at-end",name:"Auto Focus At End",snippet:`const AutoFocusAtEnd = () => <Editor
|
|
6999
6964
|
placeholder="Placeholder"
|
|
7000
6965
|
aria-label="Editor"
|
|
7001
6966
|
autoFocus="end"
|
|
7002
6967
|
defaultValue="Caret will be at the end"
|
|
7003
|
-
enableRichText />;`},{id:"core-miscellaneous-editor
|
|
6968
|
+
enableRichText />;`},{id:"core-miscellaneous-editor-rich-text--with-cancel",name:"With Cancel",snippet:`const WithCancel = () => <Editor
|
|
7004
6969
|
placeholder="Placeholder"
|
|
7005
6970
|
aria-label="Editor"
|
|
7006
6971
|
onCancel={() => {}}
|
|
7007
|
-
defaultValue="Some text to cancel" />;`},{id:"core-miscellaneous-editor
|
|
7008
|
-
placeholder="Placeholder"
|
|
7009
|
-
aria-label="Editor"
|
|
7010
|
-
onCancel={() => {}}
|
|
7011
|
-
defaultValue="<p>Some text to cancel</p>" />;`},{id:"core-miscellaneous-editor--plain-text-clear-on-save",name:"Plain Text Clear On Save",snippet:`const PlainTextClearOnSave = () => <Editor
|
|
6972
|
+
defaultValue="<p>Some text to cancel</p>" />;`},{id:"core-miscellaneous-editor-rich-text--clear-on-save",name:"Clear On Save",snippet:`const ClearOnSave = () => <Editor
|
|
7012
6973
|
placeholder="Placeholder"
|
|
7013
6974
|
aria-label="Editor"
|
|
7014
6975
|
clearOnSave
|
|
7015
|
-
defaultValue="Text that clears on save" />;`},{id:"core-miscellaneous-editor
|
|
6976
|
+
defaultValue="<p>Text that clears on save</p>" />;`},{id:"core-miscellaneous-editor-rich-text--clear-on-cancel",name:"Clear On Cancel",snippet:`const ClearOnCancel = () => <Editor
|
|
7016
6977
|
placeholder="Placeholder"
|
|
7017
6978
|
aria-label="Editor"
|
|
7018
6979
|
clearOnCancel
|
|
7019
6980
|
onCancel={() => {}}
|
|
7020
|
-
defaultValue="Text that clears on cancel" />;`},{id:"core-miscellaneous-editor
|
|
7021
|
-
placeholder="Placeholder"
|
|
7022
|
-
aria-label="Editor"
|
|
7023
|
-
clearOnSave
|
|
7024
|
-
defaultValue="<p>Text that clears on save</p>" />;`},{id:"core-miscellaneous-editor--rich-text-clear-on-cancel",name:"Rich Text Clear On Cancel",snippet:`const RichTextClearOnCancel = () => <Editor
|
|
7025
|
-
placeholder="Placeholder"
|
|
7026
|
-
aria-label="Editor"
|
|
7027
|
-
clearOnCancel
|
|
7028
|
-
onCancel={() => {}}
|
|
7029
|
-
defaultValue="<p>Text that clears on cancel</p>" />;`},{id:"core-miscellaneous-editor--plain-text-save-on-enter",name:"Plain Text Save On Enter",snippet:`const PlainTextSaveOnEnter = () => <Editor
|
|
7030
|
-
placeholder="Placeholder"
|
|
7031
|
-
aria-label="Editor"
|
|
7032
|
-
saveOnEnter
|
|
7033
|
-
defaultValue="Press Enter to save" />;`},{id:"core-miscellaneous-editor--rich-text-save-on-enter",name:"Rich Text Save On Enter",snippet:`const RichTextSaveOnEnter = () => <Editor
|
|
6981
|
+
defaultValue="<p>Text that clears on cancel</p>" />;`},{id:"core-miscellaneous-editor-rich-text--save-on-enter",name:"Save On Enter",snippet:`const SaveOnEnter = () => <Editor
|
|
7034
6982
|
placeholder="Placeholder"
|
|
7035
6983
|
aria-label="Editor"
|
|
7036
6984
|
saveOnEnter
|
|
7037
|
-
defaultValue="<p>Press Enter to save</p>" />;`},{id:"core-miscellaneous-editor
|
|
6985
|
+
defaultValue="<p>Press Enter to save</p>" />;`},{id:"core-miscellaneous-editor-rich-text--not-inline",name:"Not Inline",snippet:`const NotInline = () => <Editor
|
|
7038
6986
|
placeholder="Placeholder"
|
|
7039
6987
|
aria-label="Editor"
|
|
7040
6988
|
isInline={false}
|
|
7041
|
-
defaultValue="Non-inline
|
|
7042
|
-
|
|
7043
|
-
aria-label="Editor"
|
|
7044
|
-
isInline={false}
|
|
7045
|
-
defaultValue="<p>Non-inline rich text editor</p>" />;`},{id:"core-miscellaneous-editor--plain-text-default-save-disabled",name:"Plain Text Default Save Disabled",snippet:`const PlainTextDefaultSaveDisabled = () => <Editor
|
|
7046
|
-
placeholder="Placeholder"
|
|
7047
|
-
aria-label="Editor"
|
|
7048
|
-
isSaveDisabled
|
|
7049
|
-
defaultValue="Save is disabled" />;`}],implementation:`import React from "react";
|
|
6989
|
+
defaultValue="<p>Non-inline rich text editor</p>" />;`}],implementation:`import { BoldIcon, ItalicIcon, UnderlineIcon } from "@baseline-ui/icons/16";
|
|
6990
|
+
import React from "react";
|
|
7050
6991
|
|
|
7051
6992
|
import { ActionButton } from "../../ActionButton";
|
|
7052
6993
|
import { Box } from "../../Box";
|
|
6994
|
+
import { ColorInput } from "../../ColorInput";
|
|
6995
|
+
import { Text } from "../../Text";
|
|
6996
|
+
import { ToggleIconButton } from "../../ToggleIconButton";
|
|
7053
6997
|
import { Editor } from "../Editor";
|
|
7054
|
-
|
|
6998
|
+
import {
|
|
6999
|
+
EditorProvider,
|
|
7000
|
+
useEditable,
|
|
7001
|
+
useEditor,
|
|
7002
|
+
useEditorContext,
|
|
7003
|
+
} from "../headless";
|
|
7004
|
+
|
|
7005
|
+
import type { ColorPreset } from "../../ColorInput";
|
|
7006
|
+
import type { MarkName } from "../core/commands";
|
|
7055
7007
|
import type { EditorHandle, EditorProps } from "../Editor.types";
|
|
7056
7008
|
|
|
7057
7009
|
export const EditorWithSetCaretButton = ({
|
|
@@ -7106,6 +7058,309 @@ export const EditorAutoFocusOnMount: React.FC<EditorProps> = (args) => {
|
|
|
7106
7058
|
);
|
|
7107
7059
|
};
|
|
7108
7060
|
|
|
7061
|
+
export const EditorControlledRichText = ({
|
|
7062
|
+
onChange,
|
|
7063
|
+
}: Pick<EditorProps, "onChange">) => {
|
|
7064
|
+
const [value, setValue] = React.useState("<p>First</p>");
|
|
7065
|
+
|
|
7066
|
+
return (
|
|
7067
|
+
<>
|
|
7068
|
+
<button
|
|
7069
|
+
onClick={() => {
|
|
7070
|
+
setValue("<p>Updated <b>externally</b></p>");
|
|
7071
|
+
}}
|
|
7072
|
+
data-testid="set-value"
|
|
7073
|
+
>
|
|
7074
|
+
Set value
|
|
7075
|
+
</button>
|
|
7076
|
+
<Editor
|
|
7077
|
+
enableRichText={true}
|
|
7078
|
+
value={value}
|
|
7079
|
+
onChange={(v) => {
|
|
7080
|
+
setValue(v);
|
|
7081
|
+
onChange?.(v);
|
|
7082
|
+
}}
|
|
7083
|
+
/>
|
|
7084
|
+
</>
|
|
7085
|
+
);
|
|
7086
|
+
};
|
|
7087
|
+
|
|
7088
|
+
export const EditorControlledRichTextRejectsEdits = ({
|
|
7089
|
+
onChange,
|
|
7090
|
+
}: Pick<EditorProps, "onChange">) => (
|
|
7091
|
+
<Editor enableRichText={true} value="<p>Locked</p>" onChange={onChange} />
|
|
7092
|
+
);
|
|
7093
|
+
|
|
7094
|
+
/**
|
|
7095
|
+
* Legacy usage: \`value\` WITHOUT \`onChange\` in rich text mode. Must behave
|
|
7096
|
+
* like \`defaultValue\` \u2014 later \`value\` updates are ignored (backwards
|
|
7097
|
+
* compatibility).
|
|
7098
|
+
*/
|
|
7099
|
+
export const EditorLegacyRichTextValue = () => {
|
|
7100
|
+
const [value, setValue] = React.useState("<p>First</p>");
|
|
7101
|
+
|
|
7102
|
+
return (
|
|
7103
|
+
<>
|
|
7104
|
+
<button
|
|
7105
|
+
onClick={() => {
|
|
7106
|
+
setValue("<p>Replaced</p>");
|
|
7107
|
+
}}
|
|
7108
|
+
data-testid="set-value"
|
|
7109
|
+
>
|
|
7110
|
+
Set value
|
|
7111
|
+
</button>
|
|
7112
|
+
<Editor enableRichText={true} value={value} />
|
|
7113
|
+
</>
|
|
7114
|
+
);
|
|
7115
|
+
};
|
|
7116
|
+
|
|
7117
|
+
/**
|
|
7118
|
+
* Demonstrates the headless API: a fully custom editor built from \`useEditor\`
|
|
7119
|
+
* + \`useEditable\` on a plain \`<div>\`, with a \`Box\`-laid-out toolbar of
|
|
7120
|
+
* \`ActionButton\`s reading the shared handle via \`useEditorContext\`. Rendered as
|
|
7121
|
+
* two independent instances to prove per-editor isolation (each
|
|
7122
|
+
* \`EditorProvider\` scopes its own handle).
|
|
7123
|
+
*/
|
|
7124
|
+
const HeadlessMarkButton: React.FC<{
|
|
7125
|
+
markName: MarkName;
|
|
7126
|
+
label: string;
|
|
7127
|
+
testId: string;
|
|
7128
|
+
}> = ({ markName, label, testId }) => {
|
|
7129
|
+
const editor = useEditorContext();
|
|
7130
|
+
const isActive = editor.isMarkActive(markName);
|
|
7131
|
+
|
|
7132
|
+
return (
|
|
7133
|
+
<ActionButton
|
|
7134
|
+
size="sm"
|
|
7135
|
+
variant={isActive ? "primary" : "secondary"}
|
|
7136
|
+
label={label}
|
|
7137
|
+
data-testid={testId}
|
|
7138
|
+
aria-pressed={isActive}
|
|
7139
|
+
// Keep the selection in the editable so the toggle applies to it.
|
|
7140
|
+
preventFocusOnPress={true}
|
|
7141
|
+
onPress={() => {
|
|
7142
|
+
editor.toggleMark(markName);
|
|
7143
|
+
editor.focus();
|
|
7144
|
+
}}
|
|
7145
|
+
/>
|
|
7146
|
+
);
|
|
7147
|
+
};
|
|
7148
|
+
|
|
7149
|
+
const HEADLESS_MARK_ITEMS = [
|
|
7150
|
+
{ id: "bold", label: "Bold", icon: BoldIcon },
|
|
7151
|
+
{ id: "italic", label: "Italic", icon: ItalicIcon },
|
|
7152
|
+
{ id: "underline", label: "Underline", icon: UnderlineIcon },
|
|
7153
|
+
] as const;
|
|
7154
|
+
|
|
7155
|
+
const HEADLESS_TEXT_COLOR = "#ac0000";
|
|
7156
|
+
const HEADLESS_BACKGROUND_COLOR = "#ffff00";
|
|
7157
|
+
|
|
7158
|
+
const HeadlessMarkButtons: React.FC<{ idPrefix: string }> = ({ idPrefix }) => {
|
|
7159
|
+
const editor = useEditorContext();
|
|
7160
|
+
|
|
7161
|
+
return (
|
|
7162
|
+
<Box display="flex" gap="xs">
|
|
7163
|
+
{HEADLESS_MARK_ITEMS.map(({ id, label, icon }) => (
|
|
7164
|
+
<ToggleIconButton
|
|
7165
|
+
key={id}
|
|
7166
|
+
size="sm"
|
|
7167
|
+
variant="toolbar"
|
|
7168
|
+
icon={icon}
|
|
7169
|
+
aria-label={label}
|
|
7170
|
+
data-testid={\`\${idPrefix}-\${id}\`}
|
|
7171
|
+
isSelected={editor.isMarkActive(id)}
|
|
7172
|
+
preventFocusOnPress={true}
|
|
7173
|
+
onChange={() => {
|
|
7174
|
+
editor.toggleMark(id);
|
|
7175
|
+
editor.focus();
|
|
7176
|
+
}}
|
|
7177
|
+
/>
|
|
7178
|
+
))}
|
|
7179
|
+
</Box>
|
|
7180
|
+
);
|
|
7181
|
+
};
|
|
7182
|
+
|
|
7183
|
+
const HEADLESS_TEXT_COLOR_PRESETS: ColorPreset[] = [
|
|
7184
|
+
{ label: "Crimson", color: HEADLESS_TEXT_COLOR },
|
|
7185
|
+
{ label: "Ink", color: "#1a1a2e" },
|
|
7186
|
+
{ label: "Ocean", color: "#0050c8" },
|
|
7187
|
+
];
|
|
7188
|
+
|
|
7189
|
+
const HEADLESS_BACKGROUND_COLOR_PRESETS: ColorPreset[] = [
|
|
7190
|
+
{ label: "Sunshine", color: HEADLESS_BACKGROUND_COLOR },
|
|
7191
|
+
{ label: "Mint", color: "#c8f5d2" },
|
|
7192
|
+
];
|
|
7193
|
+
|
|
7194
|
+
/**
|
|
7195
|
+
* A presets-only \`ColorInput\` wired into the headless editor. Mirrors the
|
|
7196
|
+
* built-in EditorToolbar's color handling: capture the selection before the
|
|
7197
|
+
* popover steals focus, then restore it (Firefox collapses the contenteditable
|
|
7198
|
+
* selection on refocus) before applying the mark. Reading the value back from
|
|
7199
|
+
* \`selectionState.marks\` keeps the trigger swatch in sync with the caret.
|
|
7200
|
+
*/
|
|
7201
|
+
const HeadlessColorInput: React.FC<{
|
|
7202
|
+
idPrefix: string;
|
|
7203
|
+
colorKey: "color" | "backgroundColor";
|
|
7204
|
+
label: string;
|
|
7205
|
+
presets: ColorPreset[];
|
|
7206
|
+
}> = ({ idPrefix, colorKey, label, presets }) => {
|
|
7207
|
+
const editor = useEditorContext();
|
|
7208
|
+
const color =
|
|
7209
|
+
colorKey === "color"
|
|
7210
|
+
? editor.selectionState.marks.color
|
|
7211
|
+
: editor.selectionState.marks.backgroundColor;
|
|
7212
|
+
const savedRangeRef = React.useRef<typeof editor.selectionState.range>(null);
|
|
7213
|
+
|
|
7214
|
+
return (
|
|
7215
|
+
<Box data-testid={\`\${idPrefix}-\${colorKey}\`}>
|
|
7216
|
+
<ColorInput
|
|
7217
|
+
aria-label={label}
|
|
7218
|
+
presets={presets}
|
|
7219
|
+
includePicker={false}
|
|
7220
|
+
allowRemoval={true}
|
|
7221
|
+
placement="bottom start"
|
|
7222
|
+
value={color ?? null}
|
|
7223
|
+
onTriggerPress={() => {
|
|
7224
|
+
savedRangeRef.current = editor.selectionState.range;
|
|
7225
|
+
}}
|
|
7226
|
+
onChange={(next) => {
|
|
7227
|
+
// Defer so the popover finishes closing, then restore the captured
|
|
7228
|
+
// selection before applying \u2014 focus alone is not enough on Firefox.
|
|
7229
|
+
setTimeout(() => {
|
|
7230
|
+
if (savedRangeRef.current) {
|
|
7231
|
+
editor.core.select(savedRangeRef.current);
|
|
7232
|
+
}
|
|
7233
|
+
editor.setMark(colorKey, next ? next.toString("rgba") : undefined);
|
|
7234
|
+
}, 0);
|
|
7235
|
+
}}
|
|
7236
|
+
/>
|
|
7237
|
+
</Box>
|
|
7238
|
+
);
|
|
7239
|
+
};
|
|
7240
|
+
|
|
7241
|
+
const HeadlessCustomEditorInstance: React.FC<{
|
|
7242
|
+
idPrefix: string;
|
|
7243
|
+
label: string;
|
|
7244
|
+
defaultValue?: string;
|
|
7245
|
+
}> = ({ idPrefix, label, defaultValue }) => {
|
|
7246
|
+
const editor = useEditor({ defaultValue });
|
|
7247
|
+
const { editableProps } = useEditable(editor);
|
|
7248
|
+
|
|
7249
|
+
return (
|
|
7250
|
+
<EditorProvider editor={editor}>
|
|
7251
|
+
<Box
|
|
7252
|
+
display="flex"
|
|
7253
|
+
flexDirection="column"
|
|
7254
|
+
gap="md"
|
|
7255
|
+
padding="lg"
|
|
7256
|
+
borderRadius="lg"
|
|
7257
|
+
backgroundColor="background.primary.subtle"
|
|
7258
|
+
style={{ width: 320 }}
|
|
7259
|
+
>
|
|
7260
|
+
<Text type="helper" size="sm" color="text.secondary">
|
|
7261
|
+
{label}
|
|
7262
|
+
</Text>
|
|
7263
|
+
<Box display="flex" gap="xs" alignItems="center">
|
|
7264
|
+
<HeadlessMarkButtons idPrefix={idPrefix} />
|
|
7265
|
+
<HeadlessColorInput
|
|
7266
|
+
idPrefix={idPrefix}
|
|
7267
|
+
colorKey="color"
|
|
7268
|
+
label="Text color"
|
|
7269
|
+
presets={HEADLESS_TEXT_COLOR_PRESETS}
|
|
7270
|
+
/>
|
|
7271
|
+
<HeadlessColorInput
|
|
7272
|
+
idPrefix={idPrefix}
|
|
7273
|
+
colorKey="backgroundColor"
|
|
7274
|
+
label="Background color"
|
|
7275
|
+
presets={HEADLESS_BACKGROUND_COLOR_PRESETS}
|
|
7276
|
+
/>
|
|
7277
|
+
</Box>
|
|
7278
|
+
<Box
|
|
7279
|
+
{...editableProps}
|
|
7280
|
+
data-testid={\`\${idPrefix}-editable\`}
|
|
7281
|
+
aria-label={\`\${idPrefix} editor\`}
|
|
7282
|
+
padding="lg"
|
|
7283
|
+
borderRadius="lg"
|
|
7284
|
+
backgroundColor="background.secondary.subtle"
|
|
7285
|
+
color="text.primary"
|
|
7286
|
+
typography="body.md.regular"
|
|
7287
|
+
// \`white-space: pre-wrap\` keeps significant whitespace (leading,
|
|
7288
|
+
// trailing, and runs of spaces) visible in the contenteditable \u2014 the
|
|
7289
|
+
// built-in <Editor> sets the same on its editing surface. Without it,
|
|
7290
|
+
// a trailing space collapses whenever the model re-renders (e.g. while
|
|
7291
|
+
// a color mark is active), so the space appears not to be inserted.
|
|
7292
|
+
style={{ minHeight: 100, whiteSpace: "pre-wrap" }}
|
|
7293
|
+
/>
|
|
7294
|
+
</Box>
|
|
7295
|
+
</EditorProvider>
|
|
7296
|
+
);
|
|
7297
|
+
};
|
|
7298
|
+
|
|
7299
|
+
export const HeadlessCustomEditor: React.FC = () => {
|
|
7300
|
+
return (
|
|
7301
|
+
<Box display="flex" gap="2xl" flexDirection="column">
|
|
7302
|
+
<HeadlessCustomEditorInstance
|
|
7303
|
+
idPrefix="headless-a"
|
|
7304
|
+
label="Unformatted rich text"
|
|
7305
|
+
defaultValue="<p>Unformatted rich text preview with no active marks.</p>"
|
|
7306
|
+
/>
|
|
7307
|
+
<HeadlessCustomEditorInstance
|
|
7308
|
+
idPrefix="headless-b"
|
|
7309
|
+
label="Formatted rich text"
|
|
7310
|
+
defaultValue={\`<p><b>Bold text</b>, <i>italic text</i>, <u>underlined text</u>, and <span style="color:\${HEADLESS_TEXT_COLOR};background-color:\${HEADLESS_BACKGROUND_COLOR}">colored text</span> are visible here.</p>\`}
|
|
7311
|
+
/>
|
|
7312
|
+
</Box>
|
|
7313
|
+
);
|
|
7314
|
+
};
|
|
7315
|
+
|
|
7316
|
+
/**
|
|
7317
|
+
* Headless editor with the built-in formatting/history shortcuts disabled
|
|
7318
|
+
* (\`keyboardShortcuts: false\`). Ctrl/Cmd+B should NOT toggle bold, but the
|
|
7319
|
+
* custom toolbar button still works.
|
|
7320
|
+
*/
|
|
7321
|
+
export const HeadlessEditorNoShortcuts: React.FC = () => {
|
|
7322
|
+
const editor = useEditor({
|
|
7323
|
+
defaultValue: "<p>No shortcuts</p>",
|
|
7324
|
+
keyboardShortcuts: false,
|
|
7325
|
+
});
|
|
7326
|
+
const { editableProps } = useEditable(editor);
|
|
7327
|
+
|
|
7328
|
+
return (
|
|
7329
|
+
<EditorProvider editor={editor}>
|
|
7330
|
+
<Box
|
|
7331
|
+
display="flex"
|
|
7332
|
+
flexDirection="column"
|
|
7333
|
+
gap="md"
|
|
7334
|
+
padding="lg"
|
|
7335
|
+
borderRadius="lg"
|
|
7336
|
+
backgroundColor="background.primary.subtle"
|
|
7337
|
+
borderWidth={1}
|
|
7338
|
+
borderStyle="solid"
|
|
7339
|
+
borderColor="border.medium"
|
|
7340
|
+
style={{ width: 320 }}
|
|
7341
|
+
>
|
|
7342
|
+
<HeadlessMarkButton
|
|
7343
|
+
markName="bold"
|
|
7344
|
+
label="Bold"
|
|
7345
|
+
testId="noshortcut-bold"
|
|
7346
|
+
/>
|
|
7347
|
+
<Box
|
|
7348
|
+
{...editableProps}
|
|
7349
|
+
data-testid="noshortcut-editable"
|
|
7350
|
+
aria-label="no shortcut editor"
|
|
7351
|
+
padding="md"
|
|
7352
|
+
borderRadius="md"
|
|
7353
|
+
backgroundColor="background.secondary.subtle"
|
|
7354
|
+
borderWidth={1}
|
|
7355
|
+
borderStyle="solid"
|
|
7356
|
+
borderColor="border.medium"
|
|
7357
|
+
style={{ minHeight: 72 }}
|
|
7358
|
+
/>
|
|
7359
|
+
</Box>
|
|
7360
|
+
</EditorProvider>
|
|
7361
|
+
);
|
|
7362
|
+
};
|
|
7363
|
+
|
|
7109
7364
|
export const EditorWithAutoFocusAndCaretAtEnd = ({
|
|
7110
7365
|
initialText,
|
|
7111
7366
|
onChange,
|
|
@@ -14869,7 +15124,7 @@ children: React.ReactNode
|
|
|
14869
15124
|
{ placement: "right top" },
|
|
14870
15125
|
],
|
|
14871
15126
|
}}
|
|
14872
|
-
defaultProps={args
|
|
15127
|
+
defaultProps={args}
|
|
14873
15128
|
/>
|
|
14874
15129
|
);`},{id:"core-overlays-popover--with-custom-target",name:"With Custom Target",snippet:`const WithCustomTarget = (args) => (
|
|
14875
15130
|
<PopoverCustomTargetExample
|
|
@@ -32282,7 +32537,7 @@ padding={[null, "lg", "xl"]}
|
|
|
32282
32537
|
|
|
32283
32538
|
* [vanilla-extract sprinkles documentation](https://vanilla-extract.style/documentation/packages/sprinkles/) - Learn about the underlying sprinkles framework
|
|
32284
32539
|
* [Box component documentation](/docs/core-utilities-box--docs) - Detailed information about the Box component
|
|
32285
|
-
* [Theme documentation](/docs/theming--docs) - Learn about Baseline UI's theming system`};var c={"8":["CaretDownIcon","CaretLeftIcon","CaretRightIcon","CaretUpIcon","ChevronRightFilledIcon","ChevronRightIcon","EllipseIcon","MinusIcon","PlusIcon","XIcon"],"12":["CaretDownIcon","CaretLeftIcon","CaretRightIcon","CaretUpIcon","CheckmarkIcon","DragIndicatorIcon","DragIndicatorVerticalIcon","EditIcon","EllipseIcon","EnterKeyIcon","LockFilledIcon","LockIcon","MinusIcon","MoreVIcon","MoreIcon","PlaceholderIcon","PlusIcon","SearchIcon","SizeIcon","TrashIcon","XIcon","ZoomIcon"],"16":["AlignBottomIcon","AlignMiddleIcon","AlignTopIcon","AnonymousIcon","ArrowDiagonalTopLeftBottomRightIcon","ArrowDownCircleFilledIcon","ArrowDownIcon","ArrowIcon","ArrowLeftRightIcon","ArrowRightIcon","ArrowUpArrowDownIcon","ArrowUpIcon","AtIcon","AttachmentsIcon","AvatarIcon","BoldIcon","BookmarkFilledIcon","BookmarkIcon","BulletListIcon","CalendarIcon","CaretLeftIcon","CaretRightIcon","CheckmarkCircleFilledIcon","CheckmarkCircleIcon","CheckmarkIcon","CircleFilledIcon","ClockIcon","CopyIcon","CustomizeIcon","DocumentEditIcon","DownloadIcon","DuplicateIcon","EditIcon","ElipseAreaIcon","EllipseCloudyIcon","EllipseDashedIcon","EllipseIcon","EmbedIcon","EmojiSmileIcon","ErrorAltCircleFilledIcon","ErrorCircleFilledIcon","ErrorCircleIcon","ExpandIcon","FilterAltIcon","FolderIcon","FormButtonIcon","FormChoiceIcon","FormComboboxIcon","FormDateIcon","FormListboxIcon","FormRadioButtonIcon","FormSignatureIcon","FormTextFieldIcon","FullScreenIcon","HelpCircleIcon","HelpIcon","HereIcon","HideIcon","HighlightTextAltIcon","HighlightTextIcon","HorizontalScrollIcon","ImageIcon","InfoCircleFilledIcon","InsertIcon","ItalicIcon","LightBulbIcon","LineIcon","LinkIcon","ListIcon","LockIcon","MagicIcon","MeasureIcon","MinusIcon","MoreIcon","MoreVerticalIcon","NoteArrowRightIcon","NoteCheckIcon","NoteCircleIcon","NoteCloudIcon","NoteCrossIcon","NoteHelpIcon","NoteInsetIcon","NoteKeyIcon","NoteNewParagraphAltIcon","NoteNewParagraphIcon","NoteNoteIcon","NotePointerRightIcon","NoteSpeechBubbleIcon","NoteStarIcon","NumberedListIcon","OpenIcon","PageFittingFillIcon","PageFittingFitIcon","PageHorizontalScrollIcon","PageLayoutDoubleIcon","PageLayoutSingleIcon","PageVerticalScrollIcon","PauseIcon","PenHighlighterIcon","PenIcon","PerimeterIcon","PlaceholderIcon","PlayIcon","PlusIcon","PolygonAreaIcon","PolygonCloudyIcon","PolygonDashedIcon","PolygonIcon","PolylineIcon","ReadOnlyIcon","RectangleAreaIcon","RectangleCloudyIcon","RectangleDashedIcon","RectangleIcon","RedoIcon","RemoveFormattingIcon","ReorderIcon","RotateClockwiseIcon","RotateCounterClockwiseIcon","RulerIcon","SearchIcon","SettingsIcon","ShowIcon","SlashCommandsIcon","SoundRecordIcon","StampIcon","StarFilledIcon","StarIcon","StrikeoutTextAltIcon","TableCellIcon","TableColumnIcon","TableHeaderIcon","TableIcon","TableRowIcon","TextAlignCenterIcon","TextAlignJustifyIcon","TextAlignLeftIcon","TextAlignRightIcon","TextCalloutIcon","TextDecreaseIndentIcon","TextIcon","TextIncreaseIndentIcon","TextMarkIcon","ThumbnailsIcon","ThumbsDownIcon","ThumbsUpIcon","TrashIcon","TypeTextIcon","UnderlineIcon","UndoIcon","UnlockIcon","VerticalScrollIcon","VideoIcon","WarningFilledIcon","WarningIcon","WindowedIcon","WorkflowIcon","XCircleFilledIcon","XIcon"],"20":["AddPageIcon","AnonymousIcon","ArrowLeftIcon","ArrowRightIcon","ArrowUpCircleFilledIcon","AtIcon","AvatarFilledIcon","BoldIcon","CalloutIcon","CaretDownIcon","CaretLeftIcon","CaretRightIcon","CaretUpIcon","CheckCircleFilledIcon","CheckmarkCircleIcon","CheckmarkIcon","ClockIcon","CollapseIcon","CommentIcon","CopyIcon","CutIcon","DistanceIcon","DownloadIcon","DuplicateIcon","EditIcon","EllipseIcon","EmojiSmileIcon","ErrorAltCircleFilledIcon","ErrorAlternativeCircleIcon","ErrorCircleFilledIcon","ErrorCircleIcon","ExpandIcon","FormDateIcon","FormSignatureIcon","FormTextFieldIcon","HelpCircleIcon","HighlightTextIcon","HomeIcon","ImageIcon","InfoCircleFilledIcon","InfoCircleIcon","ItalicIcon","LinkIcon","ListIcon","LockIcon","MagicIcon","MinusIcon","MoreIcon","MoreVerticalIcon","MoveIcon","NoteArrowRightIcon","NoteCheckIcon","NoteCircleIcon","NoteCrossIcon","NoteHelpIcon","NoteInsetIcon","NoteKeyIcon","NoteNewParagraphAltIcon","NoteNewParagraphIcon","NoteNoteIcon","NotePointerRightIcon","NoteSpeechBubbleIcon","NoteStarIcon","OpenIcon","PageMoveLeftIcon","PageMoveRightIcon","PagesInsertIcon","PasteIcon","PipetteIcon","PlusIcon","PrintIcon","RotateClockwiseIcon","SearchIcon","SettingsIcon","ShapeIcon","ShareIcon","SoundIcon","SoundRecordIcon","StarFilledIcon","StarIcon","StyleIcon","TextAlignCenterIcon","TextAlignJustifyIcon","TextAlignLeftIcon","TextAlignRightIcon","TextIcon","ThumbnailsIcon","ThumbsDownIcon","ThumbsUpIcon","TrashIcon","TypeTextIcon","UnderlineIcon","UploadIcon","WarningFilledIcon","WarningIcon","XCircleFilledIcon","XCircleIcon","XIcon"],"24":["AddNoteCloudIcon","AddNoteIcon","AddTextSerifIcon","AiIcon","AirplaneIcon","AlignBottomIcon","AlignHorizontalCenterIcon","AlignMiddleIcon","AlignTopIcon","AnonymousIcon","ArrowDownIcon","ArrowIcon","ArrowLeftIcon","ArrowRightIcon","ArrowUpIcon","AtIcon","AttachmentIcon","AvatarFilledIcon","AvatarIcon","BlendModeIcon","BoldIcon","BookmarkFilledIcon","BookmarkIcon","BorderColorIcon","BottomBorderIcon","BulletListIcon","CalibrateIcon","CaptureAddIcon","CaretDownIcon","CaretIcon","CaretLeftIcon","CaretRightIcon","CaretUpIcon","CheckmarkCircleFilledIcon","CheckmarkCircleIcon","CheckmarkIcon","ChevronListIcon","ClockIcon","CloudyBorderIcon","CollapseIcon","ColorPaletteIcon","ColorSwatchIcon","CommentIcon","CommentInSidebarIcon","CommentOnPageIcon","CompareDocumentsIcon","CopyIcon","CopyPageIcon","CropIcon","CustomizeIcon","CutIcon","DateModifiedIcon","DatePlusIcon","DebugIcon","DocumentArrowDownCircleIcon","DocumentArrowDownIcon","DocumentArrowRightIcon","DocumentFilledIcon","DocumentLockIcon","DocumentPdfIcon","DownloadIcon","DragIndicatorIcon","DragIndicatorVerticalIcon","DuplicateIcon","EditAnnotationsIcon","EditContentIcon","EditDocumentIcon","EditIcon","EditThumbnailsIcon","EllipseAreaIcon","EllipseCloudyIcon","EllipseDashedIcon","EllipseIcon","EmbedIcon","EmojiSmileIcon","EndCapArrowFilledIcon","EndCapArrowIcon","EndCapChevronFilledIcon","EndCapChevronIcon","EndCapCircleIcon","EndCapDiamondIcon","EndCapNoneIcon","EndCapSlantedIcon","EndCapSquareIcon","EndCapStraightIcon","EraserIcon","ErrorAltCircleFilledIcon","ErrorAltIcon","ErrorCircleFilledIcon","ErrorCircleIcon","ExpandIcon","ExpandVerticalIcon","FillColorIcon","FilterIcon","FitToHeightIcon","FivePagesHorizontalFilledIcon","FivePagesVerticalFilledIcon","FolderAddIcon","FolderIcon","FontListIcon","FontSizeIcon","FormButtonIcon","FormChoiceIcon","FormComboboxIcon","FormDateIcon","FormListboxIcon","FormPageIcon","FormRadioButtonIcon","FormSignatureIcon","FormTextFieldIcon","FormTwoRadioButtonsIcon","FourPagesGridFilledIcon","FourPagesHorizontalFilledIcon","FourPagesStackedFilledIcon","FourPagesVerticalFilledIcon","GroupIcon","HamburgerMenuIcon","HandIcon","HeartIcon","HideIcon","HideRevealIcon","HighlightTextIcon","HomeIcon","HorizontalScollIcon","ImageIcon","InfoCircleFilledIcon","InfoCircleIcon","InitialsIcon","InnerHorizontalBorderIcon","InnerVerticalBorderIcon","InsertIcon","ItalicIcon","LayerBottomIcon","LayerDownIcon","LayerTopIcon","LayerUpIcon","LayersIcon","LeftBindingIcon","LeftBorderIcon","LineCapsIcon","LineIcon","LineSpacingIcon","LineStyleCloudyIcon","LineStyleDashedDoubleDashIcon","LineStyleDashedDoubleGapIcon","LineStyleDashedQuadrupleDashIcon","LineStyleDashedSingleGapIcon","LineStyleIcon","LineStyleSolidIcon","LineWidthIcon","LinkIcon","LockFilledIcon","LockIcon","MagicIcon","MagicPenIcon","MailIcon","MarkupIcon","MarqueeZoomIcon","MeasureIcon","MergeIcon","MessageCloudIcon","MinusIcon","MoonIcon","MoreCircleIcon","MoreIcon","MoreVerticalIcon","MoveAllDirectionsIcon","MoveLeftIcon","MoveLeftRightIcon","MoveRightIcon","MultiplePagesIcon","NonEditableIcon","NoteArrowRightIcon","NoteCheckIcon","NoteCircleIcon","NoteCloudIcon","NoteCrossIcon","NoteHelpIcon","NoteIcon","NoteInsetIcon","NoteKeyIcon","NoteNewParagraphAltIcon","NoteNewParagraphIcon","NoteNoteIcon","NotePointerRightIcon","NoteSpeechBubbleIcon","NoteStarIcon","OcrIcon","OpacityIcon","PageAddIcon","PageCurlIcon","PageDuplicateIcon","PageFittingFillIcon","PageFittingFitIcon","PageHorizontalScrollIcon","PageLandscapeIcon","PageLayoutDoubleIcon","PageLayoutSingleIcon","PageMoveLeftIcon","PageMoveRightIcon","PageNumberCircleIcon","PageNumberIcon","PagePortraitIcon","PageRemoveIcon","PageVerticalScrollIcon","PagesInsertAltIcon","PagesInsertIcon","PagesNewFromSelectionAltIcon","PagesNewFromSelectionIcon","PagesSelectAllIcon","PagesSelectNoneIcon","PasteBoardIcon","PastePageIcon","PauseIcon","PenHighlighterIcon","PenIcon","PerimeterIcon","PinDropFilledIcon","PinDropIcon","PipetteIcon","PlayIcon","PlusCircleFilledIcon","PlusCircleIcon","PlusIcon","PointerIcon","PolygonAreaIcon","PolygonCloudyIcon","PolygonDashedIcon","PolygonIcon","PolylineIcon","PrecisionIcon","PrintIcon","PrivateModeIcon","PushPinIcon","QuestionmarkCircleIcon","ReaderViewIcon","RectangleAreaIcon","RectangleCloudyIcon","RectangleDashedIcon","RectangleIcon","RedactIcon","RedactRectangleIcon","RedactTextHighlighterIcon","RedactionTextRepeatingIcon","RedactionTextSingleIcon","RedoAllIcon","RedoIcon","RegexIcon","ReplaceIcon","RightBindingIcon","RightBorderIcon","RotateClockwiseIcon","RotateCounterClockwiseIcon","RotateObjectClockwiseIcon","RotateObjectCounterClockwiseIcon","RulerIcon","ScaleIcon","SearchCircleIcon","SearchIcon","SearchSelectionIcon","SelectAllIcon","SelectionToolIcon","SettingsIcon","ShapesIcon","ShareAltIcon","ShareIcon","ShieldAddIcon","ShieldCheckmarkIcon","ShieldWarningIcon","ShieldXIcon","ShowIcon","SidebarIcon","SignOutIcon","SignatureDigitalIcon","SignatureIcon","SinglePageFilledIcon","SoundIcon","SquigglyTextIcon","StampAddIcon","StampIcon","StarFilledIcon","StarIcon","StartCapArrowFilledIcon","StartCapArrowIcon","StartCapChevronFilledIcon","StartCapChevronIcon","StartCapCircleIcon","StartCapDiamondIcon","StartCapNoneIcon","StartCapSlantedIcon","StartCapSquareIcon","StartCapStraightIcon","StrikeoutTextIcon","StyleFilledIcon","StyleIcon","StylusFilledIcon","StylusIcon","SunIcon","TableCellIcon","TextAlignCenterIcon","TextAlignJustifyIcon","TextAlignLeftIcon","TextAlignRightIcon","TextCalloutIcon","TextColorIcon","TextIcon","TextPropertiesHideIcon","TextPropertiesShowIcon","TextSerifIcon","TextSmallerIcon","ThreePagesHorizontalFilledIcon","ThreePagesStackedFilledIcon","ThreePagesVerticalFilledIcon","ThumbnailsIcon","ThumbsDownIcon","ThumbsUpIcon","TopBorderIcon","TrashIcon","TwoPagesHorizontalFilledIcon","TwoPagesVerticalFilledIcon","TypeTextIcon","UnderlineIcon","UnderlineTextIcon","UndoAllIcon","UndoIcon","UndoRedoIcon","UngroupIcon","UnlockIcon","UploadIcon","UserIcon","VerticalScrollIcon","VideoIcon","WarningFilledIcon","WarningIcon","WidgetIcon","WorkflowIcon","XCircleFilledIcon","XCircleIcon","XIcon","ZoomInIcon","ZoomOutIcon"],"36":["ArrowRight","Check","Circle","Cross","Help","Inset","Key","NewParagraphAlt","NewParagraph","Note","PointerRight","SpeechBubble","Star"]};var p={version:"0.62.0"};var u=`
|
|
32540
|
+
* [Theme documentation](/docs/theming--docs) - Learn about Baseline UI's theming system`};var c={"8":["CaretDownIcon","CaretLeftIcon","CaretRightIcon","CaretUpIcon","ChevronRightFilledIcon","ChevronRightIcon","EllipseIcon","MinusIcon","PlusIcon","XIcon"],"12":["CaretDownIcon","CaretLeftIcon","CaretRightIcon","CaretUpIcon","CheckmarkIcon","DragIndicatorIcon","DragIndicatorVerticalIcon","EditIcon","EllipseIcon","EnterKeyIcon","LockFilledIcon","LockIcon","MinusIcon","MoreVIcon","MoreIcon","PlaceholderIcon","PlusIcon","SearchIcon","SizeIcon","TrashIcon","XIcon","ZoomIcon"],"16":["AlignBottomIcon","AlignMiddleIcon","AlignTopIcon","AnonymousIcon","ArrowDiagonalTopLeftBottomRightIcon","ArrowDownCircleFilledIcon","ArrowDownIcon","ArrowIcon","ArrowLeftRightIcon","ArrowRightIcon","ArrowUpArrowDownIcon","ArrowUpIcon","AtIcon","AttachmentsIcon","AvatarIcon","BoldIcon","BookmarkFilledIcon","BookmarkIcon","BulletListIcon","CalendarIcon","CaretLeftIcon","CaretRightIcon","CheckmarkCircleFilledIcon","CheckmarkCircleIcon","CheckmarkIcon","CircleFilledIcon","ClockIcon","CopyIcon","CustomizeIcon","DocumentEditIcon","DownloadIcon","DuplicateIcon","EditIcon","ElipseAreaIcon","EllipseCloudyIcon","EllipseDashedIcon","EllipseIcon","EmbedIcon","EmojiSmileIcon","ErrorAltCircleFilledIcon","ErrorCircleFilledIcon","ErrorCircleIcon","ExpandIcon","FilterAltIcon","FolderIcon","FormButtonIcon","FormChoiceIcon","FormComboboxIcon","FormDateIcon","FormListboxIcon","FormRadioButtonIcon","FormSignatureIcon","FormTextFieldIcon","FullScreenIcon","HelpCircleIcon","HelpIcon","HereIcon","HideIcon","HighlightTextAltIcon","HighlightTextIcon","HorizontalScrollIcon","ImageIcon","InfoCircleFilledIcon","InsertIcon","ItalicIcon","LightBulbIcon","LineIcon","LinkIcon","ListIcon","LockIcon","MagicIcon","MeasureIcon","MinusIcon","MoreIcon","MoreVerticalIcon","NoteArrowRightIcon","NoteCheckIcon","NoteCircleIcon","NoteCloudIcon","NoteCrossIcon","NoteHelpIcon","NoteInsetIcon","NoteKeyIcon","NoteNewParagraphAltIcon","NoteNewParagraphIcon","NoteNoteIcon","NotePointerRightIcon","NoteSpeechBubbleIcon","NoteStarIcon","NumberedListIcon","OpenIcon","PageFittingFillIcon","PageFittingFitIcon","PageHorizontalScrollIcon","PageLayoutDoubleIcon","PageLayoutSingleIcon","PageVerticalScrollIcon","PauseIcon","PenHighlighterIcon","PenIcon","PerimeterIcon","PlaceholderIcon","PlayIcon","PlusIcon","PolygonAreaIcon","PolygonCloudyIcon","PolygonDashedIcon","PolygonIcon","PolylineIcon","ReadOnlyIcon","RectangleAreaIcon","RectangleCloudyIcon","RectangleDashedIcon","RectangleIcon","RedoIcon","RemoveFormattingIcon","ReorderIcon","RotateClockwiseIcon","RotateCounterClockwiseIcon","RulerIcon","SearchIcon","SettingsIcon","ShowIcon","SlashCommandsIcon","SoundRecordIcon","StampIcon","StarFilledIcon","StarIcon","StrikeoutTextAltIcon","TableCellIcon","TableColumnIcon","TableHeaderIcon","TableIcon","TableRowIcon","TextAlignCenterIcon","TextAlignJustifyIcon","TextAlignLeftIcon","TextAlignRightIcon","TextCalloutIcon","TextDecreaseIndentIcon","TextIcon","TextIncreaseIndentIcon","TextMarkIcon","ThumbnailsIcon","ThumbsDownIcon","ThumbsUpIcon","TrashIcon","TypeTextIcon","UnderlineIcon","UndoIcon","UnlockIcon","VerticalScrollIcon","VideoIcon","WarningFilledIcon","WarningIcon","WindowedIcon","WorkflowIcon","XCircleFilledIcon","XIcon"],"20":["AddPageIcon","AnonymousIcon","ArrowLeftIcon","ArrowRightIcon","ArrowUpCircleFilledIcon","AtIcon","AvatarFilledIcon","BoldIcon","CalloutIcon","CaretDownIcon","CaretLeftIcon","CaretRightIcon","CaretUpIcon","CheckCircleFilledIcon","CheckmarkCircleIcon","CheckmarkIcon","ClockIcon","CollapseIcon","CommentIcon","CopyIcon","CutIcon","DistanceIcon","DownloadIcon","DuplicateIcon","EditIcon","EllipseIcon","EmojiSmileIcon","ErrorAltCircleFilledIcon","ErrorAlternativeCircleIcon","ErrorCircleFilledIcon","ErrorCircleIcon","ExpandIcon","FormDateIcon","FormSignatureIcon","FormTextFieldIcon","HelpCircleIcon","HighlightTextIcon","HomeIcon","ImageIcon","InfoCircleFilledIcon","InfoCircleIcon","ItalicIcon","LinkIcon","ListIcon","LockIcon","MagicIcon","MinusIcon","MoreIcon","MoreVerticalIcon","MoveIcon","NoteArrowRightIcon","NoteCheckIcon","NoteCircleIcon","NoteCrossIcon","NoteHelpIcon","NoteInsetIcon","NoteKeyIcon","NoteNewParagraphAltIcon","NoteNewParagraphIcon","NoteNoteIcon","NotePointerRightIcon","NoteSpeechBubbleIcon","NoteStarIcon","OpenIcon","PageMoveLeftIcon","PageMoveRightIcon","PagesInsertIcon","PasteIcon","PipetteIcon","PlusIcon","PrintIcon","RotateClockwiseIcon","SearchIcon","SettingsIcon","ShapeIcon","ShareIcon","SoundIcon","SoundRecordIcon","StarFilledIcon","StarIcon","StyleIcon","TextAlignCenterIcon","TextAlignJustifyIcon","TextAlignLeftIcon","TextAlignRightIcon","TextIcon","ThumbnailsIcon","ThumbsDownIcon","ThumbsUpIcon","TrashIcon","TypeTextIcon","UnderlineIcon","UploadIcon","WarningFilledIcon","WarningIcon","XCircleFilledIcon","XCircleIcon","XIcon"],"24":["AddNoteCloudIcon","AddNoteIcon","AddTextSerifIcon","AiIcon","AirplaneIcon","AlignBottomIcon","AlignHorizontalCenterIcon","AlignMiddleIcon","AlignTopIcon","AnonymousIcon","ArrowDownIcon","ArrowIcon","ArrowLeftIcon","ArrowRightIcon","ArrowUpIcon","AtIcon","AttachmentIcon","AvatarFilledIcon","AvatarIcon","BlendModeIcon","BoldIcon","BookmarkFilledIcon","BookmarkIcon","BorderColorIcon","BottomBorderIcon","BulletListIcon","CalibrateIcon","CaptureAddIcon","CaretDownIcon","CaretIcon","CaretLeftIcon","CaretRightIcon","CaretUpIcon","CheckmarkCircleFilledIcon","CheckmarkCircleIcon","CheckmarkIcon","ChevronListIcon","ClockIcon","CloudyBorderIcon","CollapseIcon","ColorPaletteIcon","ColorSwatchIcon","CommentIcon","CommentInSidebarIcon","CommentOnPageIcon","CompareDocumentsIcon","CopyIcon","CopyPageIcon","CropIcon","CustomizeIcon","CutIcon","DateModifiedIcon","DatePlusIcon","DebugIcon","DocumentArrowDownCircleIcon","DocumentArrowDownIcon","DocumentArrowRightIcon","DocumentFilledIcon","DocumentLockIcon","DocumentPdfIcon","DownloadIcon","DragIndicatorIcon","DragIndicatorVerticalIcon","DuplicateIcon","EditAnnotationsIcon","EditContentIcon","EditDocumentIcon","EditIcon","EditThumbnailsIcon","EllipseAreaIcon","EllipseCloudyIcon","EllipseDashedIcon","EllipseIcon","EmbedIcon","EmojiSmileIcon","EndCapArrowFilledIcon","EndCapArrowIcon","EndCapChevronFilledIcon","EndCapChevronIcon","EndCapCircleIcon","EndCapDiamondIcon","EndCapNoneIcon","EndCapSlantedIcon","EndCapSquareIcon","EndCapStraightIcon","EraserIcon","ErrorAltCircleFilledIcon","ErrorAltIcon","ErrorCircleFilledIcon","ErrorCircleIcon","ExpandIcon","ExpandVerticalIcon","FillColorIcon","FilterIcon","FitToHeightIcon","FivePagesHorizontalFilledIcon","FivePagesVerticalFilledIcon","FolderAddIcon","FolderIcon","FontListIcon","FontSizeIcon","FormButtonIcon","FormChoiceIcon","FormComboboxIcon","FormDateIcon","FormListboxIcon","FormPageIcon","FormRadioButtonIcon","FormSignatureIcon","FormTextFieldIcon","FormTwoRadioButtonsIcon","FourPagesGridFilledIcon","FourPagesHorizontalFilledIcon","FourPagesStackedFilledIcon","FourPagesVerticalFilledIcon","GroupIcon","HamburgerMenuIcon","HandIcon","HeartIcon","HideIcon","HideRevealIcon","HighlightTextIcon","HomeIcon","HorizontalScollIcon","ImageIcon","InfoCircleFilledIcon","InfoCircleIcon","InitialsIcon","InnerHorizontalBorderIcon","InnerVerticalBorderIcon","InsertIcon","ItalicIcon","LayerBottomIcon","LayerDownIcon","LayerTopIcon","LayerUpIcon","LayersIcon","LeftBindingIcon","LeftBorderIcon","LineCapsIcon","LineIcon","LineSpacingIcon","LineStyleCloudyIcon","LineStyleDashedDoubleDashIcon","LineStyleDashedDoubleGapIcon","LineStyleDashedQuadrupleDashIcon","LineStyleDashedSingleGapIcon","LineStyleIcon","LineStyleSolidIcon","LineWidthIcon","LinkIcon","LockFilledIcon","LockIcon","MagicIcon","MagicPenIcon","MailIcon","MarkupIcon","MarqueeZoomIcon","MeasureIcon","MergeIcon","MessageCloudIcon","MinusIcon","MoonIcon","MoreCircleIcon","MoreIcon","MoreVerticalIcon","MoveAllDirectionsIcon","MoveLeftIcon","MoveLeftRightIcon","MoveRightIcon","MultiplePagesIcon","NonEditableIcon","NoteArrowRightIcon","NoteCheckIcon","NoteCircleIcon","NoteCloudIcon","NoteCrossIcon","NoteHelpIcon","NoteIcon","NoteInsetIcon","NoteKeyIcon","NoteNewParagraphAltIcon","NoteNewParagraphIcon","NoteNoteIcon","NotePointerRightIcon","NoteSpeechBubbleIcon","NoteStarIcon","OcrIcon","OpacityIcon","PageAddIcon","PageCurlIcon","PageDuplicateIcon","PageFittingFillIcon","PageFittingFitIcon","PageHorizontalScrollIcon","PageLandscapeIcon","PageLayoutDoubleIcon","PageLayoutSingleIcon","PageMoveLeftIcon","PageMoveRightIcon","PageNumberCircleIcon","PageNumberIcon","PagePortraitIcon","PageRemoveIcon","PageVerticalScrollIcon","PagesInsertAltIcon","PagesInsertIcon","PagesNewFromSelectionAltIcon","PagesNewFromSelectionIcon","PagesSelectAllIcon","PagesSelectNoneIcon","PasteBoardIcon","PastePageIcon","PauseIcon","PenHighlighterIcon","PenIcon","PerimeterIcon","PinDropFilledIcon","PinDropIcon","PipetteIcon","PlayIcon","PlusCircleFilledIcon","PlusCircleIcon","PlusIcon","PointerIcon","PolygonAreaIcon","PolygonCloudyIcon","PolygonDashedIcon","PolygonIcon","PolylineIcon","PrecisionIcon","PrintIcon","PrivateModeIcon","PushPinIcon","QuestionmarkCircleIcon","ReaderViewIcon","RectangleAreaIcon","RectangleCloudyIcon","RectangleDashedIcon","RectangleIcon","RedactIcon","RedactRectangleIcon","RedactTextHighlighterIcon","RedactionTextRepeatingIcon","RedactionTextSingleIcon","RedoAllIcon","RedoIcon","RegexIcon","ReplaceIcon","RightBindingIcon","RightBorderIcon","RotateClockwiseIcon","RotateCounterClockwiseIcon","RotateObjectClockwiseIcon","RotateObjectCounterClockwiseIcon","RulerIcon","ScaleIcon","SearchCircleIcon","SearchIcon","SearchSelectionIcon","SelectAllIcon","SelectionToolIcon","SettingsIcon","ShapesIcon","ShareAltIcon","ShareIcon","ShieldAddIcon","ShieldCheckmarkIcon","ShieldWarningIcon","ShieldXIcon","ShowIcon","SidebarIcon","SignOutIcon","SignatureDigitalIcon","SignatureIcon","SinglePageFilledIcon","SoundIcon","SquigglyTextIcon","StampAddIcon","StampIcon","StarFilledIcon","StarIcon","StartCapArrowFilledIcon","StartCapArrowIcon","StartCapChevronFilledIcon","StartCapChevronIcon","StartCapCircleIcon","StartCapDiamondIcon","StartCapNoneIcon","StartCapSlantedIcon","StartCapSquareIcon","StartCapStraightIcon","StrikeoutTextIcon","StyleFilledIcon","StyleIcon","StylusFilledIcon","StylusIcon","SunIcon","TableCellIcon","TextAlignCenterIcon","TextAlignJustifyIcon","TextAlignLeftIcon","TextAlignRightIcon","TextCalloutIcon","TextColorIcon","TextIcon","TextPropertiesHideIcon","TextPropertiesShowIcon","TextSerifIcon","TextSmallerIcon","ThreePagesHorizontalFilledIcon","ThreePagesStackedFilledIcon","ThreePagesVerticalFilledIcon","ThumbnailsIcon","ThumbsDownIcon","ThumbsUpIcon","TopBorderIcon","TrashIcon","TwoPagesHorizontalFilledIcon","TwoPagesVerticalFilledIcon","TypeTextIcon","UnderlineIcon","UnderlineTextIcon","UndoAllIcon","UndoIcon","UndoRedoIcon","UngroupIcon","UnlockIcon","UploadIcon","UserIcon","VerticalScrollIcon","VideoIcon","WarningFilledIcon","WarningIcon","WidgetIcon","WorkflowIcon","XCircleFilledIcon","XCircleIcon","XIcon","ZoomInIcon","ZoomOutIcon"],"36":["ArrowRight","Check","Circle","Cross","Help","Inset","Key","NewParagraphAlt","NewParagraph","Note","PointerRight","SpeechBubble","Star"]};var p={version:"0.63.0"};var u=`
|
|
32286
32541
|
# Baseline UI MCP Server Guidelines
|
|
32287
32542
|
|
|
32288
32543
|
This MCP server provides AI assistants with structured access to Baseline UI's comprehensive component documentation, icon library, theming resources, and design guidelines.
|