@fluentui-copilot/react-editor-input 0.4.7 → 0.4.9-hotfix.1

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.
Files changed (28) hide show
  1. package/CHANGELOG.json +53 -0
  2. package/CHANGELOG.md +28 -1
  3. package/dist/index.d.ts +5 -0
  4. package/lib/EditorInput.js +0 -1
  5. package/lib/components/EditorInput/EditorInput.js +4 -5
  6. package/lib/components/EditorInput/EditorInput.types.js +1 -2
  7. package/lib/components/EditorInput/EditorInput.types.js.map +1 -1
  8. package/lib/components/EditorInput/index.js +0 -1
  9. package/lib/components/EditorInput/renderEditorInput.js +30 -25
  10. package/lib/components/EditorInput/useEditorInput.js +139 -115
  11. package/lib/components/EditorInput/useEditorInput.js.map +1 -1
  12. package/lib/components/EditorInput/useEditorInputStyles.styles.raw.js +61 -0
  13. package/lib/components/EditorInput/useEditorInputStyles.styles.raw.js.map +1 -0
  14. package/lib/index.js +0 -1
  15. package/lib-commonjs/EditorInput.js +0 -1
  16. package/lib-commonjs/components/EditorInput/EditorInput.js +1 -1
  17. package/lib-commonjs/components/EditorInput/EditorInput.js.map +1 -1
  18. package/lib-commonjs/components/EditorInput/EditorInput.types.js +0 -1
  19. package/lib-commonjs/components/EditorInput/EditorInput.types.js.map +1 -1
  20. package/lib-commonjs/components/EditorInput/index.js +0 -1
  21. package/lib-commonjs/components/EditorInput/renderEditorInput.js +1 -1
  22. package/lib-commonjs/components/EditorInput/renderEditorInput.js.map +1 -1
  23. package/lib-commonjs/components/EditorInput/useEditorInput.js +33 -10
  24. package/lib-commonjs/components/EditorInput/useEditorInput.js.map +1 -1
  25. package/lib-commonjs/components/EditorInput/useEditorInputStyles.styles.raw.js +86 -0
  26. package/lib-commonjs/components/EditorInput/useEditorInputStyles.styles.raw.js.map +1 -0
  27. package/lib-commonjs/index.js +0 -1
  28. package/package.json +9 -13
package/CHANGELOG.json CHANGED
@@ -1,6 +1,59 @@
1
1
  {
2
2
  "name": "@fluentui-copilot/react-editor-input",
3
3
  "entries": [
4
+ {
5
+ "date": "Wed, 06 Aug 2025 16:01:29 GMT",
6
+ "tag": "@fluentui-copilot/react-editor-input_v0.4.9-hotfix.1",
7
+ "version": "0.4.9-hotfix.1",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "hochelmartin@gmail.com",
12
+ "package": "@fluentui-copilot/react-editor-input",
13
+ "commit": "cb43a5bd5258c678c965fddff7e7d5a95f9d0396",
14
+ "comment": "release: prepare hotfix 0.25.3-hotfix.1"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Wed, 30 Apr 2025 01:47:48 GMT",
21
+ "tag": "@fluentui-copilot/react-editor-input_v0.4.9",
22
+ "version": "0.4.9",
23
+ "comments": {
24
+ "none": [
25
+ {
26
+ "author": "tristan.watanabe@gmail.com",
27
+ "package": "@fluentui-copilot/react-editor-input",
28
+ "commit": "1391e0a7243d050db30fcc27547fd3e91df0162c",
29
+ "comment": "chore: update tsconfig to remove allowSyntheticDefaultImports to enforce named imports."
30
+ }
31
+ ],
32
+ "patch": [
33
+ {
34
+ "author": "owcampbe@microsoft.com",
35
+ "package": "@fluentui-copilot/react-editor-input",
36
+ "commit": "5a9efb11481fbe2c9bd25c8825ec4a9b991050ab",
37
+ "comment": "chore: Bump @fluentui/react-components to 9.58.3."
38
+ }
39
+ ]
40
+ }
41
+ },
42
+ {
43
+ "date": "Sat, 19 Apr 2025 00:05:39 GMT",
44
+ "tag": "@fluentui-copilot/react-editor-input_v0.4.8",
45
+ "version": "0.4.8",
46
+ "comments": {
47
+ "patch": [
48
+ {
49
+ "author": "owcampbe@microsoft.com",
50
+ "package": "@fluentui-copilot/react-editor-input",
51
+ "commit": "154067a90ddf5cc157f7cc361b98e44420315c57",
52
+ "comment": "feat: Allow setting defaultValue without calling onChange."
53
+ }
54
+ ]
55
+ }
56
+ },
4
57
  {
5
58
  "date": "Thu, 20 Mar 2025 17:00:42 GMT",
6
59
  "tag": "@fluentui-copilot/react-editor-input_v0.4.4",
package/CHANGELOG.md CHANGED
@@ -1,9 +1,36 @@
1
1
  # Change Log - @fluentui-copilot/react-editor-input
2
2
 
3
- This log was last generated on Thu, 20 Mar 2025 17:00:42 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 06 Aug 2025 16:01:29 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [0.4.9-hotfix.1](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-editor-input_v0.4.9-hotfix.1)
8
+
9
+ Wed, 06 Aug 2025 16:01:29 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-editor-input_v0.4.9..@fluentui-copilot/react-editor-input_v0.4.9-hotfix.1)
11
+
12
+ ### Changes
13
+
14
+ - release: prepare hotfix 0.25.3-hotfix.1 ([PR #3280](https://github.com/microsoft/fluentai/pull/3280) by hochelmartin@gmail.com)
15
+
16
+ ## [0.4.9](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-editor-input_v0.4.9)
17
+
18
+ Wed, 30 Apr 2025 01:47:48 GMT
19
+ [Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-editor-input_v0.4.8..@fluentui-copilot/react-editor-input_v0.4.9)
20
+
21
+ ### Patches
22
+
23
+ - chore: Bump @fluentui/react-components to 9.58.3. ([PR #2963](https://github.com/microsoft/fluentai/pull/2963) by owcampbe@microsoft.com)
24
+
25
+ ## [0.4.8](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-editor-input_v0.4.8)
26
+
27
+ Sat, 19 Apr 2025 00:05:39 GMT
28
+ [Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-editor-input_v0.4.4..@fluentui-copilot/react-editor-input_v0.4.8)
29
+
30
+ ### Patches
31
+
32
+ - feat: Allow setting defaultValue without calling onChange. ([PR #2899](https://github.com/microsoft/fluentai/pull/2899) by owcampbe@microsoft.com)
33
+
7
34
  ## [0.4.4](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-editor-input_v0.4.4)
8
35
 
9
36
  Thu, 20 Mar 2025 17:00:42 GMT
package/dist/index.d.ts CHANGED
@@ -63,6 +63,11 @@ export declare type EditorInputProps = Omit<ComponentProps<Partial<EditorInputSl
63
63
  * @default true
64
64
  */
65
65
  isSentinelNodeEnabled?: boolean;
66
+ /**
67
+ * By default when the `defaultValue` is inserted into the editor, `onChange` is triggered.
68
+ * When this prop is true, if `defaultValue` is a string, `onChange` will not be triggered with its value.
69
+ */
70
+ preventDefaultValueOnChange?: boolean;
66
71
  };
67
72
 
68
73
  export declare type EditorInputSlots = {
@@ -1,2 +1 @@
1
1
  export { EditorInput, editorInputClassNames, renderEditorInput_unstable, useEditorInputStyles_unstable, useEditorInput_unstable, useInputClassName, useLexicalStyles, usePlaceholderClassName } from './components/EditorInput/index';
2
- //# sourceMappingURL=EditorInput.js.map
@@ -3,10 +3,9 @@ import { useEditorInput_unstable } from './useEditorInput';
3
3
  import { renderEditorInput_unstable } from './renderEditorInput';
4
4
  import { useEditorInputStyles_unstable } from './useEditorInputStyles.styles';
5
5
  // EditorInput component - TODO: add more docs
6
- export const EditorInput = /*#__PURE__*/React.forwardRef((props, ref) => {
7
- const state = useEditorInput_unstable(props, ref);
8
- useEditorInputStyles_unstable(state);
9
- return renderEditorInput_unstable(state);
6
+ export const EditorInput = /*#__PURE__*/ React.forwardRef((props, ref)=>{
7
+ const state = useEditorInput_unstable(props, ref);
8
+ useEditorInputStyles_unstable(state);
9
+ return renderEditorInput_unstable(state);
10
10
  });
11
11
  EditorInput.displayName = 'EditorInput';
12
- //# sourceMappingURL=EditorInput.js.map
@@ -1,4 +1,3 @@
1
1
  /**
2
2
  * Data passed to the `onChange` callback when the chat input's value changes.
3
- */export {};
4
- //# sourceMappingURL=EditorInput.types.js.map
3
+ */ export { };
@@ -1 +1 @@
1
- {"version":3,"sources":["EditorInput.types.ts"],"sourcesContent":["import type { InitialConfigType, LexicalEditor, LexicalPlainTextPlugin } 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 * 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>;\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<\n Pick<\n EditorInputProps,\n 'disabled' | 'textPlugin' | 'history' | 'trimWhiteSpace' | 'editorRef' | 'isSentinelNodeEnabled'\n >\n > &\n Partial<Pick<EditorInputProps, 'onPaste'>> & {\n lexicalInitialConfig: InitialConfigType;\n defaultValue?: string;\n handleOnChange: (value: string) => void;\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"],"names":[],"rangeMappings":";;","mappings":"AAmFA;;CAEC,GACD,WAEE"}
1
+ {"version":3,"sources":["EditorInput.types.ts"],"sourcesContent":["import type { InitialConfigType, LexicalEditor, LexicalPlainTextPlugin } 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 * 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>;\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 * By default when the `defaultValue` is inserted into the editor, `onChange` is triggered.\n * When this prop is true, if `defaultValue` is a string, `onChange` will not be triggered with its value.\n */\n preventDefaultValueOnChange?: boolean;\n};\n\n/**\n * State used in rendering EditorInput\n */\nexport type EditorInputState = ComponentState<EditorInputSlots> &\n Required<\n Pick<\n EditorInputProps,\n 'disabled' | 'textPlugin' | 'history' | 'trimWhiteSpace' | 'editorRef' | 'isSentinelNodeEnabled'\n >\n > &\n Partial<Pick<EditorInputProps, 'onPaste'>> & {\n lexicalInitialConfig: InitialConfigType;\n defaultValue?: string;\n handleOnChange: (value: string) => void;\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"],"names":[],"rangeMappings":";;","mappings":"AAwFA;;CAEC,GACD,WAEE"}
@@ -2,4 +2,3 @@ export { EditorInput } from './EditorInput';
2
2
  export { renderEditorInput_unstable } from './renderEditorInput';
3
3
  export { useEditorInput_unstable } from './useEditorInput';
4
4
  export { editorInputClassNames, useEditorInputStyles_unstable, useInputClassName, useLexicalStyles, usePlaceholderClassName } from './useEditorInputStyles.styles';
5
- //# sourceMappingURL=index.js.map
@@ -1,31 +1,36 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@fluentui/react-jsx-runtime/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@fluentui/react-jsx-runtime/jsx-runtime";
2
2
  import { assertSlots } from '@fluentui/react-components';
3
3
  import { LexicalComposer, LexicalErrorBoundary, LexicalEditorRefPlugin, LexicalHistoryPlugin } from '@fluentui-copilot/react-text-editor';
4
4
  import { BasicFunctionalityPlugin } from '@fluentui-copilot/react-chat-input-plugins';
5
5
  /**
6
6
  * Render the final JSX of EditorInput
7
- */
8
- export const renderEditorInput_unstable = state => {
9
- assertSlots(state);
10
- return /*#__PURE__*/_jsx(state.root, {
11
- children: /*#__PURE__*/_jsxs(LexicalComposer, {
12
- initialConfig: state.lexicalInitialConfig,
13
- children: [/*#__PURE__*/_jsx(state.textPlugin, {
14
- contentEditable: /*#__PURE__*/_jsx(state.input, {}),
15
- ErrorBoundary: LexicalErrorBoundary,
16
- placeholder: state.placeholderValue ? /*#__PURE__*/_jsx(state.placeholderValue, {}) : null
17
- }), /*#__PURE__*/_jsxs(_Fragment, {
18
- children: [/*#__PURE__*/_jsx(BasicFunctionalityPlugin, {
19
- onContentChange: state.handleOnChange,
20
- onPaste: state.onPaste,
21
- trimWhitespace: state.trimWhiteSpace,
22
- defaultValue: state.defaultValue,
23
- isSentinelNodeEnabled: state.isSentinelNodeEnabled
24
- }), state.history && /*#__PURE__*/_jsx(LexicalHistoryPlugin, {})]
25
- }), /*#__PURE__*/_jsx(LexicalEditorRefPlugin, {
26
- editorRef: state.editorRef
27
- })]
28
- })
29
- });
7
+ */ export const renderEditorInput_unstable = (state)=>{
8
+ assertSlots(state);
9
+ return /*#__PURE__*/ _jsx(state.root, {
10
+ children: /*#__PURE__*/ _jsxs(LexicalComposer, {
11
+ initialConfig: state.lexicalInitialConfig,
12
+ children: [
13
+ /*#__PURE__*/ _jsx(state.textPlugin, {
14
+ contentEditable: /*#__PURE__*/ _jsx(state.input, {}),
15
+ ErrorBoundary: LexicalErrorBoundary,
16
+ placeholder: state.placeholderValue ? /*#__PURE__*/ _jsx(state.placeholderValue, {}) : null
17
+ }),
18
+ /*#__PURE__*/ _jsxs(_Fragment, {
19
+ children: [
20
+ /*#__PURE__*/ _jsx(BasicFunctionalityPlugin, {
21
+ onContentChange: state.handleOnChange,
22
+ onPaste: state.onPaste,
23
+ trimWhitespace: state.trimWhiteSpace,
24
+ defaultValue: state.defaultValue,
25
+ isSentinelNodeEnabled: state.isSentinelNodeEnabled
26
+ }),
27
+ state.history && /*#__PURE__*/ _jsx(LexicalHistoryPlugin, {})
28
+ ]
29
+ }),
30
+ /*#__PURE__*/ _jsx(LexicalEditorRefPlugin, {
31
+ editorRef: state.editorRef
32
+ })
33
+ ]
34
+ })
35
+ });
30
36
  };
31
- //# sourceMappingURL=renderEditorInput.js.map
@@ -3,6 +3,9 @@ import { getPartitionedNativeProps, slot, useId, useIsomorphicLayoutEffect, useM
3
3
  import { SentinelNode } from '@fluentui-copilot/chat-input-plugins';
4
4
  import { LexicalPlainTextPlugin, mergeRegister } from '@fluentui-copilot/react-text-editor';
5
5
  import { useControllableState } from '@fluentui/react-utilities';
6
+ export const createInitialEditorState = (defaultValue)=>{
7
+ return `{"root":{"type":"root","children":[{"children":[{"text":${JSON.stringify(defaultValue)},"type":"text"}],"type":"paragraph"}]}}`;
8
+ };
6
9
  /**
7
10
  * Create the state required to render EditorInput.
8
11
  *
@@ -11,123 +14,144 @@ import { useControllableState } from '@fluentui/react-utilities';
11
14
  *
12
15
  * @param props - props from this instance of EditorInput
13
16
  * @param ref - reference to root HTMLElement of EditorInput
14
- */
15
- export const useEditorInput_unstable = (props, ref) => {
16
- const {
17
- onChange,
18
- onPaste,
19
- trimWhiteSpace = false,
20
- textPlugin = LexicalPlainTextPlugin,
21
- history = true,
22
- editorRef: userEditorRef,
23
- customTheme,
24
- isSentinelNodeEnabled = true
25
- } = props;
26
- const {
27
- root,
28
- primary
29
- } = getPartitionedNativeProps({
30
- primarySlotTagName: 'span',
31
- props,
32
- excludedPropNames: ['onChange', 'onPaste', 'defaultValue']
33
- });
34
- const editorRef = useMergedRefs(React.useRef(null), userEditorRef);
35
- // The disabled state can also be changed by lexical (e.g. by a custom plugin) so
36
- // we use `useControllableState` to coordinate
37
- const [disabled, setDisabled] = useControllableState({
38
- state: props.disabled,
39
- initialState: false
40
- });
41
- const customNodes = props.customNodes ? [...props.customNodes, SentinelNode] : [SentinelNode];
42
- const spanRef = React.useCallback(span => {
43
- var
44
- // Register the `input` span with lexical
45
- _editorRef_current;
46
- (_editorRef_current = editorRef.current) === null || _editorRef_current === void 0 ? void 0 : _editorRef_current.setRootElement(span);
47
- }, [editorRef]);
48
- // Update lexical when disabled changes
49
- useIsomorphicLayoutEffect(() => {
50
- if (editorRef.current) {
51
- var _editorRef_current;
52
- (_editorRef_current = editorRef.current) === null || _editorRef_current === void 0 ? void 0 : _editorRef_current.setEditable(!disabled);
53
- }
54
- }, [disabled]);
55
- useIsomorphicLayoutEffect(() => {
56
- if (editorRef.current) {
57
- var _editorRef_current;
58
- return mergeRegister(editorRef.current.registerEditableListener(isEditable => {
59
- setDisabled(!isEditable);
60
- }), (_editorRef_current = editorRef.current) === null || _editorRef_current === void 0 ? void 0 : _editorRef_current.registerRootListener(root => {
61
- if (!root) {
62
- return;
17
+ */ export const useEditorInput_unstable = (props, ref)=>{
18
+ const { onChange, onPaste, trimWhiteSpace = false, textPlugin = LexicalPlainTextPlugin, history = true, editorRef: userEditorRef, customTheme, isSentinelNodeEnabled = true, preventDefaultValueOnChange = false } = props;
19
+ const { root, primary } = getPartitionedNativeProps({
20
+ primarySlotTagName: 'span',
21
+ props,
22
+ excludedPropNames: [
23
+ 'onChange',
24
+ 'onPaste',
25
+ 'defaultValue'
26
+ ]
27
+ });
28
+ const editorRef = 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] = useControllableState({
32
+ state: props.disabled,
33
+ initialState: false
34
+ });
35
+ const customNodes = props.customNodes ? [
36
+ ...props.customNodes,
37
+ SentinelNode
38
+ ] : [
39
+ SentinelNode
40
+ ];
41
+ const spanRef = React.useCallback((span)=>{
42
+ var // Register the `input` span with lexical
43
+ _editorRef_current;
44
+ (_editorRef_current = editorRef.current) === null || _editorRef_current === void 0 ? void 0 : _editorRef_current.setRootElement(span);
45
+ }, [
46
+ editorRef
47
+ ]);
48
+ // Update lexical when disabled changes
49
+ useIsomorphicLayoutEffect(()=>{
50
+ if (editorRef.current) {
51
+ var _editorRef_current;
52
+ (_editorRef_current = editorRef.current) === null || _editorRef_current === void 0 ? void 0 : _editorRef_current.setEditable(!disabled);
63
53
  }
64
- // Remove lexical's inline style so we can apply our own
65
- // Lexical needs the whitespace style to be either `pre` or `pre-wrap` to work correctly
66
- root.style.whiteSpace = '';
67
- }));
68
- }
69
- }, [editorRef]);
70
- const handleOnChange = React.useCallback(newValue => {
71
- onChange === null || onChange === void 0 ? void 0 : onChange({}, {
72
- value: newValue
54
+ }, [
55
+ disabled
56
+ ]);
57
+ useIsomorphicLayoutEffect(()=>{
58
+ if (editorRef.current) {
59
+ var _editorRef_current;
60
+ return mergeRegister(editorRef.current.registerEditableListener((isEditable)=>{
61
+ setDisabled(!isEditable);
62
+ }), (_editorRef_current = editorRef.current) === null || _editorRef_current === void 0 ? void 0 : _editorRef_current.registerRootListener((root)=>{
63
+ if (!root) {
64
+ return;
65
+ }
66
+ // Remove lexical's inline style so we can apply our own
67
+ // Lexical needs the whitespace style to be either `pre` or `pre-wrap` to work correctly
68
+ root.style.whiteSpace = '';
69
+ }));
70
+ }
71
+ }, [
72
+ editorRef
73
+ ]);
74
+ const handleOnChange = React.useCallback((newValue)=>{
75
+ onChange === null || onChange === void 0 ? void 0 : onChange({}, {
76
+ value: newValue
77
+ });
78
+ }, [
79
+ onChange
80
+ ]);
81
+ const [defaultString, lexicalEditorStateDefaultValue] = React.useMemo(()=>{
82
+ if (typeof props.defaultValue === 'function') {
83
+ return [
84
+ undefined,
85
+ props.defaultValue
86
+ ];
87
+ }
88
+ if (preventDefaultValueOnChange && props.defaultValue !== undefined) {
89
+ // Any method of providing a default value to lexical which inserts it after initialization
90
+ // will trigger a text content change.
91
+ // Providing a default value as a stringified editorState will prevent calling onChange
92
+ const editorState = createInitialEditorState(props.defaultValue);
93
+ return [
94
+ undefined,
95
+ editorState
96
+ ];
97
+ }
98
+ return [
99
+ props.defaultValue,
100
+ undefined
101
+ ];
102
+ }, [
103
+ preventDefaultValueOnChange,
104
+ props.defaultValue
105
+ ]);
106
+ const placeholderValue = slot.optional(props.placeholderValue, {
107
+ elementType: 'span'
73
108
  });
74
- }, [onChange]);
75
- const [defaultString, defaultValueFunction] = (() => {
76
- if (typeof props.defaultValue === 'function') {
77
- return [undefined, props.defaultValue];
109
+ const placeholderId = useId('chat-input-placeholder', placeholderValue === null || placeholderValue === void 0 ? void 0 : placeholderValue.id);
110
+ if (placeholderValue) {
111
+ placeholderValue.id = placeholderId;
78
112
  }
79
- return [props.defaultValue, undefined];
80
- })();
81
- const placeholderValue = slot.optional(props.placeholderValue, {
82
- elementType: 'span'
83
- });
84
- const placeholderId = useId('chat-input-placeholder', placeholderValue === null || placeholderValue === void 0 ? void 0 : placeholderValue.id);
85
- if (placeholderValue) {
86
- placeholderValue.id = placeholderId;
87
- }
88
- return {
89
- components: {
90
- root: 'span',
91
- input: 'span',
92
- placeholderValue: 'span'
93
- },
94
- root: slot.always(props.root, {
95
- defaultProps: {
96
- ...root
97
- },
98
- elementType: 'span'
99
- }),
100
- input: slot.always(props.input, {
101
- defaultProps: {
102
- ref: useMergedRefs(ref, spanRef),
103
- role: 'textbox',
104
- contentEditable: !disabled,
105
- 'aria-readonly': disabled ? true : undefined,
113
+ return {
114
+ components: {
115
+ root: 'span',
116
+ input: 'span',
117
+ placeholderValue: 'span'
118
+ },
119
+ root: slot.always(props.root, {
120
+ defaultProps: {
121
+ ...root
122
+ },
123
+ elementType: 'span'
124
+ }),
125
+ input: slot.always(props.input, {
126
+ defaultProps: {
127
+ ref: useMergedRefs(ref, spanRef),
128
+ role: 'textbox',
129
+ contentEditable: !disabled,
130
+ 'aria-readonly': disabled ? true : undefined,
131
+ disabled,
132
+ suppressContentEditableWarning: true,
133
+ tabIndex: disabled ? undefined : 0,
134
+ ...primary,
135
+ 'aria-describedby': primary['aria-describedby'] ? `${primary['aria-describedby']} ${placeholderId}` : placeholderId
136
+ },
137
+ elementType: 'span'
138
+ }),
139
+ placeholderValue,
140
+ lexicalInitialConfig: {
141
+ namespace: 'fai-EditorInput',
142
+ onError: console.error,
143
+ nodes: customNodes,
144
+ editorState: lexicalEditorStateDefaultValue,
145
+ theme: customTheme
146
+ },
147
+ editorRef,
106
148
  disabled,
107
- suppressContentEditableWarning: true,
108
- tabIndex: disabled ? undefined : 0,
109
- ...primary,
110
- 'aria-describedby': primary['aria-describedby'] ? `${primary['aria-describedby']} ${placeholderId}` : placeholderId
111
- },
112
- elementType: 'span'
113
- }),
114
- placeholderValue,
115
- lexicalInitialConfig: {
116
- namespace: 'fai-EditorInput',
117
- onError: console.error,
118
- nodes: customNodes,
119
- editorState: defaultValueFunction,
120
- theme: customTheme
121
- },
122
- editorRef,
123
- disabled,
124
- textPlugin,
125
- onPaste,
126
- handleOnChange,
127
- defaultValue: defaultString,
128
- trimWhiteSpace,
129
- history,
130
- isSentinelNodeEnabled
131
- };
149
+ textPlugin,
150
+ onPaste,
151
+ handleOnChange,
152
+ defaultValue: defaultString,
153
+ trimWhiteSpace,
154
+ history,
155
+ isSentinelNodeEnabled
156
+ };
132
157
  };
133
- //# sourceMappingURL=useEditorInput.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["useEditorInput.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n getPartitionedNativeProps,\n slot,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n} from '@fluentui/react-components';\nimport type { EditorInputProps, EditorInputState } from './EditorInput.types';\nimport { SentinelNode } from '@fluentui-copilot/chat-input-plugins';\nimport type { LexicalEditor } from '@fluentui-copilot/react-text-editor';\nimport { LexicalPlainTextPlugin, mergeRegister } from '@fluentui-copilot/react-text-editor';\nimport { 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 => {\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 [defaultString, defaultValueFunction] = (() => {\n if (typeof props.defaultValue === 'function') {\n return [undefined, props.defaultValue];\n }\n return [props.defaultValue, undefined];\n })();\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 defaultValue: defaultString,\n trimWhiteSpace,\n history,\n isSentinelNodeEnabled,\n };\n};\n"],"names":["React","getPartitionedNativeProps","slot","useId","useIsomorphicLayoutEffect","useMergedRefs","SentinelNode","LexicalPlainTextPlugin","mergeRegister","useControllableState","useEditorInput_unstable","props","ref","onChange","onPaste","trimWhiteSpace","textPlugin","history","editorRef","userEditorRef","customTheme","isSentinelNodeEnabled","root","primary","primarySlotTagName","excludedPropNames","useRef","disabled","setDisabled","state","initialState","customNodes","spanRef","useCallback","span","current","setRootElement","setEditable","registerEditableListener","isEditable","registerRootListener","style","whiteSpace","handleOnChange","newValue","value","defaultString","defaultValueFunction","defaultValue","undefined","placeholderValue","optional","elementType","placeholderId","id","components","input","always","defaultProps","role","contentEditable","suppressContentEditableWarning","tabIndex","lexicalInitialConfig","namespace","onError","console","error","nodes","editorState","theme"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAKuD,MAAM,CAAC9C,MAAM6C,KAAK,EAAE;YAC9BE,cAAc;gBACZ9C,KAAKP,cAAcO,KAAKoB;gBACxB2B,MAAM;gBACNC,iBAAiB,CAACjC;gBAClB,iBAAiBA,WAAW,OAAOsB;gBACnCtB;gBACAkC,gCAAgC;gBAChCC,UAAUnC,WAAWsB,YAAY;gBACjC,GAAG1B,OAAO;gBACV,oBAAoBA,OAAO,CAAC,mBAAmB,GAC3C,CAAC,EAAEA,OAAO,CAAC,mBAAmB,CAAC,CAAC,EAAE8B,cAAc,CAAC,GACjDA;YACN;YACAD,aAAa;QACf;QACAF;QACAa,sBAAsB;YACpBC,WAAW;YACXC,SAASC,QAAQC,KAAK;YACtBC,OAAOrC;YACPsC,aAAatB;YACbuB,OAAOlD;QACT;QACAF;QACAS;QACAX;QACAF;QACA6B;QACAK,cAAcF;QACd/B;QACAE;QACAI;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["useEditorInput.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n getPartitionedNativeProps,\n slot,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n} from '@fluentui/react-components';\nimport type { EditorInputProps, EditorInputState } from './EditorInput.types';\nimport { SentinelNode } from '@fluentui-copilot/chat-input-plugins';\nimport type { LexicalEditor } from '@fluentui-copilot/react-text-editor';\nimport { LexicalPlainTextPlugin, mergeRegister } from '@fluentui-copilot/react-text-editor';\nimport { useControllableState } from '@fluentui/react-utilities';\n\nexport const createInitialEditorState = (defaultValue: string) => {\n return `{\"root\":{\"type\":\"root\",\"children\":[{\"children\":[{\"text\":${JSON.stringify(\n defaultValue,\n )},\"type\":\"text\"}],\"type\":\"paragraph\"}]}}`;\n};\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 preventDefaultValueOnChange = false,\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 => {\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 [defaultString, lexicalEditorStateDefaultValue] = React.useMemo(() => {\n if (typeof props.defaultValue === 'function') {\n return [undefined, props.defaultValue];\n }\n\n if (preventDefaultValueOnChange && props.defaultValue !== undefined) {\n // Any method of providing a default value to lexical which inserts it after initialization\n // will trigger a text content change.\n // Providing a default value as a stringified editorState will prevent calling onChange\n const editorState = createInitialEditorState(props.defaultValue);\n return [undefined, editorState];\n }\n\n return [props.defaultValue, undefined];\n }, [preventDefaultValueOnChange, props.defaultValue]);\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: lexicalEditorStateDefaultValue,\n theme: customTheme,\n },\n editorRef,\n disabled,\n textPlugin,\n onPaste,\n handleOnChange,\n defaultValue: defaultString,\n trimWhiteSpace,\n history,\n isSentinelNodeEnabled,\n };\n};\n"],"names":["React","getPartitionedNativeProps","slot","useId","useIsomorphicLayoutEffect","useMergedRefs","SentinelNode","LexicalPlainTextPlugin","mergeRegister","useControllableState","createInitialEditorState","defaultValue","JSON","stringify","useEditorInput_unstable","props","ref","onChange","onPaste","trimWhiteSpace","textPlugin","history","editorRef","userEditorRef","customTheme","isSentinelNodeEnabled","preventDefaultValueOnChange","root","primary","primarySlotTagName","excludedPropNames","useRef","disabled","setDisabled","state","initialState","customNodes","spanRef","useCallback","span","current","setRootElement","setEditable","registerEditableListener","isEditable","registerRootListener","style","whiteSpace","handleOnChange","newValue","value","defaultString","lexicalEditorStateDefaultValue","useMemo","undefined","editorState","placeholderValue","optional","elementType","placeholderId","id","components","input","always","defaultProps","role","contentEditable","suppressContentEditableWarning","tabIndex","lexicalInitialConfig","namespace","onError","console","error","nodes","theme"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,yBAAyB,EACzBC,IAAI,EACJC,KAAK,EACLC,yBAAyB,EACzBC,aAAa,QACR,6BAA6B;AAEpC,SAASC,YAAY,QAAQ,uCAAuC;AAEpE,SAASC,sBAAsB,EAAEC,aAAa,QAAQ,sCAAsC;AAC5F,SAASC,oBAAoB,QAAQ,4BAA4B;AAEjE,OAAO,MAAMC,2BAA2B,CAACC;IACvC,OAAO,CAAC,wDAAwD,EAAEC,KAAKC,SAAS,CAC9EF,cACA,uCAAuC,CAAC;AAC5C,EAAE;AAEF;;;;;;;;CAQC,GACD,OAAO,MAAMG,0BAA0B,CAACC,OAAyBC;IAC/D,MAAM,EACJC,QAAQ,EACRC,OAAO,EACPC,iBAAiB,KAAK,EACtBC,aAAab,sBAAsB,EACnCc,UAAU,IAAI,EACdC,WAAWC,aAAa,EACxBC,WAAW,EACXC,wBAAwB,IAAI,EAC5BC,8BAA8B,KAAK,EACpC,GAAGX;IACJ,MAAM,EAAEY,IAAI,EAAEC,OAAO,EAAE,GAAG3B,0BAA0B;QAClD4B,oBAAoB;QACpBd;QACAe,mBAAmB;YAAC;YAAY;YAAW;SAAe;IAC5D;IAEA,MAAMR,YAAYjB,cAAcL,MAAM+B,MAAM,CAAgB,OAAOR;IACnE,iFAAiF;IACjF,8CAA8C;IAC9C,MAAM,CAACS,UAAUC,YAAY,GAAGxB,qBAAqB;QACnDyB,OAAOnB,MAAMiB,QAAQ;QACrBG,cAAc;IAChB;IAEA,MAAMC,cAAcrB,MAAMqB,WAAW,GAAG;WAAIrB,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/D,OAAO;gBAAC2C;gBAAWC;aAAY;QACjC;QAEA,OAAO;YAACxC,MAAMJ,YAAY;YAAE2C;SAAU;IACxC,GAAG;QAAC5B;QAA6BX,MAAMJ,YAAY;KAAC;IAEpD,MAAM6C,mBAAmBtD,KAAKuD,QAAQ,CAAC1C,MAAMyC,gBAAgB,EAAE;QAAEE,aAAa;IAAO;IACrF,MAAMC,gBAAgBxD,MAAM,0BAA0BqD,6BAAAA,uCAAAA,iBAAkBI,EAAE;IAC1E,IAAIJ,kBAAkB;QACpBA,iBAAiBI,EAAE,GAAGD;IACxB;IAEA,OAAO;QACLE,YAAY;YACVlC,MAAM;YACNmC,OAAO;YACPN,kBAAkB;QACpB;QACA7B,MAAMzB,KAAK6D,MAAM,CAAChD,MAAMY,IAAI,EAAE;YAAEqC,cAAc;gBAAE,GAAGrC,IAAI;YAAC;YAAG+B,aAAa;QAAO;QAC/EI,OAAO5D,KAAK6D,MAAM,CAAChD,MAAM+C,KAAK,EAAE;YAC9BE,cAAc;gBACZhD,KAAKX,cAAcW,KAAKqB;gBACxB4B,MAAM;gBACNC,iBAAiB,CAAClC;gBAClB,iBAAiBA,WAAW,OAAOsB;gBACnCtB;gBACAmC,gCAAgC;gBAChCC,UAAUpC,WAAWsB,YAAY;gBACjC,GAAG1B,OAAO;gBACV,oBAAoBA,OAAO,CAAC,mBAAmB,GAC3C,CAAC,EAAEA,OAAO,CAAC,mBAAmB,CAAC,CAAC,EAAE+B,cAAc,CAAC,GACjDA;YACN;YACAD,aAAa;QACf;QACAF;QACAa,sBAAsB;YACpBC,WAAW;YACXC,SAASC,QAAQC,KAAK;YACtBC,OAAOtC;YACPmB,aAAaH;YACbuB,OAAOnD;QACT;QACAF;QACAU;QACAZ;QACAF;QACA8B;QACArC,cAAcwC;QACdhC;QACAE;QACAI;IACF;AACF,EAAE"}
@@ -0,0 +1,61 @@
1
+ import { makeResetStyles, makeStyles, mergeClasses, typographyStyles } from '@fluentui/react-components';
2
+ import { tokens } from '@fluentui-copilot/tokens';
3
+ export const editorInputClassNames = {
4
+ root: 'fai-EditorInput',
5
+ input: 'fai-EditorInput__input',
6
+ placeholderValue: 'fai-EditorInput__placeholderValue'
7
+ };
8
+ /**
9
+ * Styles for the root slot
10
+ */ const useRootClassName = makeResetStyles({
11
+ display: 'inline-grid',
12
+ whiteSpace: 'pre-wrap'
13
+ });
14
+ export const useLexicalStyles = makeStyles({
15
+ paragraph: {
16
+ margin: 0,
17
+ textAlign: 'start'
18
+ }
19
+ });
20
+ export const usePlaceholderClassName = makeResetStyles({
21
+ zIndex: 0,
22
+ gridArea: '1 / 1 / 1 / 1',
23
+ color: tokens.colorNeutralForeground4,
24
+ ...typographyStyles.body1,
25
+ '@media (forced-colors: active)': {
26
+ color: 'GrayText'
27
+ }
28
+ });
29
+ export const useInputClassName = makeResetStyles({
30
+ gridArea: '1 / 1 / 1 / 1',
31
+ zIndex: 1,
32
+ width: '100%'
33
+ });
34
+ const useStyles = makeStyles({
35
+ placeholderDisabled: {
36
+ color: tokens.colorNeutralForegroundDisabled
37
+ }
38
+ });
39
+ /**
40
+ * Apply styling to the EditorInput slots based on the state
41
+ */ export const useEditorInputStyles_unstable = (state)=>{
42
+ 'use no memo';
43
+ const { disabled } = state;
44
+ const placeholderClassName = usePlaceholderClassName();
45
+ const rootClassName = useRootClassName();
46
+ const inputClassName = useInputClassName();
47
+ const styles = useStyles();
48
+ state.root.className = mergeClasses(editorInputClassNames.root, rootClassName, state.root.className);
49
+ state.input.className = mergeClasses(editorInputClassNames.input, inputClassName, state.input.className);
50
+ state.lexicalInitialConfig = {
51
+ ...state.lexicalInitialConfig,
52
+ theme: {
53
+ ...useLexicalStyles(),
54
+ ...state.lexicalInitialConfig.theme
55
+ }
56
+ };
57
+ if (state.placeholderValue) {
58
+ state.placeholderValue.className = mergeClasses(editorInputClassNames.placeholderValue, placeholderClassName, disabled && styles.placeholderDisabled, state.placeholderValue.className);
59
+ }
60
+ return state;
61
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useEditorInputStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses, typographyStyles } from '@fluentui/react-components';\nimport { tokens } 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 state.lexicalInitialConfig = {\n ...state.lexicalInitialConfig,\n theme: { ...useLexicalStyles(), ...state.lexicalInitialConfig.theme },\n };\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":["makeResetStyles","makeStyles","mergeClasses","typographyStyles","tokens","editorInputClassNames","root","input","placeholderValue","useRootClassName","display","whiteSpace","useLexicalStyles","paragraph","margin","textAlign","usePlaceholderClassName","zIndex","gridArea","color","colorNeutralForeground4","body1","useInputClassName","width","useStyles","placeholderDisabled","colorNeutralForegroundDisabled","useEditorInputStyles_unstable","state","disabled","placeholderClassName","rootClassName","inputClassName","styles","className","lexicalInitialConfig","theme"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,eAAe,EAAEC,UAAU,EAAEC,YAAY,EAAEC,gBAAgB,QAAQ,6BAA6B;AACzG,SAASC,MAAM,QAAQ,2BAA2B;AAIlD,OAAO,MAAMC,wBAA0D;IACrEC,MAAM;IACNC,OAAO;IACPC,kBAAkB;AACpB,EAAE;AAEF;;CAEC,GACD,MAAMC,mBAAmBT,gBAAgB;IACvCU,SAAS;IACTC,YAAY;AACd;AAEA,OAAO,MAAMC,mBAAmBX,WAAW;IACzCY,WAAW;QACTC,QAAQ;QACRC,WAAW;IACb;AACF,GAAG;AAEH,OAAO,MAAMC,0BAA0BhB,gBAAgB;IACrDiB,QAAQ;IACRC,UAAU;IAEVC,OAAOf,OAAOgB,uBAAuB;IACrC,GAAGjB,iBAAiBkB,KAAK;IAEzB,kCAAkC;QAChCF,OAAO;IACT;AACF,GAAG;AAEH,OAAO,MAAMG,oBAAoBtB,gBAAgB;IAC/CkB,UAAU;IACVD,QAAQ;IACRM,OAAO;AACT,GAAG;AAEH,MAAMC,YAAYvB,WAAW;IAC3BwB,qBAAqB;QACnBN,OAAOf,OAAOsB,8BAA8B;IAC9C;AACF;AACA;;CAEC,GACD,OAAO,MAAMC,gCAAgC,CAACC;IAC5C;IAEA,MAAM,EAAEC,QAAQ,EAAE,GAAGD;IACrB,MAAME,uBAAuBd;IAC7B,MAAMe,gBAAgBtB;IACtB,MAAMuB,iBAAiBV;IACvB,MAAMW,SAAST;IAEfI,MAAMtB,IAAI,CAAC4B,SAAS,GAAGhC,aAAaG,sBAAsBC,IAAI,EAAEyB,eAAeH,MAAMtB,IAAI,CAAC4B,SAAS;IAEnGN,MAAMrB,KAAK,CAAC2B,SAAS,GAAGhC,aAAaG,sBAAsBE,KAAK,EAAEyB,gBAAgBJ,MAAMrB,KAAK,CAAC2B,SAAS;IAEvGN,MAAMO,oBAAoB,GAAG;QAC3B,GAAGP,MAAMO,oBAAoB;QAC7BC,OAAO;YAAE,GAAGxB,kBAAkB;YAAE,GAAGgB,MAAMO,oBAAoB,CAACC,KAAK;QAAC;IACtE;IAEA,IAAIR,MAAMpB,gBAAgB,EAAE;QAC1BoB,MAAMpB,gBAAgB,CAAC0B,SAAS,GAAGhC,aACjCG,sBAAsBG,gBAAgB,EACtCsB,sBACAD,YAAYI,OAAOR,mBAAmB,EACtCG,MAAMpB,gBAAgB,CAAC0B,SAAS;IAEpC;IAEA,OAAON;AACT,EAAE"}
package/lib/index.js CHANGED
@@ -1,2 +1 @@
1
1
  export { EditorInput, editorInputClassNames, renderEditorInput_unstable, useEditorInputStyles_unstable, useEditorInput_unstable } from './EditorInput';
2
- //# sourceMappingURL=index.js.map
@@ -35,4 +35,3 @@ _export(exports, {
35
35
  }
36
36
  });
37
37
  const _index = require("./components/EditorInput/index");
38
- //# sourceMappingURL=EditorInput.js.map
@@ -18,4 +18,4 @@ const EditorInput = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
18
18
  (0, _useEditorInputStylesstyles.useEditorInputStyles_unstable)(state);
19
19
  return (0, _renderEditorInput.renderEditorInput_unstable)(state);
20
20
  });
21
- EditorInput.displayName = 'EditorInput'; //# sourceMappingURL=EditorInput.js.map
21
+ 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","state","useEditorInput_unstable","useEditorInputStyles_unstable","renderEditorInput_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQaA;;;eAAAA;;;;iEARU;gCACiB;mCACG;4CACG;AAKvC,MAAMA,cAAAA,WAAAA,GAAAA,OAAqDC,UAAMC,CAAU,CAACC,OAACA;UAClFC,QAAMA,IAAAA,uCAAQC,EAAAA,OAAwBF;iEAEtCG,EAAAA;WACAC,IAAAA,6CAAOA,EAAAA;AACT;AAEAP,YAAYQ,WAAW,GAAG"}
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":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQaA;;;eAAAA;;;;iEARU;gCACiB;mCACG;4CACG;AAKvC,MAAMA,cAAAA,WAAAA,GAAqDC,OAAMC,UAAU,CAAC,CAACC,OAAOC;IACzF,MAAMC,QAAQC,IAAAA,uCAAAA,EAAwBH,OAAOC;IAE7CG,IAAAA,yDAAAA,EAA8BF;IAC9B,OAAOG,IAAAA,6CAAAA,EAA2BH;AACpC;AAEAL,YAAYS,WAAW,GAAG"}
@@ -4,4 +4,3 @@
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- //# sourceMappingURL=EditorInput.types.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["EditorInput.types.ts"],"sourcesContent":["import type { InitialConfigType, LexicalEditor, LexicalPlainTextPlugin } 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 * 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>;\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<\n Pick<\n EditorInputProps,\n 'disabled' | 'textPlugin' | 'history' | 'trimWhiteSpace' | 'editorRef' | 'isSentinelNodeEnabled'\n >\n > &\n Partial<Pick<EditorInputProps, 'onPaste'>> & {\n lexicalInitialConfig: InitialConfigType;\n defaultValue?: string;\n handleOnChange: (value: string) => void;\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"],"names":[],"rangeMappings":";;","mappings":"AAmFA;;CAEC"}
1
+ {"version":3,"sources":["EditorInput.types.ts"],"sourcesContent":["import type { InitialConfigType, LexicalEditor, LexicalPlainTextPlugin } 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 * 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>;\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 * By default when the `defaultValue` is inserted into the editor, `onChange` is triggered.\n * When this prop is true, if `defaultValue` is a string, `onChange` will not be triggered with its value.\n */\n preventDefaultValueOnChange?: boolean;\n};\n\n/**\n * State used in rendering EditorInput\n */\nexport type EditorInputState = ComponentState<EditorInputSlots> &\n Required<\n Pick<\n EditorInputProps,\n 'disabled' | 'textPlugin' | 'history' | 'trimWhiteSpace' | 'editorRef' | 'isSentinelNodeEnabled'\n >\n > &\n Partial<Pick<EditorInputProps, 'onPaste'>> & {\n lexicalInitialConfig: InitialConfigType;\n defaultValue?: string;\n handleOnChange: (value: string) => void;\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"],"names":[],"rangeMappings":";;","mappings":"AAwFA;;CAEC"}
@@ -38,4 +38,3 @@ const _EditorInput = require("./EditorInput");
38
38
  const _renderEditorInput = require("./renderEditorInput");
39
39
  const _useEditorInput = require("./useEditorInput");
40
40
  const _useEditorInputStylesstyles = require("./useEditorInputStyles.styles");
41
- //# sourceMappingURL=index.js.map
@@ -41,4 +41,4 @@ const renderEditorInput_unstable = (state)=>{
41
41
  ]
42
42
  })
43
43
  });
44
- }; //# sourceMappingURL=renderEditorInput.js.map
44
+ };
@@ -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 { EditorInputState, EditorInputSlots } from './EditorInput.types';\nimport {\n LexicalComposer,\n LexicalErrorBoundary,\n LexicalEditorRefPlugin,\n LexicalHistoryPlugin,\n} from '@fluentui-copilot/react-text-editor';\nimport { BasicFunctionalityPlugin } from '@fluentui-copilot/react-chat-input-plugins';\n\n/**\n * Render the final JSX of EditorInput\n */\nexport const renderEditorInput_unstable = (state: EditorInputState) => {\n assertSlots<EditorInputSlots>(state);\n\n return (\n <state.root>\n <LexicalComposer initialConfig={state.lexicalInitialConfig}>\n <state.textPlugin\n contentEditable={<state.input />}\n ErrorBoundary={LexicalErrorBoundary}\n placeholder={state.placeholderValue ? <state.placeholderValue /> : null}\n />\n <>\n <BasicFunctionalityPlugin\n onContentChange={state.handleOnChange}\n onPaste={state.onPaste}\n trimWhitespace={state.trimWhiteSpace}\n defaultValue={state.defaultValue}\n isSentinelNodeEnabled={state.isSentinelNodeEnabled}\n />\n {state.history && <LexicalHistoryPlugin />}\n </>\n <LexicalEditorRefPlugin editorRef={state.editorRef} />\n </LexicalComposer>\n </state.root>\n );\n};\n"],"names":["assertSlots","state","_jsx","root","LexicalComposer","initialConfig","lexicalInitialConfig","textPlugin","contentEditable","ErrorBoundary","LexicalErrorBoundary","placeholder","placeholderValue","BasicFunctionalityPlugin","onContentChange","onPaste","trimWhitespace","trimWhiteSpace","defaultValue","isSentinelNodeEnabled","editorRef"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAiBEA;;;eAAAA;;;4BAhBF;iCAE4B;iCAOrB;uCACkC;AAMvCA,MAAAA,6BAA8BC,CAAAA;oCAE9B,EAAAA;sBAEI,GAAAC,IAAAA,eAAA,EAAAD,MAAAE,IAAA,EAACC;kBAAgBC,WAAAA,GAAeJ,IAAAA,gBAAAA,EAAMK,gCAAAA,EAAAA;;;8BACpCJ,IAAAA,eAAA,EAACD,MAAMM,UAAU,EAAA;qCACfC,WAAAA,GAAAA,IAAAA,eAAAA,EAAAA,MAAAA,KAAiB,EAACP,CAAAA;mCAClBQ,qCAAeC;iCACfC,MAAAA,gBAAmBC,GAAAA,WAAgB,GAAAV,IAAAA,eAAA,EAAAD,MAAAW,gBAAUA,EAAAA,CAAAA,KAAAA;;;;mCAE/C,GAAAV,IAAAA,eAAA,EAAAW,+CAAA,EAAA;;;kDAEIC,cAAiBb;gDACjBc,YAASd;mDACTe,MAAAA,qBAAsBC;;yCACtBC,WAAAA,GAAcjB,IAAAA,eAAAA,EAAAA,qCAAkB,EAAA,CAAA;qBAAA;;mDAChCkB,uCAAAA,EAAuBlB;;;;;;gDAIcmB"}
1
+ {"version":3,"sources":["renderEditorInput.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\nimport type { EditorInputState, EditorInputSlots } from './EditorInput.types';\nimport {\n LexicalComposer,\n LexicalErrorBoundary,\n LexicalEditorRefPlugin,\n LexicalHistoryPlugin,\n} from '@fluentui-copilot/react-text-editor';\nimport { BasicFunctionalityPlugin } from '@fluentui-copilot/react-chat-input-plugins';\n\n/**\n * Render the final JSX of EditorInput\n */\nexport const renderEditorInput_unstable = (state: EditorInputState) => {\n assertSlots<EditorInputSlots>(state);\n\n return (\n <state.root>\n <LexicalComposer initialConfig={state.lexicalInitialConfig}>\n <state.textPlugin\n contentEditable={<state.input />}\n ErrorBoundary={LexicalErrorBoundary}\n placeholder={state.placeholderValue ? <state.placeholderValue /> : null}\n />\n <>\n <BasicFunctionalityPlugin\n onContentChange={state.handleOnChange}\n onPaste={state.onPaste}\n trimWhitespace={state.trimWhiteSpace}\n defaultValue={state.defaultValue}\n isSentinelNodeEnabled={state.isSentinelNodeEnabled}\n />\n {state.history && <LexicalHistoryPlugin />}\n </>\n <LexicalEditorRefPlugin editorRef={state.editorRef} />\n </LexicalComposer>\n </state.root>\n );\n};\n"],"names":["renderEditorInput_unstable","state","assertSlots","_jsx","root","_jsxs","LexicalComposer","initialConfig","lexicalInitialConfig","textPlugin","contentEditable","input","ErrorBoundary","LexicalErrorBoundary","placeholder","placeholderValue","_Fragment","BasicFunctionalityPlugin","onContentChange","handleOnChange","onPaste","trimWhitespace","trimWhiteSpace","defaultValue","isSentinelNodeEnabled","history","LexicalHistoryPlugin","LexicalEditorRefPlugin","editorRef"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAgBaA;;;eAAAA;;;4BAfb;iCAE4B;iCAOrB;uCACkC;AAKlC,MAAMA,6BAA6B,CAACC;IACzCC,IAAAA,4BAAAA,EAA8BD;IAE9B,OAAA,WAAA,GACEE,IAAAA,eAAA,EAACF,MAAMG,IAAI,EAAA;kBACT,WAAA,GAAAC,IAAAA,gBAAA,EAACC,gCAAAA,EAAAA;YAAgBC,eAAeN,MAAMO,oBAAoB;;8BACxDL,IAAAA,eAAA,EAACF,MAAMQ,UAAU,EAAA;oBACfC,iBAAAA,WAAAA,GAAiBP,IAAAA,eAAA,EAACF,MAAMU,KAAK,EAAA,CAAA;oBAC7BC,eAAeC,qCAAAA;oBACfC,aAAab,MAAMc,gBAAgB,GAAA,WAAA,GAAGZ,IAAAA,eAAA,EAACF,MAAMc,gBAAgB,EAAA,CAAA,KAAM;;8BAErEV,IAAAA,gBAAA,EAAAW,oBAAA,EAAA;;sCACEb,IAAAA,eAAA,EAACc,+CAAAA,EAAAA;4BACCC,iBAAiBjB,MAAMkB,cAAc;4BACrCC,SAASnB,MAAMmB,OAAO;4BACtBC,gBAAgBpB,MAAMqB,cAAc;4BACpCC,cAActB,MAAMsB,YAAY;4BAChCC,uBAAuBvB,MAAMuB,qBAAqB;;wBAEnDvB,MAAMwB,OAAO,IAAA,WAAA,GAAItB,IAAAA,eAAA,EAACuB,qCAAAA,EAAAA,CAAAA;;;8BAErBvB,IAAAA,eAAA,EAACwB,uCAAAA,EAAAA;oBAAuBC,WAAW3B,MAAM2B,SAAS;;;;;AAI1D"}
@@ -2,9 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- Object.defineProperty(exports, "useEditorInput_unstable", {
6
- enumerable: true,
7
- get: function() {
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ createInitialEditorState: function() {
13
+ return createInitialEditorState;
14
+ },
15
+ useEditorInput_unstable: function() {
8
16
  return useEditorInput_unstable;
9
17
  }
10
18
  });
@@ -14,8 +22,11 @@ const _reactcomponents = require("@fluentui/react-components");
14
22
  const _chatinputplugins = require("@fluentui-copilot/chat-input-plugins");
15
23
  const _reacttexteditor = require("@fluentui-copilot/react-text-editor");
16
24
  const _reactutilities = require("@fluentui/react-utilities");
25
+ const createInitialEditorState = (defaultValue)=>{
26
+ return `{"root":{"type":"root","children":[{"children":[{"text":${JSON.stringify(defaultValue)},"type":"text"}],"type":"paragraph"}]}}`;
27
+ };
17
28
  const useEditorInput_unstable = (props, ref)=>{
18
- const { onChange, onPaste, trimWhiteSpace = false, textPlugin = _reacttexteditor.LexicalPlainTextPlugin, history = true, editorRef: userEditorRef, customTheme, isSentinelNodeEnabled = true } = props;
29
+ const { onChange, onPaste, trimWhiteSpace = false, textPlugin = _reacttexteditor.LexicalPlainTextPlugin, history = true, editorRef: userEditorRef, customTheme, isSentinelNodeEnabled = true, preventDefaultValueOnChange = false } = props;
19
30
  const { root, primary } = (0, _reactcomponents.getPartitionedNativeProps)({
20
31
  primarySlotTagName: 'span',
21
32
  props,
@@ -39,8 +50,7 @@ const useEditorInput_unstable = (props, ref)=>{
39
50
  _chatinputplugins.SentinelNode
40
51
  ];
41
52
  const spanRef = _react.useCallback((span)=>{
42
- var // Register the `input` span with lexical
43
- _editorRef_current;
53
+ var _editorRef_current;
44
54
  (_editorRef_current = editorRef.current) === null || _editorRef_current === void 0 ? void 0 : _editorRef_current.setRootElement(span);
45
55
  }, [
46
56
  editorRef
@@ -78,18 +88,31 @@ const useEditorInput_unstable = (props, ref)=>{
78
88
  }, [
79
89
  onChange
80
90
  ]);
81
- const [defaultString, defaultValueFunction] = (()=>{
91
+ const [defaultString, lexicalEditorStateDefaultValue] = _react.useMemo(()=>{
82
92
  if (typeof props.defaultValue === 'function') {
83
93
  return [
84
94
  undefined,
85
95
  props.defaultValue
86
96
  ];
87
97
  }
98
+ if (preventDefaultValueOnChange && props.defaultValue !== undefined) {
99
+ // Any method of providing a default value to lexical which inserts it after initialization
100
+ // will trigger a text content change.
101
+ // Providing a default value as a stringified editorState will prevent calling onChange
102
+ const editorState = createInitialEditorState(props.defaultValue);
103
+ return [
104
+ undefined,
105
+ editorState
106
+ ];
107
+ }
88
108
  return [
89
109
  props.defaultValue,
90
110
  undefined
91
111
  ];
92
- })();
112
+ }, [
113
+ preventDefaultValueOnChange,
114
+ props.defaultValue
115
+ ]);
93
116
  const placeholderValue = _reactcomponents.slot.optional(props.placeholderValue, {
94
117
  elementType: 'span'
95
118
  });
@@ -128,7 +151,7 @@ const useEditorInput_unstable = (props, ref)=>{
128
151
  namespace: 'fai-EditorInput',
129
152
  onError: console.error,
130
153
  nodes: customNodes,
131
- editorState: defaultValueFunction,
154
+ editorState: lexicalEditorStateDefaultValue,
132
155
  theme: customTheme
133
156
  },
134
157
  editorRef,
@@ -141,4 +164,4 @@ const useEditorInput_unstable = (props, ref)=>{
141
164
  history,
142
165
  isSentinelNodeEnabled
143
166
  };
144
- }; //# sourceMappingURL=useEditorInput.js.map
167
+ };
@@ -1 +1 @@
1
- {"version":3,"sources":["useEditorInput.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n getPartitionedNativeProps,\n slot,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n} from '@fluentui/react-components';\nimport type { EditorInputProps, EditorInputState } from './EditorInput.types';\nimport { SentinelNode } from '@fluentui-copilot/chat-input-plugins';\nimport type { LexicalEditor } from '@fluentui-copilot/react-text-editor';\nimport { LexicalPlainTextPlugin, mergeRegister } from '@fluentui-copilot/react-text-editor';\nimport { 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 => {\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 [defaultString, defaultValueFunction] = (() => {\n if (typeof props.defaultValue === 'function') {\n return [undefined, props.defaultValue];\n }\n return [props.defaultValue, undefined];\n })();\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 defaultValue: defaultString,\n trimWhiteSpace,\n history,\n isSentinelNodeEnabled,\n };\n};\n"],"names":["onChange","trimWhiteSpace","primarySlotTagName","props","excludedPropNames","LexicalPlainTextPlugin","userEditorRef","isSentinelNodeEnabled","root","primary","disabled","customNodes","SentinelNode","setDisabled","useControllableState","state","spanRef","React","editorRef","current","useCallback","span","_editorRef_current","useIsomorphicLayoutEffect","setRootElement","isEditable","registerRootListener","style","whiteSpace","handleOnChange","newValue","defaultString","defaultValueFunction","undefined","defaultValue","placeholderId","useId","placeholderValue","id","components","elementType","input","ref","useMergedRefs","slot","defaultProps","tabIndex","role","suppressContentEditableWarning","customTheme","nodes","textPlugin"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAyBIA;;;eAAAA;;;;iEAzBmB;iCAOhB;kCAEsB;iCAEyB;gCACjB;AAYnC,MACEA,0BAEAC,CAAAA,OAAAA;UAOF,UACEC,SACAC,mBACAC,KAAAA,eAAoBC,uCAAA,YAAY,IAAA,aAAWC,aAAA,aAAe,EAC5DC,wBAAA,IAAA,KAEAJ;UACA,EACAK,IAAA,EACAC,OAAOC,mDACgB,EAAA;4BACP;QAChBP;QAEAC,mBAAMO;YAAcR;YAAMQ;YAAc;SAAA;;UAAuBC,YAAAA,IAAAA,8BAAAA,EAAAA,OAAAA,MAAAA,CAAAA,OAAAA;qFAAgB;kDAACA;UAAa,CAAAF,UAAAG,YAAA,GAAAC,IAAAA,oCAAA,EAAA;QAE7FC,OAAMC,MAAAA,QAAUC;sBAEZ;;wBACAC,MAAAA,WAAAA,GAAUC;WAAAA,MAAOR,WAAjBO;QAAAA,8BAAAA;KAAAA,GAAAA;QAAAA,8BAAAA;KAAAA;UAEFF,UAAAC,OAAAG,WAAA,CAAAC,CAAAA;qDAAW;QAGbC;QACAC,CAAAA,qBAAAA,UAA0BJ,OAAA,MAAA,QAAAG,uBAAA,KAAA,IAAA,KAAA,IAAAA,mBAAAE,cAAA,CAAAH;;;KACpBH;2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AAAsC,KAAA,EAAA;0BACPJ;gBACFK,KAAAC,IAAAA,8BAAA,EAAAD,KAAA1B;gBACAR,MAAMoC;iCAA0BC,CAAcnC;iCAASA,WAAA,OAAAuB;;gDAAiB;gBAAOa,UAAApC,WAAAuB,YAAA;gBAC/EQ,GAAAA,OAAOG;oCACSnC,OAAA,CAAA,mBAAA,GAAA,CAAA,EAAAA,OAAA,CAAA,mBAAA,CAAA,CAAA,EAAA0B,cAAA,CAAA,GAAAA;;yBAEZY;;;8BAGArC;uBACAsC;6BACAF,KAAUpC;;yBAEVsB;mBAGFiB;;;;;;;sBAOAC;;;;;6CAMFC"}
1
+ {"version":3,"sources":["useEditorInput.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n getPartitionedNativeProps,\n slot,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n} from '@fluentui/react-components';\nimport type { EditorInputProps, EditorInputState } from './EditorInput.types';\nimport { SentinelNode } from '@fluentui-copilot/chat-input-plugins';\nimport type { LexicalEditor } from '@fluentui-copilot/react-text-editor';\nimport { LexicalPlainTextPlugin, mergeRegister } from '@fluentui-copilot/react-text-editor';\nimport { useControllableState } from '@fluentui/react-utilities';\n\nexport const createInitialEditorState = (defaultValue: string) => {\n return `{\"root\":{\"type\":\"root\",\"children\":[{\"children\":[{\"text\":${JSON.stringify(\n defaultValue,\n )},\"type\":\"text\"}],\"type\":\"paragraph\"}]}}`;\n};\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 preventDefaultValueOnChange = false,\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 => {\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 [defaultString, lexicalEditorStateDefaultValue] = React.useMemo(() => {\n if (typeof props.defaultValue === 'function') {\n return [undefined, props.defaultValue];\n }\n\n if (preventDefaultValueOnChange && props.defaultValue !== undefined) {\n // Any method of providing a default value to lexical which inserts it after initialization\n // will trigger a text content change.\n // Providing a default value as a stringified editorState will prevent calling onChange\n const editorState = createInitialEditorState(props.defaultValue);\n return [undefined, editorState];\n }\n\n return [props.defaultValue, undefined];\n }, [preventDefaultValueOnChange, props.defaultValue]);\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: lexicalEditorStateDefaultValue,\n theme: customTheme,\n },\n editorRef,\n disabled,\n textPlugin,\n onPaste,\n handleOnChange,\n defaultValue: defaultString,\n trimWhiteSpace,\n history,\n isSentinelNodeEnabled,\n };\n};\n"],"names":["createInitialEditorState","useEditorInput_unstable","defaultValue","JSON","stringify","props","ref","onChange","onPaste","trimWhiteSpace","textPlugin","LexicalPlainTextPlugin","history","editorRef","userEditorRef","customTheme","isSentinelNodeEnabled","preventDefaultValueOnChange","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","defaultString","lexicalEditorStateDefaultValue","useMemo","undefined","editorState","placeholderValue","slot","optional","elementType","placeholderId","useId","id","components","input","always","defaultProps","role","contentEditable","suppressContentEditableWarning","tabIndex","lexicalInitialConfig","namespace","onError","console","error","nodes","theme"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ editorInputClassNames: function() {
13
+ return editorInputClassNames;
14
+ },
15
+ useEditorInputStyles_unstable: function() {
16
+ return useEditorInputStyles_unstable;
17
+ },
18
+ useInputClassName: function() {
19
+ return useInputClassName;
20
+ },
21
+ useLexicalStyles: function() {
22
+ return useLexicalStyles;
23
+ },
24
+ usePlaceholderClassName: function() {
25
+ return usePlaceholderClassName;
26
+ }
27
+ });
28
+ const _reactcomponents = require("@fluentui/react-components");
29
+ const _tokens = require("@fluentui-copilot/tokens");
30
+ const editorInputClassNames = {
31
+ root: 'fai-EditorInput',
32
+ input: 'fai-EditorInput__input',
33
+ placeholderValue: 'fai-EditorInput__placeholderValue'
34
+ };
35
+ /**
36
+ * Styles for the root slot
37
+ */ const useRootClassName = (0, _reactcomponents.makeResetStyles)({
38
+ display: 'inline-grid',
39
+ whiteSpace: 'pre-wrap'
40
+ });
41
+ const useLexicalStyles = (0, _reactcomponents.makeStyles)({
42
+ paragraph: {
43
+ margin: 0,
44
+ textAlign: 'start'
45
+ }
46
+ });
47
+ const usePlaceholderClassName = (0, _reactcomponents.makeResetStyles)({
48
+ zIndex: 0,
49
+ gridArea: '1 / 1 / 1 / 1',
50
+ color: _tokens.tokens.colorNeutralForeground4,
51
+ ..._reactcomponents.typographyStyles.body1,
52
+ '@media (forced-colors: active)': {
53
+ color: 'GrayText'
54
+ }
55
+ });
56
+ const useInputClassName = (0, _reactcomponents.makeResetStyles)({
57
+ gridArea: '1 / 1 / 1 / 1',
58
+ zIndex: 1,
59
+ width: '100%'
60
+ });
61
+ const useStyles = (0, _reactcomponents.makeStyles)({
62
+ placeholderDisabled: {
63
+ color: _tokens.tokens.colorNeutralForegroundDisabled
64
+ }
65
+ });
66
+ const useEditorInputStyles_unstable = (state)=>{
67
+ 'use no memo';
68
+ const { disabled } = state;
69
+ const placeholderClassName = usePlaceholderClassName();
70
+ const rootClassName = useRootClassName();
71
+ const inputClassName = useInputClassName();
72
+ const styles = useStyles();
73
+ state.root.className = (0, _reactcomponents.mergeClasses)(editorInputClassNames.root, rootClassName, state.root.className);
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
+ if (state.placeholderValue) {
83
+ state.placeholderValue.className = (0, _reactcomponents.mergeClasses)(editorInputClassNames.placeholderValue, placeholderClassName, disabled && styles.placeholderDisabled, state.placeholderValue.className);
84
+ }
85
+ return state;
86
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useEditorInputStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses, typographyStyles } from '@fluentui/react-components';\nimport { tokens } 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 state.lexicalInitialConfig = {\n ...state.lexicalInitialConfig,\n theme: { ...useLexicalStyles(), ...state.lexicalInitialConfig.theme },\n };\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","lexicalInitialConfig","theme"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAKaA,qBAAAA;eAAAA;;IA+CAC,6BAAAA;eAAAA;;IAdAC,iBAAAA;eAAAA;;IAnBAC,gBAAAA;eAAAA;;IAOAC,uBAAAA;eAAAA;;;iCA1B+D;wBACrD;AAIhB,MAAMJ,wBAA0D;IACrEK,MAAM;IACNC,OAAO;IACPC,kBAAkB;AACpB;AAEA;;CAEC,GACD,MAAMC,mBAAmBC,IAAAA,gCAAAA,EAAgB;IACvCC,SAAS;IAC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AOP,mBAAmB,EACtCE,MAAMpB,gBAAgB,CAAC0B,SAAS;IAEpC;IAEA,OAAON;AACT"}
@@ -26,4 +26,3 @@ _export(exports, {
26
26
  }
27
27
  });
28
28
  const _EditorInput = require("./EditorInput");
29
- //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui-copilot/react-editor-input",
3
- "version": "0.4.7",
3
+ "version": "0.4.9-hotfix.1",
4
4
  "description": "a base rich editor input.",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -12,26 +12,22 @@
12
12
  },
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
- "@fluentui-copilot/chat-input-plugins": "^0.4.2",
16
- "@fluentui-copilot/react-chat-input-plugins": "^0.4.6",
17
- "@fluentui-copilot/react-text-editor": "^0.4.1",
18
- "@fluentui-copilot/tokens": "^0.3.8",
15
+ "@fluentui-copilot/chat-input-plugins": "0.4.2-hotfix.1",
16
+ "@fluentui-copilot/react-chat-input-plugins": "0.4.8-hotfix.1",
17
+ "@fluentui-copilot/react-text-editor": "0.4.1-hotfix.1",
18
+ "@fluentui-copilot/tokens": "0.3.10-hotfix.1",
19
19
  "@swc/helpers": "^0.5.1"
20
20
  },
21
21
  "peerDependencies": {
22
- "@fluentui/react-components": ">=9.55.1 <10.0.0",
23
- "@fluentui/react-jsx-runtime": ">=9.0.45 <10.0.0",
24
- "@fluentui/react-utilities": ">=9.18.16 <10.0.0",
22
+ "@fluentui/react-components": ">=9.58.3 <10.0.0",
23
+ "@fluentui/react-jsx-runtime": ">=9.0.50 <10.0.0",
24
+ "@fluentui/react-utilities": ">=9.19.0 <10.0.0",
25
25
  "@types/react": ">=16.14.0 <19.0.0",
26
26
  "@types/react-dom": ">=16.9.8 <19.0.0",
27
27
  "react": ">=16.14.0 <19.0.0",
28
28
  "react-dom": ">=16.14.0 <19.0.0"
29
29
  },
30
- "beachball": {
31
- "disallowedChangeTypes": [
32
- "major"
33
- ]
34
- },
30
+ "beachball": {},
35
31
  "exports": {
36
32
  ".": {
37
33
  "types": "./dist/index.d.ts",