@d4gger/design-system 4.1.0 → 4.1.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/BaseDialog.cjs +21 -18
- package/dist/_internal/BaseDialog.cjs.map +3 -3
- package/dist/_internal/BaseDialog.d.cts +3 -3
- package/dist/_internal/BaseDialog.d.cts.map +1 -1
- package/dist/_internal/BaseDialog.d.mts +3 -3
- package/dist/_internal/BaseDialog.d.mts.map +1 -1
- package/dist/_internal/BaseDialog.d.ts +3 -3
- package/dist/_internal/BaseDialog.d.ts.map +1 -1
- package/dist/_internal/BaseDialog.js +21 -18
- package/dist/_internal/BaseDialog.js.map +3 -3
- package/dist/components/richTextEditor/EditorTools.cjs +9 -6
- package/dist/components/richTextEditor/EditorTools.cjs.map +3 -3
- package/dist/components/richTextEditor/EditorTools.d.cts.map +1 -1
- package/dist/components/richTextEditor/EditorTools.d.mts.map +1 -1
- package/dist/components/richTextEditor/EditorTools.d.ts.map +1 -1
- package/dist/components/richTextEditor/EditorTools.js +9 -6
- package/dist/components/richTextEditor/EditorTools.js.map +3 -3
- package/dist/docs/component-index.json +1 -1
- package/dist/docs/components/rich-text-editor.md +1 -1
- package/dist/foundations/Theme.cjs +5 -3
- package/dist/foundations/Theme.cjs.map +3 -3
- package/dist/foundations/Theme.d.cts +1 -1
- package/dist/foundations/Theme.d.cts.map +1 -1
- package/dist/foundations/Theme.d.mts +1 -1
- package/dist/foundations/Theme.d.mts.map +1 -1
- package/dist/foundations/Theme.d.ts +1 -1
- package/dist/foundations/Theme.d.ts.map +1 -1
- package/dist/foundations/Theme.js +5 -3
- package/dist/foundations/Theme.js.map +3 -3
- package/dist/tokens.dtcg.json +2511 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/richTextEditor/EditorTools.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react'\nimport { NodeSelection, TextSelection } from '@tiptap/pm/state'\nimport type { Editor } from '@tiptap/react'\ntype Level = 1 | 2 | 3 | 4 | 5 | 6\nimport { Button } from '../button/Button'\nimport { Icon } from '../icon/Icon'\nimport { Toolbar } from '../toolbar/Toolbar'\nimport { DropdownMenu } from '../dropdownMenu/DropdownMenu'\nimport { Popover } from '../popover/Popover'\nimport { TextField } from '../textField/TextField'\nimport { VisuallyHidden } from '../visuallyHidden/VisuallyHidden'\nimport { MentionSuggestions } from './MentionSuggestions'\nimport type { EditorVariable, EditorMention } from './editorTokens'\n\nexport type EditorTool = 'style' | 'bold' | 'italic' | 'strike' | 'code' | 'bulletList' | 'orderedList' | 'blockquote' | 'codeBlock' | 'link' | 'clear' | 'history'\nexport interface EditorInsertItem { id: string; label: string; insert: (editor: Editor) => void }\nexport interface EditorToolsOptions {\n tools?: readonly EditorTool[]\n headingLevels?: readonly Level[]\n insertItems?: readonly EditorInsertItem[]\n variables?: readonly EditorVariable[]\n mentions?: readonly EditorMention[]\n localeText?: Partial<RichTextEditorLocaleText>\n}\nexport interface RichTextEditorLocaleText {\n loading: string\n empty: string\n characterCount: (count: number) => string\n toolbarLabel: string\n blockStyleGroup: string\n textStyleGroup: string\n insertGroup: string\n historyGroup: string\n textStyle: string\n paragraph: string\n heading: (level: number) => string\n quoteBlock: string\n codeBlock: string\n insert: string\n bold: string\n italic: string\n strikethrough: string\n inlineCode: string\n bulletList: string\n orderedList: string\n link: string\n clearFormatting: string\n undo: string\n redo: string\n variable: string\n mention: string\n insertVariable: string\n mentionSomeone: string\n variableDescription: string\n mentionDescription: string\n searchVariables: string\n searchPeople: string\n variables: string\n people: string\n noMatches: string\n sensitiveSuffix: string\n editLink: string\n linkDescription: string\n urlLabel: string\n urlInvalid: string\n saveLink: string\n removeLink: string\n mentionSuggestions: string\n peopleMatching: (query: string) => string\n noMatchingPeople: string\n}\nexport const defaultRichTextEditorLocaleText: RichTextEditorLocaleText = {\n loading: 'Editor loading',\n empty: 'Ready to write',\n characterCount: (count) => `${count} characters`,\n toolbarLabel: 'Formatting toolbar',\n blockStyleGroup: 'Block style',\n textStyleGroup: 'Text style',\n insertGroup: 'Insert',\n historyGroup: 'History',\n textStyle: 'Text style',\n paragraph: 'Paragraph',\n heading: (level) => `Heading ${level}`,\n quoteBlock: 'Quote block',\n codeBlock: 'Code block',\n insert: 'Insert',\n bold: 'Bold',\n italic: 'Italic',\n strikethrough: 'Strikethrough',\n inlineCode: 'Inline code',\n bulletList: 'Bulleted list',\n orderedList: 'Numbered list',\n link: 'Link',\n clearFormatting: 'Clear formatting',\n undo: 'Undo',\n redo: 'Redo',\n variable: 'Variable',\n mention: 'Mention',\n insertVariable: 'Insert variable',\n mentionSomeone: 'Mention someone',\n variableDescription: 'Insert a key. Its value is resolved by your application.',\n mentionDescription: 'Select a person to insert their stable identity.',\n searchVariables: 'Search variables',\n searchPeople: 'Search people',\n variables: 'Variables',\n people: 'People',\n noMatches: 'No matches',\n sensitiveSuffix: ' \u00B7 Sensitive',\n editLink: 'Edit link',\n linkDescription: 'Link the selected text or insert a URL at the caret.',\n urlLabel: 'URL',\n urlInvalid: 'Enter a valid https, http, mailto or tel URL.',\n saveLink: 'Save link',\n removeLink: 'Remove link',\n mentionSuggestions: 'Mention suggestions',\n peopleMatching: (query) => `People matching @${query}`,\n noMatchingPeople: 'No matching people',\n}\nexport function resolveRichTextEditorLocaleText(localeText?: Partial<RichTextEditorLocaleText>): RichTextEditorLocaleText {\n return { ...defaultRichTextEditorLocaleText, ...localeText }\n}\nconst defaults: EditorTool[] = ['style', 'bold', 'italic', 'strike', 'code', 'bulletList', 'orderedList', 'blockquote', 'codeBlock', 'link', 'clear', 'history']\nfunction Control({ children, ...props }: React.ComponentProps<typeof Button>) {\n return <Toolbar.Button asChild disabled={props.disabled}><Button type=\"button\" size=\"sm\" variant=\"ghost\" className=\"dsx-rich-text-editor__toolbar-button\" {...props}>{children}</Button></Toolbar.Button>\n}\nfunction TokenPicker({ editor, disabled, records, kind, localeText }: { editor: Editor; disabled: boolean; records: readonly (EditorVariable | EditorMention)[]; kind: 'variable' | 'mention'; localeText?: Partial<RichTextEditorLocaleText> }) {\n const locale = resolveRichTextEditorLocaleText(localeText)\n const [open, setOpen] = React.useState(false)\n const [query, setQuery] = React.useState('')\n const [active, setActive] = React.useState(0)\n const listId = React.useId()\n const matches = records.filter(record => `${record.label} ${'key' in record ? record.key : record.id}`.toLowerCase().includes(query.toLowerCase()))\n const insert = (index: number) => {\n const record = matches[index]\n if (!record) return\n editor.chain().focus().insertContent({ type: kind === 'variable' ? 'dsxVariable' : 'dsxMention', attrs: 'key' in record ? { key: record.key } : { userId: record.id } }).run()\n setOpen(false)\n }\n return <Popover open={open} onOpenChange={next => { setOpen(next); setQuery(''); setActive(0) }}>\n <Popover.Trigger asChild><Control disabled={disabled}>{kind === 'variable' ? locale.variable : locale.mention}</Control></Popover.Trigger>\n <Popover.Content className=\"dsx-editor-tools__popover\" align=\"start\" onCloseAutoFocus={event => { event.preventDefault(); editor.commands.focus() }}>\n <Popover.Title>{kind === 'variable' ? locale.insertVariable : locale.mentionSomeone}</Popover.Title>\n <Popover.Description>{kind === 'variable' ? locale.variableDescription : locale.mentionDescription}</Popover.Description>\n <TextField><TextField.Input aria-label={kind === 'variable' ? locale.searchVariables : locale.searchPeople} role=\"combobox\" aria-expanded=\"true\" aria-controls={listId} aria-activedescendant={matches.length ? `${listId}-${active}` : undefined} value={query} onChange={event => { setQuery(event.target.value); setActive(0) }} onKeyDown={event => {\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') { event.preventDefault(); setActive(index => Math.max(0, Math.min(matches.length - 1, index + (event.key === 'ArrowDown' ? 1 : -1)))) }\n if (event.key === 'Enter') { event.preventDefault(); insert(active) }\n }} /></TextField>\n <div id={listId} role=\"listbox\" aria-label={kind === 'variable' ? locale.variables : locale.people} className=\"dsx-editor-tools__choices\">\n {matches.map((record, index) => <Button id={`${listId}-${index}`} key={'key' in record ? record.key : record.id} role=\"option\" aria-selected={active === index} type=\"button\" variant={active === index ? 'secondary' : 'ghost'} size=\"lg\" onClick={() => insert(index)} onPointerMove={() => setActive(index)}>\n <span>{record.label}{'sensitive' in record && record.sensitive ? locale.sensitiveSuffix : ''}<small>{'key' in record ? record.key : record.id}</small></span>\n </Button>)}\n {!matches.length ? <span role=\"status\">{locale.noMatches}</span> : null}\n </div>\n </Popover.Content>\n </Popover>\n}\nfunction LinkControl({ editor, disabled, localeText }: { editor: Editor; disabled: boolean; localeText?: Partial<RichTextEditorLocaleText> }) {\n const locale = resolveRichTextEditorLocaleText(localeText)\n const [open, setOpen] = React.useState(false)\n const [url, setUrl] = React.useState('')\n const [error, setError] = React.useState('')\n const urlId = React.useId()\n const selection = React.useRef({ from: 1, to: 1 })\n const save = () => {\n let href: string\n try { const parsed = new URL(url); if (!['https:', 'http:', 'mailto:', 'tel:'].includes(parsed.protocol)) throw new Error(); href = parsed.href } catch { setError(locale.urlInvalid); return }\n const chain = editor.chain().focus().setTextSelection(selection.current)\n if (selection.current.from === selection.current.to && !editor.isActive('link')) chain.insertContent({ type: 'text', text: href, marks: [{ type: 'link', attrs: { href } }] }).run()\n else chain.extendMarkRange('link').setLink({ href }).run()\n setOpen(false)\n }\n return <Popover open={open} onOpenChange={next => { if (next) { selection.current = { from: editor.state.selection.from, to: editor.state.selection.to }; setUrl(editor.getAttributes('link').href ?? ''); setError('') }; setOpen(next) }}>\n <Popover.Trigger asChild><Control disabled={disabled} aria-label={locale.link} aria-pressed={editor.isActive('link')}><Icon name=\"link\" size=\"sm\" /></Control></Popover.Trigger>\n <Popover.Content className=\"dsx-editor-tools__popover dsx-editor-tools__link\" align=\"start\" onCloseAutoFocus={event => { event.preventDefault(); editor.commands.focus() }}>\n <Popover.Title>{locale.editLink}</Popover.Title><VisuallyHidden asChild><Popover.Description>{locale.linkDescription}</Popover.Description></VisuallyHidden>\n <TextField id={urlId} label={locale.urlLabel} errorText={error || undefined} invalid={Boolean(error)}><TextField.Input value={url} onChange={event => { setUrl(event.target.value); setError('') }} onKeyDown={event => { if (event.key === 'Enter') { event.preventDefault(); save() } }} /></TextField>\n <div className=\"dsx-editor-tools__actions\"><Button type=\"button\" size=\"md\" onClick={save}>{locale.saveLink}</Button><Button type=\"button\" size=\"md\" variant=\"outline\" disabled={!editor.isActive('link')} onClick={() => { editor.chain().focus().setTextSelection(selection.current).extendMarkRange('link').unsetLink().run(); setOpen(false) }}>{locale.removeLink}</Button></div>\n </Popover.Content>\n </Popover>\n}\nexport function EditorTools({ editor, disabled, tools = defaults, headingLevels, insertItems = [], variables = [], mentions = [], localeText }: EditorToolsOptions & { editor: Editor | null; disabled: boolean }) {\n const locale = resolveRichTextEditorLocaleText(localeText)\n const [, refresh] = React.useReducer(value => value + 1, 0)\n React.useEffect(() => { if (!editor) return; editor.on('transaction', refresh); return () => { editor.off('transaction', refresh) } }, [editor])\n const available = (tool: EditorTool, name?: string) => tools.includes(tool) && (!name || Boolean(editor?.schema.nodes[name] || editor?.schema.marks[name]))\n const levels = headingLevels ?? editor?.extensionManager.extensions.find(extension => extension.name === 'heading')?.options.levels ?? [1, 2, 3]\n const format = (label: string, icon: React.ComponentProps<typeof Icon>['name'], name: string, run: () => void) => <Control key={name} disabled={disabled} aria-label={label} aria-pressed={editor?.isActive(name)} onMouseDown={event => event.preventDefault()} onClick={run}><Icon name={icon} size=\"sm\" /></Control>\n return <>\n {available('style') ? <div className=\"dsx-rich-text-editor__toolbar-group\" role=\"group\" aria-label={locale.blockStyleGroup}><DropdownMenu><DropdownMenu.Trigger asChild><Control disabled={disabled}>{locale.textStyle} <Icon name=\"chevron-down\" size=\"sm\" /></Control></DropdownMenu.Trigger><DropdownMenu.Content onCloseAutoFocus={event => { event.preventDefault(); editor?.commands.focus() }}>\n <DropdownMenu.Item onSelect={() => editor?.chain().focus().setParagraph().run()}>{locale.paragraph}</DropdownMenu.Item>\n {editor?.schema.nodes.heading ? (levels as Level[]).map(level => <DropdownMenu.Item key={level} onSelect={() => editor.chain().focus().toggleHeading({ level }).run()}>{locale.heading(level)}</DropdownMenu.Item>) : null}\n {available('blockquote', 'blockquote') ? <DropdownMenu.Item onSelect={() => editor?.chain().focus().toggleBlockquote().run()}>{locale.quoteBlock}</DropdownMenu.Item> : null}\n {available('codeBlock', 'codeBlock') ? <DropdownMenu.Item onSelect={() => editor?.chain().focus().toggleCodeBlock().run()}>{locale.codeBlock}</DropdownMenu.Item> : null}\n </DropdownMenu.Content></DropdownMenu></div> : null}\n <div className=\"dsx-rich-text-editor__toolbar-group\" role=\"group\" aria-label={locale.textStyleGroup}>\n {available('bold', 'bold') ? format(locale.bold, 'bold', 'bold', () => editor?.chain().focus().toggleBold().run()) : null}\n {available('italic', 'italic') ? format(locale.italic, 'italic', 'italic', () => editor?.chain().focus().toggleItalic().run()) : null}\n {available('strike', 'strike') ? format(locale.strikethrough, 'strikethrough', 'strike', () => editor?.chain().focus().toggleStrike().run()) : null}\n {available('code', 'code') ? format(locale.inlineCode, 'code', 'code', () => editor?.chain().focus().toggleCode().run()) : null}\n {available('bulletList', 'bulletList') ? format(locale.bulletList, 'list', 'bulletList', () => editor?.chain().focus().toggleBulletList().run()) : null}\n {available('orderedList', 'orderedList') ? format(locale.orderedList, 'list-ordered', 'orderedList', () => editor?.chain().focus().toggleOrderedList().run()) : null}\n </div>\n {editor ? <div className=\"dsx-rich-text-editor__toolbar-group\" role=\"group\" aria-label={locale.insertGroup}>\n {available('link', 'link') ? <LinkControl editor={editor} disabled={disabled} localeText={localeText} /> : null}\n {insertItems.length ? <DropdownMenu><DropdownMenu.Trigger asChild><Control disabled={disabled}>{locale.insert} <Icon name=\"plus\" size=\"sm\" /></Control></DropdownMenu.Trigger><DropdownMenu.Content onCloseAutoFocus={event => { event.preventDefault(); editor.commands.focus() }}>{insertItems.map(item => <DropdownMenu.Item key={item.id} onSelect={() => {\n if (editor.state.selection instanceof NodeSelection) editor.commands.command(({ tr }) => {\n const paragraph = editor.schema.nodes.paragraph\n if (!paragraph) return false\n let point = tr.doc.resolve(tr.selection.to)\n while (point.depth > 0 && !point.parent.canReplaceWith(point.index(), point.index(), paragraph)) point = tr.doc.resolve(point.after())\n tr.insert(point.pos, paragraph.create())\n tr.setSelection(TextSelection.create(tr.doc, point.pos + 1))\n return true\n })\n item.insert(editor)\n }}>{item.label}</DropdownMenu.Item>)}</DropdownMenu.Content></DropdownMenu> : null}\n {variables.length && editor.schema.nodes.dsxVariable ? <TokenPicker editor={editor} disabled={disabled} kind=\"variable\" records={variables} localeText={localeText} /> : null}\n {mentions.length && editor.schema.nodes.dsxMention ? <TokenPicker editor={editor} disabled={disabled} kind=\"mention\" records={mentions} localeText={localeText} /> : null}\n {available('clear') ? format(locale.clearFormatting, 'eraser', '', () => editor.chain().focus().clearNodes().unsetAllMarks().run()) : null}\n </div> : null}\n {available('history') ? <div className=\"dsx-rich-text-editor__toolbar-group\" role=\"group\" aria-label={locale.historyGroup}><Control disabled={disabled || !editor?.can().undo()} aria-label={locale.undo} onMouseDown={event => event.preventDefault()} onClick={() => editor?.chain().focus().undo().run()}><Icon name=\"undo\" size=\"sm\" /></Control><Control disabled={disabled || !editor?.can().redo()} aria-label={locale.redo} onMouseDown={event => event.preventDefault()} onClick={() => editor?.chain().focus().redo().run()}><Icon name=\"redo\" size=\"sm\" /></Control></div> : null}\n {editor && mentions.length && editor.schema.nodes.dsxMention ? <MentionSuggestions editor={editor} mentions={mentions} localeText={localeText} /> : null}\n </>\n}\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;AACvB,SAAS,eAAe,qBAAqB;AAG7C,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,eAAe;AACxB,SAAS,oBAAoB;AAC7B,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAC1B,SAAS,sBAAsB;AAC/B,SAAS,0BAA0B;
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import * as React from 'react'\nimport { NodeSelection, TextSelection } from '@tiptap/pm/state'\nimport type { Editor } from '@tiptap/react'\ntype Level = 1 | 2 | 3 | 4 | 5 | 6\nimport { Button } from '../button/Button'\nimport { Icon } from '../icon/Icon'\nimport { Toolbar } from '../toolbar/Toolbar'\nimport { DropdownMenu } from '../dropdownMenu/DropdownMenu'\nimport { Popover } from '../popover/Popover'\nimport { TextField } from '../textField/TextField'\nimport { VisuallyHidden } from '../visuallyHidden/VisuallyHidden'\nimport { MentionSuggestions } from './MentionSuggestions'\nimport type { EditorVariable, EditorMention } from './editorTokens'\n\nexport type EditorTool = 'style' | 'bold' | 'italic' | 'strike' | 'code' | 'bulletList' | 'orderedList' | 'blockquote' | 'codeBlock' | 'link' | 'clear' | 'history'\nexport interface EditorInsertItem { id: string; label: string; insert: (editor: Editor) => void }\nexport interface EditorToolsOptions {\n tools?: readonly EditorTool[]\n headingLevels?: readonly Level[]\n insertItems?: readonly EditorInsertItem[]\n variables?: readonly EditorVariable[]\n mentions?: readonly EditorMention[]\n localeText?: Partial<RichTextEditorLocaleText>\n}\nexport interface RichTextEditorLocaleText {\n loading: string\n empty: string\n characterCount: (count: number) => string\n toolbarLabel: string\n blockStyleGroup: string\n textStyleGroup: string\n insertGroup: string\n historyGroup: string\n textStyle: string\n paragraph: string\n heading: (level: number) => string\n quoteBlock: string\n codeBlock: string\n insert: string\n bold: string\n italic: string\n strikethrough: string\n inlineCode: string\n bulletList: string\n orderedList: string\n link: string\n clearFormatting: string\n undo: string\n redo: string\n variable: string\n mention: string\n insertVariable: string\n mentionSomeone: string\n variableDescription: string\n mentionDescription: string\n searchVariables: string\n searchPeople: string\n variables: string\n people: string\n noMatches: string\n sensitiveSuffix: string\n editLink: string\n linkDescription: string\n urlLabel: string\n urlInvalid: string\n saveLink: string\n removeLink: string\n mentionSuggestions: string\n peopleMatching: (query: string) => string\n noMatchingPeople: string\n}\nexport const defaultRichTextEditorLocaleText: RichTextEditorLocaleText = {\n loading: 'Editor loading',\n empty: 'Ready to write',\n characterCount: (count) => `${count} characters`,\n toolbarLabel: 'Formatting toolbar',\n blockStyleGroup: 'Block style',\n textStyleGroup: 'Text style',\n insertGroup: 'Insert',\n historyGroup: 'History',\n textStyle: 'Text style',\n paragraph: 'Paragraph',\n heading: (level) => `Heading ${level}`,\n quoteBlock: 'Quote block',\n codeBlock: 'Code block',\n insert: 'Insert',\n bold: 'Bold',\n italic: 'Italic',\n strikethrough: 'Strikethrough',\n inlineCode: 'Inline code',\n bulletList: 'Bulleted list',\n orderedList: 'Numbered list',\n link: 'Link',\n clearFormatting: 'Clear formatting',\n undo: 'Undo',\n redo: 'Redo',\n variable: 'Variable',\n mention: 'Mention',\n insertVariable: 'Insert variable',\n mentionSomeone: 'Mention someone',\n variableDescription: 'Insert a key. Its value is resolved by your application.',\n mentionDescription: 'Select a person to insert their stable identity.',\n searchVariables: 'Search variables',\n searchPeople: 'Search people',\n variables: 'Variables',\n people: 'People',\n noMatches: 'No matches',\n sensitiveSuffix: ' \u00B7 Sensitive',\n editLink: 'Edit link',\n linkDescription: 'Link the selected text or insert a URL at the caret.',\n urlLabel: 'URL',\n urlInvalid: 'Enter a valid https, http, mailto or tel URL.',\n saveLink: 'Save link',\n removeLink: 'Remove link',\n mentionSuggestions: 'Mention suggestions',\n peopleMatching: (query) => `People matching @${query}`,\n noMatchingPeople: 'No matching people',\n}\nexport function resolveRichTextEditorLocaleText(localeText?: Partial<RichTextEditorLocaleText>): RichTextEditorLocaleText {\n return { ...defaultRichTextEditorLocaleText, ...localeText }\n}\nconst defaults: EditorTool[] = ['style', 'bold', 'italic', 'strike', 'code', 'bulletList', 'orderedList', 'blockquote', 'codeBlock', 'link', 'clear', 'history']\nconst Control = React.forwardRef<React.ComponentRef<typeof Button>, React.ComponentProps<typeof Button>>(\n function Control({ children, ...props }, forwardedRef) {\n return <Toolbar.Button asChild disabled={props.disabled}><Button type=\"button\" size=\"sm\" variant=\"ghost\" className=\"dsx-rich-text-editor__toolbar-button\" {...props} ref={forwardedRef}>{children}</Button></Toolbar.Button>\n },\n)\nControl.displayName = 'Control'\nfunction TokenPicker({ editor, disabled, records, kind, localeText }: { editor: Editor; disabled: boolean; records: readonly (EditorVariable | EditorMention)[]; kind: 'variable' | 'mention'; localeText?: Partial<RichTextEditorLocaleText> }) {\n const locale = resolveRichTextEditorLocaleText(localeText)\n const [open, setOpen] = React.useState(false)\n const [query, setQuery] = React.useState('')\n const [active, setActive] = React.useState(0)\n const listId = React.useId()\n const matches = records.filter(record => `${record.label} ${'key' in record ? record.key : record.id}`.toLowerCase().includes(query.toLowerCase()))\n const insert = (index: number) => {\n const record = matches[index]\n if (!record) return\n editor.chain().focus().insertContent({ type: kind === 'variable' ? 'dsxVariable' : 'dsxMention', attrs: 'key' in record ? { key: record.key } : { userId: record.id } }).run()\n setOpen(false)\n }\n return <Popover open={open} onOpenChange={next => { setOpen(next); setQuery(''); setActive(0) }}>\n <Popover.Trigger asChild><Control disabled={disabled}>{kind === 'variable' ? locale.variable : locale.mention}</Control></Popover.Trigger>\n <Popover.Content className=\"dsx-editor-tools__popover\" align=\"start\" onCloseAutoFocus={event => { event.preventDefault(); if (!editor.isDestroyed) editor.commands.focus() }}>\n <Popover.Title>{kind === 'variable' ? locale.insertVariable : locale.mentionSomeone}</Popover.Title>\n <Popover.Description>{kind === 'variable' ? locale.variableDescription : locale.mentionDescription}</Popover.Description>\n <TextField><TextField.Input aria-label={kind === 'variable' ? locale.searchVariables : locale.searchPeople} role=\"combobox\" aria-expanded=\"true\" aria-controls={listId} aria-activedescendant={matches.length ? `${listId}-${active}` : undefined} value={query} onChange={event => { setQuery(event.target.value); setActive(0) }} onKeyDown={event => {\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') { event.preventDefault(); setActive(index => Math.max(0, Math.min(matches.length - 1, index + (event.key === 'ArrowDown' ? 1 : -1)))) }\n if (event.key === 'Enter') { event.preventDefault(); insert(active) }\n }} /></TextField>\n <div id={listId} role=\"listbox\" aria-label={kind === 'variable' ? locale.variables : locale.people} className=\"dsx-editor-tools__choices\">\n {matches.map((record, index) => <Button id={`${listId}-${index}`} key={'key' in record ? record.key : record.id} role=\"option\" aria-selected={active === index} type=\"button\" variant={active === index ? 'secondary' : 'ghost'} size=\"lg\" onClick={() => insert(index)} onPointerMove={() => setActive(index)}>\n <span>{record.label}{'sensitive' in record && record.sensitive ? locale.sensitiveSuffix : ''}<small>{'key' in record ? record.key : record.id}</small></span>\n </Button>)}\n {!matches.length ? <span role=\"status\">{locale.noMatches}</span> : null}\n </div>\n </Popover.Content>\n </Popover>\n}\nfunction LinkControl({ editor, disabled, localeText }: { editor: Editor; disabled: boolean; localeText?: Partial<RichTextEditorLocaleText> }) {\n const locale = resolveRichTextEditorLocaleText(localeText)\n const [open, setOpen] = React.useState(false)\n const [url, setUrl] = React.useState('')\n const [error, setError] = React.useState('')\n const urlId = React.useId()\n const selection = React.useRef({ from: 1, to: 1 })\n const save = () => {\n let href: string\n try { const parsed = new URL(url); if (!['https:', 'http:', 'mailto:', 'tel:'].includes(parsed.protocol)) throw new Error(); href = parsed.href } catch { setError(locale.urlInvalid); return }\n const chain = editor.chain().focus().setTextSelection(selection.current)\n if (selection.current.from === selection.current.to && !editor.isActive('link')) chain.insertContent({ type: 'text', text: href, marks: [{ type: 'link', attrs: { href } }] }).run()\n else chain.extendMarkRange('link').setLink({ href }).run()\n setOpen(false)\n }\n return <Popover open={open} onOpenChange={next => { if (next) { selection.current = { from: editor.state.selection.from, to: editor.state.selection.to }; setUrl(editor.getAttributes('link').href ?? ''); setError('') }; setOpen(next) }}>\n <Popover.Trigger asChild><Control disabled={disabled} aria-label={locale.link} aria-pressed={editor.isActive('link')}><Icon name=\"link\" size=\"sm\" /></Control></Popover.Trigger>\n <Popover.Content className=\"dsx-editor-tools__popover dsx-editor-tools__link\" align=\"start\" onCloseAutoFocus={event => { event.preventDefault(); if (!editor.isDestroyed) editor.commands.focus() }}>\n <Popover.Title>{locale.editLink}</Popover.Title><VisuallyHidden asChild><Popover.Description>{locale.linkDescription}</Popover.Description></VisuallyHidden>\n <TextField id={urlId} label={locale.urlLabel} errorText={error || undefined} invalid={Boolean(error)}><TextField.Input value={url} onChange={event => { setUrl(event.target.value); setError('') }} onKeyDown={event => { if (event.key === 'Enter') { event.preventDefault(); save() } }} /></TextField>\n <div className=\"dsx-editor-tools__actions\"><Button type=\"button\" size=\"md\" onClick={save}>{locale.saveLink}</Button><Button type=\"button\" size=\"md\" variant=\"outline\" disabled={!editor.isActive('link')} onClick={() => { editor.chain().focus().setTextSelection(selection.current).extendMarkRange('link').unsetLink().run(); setOpen(false) }}>{locale.removeLink}</Button></div>\n </Popover.Content>\n </Popover>\n}\nexport function EditorTools({ editor, disabled, tools = defaults, headingLevels, insertItems = [], variables = [], mentions = [], localeText }: EditorToolsOptions & { editor: Editor | null; disabled: boolean }) {\n const locale = resolveRichTextEditorLocaleText(localeText)\n const [, refresh] = React.useReducer(value => value + 1, 0)\n React.useEffect(() => { if (!editor) return; editor.on('transaction', refresh); return () => { editor.off('transaction', refresh) } }, [editor])\n const available = (tool: EditorTool, name?: string) => tools.includes(tool) && (!name || Boolean(editor?.schema.nodes[name] || editor?.schema.marks[name]))\n const levels = headingLevels ?? editor?.extensionManager.extensions.find(extension => extension.name === 'heading')?.options.levels ?? [1, 2, 3]\n const format = (label: string, icon: React.ComponentProps<typeof Icon>['name'], name: string, run: () => void) => <Control key={name} disabled={disabled} aria-label={label} aria-pressed={editor?.isActive(name)} onMouseDown={event => event.preventDefault()} onClick={run}><Icon name={icon} size=\"sm\" /></Control>\n return <>\n {available('style') ? <div className=\"dsx-rich-text-editor__toolbar-group\" role=\"group\" aria-label={locale.blockStyleGroup}><DropdownMenu><DropdownMenu.Trigger asChild><Control disabled={disabled}>{locale.textStyle} <Icon name=\"chevron-down\" size=\"sm\" /></Control></DropdownMenu.Trigger><DropdownMenu.Content onCloseAutoFocus={event => { event.preventDefault(); editor?.commands.focus() }}>\n <DropdownMenu.Item onSelect={() => editor?.chain().focus().setParagraph().run()}>{locale.paragraph}</DropdownMenu.Item>\n {editor?.schema.nodes.heading ? (levels as Level[]).map(level => <DropdownMenu.Item key={level} onSelect={() => editor.chain().focus().toggleHeading({ level }).run()}>{locale.heading(level)}</DropdownMenu.Item>) : null}\n {available('blockquote', 'blockquote') ? <DropdownMenu.Item onSelect={() => editor?.chain().focus().toggleBlockquote().run()}>{locale.quoteBlock}</DropdownMenu.Item> : null}\n {available('codeBlock', 'codeBlock') ? <DropdownMenu.Item onSelect={() => editor?.chain().focus().toggleCodeBlock().run()}>{locale.codeBlock}</DropdownMenu.Item> : null}\n </DropdownMenu.Content></DropdownMenu></div> : null}\n <div className=\"dsx-rich-text-editor__toolbar-group\" role=\"group\" aria-label={locale.textStyleGroup}>\n {available('bold', 'bold') ? format(locale.bold, 'bold', 'bold', () => editor?.chain().focus().toggleBold().run()) : null}\n {available('italic', 'italic') ? format(locale.italic, 'italic', 'italic', () => editor?.chain().focus().toggleItalic().run()) : null}\n {available('strike', 'strike') ? format(locale.strikethrough, 'strikethrough', 'strike', () => editor?.chain().focus().toggleStrike().run()) : null}\n {available('code', 'code') ? format(locale.inlineCode, 'code', 'code', () => editor?.chain().focus().toggleCode().run()) : null}\n {available('bulletList', 'bulletList') ? format(locale.bulletList, 'list', 'bulletList', () => editor?.chain().focus().toggleBulletList().run()) : null}\n {available('orderedList', 'orderedList') ? format(locale.orderedList, 'list-ordered', 'orderedList', () => editor?.chain().focus().toggleOrderedList().run()) : null}\n </div>\n {editor ? <div className=\"dsx-rich-text-editor__toolbar-group\" role=\"group\" aria-label={locale.insertGroup}>\n {available('link', 'link') ? <LinkControl editor={editor} disabled={disabled} localeText={localeText} /> : null}\n {insertItems.length ? <DropdownMenu><DropdownMenu.Trigger asChild><Control disabled={disabled}>{locale.insert} <Icon name=\"plus\" size=\"sm\" /></Control></DropdownMenu.Trigger><DropdownMenu.Content onCloseAutoFocus={event => { event.preventDefault(); if (!editor.isDestroyed) editor.commands.focus() }}>{insertItems.map(item => <DropdownMenu.Item key={item.id} onSelect={() => {\n if (editor.state.selection instanceof NodeSelection) editor.commands.command(({ tr }) => {\n const paragraph = editor.schema.nodes.paragraph\n if (!paragraph) return false\n let point = tr.doc.resolve(tr.selection.to)\n while (point.depth > 0 && !point.parent.canReplaceWith(point.index(), point.index(), paragraph)) point = tr.doc.resolve(point.after())\n tr.insert(point.pos, paragraph.create())\n tr.setSelection(TextSelection.create(tr.doc, point.pos + 1))\n return true\n })\n item.insert(editor)\n }}>{item.label}</DropdownMenu.Item>)}</DropdownMenu.Content></DropdownMenu> : null}\n {variables.length && editor.schema.nodes.dsxVariable ? <TokenPicker editor={editor} disabled={disabled} kind=\"variable\" records={variables} localeText={localeText} /> : null}\n {mentions.length && editor.schema.nodes.dsxMention ? <TokenPicker editor={editor} disabled={disabled} kind=\"mention\" records={mentions} localeText={localeText} /> : null}\n {available('clear') ? format(locale.clearFormatting, 'eraser', '', () => editor.chain().focus().clearNodes().unsetAllMarks().run()) : null}\n </div> : null}\n {available('history') ? <div className=\"dsx-rich-text-editor__toolbar-group\" role=\"group\" aria-label={locale.historyGroup}><Control disabled={disabled || !editor?.can().undo()} aria-label={locale.undo} onMouseDown={event => event.preventDefault()} onClick={() => editor?.chain().focus().undo().run()}><Icon name=\"undo\" size=\"sm\" /></Control><Control disabled={disabled || !editor?.can().redo()} aria-label={locale.redo} onMouseDown={event => event.preventDefault()} onClick={() => editor?.chain().focus().redo().run()}><Icon name=\"redo\" size=\"sm\" /></Control></div> : null}\n {editor && mentions.length && editor.schema.nodes.dsxMention ? <MentionSuggestions editor={editor} mentions={mentions} localeText={localeText} /> : null}\n </>\n}\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;AACvB,SAAS,eAAe,qBAAqB;AAG7C,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,eAAe;AACxB,SAAS,oBAAoB;AAC7B,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAC1B,SAAS,sBAAsB;AAC/B,SAAS,0BAA0B;AAiH0B,SAkEpD,UAlEoD,KA4BnD,YA5BmD;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E,IAAI,GAAG,8BAAC,QAAK,MAAK,QAAO,MAAK,MAAK,GAAE;AAAA,MAAU,oBAAC,WAAQ,UAAU,YAAY,CAAC,QAAQ,IAAI,EAAE,KAAK,GAAG,cAAY,OAAO,MAAM,aAAa,WAAS,MAAM,eAAe,GAAG,SAAS,MAAM,QAAQ,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,GAAG,8BAAC,QAAK,MAAK,QAAO,MAAK,MAAK,GAAE;AAAA,OAAU,IAAS;AAAA,IACvjB,UAAU,SAAS,UAAU,OAAO,OAAO,MAAM,aAAa,oBAAC,sBAAmB,QAAgB,UAAoB,YAAwB,IAAK;AAAA,KACtJ;AACF;",
|
|
6
|
+
"names": ["Control"]
|
|
7
7
|
}
|
|
@@ -66,7 +66,7 @@ The `EditorContent` component from `@tiptap/react` renders inside `RichTextEdito
|
|
|
66
66
|
| `asChild` | `boolean` | `false` | no | Extracted from prop defs but not used by the root. The root always renders as a `<div>`. | no |
|
|
67
67
|
| `disabled` | `boolean` | `false` | no | Makes the editor non-editable. Drives `data-disabled` and `aria-disabled` on the shell. Changing disabled retains the document and editor instance. The CSS file consumes `data-disabled='true'` to change the shell border, background, and text color. | no |
|
|
68
68
|
| `content` | `unknown` | `''` | no | Initial or controlled editor content. Accepts `string` (HTML), `object` (JSON), or `null`. Validated by `isRichTextEditorContent`. | no |
|
|
69
|
-
| `editorOptions` | `Omit<UseEditorOptions, 'content' \| 'editable' \| 'extensions' \| 'onUpdate'>` | `undefined` | no | Escape hatch for `useEditor` options. Merged with the DS-managed options. | no |
|
|
69
|
+
| `editorOptions` | `Omit<UseEditorOptions, 'content' \| 'editable' \| 'extensions' \| 'onUpdate'>` | `undefined` | no | Escape hatch for `useEditor` options. Merged with the DS-managed options. Hoist it or memoize it: a fresh inline object is a new hook dep and recreates the editor (same as any hook dep — Tiptap destroys and rebuilds on change). | no |
|
|
70
70
|
| `extensions` | `UseEditorOptions['extensions']` | `[StarterKit]` | no | Tiptap extensions. Defaults to `StarterKit`. Apps that need custom schema or extensions pass their own array. | no |
|
|
71
71
|
| `onEditorUpdate` | `(editor: Editor) => void` | `undefined` | no | Fires on every editor update with the raw `Editor` instance. App-owned escape hatch. | no |
|
|
72
72
|
| `onUpdate` | `(content: string) => void` | `undefined` | no | Fires on every editor update with the serialized content string. Defaults to HTML serialization unless `serialize` is provided. | no |
|
|
@@ -139,7 +139,7 @@ function getDocumentThemeMode() {
|
|
|
139
139
|
function useThemeContext() {
|
|
140
140
|
return React.useContext(ThemeContext);
|
|
141
141
|
}
|
|
142
|
-
|
|
142
|
+
const Theme = React.forwardRef(function Theme2({
|
|
143
143
|
accentColor,
|
|
144
144
|
appearance,
|
|
145
145
|
applyToDocument = false,
|
|
@@ -156,7 +156,7 @@ function Theme({
|
|
|
156
156
|
style,
|
|
157
157
|
surface = "theme",
|
|
158
158
|
...props
|
|
159
|
-
}) {
|
|
159
|
+
}, ref) {
|
|
160
160
|
const Component = asChild ? import_react_slot.Slot : as ?? "div";
|
|
161
161
|
const inheritedTheme = useThemeContext();
|
|
162
162
|
const resolvedMode = React.useMemo(() => {
|
|
@@ -205,6 +205,7 @@ function Theme({
|
|
|
205
205
|
Component,
|
|
206
206
|
{
|
|
207
207
|
...props,
|
|
208
|
+
ref,
|
|
208
209
|
"data-accent-color": resolvedAccentColor,
|
|
209
210
|
"data-dsx-density": resolvedDensity,
|
|
210
211
|
"data-dsx-scaling": resolvedScaling,
|
|
@@ -218,5 +219,6 @@ function Theme({
|
|
|
218
219
|
children
|
|
219
220
|
}
|
|
220
221
|
) });
|
|
221
|
-
}
|
|
222
|
+
});
|
|
223
|
+
Theme.displayName = "Theme";
|
|
222
224
|
//# sourceMappingURL=Theme.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/foundations/Theme.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { Slot } from '@radix-ui/react-slot'\n\nimport { cn } from '../_internal/cn'\nimport { ACCENT_COLOR_VALUES, THEME_RADIUS_VALUES } from '../_internal/constants'\nimport { type DensityMode } from '../layout/responsive.props'\nimport { type PolymorphicProps } from './Shared'\n\nexport type ThemeMode = 'dark' | 'light'\nexport type ThemeAppearance = ThemeMode | 'inherit'\nexport type ThemeAccentColor = (typeof ACCENT_COLOR_VALUES)[number]\nexport type ThemeGrayColor = 'auto' | 'neutral'\nexport type ThemeRadius = (typeof THEME_RADIUS_VALUES)[number]\nexport type ThemePanelBackground = 'solid' | 'translucent'\nexport type ThemeScaling = '90' | '95' | '100' | '105' | '110'\n\nexport type ThemeContextValue = {\n accentColor: ThemeAccentColor\n density: DensityMode\n grayColor: ThemeGrayColor\n hasBackground: boolean\n mode: ThemeMode\n panelBackground: ThemePanelBackground\n radius: ThemeRadius\n scaling?: ThemeScaling\n}\n\ntype ThemeDocumentSnapshot = {\n bodyAccent: string | null\n bodyColorScheme: string\n bodyDensity: string | null\n bodyGray: string | null\n bodyHasBackground: string | null\n bodyPanelBackground: string | null\n bodyRadius: string | null\n bodyScaling: string | null\n bodyTheme: string | null\n rootAccent: string | null\n rootColorScheme: string\n rootDensity: string | null\n rootGray: string | null\n rootHasBackground: string | null\n rootPanelBackground: string | null\n rootRadius: string | null\n rootScaling: string | null\n rootTheme: string | null\n}\n\nconst DEFAULT_THEME_CONTEXT_VALUE: ThemeContextValue = {\n accentColor: 'rift',\n density: 'comfortable',\n grayColor: 'auto',\n hasBackground: true,\n mode: 'dark',\n panelBackground: 'translucent',\n radius: 'md',\n scaling: '100',\n}\n\nconst ThemeContext = React.createContext<ThemeContextValue | null>(null)\n\ntype ThemeOwnProps = {\n accentColor?: ThemeAccentColor\n appearance?: ThemeAppearance\n applyToDocument?: boolean\n asChild?: boolean\n density?: DensityMode\n grayColor?: ThemeGrayColor\n mode?: ThemeMode\n panelBackground?: ThemePanelBackground\n radius?: ThemeRadius\n scaling?: ThemeScaling\n surface?: 'theme' | 'transparent'\n}\n\nfunction setOrRemoveAttribute(element: HTMLElement, name: string, value: string | null) {\n if (value === null) {\n element.removeAttribute(name)\n return\n }\n\n element.setAttribute(name, value)\n}\n\nfunction captureThemeDocumentSnapshot(root: HTMLElement, body: HTMLElement): ThemeDocumentSnapshot {\n return {\n bodyAccent: body.getAttribute('data-accent-color'),\n bodyColorScheme: body.style.colorScheme,\n bodyDensity: body.getAttribute('data-dsx-density'),\n bodyGray: body.getAttribute('data-gray-color'),\n bodyHasBackground: body.getAttribute('data-has-background'),\n bodyPanelBackground: body.getAttribute('data-panel-background'),\n bodyRadius: body.getAttribute('data-radius'),\n bodyScaling: body.getAttribute('data-dsx-scaling'),\n bodyTheme: body.getAttribute('data-dsx-theme'),\n rootAccent: root.getAttribute('data-accent-color'),\n rootColorScheme: root.style.colorScheme,\n rootDensity: root.getAttribute('data-dsx-density'),\n rootGray: root.getAttribute('data-gray-color'),\n rootHasBackground: root.getAttribute('data-has-background'),\n rootPanelBackground: root.getAttribute('data-panel-background'),\n rootRadius: root.getAttribute('data-radius'),\n rootScaling: root.getAttribute('data-dsx-scaling'),\n rootTheme: root.getAttribute('data-dsx-theme'),\n }\n}\n\nfunction restoreThemeDocumentSnapshot(root: HTMLElement, body: HTMLElement, snapshot: ThemeDocumentSnapshot) {\n setOrRemoveAttribute(root, 'data-dsx-theme', snapshot.rootTheme)\n setOrRemoveAttribute(root, 'data-dsx-density', snapshot.rootDensity)\n setOrRemoveAttribute(root, 'data-dsx-scaling', snapshot.rootScaling)\n setOrRemoveAttribute(root, 'data-accent-color', snapshot.rootAccent)\n setOrRemoveAttribute(root, 'data-gray-color', snapshot.rootGray)\n setOrRemoveAttribute(root, 'data-radius', snapshot.rootRadius)\n setOrRemoveAttribute(root, 'data-panel-background', snapshot.rootPanelBackground)\n setOrRemoveAttribute(root, 'data-has-background', snapshot.rootHasBackground)\n setOrRemoveAttribute(body, 'data-dsx-theme', snapshot.bodyTheme)\n setOrRemoveAttribute(body, 'data-dsx-density', snapshot.bodyDensity)\n setOrRemoveAttribute(body, 'data-dsx-scaling', snapshot.bodyScaling)\n setOrRemoveAttribute(body, 'data-accent-color', snapshot.bodyAccent)\n setOrRemoveAttribute(body, 'data-gray-color', snapshot.bodyGray)\n setOrRemoveAttribute(body, 'data-radius', snapshot.bodyRadius)\n setOrRemoveAttribute(body, 'data-panel-background', snapshot.bodyPanelBackground)\n setOrRemoveAttribute(body, 'data-has-background', snapshot.bodyHasBackground)\n root.style.colorScheme = snapshot.rootColorScheme\n body.style.colorScheme = snapshot.bodyColorScheme\n}\n\nexport function applyThemeToDocument(theme: ThemeContextValue) {\n if (typeof document === 'undefined') return\n\n const root = document.documentElement\n const body = document.body\n\n if (!body) return\n\n const snapshot = captureThemeDocumentSnapshot(root, body)\n\n root.setAttribute('data-dsx-theme', theme.mode)\n root.setAttribute('data-dsx-density', theme.density)\n setOrRemoveAttribute(root, 'data-dsx-scaling', theme.scaling ?? null)\n setOrRemoveAttribute(root, 'data-accent-color', theme.accentColor)\n setOrRemoveAttribute(root, 'data-gray-color', theme.grayColor)\n setOrRemoveAttribute(root, 'data-radius', theme.radius)\n setOrRemoveAttribute(root, 'data-panel-background', theme.panelBackground)\n setOrRemoveAttribute(root, 'data-has-background', theme.hasBackground ? 'true' : null)\n body.setAttribute('data-dsx-theme', theme.mode)\n body.setAttribute('data-dsx-density', theme.density)\n setOrRemoveAttribute(body, 'data-dsx-scaling', theme.scaling ?? null)\n setOrRemoveAttribute(body, 'data-accent-color', theme.accentColor)\n setOrRemoveAttribute(body, 'data-gray-color', theme.grayColor)\n setOrRemoveAttribute(body, 'data-radius', theme.radius)\n setOrRemoveAttribute(body, 'data-panel-background', theme.panelBackground)\n setOrRemoveAttribute(body, 'data-has-background', theme.hasBackground ? 'true' : null)\n root.style.colorScheme = theme.mode\n body.style.colorScheme = theme.mode\n\n return () => {\n restoreThemeDocumentSnapshot(root, body, snapshot)\n }\n}\n\nfunction getDocumentThemeMode(): ThemeMode {\n if (typeof document === 'undefined') {\n return 'dark'\n }\n\n return document.body?.getAttribute('data-dsx-theme') === 'light'\n || document.documentElement.getAttribute('data-dsx-theme') === 'light'\n ? 'light'\n : 'dark'\n}\n\nexport function useThemeContext() {\n return React.useContext(ThemeContext)\n}\n\nexport function Theme<T extends React.ElementType = 'div'>({\n accentColor,\n appearance,\n applyToDocument = false,\n as,\n asChild = false,\n children,\n className,\n density,\n grayColor,\n mode,\n panelBackground,\n radius,\n scaling,\n style,\n surface = 'theme',\n ...props\n}: PolymorphicProps<T, ThemeOwnProps>) {\n const Component = asChild ? Slot : (as ?? 'div')\n const inheritedTheme = useThemeContext()\n const resolvedMode = React.useMemo<ThemeMode>(() => {\n if (appearance === 'inherit') {\n return inheritedTheme?.mode ?? getDocumentThemeMode()\n }\n\n return appearance ?? mode ?? inheritedTheme?.mode ?? DEFAULT_THEME_CONTEXT_VALUE.mode\n }, [appearance, inheritedTheme?.mode, mode])\n const resolvedDensity = density ?? inheritedTheme?.density ?? DEFAULT_THEME_CONTEXT_VALUE.density\n const resolvedScaling = scaling ?? inheritedTheme?.scaling ?? DEFAULT_THEME_CONTEXT_VALUE.scaling\n const resolvedAccentColor = accentColor ?? inheritedTheme?.accentColor ?? DEFAULT_THEME_CONTEXT_VALUE.accentColor\n const resolvedGrayColor = grayColor ?? inheritedTheme?.grayColor ?? DEFAULT_THEME_CONTEXT_VALUE.grayColor\n const resolvedRadius = radius ?? inheritedTheme?.radius ?? DEFAULT_THEME_CONTEXT_VALUE.radius\n const resolvedPanelBackground =\n panelBackground ?? inheritedTheme?.panelBackground ?? DEFAULT_THEME_CONTEXT_VALUE.panelBackground\n const hasBackground = surface === 'theme'\n\n const contextValue = React.useMemo<ThemeContextValue>(\n () => ({\n accentColor: resolvedAccentColor,\n density: resolvedDensity,\n grayColor: resolvedGrayColor,\n hasBackground,\n mode: resolvedMode,\n panelBackground: resolvedPanelBackground,\n radius: resolvedRadius,\n scaling: resolvedScaling,\n }),\n [\n hasBackground,\n resolvedAccentColor,\n resolvedDensity,\n resolvedGrayColor,\n resolvedMode,\n resolvedPanelBackground,\n resolvedRadius,\n resolvedScaling,\n ],\n )\n\n React.useEffect(() => {\n if (!applyToDocument || typeof document === 'undefined') return\n\n return applyThemeToDocument(contextValue)\n }, [\n applyToDocument,\n contextValue,\n ])\n\n return (\n <ThemeContext.Provider value={contextValue}>\n <Component\n {...props}\n data-accent-color={resolvedAccentColor}\n data-dsx-density={resolvedDensity}\n data-dsx-scaling={resolvedScaling}\n data-dsx-theme={resolvedMode}\n data-gray-color={resolvedGrayColor}\n data-has-background={hasBackground ? 'true' : undefined}\n data-panel-background={resolvedPanelBackground}\n data-radius={resolvedRadius}\n className={cn('dsx-theme', hasBackground && 'dsx-theme--surface', className)}\n style={{ colorScheme: resolvedMode, ...style }}\n >\n {children}\n </Component>\n </ThemeContext.Provider>\n )\n}\n\nexport { ThemeContext }\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AACvB,wBAAqB;AAErB,gBAAmB;AACnB,uBAAyD;AACzD,wBAAiC;AACjC,oBAAsC;
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { Slot } from '@radix-ui/react-slot'\n\nimport { cn } from '../_internal/cn'\nimport { ACCENT_COLOR_VALUES, THEME_RADIUS_VALUES } from '../_internal/constants'\nimport { type DensityMode } from '../layout/responsive.props'\nimport { type PolymorphicProps } from './Shared'\n\nexport type ThemeMode = 'dark' | 'light'\nexport type ThemeAppearance = ThemeMode | 'inherit'\nexport type ThemeAccentColor = (typeof ACCENT_COLOR_VALUES)[number]\nexport type ThemeGrayColor = 'auto' | 'neutral'\nexport type ThemeRadius = (typeof THEME_RADIUS_VALUES)[number]\nexport type ThemePanelBackground = 'solid' | 'translucent'\nexport type ThemeScaling = '90' | '95' | '100' | '105' | '110'\n\nexport type ThemeContextValue = {\n accentColor: ThemeAccentColor\n density: DensityMode\n grayColor: ThemeGrayColor\n hasBackground: boolean\n mode: ThemeMode\n panelBackground: ThemePanelBackground\n radius: ThemeRadius\n scaling?: ThemeScaling\n}\n\ntype ThemeDocumentSnapshot = {\n bodyAccent: string | null\n bodyColorScheme: string\n bodyDensity: string | null\n bodyGray: string | null\n bodyHasBackground: string | null\n bodyPanelBackground: string | null\n bodyRadius: string | null\n bodyScaling: string | null\n bodyTheme: string | null\n rootAccent: string | null\n rootColorScheme: string\n rootDensity: string | null\n rootGray: string | null\n rootHasBackground: string | null\n rootPanelBackground: string | null\n rootRadius: string | null\n rootScaling: string | null\n rootTheme: string | null\n}\n\nconst DEFAULT_THEME_CONTEXT_VALUE: ThemeContextValue = {\n accentColor: 'rift',\n density: 'comfortable',\n grayColor: 'auto',\n hasBackground: true,\n mode: 'dark',\n panelBackground: 'translucent',\n radius: 'md',\n scaling: '100',\n}\n\nconst ThemeContext = React.createContext<ThemeContextValue | null>(null)\n\ntype ThemeOwnProps = {\n accentColor?: ThemeAccentColor\n appearance?: ThemeAppearance\n applyToDocument?: boolean\n asChild?: boolean\n density?: DensityMode\n grayColor?: ThemeGrayColor\n mode?: ThemeMode\n panelBackground?: ThemePanelBackground\n radius?: ThemeRadius\n scaling?: ThemeScaling\n surface?: 'theme' | 'transparent'\n}\n\nfunction setOrRemoveAttribute(element: HTMLElement, name: string, value: string | null) {\n if (value === null) {\n element.removeAttribute(name)\n return\n }\n\n element.setAttribute(name, value)\n}\n\nfunction captureThemeDocumentSnapshot(root: HTMLElement, body: HTMLElement): ThemeDocumentSnapshot {\n return {\n bodyAccent: body.getAttribute('data-accent-color'),\n bodyColorScheme: body.style.colorScheme,\n bodyDensity: body.getAttribute('data-dsx-density'),\n bodyGray: body.getAttribute('data-gray-color'),\n bodyHasBackground: body.getAttribute('data-has-background'),\n bodyPanelBackground: body.getAttribute('data-panel-background'),\n bodyRadius: body.getAttribute('data-radius'),\n bodyScaling: body.getAttribute('data-dsx-scaling'),\n bodyTheme: body.getAttribute('data-dsx-theme'),\n rootAccent: root.getAttribute('data-accent-color'),\n rootColorScheme: root.style.colorScheme,\n rootDensity: root.getAttribute('data-dsx-density'),\n rootGray: root.getAttribute('data-gray-color'),\n rootHasBackground: root.getAttribute('data-has-background'),\n rootPanelBackground: root.getAttribute('data-panel-background'),\n rootRadius: root.getAttribute('data-radius'),\n rootScaling: root.getAttribute('data-dsx-scaling'),\n rootTheme: root.getAttribute('data-dsx-theme'),\n }\n}\n\nfunction restoreThemeDocumentSnapshot(root: HTMLElement, body: HTMLElement, snapshot: ThemeDocumentSnapshot) {\n setOrRemoveAttribute(root, 'data-dsx-theme', snapshot.rootTheme)\n setOrRemoveAttribute(root, 'data-dsx-density', snapshot.rootDensity)\n setOrRemoveAttribute(root, 'data-dsx-scaling', snapshot.rootScaling)\n setOrRemoveAttribute(root, 'data-accent-color', snapshot.rootAccent)\n setOrRemoveAttribute(root, 'data-gray-color', snapshot.rootGray)\n setOrRemoveAttribute(root, 'data-radius', snapshot.rootRadius)\n setOrRemoveAttribute(root, 'data-panel-background', snapshot.rootPanelBackground)\n setOrRemoveAttribute(root, 'data-has-background', snapshot.rootHasBackground)\n setOrRemoveAttribute(body, 'data-dsx-theme', snapshot.bodyTheme)\n setOrRemoveAttribute(body, 'data-dsx-density', snapshot.bodyDensity)\n setOrRemoveAttribute(body, 'data-dsx-scaling', snapshot.bodyScaling)\n setOrRemoveAttribute(body, 'data-accent-color', snapshot.bodyAccent)\n setOrRemoveAttribute(body, 'data-gray-color', snapshot.bodyGray)\n setOrRemoveAttribute(body, 'data-radius', snapshot.bodyRadius)\n setOrRemoveAttribute(body, 'data-panel-background', snapshot.bodyPanelBackground)\n setOrRemoveAttribute(body, 'data-has-background', snapshot.bodyHasBackground)\n root.style.colorScheme = snapshot.rootColorScheme\n body.style.colorScheme = snapshot.bodyColorScheme\n}\n\nexport function applyThemeToDocument(theme: ThemeContextValue) {\n if (typeof document === 'undefined') return\n\n const root = document.documentElement\n const body = document.body\n\n if (!body) return\n\n const snapshot = captureThemeDocumentSnapshot(root, body)\n\n root.setAttribute('data-dsx-theme', theme.mode)\n root.setAttribute('data-dsx-density', theme.density)\n setOrRemoveAttribute(root, 'data-dsx-scaling', theme.scaling ?? null)\n setOrRemoveAttribute(root, 'data-accent-color', theme.accentColor)\n setOrRemoveAttribute(root, 'data-gray-color', theme.grayColor)\n setOrRemoveAttribute(root, 'data-radius', theme.radius)\n setOrRemoveAttribute(root, 'data-panel-background', theme.panelBackground)\n setOrRemoveAttribute(root, 'data-has-background', theme.hasBackground ? 'true' : null)\n body.setAttribute('data-dsx-theme', theme.mode)\n body.setAttribute('data-dsx-density', theme.density)\n setOrRemoveAttribute(body, 'data-dsx-scaling', theme.scaling ?? null)\n setOrRemoveAttribute(body, 'data-accent-color', theme.accentColor)\n setOrRemoveAttribute(body, 'data-gray-color', theme.grayColor)\n setOrRemoveAttribute(body, 'data-radius', theme.radius)\n setOrRemoveAttribute(body, 'data-panel-background', theme.panelBackground)\n setOrRemoveAttribute(body, 'data-has-background', theme.hasBackground ? 'true' : null)\n root.style.colorScheme = theme.mode\n body.style.colorScheme = theme.mode\n\n return () => {\n restoreThemeDocumentSnapshot(root, body, snapshot)\n }\n}\n\nfunction getDocumentThemeMode(): ThemeMode {\n if (typeof document === 'undefined') {\n return 'dark'\n }\n\n return document.body?.getAttribute('data-dsx-theme') === 'light'\n || document.documentElement.getAttribute('data-dsx-theme') === 'light'\n ? 'light'\n : 'dark'\n}\n\nexport function useThemeContext() {\n return React.useContext(ThemeContext)\n}\n\nexport const Theme = React.forwardRef(function Theme<T extends React.ElementType = 'div'>(\n {\n accentColor,\n appearance,\n applyToDocument = false,\n as,\n asChild = false,\n children,\n className,\n density,\n grayColor,\n mode,\n panelBackground,\n radius,\n scaling,\n style,\n surface = 'theme',\n ...props\n }: PolymorphicProps<T, ThemeOwnProps>,\n ref: React.Ref<HTMLElement>,\n) {\n const Component = asChild ? Slot : (as ?? 'div')\n const inheritedTheme = useThemeContext()\n const resolvedMode = React.useMemo<ThemeMode>(() => {\n if (appearance === 'inherit') {\n return inheritedTheme?.mode ?? getDocumentThemeMode()\n }\n\n return appearance ?? mode ?? inheritedTheme?.mode ?? DEFAULT_THEME_CONTEXT_VALUE.mode\n }, [appearance, inheritedTheme?.mode, mode])\n const resolvedDensity = density ?? inheritedTheme?.density ?? DEFAULT_THEME_CONTEXT_VALUE.density\n const resolvedScaling = scaling ?? inheritedTheme?.scaling ?? DEFAULT_THEME_CONTEXT_VALUE.scaling\n const resolvedAccentColor = accentColor ?? inheritedTheme?.accentColor ?? DEFAULT_THEME_CONTEXT_VALUE.accentColor\n const resolvedGrayColor = grayColor ?? inheritedTheme?.grayColor ?? DEFAULT_THEME_CONTEXT_VALUE.grayColor\n const resolvedRadius = radius ?? inheritedTheme?.radius ?? DEFAULT_THEME_CONTEXT_VALUE.radius\n const resolvedPanelBackground =\n panelBackground ?? inheritedTheme?.panelBackground ?? DEFAULT_THEME_CONTEXT_VALUE.panelBackground\n const hasBackground = surface === 'theme'\n\n const contextValue = React.useMemo<ThemeContextValue>(\n () => ({\n accentColor: resolvedAccentColor,\n density: resolvedDensity,\n grayColor: resolvedGrayColor,\n hasBackground,\n mode: resolvedMode,\n panelBackground: resolvedPanelBackground,\n radius: resolvedRadius,\n scaling: resolvedScaling,\n }),\n [\n hasBackground,\n resolvedAccentColor,\n resolvedDensity,\n resolvedGrayColor,\n resolvedMode,\n resolvedPanelBackground,\n resolvedRadius,\n resolvedScaling,\n ],\n )\n\n React.useEffect(() => {\n if (!applyToDocument || typeof document === 'undefined') return\n\n return applyThemeToDocument(contextValue)\n }, [\n applyToDocument,\n contextValue,\n ])\n\n return (\n <ThemeContext.Provider value={contextValue}>\n <Component\n {...props}\n ref={ref as never}\n data-accent-color={resolvedAccentColor}\n data-dsx-density={resolvedDensity}\n data-dsx-scaling={resolvedScaling}\n data-dsx-theme={resolvedMode}\n data-gray-color={resolvedGrayColor}\n data-has-background={hasBackground ? 'true' : undefined}\n data-panel-background={resolvedPanelBackground}\n data-radius={resolvedRadius}\n className={cn('dsx-theme', hasBackground && 'dsx-theme--surface', className)}\n style={{ colorScheme: resolvedMode, ...style }}\n >\n {children}\n </Component>\n </ThemeContext.Provider>\n )\n})\nTheme.displayName = 'Theme'\n\nexport { ThemeContext }\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AACvB,wBAAqB;AAErB,gBAAmB;AACnB,uBAAyD;AACzD,wBAAiC;AACjC,oBAAsC;AAoPhC;AA1MN,MAAM,8BAAiD;AAAA,EACrD,aAAa;AAAA,EACb,SAAS;AAAA,EACT,WAAW;AAAA,EACX,eAAe;AAAA,EACf,MAAM;AAAA,EACN,iBAAiB;AAAA,EACjB,QAAQ;AAAA,EACR,SAAS;AACX;AAEA,MAAM,eAAe,MAAM,cAAwC,IAAI;AAgBvE,SAAS,qBAAqB,SAAsB,MAAc,OAAsB;AACtF,MAAI,UAAU,MAAM;AAClB,YAAQ,gBAAgB,IAAI;AAC5B;AAAA,EACF;AAEA,UAAQ,aAAa,MAAM,KAAK;AAClC;AAEA,SAAS,6BAA6B,MAAmB,MAA0C;AACjG,SAAO;AAAA,IACL,YAAY,KAAK,aAAa,mBAAmB;AAAA,IACjD,iBAAiB,KAAK,MAAM;AAAA,IAC5B,aAAa,KAAK,aAAa,kBAAkB;AAAA,IACjD,UAAU,KAAK,aAAa,iBAAiB;AAAA,IAC7C,mBAAmB,KAAK,aAAa,qBAAqB;AAAA,IAC1D,qBAAqB,KAAK,aAAa,uBAAuB;AAAA,IAC9D,YAAY,KAAK,aAAa,aAAa;AAAA,IAC3C,aAAa,KAAK,aAAa,kBAAkB;AAAA,IACjD,WAAW,KAAK,aAAa,gBAAgB;AAAA,IAC7C,YAAY,KAAK,aAAa,mBAAmB;AAAA,IACjD,iBAAiB,K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AAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA,qBAAmB;AAAA,MACnB,oBAAkB;AAAA,MAClB,oBAAkB;AAAA,MAClB,kBAAgB;AAAA,MAChB,mBAAiB;AAAA,MACjB,uBAAqB,gBAAgB,SAAS;AAAA,MAC9C,yBAAuB;AAAA,MACvB,eAAa;AAAA,MACb,eAAW,cAAG,aAAa,iBAAiB,sBAAsB,SAAS;AAAA,MAC3E,OAAO,EAAE,aAAa,cAAc,GAAG,MAAM;AAAA,MAE5C;AAAA;AAAA,EACH,GACF;AAEJ,CAAC;AACD,MAAM,cAAc;",
|
|
6
|
+
"names": ["Theme"]
|
|
7
7
|
}
|
|
@@ -35,6 +35,6 @@ type ThemeOwnProps = {
|
|
|
35
35
|
};
|
|
36
36
|
export declare function applyThemeToDocument(theme: ThemeContextValue): (() => void) | undefined;
|
|
37
37
|
export declare function useThemeContext(): ThemeContextValue | null;
|
|
38
|
-
export declare
|
|
38
|
+
export declare const Theme: React.ForwardRefExoticComponent<Omit<PolymorphicProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>, ThemeOwnProps>, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
39
39
|
export { ThemeContext };
|
|
40
40
|
//# sourceMappingURL=Theme.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Theme.d.cts","sourceRoot":"","sources":["../../src/foundations/Theme.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AACjF,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAEhD,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,OAAO,CAAA;AACxC,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,SAAS,CAAA;AAC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,eAAe,CAAA;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,WAAW,CAAA;IACrB,SAAS,CAAC,EAAE,cAAc,CAAA;IAC1B,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,eAAe,CAAC,EAAE,oBAAoB,CAAA;IACtC,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,OAAO,CAAC,EAAE,YAAY,CAAA;IACtB,OAAO,CAAC,EAAE,OAAO,GAAG,aAAa,CAAA;CAClC,CAAA;AAuDD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,iBAAiB,4BAgC5D;AAaD,wBAAgB,eAAe,6BAE9B;AAED,eAAO,MAAM,KAAK,6KA2FhB,CAAA;AAGF,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -35,6 +35,6 @@ type ThemeOwnProps = {
|
|
|
35
35
|
};
|
|
36
36
|
export declare function applyThemeToDocument(theme: ThemeContextValue): (() => void) | undefined;
|
|
37
37
|
export declare function useThemeContext(): ThemeContextValue | null;
|
|
38
|
-
export declare
|
|
38
|
+
export declare const Theme: React.ForwardRefExoticComponent<Omit<PolymorphicProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>, ThemeOwnProps>, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
39
39
|
export { ThemeContext };
|
|
40
40
|
//# sourceMappingURL=Theme.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Theme.d.mts","sourceRoot":"","sources":["../../src/foundations/Theme.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AACjF,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAA;AA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M,YAAY,yCAAsD,CAAA;AAExE,KAAK,aAAa,GAAG;IACnB,WAAW,CAAC,EAAE,gBAAgB,CAAA;IAC9B,UAAU,CAAC,EAAE,eAAe,CAAA;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,WAAW,CAAA;IACrB,SAAS,CAAC,EAAE,cAAc,CAAA;IAC1B,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,eAAe,CAAC,EAAE,oBAAoB,CAAA;IACtC,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,OAAO,CAAC,EAAE,YAAY,CAAA;IACtB,OAAO,CAAC,EAAE,OAAO,GAAG,aAAa,CAAA;CAClC,CAAA;AAuDD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,iBAAiB,4BAgC5D;AAaD,wBAAgB,eAAe,6BAE9B;AAED,eAAO,MAAM,KAAK,6KA2FhB,CAAA;AAGF,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -35,6 +35,6 @@ type ThemeOwnProps = {
|
|
|
35
35
|
};
|
|
36
36
|
export declare function applyThemeToDocument(theme: ThemeContextValue): (() => void) | undefined;
|
|
37
37
|
export declare function useThemeContext(): ThemeContextValue | null;
|
|
38
|
-
export declare
|
|
38
|
+
export declare const Theme: React.ForwardRefExoticComponent<Omit<PolymorphicProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>, ThemeOwnProps>, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
39
39
|
export { ThemeContext };
|
|
40
40
|
//# sourceMappingURL=Theme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Theme.d.ts","sourceRoot":"","sources":["../../src/foundations/Theme.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AACjF,O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oBAAoB,CAAA;IACrC,MAAM,EAAE,WAAW,CAAA;IACnB,OAAO,CAAC,EAAE,YAAY,CAAA;CACvB,CAAA;AAkCD,QAAA,MAAM,YAAY,yCAAsD,CAAA;AAExE,KAAK,aAAa,GAAG;IACnB,WAAW,CAAC,EAAE,gBAAgB,CAAA;IAC9B,UAAU,CAAC,EAAE,eAAe,CAAA;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,WAAW,CAAA;IACrB,SAAS,CAAC,EAAE,cAAc,CAAA;IAC1B,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,eAAe,CAAC,EAAE,oBAAoB,CAAA;IACtC,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,OAAO,CAAC,EAAE,YAAY,CAAA;IACtB,OAAO,CAAC,EAAE,OAAO,GAAG,aAAa,CAAA;CAClC,CAAA;AAuDD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,iBAAiB,4BAgC5D;AAaD,wBAAgB,eAAe,6BAE9B;AAED,eAAO,MAAM,KAAK,6KA2FhB,CAAA;AAGF,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -103,7 +103,7 @@ function getDocumentThemeMode() {
|
|
|
103
103
|
function useThemeContext() {
|
|
104
104
|
return React.useContext(ThemeContext);
|
|
105
105
|
}
|
|
106
|
-
|
|
106
|
+
const Theme = React.forwardRef(function Theme2({
|
|
107
107
|
accentColor,
|
|
108
108
|
appearance,
|
|
109
109
|
applyToDocument = false,
|
|
@@ -120,7 +120,7 @@ function Theme({
|
|
|
120
120
|
style,
|
|
121
121
|
surface = "theme",
|
|
122
122
|
...props
|
|
123
|
-
}) {
|
|
123
|
+
}, ref) {
|
|
124
124
|
const Component = asChild ? Slot : as ?? "div";
|
|
125
125
|
const inheritedTheme = useThemeContext();
|
|
126
126
|
const resolvedMode = React.useMemo(() => {
|
|
@@ -169,6 +169,7 @@ function Theme({
|
|
|
169
169
|
Component,
|
|
170
170
|
{
|
|
171
171
|
...props,
|
|
172
|
+
ref,
|
|
172
173
|
"data-accent-color": resolvedAccentColor,
|
|
173
174
|
"data-dsx-density": resolvedDensity,
|
|
174
175
|
"data-dsx-scaling": resolvedScaling,
|
|
@@ -182,7 +183,8 @@ function Theme({
|
|
|
182
183
|
children
|
|
183
184
|
}
|
|
184
185
|
) });
|
|
185
|
-
}
|
|
186
|
+
});
|
|
187
|
+
Theme.displayName = "Theme";
|
|
186
188
|
export {
|
|
187
189
|
Theme,
|
|
188
190
|
ThemeContext,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/foundations/Theme.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { Slot } from '@radix-ui/react-slot'\n\nimport { cn } from '../_internal/cn'\nimport { ACCENT_COLOR_VALUES, THEME_RADIUS_VALUES } from '../_internal/constants'\nimport { type DensityMode } from '../layout/responsive.props'\nimport { type PolymorphicProps } from './Shared'\n\nexport type ThemeMode = 'dark' | 'light'\nexport type ThemeAppearance = ThemeMode | 'inherit'\nexport type ThemeAccentColor = (typeof ACCENT_COLOR_VALUES)[number]\nexport type ThemeGrayColor = 'auto' | 'neutral'\nexport type ThemeRadius = (typeof THEME_RADIUS_VALUES)[number]\nexport type ThemePanelBackground = 'solid' | 'translucent'\nexport type ThemeScaling = '90' | '95' | '100' | '105' | '110'\n\nexport type ThemeContextValue = {\n accentColor: ThemeAccentColor\n density: DensityMode\n grayColor: ThemeGrayColor\n hasBackground: boolean\n mode: ThemeMode\n panelBackground: ThemePanelBackground\n radius: ThemeRadius\n scaling?: ThemeScaling\n}\n\ntype ThemeDocumentSnapshot = {\n bodyAccent: string | null\n bodyColorScheme: string\n bodyDensity: string | null\n bodyGray: string | null\n bodyHasBackground: string | null\n bodyPanelBackground: string | null\n bodyRadius: string | null\n bodyScaling: string | null\n bodyTheme: string | null\n rootAccent: string | null\n rootColorScheme: string\n rootDensity: string | null\n rootGray: string | null\n rootHasBackground: string | null\n rootPanelBackground: string | null\n rootRadius: string | null\n rootScaling: string | null\n rootTheme: string | null\n}\n\nconst DEFAULT_THEME_CONTEXT_VALUE: ThemeContextValue = {\n accentColor: 'rift',\n density: 'comfortable',\n grayColor: 'auto',\n hasBackground: true,\n mode: 'dark',\n panelBackground: 'translucent',\n radius: 'md',\n scaling: '100',\n}\n\nconst ThemeContext = React.createContext<ThemeContextValue | null>(null)\n\ntype ThemeOwnProps = {\n accentColor?: ThemeAccentColor\n appearance?: ThemeAppearance\n applyToDocument?: boolean\n asChild?: boolean\n density?: DensityMode\n grayColor?: ThemeGrayColor\n mode?: ThemeMode\n panelBackground?: ThemePanelBackground\n radius?: ThemeRadius\n scaling?: ThemeScaling\n surface?: 'theme' | 'transparent'\n}\n\nfunction setOrRemoveAttribute(element: HTMLElement, name: string, value: string | null) {\n if (value === null) {\n element.removeAttribute(name)\n return\n }\n\n element.setAttribute(name, value)\n}\n\nfunction captureThemeDocumentSnapshot(root: HTMLElement, body: HTMLElement): ThemeDocumentSnapshot {\n return {\n bodyAccent: body.getAttribute('data-accent-color'),\n bodyColorScheme: body.style.colorScheme,\n bodyDensity: body.getAttribute('data-dsx-density'),\n bodyGray: body.getAttribute('data-gray-color'),\n bodyHasBackground: body.getAttribute('data-has-background'),\n bodyPanelBackground: body.getAttribute('data-panel-background'),\n bodyRadius: body.getAttribute('data-radius'),\n bodyScaling: body.getAttribute('data-dsx-scaling'),\n bodyTheme: body.getAttribute('data-dsx-theme'),\n rootAccent: root.getAttribute('data-accent-color'),\n rootColorScheme: root.style.colorScheme,\n rootDensity: root.getAttribute('data-dsx-density'),\n rootGray: root.getAttribute('data-gray-color'),\n rootHasBackground: root.getAttribute('data-has-background'),\n rootPanelBackground: root.getAttribute('data-panel-background'),\n rootRadius: root.getAttribute('data-radius'),\n rootScaling: root.getAttribute('data-dsx-scaling'),\n rootTheme: root.getAttribute('data-dsx-theme'),\n }\n}\n\nfunction restoreThemeDocumentSnapshot(root: HTMLElement, body: HTMLElement, snapshot: ThemeDocumentSnapshot) {\n setOrRemoveAttribute(root, 'data-dsx-theme', snapshot.rootTheme)\n setOrRemoveAttribute(root, 'data-dsx-density', snapshot.rootDensity)\n setOrRemoveAttribute(root, 'data-dsx-scaling', snapshot.rootScaling)\n setOrRemoveAttribute(root, 'data-accent-color', snapshot.rootAccent)\n setOrRemoveAttribute(root, 'data-gray-color', snapshot.rootGray)\n setOrRemoveAttribute(root, 'data-radius', snapshot.rootRadius)\n setOrRemoveAttribute(root, 'data-panel-background', snapshot.rootPanelBackground)\n setOrRemoveAttribute(root, 'data-has-background', snapshot.rootHasBackground)\n setOrRemoveAttribute(body, 'data-dsx-theme', snapshot.bodyTheme)\n setOrRemoveAttribute(body, 'data-dsx-density', snapshot.bodyDensity)\n setOrRemoveAttribute(body, 'data-dsx-scaling', snapshot.bodyScaling)\n setOrRemoveAttribute(body, 'data-accent-color', snapshot.bodyAccent)\n setOrRemoveAttribute(body, 'data-gray-color', snapshot.bodyGray)\n setOrRemoveAttribute(body, 'data-radius', snapshot.bodyRadius)\n setOrRemoveAttribute(body, 'data-panel-background', snapshot.bodyPanelBackground)\n setOrRemoveAttribute(body, 'data-has-background', snapshot.bodyHasBackground)\n root.style.colorScheme = snapshot.rootColorScheme\n body.style.colorScheme = snapshot.bodyColorScheme\n}\n\nexport function applyThemeToDocument(theme: ThemeContextValue) {\n if (typeof document === 'undefined') return\n\n const root = document.documentElement\n const body = document.body\n\n if (!body) return\n\n const snapshot = captureThemeDocumentSnapshot(root, body)\n\n root.setAttribute('data-dsx-theme', theme.mode)\n root.setAttribute('data-dsx-density', theme.density)\n setOrRemoveAttribute(root, 'data-dsx-scaling', theme.scaling ?? null)\n setOrRemoveAttribute(root, 'data-accent-color', theme.accentColor)\n setOrRemoveAttribute(root, 'data-gray-color', theme.grayColor)\n setOrRemoveAttribute(root, 'data-radius', theme.radius)\n setOrRemoveAttribute(root, 'data-panel-background', theme.panelBackground)\n setOrRemoveAttribute(root, 'data-has-background', theme.hasBackground ? 'true' : null)\n body.setAttribute('data-dsx-theme', theme.mode)\n body.setAttribute('data-dsx-density', theme.density)\n setOrRemoveAttribute(body, 'data-dsx-scaling', theme.scaling ?? null)\n setOrRemoveAttribute(body, 'data-accent-color', theme.accentColor)\n setOrRemoveAttribute(body, 'data-gray-color', theme.grayColor)\n setOrRemoveAttribute(body, 'data-radius', theme.radius)\n setOrRemoveAttribute(body, 'data-panel-background', theme.panelBackground)\n setOrRemoveAttribute(body, 'data-has-background', theme.hasBackground ? 'true' : null)\n root.style.colorScheme = theme.mode\n body.style.colorScheme = theme.mode\n\n return () => {\n restoreThemeDocumentSnapshot(root, body, snapshot)\n }\n}\n\nfunction getDocumentThemeMode(): ThemeMode {\n if (typeof document === 'undefined') {\n return 'dark'\n }\n\n return document.body?.getAttribute('data-dsx-theme') === 'light'\n || document.documentElement.getAttribute('data-dsx-theme') === 'light'\n ? 'light'\n : 'dark'\n}\n\nexport function useThemeContext() {\n return React.useContext(ThemeContext)\n}\n\nexport function Theme<T extends React.ElementType = 'div'>({\n accentColor,\n appearance,\n applyToDocument = false,\n as,\n asChild = false,\n children,\n className,\n density,\n grayColor,\n mode,\n panelBackground,\n radius,\n scaling,\n style,\n surface = 'theme',\n ...props\n}: PolymorphicProps<T, ThemeOwnProps>) {\n const Component = asChild ? Slot : (as ?? 'div')\n const inheritedTheme = useThemeContext()\n const resolvedMode = React.useMemo<ThemeMode>(() => {\n if (appearance === 'inherit') {\n return inheritedTheme?.mode ?? getDocumentThemeMode()\n }\n\n return appearance ?? mode ?? inheritedTheme?.mode ?? DEFAULT_THEME_CONTEXT_VALUE.mode\n }, [appearance, inheritedTheme?.mode, mode])\n const resolvedDensity = density ?? inheritedTheme?.density ?? DEFAULT_THEME_CONTEXT_VALUE.density\n const resolvedScaling = scaling ?? inheritedTheme?.scaling ?? DEFAULT_THEME_CONTEXT_VALUE.scaling\n const resolvedAccentColor = accentColor ?? inheritedTheme?.accentColor ?? DEFAULT_THEME_CONTEXT_VALUE.accentColor\n const resolvedGrayColor = grayColor ?? inheritedTheme?.grayColor ?? DEFAULT_THEME_CONTEXT_VALUE.grayColor\n const resolvedRadius = radius ?? inheritedTheme?.radius ?? DEFAULT_THEME_CONTEXT_VALUE.radius\n const resolvedPanelBackground =\n panelBackground ?? inheritedTheme?.panelBackground ?? DEFAULT_THEME_CONTEXT_VALUE.panelBackground\n const hasBackground = surface === 'theme'\n\n const contextValue = React.useMemo<ThemeContextValue>(\n () => ({\n accentColor: resolvedAccentColor,\n density: resolvedDensity,\n grayColor: resolvedGrayColor,\n hasBackground,\n mode: resolvedMode,\n panelBackground: resolvedPanelBackground,\n radius: resolvedRadius,\n scaling: resolvedScaling,\n }),\n [\n hasBackground,\n resolvedAccentColor,\n resolvedDensity,\n resolvedGrayColor,\n resolvedMode,\n resolvedPanelBackground,\n resolvedRadius,\n resolvedScaling,\n ],\n )\n\n React.useEffect(() => {\n if (!applyToDocument || typeof document === 'undefined') return\n\n return applyThemeToDocument(contextValue)\n }, [\n applyToDocument,\n contextValue,\n ])\n\n return (\n <ThemeContext.Provider value={contextValue}>\n <Component\n {...props}\n data-accent-color={resolvedAccentColor}\n data-dsx-density={resolvedDensity}\n data-dsx-scaling={resolvedScaling}\n data-dsx-theme={resolvedMode}\n data-gray-color={resolvedGrayColor}\n data-has-background={hasBackground ? 'true' : undefined}\n data-panel-background={resolvedPanelBackground}\n data-radius={resolvedRadius}\n className={cn('dsx-theme', hasBackground && 'dsx-theme--surface', className)}\n style={{ colorScheme: resolvedMode, ...style }}\n >\n {children}\n </Component>\n </ThemeContext.Provider>\n )\n}\n\nexport { ThemeContext }\n"],
|
|
5
|
-
"mappings": ";AAEA,YAAY,WAAW;AACvB,SAAS,YAAY;AAErB,SAAS,UAAU;AACnB,SAAS,qBAAqB,2BAA2B;AACzD,eAAiC;AACjC,eAAsC;
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { Slot } from '@radix-ui/react-slot'\n\nimport { cn } from '../_internal/cn'\nimport { ACCENT_COLOR_VALUES, THEME_RADIUS_VALUES } from '../_internal/constants'\nimport { type DensityMode } from '../layout/responsive.props'\nimport { type PolymorphicProps } from './Shared'\n\nexport type ThemeMode = 'dark' | 'light'\nexport type ThemeAppearance = ThemeMode | 'inherit'\nexport type ThemeAccentColor = (typeof ACCENT_COLOR_VALUES)[number]\nexport type ThemeGrayColor = 'auto' | 'neutral'\nexport type ThemeRadius = (typeof THEME_RADIUS_VALUES)[number]\nexport type ThemePanelBackground = 'solid' | 'translucent'\nexport type ThemeScaling = '90' | '95' | '100' | '105' | '110'\n\nexport type ThemeContextValue = {\n accentColor: ThemeAccentColor\n density: DensityMode\n grayColor: ThemeGrayColor\n hasBackground: boolean\n mode: ThemeMode\n panelBackground: ThemePanelBackground\n radius: ThemeRadius\n scaling?: ThemeScaling\n}\n\ntype ThemeDocumentSnapshot = {\n bodyAccent: string | null\n bodyColorScheme: string\n bodyDensity: string | null\n bodyGray: string | null\n bodyHasBackground: string | null\n bodyPanelBackground: string | null\n bodyRadius: string | null\n bodyScaling: string | null\n bodyTheme: string | null\n rootAccent: string | null\n rootColorScheme: string\n rootDensity: string | null\n rootGray: string | null\n rootHasBackground: string | null\n rootPanelBackground: string | null\n rootRadius: string | null\n rootScaling: string | null\n rootTheme: string | null\n}\n\nconst DEFAULT_THEME_CONTEXT_VALUE: ThemeContextValue = {\n accentColor: 'rift',\n density: 'comfortable',\n grayColor: 'auto',\n hasBackground: true,\n mode: 'dark',\n panelBackground: 'translucent',\n radius: 'md',\n scaling: '100',\n}\n\nconst ThemeContext = React.createContext<ThemeContextValue | null>(null)\n\ntype ThemeOwnProps = {\n accentColor?: ThemeAccentColor\n appearance?: ThemeAppearance\n applyToDocument?: boolean\n asChild?: boolean\n density?: DensityMode\n grayColor?: ThemeGrayColor\n mode?: ThemeMode\n panelBackground?: ThemePanelBackground\n radius?: ThemeRadius\n scaling?: ThemeScaling\n surface?: 'theme' | 'transparent'\n}\n\nfunction setOrRemoveAttribute(element: HTMLElement, name: string, value: string | null) {\n if (value === null) {\n element.removeAttribute(name)\n return\n }\n\n element.setAttribute(name, value)\n}\n\nfunction captureThemeDocumentSnapshot(root: HTMLElement, body: HTMLElement): ThemeDocumentSnapshot {\n return {\n bodyAccent: body.getAttribute('data-accent-color'),\n bodyColorScheme: body.style.colorScheme,\n bodyDensity: body.getAttribute('data-dsx-density'),\n bodyGray: body.getAttribute('data-gray-color'),\n bodyHasBackground: body.getAttribute('data-has-background'),\n bodyPanelBackground: body.getAttribute('data-panel-background'),\n bodyRadius: body.getAttribute('data-radius'),\n bodyScaling: body.getAttribute('data-dsx-scaling'),\n bodyTheme: body.getAttribute('data-dsx-theme'),\n rootAccent: root.getAttribute('data-accent-color'),\n rootColorScheme: root.style.colorScheme,\n rootDensity: root.getAttribute('data-dsx-density'),\n rootGray: root.getAttribute('data-gray-color'),\n rootHasBackground: root.getAttribute('data-has-background'),\n rootPanelBackground: root.getAttribute('data-panel-background'),\n rootRadius: root.getAttribute('data-radius'),\n rootScaling: root.getAttribute('data-dsx-scaling'),\n rootTheme: root.getAttribute('data-dsx-theme'),\n }\n}\n\nfunction restoreThemeDocumentSnapshot(root: HTMLElement, body: HTMLElement, snapshot: ThemeDocumentSnapshot) {\n setOrRemoveAttribute(root, 'data-dsx-theme', snapshot.rootTheme)\n setOrRemoveAttribute(root, 'data-dsx-density', snapshot.rootDensity)\n setOrRemoveAttribute(root, 'data-dsx-scaling', snapshot.rootScaling)\n setOrRemoveAttribute(root, 'data-accent-color', snapshot.rootAccent)\n setOrRemoveAttribute(root, 'data-gray-color', snapshot.rootGray)\n setOrRemoveAttribute(root, 'data-radius', snapshot.rootRadius)\n setOrRemoveAttribute(root, 'data-panel-background', snapshot.rootPanelBackground)\n setOrRemoveAttribute(root, 'data-has-background', snapshot.rootHasBackground)\n setOrRemoveAttribute(body, 'data-dsx-theme', snapshot.bodyTheme)\n setOrRemoveAttribute(body, 'data-dsx-density', snapshot.bodyDensity)\n setOrRemoveAttribute(body, 'data-dsx-scaling', snapshot.bodyScaling)\n setOrRemoveAttribute(body, 'data-accent-color', snapshot.bodyAccent)\n setOrRemoveAttribute(body, 'data-gray-color', snapshot.bodyGray)\n setOrRemoveAttribute(body, 'data-radius', snapshot.bodyRadius)\n setOrRemoveAttribute(body, 'data-panel-background', snapshot.bodyPanelBackground)\n setOrRemoveAttribute(body, 'data-has-background', snapshot.bodyHasBackground)\n root.style.colorScheme = snapshot.rootColorScheme\n body.style.colorScheme = snapshot.bodyColorScheme\n}\n\nexport function applyThemeToDocument(theme: ThemeContextValue) {\n if (typeof document === 'undefined') return\n\n const root = document.documentElement\n const body = document.body\n\n if (!body) return\n\n const snapshot = captureThemeDocumentSnapshot(root, body)\n\n root.setAttribute('data-dsx-theme', theme.mode)\n root.setAttribute('data-dsx-density', theme.density)\n setOrRemoveAttribute(root, 'data-dsx-scaling', theme.scaling ?? null)\n setOrRemoveAttribute(root, 'data-accent-color', theme.accentColor)\n setOrRemoveAttribute(root, 'data-gray-color', theme.grayColor)\n setOrRemoveAttribute(root, 'data-radius', theme.radius)\n setOrRemoveAttribute(root, 'data-panel-background', theme.panelBackground)\n setOrRemoveAttribute(root, 'data-has-background', theme.hasBackground ? 'true' : null)\n body.setAttribute('data-dsx-theme', theme.mode)\n body.setAttribute('data-dsx-density', theme.density)\n setOrRemoveAttribute(body, 'data-dsx-scaling', theme.scaling ?? null)\n setOrRemoveAttribute(body, 'data-accent-color', theme.accentColor)\n setOrRemoveAttribute(body, 'data-gray-color', theme.grayColor)\n setOrRemoveAttribute(body, 'data-radius', theme.radius)\n setOrRemoveAttribute(body, 'data-panel-background', theme.panelBackground)\n setOrRemoveAttribute(body, 'data-has-background', theme.hasBackground ? 'true' : null)\n root.style.colorScheme = theme.mode\n body.style.colorScheme = theme.mode\n\n return () => {\n restoreThemeDocumentSnapshot(root, body, snapshot)\n }\n}\n\nfunction getDocumentThemeMode(): ThemeMode {\n if (typeof document === 'undefined') {\n return 'dark'\n }\n\n return document.body?.getAttribute('data-dsx-theme') === 'light'\n || document.documentElement.getAttribute('data-dsx-theme') === 'light'\n ? 'light'\n : 'dark'\n}\n\nexport function useThemeContext() {\n return React.useContext(ThemeContext)\n}\n\nexport const Theme = React.forwardRef(function Theme<T extends React.ElementType = 'div'>(\n {\n accentColor,\n appearance,\n applyToDocument = false,\n as,\n asChild = false,\n children,\n className,\n density,\n grayColor,\n mode,\n panelBackground,\n radius,\n scaling,\n style,\n surface = 'theme',\n ...props\n }: PolymorphicProps<T, ThemeOwnProps>,\n ref: React.Ref<HTMLElement>,\n) {\n const Component = asChild ? Slot : (as ?? 'div')\n const inheritedTheme = useThemeContext()\n const resolvedMode = React.useMemo<ThemeMode>(() => {\n if (appearance === 'inherit') {\n return inheritedTheme?.mode ?? getDocumentThemeMode()\n }\n\n return appearance ?? mode ?? inheritedTheme?.mode ?? DEFAULT_THEME_CONTEXT_VALUE.mode\n }, [appearance, inheritedTheme?.mode, mode])\n const resolvedDensity = density ?? inheritedTheme?.density ?? DEFAULT_THEME_CONTEXT_VALUE.density\n const resolvedScaling = scaling ?? inheritedTheme?.scaling ?? DEFAULT_THEME_CONTEXT_VALUE.scaling\n const resolvedAccentColor = accentColor ?? inheritedTheme?.accentColor ?? DEFAULT_THEME_CONTEXT_VALUE.accentColor\n const resolvedGrayColor = grayColor ?? inheritedTheme?.grayColor ?? DEFAULT_THEME_CONTEXT_VALUE.grayColor\n const resolvedRadius = radius ?? inheritedTheme?.radius ?? DEFAULT_THEME_CONTEXT_VALUE.radius\n const resolvedPanelBackground =\n panelBackground ?? inheritedTheme?.panelBackground ?? DEFAULT_THEME_CONTEXT_VALUE.panelBackground\n const hasBackground = surface === 'theme'\n\n const contextValue = React.useMemo<ThemeContextValue>(\n () => ({\n accentColor: resolvedAccentColor,\n density: resolvedDensity,\n grayColor: resolvedGrayColor,\n hasBackground,\n mode: resolvedMode,\n panelBackground: resolvedPanelBackground,\n radius: resolvedRadius,\n scaling: resolvedScaling,\n }),\n [\n hasBackground,\n resolvedAccentColor,\n resolvedDensity,\n resolvedGrayColor,\n resolvedMode,\n resolvedPanelBackground,\n resolvedRadius,\n resolvedScaling,\n ],\n )\n\n React.useEffect(() => {\n if (!applyToDocument || typeof document === 'undefined') return\n\n return applyThemeToDocument(contextValue)\n }, [\n applyToDocument,\n contextValue,\n ])\n\n return (\n <ThemeContext.Provider value={contextValue}>\n <Component\n {...props}\n ref={ref as never}\n data-accent-color={resolvedAccentColor}\n data-dsx-density={resolvedDensity}\n data-dsx-scaling={resolvedScaling}\n data-dsx-theme={resolvedMode}\n data-gray-color={resolvedGrayColor}\n data-has-background={hasBackground ? 'true' : undefined}\n data-panel-background={resolvedPanelBackground}\n data-radius={resolvedRadius}\n className={cn('dsx-theme', hasBackground && 'dsx-theme--surface', className)}\n style={{ colorScheme: resolvedMode, ...style }}\n >\n {children}\n </Component>\n </ThemeContext.Provider>\n )\n})\nTheme.displayName = 'Theme'\n\nexport { ThemeContext }\n"],
|
|
5
|
+
"mappings": ";AAEA,YAAY,WAAW;AACvB,SAAS,YAAY;AAErB,SAAS,UAAU;AACnB,SAAS,qBAAqB,2BAA2B;AACzD,eAAiC;AACjC,eAAsC;AAoPhC;AA1MN,MAAM,8BAAiD;AAAA,EACrD,aAAa;AAAA,EACb,SAAS;AAAA,EACT,WAAW;AAAA,EACX,eAAe;AAAA,EACf,MAAM;AAAA,EACN,iBAAiB;AAAA,EACjB,QAAQ;AAAA,EACR,SAAS;AACX;AAEA,MAAM,eAAe,MAAM,cAAwC,IAAI;AAgBvE,SAAS,qBAAqB,SAAsB,MAAc,OAAsB;AACtF,MAAI,UAAU,MAAM;AAClB,YAAQ,gBAAgB,IAAI;AAC5B;AAAA,EACF;AAEA,UAAQ,aAAa,MAAM,KAAK;AAClC;AAEA,SAAS,6BAA6B,MAAmB,MAA0C;AACjG,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