@fluentui-copilot/react-editor-input 0.1.3 → 0.1.5

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 CHANGED
@@ -1,6 +1,62 @@
1
1
  {
2
2
  "name": "@fluentui-copilot/react-editor-input",
3
3
  "entries": [
4
+ {
5
+ "date": "Wed, 21 Aug 2024 00:24:51 GMT",
6
+ "tag": "@fluentui-copilot/react-editor-input_v0.1.5",
7
+ "version": "0.1.5",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "Humberto.Morimoto@microsoft.com",
12
+ "package": "@fluentui-copilot/react-editor-input",
13
+ "commit": "907c63c4da894b41cad4601b30e0df6d9f269056",
14
+ "comment": "chore: Bumping versions of @fluentui/* and @griffel/* packages to latest (corresponding to version 9.54.8 of @fluentui/react-components)."
15
+ },
16
+ {
17
+ "author": "ololubek@microsoft.com",
18
+ "package": "@fluentui-copilot/react-editor-input",
19
+ "commit": "0a6327b6b174fc99abed7fa70ed0542e698bcf40",
20
+ "comment": "chore: bump react-components version to 9.54.10."
21
+ },
22
+ {
23
+ "author": "Humberto.Morimoto@microsoft.com",
24
+ "package": "@fluentui-copilot/react-editor-input",
25
+ "commit": "6ce23774f5f2055977299510e8df454d86a1a313",
26
+ "comment": "chore: Removing shorthands' usage now that griffel supports them."
27
+ }
28
+ ],
29
+ "none": [
30
+ {
31
+ "author": "tristan.watanabe@gmail.com",
32
+ "package": "@fluentui-copilot/react-editor-input",
33
+ "commit": "85fc7f2580c8bad8ea04e2c73960204b4ca1c116",
34
+ "comment": "chore: update api.md file."
35
+ },
36
+ {
37
+ "author": "owcampbe@microsoft.com",
38
+ "package": "@fluentui-copilot/react-editor-input",
39
+ "commit": "27762790e2d38ca7090eb13352b2b9fe2d4788a6",
40
+ "comment": "chore: Applying package updates."
41
+ }
42
+ ]
43
+ }
44
+ },
45
+ {
46
+ "date": "Thu, 15 Aug 2024 00:14:10 GMT",
47
+ "tag": "@fluentui-copilot/react-editor-input_v0.1.4",
48
+ "version": "0.1.4",
49
+ "comments": {
50
+ "patch": [
51
+ {
52
+ "author": "owcampbe@microsoft.com",
53
+ "package": "@fluentui-copilot/react-editor-input",
54
+ "commit": "1b37d749959789efdf29b6b0bdac82666bc0f49b",
55
+ "comment": "chore: Allow exposing lexicalRef."
56
+ }
57
+ ]
58
+ }
59
+ },
4
60
  {
5
61
  "date": "Tue, 23 Jul 2024 00:56:26 GMT",
6
62
  "tag": "@fluentui-copilot/react-editor-input_v0.1.1",
package/CHANGELOG.md CHANGED
@@ -1,9 +1,29 @@
1
1
  # Change Log - @fluentui-copilot/react-editor-input
2
2
 
3
- This log was last generated on Tue, 23 Jul 2024 00:56:26 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 21 Aug 2024 00:24:51 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [0.1.5](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-editor-input_v0.1.5)
8
+
9
+ Wed, 21 Aug 2024 00:24:51 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-editor-input_v0.1.4..@fluentui-copilot/react-editor-input_v0.1.5)
11
+
12
+ ### Patches
13
+
14
+ - chore: Bumping versions of @fluentui/* and @griffel/* packages to latest (corresponding to version 9.54.8 of @fluentui/react-components). ([PR #1993](https://github.com/microsoft/fluentai/pull/1993) by Humberto.Morimoto@microsoft.com)
15
+ - chore: bump react-components version to 9.54.10. ([PR #2018](https://github.com/microsoft/fluentai/pull/2018) by ololubek@microsoft.com)
16
+ - chore: Removing shorthands' usage now that griffel supports them. ([PR #1994](https://github.com/microsoft/fluentai/pull/1994) by Humberto.Morimoto@microsoft.com)
17
+
18
+ ## [0.1.4](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-editor-input_v0.1.4)
19
+
20
+ Thu, 15 Aug 2024 00:14:10 GMT
21
+ [Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-editor-input_v0.1.1..@fluentui-copilot/react-editor-input_v0.1.4)
22
+
23
+ ### Patches
24
+
25
+ - chore: Allow exposing lexicalRef. ([PR #2042](https://github.com/microsoft/fluentai/pull/2042) by owcampbe@microsoft.com)
26
+
7
27
  ## [0.1.1](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-editor-input_v0.1.1)
8
28
 
9
29
  Tue, 23 Jul 2024 00:56:26 GMT
package/dist/index.d.ts CHANGED
@@ -3,9 +3,9 @@
3
3
  import type { ComponentProps } from '@fluentui/react-components';
4
4
  import type { ComponentState } from '@fluentui/react-components';
5
5
  import type { ForwardRefComponent } from '@fluentui/react-components';
6
- import { InitialConfigType } from '@lexical/react/LexicalComposer';
7
- import { LexicalEditor } from 'lexical';
8
- import { PlainTextPlugin } from '@lexical/react/LexicalPlainTextPlugin';
6
+ import type { InitialConfigType } from '@fluentui-copilot/react-text-editor';
7
+ import type { LexicalEditor } from '@fluentui-copilot/react-text-editor';
8
+ import type { LexicalPlainTextPlugin } from '@fluentui-copilot/react-text-editor';
9
9
  import * as React_2 from 'react';
10
10
  import type { Slot } from '@fluentui/react-components';
11
11
  import type { SlotClassNames } from '@fluentui/react-components';
@@ -46,12 +46,13 @@ export declare type EditorInputProps = Omit<ComponentProps<Partial<EditorInputSl
46
46
  * The plugin which is in charge of initializing Lexical and is given the `input` and `placeholder` slots
47
47
  * @default LexicalPlainTextPlugin
48
48
  */
49
- textPlugin?: typeof PlainTextPlugin;
49
+ textPlugin?: typeof LexicalPlainTextPlugin;
50
50
  /**
51
51
  * Controls whether history is tracked to provide undo and redo functionality
52
52
  * @default true
53
53
  */
54
54
  history?: boolean;
55
+ editorRef?: React.RefObject<LexicalEditor>;
55
56
  };
56
57
 
57
58
  export declare type EditorInputSlots = {
@@ -63,9 +64,8 @@ export declare type EditorInputSlots = {
63
64
  /**
64
65
  * State used in rendering EditorInput
65
66
  */
66
- export declare type EditorInputState = ComponentState<EditorInputSlots> & Required<Pick<EditorInputProps, 'disabled' | 'textPlugin' | 'history' | 'trimWhiteSpace'>> & Partial<Pick<EditorInputProps, 'onPaste'>> & {
67
+ export declare type EditorInputState = ComponentState<EditorInputSlots> & Required<Pick<EditorInputProps, 'disabled' | 'textPlugin' | 'history' | 'trimWhiteSpace' | 'editorRef'>> & Partial<Pick<EditorInputProps, 'onPaste'>> & {
67
68
  lexicalInitialConfig: InitialConfigType;
68
- editorRef: React.RefObject<LexicalEditor>;
69
69
  defaultValue?: string;
70
70
  handleOnChange: (value: string) => void;
71
71
  };
@@ -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\n/**\n * State used in rendering EditorInput\n */\nexport type EditorInputState = ComponentState<EditorInputSlots> &\n Required<Pick<EditorInputProps, 'disabled' | 'textPlugin' | 'history' | 'trimWhiteSpace'>> &\n Partial<Pick<EditorInputProps, 'onPaste'>> & {\n lexicalInitialConfig: InitialConfigType;\n editorRef: React.RefObject<LexicalEditor>;\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":"AAiEA;;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/**\n * State used in rendering EditorInput\n */\nexport type EditorInputState = ComponentState<EditorInputSlots> &\n Required<Pick<EditorInputProps, 'disabled' | 'textPlugin' | 'history' | 'trimWhiteSpace' | 'editorRef'>> &\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":"AAkEA;;CAEC,GACD,WAEE"}
@@ -18,7 +18,8 @@ export const useEditorInput_unstable = (props, ref) => {
18
18
  onPaste,
19
19
  trimWhiteSpace = false,
20
20
  textPlugin = LexicalPlainTextPlugin,
21
- history = true
21
+ history = true,
22
+ editorRef: userEditorRef
22
23
  } = props;
23
24
  const {
24
25
  root,
@@ -28,7 +29,7 @@ export const useEditorInput_unstable = (props, ref) => {
28
29
  props,
29
30
  excludedPropNames: ['onChange', 'onPaste', 'defaultValue']
30
31
  });
31
- const editorRef = React.useRef(null);
32
+ const editorRef = useMergedRefs(React.useRef(null), userEditorRef);
32
33
  // The disabled state can also be changed by lexical (e.g. by a custom plugin) so
33
34
  // we use `useControllableState` to coordinate
34
35
  const [disabled, setDisabled] = useControllableState({
@@ -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 { onChange, onPaste, trimWhiteSpace = false, textPlugin = LexicalPlainTextPlugin, history = true } = props;\n const { root, primary } = getPartitionedNativeProps({\n primarySlotTagName: 'span',\n props,\n excludedPropNames: ['onChange', 'onPaste', 'defaultValue'],\n });\n\n const editorRef = React.useRef<LexicalEditor>(null);\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 tabIndex: disabled ? -1 : 0,\n disabled,\n suppressContentEditableWarning: true,\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 },\n editorRef,\n disabled,\n textPlugin,\n onPaste,\n handleOnChange,\n defaultValue: defaultString,\n trimWhiteSpace,\n history,\n };\n};\n"],"names":["React","getPartitionedNativeProps","slot","useId","useIsomorphicLayoutEffect","useMergedRefs","SentinelNode","LexicalPlainTextPlugin","mergeRegister","useControllableState","useEditorInput_unstable","props","ref","onChange","onPaste","trimWhiteSpace","textPlugin","history","root","primary","primarySlotTagName","excludedPropNames","editorRef","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","tabIndex","suppressContentEditableWarning","lexicalInitialConfig","namespace","onError","console","error","nodes","editorState"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAC3C,MAAM0C,KAAK,EAAE;YAC9BE,cAAc;gBACZ3C,KAAKP,cAAcO,KAAKiB;gBACxB2B,MAAM;gBACNC,iBAAiB,CAACjC;gBAClB,iBAAiBA,WAAW,OAAOsB;gBACnCY,UAAUlC,WAAW,CAAC,IAAI;gBAC1BA;gBACAmC,gCAAgC;gBAChC,GAAGxC,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,OAAOrC;YACPsC,aAAatB;QACf;QACAtB;QACAE;QACAR;QACAF;QACA0B;QACAK,cAAcF;QACd5B;QACAE;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\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 } = 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 tabIndex: disabled ? -1 : 0,\n disabled,\n suppressContentEditableWarning: true,\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 },\n editorRef,\n disabled,\n textPlugin,\n onPaste,\n handleOnChange,\n defaultValue: defaultString,\n trimWhiteSpace,\n history,\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","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","tabIndex","suppressContentEditableWarning","lexicalInitialConfig","namespace","onError","console","error","nodes","editorState"],"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;;;;;;;;CAQC,GACD,OAAO,MAAMC,0BAA0B,CAACC,OAAyBC;IAC/D,MAAM,EACJC,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K;YACtBC,OAAOrC;YACPsC,aAAatB;QACf;QACA3B;QACAO;QACAT;QACAF;QACA2B;QACAK,cAAcF;QACd7B;QACAE;IACF;AACF,EAAE"}
@@ -1,4 +1,4 @@
1
- import { __resetStyles, __styles, mergeClasses, shorthands, tokens, typographyStyles } from '@fluentui/react-components';
1
+ import { __resetStyles, __styles, mergeClasses, tokens, typographyStyles } from '@fluentui/react-components';
2
2
  export const editorInputClassNames = {
3
3
  root: 'fai-EditorInput',
4
4
  input: 'fai-EditorInput__input',
@@ -10,13 +10,16 @@ export const editorInputClassNames = {
10
10
  const useRootClassName = __resetStyles("r1x54j0a", null, [".r1x54j0a{display:inline-grid;white-space:pre-wrap;}"]);
11
11
  export const useLexicalStyles = __styles({
12
12
  paragraph: {
13
- B6of3ja: "f1hu3pq6",
14
- t21cq0: ["f11qmguv", "f1tyq0we"],
15
- jrapky: "f19f4twv",
16
- Frg6f3: ["f1tyq0we", "f11qmguv"]
13
+ jrapky: 0,
14
+ Frg6f3: 0,
15
+ t21cq0: 0,
16
+ B6of3ja: 0,
17
+ B74szlk: "f1s184ao"
17
18
  }
18
19
  }, {
19
- d: [".f1hu3pq6{margin-top:0;}", ".f11qmguv{margin-right:0;}", ".f1tyq0we{margin-left:0;}", ".f19f4twv{margin-bottom:0;}"]
20
+ d: [[".f1s184ao{margin:0;}", {
21
+ p: -1
22
+ }]]
20
23
  });
21
24
  export const usePlaceholderClassName = __resetStyles("r1tldilo", null, [".r1tldilo{z-index:0;grid-area:1/1/1/1;color:var(--colorNeutralForeground3);font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase300);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase300);}"]);
22
25
  export const useInputClassName = __resetStyles("r18fti29", null, [".r18fti29{grid-area:1/1/1/1;z-index:1;width:100%;}"]);
@@ -1 +1 @@
1
- {"version":3,"sources":["useEditorInputStyles.styles.ts"],"sourcesContent":["import {\n makeResetStyles,\n makeStyles,\n mergeClasses,\n shorthands,\n tokens,\n typographyStyles,\n} from '@fluentui/react-components';\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 ...shorthands.margin(0),\n },\n});\n\nexport const usePlaceholderClassName = makeResetStyles({\n zIndex: 0,\n gridArea: '1 / 1 / 1 / 1',\n\n color: tokens.colorNeutralForeground3,\n ...typographyStyles.body1,\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","shorthands","tokens","typographyStyles","editorInputClassNames","root","input","placeholderValue","useRootClassName","display","whiteSpace","useLexicalStyles","paragraph","margin","usePlaceholderClassName","zIndex","gridArea","color","colorNeutralForeground3","body1","useInputClassName","width","useStyles","placeholderDisabled","colorNeutralForegroundDisabled","useEditorInputStyles_unstable","state","disabled","placeholderClassName","rootClassName","inputClassName","styles","className","lexicalInitialConfig","theme"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SACEA,eAAe,EACfC,UAAU,EACVC,YAAY,EACZC,UAAU,EACVC,MAAM,EACNC,gBAAgB,QACX,6BAA6B;AAIpC,OAAO,MAAMC,wBAA0D;IACrEC,MAAM;IACNC,OAAO;IACPC,kBAAkB;AACpB,EAAE;AAEF;;CAEC,GACD,MAAMC,mBAAmBV,gBAAgB;IACvCW,SAAS;IACTC,YAAY;AACd;AAEA,OAAO,MAAMC,mBAAmBZ,WAAW;IACzCa,WAAW;QACT,GAAGX,WAAWY,MAAM,CAAC,EAAE;IACzB;AACF,GAAG;AAEH,OAAO,MAAMC,0BAA0BhB,gBAAgB;IACrDiB,QAAQ;IACRC,UAAU;IAEVC,OAAOf,OAAOgB,uBAAuB;IACrC,GAAGf,iBAAiBgB,KAAK;AAC3B,GAAG;AAEH,OAAO,MAAMC,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,gBAAgBrB;IACtB,MAAMsB,iBAAiBV;IACvB,MAAMW,SAAST;IAEfI,MAAMrB,IAAI,CAAC2B,SAAS,GAAGhC,aAAaI,sBAAsBC,IAAI,EAAEwB,eAAeH,MAAMrB,IAAI,CAAC2B,SAAS;IAEnGN,MAAMpB,KAAK,CAAC0B,SAAS,GAAGhC,aAAaI,sBAAsBE,KAAK,EAAEwB,gBAAgBJ,MAAMpB,KAAK,CAAC0B,SAAS;IAEvGN,MAAMO,oBAAoB,GAAG;QAC3B,GAAGP,MAAMO,oBAAoB;QAC7BC,OAAO;YAAE,GAAGvB,kBAAkB;YAAE,GAAGe,MAAMO,oBAAoB,CAACC,KAAK;QAAC;IACtE;IAEA,IAAIR,MAAMnB,gBAAgB,EAAE;QAC1BmB,MAAMnB,gBAAgB,CAACyB,SAAS,GAAGhC,aACjCI,sBAAsBG,gBAAgB,EACtCqB,sBACAD,YAAYI,OAAOR,mBAAmB,EACtCG,MAAMnB,gBAAgB,CAACyB,SAAS;IAEpC;IAEA,OAAON;AACT,EAAE"}
1
+ {"version":3,"sources":["useEditorInputStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses, tokens, typographyStyles } from '@fluentui/react-components';\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 },\n});\n\nexport const usePlaceholderClassName = makeResetStyles({\n zIndex: 0,\n gridArea: '1 / 1 / 1 / 1',\n\n color: tokens.colorNeutralForeground3,\n ...typographyStyles.body1,\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","tokens","typographyStyles","editorInputClassNames","root","input","placeholderValue","useRootClassName","display","whiteSpace","useLexicalStyles","paragraph","margin","usePlaceholderClassName","zIndex","gridArea","color","colorNeutralForeground3","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,MAAM,EAAEC,gBAAgB,QAAQ,6BAA6B;AAIjH,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;IACV;AACF,GAAG;AAEH,OAAO,MAAMC,0BAA0Bf,gBAAgB;IACrDgB,QAAQ;IACRC,UAAU;IAEVC,OAAOf,OAAOgB,uBAAuB;IACrC,GAAGf,iBAAiBgB,KAAK;AAC3B,GAAG;AAEH,OAAO,MAAMC,oBAAoBrB,gBAAgB;IAC/CiB,UAAU;IACVD,QAAQ;IACRM,OAAO;AACT,GAAG;AAEH,MAAMC,YAAYtB,WAAW;IAC3BuB,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,gBAAgBrB;IACtB,MAAMsB,iBAAiBV;IACvB,MAAMW,SAAST;IAEfI,MAAMrB,IAAI,CAAC2B,SAAS,GAAG/B,aAAaG,sBAAsBC,IAAI,EAAEwB,eAAeH,MAAMrB,IAAI,CAAC2B,SAAS;IAEnGN,MAAMpB,KAAK,CAAC0B,SAAS,GAAG/B,aAAaG,sBAAsBE,KAAK,EAAEwB,gBAAgBJ,MAAMpB,KAAK,CAAC0B,SAAS;IAEvGN,MAAMO,oBAAoB,GAAG;QAC3B,GAAGP,MAAMO,oBAAoB;QAC7BC,OAAO;YAAE,GAAGvB,kBAAkB;YAAE,GAAGe,MAAMO,oBAAoB,CAACC,KAAK;QAAC;IACtE;IAEA,IAAIR,MAAMnB,gBAAgB,EAAE;QAC1BmB,MAAMnB,gBAAgB,CAACyB,SAAS,GAAG/B,aACjCG,sBAAsBG,gBAAgB,EACtCqB,sBACAD,YAAYI,OAAOR,mBAAmB,EACtCG,MAAMnB,gBAAgB,CAACyB,SAAS;IAEpC;IAEA,OAAON;AACT,EAAE"}
@@ -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\n/**\n * State used in rendering EditorInput\n */\nexport type EditorInputState = ComponentState<EditorInputSlots> &\n Required<Pick<EditorInputProps, 'disabled' | 'textPlugin' | 'history' | 'trimWhiteSpace'>> &\n Partial<Pick<EditorInputProps, 'onPaste'>> & {\n lexicalInitialConfig: InitialConfigType;\n editorRef: React.RefObject<LexicalEditor>;\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":"AAiEA;;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/**\n * State used in rendering EditorInput\n */\nexport type EditorInputState = ComponentState<EditorInputSlots> &\n Required<Pick<EditorInputProps, 'disabled' | 'textPlugin' | 'history' | 'trimWhiteSpace' | 'editorRef'>> &\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":"AAkEA;;CAEC"}
@@ -15,7 +15,7 @@ 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
17
  const useEditorInput_unstable = (props, ref)=>{
18
- const { onChange, onPaste, trimWhiteSpace = false, textPlugin = _reacttexteditor.LexicalPlainTextPlugin, history = true } = props;
18
+ const { onChange, onPaste, trimWhiteSpace = false, textPlugin = _reacttexteditor.LexicalPlainTextPlugin, history = true, editorRef: userEditorRef } = props;
19
19
  const { root, primary } = (0, _reactcomponents.getPartitionedNativeProps)({
20
20
  primarySlotTagName: 'span',
21
21
  props,
@@ -25,7 +25,7 @@ const useEditorInput_unstable = (props, ref)=>{
25
25
  'defaultValue'
26
26
  ]
27
27
  });
28
- const editorRef = _react.useRef(null);
28
+ const editorRef = (0, _reactcomponents.useMergedRefs)(_react.useRef(null), userEditorRef);
29
29
  // The disabled state can also be changed by lexical (e.g. by a custom plugin) so
30
30
  // we use `useControllableState` to coordinate
31
31
  const [disabled, setDisabled] = (0, _reactutilities.useControllableState)({
@@ -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 { onChange, onPaste, trimWhiteSpace = false, textPlugin = LexicalPlainTextPlugin, history = true } = props;\n const { root, primary } = getPartitionedNativeProps({\n primarySlotTagName: 'span',\n props,\n excludedPropNames: ['onChange', 'onPaste', 'defaultValue'],\n });\n\n const editorRef = React.useRef<LexicalEditor>(null);\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 tabIndex: disabled ? -1 : 0,\n disabled,\n suppressContentEditableWarning: true,\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 },\n editorRef,\n disabled,\n textPlugin,\n onPaste,\n handleOnChange,\n defaultValue: defaultString,\n trimWhiteSpace,\n history,\n };\n};\n"],"names":["onChange","trimWhiteSpace","primarySlotTagName","props","excludedPropNames","LexicalPlainTextPlugin","root","primary","editorRef","getPartitionedNativeProps","disabled","React","useRef","SentinelNode","customNodes","useCallback","span","current","_editorRef_current","useIsomorphicLayoutEffect","setEditable","registerEditableListener","isEditable","mergeRegister","setDisabled","whiteSpace","handleOnChange","newValue","value","undefined","defaultValue","placeholderValue","defaultValueFunction","id","placeholderId","elementType","defaultProps","input","slot","always","ref","spanRef","contentEditable","error"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAwBUA;;;eAAAA;;;;iEAxBa;iCAOhB;kCAEsB;iCAEyB;gCACjB;AAYnC,MAAQA,0BAAmBC,CAAAA,OAAAA;UAC3B,UACEC,SACAC,mBACAC,KAAAA,eAAoBC,uCAAA,YAAY,IAAA;YAClCC,IAAA,EAEAC,OAAMC,KACNC,IAAAA,0CAAA,EAAA;QACAP,oBAAA;QACAC;2BACeO;YAAAA;YAAQ;YAAA;SAAA;;UAEvBF,YAAAG,OAAAC,MAAA,CAAA;qFAEwC;kDAAqB;UAAEC,CAAAA,UAAAA,YAAAA,GAAAA,IAAAA,oCA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,EAAAA,0BAAAA,qBAAAA,QAAAA,qBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,iBAAAA,EAAAA;0BAAiBC;yBAAaG,EAAA,GAAAC;;WAExC;oBAAQ/B;kBAAoB0B;mBAAU;YACxCE,kBAAA;QAEA;cAAiEI,qBAAAA,CAAAA,MAAa,CAAAhC,MAAAG,IAAA,EAAA;YAAO8B,cAAA;gBACrF,GAAMF,IAAAA;YACN;yBACEH;QACF;QAEAM,OAAOC,qBAAA,CAAAC,MAAA,CAAApC,MAAAkC,KAAA,EAAA;0BACO;qBACV/B,IAAAA,8BAAM,EAAAkC,KAAAC;sBACNJ;iCACAN,CAAAA;gBACF,iBAAArB,WAAA,OAAAmB;gBACAvB,UAAMgC,WAAYnC,CAAAA,IAAMG;;gDAA+B;0BAAC;oCAAgBC,OAAA,CAAA,mBAAA,GAAA,CAAA,EAAAA,OAAA,CAAA,mBAAA,CAAA,CAAA,EAAA2B,cAAA,CAAA,GAAAA;;yBACjEI;;;8BAGG;uBACNI;6BACAC,KAAA;;yBAEAjC;;;;;;;sBASJqB;;;;6CAKeC"}
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 } = 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 tabIndex: disabled ? -1 : 0,\n disabled,\n suppressContentEditableWarning: true,\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 },\n editorRef,\n disabled,\n textPlugin,\n onPaste,\n handleOnChange,\n defaultValue: defaultString,\n trimWhiteSpace,\n history,\n };\n};\n"],"names":["onChange","trimWhiteSpace","primarySlotTagName","props","excludedPropNames","LexicalPlainTextPlugin","userEditorRef","root","primary","getPartitionedNativeProps","setDisabled","editorRef","customNodes","SentinelNode","disabled","useControllableState","_editorRef_current","current","setRootElement","span","setEditable","useIsomorphicLayoutEffect","mergeRegister","isEditable","whiteSpace","handleOnChange","React","useCallback","newValue","value","defaultValue","undefined","placeholderValue","id","placeholderId","input","slot","always","defaultProps","elementType","components","ref","spanRef","contentEditable","tabIndex","suppressContentEditableWarning","lexicalInitialConfig"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAyBIA;;;eAAAA;;;;iEAzBmB;iCAOhB;kCAEsB;iCAEyB;gCACjB;AAYnC,MACEA,0BAEAC,CAAAA,OAAAA;UAKF,UACEC,SACAC,mBACAC,KAAAA,eAAoBC,uCAAA,YAAY,IAAA,aAAWC,aAAA;UAC7C,EAEAC,IAAA,EACAC,OAAA,KACAC,IAAAA,0CAAA,EAAA;QACAP,oBAAiBQ;;2BAED;YAAA;YAAA;YA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SAAA;;UAIVC,mBAAiBF,qBAAAA,CAAAA,QAAY,CAAA3B,MAAK6B,gBAAY,EAAA;qBAC5C;;0BAAyBF,IAAAA,sBAAAA,EAAAA,0BAAYE,qBAAA,QAAAA,qBAAA,KAAA,IAAA,KAAA,IAAAA,iBAAAC,EAAA;0BAAC;yBACxCA,EAAA,GAAAC;;;oBAC4BH;kBAAU;YACxCI,OAAA;YAEAH,kBAAMA;;QAA+EzB,MAAA6B,qBAAA,CAAAC,MAAA,CAAAlC,MAAAI,IAAA,EAAA;YACrF+B,cAAMJ;gBACFF,GAAAA,IAAAA;;YAEJO,aAAA;QAEA;eACEC,qBAAAA,CAAAA,MAAY,CAAArC,MAAAgC,KAAA,EAAA;0BACJ;qBACNA,IAAAA,8BAAO,EAAAM,KAAAC;sBACPV;gBACFW,iBAAA,CAAA7B;gBACAP,iBAAiBO,WAAW,OAAEiB;0BAAEO,WAAc,CAAA,IAAA;;gDAAU;0BAAGC;gBAAoB,oBAAA/B,OAAA,CAAA,mBAAA,GAAA,CAAA,EAAAA,OAAA,CAAA,mBAAA,CAAA,CAAA,EAAA0B,cAAA,CAAA,GAAAA;;yBAE7EI;;;8BAGEK;uBACA;6BACAC,KAAU9B;;yBAEV+B;;;;;;;sBASJC;;;;6CAKA"}
@@ -38,23 +38,20 @@ const editorInputClassNames = {
38
38
  ]);
39
39
  const useLexicalStyles = (0, _reactcomponents.__styles)({
40
40
  paragraph: {
41
- B6of3ja: "f1hu3pq6",
42
- t21cq0: [
43
- "f11qmguv",
44
- "f1tyq0we"
45
- ],
46
- jrapky: "f19f4twv",
47
- Frg6f3: [
48
- "f1tyq0we",
49
- "f11qmguv"
50
- ]
41
+ jrapky: 0,
42
+ Frg6f3: 0,
43
+ t21cq0: 0,
44
+ B6of3ja: 0,
45
+ B74szlk: "f1s184ao"
51
46
  }
52
47
  }, {
53
48
  d: [
54
- ".f1hu3pq6{margin-top:0;}",
55
- ".f11qmguv{margin-right:0;}",
56
- ".f1tyq0we{margin-left:0;}",
57
- ".f19f4twv{margin-bottom:0;}"
49
+ [
50
+ ".f1s184ao{margin:0;}",
51
+ {
52
+ p: -1
53
+ }
54
+ ]
58
55
  ]
59
56
  });
60
57
  const usePlaceholderClassName = (0, _reactcomponents.__resetStyles)("r1tldilo", null, [
@@ -1 +1 @@
1
- {"version":3,"sources":["useEditorInputStyles.styles.ts"],"sourcesContent":["import {\n makeResetStyles,\n makeStyles,\n mergeClasses,\n shorthands,\n tokens,\n typographyStyles,\n} from '@fluentui/react-components';\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 ...shorthands.margin(0),\n },\n});\n\nexport const usePlaceholderClassName = makeResetStyles({\n zIndex: 0,\n gridArea: '1 / 1 / 1 / 1',\n\n color: tokens.colorNeutralForeground3,\n ...typographyStyles.body1,\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","typographyStyles","whiteSpace","tokens","colorNeutralForeground3","root","input","placeholderValue","display","__resetStyles","__styles","paragraph","B6of3ja","useLexicalStyles","shorthands","Frg6f3","zIndex","color","useStyles","placeholderDisabled","useInputClassName","gridArea","d","state","disabled","placeholderClassName","rootClassName","inputClassName","styles","className","mergeClasses","lexicalInitialConfig","theme"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAWaA,qBAAAA;eAAAA;;IAsCbC,6BAAA;eAAAA;;IAbKC,iBAAsB;eAAtBA;;IAdHC,gBAAY;eAAZA;;IAaOC,uBAAOC;eAAPD;;;iCA7BS;AAKX,MAAMJ,wBAA0D;UACrEM;WACAC;sBACAC;AACF;AAEA;;CAEC,SAECC,mBAASC,IAAAA,8BAAA,EAAA,YAAA,MAAA;IAAA;CAAA;AACTP,MAAAA,mBAAYQ,IAAAA,yBAAA,EAAA;IACdC,WAAA;QAEAC,SAAaC;QACXF,QAAAA;YAAAA;YAAW;SAAA;gBACNG;QACLC,QAAA;YAAA;YAAA;SAAA;IACF;AAEA,GAAA;OACEC;QAAAA;QAAQ;QAAA;QAAA;KAAA;;AAGRC,MAAOd,0BAAOC,IAAAA,8BAAuB,EAAA,YAAA,MAAA;IAAA;CAAA;AAClCH,MAAAA,oBAAsBQ,IAAAA,8BAAA,EAAA,YAAA,MAAA;IAAA;CAAA;AAC3B,MAAGS,YAAAR,IAAAA,yBAAA,EAAA;IAEHS,qBAAaC;QACXC,QAAAA;;;IAGFC,GAAG;QAAA;KAAA;AAEH;AAIA,MAAAtB,gCAAAuB,CAAAA;IACA;IAEC,MACD,EACEC,QAAA,KAEAD;UACAE,uBAAMA;UACNC,gBAAMA;UACNC,iBAAMA;UACNC,SAAMA;UAENL,IAAMlB,CAAAA,SAAKwB,GAASC,IAAAA,6BAAGA,EAAAA,sBAAa/B,IAAsBM,EAAIqB,eAAEA,MAAeH,IAAMlB,CAAAA,SAAKwB;UAE1FN,KAAMjB,CAAAA,SAAMuB,GAASC,IAAAA,6BAAGA,EAAAA,sBAAa/B,KAAsBO,EAAKqB,gBAAEA,MAAgBJ,KAAMjB,CAAAA,SAAMuB;UAE9FN,oBAAMQ,GAAoB;iBACrBR,oBAAMQ;eACTC;iCAAYnB;qBAAuBU,oBAAMQ,CAAAA,KAAoB;;;QAG/DR,MAAIA,gBAAMhB,EAAgB;cACxBgB,gBAAMhB,CAAAA,SAAiBsB,GAAAA,IAAAA,6BAAYC,EAAAA,sBACjC/B,gBAAsBQ,EAAAA,sBACtBkB,YACAD,OAAYI,mBAAOT,EAAAA,MACnBI,gBAAMhB,CAAAA,SAAiBsB;;WAI3BN;AACF"}
1
+ {"version":3,"sources":["useEditorInputStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses, tokens, typographyStyles } from '@fluentui/react-components';\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 },\n});\n\nexport const usePlaceholderClassName = makeResetStyles({\n zIndex: 0,\n gridArea: '1 / 1 / 1 / 1',\n\n color: tokens.colorNeutralForeground3,\n ...typographyStyles.body1,\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","gridArea","whiteSpace","useInputClassName","makeResetStyles","root","input","placeholderValue","display","__resetStyles","__styles","paragraph","jrapky","margin","B6of3ja","B74szlk","color","zIndex","sj55zd","disabled","rootClassName","state","placeholderClassName","useStyles","useRootClassName","lexicalInitialConfig","className","theme","mergeClasses","inputClassName","useLexicalStyles","styles","placeholderDisabled"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAIaA,qBAAAA;eAAAA;;IA0CNC,6BAAMA;eAANA;;IAbLC,iBAAU;eAAVA;;IAlBAC,gBAAY;eAAZA;;IAiBWC,uBAAoBC;eAApBD;;;iCAhC+D;AAIrE,MAAMJ,wBAA0D;UACrEM;WACAC;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 "version": "0.1.5",
4
4
  "description": "a base rich editor input.",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -12,15 +12,15 @@
12
12
  },
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
- "@fluentui-copilot/chat-input-plugins": "^0.1.3",
16
- "@fluentui-copilot/react-chat-input-plugins": "^0.1.3",
17
- "@fluentui-copilot/react-text-editor": "^0.1.8",
15
+ "@fluentui-copilot/chat-input-plugins": "^0.1.4",
16
+ "@fluentui-copilot/react-chat-input-plugins": "^0.1.5",
17
+ "@fluentui-copilot/react-text-editor": "^0.1.9",
18
18
  "@swc/helpers": "^0.5.1"
19
19
  },
20
20
  "peerDependencies": {
21
- "@fluentui/react-components": ">=9.54.4 <10.0.0",
22
- "@fluentui/react-jsx-runtime": ">=9.0.40 <10.0.0",
23
- "@fluentui/react-utilities": ">=9.18.11 <10.0.0",
21
+ "@fluentui/react-components": ">=9.54.10 <10.0.0",
22
+ "@fluentui/react-jsx-runtime": ">=9.0.42 <10.0.0",
23
+ "@fluentui/react-utilities": ">=9.18.13 <10.0.0",
24
24
  "@types/react": ">=16.14.0 <19.0.0",
25
25
  "@types/react-dom": ">=16.9.8 <19.0.0",
26
26
  "react": ">=16.14.0 <19.0.0",