@d4gger/design-system 4.0.1 → 4.0.2
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/_internal/props/propDef.cjs +2 -1
- package/dist/_internal/props/propDef.cjs.map +2 -2
- package/dist/_internal/props/propDef.d.cts.map +1 -1
- package/dist/_internal/props/propDef.d.mts.map +1 -1
- package/dist/_internal/props/propDef.d.ts.map +1 -1
- package/dist/_internal/props/propDef.js +2 -1
- package/dist/_internal/props/propDef.js.map +2 -2
- package/dist/components/alert.css +12 -0
- package/dist/components/box.css +0 -12
- package/dist/components/config-drawer.css +9 -1
- package/dist/components/configDrawer/ConfigDrawer.cjs +1 -0
- package/dist/components/configDrawer/ConfigDrawer.cjs.map +2 -2
- package/dist/components/configDrawer/ConfigDrawer.d.cts.map +1 -1
- package/dist/components/configDrawer/ConfigDrawer.d.mts.map +1 -1
- package/dist/components/configDrawer/ConfigDrawer.d.ts.map +1 -1
- package/dist/components/configDrawer/ConfigDrawer.js +1 -0
- package/dist/components/configDrawer/ConfigDrawer.js.map +2 -2
- package/dist/components/drawer.css +4 -2
- package/dist/components/flex/Flex.cjs +5 -4
- package/dist/components/flex/Flex.cjs.map +2 -2
- package/dist/components/flex/Flex.d.cts.map +1 -1
- package/dist/components/flex/Flex.d.mts.map +1 -1
- package/dist/components/flex/Flex.d.ts.map +1 -1
- package/dist/components/flex/Flex.js +5 -4
- package/dist/components/flex/Flex.js.map +2 -2
- package/dist/components/grid/Grid.cjs +5 -5
- package/dist/components/grid/Grid.cjs.map +2 -2
- package/dist/components/grid/Grid.d.cts.map +1 -1
- package/dist/components/grid/Grid.d.mts.map +1 -1
- package/dist/components/grid/Grid.d.ts.map +1 -1
- package/dist/components/grid/Grid.js +5 -5
- package/dist/components/grid/Grid.js.map +2 -2
- package/dist/components/input-otp.css +24 -0
- package/dist/components/inputOtp/InputOtp.cjs +2 -1
- package/dist/components/inputOtp/InputOtp.cjs.map +2 -2
- package/dist/components/inputOtp/InputOtp.d.cts +8 -0
- package/dist/components/inputOtp/InputOtp.d.cts.map +1 -1
- package/dist/components/inputOtp/InputOtp.d.mts +8 -0
- package/dist/components/inputOtp/InputOtp.d.mts.map +1 -1
- package/dist/components/inputOtp/InputOtp.d.ts +8 -0
- package/dist/components/inputOtp/InputOtp.d.ts.map +1 -1
- package/dist/components/inputOtp/InputOtp.js +2 -1
- package/dist/components/inputOtp/InputOtp.js.map +2 -2
- package/dist/components/inputOtp/inputOtp.props.cjs +4 -0
- package/dist/components/inputOtp/inputOtp.props.cjs.map +2 -2
- package/dist/components/inputOtp/inputOtp.props.d.cts +4 -0
- package/dist/components/inputOtp/inputOtp.props.d.cts.map +1 -1
- package/dist/components/inputOtp/inputOtp.props.d.mts +4 -0
- package/dist/components/inputOtp/inputOtp.props.d.mts.map +1 -1
- package/dist/components/inputOtp/inputOtp.props.d.ts +4 -0
- package/dist/components/inputOtp/inputOtp.props.d.ts.map +1 -1
- package/dist/components/inputOtp/inputOtp.props.js +4 -0
- package/dist/components/inputOtp/inputOtp.props.js.map +2 -2
- package/dist/components/link.css +21 -0
- package/dist/components/rich-text-editor.css +2 -0
- package/dist/components/richTextEditor/EditorTools.cjs +98 -44
- package/dist/components/richTextEditor/EditorTools.cjs.map +2 -2
- package/dist/components/richTextEditor/EditorTools.d.cts +51 -1
- package/dist/components/richTextEditor/EditorTools.d.cts.map +1 -1
- package/dist/components/richTextEditor/EditorTools.d.mts +51 -1
- package/dist/components/richTextEditor/EditorTools.d.mts.map +1 -1
- package/dist/components/richTextEditor/EditorTools.d.ts +51 -1
- package/dist/components/richTextEditor/EditorTools.d.ts.map +1 -1
- package/dist/components/richTextEditor/EditorTools.js +98 -44
- package/dist/components/richTextEditor/EditorTools.js.map +2 -2
- package/dist/components/richTextEditor/MentionSuggestions.cjs +6 -7
- package/dist/components/richTextEditor/MentionSuggestions.cjs.map +2 -2
- package/dist/components/richTextEditor/MentionSuggestions.d.cts +3 -1
- package/dist/components/richTextEditor/MentionSuggestions.d.cts.map +1 -1
- package/dist/components/richTextEditor/MentionSuggestions.d.mts +3 -1
- package/dist/components/richTextEditor/MentionSuggestions.d.mts.map +1 -1
- package/dist/components/richTextEditor/MentionSuggestions.d.ts +3 -1
- package/dist/components/richTextEditor/MentionSuggestions.d.ts.map +1 -1
- package/dist/components/richTextEditor/MentionSuggestions.js +6 -7
- package/dist/components/richTextEditor/MentionSuggestions.js.map +2 -2
- package/dist/components/richTextEditor/RichTextEditor.cjs +17 -10
- package/dist/components/richTextEditor/RichTextEditor.cjs.map +3 -3
- package/dist/components/richTextEditor/RichTextEditor.d.cts +2 -1
- package/dist/components/richTextEditor/RichTextEditor.d.cts.map +1 -1
- package/dist/components/richTextEditor/RichTextEditor.d.mts +2 -1
- package/dist/components/richTextEditor/RichTextEditor.d.mts.map +1 -1
- package/dist/components/richTextEditor/RichTextEditor.d.ts +2 -1
- package/dist/components/richTextEditor/RichTextEditor.d.ts.map +1 -1
- package/dist/components/richTextEditor/RichTextEditor.js +17 -10
- package/dist/components/richTextEditor/RichTextEditor.js.map +3 -3
- package/dist/components/segmented-control.css +14 -5
- package/dist/docs/component-index.json +1 -1
- package/dist/docs/components/alert.md +4 -0
- package/dist/docs/components/box.md +3 -1
- package/dist/docs/components/config-drawer.md +3 -1
- package/dist/docs/components/grid.md +2 -0
- package/dist/docs/components/input-otp.md +10 -2
- package/dist/docs/components/layout-props.md +4 -1
- package/dist/docs/components/link.md +4 -0
- package/dist/docs/components/rich-text-editor.md +6 -1
- package/dist/docs/components/segmented-control.md +3 -2
- package/dist/layout/Layout.cjs +13 -9
- package/dist/layout/Layout.cjs.map +2 -2
- package/dist/layout/Layout.d.cts.map +1 -1
- package/dist/layout/Layout.d.mts.map +1 -1
- package/dist/layout/Layout.d.ts.map +1 -1
- package/dist/layout/Layout.js +13 -9
- package/dist/layout/Layout.js.map +2 -2
- package/dist/layout/grid-area.cjs +32 -0
- package/dist/layout/grid-area.cjs.map +7 -0
- package/dist/layout/grid-area.d.cts +12 -0
- package/dist/layout/grid-area.d.cts.map +1 -0
- package/dist/layout/grid-area.d.mts +12 -0
- package/dist/layout/grid-area.d.mts.map +1 -0
- package/dist/layout/grid-area.d.ts +12 -0
- package/dist/layout/grid-area.d.ts.map +1 -0
- package/dist/layout/grid-area.js +12 -0
- package/dist/layout/grid-area.js.map +7 -0
- package/dist/styles.css +11366 -12134
- package/package.json +1 -1
|
@@ -58,6 +58,7 @@ declare const RichTextEditor: typeof RichTextEditorRoot & {
|
|
|
58
58
|
export { RichTextEditor, RichTextEditorContent, RichTextEditorRoot, RichTextEditorShell, RichTextEditorToolbar, RichTextEditorToolbarButton, createRichTextEditorExtensions };
|
|
59
59
|
export type { RichTextEditorContentProps, RichTextEditorProps, RichTextEditorShellProps, RichTextEditorToolbarProps, RichTextEditorToolbarButtonProps, RichTextEditorToolbarSlot, RichTextEditorPreset, RichTextEditorExtensionConfig, };
|
|
60
60
|
export { createVariableExtension, createMentionExtension } from './editorTokens.js';
|
|
61
|
+
export { defaultRichTextEditorLocaleText, resolveRichTextEditorLocaleText } from './EditorTools.js';
|
|
61
62
|
export type { EditorVariable, EditorMention } from './editorTokens.js';
|
|
62
|
-
export type { EditorTool, EditorInsertItem, EditorToolsOptions } from './EditorTools.js';
|
|
63
|
+
export type { EditorTool, EditorInsertItem, EditorToolsOptions, RichTextEditorLocaleText } from './EditorTools.js';
|
|
63
64
|
//# sourceMappingURL=RichTextEditor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextEditor.d.ts","sourceRoot":"","sources":["../../../src/components/richTextEditor/RichTextEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAA0C,KAAK,MAAM,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAI1G,OAAO,EAAE,6BAA6B,EAAE,sBAAsB,EAAE,mCAAmC,EAAE,MAAM,wBAAwB,CAAA;AA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10
10
|
import { Toolbar } from "../toolbar/Toolbar.js";
|
|
11
11
|
import { createArticleExtensions } from "../articleNodes/articleExtensions.js";
|
|
12
12
|
import { EditorTools } from "./EditorTools.js";
|
|
13
|
+
import { resolveRichTextEditorLocaleText } from "./EditorTools.js";
|
|
13
14
|
import { createVariableExtension, createMentionExtension } from "./editorTokens.js";
|
|
14
15
|
import { createVariableExtension as createVariableExtension2, createMentionExtension as createMentionExtension2 } from "./editorTokens.js";
|
|
16
|
+
import { defaultRichTextEditorLocaleText, resolveRichTextEditorLocaleText as resolveRichTextEditorLocaleText2 } from "./EditorTools.js";
|
|
15
17
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
18
|
const defaultRichTextEditorExtensions = [StarterKit];
|
|
17
19
|
function createRichTextEditorExtensions(config = {}) {
|
|
@@ -51,18 +53,19 @@ function getRichTextEditorAttributes(editorOptions) {
|
|
|
51
53
|
"data-slot": "rich-text-editor-prosemirror"
|
|
52
54
|
};
|
|
53
55
|
}
|
|
54
|
-
function getRichTextEditorStatus(editor) {
|
|
56
|
+
function getRichTextEditorStatus(editor, localeText) {
|
|
57
|
+
const locale = resolveRichTextEditorLocaleText(localeText);
|
|
55
58
|
if (!editor) {
|
|
56
|
-
return
|
|
59
|
+
return locale.loading;
|
|
57
60
|
}
|
|
58
61
|
const plainText = editor.getText().trim();
|
|
59
62
|
if (plainText.length === 0) {
|
|
60
|
-
return
|
|
63
|
+
return locale.empty;
|
|
61
64
|
}
|
|
62
|
-
return
|
|
65
|
+
return locale.characterCount(plainText.length);
|
|
63
66
|
}
|
|
64
67
|
const RichTextEditorShell = React.forwardRef(
|
|
65
|
-
({ className: propClassName, disabled = false, editor, placeholder, toolbar, tools, headingLevels, insertItems, variables, mentions, ...props }, forwardedRef) => {
|
|
68
|
+
({ className: propClassName, disabled = false, editor, placeholder, toolbar, tools, headingLevels, insertItems, variables, mentions, localeText, ...props }, forwardedRef) => {
|
|
66
69
|
const {
|
|
67
70
|
asChild: _asChild,
|
|
68
71
|
className,
|
|
@@ -85,9 +88,9 @@ const RichTextEditorShell = React.forwardRef(
|
|
|
85
88
|
"data-disabled": disabled ? "true" : void 0,
|
|
86
89
|
"data-slot": "rich-text-editor",
|
|
87
90
|
children: [
|
|
88
|
-
renderRichTextEditorToolbar(toolbar, editor, disabled, { tools, headingLevels, insertItems, variables, mentions }),
|
|
91
|
+
renderRichTextEditorToolbar(toolbar, editor, disabled, { tools, headingLevels, insertItems, variables, mentions, localeText }),
|
|
89
92
|
/* @__PURE__ */ jsx(RichTextEditorContent, { editor, placeholder, disabled }),
|
|
90
|
-
/* @__PURE__ */ jsx("div", { className: "dsx-rich-text-editor__status", "data-slot": "rich-text-editor-status", children: /* @__PURE__ */ jsx("span", { children: getRichTextEditorStatus(editor) }) })
|
|
93
|
+
/* @__PURE__ */ jsx("div", { className: "dsx-rich-text-editor__status", "data-slot": "rich-text-editor-status", children: /* @__PURE__ */ jsx("span", { children: getRichTextEditorStatus(editor, localeText) }) })
|
|
91
94
|
]
|
|
92
95
|
}
|
|
93
96
|
);
|
|
@@ -122,7 +125,7 @@ const RichTextEditorToolbarButton = React.forwardRef(
|
|
|
122
125
|
);
|
|
123
126
|
RichTextEditorToolbarButton.displayName = "RichTextEditorToolbarButton";
|
|
124
127
|
const RichTextEditorToolbar = React.forwardRef(
|
|
125
|
-
({ editor, disabled = false, className, tools, headingLevels, insertItems, variables, mentions, ...props }, forwardedRef) => /* @__PURE__ */ jsx(Toolbar, { asChild: true, dir: props.dir === "rtl" || props.dir === "ltr" ? props.dir : void 0, children: /* @__PURE__ */ jsx("div", { ...props, ref: forwardedRef, className: classNames("dsx-rich-text-editor__toolbar", className), "data-disabled": disabled || !editor ? "true" : void 0, "data-slot": "rich-text-editor-toolbar", "aria-label":
|
|
128
|
+
({ editor, disabled = false, className, tools, headingLevels, insertItems, variables, mentions, localeText, ...props }, forwardedRef) => /* @__PURE__ */ jsx(Toolbar, { asChild: true, dir: props.dir === "rtl" || props.dir === "ltr" ? props.dir : void 0, children: /* @__PURE__ */ jsx("div", { ...props, ref: forwardedRef, className: classNames("dsx-rich-text-editor__toolbar", className), "data-disabled": disabled || !editor ? "true" : void 0, "data-slot": "rich-text-editor-toolbar", "aria-label": resolveRichTextEditorLocaleText(localeText).toolbarLabel, children: /* @__PURE__ */ jsx(EditorTools, { editor, disabled: disabled || !editor, tools, headingLevels, insertItems, variables, mentions, localeText }) }) })
|
|
126
129
|
);
|
|
127
130
|
RichTextEditorToolbar.displayName = "RichTextEditorToolbar";
|
|
128
131
|
const RichTextEditorContent = React.forwardRef(
|
|
@@ -175,6 +178,7 @@ const RichTextEditorRoot = React.forwardRef(
|
|
|
175
178
|
insertItems,
|
|
176
179
|
variables,
|
|
177
180
|
mentions,
|
|
181
|
+
localeText,
|
|
178
182
|
...props
|
|
179
183
|
}, forwardedRef) => {
|
|
180
184
|
const managedContent = isRichTextEditorContent(content) ? content : void 0;
|
|
@@ -251,7 +255,8 @@ const RichTextEditorRoot = React.forwardRef(
|
|
|
251
255
|
headingLevels,
|
|
252
256
|
insertItems,
|
|
253
257
|
variables,
|
|
254
|
-
mentions
|
|
258
|
+
mentions,
|
|
259
|
+
localeText
|
|
255
260
|
}
|
|
256
261
|
);
|
|
257
262
|
}
|
|
@@ -273,6 +278,8 @@ export {
|
|
|
273
278
|
RichTextEditorToolbarButton,
|
|
274
279
|
createMentionExtension2 as createMentionExtension,
|
|
275
280
|
createRichTextEditorExtensions,
|
|
276
|
-
createVariableExtension2 as createVariableExtension
|
|
281
|
+
createVariableExtension2 as createVariableExtension,
|
|
282
|
+
defaultRichTextEditorLocaleText,
|
|
283
|
+
resolveRichTextEditorLocaleText2 as resolveRichTextEditorLocaleText
|
|
277
284
|
};
|
|
278
285
|
//# sourceMappingURL=RichTextEditor.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/richTextEditor/RichTextEditor.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport classNames from 'classnames'\nimport { EditorContent, useEditor, type Content, type Editor, type UseEditorOptions } from '@tiptap/react'\nimport StarterKit from '@tiptap/starter-kit'\n\nimport { extractProps } from '../../_internal/helpers/extractProps'\nimport { richTextEditorContentPropDefs, richTextEditorPropDefs, richTextEditorToolbarButtonPropDefs } from './richTextEditor.props'\nimport { Button } from '../button/Button'\nimport { Icon } from '../icon/Icon'\nimport { Toolbar } from '../toolbar/Toolbar'\nimport { createArticleExtensions } from '../articleNodes/articleExtensions'\nimport { EditorTools, type EditorToolsOptions } from './EditorTools'\nimport { createVariableExtension, createMentionExtension } from './editorTokens'\n\nimport type { GetPropDefTypes } from '../../_internal/props/propDef'\n\ntype RichTextEditorOwnProps = GetPropDefTypes<typeof richTextEditorPropDefs>\ntype RichTextEditorContentOwnProps = GetPropDefTypes<typeof richTextEditorContentPropDefs>\ntype RichTextEditorToolbarButtonOwnProps = GetPropDefTypes<typeof richTextEditorToolbarButtonPropDefs>\n\ntype RichTextEditorManagedEditorOptions = Omit<UseEditorOptions, 'content' | 'editable' | 'extensions' | 'onUpdate'>\ntype RichTextEditorToolbarSlot = React.ReactNode | ((context: { disabled: boolean; editor: Editor | null }) => React.ReactNode)\n\nconst defaultRichTextEditorExtensions: NonNullable<UseEditorOptions['extensions']> = [StarterKit]\n\ntype RichTextEditorPreset = 'basic' | 'article'\ntype RichTextEditorExtensionConfig = Pick<EditorToolsOptions, 'variables' | 'mentions'> & { preset?: RichTextEditorPreset; extensions?: UseEditorOptions['extensions'] }\n\nfunction createRichTextEditorExtensions(config: RichTextEditorExtensionConfig = {}): NonNullable<UseEditorOptions['extensions']> {\n if (config.extensions) return config.extensions\n return [...(config.preset === 'article' ? [StarterKit.configure({ codeBlock: false }), ...createArticleExtensions()] : defaultRichTextEditorExtensions), ...(config.variables ? [createVariableExtension({ variables: config.variables })] : []), ...(config.mentions ? [createMentionExtension({ mentions: config.mentions })] : [])]\n}\n\nfunction isRichTextEditorContent(value: unknown): value is Content {\n return value === null || typeof value === 'string' || typeof value === 'object'\n}\n\nfunction renderRichTextEditorToolbar(toolbar: RichTextEditorToolbarSlot | null | undefined, editor: Editor | null, disabled: boolean, options: EditorToolsOptions) {\n if (toolbar === null) {\n return null\n }\n\n if (typeof toolbar === 'function') {\n return toolbar({ disabled, editor })\n }\n\n if (toolbar !== undefined) {\n return toolbar\n }\n\n return <RichTextEditorToolbar editor={editor} disabled={disabled} {...options} />\n}\n\nfunction getRichTextEditorAttributes(editorOptions?: RichTextEditorManagedEditorOptions): NonNullable<NonNullable<UseEditorOptions['editorProps']>['attributes']> {\n const attributes = editorOptions?.editorProps?.attributes\n if (typeof attributes === 'function') {\n return (state) => {\n const resolved = attributes(state)\n return {\n ...resolved,\n class: classNames('dsx-rich-text-editor__prosemirror', resolved.class),\n 'data-slot': 'rich-text-editor-prosemirror',\n }\n }\n }\n\n return {\n ...attributes,\n class: classNames('dsx-rich-text-editor__prosemirror', attributes?.class),\n 'data-slot': 'rich-text-editor-prosemirror',\n }\n}\n\nfunction getRichTextEditorStatus(editor: Editor | null) {\n if (!editor) {\n return 'Editor loading'\n }\n\n const plainText = editor.getText().trim()\n\n if (plainText.length === 0) {\n return 'Ready to write'\n }\n\n return `${plainText.length} characters`\n}\n\ninterface RichTextEditorProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, 'content' | 'onUpdate'>,\n RichTextEditorOwnProps, EditorToolsOptions {\n content?: unknown\n editorOptions?: RichTextEditorManagedEditorOptions\n extensions?: UseEditorOptions['extensions']\n onEditorUpdate?: (editor: Editor) => void\n onUpdate?: (content: string) => void\n placeholder?: string\n preset?: RichTextEditorPreset\n serialize?: (editor: Editor) => string\n toolbar?: RichTextEditorToolbarSlot | null\n}\n\ninterface RichTextEditorShellProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'>, RichTextEditorOwnProps, EditorToolsOptions {\n editor: Editor | null\n placeholder?: string\n toolbar?: RichTextEditorToolbarSlot | null\n}\n\ninterface RichTextEditorToolbarProps extends React.HTMLAttributes<HTMLDivElement>, EditorToolsOptions {\n editor: Editor | null\n disabled?: boolean\n}\n\ninterface RichTextEditorContentProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'>,\n RichTextEditorContentOwnProps {\n editor: Editor | null\n placeholder?: string\n}\n\ninterface RichTextEditorToolbarButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n RichTextEditorToolbarButtonOwnProps {}\n\nconst RichTextEditorShell = React.forwardRef<HTMLDivElement, RichTextEditorShellProps>(\n ({ className: propClassName, disabled = false, editor, placeholder, toolbar, tools, headingLevels, insertItems, variables, mentions, ...props }, forwardedRef) => {\n const {\n asChild: _asChild,\n className,\n ...editorProps\n } = extractProps(\n {\n ...props,\n className: propClassName,\n disabled,\n },\n richTextEditorPropDefs,\n )\n\n return (\n <div\n {...editorProps}\n ref={forwardedRef}\n className={classNames('dsx-rich-text-editor', className)}\n aria-disabled={disabled}\n data-disabled={disabled ? 'true' : undefined}\n data-slot=\"rich-text-editor\"\n >\n {renderRichTextEditorToolbar(toolbar, editor, disabled, { tools, headingLevels, insertItems, variables, mentions })}\n <RichTextEditorContent editor={editor} placeholder={placeholder} disabled={disabled} />\n <div className=\"dsx-rich-text-editor__status\" data-slot=\"rich-text-editor-status\">\n <span>{getRichTextEditorStatus(editor)}</span>\n </div>\n </div>\n )\n },\n)\nRichTextEditorShell.displayName = 'RichTextEditorShell'\n\nconst RichTextEditorToolbarButton = React.forwardRef<HTMLButtonElement, RichTextEditorToolbarButtonProps>(\n ({ active = false, className: propClassName, ...props }, forwardedRef) => {\n const { asChild, className, ...buttonProps } = extractProps(\n {\n ...props,\n className: propClassName,\n active,\n },\n richTextEditorToolbarButtonPropDefs,\n )\n\n return (\n <Toolbar.Button asChild disabled={buttonProps.disabled}>\n <Button\n {...buttonProps}\n ref={forwardedRef}\n asChild={asChild}\n variant=\"ghost\"\n size=\"sm\"\n aria-pressed={active}\n data-active={active ? 'true' : undefined}\n data-slot=\"rich-text-editor-toolbar-button\"\n className={classNames('dsx-rich-text-editor__toolbar-button', className)}\n />\n </Toolbar.Button>\n )\n },\n)\nRichTextEditorToolbarButton.displayName = 'RichTextEditorToolbarButton'\n\nconst RichTextEditorToolbar = React.forwardRef<HTMLDivElement, RichTextEditorToolbarProps>(\n ({ editor, disabled = false, className, tools, headingLevels, insertItems, variables, mentions, ...props }, forwardedRef) => (\n <Toolbar asChild dir={props.dir === 'rtl' || props.dir === 'ltr' ? props.dir : undefined}>\n <div {...props} ref={forwardedRef} className={classNames('dsx-rich-text-editor__toolbar', className)} data-disabled={disabled || !editor ? 'true' : undefined} data-slot=\"rich-text-editor-toolbar\" aria-label=\"Formatting toolbar\">\n <EditorTools editor={editor} disabled={disabled || !editor} tools={tools} headingLevels={headingLevels} insertItems={insertItems} variables={variables} mentions={mentions} />\n </div>\n </Toolbar>\n ),\n)\nRichTextEditorToolbar.displayName = 'RichTextEditorToolbar'\n\nconst RichTextEditorContent = React.forwardRef<HTMLDivElement, RichTextEditorContentProps>(\n ({ className: propClassName, disabled = false, editor, placeholder, ...props }, forwardedRef) => {\n const {\n asChild: _asChild,\n className,\n mode: _mode,\n ...contentProps\n } = extractProps(\n {\n ...props,\n className: propClassName,\n disabled,\n },\n richTextEditorContentPropDefs,\n )\n\n return (\n <div\n {...contentProps}\n ref={forwardedRef}\n className={classNames('dsx-rich-text-editor__area', className)}\n data-disabled={disabled ? 'true' : undefined}\n data-slot=\"rich-text-editor-area\"\n >\n {editor?.isEmpty && placeholder ? (\n <div className=\"dsx-rich-text-editor__placeholder\" data-slot=\"rich-text-editor-placeholder\">\n {placeholder}\n </div>\n ) : null}\n <EditorContent editor={editor} className=\"dsx-rich-text-editor__content\" data-slot=\"rich-text-editor-content\" />\n </div>\n )\n },\n)\nRichTextEditorContent.displayName = 'RichTextEditorContent'\n\nconst RichTextEditorRoot = React.forwardRef<HTMLDivElement, RichTextEditorProps>(\n (\n {\n className,\n content = '',\n disabled = false,\n editorOptions,\n extensions,\n onEditorUpdate,\n onUpdate,\n placeholder,\n preset = 'basic',\n serialize,\n toolbar, tools, headingLevels, insertItems, variables, mentions,\n ...props\n },\n forwardedRef,\n ) => {\n const managedContent = isRichTextEditorContent(content) ? content : undefined\n\n const onEditorUpdateRef = React.useRef(onEditorUpdate)\n const onUpdateRef = React.useRef(onUpdate)\n const serializeRef = React.useRef(serialize)\n\n React.useEffect(() => {\n onEditorUpdateRef.current = onEditorUpdate\n onUpdateRef.current = onUpdate\n serializeRef.current = serialize\n })\n\n const registryRef = React.useRef({ variables, mentions })\n registryRef.current = { variables, mentions }\n const hasVariables = variables !== undefined\n const hasMentions = mentions !== undefined\n const managedExtensions = React.useMemo(() => extensions ?? [\n ...createRichTextEditorExtensions({ preset }),\n ...(hasVariables ? [createVariableExtension({ variables: () => registryRef.current.variables ?? [] })] : []),\n ...(hasMentions ? [createMentionExtension({ mentions: () => registryRef.current.mentions ?? [] })] : []),\n ], [extensions, preset, hasVariables, hasMentions])\n\n const editor = useEditor(\n {\n ...editorOptions,\n content: managedContent,\n editable: !disabled,\n extensions: managedExtensions,\n immediatelyRender: false,\n shouldRerenderOnTransaction: true,\n editorProps: {\n ...editorOptions?.editorProps,\n attributes: getRichTextEditorAttributes(editorOptions),\n },\n onUpdate: ({ editor: currentEditor }) => {\n onEditorUpdateRef.current?.(currentEditor)\n onUpdateRef.current?.((serializeRef.current ?? ((editorInstance: Editor) => editorInstance.getHTML()))(currentEditor))\n },\n },\n [editorOptions, managedExtensions],\n )\n\n React.useEffect(() => {\n if (editor && !editor.isDestroyed) editor.view.dispatch(editor.state.tr.setMeta('dsxRegistryRefresh', true))\n }, [editor, variables, mentions])\n\n React.useEffect(() => {\n editor?.setEditable(!disabled)\n }, [disabled, editor])\n\n React.useEffect(() => {\n if (!editor) {\n return\n }\n\n if (managedContent === undefined) {\n return\n }\n\n if (typeof managedContent === 'string') {\n if (editor.getHTML() !== managedContent) {\n editor.commands.setContent(managedContent, { emitUpdate: false })\n }\n\n return\n }\n\n if (JSON.stringify(editor.getJSON()) !== JSON.stringify(managedContent)) {\n editor.commands.setContent(managedContent, { emitUpdate: false })\n }\n }, [editor, managedContent])\n\n return (\n <RichTextEditorShell\n {...props}\n ref={forwardedRef}\n className={className}\n disabled={disabled}\n editor={editor}\n placeholder={placeholder}\n toolbar={toolbar}\n tools={tools} headingLevels={headingLevels} insertItems={insertItems} variables={variables} mentions={mentions}\n />\n )\n },\n)\nRichTextEditorRoot.displayName = 'RichTextEditor'\n\nconst RichTextEditor: typeof RichTextEditorRoot & {\n Root: typeof RichTextEditorRoot\n Shell: typeof RichTextEditorShell\n Toolbar: typeof RichTextEditorToolbar\n Content: typeof RichTextEditorContent\n ToolbarButton: typeof RichTextEditorToolbarButton\n} = Object.assign(RichTextEditorRoot, {\n Root: RichTextEditorRoot,\n Shell: RichTextEditorShell,\n Toolbar: RichTextEditorToolbar,\n Content: RichTextEditorContent,\n ToolbarButton: RichTextEditorToolbarButton,\n})\n\nexport { RichTextEditor, RichTextEditorContent, RichTextEditorRoot, RichTextEditorShell, RichTextEditorToolbar, RichTextEditorToolbarButton, createRichTextEditorExtensions }\nexport type {\n RichTextEditorContentProps,\n RichTextEditorProps,\n RichTextEditorShellProps,\n RichTextEditorToolbarProps,\n RichTextEditorToolbarButtonProps,\n RichTextEditorToolbarSlot,\n RichTextEditorPreset,\n RichTextEditorExtensionConfig,\n}\n\nexport { createVariableExtension, createMentionExtension } from './editorTokens'\nexport type { EditorVariable, EditorMention } from './editorTokens'\nexport type { EditorTool, EditorInsertItem, EditorToolsOptions } from './EditorTools'\n"],
|
|
5
|
-
"mappings": ";AAEA,YAAY,WAAW;AACvB,OAAO,gBAAgB;AACvB,SAAS,eAAe,iBAAmE;AAC3F,OAAO,gBAAgB;AAEvB,SAAS,oBAAoB;AAC7B,SAAS,+BAA+B,wBAAwB,2CAA2C;AAC3G,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,eAAe;AACxB,SAAS,+BAA+B;AACxC,SAAS,mBAA4C;AACrD,SAAS,yBAAyB,8BAA8B;
|
|
6
|
-
"names": ["createVariableExtension", "createMentionExtension"]
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport classNames from 'classnames'\nimport { EditorContent, useEditor, type Content, type Editor, type UseEditorOptions } from '@tiptap/react'\nimport StarterKit from '@tiptap/starter-kit'\n\nimport { extractProps } from '../../_internal/helpers/extractProps'\nimport { richTextEditorContentPropDefs, richTextEditorPropDefs, richTextEditorToolbarButtonPropDefs } from './richTextEditor.props'\nimport { Button } from '../button/Button'\nimport { Icon } from '../icon/Icon'\nimport { Toolbar } from '../toolbar/Toolbar'\nimport { createArticleExtensions } from '../articleNodes/articleExtensions'\nimport { EditorTools, type EditorToolsOptions } from './EditorTools'\nimport { resolveRichTextEditorLocaleText, type RichTextEditorLocaleText } from './EditorTools'\nimport { createVariableExtension, createMentionExtension } from './editorTokens'\n\nimport type { GetPropDefTypes } from '../../_internal/props/propDef'\n\ntype RichTextEditorOwnProps = GetPropDefTypes<typeof richTextEditorPropDefs>\ntype RichTextEditorContentOwnProps = GetPropDefTypes<typeof richTextEditorContentPropDefs>\ntype RichTextEditorToolbarButtonOwnProps = GetPropDefTypes<typeof richTextEditorToolbarButtonPropDefs>\n\ntype RichTextEditorManagedEditorOptions = Omit<UseEditorOptions, 'content' | 'editable' | 'extensions' | 'onUpdate'>\ntype RichTextEditorToolbarSlot = React.ReactNode | ((context: { disabled: boolean; editor: Editor | null }) => React.ReactNode)\n\nconst defaultRichTextEditorExtensions: NonNullable<UseEditorOptions['extensions']> = [StarterKit]\n\ntype RichTextEditorPreset = 'basic' | 'article'\ntype RichTextEditorExtensionConfig = Pick<EditorToolsOptions, 'variables' | 'mentions'> & { preset?: RichTextEditorPreset; extensions?: UseEditorOptions['extensions'] }\n\nfunction createRichTextEditorExtensions(config: RichTextEditorExtensionConfig = {}): NonNullable<UseEditorOptions['extensions']> {\n if (config.extensions) return config.extensions\n return [...(config.preset === 'article' ? [StarterKit.configure({ codeBlock: false }), ...createArticleExtensions()] : defaultRichTextEditorExtensions), ...(config.variables ? [createVariableExtension({ variables: config.variables })] : []), ...(config.mentions ? [createMentionExtension({ mentions: config.mentions })] : [])]\n}\n\nfunction isRichTextEditorContent(value: unknown): value is Content {\n return value === null || typeof value === 'string' || typeof value === 'object'\n}\n\nfunction renderRichTextEditorToolbar(toolbar: RichTextEditorToolbarSlot | null | undefined, editor: Editor | null, disabled: boolean, options: EditorToolsOptions) {\n if (toolbar === null) {\n return null\n }\n\n if (typeof toolbar === 'function') {\n return toolbar({ disabled, editor })\n }\n\n if (toolbar !== undefined) {\n return toolbar\n }\n\n return <RichTextEditorToolbar editor={editor} disabled={disabled} {...options} />\n}\n\nfunction getRichTextEditorAttributes(editorOptions?: RichTextEditorManagedEditorOptions): NonNullable<NonNullable<UseEditorOptions['editorProps']>['attributes']> {\n const attributes = editorOptions?.editorProps?.attributes\n if (typeof attributes === 'function') {\n return (state) => {\n const resolved = attributes(state)\n return {\n ...resolved,\n class: classNames('dsx-rich-text-editor__prosemirror', resolved.class),\n 'data-slot': 'rich-text-editor-prosemirror',\n }\n }\n }\n\n return {\n ...attributes,\n class: classNames('dsx-rich-text-editor__prosemirror', attributes?.class),\n 'data-slot': 'rich-text-editor-prosemirror',\n }\n}\n\nfunction getRichTextEditorStatus(editor: Editor | null, localeText?: Partial<RichTextEditorLocaleText>) {\n const locale = resolveRichTextEditorLocaleText(localeText)\n if (!editor) {\n return locale.loading\n }\n\n const plainText = editor.getText().trim()\n\n if (plainText.length === 0) {\n return locale.empty\n }\n\n return locale.characterCount(plainText.length)\n}\n\ninterface RichTextEditorProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, 'content' | 'onUpdate'>,\n RichTextEditorOwnProps, EditorToolsOptions {\n content?: unknown\n editorOptions?: RichTextEditorManagedEditorOptions\n extensions?: UseEditorOptions['extensions']\n onEditorUpdate?: (editor: Editor) => void\n onUpdate?: (content: string) => void\n placeholder?: string\n preset?: RichTextEditorPreset\n serialize?: (editor: Editor) => string\n toolbar?: RichTextEditorToolbarSlot | null\n}\n\ninterface RichTextEditorShellProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'>, RichTextEditorOwnProps, EditorToolsOptions {\n editor: Editor | null\n placeholder?: string\n toolbar?: RichTextEditorToolbarSlot | null\n}\n\ninterface RichTextEditorToolbarProps extends React.HTMLAttributes<HTMLDivElement>, EditorToolsOptions {\n editor: Editor | null\n disabled?: boolean\n}\n\ninterface RichTextEditorContentProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'>,\n RichTextEditorContentOwnProps {\n editor: Editor | null\n placeholder?: string\n}\n\ninterface RichTextEditorToolbarButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n RichTextEditorToolbarButtonOwnProps {}\n\nconst RichTextEditorShell = React.forwardRef<HTMLDivElement, RichTextEditorShellProps>(\n ({ className: propClassName, disabled = false, editor, placeholder, toolbar, tools, headingLevels, insertItems, variables, mentions, localeText, ...props }, forwardedRef) => {\n const {\n asChild: _asChild,\n className,\n ...editorProps\n } = extractProps(\n {\n ...props,\n className: propClassName,\n disabled,\n },\n richTextEditorPropDefs,\n )\n\n return (\n <div\n {...editorProps}\n ref={forwardedRef}\n className={classNames('dsx-rich-text-editor', className)}\n aria-disabled={disabled}\n data-disabled={disabled ? 'true' : undefined}\n data-slot=\"rich-text-editor\"\n >\n {renderRichTextEditorToolbar(toolbar, editor, disabled, { tools, headingLevels, insertItems, variables, mentions, localeText })}\n <RichTextEditorContent editor={editor} placeholder={placeholder} disabled={disabled} />\n <div className=\"dsx-rich-text-editor__status\" data-slot=\"rich-text-editor-status\">\n <span>{getRichTextEditorStatus(editor, localeText)}</span>\n </div>\n </div>\n )\n },\n)\nRichTextEditorShell.displayName = 'RichTextEditorShell'\n\nconst RichTextEditorToolbarButton = React.forwardRef<HTMLButtonElement, RichTextEditorToolbarButtonProps>(\n ({ active = false, className: propClassName, ...props }, forwardedRef) => {\n const { asChild, className, ...buttonProps } = extractProps(\n {\n ...props,\n className: propClassName,\n active,\n },\n richTextEditorToolbarButtonPropDefs,\n )\n\n return (\n <Toolbar.Button asChild disabled={buttonProps.disabled}>\n <Button\n {...buttonProps}\n ref={forwardedRef}\n asChild={asChild}\n variant=\"ghost\"\n size=\"sm\"\n aria-pressed={active}\n data-active={active ? 'true' : undefined}\n data-slot=\"rich-text-editor-toolbar-button\"\n className={classNames('dsx-rich-text-editor__toolbar-button', className)}\n />\n </Toolbar.Button>\n )\n },\n)\nRichTextEditorToolbarButton.displayName = 'RichTextEditorToolbarButton'\n\nconst RichTextEditorToolbar = React.forwardRef<HTMLDivElement, RichTextEditorToolbarProps>(\n ({ editor, disabled = false, className, tools, headingLevels, insertItems, variables, mentions, localeText, ...props }, forwardedRef) => (\n <Toolbar asChild dir={props.dir === 'rtl' || props.dir === 'ltr' ? props.dir : undefined}>\n <div {...props} ref={forwardedRef} className={classNames('dsx-rich-text-editor__toolbar', className)} data-disabled={disabled || !editor ? 'true' : undefined} data-slot=\"rich-text-editor-toolbar\" aria-label={resolveRichTextEditorLocaleText(localeText).toolbarLabel}>\n <EditorTools editor={editor} disabled={disabled || !editor} tools={tools} headingLevels={headingLevels} insertItems={insertItems} variables={variables} mentions={mentions} localeText={localeText} />\n </div>\n </Toolbar>\n ),\n)\nRichTextEditorToolbar.displayName = 'RichTextEditorToolbar'\n\nconst RichTextEditorContent = React.forwardRef<HTMLDivElement, RichTextEditorContentProps>(\n ({ className: propClassName, disabled = false, editor, placeholder, ...props }, forwardedRef) => {\n const {\n asChild: _asChild,\n className,\n mode: _mode,\n ...contentProps\n } = extractProps(\n {\n ...props,\n className: propClassName,\n disabled,\n },\n richTextEditorContentPropDefs,\n )\n\n return (\n <div\n {...contentProps}\n ref={forwardedRef}\n className={classNames('dsx-rich-text-editor__area', className)}\n data-disabled={disabled ? 'true' : undefined}\n data-slot=\"rich-text-editor-area\"\n >\n {editor?.isEmpty && placeholder ? (\n <div className=\"dsx-rich-text-editor__placeholder\" data-slot=\"rich-text-editor-placeholder\">\n {placeholder}\n </div>\n ) : null}\n <EditorContent editor={editor} className=\"dsx-rich-text-editor__content\" data-slot=\"rich-text-editor-content\" />\n </div>\n )\n },\n)\nRichTextEditorContent.displayName = 'RichTextEditorContent'\n\nconst RichTextEditorRoot = React.forwardRef<HTMLDivElement, RichTextEditorProps>(\n (\n {\n className,\n content = '',\n disabled = false,\n editorOptions,\n extensions,\n onEditorUpdate,\n onUpdate,\n placeholder,\n preset = 'basic',\n serialize,\n toolbar, tools, headingLevels, insertItems, variables, mentions, localeText,\n ...props\n },\n forwardedRef,\n ) => {\n const managedContent = isRichTextEditorContent(content) ? content : undefined\n\n const onEditorUpdateRef = React.useRef(onEditorUpdate)\n const onUpdateRef = React.useRef(onUpdate)\n const serializeRef = React.useRef(serialize)\n\n React.useEffect(() => {\n onEditorUpdateRef.current = onEditorUpdate\n onUpdateRef.current = onUpdate\n serializeRef.current = serialize\n })\n\n const registryRef = React.useRef({ variables, mentions })\n registryRef.current = { variables, mentions }\n const hasVariables = variables !== undefined\n const hasMentions = mentions !== undefined\n const managedExtensions = React.useMemo(() => extensions ?? [\n ...createRichTextEditorExtensions({ preset }),\n ...(hasVariables ? [createVariableExtension({ variables: () => registryRef.current.variables ?? [] })] : []),\n ...(hasMentions ? [createMentionExtension({ mentions: () => registryRef.current.mentions ?? [] })] : []),\n ], [extensions, preset, hasVariables, hasMentions])\n\n const editor = useEditor(\n {\n ...editorOptions,\n content: managedContent,\n editable: !disabled,\n extensions: managedExtensions,\n immediatelyRender: false,\n shouldRerenderOnTransaction: true,\n editorProps: {\n ...editorOptions?.editorProps,\n attributes: getRichTextEditorAttributes(editorOptions),\n },\n onUpdate: ({ editor: currentEditor }) => {\n onEditorUpdateRef.current?.(currentEditor)\n onUpdateRef.current?.((serializeRef.current ?? ((editorInstance: Editor) => editorInstance.getHTML()))(currentEditor))\n },\n },\n [editorOptions, managedExtensions],\n )\n\n React.useEffect(() => {\n if (editor && !editor.isDestroyed) editor.view.dispatch(editor.state.tr.setMeta('dsxRegistryRefresh', true))\n }, [editor, variables, mentions])\n\n React.useEffect(() => {\n editor?.setEditable(!disabled)\n }, [disabled, editor])\n\n React.useEffect(() => {\n if (!editor) {\n return\n }\n\n if (managedContent === undefined) {\n return\n }\n\n if (typeof managedContent === 'string') {\n if (editor.getHTML() !== managedContent) {\n editor.commands.setContent(managedContent, { emitUpdate: false })\n }\n\n return\n }\n\n if (JSON.stringify(editor.getJSON()) !== JSON.stringify(managedContent)) {\n editor.commands.setContent(managedContent, { emitUpdate: false })\n }\n }, [editor, managedContent])\n\n return (\n <RichTextEditorShell\n {...props}\n ref={forwardedRef}\n className={className}\n disabled={disabled}\n editor={editor}\n placeholder={placeholder}\n toolbar={toolbar}\n tools={tools} headingLevels={headingLevels} insertItems={insertItems} variables={variables} mentions={mentions} localeText={localeText}\n />\n )\n },\n)\nRichTextEditorRoot.displayName = 'RichTextEditor'\n\nconst RichTextEditor: typeof RichTextEditorRoot & {\n Root: typeof RichTextEditorRoot\n Shell: typeof RichTextEditorShell\n Toolbar: typeof RichTextEditorToolbar\n Content: typeof RichTextEditorContent\n ToolbarButton: typeof RichTextEditorToolbarButton\n} = Object.assign(RichTextEditorRoot, {\n Root: RichTextEditorRoot,\n Shell: RichTextEditorShell,\n Toolbar: RichTextEditorToolbar,\n Content: RichTextEditorContent,\n ToolbarButton: RichTextEditorToolbarButton,\n})\n\nexport { RichTextEditor, RichTextEditorContent, RichTextEditorRoot, RichTextEditorShell, RichTextEditorToolbar, RichTextEditorToolbarButton, createRichTextEditorExtensions }\nexport type {\n RichTextEditorContentProps,\n RichTextEditorProps,\n RichTextEditorShellProps,\n RichTextEditorToolbarProps,\n RichTextEditorToolbarButtonProps,\n RichTextEditorToolbarSlot,\n RichTextEditorPreset,\n RichTextEditorExtensionConfig,\n}\n\nexport { createVariableExtension, createMentionExtension } from './editorTokens'\nexport { defaultRichTextEditorLocaleText, resolveRichTextEditorLocaleText } from './EditorTools'\nexport type { EditorVariable, EditorMention } from './editorTokens'\nexport type { EditorTool, EditorInsertItem, EditorToolsOptions, RichTextEditorLocaleText } from './EditorTools'\n"],
|
|
5
|
+
"mappings": ";AAEA,YAAY,WAAW;AACvB,OAAO,gBAAgB;AACvB,SAAS,eAAe,iBAAmE;AAC3F,OAAO,gBAAgB;AAEvB,SAAS,oBAAoB;AAC7B,SAAS,+BAA+B,wBAAwB,2CAA2C;AAC3G,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,eAAe;AACxB,SAAS,+BAA+B;AACxC,SAAS,mBAA4C;AACrD,SAAS,uCAAsE;AAC/E,SAAS,yBAAyB,8BAA8B;AAoWhE,SAAS,2BAAAA,0BAAyB,0BAAAC,+BAA8B;AAChE,SAAS,iCAAiC,mCAAAC,wCAAuC;AA/TxE,cA0FH,YA1FG;AA3BT,MAAM,kCAA+E,CAAC,UAAU;AAKhG,SAAS,+BAA+B,SAAwC,CAAC,GAAgD;AAC/H,MAAI,OAAO,WAAY,QAAO,OAAO;AACrC,SAAO,CAAC,GAAI,OAAO,WAAW,YAAY,CAAC,WAAW,UAAU,EAAE,WAAW,MAAM,CAAC,GAAG,GAAG,wBAAwB,CAAC,IAAI,iCAAkC,GAAI,OAAO,YAAY,CAAC,wBAAwB,EAAE,WAAW,OAAO,UAAU,CAAC,CAAC,IAAI,CAAC,GAAI,GAAI,OAAO,WAAW,CAAC,uBAAuB,EAAE,UAAU,OAAO,SAAS,CAAC,CAAC,IAAI,CAAC,CAAE;AACvU;AAEA,SAAS,wBAAwB,OAAkC;AACjE,SAAO,UAAU,QAAQ,OAAO,UAAU,YAAY,OAAO,UAAU;AACzE;AAEA,SAAS,4BAA4B,SAAuD,QAAuB,UAAmB,SAA6B;AACjK,MAAI,YAAY,MAAM;AACpB,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,YAAY,YAAY;AACjC,WAAO,QAAQ,EAAE,UAAU,OAAO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sB,IAAI,CAAC;AAAA,IAC7G,GAAG,CAAC,QAAQ,WAAW,QAAQ,CAAC;AAEhC,UAAM,UAAU,MAAM;AACpB,cAAQ,YAAY,CAAC,QAAQ;AAAA,IAC/B,GAAG,CAAC,UAAU,MAAM,CAAC;AAErB,UAAM,UAAU,MAAM;AACpB,UAAI,CAAC,QAAQ;AACX;AAAA,MACF;AAEA,UAAI,mBAAmB,QAAW;AAChC;AAAA,MACF;AAEA,UAAI,OAAO,mBAAmB,UAAU;AACtC,YAAI,OAAO,QAAQ,MAAM,gBAAgB;AACvC,iBAAO,SAAS,WAAW,gBAAgB,EAAE,YAAY,MAAM,CAAC;AAAA,QAClE;AAEA;AAAA,MACF;AAEA,UAAI,KAAK,UAAU,OAAO,QAAQ,CAAC,MAAM,KAAK,UAAU,cAAc,GAAG;AACvE,eAAO,SAAS,WAAW,gBAAgB,EAAE,YAAY,MAAM,CAAC;AAAA,MAClE;AAAA,IACF,GAAG,CAAC,QAAQ,cAAc,CAAC;AAE3B,WACE;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACJ,KAAK;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QAAc;AAAA,QAA8B;AAAA,QAA0B;AAAA,QAAsB;AAAA,QAAoB;AAAA;AAAA,IAClH;AAAA,EAEJ;AACF;AACA,mBAAmB,cAAc;AAEjC,MAAM,iBAMF,OAAO,OAAO,oBAAoB;AAAA,EACpC,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,SAAS;AAAA,EACT,eAAe;AACjB,CAAC;",
|
|
6
|
+
"names": ["createVariableExtension", "createMentionExtension", "resolveRichTextEditorLocaleText"]
|
|
7
7
|
}
|
|
@@ -30,11 +30,18 @@
|
|
|
30
30
|
.dsx-segmented-control:where(.dsx-segmented-control--fill, [data-fill='true']) {
|
|
31
31
|
width: 100%;
|
|
32
32
|
align-self: stretch;
|
|
33
|
+
/* The equal share of the row is the visible padding in fill mode, so the segment padding is only the floor between a label and
|
|
34
|
+
the edge of its pill, and it is small (G-28, 2026-10-06). */
|
|
35
|
+
--dsx-segmented-control-item-gutter: var(--dsx-space-xs);
|
|
33
36
|
}
|
|
34
37
|
|
|
38
|
+
/* A segment shares the row equally wherever its label fits and is never narrower than the label: `overflow-wrap: anywhere` is
|
|
39
|
+
inherited from a card and lets an item shrink below its longest word, which broke «Системная» into two lines on every phone
|
|
40
|
+
(G-28, 2026-10-06: 87px at 320, 96px at 360, 106px at 390 against the 126px the word needs). A label that still does not fit
|
|
41
|
+
makes the root scroll (the containment above), never break a word. */
|
|
35
42
|
.dsx-segmented-control:where(.dsx-segmented-control--fill, [data-fill='true']) .dsx-segmented-control__item {
|
|
36
43
|
flex: 1 1 0;
|
|
37
|
-
min-width:
|
|
44
|
+
min-width: max-content;
|
|
38
45
|
}
|
|
39
46
|
|
|
40
47
|
/* ---- Disabled root ---- */
|
|
@@ -56,7 +63,9 @@
|
|
|
56
63
|
otherwise. No effect in roomy containers. */
|
|
57
64
|
flex-shrink: 0;
|
|
58
65
|
gap: var(--dsx-space-xs);
|
|
59
|
-
|
|
66
|
+
/* `--dsx-segmented-control-item-gutter` is the hook for the inline padding of a segment: unset, each size keeps its own
|
|
67
|
+
(sm, md, lg below). Fill mode and the Preferences drawer's accent row set it (G-28, G-29, 2026-10-06). */
|
|
68
|
+
padding-inline: var(--dsx-segmented-control-item-gutter, var(--dsx-space-md));
|
|
60
69
|
border: 0;
|
|
61
70
|
border-radius: max(0px, calc(var(--dsx-grouped-radius, var(--dsx-rounded-md)) - var(--dsx-space-2xs)));
|
|
62
71
|
background: transparent;
|
|
@@ -186,7 +195,7 @@
|
|
|
186
195
|
|
|
187
196
|
.dsx-segmented-control--sm .dsx-segmented-control__item {
|
|
188
197
|
min-height: calc(var(--dsx-density-control-height-sm, var(--dsx-size-lg)) - 2 * var(--dsx-boundary-control-width));
|
|
189
|
-
padding-inline: var(--dsx-space-sm);
|
|
198
|
+
padding-inline: var(--dsx-segmented-control-item-gutter, var(--dsx-space-sm));
|
|
190
199
|
font-size: var(--dsx-typography-label-small-font-size);
|
|
191
200
|
letter-spacing: var(--dsx-typography-label-small-letter-spacing);
|
|
192
201
|
}
|
|
@@ -197,7 +206,7 @@
|
|
|
197
206
|
|
|
198
207
|
.dsx-segmented-control--md .dsx-segmented-control__item {
|
|
199
208
|
min-height: calc(var(--dsx-density-control-height, var(--dsx-size-xl)) - 2 * var(--dsx-boundary-control-width));
|
|
200
|
-
padding-inline: var(--dsx-space-md);
|
|
209
|
+
padding-inline: var(--dsx-segmented-control-item-gutter, var(--dsx-space-md));
|
|
201
210
|
}
|
|
202
211
|
|
|
203
212
|
.dsx-segmented-control--lg {
|
|
@@ -206,7 +215,7 @@
|
|
|
206
215
|
|
|
207
216
|
.dsx-segmented-control--lg .dsx-segmented-control__item {
|
|
208
217
|
min-height: calc(var(--dsx-density-control-height-lg, var(--dsx-size-2xl)) - 2 * var(--dsx-boundary-control-width));
|
|
209
|
-
padding-inline: var(--dsx-space-lg);
|
|
218
|
+
padding-inline: var(--dsx-segmented-control-item-gutter, var(--dsx-space-lg));
|
|
210
219
|
font-size: var(--dsx-typography-label-large-font-size);
|
|
211
220
|
letter-spacing: var(--dsx-typography-label-large-letter-spacing);
|
|
212
221
|
}
|
|
@@ -110,6 +110,10 @@ The icon is rendered with `size="md"` and `strokeWidth="var(--dsx-icon-stroke-wi
|
|
|
110
110
|
| `Alert.Title` | `dsx-alert__title` | `alert.css` |
|
|
111
111
|
| `Alert.Description` | `dsx-alert__description` | `alert.css` |
|
|
112
112
|
|
|
113
|
+
**Links in the content:**
|
|
114
|
+
|
|
115
|
+
- A default `Link` inside an alert (no `tone`, `color` or `highContrast`, and the default `underline`) inherits the alert's foreground and is underlined at rest (`alert.css`, G-27). The alert's colour carries its meaning, so a link adds no second hue, and the underline is what marks it (colour is not the only cue). A link that sets any of those keeps its own treatment.
|
|
116
|
+
|
|
113
117
|
**Responsive behavior:**
|
|
114
118
|
|
|
115
119
|
- The component does not write `@media` rules. `size`, `variant`, `color`, and `highContrast` are single-value only. The action wrap is intrinsic (`flex-wrap` on the main column), not a breakpoint, so it follows the alert's own width, not the window's.
|
|
@@ -72,7 +72,7 @@ No slots: flat export. `Box` is a single forwardRef that renders a host element
|
|
|
72
72
|
| `flexGrow` | `ResponsiveValue<number>` | `undefined` | no | CSS `flex-grow`. Resolves `--dsx-box-flex-grow`. | yes (initial, sm, md, lg, xl, 2xl) |
|
|
73
73
|
| `flexShrink` | `ResponsiveValue<number>` | `undefined` | no | CSS `flex-shrink`. Resolves `--dsx-box-flex-shrink`. | yes (initial, sm, md, lg, xl, 2xl) |
|
|
74
74
|
| `order` | `ResponsiveValue<number>` | `undefined` | no | CSS `order`. Resolves `--dsx-box-order`. | yes (initial, sm, md, lg, xl, 2xl) |
|
|
75
|
-
| `gridArea` | `ResponsiveValue<string>` | `undefined` | no | CSS `grid-area`.
|
|
75
|
+
| `gridArea` | `ResponsiveValue<string>` | `undefined` | no | CSS `grid-area`. Emits the `dsx-r-ga` utility class and writes `--dsx-r-grid-area`; the class exists only when the prop is used, so it never cancels `gridColumn` or `gridRow` (G-23). | yes (initial, sm, md, lg, xl, 2xl) |
|
|
76
76
|
| `gridColumn` | `ResponsiveValue<string>` | `undefined` | no | CSS `grid-column`. Resolves `--dsx-box-grid-column`. | yes (initial, sm, md, lg, xl, 2xl) |
|
|
77
77
|
| `gridRow` | `ResponsiveValue<string>` | `undefined` | no | CSS `grid-row`. Resolves `--dsx-box-grid-row`. | yes (initial, sm, md, lg, xl, 2xl) |
|
|
78
78
|
| `className` | `string` | `undefined` | no | Extra classes appended to the generated utility class string. | no |
|
|
@@ -110,6 +110,8 @@ The component generates per-breakpoint prefixed classes from responsive values t
|
|
|
110
110
|
**Responsive behavior:**
|
|
111
111
|
|
|
112
112
|
- The component does not write `@media` rules directly. `box.css` does write `@media (min-width: ...)` blocks for `sm`, `md`, `lg`, `xl`, `2xl` so the `--dsx-box-*` cascade works, but the responsive class prefix is generated by the runtime.
|
|
113
|
+
- `box.css` declares `grid-column` and `grid-row` from `--dsx-box-grid-column` and `--dsx-box-grid-row`, and does not declare `grid-area`: a base-rule `grid-area: initial` after them reset both on every Box (G-23). `gridArea` is the `dsx-r-ga` utility instead.
|
|
114
|
+
- A named margin token (`mt="lg"`) applies through the `dsx-r-mt-lg` utility, which sets `--dsx-r-margin-top` and declares `margin-top` from it; the same holds for `m`, `mx`, `my`, `mr`, `mb` and `ml` (G-26).
|
|
113
115
|
- Breakpoints are defined once in `BREAKPOINTS` from `responsive.props.ts` and used everywhere. They are: `sm` 640, `md` 768, `lg` 1024, `xl` 1280, `2xl` 1536.
|
|
114
116
|
|
|
115
117
|
**Reduced motion:**
|
|
@@ -68,6 +68,7 @@ are visual cues; each control has its own programmatic name.
|
|
|
68
68
|
| Row | dsx-config-drawer__row |
|
|
69
69
|
| Information | dsx-config-drawer__row-info |
|
|
70
70
|
| Control | dsx-config-drawer__row-control |
|
|
71
|
+
| Accent control (on the accent `SegmentedControl`) | dsx-config-drawer__accent |
|
|
71
72
|
| Swatch | dsx-config-drawer__accent-swatch |
|
|
72
73
|
| Scaling | dsx-config-drawer__scaling-input |
|
|
73
74
|
|
|
@@ -83,7 +84,8 @@ the shared Drawer contract. No package width breakpoints.
|
|
|
83
84
|
| Body gap / padding | --dsx-space-lg / --dsx-space-md |
|
|
84
85
|
| Row gap / minimum height | --dsx-space-md / --dsx-size-lg |
|
|
85
86
|
| Information gap | --dsx-space-2xs |
|
|
86
|
-
| Swatch size /
|
|
87
|
+
| Swatch size / radius | --dsx-space-sm / --dsx-radius-full (the space to the name is the segment's own `gap`, `--dsx-space-xs`) |
|
|
88
|
+
| Accent segment gutter | --dsx-space-xs (five swatch + name segments are 278px, so the control fits a 360px phone's drawer; the default gutter was 338px in a 328px column, G-29) |
|
|
87
89
|
| Swatch fill | --dsx-color-accent-{rift,warp,ray,astral,spark}-9 |
|
|
88
90
|
| Scaling width | 7ch |
|
|
89
91
|
|
|
@@ -94,6 +94,8 @@ The `dsx-grid` selector wires the grid-template custom properties:
|
|
|
94
94
|
**Responsive behavior:**
|
|
95
95
|
|
|
96
96
|
- The runtime writes `--dsx-grid-columns` (and other `--dsx-grid-*` variables) per breakpoint through `assignResponsiveVars` for the inline-style cascade.
|
|
97
|
+
- A prop that goes through the layout extractor (`areas`, an arbitrary `gap` or `width`, `minWidth`..`maxHeight`, `alignSelf`, `justifySelf`, `flow`, `alignContent`, `justifyItems`, `justifyContent`) writes its custom properties into the element's `style`, and the caller's own `style` comes last. Before G-24 the generated style was overwritten by a later `style=` and those props did nothing.
|
|
98
|
+
- `gap` accepts the space tokens including `gutter` and `margin` (G-26); a token without a utility class (`gutter`, `margin`) is written as `--dsx-box-gap: var(--dsx-space-gutter)` and read by `.dsx-r-gap`.
|
|
97
99
|
- The breakpoint alias props `sm`, `md`, `lg` override their corresponding entries and preserve the rest of the responsive map, including `xl` and `2xl`.
|
|
98
100
|
- Columns and rows use only the component custom-property cascade; duplicate track utility classes are not emitted. Auto-fit minimum widths carry forward as widths and take precedence over column counts until another minimum width is supplied.
|
|
99
101
|
|
|
@@ -37,8 +37,9 @@ A verification-code and short-PIN entry control. The user types into a hidden ab
|
|
|
37
37
|
| Prop | Type | Default | Required | Description | Responsive |
|
|
38
38
|
|---|---|---|---|---|---|
|
|
39
39
|
| `asChild` | `boolean` | `false` | no | Renders the root through `Slot` from `@radix-ui/react-slot`. The `extractProps` step consumes the prop so the host element receives the class. | no |
|
|
40
|
-
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | no | Slot size. Writes `data-size` on the
|
|
40
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | no | Slot size. Writes `data-size` on the hidden input; the slots scale to 0.8× (`sm`) and 1.15× (`lg`) of the fixed width and height through `:has()` rules on the container. With `fill` the cell follows the container, so `size` no longer sets it. | no |
|
|
41
41
|
| `radius` | `'none' \| 'sm' \| 'md' \| 'lg' \| 'full'` | `'md'` | no | Slot corner roundness. Writes `data-radius`. | no |
|
|
42
|
+
| `fill` | `boolean` | `false` | no | The code spans its container: the groups share the row, the slots share a group, and a cell keeps a 5 : 6 portrait proportion with the fixed slot height as its floor and a 24px digit. Writes `data-fill="true"` on the hidden input (with `data-size` and `data-radius`); the prop never reaches the DOM as an attribute. Opt-in: the consumer caps the measure with its container, as for a filled `SegmentedControl`. Where the container is a phone's column the cells come out close to the fixed size (43 × 51 in 277px); in a 372px column they are 59 × 70 (G-30). | no |
|
|
42
43
|
| `containerClassName` | `string` | `undefined` | no | Extra classes appended to `dsx-input-otp`. | no |
|
|
43
44
|
| `className` | `string` | `undefined` | no | Extra classes appended to `dsx-input-otp__hidden-input`. | no |
|
|
44
45
|
| `maxLength` | `number` | `6` | no | Maximum number of characters. The OTP input enforces the cap. The runtime forwards this to `OTPInput`. | no |
|
|
@@ -79,6 +80,7 @@ Rules:
|
|
|
79
80
|
| `data-size` | `sm`, `md`, `lg` | Slot scale follows `:has([data-size])` rules (sm 0.8×, lg 1.15×). | `input-otp.css` |
|
|
80
81
|
| `aria-invalid` | `true` (on the hidden input) | Slots paint `var(--dsx-color-error)` borders via `:has([aria-invalid='true'])`. | `input-otp.css` |
|
|
81
82
|
| `data-radius` | `none`, `sm`, `md`, `lg`, `full` | (attribute written on root; CSS reads `--dsx-radius-*` for the slot border-radius) | `input-otp.css` |
|
|
83
|
+
| `data-fill` | `true` (on the hidden input; absent when `fill` is off) | `.dsx-input-otp:has(.dsx-input-otp__hidden-input[data-fill='true'])` (one row; groups and slots share the width) | `input-otp.css` |
|
|
82
84
|
| `data-active` | `true` | (attribute written on the active slot; CSS uses it to drive the focus border) | `input-otp.css` |
|
|
83
85
|
| `data-filled` | `true` | (attribute written on filled slots) | `input-otp.css` |
|
|
84
86
|
| `data-slot` | `input-otp-input`, `input-otp-group`, `input-otp-slot`, `input-otp-separator`, `input-otp-caret-wrapper`, `input-otp-caret`, `input-otp-separator-dash` | (attribute written for tooling) | `input-otp.css` |
|
|
@@ -113,7 +115,8 @@ Every CSS value the component paints is a `var(--dsx-*)` token.
|
|
|
113
115
|
| Container gap | `var(--dsx-space-sm)` | Gap between groups and separators. |
|
|
114
116
|
| Group gap | `var(--dsx-space-xs)` | Gap between slots inside a group. |
|
|
115
117
|
| Slot width | `var(--dsx-input-otp-slot-width)` | Slot width. |
|
|
116
|
-
| Slot height | `var(--dsx-input-otp-slot-height)` | Slot height. |
|
|
118
|
+
| Slot height | `var(--dsx-input-otp-slot-height)` | Slot height; under `fill` the `min-height` floor of a cell that is otherwise `aspect-ratio: 5 / 6` of its flexed width (a proportion, not a token). |
|
|
119
|
+
| Fill digit | `var(--dsx-typography-headline-medium-font-size)` and `-line-height` | The digit under `fill`: a 16px digit is lost in a 59 × 70 cell. |
|
|
117
120
|
| Slot border | `1px` (hard-coded hairline) | Visual parity with `Input`. |
|
|
118
121
|
| Slot typography | `var(--dsx-typography-body-large-*)` | Slot character ramp. |
|
|
119
122
|
| Caret width | `var(--dsx-input-otp-caret-width)` | Caret width. |
|
|
@@ -189,6 +192,10 @@ Rules:
|
|
|
189
192
|
|
|
190
193
|
- Renders one `InputOtp` per `radius` value (`none`, `sm`, `md`, `lg`, `full`). Asserts the matching `data-radius` attribute is set on the root.
|
|
191
194
|
|
|
195
|
+
**Fill story:**
|
|
196
|
+
|
|
197
|
+
- Renders `InputOtp` with `fill` in a capped column, once as one group and once as two groups around a separator. Asserts the hidden input carries `data-fill="true"`, the slots share the container width with no horizontal spill, and an `InputOtp` without `fill` keeps its fixed 36 × 44 cells.
|
|
198
|
+
|
|
192
199
|
**Composition story:**
|
|
193
200
|
|
|
194
201
|
- Renders `InputOtp` with two `InputOtp.Group` blocks separated by `InputOtp.Separator`. Asserts the separator has `role="separator"`, the dash class is rendered, and the slot groups are split correctly.
|
|
@@ -207,6 +214,7 @@ Rules:
|
|
|
207
214
|
|---|---|---|
|
|
208
215
|
| `size` | select | `md` |
|
|
209
216
|
| `radius` | select | `md` |
|
|
217
|
+
| `fill` | switch | `false` |
|
|
210
218
|
| `maxLength` | number | `6` |
|
|
211
219
|
|
|
212
220
|
## Wiring notes
|
|
@@ -61,7 +61,7 @@ Rules:
|
|
|
61
61
|
|
|
62
62
|
| Custom property group | Token | Consumer CSS file |
|
|
63
63
|
|---|---|---|
|
|
64
|
-
| `--dsx-box-display`, `--dsx-box-position`, `--dsx-box-inset`, `--dsx-box-z-index`, `--dsx-box-min-*`, `--dsx-box-max-*`, `--dsx-box-margin`, `--dsx-box-padding`, `--dsx-box-gap`, `--dsx-box-align-self`, `--dsx-box-justify-self`, `--dsx-box-flex*`, `--dsx-box-order`, `--dsx-box-grid
|
|
64
|
+
| `--dsx-box-display`, `--dsx-box-position`, `--dsx-box-inset`, `--dsx-box-z-index`, `--dsx-box-min-*`, `--dsx-box-max-*`, `--dsx-box-margin`, `--dsx-box-padding`, `--dsx-box-gap`, `--dsx-box-align-self`, `--dsx-box-justify-self`, `--dsx-box-flex*`, `--dsx-box-order`, `--dsx-box-grid-column`, `--dsx-box-grid-row` | (see [Box](./box.md)) | `box.css` |
|
|
65
65
|
| `--dsx-flex-direction`, `--dsx-flex-align`, `--dsx-flex-justify`, `--dsx-flex-wrap` | (see [Flex](./flex.md)) | `flex.css` (consumed with `row` / `stretch` / `flex-start` / `nowrap` fallbacks; written via `FLEX_PROP_DEFS` by `extractLayoutProps` consumers such as `Container`) |
|
|
66
66
|
| `--dsx-grid-columns`, `--dsx-grid-rows`, `--dsx-grid-areas`, `--dsx-grid-auto-flow`, `--dsx-grid-align`, `--dsx-grid-justify`, `--dsx-grid-align-content`, `--dsx-grid-justify-items`, `--dsx-grid-justify-content` | (see [Grid](./grid.md)) | `grid.css` |
|
|
67
67
|
| `--dsx-container-max-width`, `--dsx-container-inset` | (see [Container](./container.md)) | `container.css` |
|
|
@@ -74,6 +74,9 @@ Rules:
|
|
|
74
74
|
|
|
75
75
|
- The responsive contract is the breakpoint set in `BREAKPOINTS` (`sm` 640, `md` 768, `lg` 1024, `xl` 1280, `2xl` 1536) plus the `initial` condition. `BREAKPOINTS` is the only place widths are defined.
|
|
76
76
|
- All exported prop defs use `responsive: true`. The runtime resolves them through `extractProps` and the per-breakpoint CSS cascade.
|
|
77
|
+
- **Cascade order (G-25).** The build puts every base utility (`.dsx-r-*`) before every breakpoint utility (`.sm:dsx-r-*` .. `.2xl:dsx-r-*`) and emits one media block per breakpoint, narrowest first, so a breakpoint value always beats a base value and a wider breakpoint beats a narrower one, whatever the kind of value (numeric token, named token, arbitrary). `postcss-breakpoints-plugin.mjs` does it in one pass at the end; `src/test/styles/layout-utilities.css.test.ts` guards it.
|
|
78
|
+
- **One variable per prop (G-26).** The generic utility for a prop reads the custom property its prop def writes (`--dsx-box-gap`, `--dsx-grid-areas`, `--dsx-box-min-width`, `--dsx-r-px`, ...), with the older `--dsx-r-*` name as the fallback where one existed. The same test guards it.
|
|
79
|
+
- `parseSpaceValue` maps every space token to its variable, `gutter` and `margin` included.
|
|
77
80
|
|
|
78
81
|
**Reduced motion:**
|
|
79
82
|
|
|
@@ -18,6 +18,8 @@ A native inline anchor with readable accent foreground, explicit underline polic
|
|
|
18
18
|
|
|
19
19
|
Single `<a>` root with `dsx-link`; no compound slots. Native anchor attributes and refs are forwarded. `asChild` uses Radix Slot.
|
|
20
20
|
|
|
21
|
+
A `<button>` is a valid `asChild` host for a link-weight action that is not a destination (resend, show more, cancel inside a sentence): `<Link asChild><button type="button" onClick={…}>Resend</button></Link>`. The browser's button chrome is reset so it reads in the line like an anchor, and a `disabled` one takes the muted ink with no underline and a `not-allowed` cursor. A destination is still an `<a href>`.
|
|
22
|
+
|
|
21
23
|
## Props contract
|
|
22
24
|
|
|
23
25
|
| Prop | Type | Default | Required | Description | Responsive |
|
|
@@ -38,6 +40,8 @@ Single `<a>` root with `dsx-link`; no compound slots. Native anchor attributes a
|
|
|
38
40
|
|
|
39
41
|
Root: `dsx-link`. Modifier classes: `dsx-link--auto`, `--always`, `--hover`, `--none`, `--muted`, `--inverse`. Attributes: `data-size`, `data-accent-color`, `data-high-contrast`.
|
|
40
42
|
|
|
43
|
+
A `<button>` host gets a zero-specificity reset (`.dsx-link:where(button)`: no appearance, margin, padding, border or background, `font`, `letter-spacing` and `text-align` inherited) so a size or a tone still wins over it, and `.dsx-link:where(button):disabled` (muted ink `--dsx-color-on-surface-variant`, `text-decoration-line: none`, `cursor: not-allowed`), placed after the colour and hover rules.
|
|
44
|
+
|
|
41
45
|
The root uses native inline flow; multiline links share line boxes with surrounding text. `overflow-wrap: anywhere` allows long identifiers to wrap. SVG children align vertically with a token gutter. Layout primitives can still position a Link as a flex/grid child.
|
|
42
46
|
|
|
43
47
|
Underline policy:
|
|
@@ -53,7 +53,7 @@ The `EditorContent` component from `@tiptap/react` renders inside `RichTextEdito
|
|
|
53
53
|
|---|---|---|---|
|
|
54
54
|
| Toolbar group | `<div>` | `dsx-rich-text-editor__toolbar-group` | Groups related toolbar buttons. `role="group"` with `aria-label`. |
|
|
55
55
|
| Optional custom toolbar label | `<span>` | `dsx-rich-text-editor__toolbar-label` | Group label ("Text", "Blocks", "Insert", "History"). |
|
|
56
|
-
| Status bar | `<div>` | `dsx-rich-text-editor__status` | Shows editor status ("Editor loading", "Ready to write", or character count). `data-slot="rich-text-editor-status"`. |
|
|
56
|
+
| Status bar | `<div>` | `dsx-rich-text-editor__status` | Shows editor status ("Editor loading", "Ready to write", or character count in English by default; every string overridable through `localeText`, with `characterCount` as the count formatter). `data-slot="rich-text-editor-status"`. |
|
|
57
57
|
| Placeholder | `<div>` | `dsx-rich-text-editor__placeholder` | Shown when the editor is empty and a placeholder is provided. `data-slot="rich-text-editor-placeholder"`. |
|
|
58
58
|
| Content host | `EditorContent` | `dsx-rich-text-editor__content` | The Tiptap adapter host. `data-slot="rich-text-editor-content"`. |
|
|
59
59
|
|
|
@@ -79,6 +79,7 @@ The `EditorContent` component from `@tiptap/react` renders inside `RichTextEdito
|
|
|
79
79
|
| `insertItems` | `readonly EditorInsertItem[]` | `[]` | no | Consumer-labelled insertion callbacks. | no |
|
|
80
80
|
| `variables` | `readonly EditorVariable[]` | `undefined` | no | Registry metadata; Root adds key-only atom unless extensions are replaced. | no |
|
|
81
81
|
| `mentions` | `readonly EditorMention[]` | `undefined` | no | User IDs/labels; picker and @ suggestions. Custom schemas add the mention extension. | no |
|
|
82
|
+
| `localeText` | `Partial<RichTextEditorLocaleText>` | English defaults | no | Overrides the shell's user-visible strings: status bar, toolbar groups and controls, token pickers, link popover, mention suggestions. `characterCount` is a `(count: number) => string` formatter. Merged over the English defaults, so partial overrides keep the rest. | no |
|
|
82
83
|
|
|
83
84
|
### `RichTextEditor.Shell` props
|
|
84
85
|
|
|
@@ -95,6 +96,7 @@ The `EditorContent` component from `@tiptap/react` renders inside `RichTextEdito
|
|
|
95
96
|
| `insertItems` | `readonly EditorInsertItem[]` | `[]` | no | Consumer-labelled insertion callbacks. | no |
|
|
96
97
|
| `variables` | `readonly EditorVariable[]` | `undefined` | no | Registry metadata; Root adds key-only atom unless extensions are replaced. | no |
|
|
97
98
|
| `mentions` | `readonly EditorMention[]` | `undefined` | no | User IDs/labels; picker and @ suggestions. Custom schemas add the mention extension. | no |
|
|
99
|
+
| `localeText` | `Partial<RichTextEditorLocaleText>` | English defaults | no | Same bundle as `Root`: status bar, toolbar, pickers, link popover, mention suggestions. | no |
|
|
98
100
|
|
|
99
101
|
### `RichTextEditor.Toolbar` props
|
|
100
102
|
|
|
@@ -108,6 +110,7 @@ The `EditorContent` component from `@tiptap/react` renders inside `RichTextEdito
|
|
|
108
110
|
| `insertItems` | `readonly EditorInsertItem[]` | `[]` | no | Consumer-labelled insertion callbacks. | no |
|
|
109
111
|
| `variables` | `readonly EditorVariable[]` | `undefined` | no | Registry metadata; Root adds key-only atom unless extensions are replaced. | no |
|
|
110
112
|
| `mentions` | `readonly EditorMention[]` | `undefined` | no | User IDs/labels; picker and @ suggestions. Custom schemas add the mention extension. | no |
|
|
113
|
+
| `localeText` | `Partial<RichTextEditorLocaleText>` | English defaults | no | Same bundle as `Root`, toolbar subset: group and control labels, style menu, pickers, link popover. | no |
|
|
111
114
|
|
|
112
115
|
### `RichTextEditor.Content` props
|
|
113
116
|
|
|
@@ -212,6 +215,8 @@ Every CSS value the component paints is a `var(--dsx-*)` token.
|
|
|
212
215
|
| ProseMirror H3 | `var(--dsx-typography-label-large-*)` | H3. |
|
|
213
216
|
| ProseMirror blockquote | `var(--dsx-color-accent-border)` (1px border), `var(--dsx-effect-hover-primary)` (bg) | Decorative quotation rule and wash. |
|
|
214
217
|
| ProseMirror code | `var(--dsx-code-soft-background)` + `var(--dsx-color-on-surface)` | Readable inline code. |
|
|
218
|
+
| Selection wash | `var(--dsx-color-accent-surface)` + `var(--dsx-color-on-surface)` | `::selection` inside the editor content, so selected chips read intentional. |
|
|
219
|
+
| Active picker key | inherits the option button ink | The active variable/mention option key drops the muted surface ink, which fails on the secondary option background. |
|
|
215
220
|
| ProseMirror pre | `var(--dsx-code-soft-background)` + `var(--dsx-color-on-surface)` | Code block. |
|
|
216
221
|
| Status bar | `var(--dsx-color-surface-editor-subtle)` + `var(--dsx-color-on-surface-variant)` | Status surface and text. |
|
|
217
222
|
| Transition | `var(--dsx-motion-duration-fast)` + `var(--dsx-motion-easing-standard)` | Hover and focus transitions. |
|
|
@@ -36,7 +36,7 @@ A single-select control that renders a row of mutually exclusive options, backed
|
|
|
36
36
|
| `activationMode` | `'manual' \| 'automatic'` | `'manual'` | no | Selection timing; writes `data-activation-mode`. `manual` selects only on activation (click, `Enter`, `Space`). `automatic` selects on item focus, so arrow-key navigation selects without `Enter`. | no |
|
|
37
37
|
| `orientation` | `'horizontal' \| 'vertical'` | `'horizontal'` | no | Stacking axis; writes `data-orientation`. Vertical stacks icon columns (ref: view-switcher rails); the sliding indicator measures y/height and arrow keys move up/down via Radix. | no |
|
|
38
38
|
| `disabled` | `boolean` | `false` | no | Disables the entire control; writes `data-disabled`. | no |
|
|
39
|
-
| `fill` | `boolean` | `false` | no | Distributes the track width equally across items; writes `data-fill` and `dsx-segmented-control--fill`; both selectors share the same fill styling. Opt-in for few-item groups that fit (method pickers); the default hug-content root with scroll containment stays for overflowing groups. The sliding indicator measures live boxes, so it tracks fill widths with no change. | no |
|
|
39
|
+
| `fill` | `boolean` | `false` | no | Distributes the track width equally across items; writes `data-fill` and `dsx-segmented-control--fill`; both selectors share the same fill styling. Opt-in for few-item groups that fit (method pickers); the default hug-content root with scroll containment stays for overflowing groups. The sliding indicator measures live boxes, so it tracks fill widths with no change. A segment is never narrower than its own label (`min-width: max-content`) and keeps an `xs` gutter (the equal share is the visible padding), so a label that does not fit makes the root scroll instead of breaking mid-word (G-28: «Системная» broke at 87px, 96px and 106px on 320, 360 and 390 phones; it needs 126px with the default gutter). | no |
|
|
40
40
|
| `value` | `string` | `undefined` | no | Controlled selected value. | no |
|
|
41
41
|
| `defaultValue` | `string` | `undefined` | no | Uncontrolled initial selected value. | no |
|
|
42
42
|
| `onValueChange` | `(value: string) => void` | `undefined` | no | Callback when the selected value changes. | no |
|
|
@@ -75,7 +75,7 @@ Rules:
|
|
|
75
75
|
| `data-variant` | `default`, `outline`, `subtle` | `.dsx-segmented-control--default`, `.dsx-segmented-control--outline`, `.dsx-segmented-control--subtle` | `segmented-control.css` |
|
|
76
76
|
| `data-disabled` | (present/absent) | `.dsx-segmented-control[data-disabled]` | `segmented-control.css` |
|
|
77
77
|
| `data-orientation` | `horizontal`, `vertical` | `.dsx-segmented-control[data-orientation='vertical']` (column stack; indicator measures y/height) | `segmented-control.css` |
|
|
78
|
-
| `data-fill` | (present/absent) | `.dsx-segmented-control--fill` (root spans the container, items share width equally) | `segmented-control.css` |
|
|
78
|
+
| `data-fill` | (present/absent) | `.dsx-segmented-control--fill` (root spans the container, items share width equally and are never narrower than their label) | `segmented-control.css` |
|
|
79
79
|
|
|
80
80
|
**Slot classes:**
|
|
81
81
|
|
|
@@ -127,6 +127,7 @@ Every CSS value the component paints is a `var(--dsx-*)` token.
|
|
|
127
127
|
| Item padding (sm) | `var(--dsx-space-sm)` | Small item horizontal padding |
|
|
128
128
|
| Item padding (md) | `var(--dsx-space-md)` | Default item horizontal padding |
|
|
129
129
|
| Item padding (lg) | `var(--dsx-space-lg)` | Large item horizontal padding |
|
|
130
|
+
| Item gutter hook | `--dsx-segmented-control-item-gutter` | Optional. When set on the control (or any ancestor), it replaces the size padding above in every size. `fill` sets it to `var(--dsx-space-xs)` (the equal share is the visible padding); the Preferences drawer's accent row sets the same (G-28, G-29). Icon-only items ignore it. |
|
|
130
131
|
| Height (sm) | `var(--dsx-density-control-height-sm, var(--dsx-size-lg))` | Small control height |
|
|
131
132
|
| Height (md) | `var(--dsx-density-control-height, var(--dsx-size-xl))` | Default control height |
|
|
132
133
|
| Height (lg) | `var(--dsx-density-control-height-lg, var(--dsx-size-2xl))` | Large control height |
|
package/dist/layout/Layout.cjs
CHANGED
|
@@ -39,6 +39,7 @@ module.exports = __toCommonJS(Layout_exports);
|
|
|
39
39
|
var React = __toESM(require("react"), 1);
|
|
40
40
|
var import_cn = require("../_internal/cn");
|
|
41
41
|
var import_Slot = require("../components/slot/Slot");
|
|
42
|
+
var import_grid_area = require("./grid-area");
|
|
42
43
|
var import_responsive = require("./responsive.props");
|
|
43
44
|
var import_Shared = require("../foundations/Shared");
|
|
44
45
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -123,6 +124,7 @@ function assignArbitraryResponsiveVars(vars, name, value, utilityValues, resolve
|
|
|
123
124
|
return vars;
|
|
124
125
|
}
|
|
125
126
|
function getBoxUtilityClassName({
|
|
127
|
+
gridArea,
|
|
126
128
|
height,
|
|
127
129
|
m,
|
|
128
130
|
mb,
|
|
@@ -160,7 +162,10 @@ function getBoxUtilityClassName({
|
|
|
160
162
|
getResponsiveUtilityClassNames("dsx-r-mt", mt, spacingUtilityValues),
|
|
161
163
|
getResponsiveUtilityClassNames("dsx-r-mr", mr, spacingUtilityValues),
|
|
162
164
|
getResponsiveUtilityClassNames("dsx-r-mb", mb, spacingUtilityValues),
|
|
163
|
-
getResponsiveUtilityClassNames("dsx-r-ml", ml, spacingUtilityValues)
|
|
165
|
+
getResponsiveUtilityClassNames("dsx-r-ml", ml, spacingUtilityValues),
|
|
166
|
+
// gridArea is a utility class that exists only when the prop is used: the base rule's own `grid-area` reset used to cancel
|
|
167
|
+
// gridColumn and gridRow (G-23).
|
|
168
|
+
(0, import_grid_area.getGridAreaProps)(gridArea).className
|
|
164
169
|
);
|
|
165
170
|
}
|
|
166
171
|
function getBoxStyle(style, {
|
|
@@ -253,10 +258,9 @@ function getBoxChildStyle(style, props) {
|
|
|
253
258
|
(0, import_responsive.assignResponsiveVars)(vars, "dsx-box-order", props.order, (value) => value);
|
|
254
259
|
(0, import_responsive.assignResponsiveVars)(vars, "dsx-box-grid-column", props.gridColumn, (value) => value);
|
|
255
260
|
(0, import_responsive.assignResponsiveVars)(vars, "dsx-box-grid-row", props.gridRow, (value) => value);
|
|
256
|
-
(0, import_responsive.assignResponsiveVars)(vars, "dsx-box-grid-area", props.gridArea, (value) => value);
|
|
257
261
|
(0, import_responsive.assignResponsiveVars)(vars, "dsx-box-align-self", props.alignSelf, (value) => resolveAlign(value));
|
|
258
262
|
(0, import_responsive.assignResponsiveVars)(vars, "dsx-box-justify-self", props.justifySelf, (value) => resolveAlign(value));
|
|
259
|
-
return (0, import_Shared.withVars)(style, vars);
|
|
263
|
+
return (0, import_Shared.withVars)(style, { ...vars, ...(0, import_grid_area.getGridAreaProps)(props.gridArea).style });
|
|
260
264
|
}
|
|
261
265
|
function resolveGridAlign(value) {
|
|
262
266
|
if (!value) return void 0;
|
|
@@ -408,7 +412,7 @@ function BoxInner({
|
|
|
408
412
|
Component,
|
|
409
413
|
{
|
|
410
414
|
...rest,
|
|
411
|
-
className: (0, import_cn.cn)("dsx-box", getBoxUtilityClassName({ height, m, mb, ml, mr, mt, mx, my, padding, p, pb, pl, pr, pt, px, py, radius, width }), className),
|
|
415
|
+
className: (0, import_cn.cn)("dsx-box", getBoxUtilityClassName({ gridArea, height, m, mb, ml, mr, mt, mx, my, padding, p, pb, pl, pr, pt, px, py, radius, width }), className),
|
|
412
416
|
style: getBoxChildStyle(boxStyle, { alignSelf, flex, flexBasis, flexGrow, flexShrink, gridArea, gridColumn, gridRow, justifySelf, order }),
|
|
413
417
|
ref,
|
|
414
418
|
children
|
|
@@ -539,7 +543,7 @@ function Flex({
|
|
|
539
543
|
Component,
|
|
540
544
|
{
|
|
541
545
|
...rest,
|
|
542
|
-
className: (0, import_cn.cn)("dsx-box", "dsx-flex", getBoxUtilityClassName({ height, m, mb, ml, mr, mt, mx, my, padding, p, pb, pl, pr, pt, px, py, radius, width }), getFlexUtilityClassName({ align, direction, justify, wrap }), className),
|
|
546
|
+
className: (0, import_cn.cn)("dsx-box", "dsx-flex", getBoxUtilityClassName({ gridArea, height, m, mb, ml, mr, mt, mx, my, padding, p, pb, pl, pr, pt, px, py, radius, width }), getFlexUtilityClassName({ align, direction, justify, wrap }), className),
|
|
543
547
|
"data-gap": serializeResponsiveValue(gap),
|
|
544
548
|
"data-align": serializeResponsiveValue(align),
|
|
545
549
|
"data-justify": serializeResponsiveValue(justify),
|
|
@@ -688,7 +692,7 @@ function Grid({
|
|
|
688
692
|
Component,
|
|
689
693
|
{
|
|
690
694
|
...rest,
|
|
691
|
-
className: (0, import_cn.cn)("dsx-box", "dsx-grid", getBoxUtilityClassName({ height, m, mb, ml, mr, mt, mx, my, padding, p, pb, pl, pr, pt, px, py, radius, width }), className),
|
|
695
|
+
className: (0, import_cn.cn)("dsx-box", "dsx-grid", getBoxUtilityClassName({ gridArea, height, m, mb, ml, mr, mt, mx, my, padding, p, pb, pl, pr, pt, px, py, radius, width }), className),
|
|
692
696
|
"data-gap": serializeResponsiveValue(responsiveGap),
|
|
693
697
|
"data-align": serializeResponsiveValue(responsiveAlign),
|
|
694
698
|
"data-justify": serializeResponsiveValue(responsiveJustify),
|
|
@@ -813,7 +817,7 @@ function Stack({
|
|
|
813
817
|
Component,
|
|
814
818
|
{
|
|
815
819
|
...rest,
|
|
816
|
-
className: (0, import_cn.cn)("dsx-box", "dsx-flex", "dsx-stack", getBoxUtilityClassName({ height, m, mb, ml, mr, mt, mx, my, padding, p, pb, pl, pr, pt, px, py, radius, width }), getFlexUtilityClassName({ align: responsiveAlign, direction: responsiveDirection, justify: responsiveJustify, wrap: responsiveWrap }), className),
|
|
820
|
+
className: (0, import_cn.cn)("dsx-box", "dsx-flex", "dsx-stack", getBoxUtilityClassName({ gridArea, height, m, mb, ml, mr, mt, mx, my, padding, p, pb, pl, pr, pt, px, py, radius, width }), getFlexUtilityClassName({ align: responsiveAlign, direction: responsiveDirection, justify: responsiveJustify, wrap: responsiveWrap }), className),
|
|
817
821
|
"data-gap": serializeResponsiveValue(responsiveGap),
|
|
818
822
|
"data-align": serializeResponsiveValue(responsiveAlign),
|
|
819
823
|
"data-justify": serializeResponsiveValue(responsiveJustify),
|
|
@@ -906,7 +910,7 @@ function Container({
|
|
|
906
910
|
Component,
|
|
907
911
|
{
|
|
908
912
|
...rest,
|
|
909
|
-
className: (0, import_cn.cn)("dsx-box", usesFlexLayout && "dsx-flex", "dsx-container", getBoxUtilityClassName({ height, m, mb, ml, mr, mt, mx, my, padding, p, pb, pl, pr, pt, px, py, radius, width }), getFlexUtilityClassName({ align: responsiveAlign, direction: responsiveDirection, justify: responsiveJustify, wrap: responsiveWrap }), className),
|
|
913
|
+
className: (0, import_cn.cn)("dsx-box", usesFlexLayout && "dsx-flex", "dsx-container", getBoxUtilityClassName({ gridArea, height, m, mb, ml, mr, mt, mx, my, padding, p, pb, pl, pr, pt, px, py, radius, width }), getFlexUtilityClassName({ align: responsiveAlign, direction: responsiveDirection, justify: responsiveJustify, wrap: responsiveWrap }), className),
|
|
910
914
|
"data-gap": serializeResponsiveValue(responsiveGap),
|
|
911
915
|
"data-align": serializeResponsiveValue(responsiveAlign),
|
|
912
916
|
"data-justify": serializeResponsiveValue(responsiveJustify),
|
|
@@ -933,7 +937,7 @@ function Section({
|
|
|
933
937
|
Component,
|
|
934
938
|
{
|
|
935
939
|
...rest,
|
|
936
|
-
className: (0, import_cn.cn)("dsx-box", "dsx-section", getBoxUtilityClassName({ height, m, mb, ml, mr, mt, mx, my, padding, p, pb, pl, pr, pt, px, py, radius, width }), className),
|
|
940
|
+
className: (0, import_cn.cn)("dsx-box", "dsx-section", getBoxUtilityClassName({ gridArea, height, m, mb, ml, mr, mt, mx, my, padding, p, pb, pl, pr, pt, px, py, radius, width }), className),
|
|
937
941
|
style: getBoxChildStyle(vars, { alignSelf, flex, flexBasis, flexGrow, flexShrink, gridArea, gridColumn, gridRow, justifySelf, order }),
|
|
938
942
|
children
|
|
939
943
|
}
|