@fluentui-copilot/react-editor-input 0.5.7 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +24 -1
- package/CHANGELOG.md +11 -2
- package/dist/index.d.ts +17 -3
- package/lib/EditorInput.js +1 -1
- package/lib/EditorInput.js.map +1 -1
- package/lib/components/EditorInput/EditorInput.js +3 -1
- package/lib/components/EditorInput/EditorInput.js.map +1 -1
- package/lib/components/EditorInput/EditorInput.types.js +1 -3
- package/lib/components/EditorInput/EditorInput.types.js.map +1 -1
- package/lib/components/EditorInput/index.js +1 -0
- package/lib/components/EditorInput/index.js.map +1 -1
- package/lib/components/EditorInput/renderEditorInput.js +10 -9
- package/lib/components/EditorInput/renderEditorInput.js.map +1 -1
- package/lib/components/EditorInput/useEditorInput.js +18 -63
- package/lib/components/EditorInput/useEditorInput.js.map +1 -1
- package/lib/components/EditorInput/useEditorInputContextValues.js +16 -0
- package/lib/components/EditorInput/useEditorInputContextValues.js.map +1 -0
- package/lib/components/EditorInput/useEditorInputStyles.styles.js +0 -7
- package/lib/components/EditorInput/useEditorInputStyles.styles.js.map +1 -1
- package/lib/components/EditorInput/useEditorInputStyles.styles.raw.js +0 -7
- package/lib/components/EditorInput/useEditorInputStyles.styles.raw.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/utilities/useCanShowPlaceholder.js +18 -0
- package/lib/utilities/useCanShowPlaceholder.js.map +1 -0
- package/lib/utilities/useLexicalContentEditable.js +69 -0
- package/lib/utilities/useLexicalContentEditable.js.map +1 -0
- package/lib/utilities/useLexicalEditor.js +63 -0
- package/lib/utilities/useLexicalEditor.js.map +1 -0
- package/lib-commonjs/EditorInput.js +3 -0
- package/lib-commonjs/EditorInput.js.map +1 -1
- package/lib-commonjs/components/EditorInput/EditorInput.js +3 -1
- package/lib-commonjs/components/EditorInput/EditorInput.js.map +1 -1
- package/lib-commonjs/components/EditorInput/EditorInput.types.js +1 -3
- package/lib-commonjs/components/EditorInput/EditorInput.types.js.map +1 -1
- package/lib-commonjs/components/EditorInput/index.js +4 -0
- package/lib-commonjs/components/EditorInput/index.js.map +1 -1
- package/lib-commonjs/components/EditorInput/renderEditorInput.js +9 -8
- package/lib-commonjs/components/EditorInput/renderEditorInput.js.map +1 -1
- package/lib-commonjs/components/EditorInput/useEditorInput.js +14 -58
- package/lib-commonjs/components/EditorInput/useEditorInput.js.map +1 -1
- package/lib-commonjs/components/EditorInput/useEditorInputContextValues.js +27 -0
- package/lib-commonjs/components/EditorInput/useEditorInputContextValues.js.map +1 -0
- package/lib-commonjs/components/EditorInput/useEditorInputStyles.styles.js +0 -7
- package/lib-commonjs/components/EditorInput/useEditorInputStyles.styles.js.map +1 -1
- package/lib-commonjs/components/EditorInput/useEditorInputStyles.styles.raw.js +0 -7
- package/lib-commonjs/components/EditorInput/useEditorInputStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/index.js +12 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utilities/useCanShowPlaceholder.js +29 -0
- package/lib-commonjs/utilities/useCanShowPlaceholder.js.map +1 -0
- package/lib-commonjs/utilities/useLexicalContentEditable.js +80 -0
- package/lib-commonjs/utilities/useLexicalContentEditable.js.map +1 -0
- package/lib-commonjs/utilities/useLexicalEditor.js +72 -0
- package/lib-commonjs/utilities/useLexicalEditor.js.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SentinelNode } from '@fluentui-copilot/chat-input-plugins';
|
|
3
|
+
import { mergeRegister } from '@fluentui-copilot/react-text-editor';
|
|
4
|
+
import { useControllableState, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';
|
|
5
|
+
import { useLexicalStyles } from '../EditorInput';
|
|
6
|
+
import { useLexicalEditor } from './useLexicalEditor';
|
|
7
|
+
import { useCanShowPlaceholder } from './useCanShowPlaceholder';
|
|
8
|
+
import { mergeClasses } from '@fluentui/react-components';
|
|
9
|
+
export function useLexicalContentEditable(props) {
|
|
10
|
+
const { defaultValue, customTheme } = props;
|
|
11
|
+
const customNodes = props.customNodes ? [
|
|
12
|
+
...props.customNodes,
|
|
13
|
+
SentinelNode
|
|
14
|
+
] : [
|
|
15
|
+
SentinelNode
|
|
16
|
+
];
|
|
17
|
+
// The disabled state can also be changed by lexical (e.g. by a custom plugin) so
|
|
18
|
+
// we use `useControllableState` to coordinate
|
|
19
|
+
const [disabled, setDisabled] = useControllableState({
|
|
20
|
+
state: props.disabled,
|
|
21
|
+
initialState: false
|
|
22
|
+
});
|
|
23
|
+
const lexicalStyles = useLexicalStyles();
|
|
24
|
+
const paragraphClassName = mergeClasses(lexicalStyles.paragraph, customTheme === null || customTheme === void 0 ? void 0 : customTheme.paragraph);
|
|
25
|
+
const lexicalInitialConfig = {
|
|
26
|
+
namespace: 'fai-EditorInput',
|
|
27
|
+
onError: console.log,
|
|
28
|
+
nodes: customNodes,
|
|
29
|
+
editorState: defaultValue,
|
|
30
|
+
editable: !disabled,
|
|
31
|
+
theme: {
|
|
32
|
+
...customTheme,
|
|
33
|
+
paragraph: paragraphClassName.trim() === '' ? undefined : paragraphClassName
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const lexicalEditor = useLexicalEditor(lexicalInitialConfig);
|
|
37
|
+
const canShowPlaceholder = useCanShowPlaceholder(lexicalEditor);
|
|
38
|
+
const spanRef = React.useCallback((span)=>{
|
|
39
|
+
// Register the `input` span with lexical
|
|
40
|
+
lexicalEditor.setRootElement(span);
|
|
41
|
+
}, [
|
|
42
|
+
lexicalEditor
|
|
43
|
+
]);
|
|
44
|
+
// Update lexical when disabled changes
|
|
45
|
+
useIsomorphicLayoutEffect(()=>{
|
|
46
|
+
lexicalEditor.setEditable(!disabled);
|
|
47
|
+
}, [
|
|
48
|
+
lexicalEditor
|
|
49
|
+
]);
|
|
50
|
+
useIsomorphicLayoutEffect(()=>{
|
|
51
|
+
return mergeRegister(lexicalEditor.registerEditableListener((isEditable)=>{
|
|
52
|
+
setDisabled(!isEditable);
|
|
53
|
+
}), lexicalEditor.registerRootListener((root)=>{
|
|
54
|
+
if (!root) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
// Remove lexical's inline style so we can apply our own
|
|
58
|
+
// Lexical needs the whitespace style to be either `pre` or `pre-wrap` to work correctly
|
|
59
|
+
root.style.whiteSpace = '';
|
|
60
|
+
}));
|
|
61
|
+
}, []);
|
|
62
|
+
return {
|
|
63
|
+
canShowPlaceholder,
|
|
64
|
+
disabled,
|
|
65
|
+
spanRef,
|
|
66
|
+
lexicalEditor,
|
|
67
|
+
lexicalInitialConfig
|
|
68
|
+
};
|
|
69
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useLexicalContentEditable.ts"],"sourcesContent":["import * as React from 'react';\nimport { SentinelNode } from '@fluentui-copilot/chat-input-plugins';\nimport type { InitialConfigType, LexicalEditor } from '@fluentui-copilot/react-text-editor';\nimport { mergeRegister } from '@fluentui-copilot/react-text-editor';\nimport { useControllableState, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport type { EditorInputProps } from '../EditorInput';\nimport { useLexicalStyles } from '../EditorInput';\nimport { useLexicalEditor } from './useLexicalEditor';\nimport { useCanShowPlaceholder } from './useCanShowPlaceholder';\nimport { mergeClasses } from '@fluentui/react-components';\n\nexport type UseLexicalContentEditableProps = Pick<EditorInputProps, 'customNodes' | 'disabled' | 'customTheme'> & {\n defaultValue?: () => void;\n};\nexport type UseLexicalContentEditableResult = {\n canShowPlaceholder: boolean;\n disabled: boolean;\n spanRef: React.Ref<HTMLSpanElement>;\n lexicalEditor: LexicalEditor;\n lexicalInitialConfig: InitialConfigType;\n};\n\nexport function useLexicalContentEditable(props: UseLexicalContentEditableProps): UseLexicalContentEditableResult {\n const { defaultValue, customTheme } = props;\n\n const customNodes = props.customNodes ? [...props.customNodes, SentinelNode] : [SentinelNode];\n\n // The disabled state can also be changed by lexical (e.g. by a custom plugin) so\n // we use `useControllableState` to coordinate\n const [disabled, setDisabled] = useControllableState({\n state: props.disabled,\n initialState: false,\n });\n\n const lexicalStyles = useLexicalStyles();\n const paragraphClassName = mergeClasses(lexicalStyles.paragraph, customTheme?.paragraph);\n\n const lexicalInitialConfig = {\n namespace: 'fai-EditorInput',\n onError: console.log,\n nodes: customNodes,\n editorState: defaultValue,\n editable: !disabled,\n theme: { ...customTheme, paragraph: paragraphClassName.trim() === '' ? undefined : paragraphClassName },\n };\n const lexicalEditor = useLexicalEditor(lexicalInitialConfig);\n\n const canShowPlaceholder = useCanShowPlaceholder(lexicalEditor);\n\n const spanRef = React.useCallback(\n (span: HTMLSpanElement | null) => {\n // Register the `input` span with lexical\n lexicalEditor.setRootElement(span);\n },\n [lexicalEditor],\n );\n\n // Update lexical when disabled changes\n useIsomorphicLayoutEffect(() => {\n lexicalEditor.setEditable(!disabled);\n }, [lexicalEditor]);\n\n useIsomorphicLayoutEffect(() => {\n return mergeRegister(\n lexicalEditor.registerEditableListener(isEditable => {\n setDisabled(!isEditable);\n }),\n lexicalEditor.registerRootListener(root => {\n if (!root) {\n return;\n }\n\n // Remove lexical's inline style so we can apply our own\n // Lexical needs the whitespace style to be either `pre` or `pre-wrap` to work correctly\n root.style.whiteSpace = '';\n }),\n );\n }, []);\n\n return { canShowPlaceholder, disabled, spanRef, lexicalEditor, lexicalInitialConfig };\n}\n"],"names":["React","SentinelNode","mergeRegister","useControllableState","useIsomorphicLayoutEffect","useLexicalStyles","useLexicalEditor","useCanShowPlaceholder","mergeClasses","useLexicalContentEditable","props","defaultValue","customTheme","customNodes","disabled","setDisabled","state","initialState","lexicalStyles","paragraphClassName","paragraph","lexicalInitialConfig","namespace","onError","console","log","nodes","editorState","editable","theme","trim","undefined","lexicalEditor","canShowPlaceholder","spanRef","useCallback","span","setRootElement","setEditable","registerEditableListener","isEditable","registerRootListener","root","style","whiteSpace"],"rangeMappings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,WAAW,CAAC,CAACxB;IAC7B,GAAG;QAACkB;KAAc;IAElB5B,0BAA0B;QACxB,OAAOF,cACL8B,cAAcO,wBAAwB,CAACC,CAAAA;YACrCzB,YAAY,CAACyB;QACf,IACAR,cAAcS,oBAAoB,CAACC,CAAAA;YACjC,IAAI,CAACA,MAAM;gBACT;YACF;YAEA,wDAAwD;YACxD,wFAAwF;YACxFA,KAAKC,KAAK,CAACC,UAAU,GAAG;QAC1B;IAEJ,GAAG,EAAE;IAEL,OAAO;QAAEX;QAAoBnB;QAAUoB;QAASF;QAAeX;IAAqB;AACtF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { $createParagraphNode } from '@fluentui-copilot/react-text-editor';
|
|
2
|
+
import { $getRoot } from '@fluentui-copilot/react-text-editor';
|
|
3
|
+
import { createEditor } from '@fluentui-copilot/react-text-editor';
|
|
4
|
+
import { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
// Merge initial state with history
|
|
7
|
+
const UPDATE_OPTIONS = {
|
|
8
|
+
tag: 'history-merge'
|
|
9
|
+
};
|
|
10
|
+
function setInitialState(editor, initialState) {
|
|
11
|
+
if (initialState === null) {
|
|
12
|
+
return;
|
|
13
|
+
} else if (initialState === undefined) {
|
|
14
|
+
editor.update(()=>{
|
|
15
|
+
const root = $getRoot();
|
|
16
|
+
if (root.isEmpty()) {
|
|
17
|
+
root.append($createParagraphNode());
|
|
18
|
+
}
|
|
19
|
+
}, UPDATE_OPTIONS);
|
|
20
|
+
} else {
|
|
21
|
+
switch(typeof initialState){
|
|
22
|
+
case 'string':
|
|
23
|
+
{
|
|
24
|
+
const parsedState = editor.parseEditorState(initialState);
|
|
25
|
+
editor.setEditorState(parsedState, UPDATE_OPTIONS);
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
case 'object':
|
|
29
|
+
{
|
|
30
|
+
editor.setEditorState(initialState, UPDATE_OPTIONS);
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
case 'function':
|
|
34
|
+
{
|
|
35
|
+
editor.update(()=>{
|
|
36
|
+
if ($getRoot().isEmpty()) {
|
|
37
|
+
initialState(editor);
|
|
38
|
+
}
|
|
39
|
+
}, UPDATE_OPTIONS);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export function useLexicalEditor(initialConfig) {
|
|
45
|
+
const { theme, namespace, nodes, onError, editorState: initialEditorState, html, editable = true } = initialConfig;
|
|
46
|
+
const [lexicalEditor] = React.useState(()=>{
|
|
47
|
+
const lexicalEditor = createEditor({
|
|
48
|
+
editable,
|
|
49
|
+
html,
|
|
50
|
+
namespace,
|
|
51
|
+
nodes,
|
|
52
|
+
onError: (error)=>onError(error, lexicalEditor),
|
|
53
|
+
theme
|
|
54
|
+
});
|
|
55
|
+
setInitialState(lexicalEditor, initialEditorState);
|
|
56
|
+
return lexicalEditor;
|
|
57
|
+
});
|
|
58
|
+
useIsomorphicLayoutEffect(()=>{
|
|
59
|
+
const isEditable = initialConfig.editable;
|
|
60
|
+
lexicalEditor.setEditable(isEditable !== undefined ? isEditable : true);
|
|
61
|
+
}, []);
|
|
62
|
+
return lexicalEditor;
|
|
63
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useLexicalEditor.ts"],"sourcesContent":["import type { InitialConfigType, LexicalEditor } from '@fluentui-copilot/react-text-editor';\nimport { $createParagraphNode } from '@fluentui-copilot/react-text-editor';\nimport { $getRoot } from '@fluentui-copilot/react-text-editor';\nimport { createEditor } from '@fluentui-copilot/react-text-editor';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport * as React from 'react';\n\n// Merge initial state with history\nconst UPDATE_OPTIONS = { tag: 'history-merge' };\n\nfunction setInitialState(editor: LexicalEditor, initialState: InitialConfigType['editorState']) {\n if (initialState === null) {\n return;\n } else if (initialState === undefined) {\n editor.update(() => {\n const root = $getRoot();\n if (root.isEmpty()) {\n root.append($createParagraphNode());\n }\n }, UPDATE_OPTIONS);\n } else {\n switch (typeof initialState) {\n case 'string': {\n const parsedState = editor.parseEditorState(initialState);\n editor.setEditorState(parsedState, UPDATE_OPTIONS);\n break;\n }\n case 'object': {\n editor.setEditorState(initialState, UPDATE_OPTIONS);\n break;\n }\n case 'function': {\n editor.update(() => {\n if ($getRoot().isEmpty()) {\n initialState(editor);\n }\n }, UPDATE_OPTIONS);\n }\n }\n }\n}\n\nexport function useLexicalEditor(initialConfig: InitialConfigType): LexicalEditor {\n const { theme, namespace, nodes, onError, editorState: initialEditorState, html, editable = true } = initialConfig;\n\n const [lexicalEditor] = React.useState(() => {\n const lexicalEditor = createEditor({\n editable,\n html,\n namespace,\n nodes,\n onError: error => onError(error, lexicalEditor),\n theme,\n });\n\n setInitialState(lexicalEditor, initialEditorState);\n\n return lexicalEditor;\n });\n\n useIsomorphicLayoutEffect(() => {\n const isEditable = initialConfig.editable;\n lexicalEditor.setEditable(isEditable !== undefined ? isEditable : true);\n }, []);\n\n return lexicalEditor;\n}\n"],"names":["$createParagraphNode","$getRoot","createEditor","useIsomorphicLayoutEffect","React","UPDATE_OPTIONS","tag","setInitialState","editor","initialState","undefined","update","root","isEmpty","append","parsedState","parseEditorState","setEditorState","useLexicalEditor","initialConfig","theme","namespace","nodes","onError","editorState","initialEditorState","html","editable","lexicalEditor","useState","error","isEditable","setEditable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AACA,SAASA,oBAAoB,QAAQ,sCAAsC;AAC3E,SAASC,QAAQ,QAAQ,sCAAsC;AAC/D,SAASC,YAAY,QAAQ,sCAAsC;AACnE,SAASC,yBAAyB,QAAQ,4BAA4B;AACtE,YAAYC,WAAW,QAAQ;AAE/B,mCAAmC;AACnC,MAAMC,iBAAiB;IAAEC,KAAK;AAAgB;AAE9C,SAASC,gBAAgBC,MAAqB,EAAEC,YAA8C;IAC5F,IAAIA,iBAAiB,MAAM;QACzB;IACF,OAAO,IAAIA,iBAAiBC,WAAW;QACrCF,OAAOG,MAAM,CAAC;YACZ,MAAMC,OAAOX;YACb,IAAIW,KAAKC,OAAO,IAAI;gBAClBD,KAAKE,MAAM,CAACd;YACd;QACF,GAAGK;IACL,OAAO;QACL,OAAQ,OAAOI;YACb,KAAK;gBAAU;oBACb,MAAMM,cAAcP,OAAOQ,gBAAgB,CAACP;oBAC5CD,OAAOS,cAAc,CAACF,aAAaV;oBACnC;gBACF;YACA,KAAK;gBAAU;oBACbG,OAAOS,cAAc,CAACR,cAAcJ;oBACpC;gBACF;YACA,KAAK;gBAAY;oBACfG,OAAOG,MAAM,CAAC;wBACZ,IAAIV,WAAWY,OAAO,IAAI;4BACxBJ,aAAaD;wBACf;oBACF,GAAGH;gBACL;QACF;IACF;AACF;AAEA,OAAO,SAASa,iBAAiBC,aAAgC;IAC/D,MAAM,EAAEC,KAAK,EAAEC,SAAS,EAAEC,KAAK,EAAEC,OAAO,EAAEC,aAAaC,kBAAkB,EAAEC,IAAI,EAAEC,WAAW,IAAI,EAAE,GAAGR;IAErG,MAAM,CAACS,cAAc,GAAGxB,MAAMyB,QAAQ,CAAC;QACrC,MAAMD,gBAAgB1B,aAAa;YACjCyB;YACAD;YACAL;YACAC;YACAC,SAASO,CAAAA,QAASP,QAAQO,OAAOF;YACjCR;QACF;QAEAb,gBAAgBqB,eAAeH;QAE/B,OAAOG;IACT;IAEAzB,0BAA0B;QACxB,MAAM4B,aAAaZ,cAAcQ,QAAQ;QACzCC,cAAcI,WAAW,CAACD,eAAerB,YAAYqB,aAAa;IACpE,GAAG,EAAE;IAEL,OAAOH;AACT"}
|
|
@@ -18,6 +18,9 @@ _export(exports, {
|
|
|
18
18
|
renderEditorInput_unstable: function() {
|
|
19
19
|
return _index.renderEditorInput_unstable;
|
|
20
20
|
},
|
|
21
|
+
useEditorInputContextValues: function() {
|
|
22
|
+
return _index.useEditorInputContextValues;
|
|
23
|
+
},
|
|
21
24
|
useEditorInputStyles_unstable: function() {
|
|
22
25
|
return _index.useEditorInputStyles_unstable;
|
|
23
26
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["EditorInput.ts"],"sourcesContent":["export
|
|
1
|
+
{"version":3,"sources":["EditorInput.ts"],"sourcesContent":["export {\n EditorInput,\n editorInputClassNames,\n renderEditorInput_unstable,\n useEditorInputContextValues,\n useEditorInputStyles_unstable,\n useEditorInput_unstable,\n useInputClassName,\n useLexicalStyles,\n usePlaceholderClassName,\n} from './components/EditorInput/index';\nexport type {\n EditorInputContextValues,\n EditorInputProps,\n EditorInputSlots,\n EditorInputState,\n EditorInputValueData,\n} from './components/EditorInput/index';\n"],"names":["EditorInput","editorInputClassNames","renderEditorInput_unstable","useEditorInputContextValues","useEditorInputStyles_unstable","useEditorInput_unstable","useInputClassName","useLexicalStyles","usePlaceholderClassName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IACEA,WAAW;eAAXA,kBAAW;;IACXC,qBAAqB;eAArBA,4BAAqB;;IACrBC,0BAA0B;eAA1BA,iCAA0B;;IAC1BC,2BAA2B;eAA3BA,kCAA2B;;IAC3BC,6BAA6B;eAA7BA,oCAA6B;;IAC7BC,uBAAuB;eAAvBA,8BAAuB;;IACvBC,iBAAiB;eAAjBA,wBAAiB;;IACjBC,gBAAgB;eAAhBA,uBAAgB;;IAChBC,uBAAuB;eAAvBA,8BAAuB;;;uBAClB"}
|
|
@@ -13,9 +13,11 @@ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
|
13
13
|
const _useEditorInput = require("./useEditorInput");
|
|
14
14
|
const _renderEditorInput = require("./renderEditorInput");
|
|
15
15
|
const _useEditorInputStylesstyles = require("./useEditorInputStyles.styles");
|
|
16
|
+
const _useEditorInputContextValues = require("./useEditorInputContextValues");
|
|
16
17
|
const EditorInput = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
|
|
17
18
|
const state = (0, _useEditorInput.useEditorInput_unstable)(props, ref);
|
|
19
|
+
const contextValues = (0, _useEditorInputContextValues.useEditorInputContextValues)(state);
|
|
18
20
|
(0, _useEditorInputStylesstyles.useEditorInputStyles_unstable)(state);
|
|
19
|
-
return (0, _renderEditorInput.renderEditorInput_unstable)(state);
|
|
21
|
+
return (0, _renderEditorInput.renderEditorInput_unstable)(state, contextValues);
|
|
20
22
|
});
|
|
21
23
|
EditorInput.displayName = 'EditorInput';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["EditorInput.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useEditorInput_unstable } from './useEditorInput';\nimport { renderEditorInput_unstable } from './renderEditorInput';\nimport { useEditorInputStyles_unstable } from './useEditorInputStyles.styles';\nimport type { EditorInputProps } from './EditorInput.types';\nimport type { ForwardRefComponent } from '@fluentui/react-components';\n\n// EditorInput component - TODO: add more docs\nexport const EditorInput: ForwardRefComponent<EditorInputProps> = React.forwardRef((props, ref) => {\n const state = useEditorInput_unstable(props, ref);\n\n useEditorInputStyles_unstable(state);\n return renderEditorInput_unstable(state);\n});\n\nEditorInput.displayName = 'EditorInput';\n"],"names":["EditorInput","React","forwardRef","props","ref","state","useEditorInput_unstable","useEditorInputStyles_unstable","renderEditorInput_unstable","displayName"],"rangeMappings":"
|
|
1
|
+
{"version":3,"sources":["EditorInput.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useEditorInput_unstable } from './useEditorInput';\nimport { renderEditorInput_unstable } from './renderEditorInput';\nimport { useEditorInputStyles_unstable } from './useEditorInputStyles.styles';\nimport type { EditorInputProps } from './EditorInput.types';\nimport type { ForwardRefComponent } from '@fluentui/react-components';\nimport { useEditorInputContextValues } from './useEditorInputContextValues';\n\n// EditorInput component - TODO: add more docs\nexport const EditorInput: ForwardRefComponent<EditorInputProps> = React.forwardRef((props, ref) => {\n const state = useEditorInput_unstable(props, ref);\n const contextValues = useEditorInputContextValues(state);\n\n useEditorInputStyles_unstable(state);\n return renderEditorInput_unstable(state, contextValues);\n});\n\nEditorInput.displayName = 'EditorInput';\n"],"names":["EditorInput","React","forwardRef","props","ref","state","useEditorInput_unstable","contextValues","useEditorInputContextValues","useEditorInputStyles_unstable","renderEditorInput_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BASaA;;;eAAAA;;;;iEATU;gCACiB;mCACG;4CACG;6CAGF;AAGrC,MAAMA,cAAAA,WAAAA,GAAqDC,OAAMC,UAAU,CAAC,CAACC,OAAOC;IACzF,MAAMC,QAAQC,IAAAA,uCAAAA,EAAwBH,OAAOC;IAC7C,MAAMG,gBAAgBC,IAAAA,wDAAAA,EAA4BH;IAElDI,IAAAA,yDAAAA,EAA8BJ;IAC9B,OAAOK,IAAAA,6CAAAA,EAA2BL,OAAOE;AAC3C;AAEAP,YAAYW,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["EditorInput.types.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["EditorInput.types.ts"],"sourcesContent":["import type {\n InitialConfigType,\n LexicalComposerContextWithEditor,\n LexicalEditor,\n LexicalPlainTextPlugin,\n} from '@fluentui-copilot/react-text-editor';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\n\nexport type EditorInputSlots = {\n root: NonNullable<Slot<'span'>>;\n input: NonNullable<Slot<'span'>>;\n placeholderValue?: Slot<'span'>;\n};\n\n/**\n * EditorInput Props\n */\nexport type EditorInputProps = Omit<\n ComponentProps<Partial<EditorInputSlots>, 'input'>,\n 'onChange' | 'onPaste' | 'defaultValue' | 'onSubmit'\n> & {\n disabled?: boolean;\n /**\n * If defaultValue is a string, it will be added to the input on first render.\n * If defaultValue is a function, it can call lexical $ functions to imperatively set the initial content with more complex nodes.\n */\n defaultValue?: string | (() => void);\n /**\n * Called when the default value is given to the editor.\n * If `defaultValue` was a function, this will be called with the state of the editor after\n * calling that function.\n * If `defaultValue` was a string, this will be called with the same string.\n */\n onDefaultValueSet?: (defaultValue: string) => void;\n /**\n * Callback for when the user changes the value.\n * TODO: Add proper event type for callback\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onChange?: (ev: any, data: EditorInputValueData) => void;\n /**\n * Callback for when content is pasted into the Editor.\n */\n onPaste?: (ev: ClipboardEvent) => void;\n /**\n * When true, the input will be cleared when only whitespace is remaining.\n * @default false\n */\n trimWhiteSpace?: boolean;\n /**\n * Used to register any custom nodes used by plugins added. Can also be used to override the default nodes.\n */\n customNodes?: InitialConfigType['nodes'];\n /**\n * The plugin which is in charge of initializing Lexical and is given the `input` and `placeholder` slots\n * @default LexicalPlainTextPlugin\n */\n textPlugin?: typeof LexicalPlainTextPlugin;\n /**\n * Controls whether history is tracked to provide undo and redo functionality\n * @default true\n */\n history?: boolean;\n\n editorRef?: React.RefObject<LexicalEditor | null>;\n\n /**\n * Customize the default styles of elements inserted by Lexical in the editor.\n */\n customTheme?: InitialConfigType['theme'];\n\n /**\n * Whether or not to enable the sentinel node. The sentinel node is a node that is inserted at the end of the editor\n * The SentinelNode fixes a Safari bug in lexical versions below 0.20.1\n * @default true\n */\n isSentinelNodeEnabled?: boolean;\n};\n\n/**\n * State used in rendering EditorInput\n */\nexport type EditorInputState = ComponentState<EditorInputSlots> &\n Required<Pick<EditorInputProps, 'disabled' | 'textPlugin' | 'history' | 'trimWhiteSpace' | 'isSentinelNodeEnabled'>> &\n Partial<Pick<EditorInputProps, 'editorRef' | 'onPaste'>> & {\n handleOnChange: (value: string) => void;\n lexicalEditor: LexicalEditor;\n lexicalInitialConfig: InitialConfigType;\n };\n\n/**\n * Data passed to the `onChange` callback when the chat input's value changes.\n */\nexport type EditorInputValueData = {\n value: string;\n};\n\nexport type EditorInputContextValues = {\n lexicalComposer: LexicalComposerContextWithEditor;\n};\n"],"names":[],"rangeMappings":"","mappings":""}
|
|
@@ -18,6 +18,9 @@ _export(exports, {
|
|
|
18
18
|
renderEditorInput_unstable: function() {
|
|
19
19
|
return _renderEditorInput.renderEditorInput_unstable;
|
|
20
20
|
},
|
|
21
|
+
useEditorInputContextValues: function() {
|
|
22
|
+
return _useEditorInputContextValues.useEditorInputContextValues;
|
|
23
|
+
},
|
|
21
24
|
useEditorInputStyles_unstable: function() {
|
|
22
25
|
return _useEditorInputStylesstyles.useEditorInputStyles_unstable;
|
|
23
26
|
},
|
|
@@ -38,3 +41,4 @@ const _EditorInput = require("./EditorInput");
|
|
|
38
41
|
const _renderEditorInput = require("./renderEditorInput");
|
|
39
42
|
const _useEditorInput = require("./useEditorInput");
|
|
40
43
|
const _useEditorInputStylesstyles = require("./useEditorInputStyles.styles");
|
|
44
|
+
const _useEditorInputContextValues = require("./useEditorInputContextValues");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export { EditorInput } from './EditorInput';\nexport type {
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export { EditorInput } from './EditorInput';\nexport type {\n EditorInputProps,\n EditorInputSlots,\n EditorInputState,\n EditorInputValueData,\n EditorInputContextValues,\n} from './EditorInput.types';\nexport { renderEditorInput_unstable } from './renderEditorInput';\nexport { useEditorInput_unstable } from './useEditorInput';\nexport {\n editorInputClassNames,\n useEditorInputStyles_unstable,\n useInputClassName,\n useLexicalStyles,\n usePlaceholderClassName,\n} from './useEditorInputStyles.styles';\nexport { useEditorInputContextValues } from './useEditorInputContextValues';\n"],"names":["EditorInput","editorInputClassNames","renderEditorInput_unstable","useEditorInputContextValues","useEditorInputStyles_unstable","useEditorInput_unstable","useInputClassName","useLexicalStyles","usePlaceholderClassName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAASA,WAAW;eAAXA,wBAAW;;IAWlBC,qBAAqB;eAArBA,iDAAqB;;IAHdC,0BAA0B;eAA1BA,6CAA0B;;IAS1BC,2BAA2B;eAA3BA,wDAA2B;;IALlCC,6BAA6B;eAA7BA,yDAA6B;;IAHtBC,uBAAuB;eAAvBA,uCAAuB;;IAI9BC,iBAAiB;eAAjBA,6CAAiB;;IACjBC,gBAAgB;eAAhBA,4CAAgB;;IAChBC,uBAAuB;eAAvBA,mDAAuB;;;6BAfG;mCAQe;gCACH;4CAOjC;6CACqC"}
|
|
@@ -12,30 +12,31 @@ const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
|
|
|
12
12
|
const _reactcomponents = require("@fluentui/react-components");
|
|
13
13
|
const _reacttexteditor = require("@fluentui-copilot/react-text-editor");
|
|
14
14
|
const _reactchatinputplugins = require("@fluentui-copilot/react-chat-input-plugins");
|
|
15
|
-
const renderEditorInput_unstable = (state)=>{
|
|
15
|
+
const renderEditorInput_unstable = (state, contextValues)=>{
|
|
16
16
|
(0, _reactcomponents.assertSlots)(state);
|
|
17
17
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(state.root, {
|
|
18
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_reacttexteditor.
|
|
19
|
-
|
|
18
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_reacttexteditor.LexicalComposerContext.Provider, {
|
|
19
|
+
value: contextValues.lexicalComposer,
|
|
20
20
|
children: [
|
|
21
21
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(state.textPlugin, {
|
|
22
22
|
contentEditable: /*#__PURE__*/ (0, _jsxruntime.jsx)(state.input, {}),
|
|
23
23
|
ErrorBoundary: _reacttexteditor.LexicalErrorBoundary,
|
|
24
|
-
placeholder:
|
|
24
|
+
placeholder: null
|
|
25
25
|
}),
|
|
26
26
|
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
27
27
|
children: [
|
|
28
|
+
state.placeholderValue ? /*#__PURE__*/ (0, _jsxruntime.jsx)(state.placeholderValue, {}) : null,
|
|
28
29
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactchatinputplugins.BasicFunctionalityPlugin, {
|
|
29
30
|
onContentChange: state.handleOnChange,
|
|
30
31
|
onPaste: state.onPaste,
|
|
31
32
|
trimWhitespace: state.trimWhiteSpace,
|
|
32
33
|
isSentinelNodeEnabled: state.isSentinelNodeEnabled
|
|
33
34
|
}),
|
|
34
|
-
state.history && /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacttexteditor.LexicalHistoryPlugin, {})
|
|
35
|
+
state.history && /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacttexteditor.LexicalHistoryPlugin, {}),
|
|
36
|
+
state.editorRef && /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacttexteditor.LexicalEditorRefPlugin, {
|
|
37
|
+
editorRef: state.editorRef
|
|
38
|
+
})
|
|
35
39
|
]
|
|
36
|
-
}),
|
|
37
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reacttexteditor.LexicalEditorRefPlugin, {
|
|
38
|
-
editorRef: state.editorRef
|
|
39
40
|
})
|
|
40
41
|
]
|
|
41
42
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderEditorInput.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\nimport type { JSXElement } from '@fluentui/react-components';\nimport
|
|
1
|
+
{"version":3,"sources":["renderEditorInput.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\nimport type { JSXElement } from '@fluentui/react-components';\nimport {\n LexicalErrorBoundary,\n LexicalEditorRefPlugin,\n LexicalHistoryPlugin,\n LexicalComposerContext,\n} from '@fluentui-copilot/react-text-editor';\nimport { BasicFunctionalityPlugin } from '@fluentui-copilot/react-chat-input-plugins';\nimport type { EditorInputState, EditorInputContextValues, EditorInputSlots } from './EditorInput.types';\n\n/**\n * Render the final JSX of EditorInput\n */\nexport const renderEditorInput_unstable = (\n state: EditorInputState,\n contextValues: EditorInputContextValues,\n): JSXElement => {\n assertSlots<EditorInputSlots>(state);\n\n return (\n <state.root>\n <LexicalComposerContext.Provider value={contextValues.lexicalComposer}>\n <state.textPlugin contentEditable={<state.input />} ErrorBoundary={LexicalErrorBoundary} placeholder={null} />\n <>\n {state.placeholderValue ? <state.placeholderValue /> : null}\n <BasicFunctionalityPlugin\n onContentChange={state.handleOnChange}\n onPaste={state.onPaste}\n trimWhitespace={state.trimWhiteSpace}\n isSentinelNodeEnabled={state.isSentinelNodeEnabled}\n />\n {state.history && <LexicalHistoryPlugin />}\n {state.editorRef && <LexicalEditorRefPlugin editorRef={state.editorRef} />}\n </>\n </LexicalComposerContext.Provider>\n </state.root>\n );\n};\n"],"names":["renderEditorInput_unstable","state","contextValues","assertSlots","_jsx","root","_jsxs","LexicalComposerContext","Provider","value","lexicalComposer","textPlugin","contentEditable","input","ErrorBoundary","LexicalErrorBoundary","placeholder","_Fragment","placeholderValue","BasicFunctionalityPlugin","onContentChange","handleOnChange","onPaste","trimWhitespace","trimWhiteSpace","isSentinelNodeEnabled","history","LexicalHistoryPlugin","editorRef","LexicalEditorRefPlugin"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAiBaA;;;eAAAA;;;4BAhBb;iCAE4B;iCAOrB;uCACkC;AAMlC,MAAMA,6BAA6B,CACxCC,OACAC;IAEAC,IAAAA,4BAAAA,EAA8BF;IAE9B,OAAA,WAAA,GACEG,IAAAA,eAAA,EAACH,MAAMI,IAAI,EAAA;kBACT,WAAA,GAAAC,IAAAA,gBAAA,EAACC,uCAAAA,CAAuBC,QAAQ,EAAA;YAACC,OAAOP,cAAcQ,eAAe;;8BACnEN,IAAAA,eAAA,EAACH,MAAMU,UAAU,EAAA;oBAACC,iBAAAA,WAAAA,GAAiBR,IAAAA,eAAA,EAACH,MAAMY,KAAK,EAAA,CAAA;oBAAKC,eAAeC,qCAAAA;oBAAsBC,aAAa;;8BACtGV,IAAAA,gBAAA,EAAAW,oBAAA,EAAA;;wBACGhB,MAAMiB,gBAAgB,GAAA,WAAA,GAAGd,IAAAA,eAAA,EAACH,MAAMiB,gBAAgB,EAAA,CAAA,KAAM;sCACvDd,IAAAA,eAAA,EAACe,+CAAAA,EAAAA;4BACCC,iBAAiBnB,MAAMoB,cAAc;4BACrCC,SAASrB,MAAMqB,OAAO;4BACtBC,gBAAgBtB,MAAMuB,cAAc;4BACpCC,uBAAuBxB,MAAMwB,qBAAqB;;wBAEnDxB,MAAMyB,OAAO,IAAA,WAAA,GAAItB,IAAAA,eAAA,EAACuB,qCAAAA,EAAAA,CAAAA;wBAClB1B,MAAM2B,SAAS,IAAA,WAAA,GAAIxB,IAAAA,eAAA,EAACyB,uCAAAA,EAAAA;4BAAuBD,WAAW3B,MAAM2B,SAAS;;;;;;;AAKhF"}
|
|
@@ -14,8 +14,9 @@ const _reactcomponents = require("@fluentui/react-components");
|
|
|
14
14
|
const _chatinputplugins = require("@fluentui-copilot/chat-input-plugins");
|
|
15
15
|
const _reacttexteditor = require("@fluentui-copilot/react-text-editor");
|
|
16
16
|
const _reactutilities = require("@fluentui/react-utilities");
|
|
17
|
+
const _useLexicalContentEditable = require("../../utilities/useLexicalContentEditable");
|
|
17
18
|
const useEditorInput_unstable = (props, ref)=>{
|
|
18
|
-
const { onChange, onPaste, trimWhiteSpace = false, textPlugin = _reacttexteditor.LexicalPlainTextPlugin, history = true, editorRef
|
|
19
|
+
const { onChange, onPaste, trimWhiteSpace = false, textPlugin = _reacttexteditor.LexicalPlainTextPlugin, history = true, editorRef, isSentinelNodeEnabled = true } = props;
|
|
19
20
|
const { root, primary } = (0, _reactcomponents.getPartitionedNativeProps)({
|
|
20
21
|
primarySlotTagName: 'span',
|
|
21
22
|
props,
|
|
@@ -25,51 +26,6 @@ const useEditorInput_unstable = (props, ref)=>{
|
|
|
25
26
|
'defaultValue'
|
|
26
27
|
]
|
|
27
28
|
});
|
|
28
|
-
const editorRef = (0, _reactcomponents.useMergedRefs)(_react.useRef(null), userEditorRef);
|
|
29
|
-
// The disabled state can also be changed by lexical (e.g. by a custom plugin) so
|
|
30
|
-
// we use `useControllableState` to coordinate
|
|
31
|
-
const [disabled, setDisabled] = (0, _reactutilities.useControllableState)({
|
|
32
|
-
state: props.disabled,
|
|
33
|
-
initialState: false
|
|
34
|
-
});
|
|
35
|
-
const customNodes = props.customNodes ? [
|
|
36
|
-
...props.customNodes,
|
|
37
|
-
_chatinputplugins.SentinelNode
|
|
38
|
-
] : [
|
|
39
|
-
_chatinputplugins.SentinelNode
|
|
40
|
-
];
|
|
41
|
-
const spanRef = _react.useCallback((span)=>{
|
|
42
|
-
var _editorRef_current;
|
|
43
|
-
(_editorRef_current = editorRef.current) === null || _editorRef_current === void 0 ? void 0 : _editorRef_current.setRootElement(span);
|
|
44
|
-
}, [
|
|
45
|
-
editorRef
|
|
46
|
-
]);
|
|
47
|
-
// Update lexical when disabled changes
|
|
48
|
-
(0, _reactcomponents.useIsomorphicLayoutEffect)(()=>{
|
|
49
|
-
if (editorRef.current) {
|
|
50
|
-
var _editorRef_current;
|
|
51
|
-
(_editorRef_current = editorRef.current) === null || _editorRef_current === void 0 ? void 0 : _editorRef_current.setEditable(!disabled);
|
|
52
|
-
}
|
|
53
|
-
}, [
|
|
54
|
-
disabled
|
|
55
|
-
]);
|
|
56
|
-
(0, _reactcomponents.useIsomorphicLayoutEffect)(()=>{
|
|
57
|
-
if (editorRef.current) {
|
|
58
|
-
var _editorRef_current;
|
|
59
|
-
return (0, _reacttexteditor.mergeRegister)(editorRef.current.registerEditableListener((isEditable)=>{
|
|
60
|
-
setDisabled(!isEditable);
|
|
61
|
-
}), (_editorRef_current = editorRef.current) === null || _editorRef_current === void 0 ? void 0 : _editorRef_current.registerRootListener((root)=>{
|
|
62
|
-
if (!root) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
// Remove lexical's inline style so we can apply our own
|
|
66
|
-
// Lexical needs the whitespace style to be either `pre` or `pre-wrap` to work correctly
|
|
67
|
-
root.style.whiteSpace = '';
|
|
68
|
-
}));
|
|
69
|
-
}
|
|
70
|
-
}, [
|
|
71
|
-
editorRef
|
|
72
|
-
]);
|
|
73
29
|
const handleOnChange = _react.useCallback((newValue)=>{
|
|
74
30
|
onChange === null || onChange === void 0 ? void 0 : onChange({}, {
|
|
75
31
|
value: newValue
|
|
@@ -77,14 +33,19 @@ const useEditorInput_unstable = (props, ref)=>{
|
|
|
77
33
|
}, [
|
|
78
34
|
onChange
|
|
79
35
|
]);
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
36
|
+
const { canShowPlaceholder, spanRef, disabled, lexicalEditor, lexicalInitialConfig } = (0, _useLexicalContentEditable.useLexicalContentEditable)({
|
|
37
|
+
customNodes: props.customNodes,
|
|
38
|
+
defaultValue: useDefaultValueFunction(props),
|
|
39
|
+
disabled: props.disabled
|
|
83
40
|
});
|
|
41
|
+
const placeholderValue = canShowPlaceholder ? _reactcomponents.slot.optional(props.placeholderValue, {
|
|
42
|
+
elementType: 'span'
|
|
43
|
+
}) : undefined;
|
|
84
44
|
const placeholderId = (0, _reactcomponents.useId)('chat-input-placeholder', placeholderValue === null || placeholderValue === void 0 ? void 0 : placeholderValue.id);
|
|
85
45
|
if (placeholderValue) {
|
|
86
46
|
placeholderValue.id = placeholderId;
|
|
87
47
|
}
|
|
48
|
+
const describedBy = primary['aria-describedby'] ? `${primary['aria-describedby']} ${placeholderId}` : placeholderId;
|
|
88
49
|
return {
|
|
89
50
|
components: {
|
|
90
51
|
root: 'span',
|
|
@@ -107,18 +68,12 @@ const useEditorInput_unstable = (props, ref)=>{
|
|
|
107
68
|
suppressContentEditableWarning: true,
|
|
108
69
|
tabIndex: disabled ? undefined : 0,
|
|
109
70
|
...primary,
|
|
110
|
-
'aria-describedby':
|
|
71
|
+
'aria-describedby': describedBy
|
|
111
72
|
},
|
|
112
73
|
elementType: 'span'
|
|
113
74
|
}),
|
|
114
75
|
placeholderValue,
|
|
115
|
-
lexicalInitialConfig
|
|
116
|
-
namespace: 'fai-EditorInput',
|
|
117
|
-
onError: console.error,
|
|
118
|
-
nodes: customNodes,
|
|
119
|
-
editorState: defaultValueFunction,
|
|
120
|
-
theme: customTheme
|
|
121
|
-
},
|
|
76
|
+
lexicalInitialConfig,
|
|
122
77
|
editorRef,
|
|
123
78
|
disabled,
|
|
124
79
|
textPlugin,
|
|
@@ -126,7 +81,8 @@ const useEditorInput_unstable = (props, ref)=>{
|
|
|
126
81
|
handleOnChange,
|
|
127
82
|
trimWhiteSpace,
|
|
128
83
|
history,
|
|
129
|
-
isSentinelNodeEnabled
|
|
84
|
+
isSentinelNodeEnabled,
|
|
85
|
+
lexicalEditor
|
|
130
86
|
};
|
|
131
87
|
};
|
|
132
88
|
function useDefaultValueFunction(props) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useEditorInput.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n getPartitionedNativeProps,\n slot,\n useFluent,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n} from '@fluentui/react-components';\nimport type { EditorInputProps, EditorInputState } from './EditorInput.types';\nimport { SentinelNode, SENTINEL_VALUE } from '@fluentui-copilot/chat-input-plugins';\nimport type { LexicalEditor } from '@fluentui-copilot/react-text-editor';\nimport { $createTextNode, $insertNodes } from '@fluentui-copilot/react-text-editor';\nimport { $getRoot } from '@fluentui-copilot/react-text-editor';\nimport { LexicalPlainTextPlugin, mergeRegister } from '@fluentui-copilot/react-text-editor';\nimport { mergeCallbacks, useControllableState } from '@fluentui/react-utilities';\n\n/**\n * Create the state required to render EditorInput.\n *\n * The returned state can be modified with hooks such as useEditorInputStyles_unstable,\n * before being passed to renderEditorInput_unstable.\n *\n * @param props - props from this instance of EditorInput\n * @param ref - reference to root HTMLElement of EditorInput\n */\nexport const useEditorInput_unstable = (props: EditorInputProps, ref: React.Ref<HTMLSpanElement>): EditorInputState => {\n const {\n onChange,\n onPaste,\n trimWhiteSpace = false,\n textPlugin = LexicalPlainTextPlugin,\n history = true,\n editorRef: userEditorRef,\n customTheme,\n isSentinelNodeEnabled = true,\n } = props;\n const { root, primary } = getPartitionedNativeProps({\n primarySlotTagName: 'span',\n props,\n excludedPropNames: ['onChange', 'onPaste', 'defaultValue'],\n });\n\n const editorRef = useMergedRefs(React.useRef<LexicalEditor>(null), userEditorRef);\n // The disabled state can also be changed by lexical (e.g. by a custom plugin) so\n // we use `useControllableState` to coordinate\n const [disabled, setDisabled] = useControllableState({\n state: props.disabled,\n initialState: false,\n });\n\n const customNodes = props.customNodes ? [...props.customNodes, SentinelNode] : [SentinelNode];\n\n const spanRef = React.useCallback(\n (span: HTMLSpanElement | null) => {\n // Register the `input` span with lexical\n editorRef.current?.setRootElement(span);\n },\n [editorRef],\n );\n\n // Update lexical when disabled changes\n useIsomorphicLayoutEffect(() => {\n if (editorRef.current) {\n editorRef.current?.setEditable(!disabled);\n }\n }, [disabled]);\n\n useIsomorphicLayoutEffect(() => {\n if (editorRef.current) {\n return mergeRegister(\n editorRef.current.registerEditableListener(isEditable => {\n setDisabled(!isEditable);\n }),\n editorRef.current?.registerRootListener(root => {\n if (!root) {\n return;\n }\n\n // Remove lexical's inline style so we can apply our own\n // Lexical needs the whitespace style to be either `pre` or `pre-wrap` to work correctly\n root.style.whiteSpace = '';\n }),\n );\n }\n }, [editorRef]);\n\n const handleOnChange = React.useCallback(\n (newValue: string) => {\n onChange?.({}, { value: newValue });\n },\n [onChange],\n );\n\n const defaultValueFunction = useDefaultValueFunction(props);\n\n const placeholderValue = slot.optional(props.placeholderValue, { elementType: 'span' });\n const placeholderId = useId('chat-input-placeholder', placeholderValue?.id);\n if (placeholderValue) {\n placeholderValue.id = placeholderId;\n }\n\n return {\n components: {\n root: 'span',\n input: 'span',\n placeholderValue: 'span',\n },\n root: slot.always(props.root, { defaultProps: { ...root }, elementType: 'span' }),\n input: slot.always(props.input, {\n defaultProps: {\n ref: useMergedRefs(ref, spanRef),\n role: 'textbox',\n contentEditable: !disabled,\n 'aria-readonly': disabled ? true : undefined,\n disabled,\n suppressContentEditableWarning: true,\n tabIndex: disabled ? undefined : 0,\n ...primary,\n 'aria-describedby': primary['aria-describedby']\n ? `${primary['aria-describedby']} ${placeholderId}`\n : placeholderId,\n },\n elementType: 'span',\n }),\n placeholderValue,\n lexicalInitialConfig: {\n namespace: 'fai-EditorInput',\n onError: console.error,\n nodes: customNodes,\n editorState: defaultValueFunction,\n theme: customTheme,\n },\n editorRef,\n disabled,\n textPlugin,\n onPaste,\n handleOnChange,\n trimWhiteSpace,\n history,\n isSentinelNodeEnabled,\n };\n};\n\nfunction useDefaultValueFunction(props: EditorInputProps) {\n const { targetDocument } = useFluent();\n const requestAnimationFrame = targetDocument?.defaultView?.requestAnimationFrame;\n\n const [defaultValueFunction] = React.useState(() => {\n const { defaultValue, onDefaultValueSet } = props;\n if (defaultValue === undefined) {\n return undefined;\n }\n\n const insertDefaultValueFunction =\n typeof defaultValue === 'function'\n ? defaultValue\n : () => {\n $insertNodes([$createTextNode(defaultValue)]);\n };\n\n // After the defaultValue function has run, read back the result and give\n // it to the onDefaultValueSet callback.\n const readDefaultValueFunction = onDefaultValueSet\n ? () => {\n const text = $getRoot().getTextContent().replace(SENTINEL_VALUE, '');\n\n // This runs while rendering `LexicalComposer` so delay calling back into the parent\n // until after finished rendering `LexicalComposer`\n requestAnimationFrame?.(() => {\n onDefaultValueSet?.(text);\n });\n }\n : undefined;\n\n return mergeCallbacks(insertDefaultValueFunction, readDefaultValueFunction);\n });\n\n return defaultValueFunction;\n}\n"],"names":["useEditorInput_unstable","props","ref","onChange","onPaste","trimWhiteSpace","textPlugin","LexicalPlainTextPlugin","history","editorRef","userEditorRef","customTheme","isSentinelNodeEnabled","root","primary","getPartitionedNativeProps","primarySlotTagName","excludedPropNames","useMergedRefs","React","useRef","disabled","setDisabled","useControllableState","state","initialState","customNodes","SentinelNode","spanRef","useCallback","span","current","setRootElement","useIsomorphicLayoutEffect","setEditable","mergeRegister","registerEditableListener","isEditable","registerRootListener","style","whiteSpace","handleOnChange","newValue","value","defaultValueFunction","useDefaultValueFunction","placeholderValue","slot","optional","elementType","placeholderId","useId","id","components","input","always","defaultProps","role","contentEditable","undefined","suppressContentEditableWarning","tabIndex","lexicalInitialConfig","namespace","onError","console","error","nodes","editorState","theme","targetDocument","useFluent","requestAnimationFrame","defaultView","useState","defaultValue","onDefaultValueSet","insertDefaultValueFunction","$insertNodes","$createTextNode","readDefaultValueFunction","text","$getRoot","getTextContent","replace","SENTINEL_VALUE","mergeCallbacks"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BA0BaA;;;eAAAA;;;;iEA1BU;iCAQhB;kCAEsC;iCAEC;gCAGO;AAW9C,MAAMA,0BAA0B,CAACC,OAAyBC;IAC/D,MAAM,EACJC,QAAQ,EACRC,OAAO,EACPC,iBAAiB,KAAK,EACtBC,aAAaC,uCAAsB,EACnCC,UAAU,IAAI,EACdC,WAAWC,aAAa,EACxBC,WAAW,EACXC,wBAAwB,IAAI,EAC7B,GAAGX;IACJ,MAAM,EAAEY,IAAI,EAAEC,OAAO,EAAE,GAAGC,IAAAA,0CAAAA,EAA0B;QAClDC,oBAAoB;QACpBf;QACAgB,mBAAmB;YAAC;YAAY;YAAW;SAAe;IAC5D;IAEA,MAAMR,YAAYS,IAAAA,8BAAAA,EAAcC,OAAMC,MAAM,CAAgB,OAAOV;IACnE,iFAAiF;IACjF,8CAA8C;IAC9C,MAAM,CAACW,UAAUC,YAAY,GAAGC,IAAAA,oCAAAA,EAAqB;QACnDC,OAAOvB,MAAMoB,QAA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AAA,IAAAA,KAAAA,IAAAA,CAAAA,8BAAAA,eAAgBG,WAAW,AAAXA,MAAW,QAA3BH,gCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,4BAA6BE,qBAAqB;IAEhF,MAAM,CAAC5B,qBAAqB,GAAGzB,OAAMuD,QAAQ,CAAC;QAC5C,MAAM,EAAEC,YAAY,EAAEC,iBAAiB,EAAE,GAAG3E;QAC5C,IAAI0E,iBAAiBhB,WAAW;YAC9B,OAAOA;QACT;QAEA,MAAMkB,6BACJ,OAAOF,iBAAiB,aACpBA,eACA;YACEG,IAAAA,6BAAAA,EAAa;gBAACC,IAAAA,gCAAAA,EAAgBJ;aAAc;QAC9C;QAEN,yEAAyE;QACzE,wCAAwC;QACxC,MAAMK,2BAA2BJ,oBAC7B;YACE,MAAMK,OAAOC,IAAAA,yBAAAA,IAAWC,cAAc,GAAGC,OAAO,CAACC,gCAAAA,EAAgB;YAEjE,oFAAoF;YACpF,mDAAmD;YACnDb,0BAAAA,QAAAA,0BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,sBAAwB;gBACtBI,sBAAAA,QAAAA,sBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,kBAAoBK;YACtB;QACF,IACAtB;QAEJ,OAAO2B,IAAAA,8BAAAA,EAAeT,4BAA4BG;IACpD;IAEA,OAAOpC;AACT"}
|
|
1
|
+
{"version":3,"sources":["useEditorInput.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getPartitionedNativeProps, slot, useFluent, useId, useMergedRefs } from '@fluentui/react-components';\nimport type { EditorInputProps, EditorInputState } from './EditorInput.types';\nimport { SENTINEL_VALUE } from '@fluentui-copilot/chat-input-plugins';\nimport { $createTextNode, $insertNodes } from '@fluentui-copilot/react-text-editor';\nimport { $getRoot } from '@fluentui-copilot/react-text-editor';\nimport { LexicalPlainTextPlugin } from '@fluentui-copilot/react-text-editor';\nimport { mergeCallbacks } from '@fluentui/react-utilities';\nimport { useLexicalContentEditable } from '../../utilities/useLexicalContentEditable';\n\n/**\n * Create the state required to render EditorInput.\n *\n * The returned state can be modified with hooks such as useEditorInputStyles_unstable,\n * before being passed to renderEditorInput_unstable.\n *\n * @param props - props from this instance of EditorInput\n * @param ref - reference to root HTMLElement of EditorInput\n */\nexport const useEditorInput_unstable = (props: EditorInputProps, ref: React.Ref<HTMLSpanElement>): EditorInputState => {\n const {\n onChange,\n onPaste,\n trimWhiteSpace = false,\n textPlugin = LexicalPlainTextPlugin,\n history = true,\n editorRef,\n isSentinelNodeEnabled = true,\n } = props;\n const { root, primary } = getPartitionedNativeProps({\n primarySlotTagName: 'span',\n props,\n excludedPropNames: ['onChange', 'onPaste', 'defaultValue'],\n });\n\n const handleOnChange = React.useCallback(\n (newValue: string) => {\n onChange?.({}, { value: newValue });\n },\n [onChange],\n );\n\n const { canShowPlaceholder, spanRef, disabled, lexicalEditor, lexicalInitialConfig } = useLexicalContentEditable({\n customNodes: props.customNodes,\n defaultValue: useDefaultValueFunction(props),\n disabled: props.disabled,\n });\n\n const placeholderValue = canShowPlaceholder\n ? slot.optional(props.placeholderValue, { elementType: 'span' })\n : undefined;\n const placeholderId = useId('chat-input-placeholder', placeholderValue?.id);\n if (placeholderValue) {\n placeholderValue.id = placeholderId;\n }\n const describedBy = primary['aria-describedby'] ? `${primary['aria-describedby']} ${placeholderId}` : placeholderId;\n\n return {\n components: {\n root: 'span',\n input: 'span',\n placeholderValue: 'span',\n },\n root: slot.always(props.root, { defaultProps: { ...root }, elementType: 'span' }),\n input: slot.always(props.input, {\n defaultProps: {\n ref: useMergedRefs(ref, spanRef),\n role: 'textbox',\n contentEditable: !disabled,\n 'aria-readonly': disabled ? true : undefined,\n disabled,\n suppressContentEditableWarning: true,\n tabIndex: disabled ? undefined : 0,\n ...primary,\n 'aria-describedby': describedBy,\n },\n elementType: 'span',\n }),\n placeholderValue,\n lexicalInitialConfig,\n editorRef,\n disabled,\n textPlugin,\n onPaste,\n handleOnChange,\n trimWhiteSpace,\n history,\n isSentinelNodeEnabled,\n lexicalEditor,\n };\n};\n\nfunction useDefaultValueFunction(props: EditorInputProps) {\n const { targetDocument } = useFluent();\n const requestAnimationFrame = targetDocument?.defaultView?.requestAnimationFrame;\n\n const [defaultValueFunction] = React.useState(() => {\n const { defaultValue, onDefaultValueSet } = props;\n if (defaultValue === undefined) {\n return undefined;\n }\n\n const insertDefaultValueFunction =\n typeof defaultValue === 'function'\n ? defaultValue\n : () => {\n $insertNodes([$createTextNode(defaultValue)]);\n };\n\n // After the defaultValue function has run, read back the result and give\n // it to the onDefaultValueSet callback.\n const readDefaultValueFunction = onDefaultValueSet\n ? () => {\n const text = $getRoot().getTextContent().replace(SENTINEL_VALUE, '');\n\n // This runs while rendering `LexicalComposer` so delay calling back into the parent\n // until after finished rendering `LexicalComposer`\n requestAnimationFrame?.(() => {\n onDefaultValueSet?.(text);\n });\n }\n : undefined;\n\n return mergeCallbacks(insertDefaultValueFunction, readDefaultValueFunction);\n });\n\n return defaultValueFunction;\n}\n"],"names":["useEditorInput_unstable","props","ref","onChange","onPaste","trimWhiteSpace","textPlugin","LexicalPlainTextPlugin","history","editorRef","isSentinelNodeEnabled","root","primary","getPartitionedNativeProps","primarySlotTagName","excludedPropNames","handleOnChange","React","useCallback","newValue","value","canShowPlaceholder","spanRef","disabled","lexicalEditor","lexicalInitialConfig","useLexicalContentEditable","customNodes","defaultValue","useDefaultValueFunction","placeholderValue","slot","optional","elementType","undefined","placeholderId","useId","id","describedBy","components","input","always","defaultProps","useMergedRefs","role","contentEditable","suppressContentEditableWarning","tabIndex","targetDocument","useFluent","requestAnimationFrame","defaultView","defaultValueFunction","useState","onDefaultValueSet","insertDefaultValueFunction","$insertNodes","$createTextNode","readDefaultValueFunction","text","$getRoot","getTextContent","replace","SENTINEL_VALUE","mergeCallbacks"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AOC,IAAAA,yBAAAA,IAAWC,cAAc,GAAGC,OAAO,CAACC,gCAAAA,EAAgB;YAEjE,oFAAoF;YACpF,mDAAmD;YACnDb,0BAAAA,QAAAA,0BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,sBAAwB;gBACtBI,sBAAAA,QAAAA,sBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,kBAAoBK;YACtB;QACF,IACAzB;QAEJ,OAAO8B,IAAAA,8BAAAA,EAAeT,4BAA4BG;IACpD;IAEA,OAAON;AACT"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "useEditorInputContextValues", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return useEditorInputContextValues;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
|
+
const _reacttexteditor = require("@fluentui-copilot/react-text-editor");
|
|
14
|
+
function useEditorInputContextValues(state) {
|
|
15
|
+
const { lexicalInitialConfig, lexicalEditor } = state;
|
|
16
|
+
const { theme } = lexicalInitialConfig;
|
|
17
|
+
const context = _react.useMemo(()=>[
|
|
18
|
+
lexicalEditor,
|
|
19
|
+
(0, _reacttexteditor.createLexicalComposerContext)(null, theme)
|
|
20
|
+
], [
|
|
21
|
+
lexicalEditor,
|
|
22
|
+
theme
|
|
23
|
+
]);
|
|
24
|
+
return {
|
|
25
|
+
lexicalComposer: context
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useEditorInputContextValues.ts"],"sourcesContent":["import * as React from 'react';\nimport type { LexicalComposerContextWithEditor } from '@fluentui-copilot/react-text-editor';\nimport { createLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\nimport type { EditorInputContextValues, EditorInputState } from './EditorInput.types';\n\nexport function useEditorInputContextValues(state: EditorInputState): EditorInputContextValues {\n const { lexicalInitialConfig, lexicalEditor } = state;\n const { theme } = lexicalInitialConfig;\n\n const context: LexicalComposerContextWithEditor = React.useMemo(\n () => [lexicalEditor, createLexicalComposerContext(null, theme)],\n [lexicalEditor, theme],\n );\n\n return { lexicalComposer: context };\n}\n"],"names":["useEditorInputContextValues","state","lexicalInitialConfig","lexicalEditor","theme","context","React","useMemo","createLexicalComposerContext","lexicalComposer"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAKgBA;;;eAAAA;;;;iEALO;iCAEsB;AAGtC,SAASA,4BAA4BC,KAAuB;IACjE,MAAM,EAAEC,oBAAoB,EAAEC,aAAa,EAAE,GAAGF;IAChD,MAAM,EAAEG,KAAK,EAAE,GAAGF;IAElB,MAAMG,UAA4CC,OAAMC,OAAO,CAC7D,IAAM;YAACJ;YAAeK,IAAAA,6CAAAA,EAA6B,MAAMJ;SAAO,EAChE;QAACD;QAAeC;KAAM;IAGxB,OAAO;QAAEK,iBAAiBJ;IAAQ;AACpC"}
|
|
@@ -85,13 +85,6 @@ const useEditorInputStyles_unstable = (state)=>{
|
|
|
85
85
|
const styles = useStyles();
|
|
86
86
|
state.root.className = (0, _reactcomponents.mergeClasses)(editorInputClassNames.root, rootClassName, state.root.className);
|
|
87
87
|
state.input.className = (0, _reactcomponents.mergeClasses)(editorInputClassNames.input, inputClassName, state.input.className);
|
|
88
|
-
state.lexicalInitialConfig = {
|
|
89
|
-
...state.lexicalInitialConfig,
|
|
90
|
-
theme: {
|
|
91
|
-
...useLexicalStyles(),
|
|
92
|
-
...state.lexicalInitialConfig.theme
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
88
|
if (state.placeholderValue) {
|
|
96
89
|
state.placeholderValue.className = (0, _reactcomponents.mergeClasses)(editorInputClassNames.placeholderValue, placeholderClassName, disabled && styles.placeholderDisabled, state.placeholderValue.className);
|
|
97
90
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useEditorInputStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@fluentui/react-components';\nimport { tokens, typographyStyles } from '@fluentui-copilot/tokens';\nimport type { SlotClassNames } from '@fluentui/react-components';\nimport type { EditorInputSlots, EditorInputState } from './EditorInput.types';\n\nexport const editorInputClassNames: SlotClassNames<EditorInputSlots> = {\n root: 'fai-EditorInput',\n input: 'fai-EditorInput__input',\n placeholderValue: 'fai-EditorInput__placeholderValue',\n};\n\n/**\n * Styles for the root slot\n */\nconst useRootClassName = makeResetStyles({\n display: 'inline-grid',\n whiteSpace: 'pre-wrap',\n});\n\nexport const useLexicalStyles = makeStyles({\n paragraph: {\n margin: 0,\n textAlign: 'start',\n },\n});\n\nexport const usePlaceholderClassName = makeResetStyles({\n zIndex: 0,\n gridArea: '1 / 1 / 1 / 1',\n\n color: tokens.colorNeutralForeground4,\n ...typographyStyles.body1,\n\n '@media (forced-colors: active)': {\n color: 'GrayText',\n },\n});\n\nexport const useInputClassName = makeResetStyles({\n gridArea: '1 / 1 / 1 / 1',\n zIndex: 1,\n width: '100%',\n});\n\nconst useStyles = makeStyles({\n placeholderDisabled: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n});\n/**\n * Apply styling to the EditorInput slots based on the state\n */\nexport const useEditorInputStyles_unstable = (state: EditorInputState): EditorInputState => {\n 'use no memo';\n\n const { disabled } = state;\n const placeholderClassName = usePlaceholderClassName();\n const rootClassName = useRootClassName();\n const inputClassName = useInputClassName();\n const styles = useStyles();\n\n state.root.className = mergeClasses(editorInputClassNames.root, rootClassName, state.root.className);\n\n state.input.className = mergeClasses(editorInputClassNames.input, inputClassName, state.input.className);\n\n
|
|
1
|
+
{"version":3,"sources":["useEditorInputStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@fluentui/react-components';\nimport { tokens, typographyStyles } from '@fluentui-copilot/tokens';\nimport type { SlotClassNames } from '@fluentui/react-components';\nimport type { EditorInputSlots, EditorInputState } from './EditorInput.types';\n\nexport const editorInputClassNames: SlotClassNames<EditorInputSlots> = {\n root: 'fai-EditorInput',\n input: 'fai-EditorInput__input',\n placeholderValue: 'fai-EditorInput__placeholderValue',\n};\n\n/**\n * Styles for the root slot\n */\nconst useRootClassName = makeResetStyles({\n display: 'inline-grid',\n whiteSpace: 'pre-wrap',\n});\n\nexport const useLexicalStyles = makeStyles({\n paragraph: {\n margin: 0,\n textAlign: 'start',\n },\n});\n\nexport const usePlaceholderClassName = makeResetStyles({\n zIndex: 0,\n gridArea: '1 / 1 / 1 / 1',\n\n color: tokens.colorNeutralForeground4,\n ...typographyStyles.body1,\n\n '@media (forced-colors: active)': {\n color: 'GrayText',\n },\n});\n\nexport const useInputClassName = makeResetStyles({\n gridArea: '1 / 1 / 1 / 1',\n zIndex: 1,\n width: '100%',\n});\n\nconst useStyles = makeStyles({\n placeholderDisabled: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n});\n/**\n * Apply styling to the EditorInput slots based on the state\n */\nexport const useEditorInputStyles_unstable = (state: EditorInputState): EditorInputState => {\n 'use no memo';\n\n const { disabled } = state;\n const placeholderClassName = usePlaceholderClassName();\n const rootClassName = useRootClassName();\n const inputClassName = useInputClassName();\n const styles = useStyles();\n\n state.root.className = mergeClasses(editorInputClassNames.root, rootClassName, state.root.className);\n\n state.input.className = mergeClasses(editorInputClassNames.input, inputClassName, state.input.className);\n\n if (state.placeholderValue) {\n state.placeholderValue.className = mergeClasses(\n editorInputClassNames.placeholderValue,\n placeholderClassName,\n disabled && styles.placeholderDisabled,\n state.placeholderValue.className,\n );\n }\n\n return state;\n};\n"],"names":["editorInputClassNames","useEditorInputStyles_unstable","gridArea","whiteSpace","color","root","input","placeholderValue","display","__resetStyles","__styles","paragraph","jrapky","margin","textAlign","B74szlk","fsow6f","s","zIndex","sj55zd","disabled","rootClassName","state","placeholderClassName","useStyles","useRootClassName","useInputClassName","className","mergeClasses","inputClassName","styles","placeholderDisabled"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAKaA,qBAAAA;eAAAA;;IA+CNC,6BAAMA;eAANA;;IAbLC,iBAAU;eAAVA;;IAvBAC,gBAAY;eAAZA;;IAkBEC,uBAAO;eAAPA;;;iCAlC8C;AAK3C,MAAMJ,wBAA0D;UACrEK;WACAC;sBACAC;AACF;AAEA;;CAEC,SAECC,mBAASC,IAAAA,8BAAA,EAAA,YAAA,MAAA;IAAA;CAAA;AACTN,MAAAA,mBAAYO,IAAAA,yBAAA,EAAA;IACdC,WAAA;QAEAC,QAAO;QACLD,QAAAA;gBACEE;iBACAC;QACFC,SAAA;QACCC,QAAA;IAEH;;OAEEd;QAAAA;YAAAA;YAAU;gBAEVE,GAAAA,CAAAA;;SACA;QAAA;KAAyB;;MAGvBA,0BAAOK,IAAAA,8BAAA,EAAA,WAAA,MAAA;OACT;QAAA;KAAA;IACFQ,GAAG;QAAA;KAAA;AAEH;AACEf,MAAAA,oBAAUO,IAAAA,8BAAA,EAAA,YAAA,MAAA;IAAA;CAAA;MACVS,YAAQR,IAAAA,yBAAA,EAAA;yBACD;QACNS,QAAA;IAEH;;;;KAEgD;;AAMhD,MAAOlB,gCAAMA,CAAAA;;UAIX,EACAmB,QAAMC,KACNC;UACAC,uBAAeC;UAEfF,gBAAoBG;UAEpBH,iBAAqBI;UAEjBJ,SAAMf;UACRe,IAAAA,CAAAA,SAAMf,GAAAA,IAAAA,6BAAiBoB,EAAAA,sBACrB3B,IAAAA,EAAAA,eAAsBO,MAAAA,IAAAA,CAAAA,SACtBgB;UAIJjB,KAAA,CAAAqB,SAAA,GAAAC,IAAAA,6BAAA,EAAA5B,sBAAAM,KAAA,EAAAuB,gBAAAP,MAAAhB,KAAA,CAAAqB,SAAA;QAEAL,MAAOA,gBAAAA,EAAAA;QACPA,MAAAf,gBAAA,CAAAoB,SAAA,GAAAC,IAAAA,6BAAA,EAAA5B,sBAAAO,gBAAA,EAAAgB,sBAAAH,YAAAU,OAAAC,mBAAA,EAAAT,MAAAf,gBAAA,CAAAoB,SAAA"}
|
|
@@ -72,13 +72,6 @@ const useEditorInputStyles_unstable = (state)=>{
|
|
|
72
72
|
const styles = useStyles();
|
|
73
73
|
state.root.className = (0, _reactcomponents.mergeClasses)(editorInputClassNames.root, rootClassName, state.root.className);
|
|
74
74
|
state.input.className = (0, _reactcomponents.mergeClasses)(editorInputClassNames.input, inputClassName, state.input.className);
|
|
75
|
-
state.lexicalInitialConfig = {
|
|
76
|
-
...state.lexicalInitialConfig,
|
|
77
|
-
theme: {
|
|
78
|
-
...useLexicalStyles(),
|
|
79
|
-
...state.lexicalInitialConfig.theme
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
75
|
if (state.placeholderValue) {
|
|
83
76
|
state.placeholderValue.className = (0, _reactcomponents.mergeClasses)(editorInputClassNames.placeholderValue, placeholderClassName, disabled && styles.placeholderDisabled, state.placeholderValue.className);
|
|
84
77
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useEditorInputStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@fluentui/react-components';\nimport { tokens, typographyStyles } from '@fluentui-copilot/tokens';\nimport type { SlotClassNames } from '@fluentui/react-components';\nimport type { EditorInputSlots, EditorInputState } from './EditorInput.types';\n\nexport const editorInputClassNames: SlotClassNames<EditorInputSlots> = {\n root: 'fai-EditorInput',\n input: 'fai-EditorInput__input',\n placeholderValue: 'fai-EditorInput__placeholderValue',\n};\n\n/**\n * Styles for the root slot\n */\nconst useRootClassName = makeResetStyles({\n display: 'inline-grid',\n whiteSpace: 'pre-wrap',\n});\n\nexport const useLexicalStyles = makeStyles({\n paragraph: {\n margin: 0,\n textAlign: 'start',\n },\n});\n\nexport const usePlaceholderClassName = makeResetStyles({\n zIndex: 0,\n gridArea: '1 / 1 / 1 / 1',\n\n color: tokens.colorNeutralForeground4,\n ...typographyStyles.body1,\n\n '@media (forced-colors: active)': {\n color: 'GrayText',\n },\n});\n\nexport const useInputClassName = makeResetStyles({\n gridArea: '1 / 1 / 1 / 1',\n zIndex: 1,\n width: '100%',\n});\n\nconst useStyles = makeStyles({\n placeholderDisabled: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n});\n/**\n * Apply styling to the EditorInput slots based on the state\n */\nexport const useEditorInputStyles_unstable = (state: EditorInputState): EditorInputState => {\n 'use no memo';\n\n const { disabled } = state;\n const placeholderClassName = usePlaceholderClassName();\n const rootClassName = useRootClassName();\n const inputClassName = useInputClassName();\n const styles = useStyles();\n\n state.root.className = mergeClasses(editorInputClassNames.root, rootClassName, state.root.className);\n\n state.input.className = mergeClasses(editorInputClassNames.input, inputClassName, state.input.className);\n\n
|
|
1
|
+
{"version":3,"sources":["useEditorInputStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@fluentui/react-components';\nimport { tokens, typographyStyles } from '@fluentui-copilot/tokens';\nimport type { SlotClassNames } from '@fluentui/react-components';\nimport type { EditorInputSlots, EditorInputState } from './EditorInput.types';\n\nexport const editorInputClassNames: SlotClassNames<EditorInputSlots> = {\n root: 'fai-EditorInput',\n input: 'fai-EditorInput__input',\n placeholderValue: 'fai-EditorInput__placeholderValue',\n};\n\n/**\n * Styles for the root slot\n */\nconst useRootClassName = makeResetStyles({\n display: 'inline-grid',\n whiteSpace: 'pre-wrap',\n});\n\nexport const useLexicalStyles = makeStyles({\n paragraph: {\n margin: 0,\n textAlign: 'start',\n },\n});\n\nexport const usePlaceholderClassName = makeResetStyles({\n zIndex: 0,\n gridArea: '1 / 1 / 1 / 1',\n\n color: tokens.colorNeutralForeground4,\n ...typographyStyles.body1,\n\n '@media (forced-colors: active)': {\n color: 'GrayText',\n },\n});\n\nexport const useInputClassName = makeResetStyles({\n gridArea: '1 / 1 / 1 / 1',\n zIndex: 1,\n width: '100%',\n});\n\nconst useStyles = makeStyles({\n placeholderDisabled: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n});\n/**\n * Apply styling to the EditorInput slots based on the state\n */\nexport const useEditorInputStyles_unstable = (state: EditorInputState): EditorInputState => {\n 'use no memo';\n\n const { disabled } = state;\n const placeholderClassName = usePlaceholderClassName();\n const rootClassName = useRootClassName();\n const inputClassName = useInputClassName();\n const styles = useStyles();\n\n state.root.className = mergeClasses(editorInputClassNames.root, rootClassName, state.root.className);\n\n state.input.className = mergeClasses(editorInputClassNames.input, inputClassName, state.input.className);\n\n if (state.placeholderValue) {\n state.placeholderValue.className = mergeClasses(\n editorInputClassNames.placeholderValue,\n placeholderClassName,\n disabled && styles.placeholderDisabled,\n state.placeholderValue.className,\n );\n }\n\n return state;\n};\n"],"names":["editorInputClassNames","useEditorInputStyles_unstable","useInputClassName","useLexicalStyles","usePlaceholderClassName","root","input","placeholderValue","useRootClassName","makeResetStyles","display","whiteSpace","makeStyles","paragraph","margin","textAlign","zIndex","gridArea","color","tokens","colorNeutralForeground4","typographyStyles","body1","width","useStyles","placeholderDisabled","colorNeutralForegroundDisabled","state","disabled","placeholderClassName","rootClassName","inputClassName","styles","className","mergeClasses"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAKaA,qBAAAA;eAAAA;;IA+CAC,6BAAAA;eAAAA;;IAdAC,iBAAAA;eAAAA;;IAnBAC,gBAAAA;eAAAA;;IAOAC,uBAAAA;eAAAA;;;iCA1B6C;wBACjB;AAIlC,MAAMJ,wBAA0D;IACrEK,MAAM;IACNC,OAAO;IACPC,kBAAkB;AACpB;AAEA;;CAEC,GACD,MAAMC,mBAAmBC,IAAAA,gCAAAA,EAAgB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