@fluentui-copilot/react-editor-input 0.4.11-hotfix.1 → 0.4.11-hotfix.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +4 -4
- package/CHANGELOG.md +5 -5
- package/lib/EditorInput.js +1 -0
- package/lib/components/EditorInput/EditorInput.js +5 -4
- package/lib/components/EditorInput/EditorInput.types.js +2 -1
- package/lib/components/EditorInput/index.js +1 -0
- package/lib/components/EditorInput/renderEditorInput.js +25 -30
- package/lib/components/EditorInput/useEditorInput.js +125 -138
- package/lib/components/EditorInput/useEditorInputStyles.styles.raw.js +48 -42
- package/lib/index.js +1 -0
- package/lib-commonjs/EditorInput.js +1 -0
- package/lib-commonjs/components/EditorInput/EditorInput.js +1 -1
- package/lib-commonjs/components/EditorInput/EditorInput.js.map +1 -1
- package/lib-commonjs/components/EditorInput/EditorInput.types.js +1 -0
- package/lib-commonjs/components/EditorInput/index.js +1 -0
- package/lib-commonjs/components/EditorInput/renderEditorInput.js +1 -1
- package/lib-commonjs/components/EditorInput/renderEditorInput.js.map +1 -1
- package/lib-commonjs/components/EditorInput/useEditorInput.js +3 -2
- package/lib-commonjs/components/EditorInput/useEditorInput.js.map +1 -1
- package/lib-commonjs/components/EditorInput/useEditorInputStyles.styles.raw.js +1 -1
- package/lib-commonjs/components/EditorInput/useEditorInputStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/index.js +1 -0
- package/package.json +5 -5
package/CHANGELOG.json
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
"name": "@fluentui-copilot/react-editor-input",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
6
|
-
"tag": "@fluentui-copilot/react-editor-input_v0.4.11-hotfix.
|
|
7
|
-
"version": "0.4.11-hotfix.
|
|
5
|
+
"date": "Fri, 19 Sep 2025 15:10:19 GMT",
|
|
6
|
+
"tag": "@fluentui-copilot/react-editor-input_v0.4.11-hotfix.2",
|
|
7
|
+
"version": "0.4.11-hotfix.2",
|
|
8
8
|
"comments": {
|
|
9
9
|
"prerelease": [
|
|
10
10
|
{
|
|
11
11
|
"author": "hochelmartin@gmail.com",
|
|
12
12
|
"package": "@fluentui-copilot/react-editor-input",
|
|
13
13
|
"commit": "3e4ebe676646c4c4346dbbab83511f963ffefd85",
|
|
14
|
-
"comment": "release: prepare hotfix 0.26.2-hotfix.
|
|
14
|
+
"comment": "release: prepare hotfix 0.26.2-hotfix.2"
|
|
15
15
|
}
|
|
16
16
|
]
|
|
17
17
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# Change Log - @fluentui-copilot/react-editor-input
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 19 Sep 2025 15:10:19 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## [0.4.11-hotfix.
|
|
7
|
+
## [0.4.11-hotfix.2](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-editor-input_v0.4.11-hotfix.2)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-editor-input_v0.4.11..@fluentui-copilot/react-editor-input_v0.4.11-hotfix.
|
|
9
|
+
Fri, 19 Sep 2025 15:10:19 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-editor-input_v0.4.11..@fluentui-copilot/react-editor-input_v0.4.11-hotfix.2)
|
|
11
11
|
|
|
12
12
|
### Changes
|
|
13
13
|
|
|
14
|
-
- release: prepare hotfix 0.26.2-hotfix.
|
|
14
|
+
- release: prepare hotfix 0.26.2-hotfix.2 ([PR #3284](https://github.com/microsoft/fluentai/pull/3284) by hochelmartin@gmail.com)
|
|
15
15
|
|
|
16
16
|
## [0.4.10](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-editor-input_v0.4.10)
|
|
17
17
|
|
package/lib/EditorInput.js
CHANGED
|
@@ -3,9 +3,10 @@ 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__*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
|
@@ -2,3 +2,4 @@ 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,36 +1,31 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
/*#__PURE__*/ _jsx(LexicalEditorRefPlugin, {
|
|
31
|
-
editorRef: state.editorRef
|
|
32
|
-
})
|
|
33
|
-
]
|
|
34
|
-
})
|
|
35
|
-
});
|
|
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
|
+
});
|
|
36
30
|
};
|
|
31
|
+
//# sourceMappingURL=renderEditorInput.js.map
|
|
@@ -3,8 +3,8 @@ 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 =
|
|
7
|
-
|
|
6
|
+
export const createInitialEditorState = defaultValue => {
|
|
7
|
+
return `{"root":{"type":"root","children":[{"children":[{"text":${JSON.stringify(defaultValue)},"type":"text"}],"type":"paragraph"}]}}`;
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
10
10
|
* Create the state required to render EditorInput.
|
|
@@ -14,144 +14,131 @@ export const createInitialEditorState = (defaultValue)=>{
|
|
|
14
14
|
*
|
|
15
15
|
* @param props - props from this instance of EditorInput
|
|
16
16
|
* @param ref - reference to root HTMLElement of EditorInput
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
//
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
];
|
|
17
|
+
*/
|
|
18
|
+
export const useEditorInput_unstable = (props, ref) => {
|
|
19
|
+
const {
|
|
20
|
+
onChange,
|
|
21
|
+
onPaste,
|
|
22
|
+
trimWhiteSpace = false,
|
|
23
|
+
textPlugin = LexicalPlainTextPlugin,
|
|
24
|
+
history = true,
|
|
25
|
+
editorRef: userEditorRef,
|
|
26
|
+
customTheme,
|
|
27
|
+
isSentinelNodeEnabled = true,
|
|
28
|
+
preventDefaultValueOnChange = false
|
|
29
|
+
} = props;
|
|
30
|
+
const {
|
|
31
|
+
root,
|
|
32
|
+
primary
|
|
33
|
+
} = getPartitionedNativeProps({
|
|
34
|
+
primarySlotTagName: 'span',
|
|
35
|
+
props,
|
|
36
|
+
excludedPropNames: ['onChange', 'onPaste', 'defaultValue']
|
|
37
|
+
});
|
|
38
|
+
const editorRef = useMergedRefs(React.useRef(null), userEditorRef);
|
|
39
|
+
// The disabled state can also be changed by lexical (e.g. by a custom plugin) so
|
|
40
|
+
// we use `useControllableState` to coordinate
|
|
41
|
+
const [disabled, setDisabled] = useControllableState({
|
|
42
|
+
state: props.disabled,
|
|
43
|
+
initialState: false
|
|
44
|
+
});
|
|
45
|
+
const customNodes = props.customNodes ? [...props.customNodes, SentinelNode] : [SentinelNode];
|
|
46
|
+
const spanRef = React.useCallback(span => {
|
|
47
|
+
var
|
|
48
|
+
// Register the `input` span with lexical
|
|
49
|
+
_editorRef_current;
|
|
50
|
+
(_editorRef_current = editorRef.current) === null || _editorRef_current === void 0 ? void 0 : _editorRef_current.setRootElement(span);
|
|
51
|
+
}, [editorRef]);
|
|
52
|
+
// Update lexical when disabled changes
|
|
53
|
+
useIsomorphicLayoutEffect(() => {
|
|
54
|
+
if (editorRef.current) {
|
|
55
|
+
var _editorRef_current;
|
|
56
|
+
(_editorRef_current = editorRef.current) === null || _editorRef_current === void 0 ? void 0 : _editorRef_current.setEditable(!disabled);
|
|
57
|
+
}
|
|
58
|
+
}, [disabled]);
|
|
59
|
+
useIsomorphicLayoutEffect(() => {
|
|
60
|
+
if (editorRef.current) {
|
|
61
|
+
var _editorRef_current;
|
|
62
|
+
return mergeRegister(editorRef.current.registerEditableListener(isEditable => {
|
|
63
|
+
setDisabled(!isEditable);
|
|
64
|
+
}), (_editorRef_current = editorRef.current) === null || _editorRef_current === void 0 ? void 0 : _editorRef_current.registerRootListener(root => {
|
|
65
|
+
if (!root) {
|
|
66
|
+
return;
|
|
97
67
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
elementType: 'span'
|
|
68
|
+
// Remove lexical's inline style so we can apply our own
|
|
69
|
+
// Lexical needs the whitespace style to be either `pre` or `pre-wrap` to work correctly
|
|
70
|
+
root.style.whiteSpace = '';
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
}, [editorRef]);
|
|
74
|
+
const handleOnChange = React.useCallback(newValue => {
|
|
75
|
+
onChange === null || onChange === void 0 ? void 0 : onChange({}, {
|
|
76
|
+
value: newValue
|
|
108
77
|
});
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
78
|
+
}, [onChange]);
|
|
79
|
+
const [defaultString, lexicalEditorStateDefaultValue] = React.useMemo(() => {
|
|
80
|
+
if (typeof props.defaultValue === 'function') {
|
|
81
|
+
return [undefined, props.defaultValue];
|
|
82
|
+
}
|
|
83
|
+
if (preventDefaultValueOnChange && props.defaultValue !== undefined) {
|
|
84
|
+
// Any method of providing a default value to lexical which inserts it after initialization
|
|
85
|
+
// will trigger a text content change.
|
|
86
|
+
// Providing a default value as a stringified editorState will prevent calling onChange
|
|
87
|
+
const editorState = createInitialEditorState(props.defaultValue);
|
|
88
|
+
return [undefined, editorState];
|
|
112
89
|
}
|
|
113
|
-
return
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
lexicalInitialConfig: {
|
|
141
|
-
namespace: 'fai-EditorInput',
|
|
142
|
-
onError: console.error,
|
|
143
|
-
nodes: customNodes,
|
|
144
|
-
editorState: lexicalEditorStateDefaultValue,
|
|
145
|
-
theme: customTheme
|
|
146
|
-
},
|
|
147
|
-
editorRef,
|
|
90
|
+
return [props.defaultValue, undefined];
|
|
91
|
+
}, [preventDefaultValueOnChange, props.defaultValue]);
|
|
92
|
+
const placeholderValue = slot.optional(props.placeholderValue, {
|
|
93
|
+
elementType: 'span'
|
|
94
|
+
});
|
|
95
|
+
const placeholderId = useId('chat-input-placeholder', placeholderValue === null || placeholderValue === void 0 ? void 0 : placeholderValue.id);
|
|
96
|
+
if (placeholderValue) {
|
|
97
|
+
placeholderValue.id = placeholderId;
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
components: {
|
|
101
|
+
root: 'span',
|
|
102
|
+
input: 'span',
|
|
103
|
+
placeholderValue: 'span'
|
|
104
|
+
},
|
|
105
|
+
root: slot.always(props.root, {
|
|
106
|
+
defaultProps: {
|
|
107
|
+
...root
|
|
108
|
+
},
|
|
109
|
+
elementType: 'span'
|
|
110
|
+
}),
|
|
111
|
+
input: slot.always(props.input, {
|
|
112
|
+
defaultProps: {
|
|
113
|
+
ref: useMergedRefs(ref, spanRef),
|
|
114
|
+
role: 'textbox',
|
|
115
|
+
contentEditable: !disabled,
|
|
116
|
+
'aria-readonly': disabled ? true : undefined,
|
|
148
117
|
disabled,
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
118
|
+
suppressContentEditableWarning: true,
|
|
119
|
+
tabIndex: disabled ? undefined : 0,
|
|
120
|
+
...primary,
|
|
121
|
+
'aria-describedby': primary['aria-describedby'] ? `${primary['aria-describedby']} ${placeholderId}` : placeholderId
|
|
122
|
+
},
|
|
123
|
+
elementType: 'span'
|
|
124
|
+
}),
|
|
125
|
+
placeholderValue,
|
|
126
|
+
lexicalInitialConfig: {
|
|
127
|
+
namespace: 'fai-EditorInput',
|
|
128
|
+
onError: console.error,
|
|
129
|
+
nodes: customNodes,
|
|
130
|
+
editorState: lexicalEditorStateDefaultValue,
|
|
131
|
+
theme: customTheme
|
|
132
|
+
},
|
|
133
|
+
editorRef,
|
|
134
|
+
disabled,
|
|
135
|
+
textPlugin,
|
|
136
|
+
onPaste,
|
|
137
|
+
handleOnChange,
|
|
138
|
+
defaultValue: defaultString,
|
|
139
|
+
trimWhiteSpace,
|
|
140
|
+
history,
|
|
141
|
+
isSentinelNodeEnabled
|
|
142
|
+
};
|
|
157
143
|
};
|
|
144
|
+
//# sourceMappingURL=useEditorInput.js.map
|
|
@@ -1,61 +1,67 @@
|
|
|
1
1
|
import { makeResetStyles, makeStyles, mergeClasses, typographyStyles } from '@fluentui/react-components';
|
|
2
2
|
import { tokens } from '@fluentui-copilot/tokens';
|
|
3
3
|
export const editorInputClassNames = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
root: 'fai-EditorInput',
|
|
5
|
+
input: 'fai-EditorInput__input',
|
|
6
|
+
placeholderValue: 'fai-EditorInput__placeholderValue'
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
9
|
* Styles for the root slot
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
*/
|
|
11
|
+
const useRootClassName = makeResetStyles({
|
|
12
|
+
display: 'inline-grid',
|
|
13
|
+
whiteSpace: 'pre-wrap'
|
|
13
14
|
});
|
|
14
15
|
export const useLexicalStyles = makeStyles({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
paragraph: {
|
|
17
|
+
margin: 0,
|
|
18
|
+
textAlign: 'start'
|
|
19
|
+
}
|
|
19
20
|
});
|
|
20
21
|
export const usePlaceholderClassName = makeResetStyles({
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
zIndex: 0,
|
|
23
|
+
gridArea: '1 / 1 / 1 / 1',
|
|
24
|
+
color: tokens.colorNeutralForeground4,
|
|
25
|
+
...typographyStyles.body1,
|
|
26
|
+
'@media (forced-colors: active)': {
|
|
27
|
+
color: 'GrayText'
|
|
28
|
+
}
|
|
28
29
|
});
|
|
29
30
|
export const useInputClassName = makeResetStyles({
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
gridArea: '1 / 1 / 1 / 1',
|
|
32
|
+
zIndex: 1,
|
|
33
|
+
width: '100%'
|
|
33
34
|
});
|
|
34
35
|
const useStyles = makeStyles({
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
placeholderDisabled: {
|
|
37
|
+
color: tokens.colorNeutralForegroundDisabled
|
|
38
|
+
}
|
|
38
39
|
});
|
|
39
40
|
/**
|
|
40
41
|
* Apply styling to the EditorInput slots based on the state
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
42
|
+
*/
|
|
43
|
+
export const useEditorInputStyles_unstable = state => {
|
|
44
|
+
'use no memo';
|
|
45
|
+
|
|
46
|
+
const {
|
|
47
|
+
disabled
|
|
48
|
+
} = state;
|
|
49
|
+
const placeholderClassName = usePlaceholderClassName();
|
|
50
|
+
const rootClassName = useRootClassName();
|
|
51
|
+
const inputClassName = useInputClassName();
|
|
52
|
+
const styles = useStyles();
|
|
53
|
+
state.root.className = mergeClasses(editorInputClassNames.root, rootClassName, state.root.className);
|
|
54
|
+
state.input.className = mergeClasses(editorInputClassNames.input, inputClassName, state.input.className);
|
|
55
|
+
state.lexicalInitialConfig = {
|
|
56
|
+
...state.lexicalInitialConfig,
|
|
57
|
+
theme: {
|
|
58
|
+
...useLexicalStyles(),
|
|
59
|
+
...state.lexicalInitialConfig.theme
|
|
59
60
|
}
|
|
60
|
-
|
|
61
|
+
};
|
|
62
|
+
if (state.placeholderValue) {
|
|
63
|
+
state.placeholderValue.className = mergeClasses(editorInputClassNames.placeholderValue, placeholderClassName, disabled && styles.placeholderDisabled, state.placeholderValue.className);
|
|
64
|
+
}
|
|
65
|
+
return state;
|
|
61
66
|
};
|
|
67
|
+
//# sourceMappingURL=useEditorInputStyles.styles.raw.js.map
|
package/lib/index.js
CHANGED
|
@@ -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';
|
|
21
|
+
EditorInput.displayName = 'EditorInput'; //# sourceMappingURL=EditorInput.js.map
|
|
@@ -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","
|
|
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"}
|
|
@@ -38,3 +38,4 @@ 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
|
|
@@ -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":["
|
|
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"}
|
|
@@ -50,7 +50,8 @@ const useEditorInput_unstable = (props, ref)=>{
|
|
|
50
50
|
_chatinputplugins.SentinelNode
|
|
51
51
|
];
|
|
52
52
|
const spanRef = _react.useCallback((span)=>{
|
|
53
|
-
var
|
|
53
|
+
var // Register the `input` span with lexical
|
|
54
|
+
_editorRef_current;
|
|
54
55
|
(_editorRef_current = editorRef.current) === null || _editorRef_current === void 0 ? void 0 : _editorRef_current.setRootElement(span);
|
|
55
56
|
}, [
|
|
56
57
|
editorRef
|
|
@@ -164,4 +165,4 @@ const useEditorInput_unstable = (props, ref)=>{
|
|
|
164
165
|
history,
|
|
165
166
|
isSentinelNodeEnabled
|
|
166
167
|
};
|
|
167
|
-
};
|
|
168
|
+
}; //# 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\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","
|
|
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","onChange","trimWhiteSpace","defaultValue","JSON","stringify","primarySlotTagName","props","excludedPropNames","LexicalPlainTextPlugin","userEditorRef","isSentinelNodeEnabled","preventDefaultValueOnChange","useMergedRefs","React","root","state","customNodes","editorRef","useRef","SentinelNode","disabled","spanRef","useCallback","span","useIsomorphicLayoutEffect","current","_editorRef_current","setRootElement","setEditable","mergeRegister","registerRootListener","style","whiteSpace","handleOnChange","value","defaultString","lexicalEditorStateDefaultValue","undefined","editorState","id","placeholderId","input","slot","always","defaultProps","placeholderValue","elementType","ref","components","suppressContentEditableWarning","primary","error"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"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"}
|
|
@@ -83,4 +83,4 @@ const useEditorInputStyles_unstable = (state)=>{
|
|
|
83
83
|
state.placeholderValue.className = (0, _reactcomponents.mergeClasses)(editorInputClassNames.placeholderValue, placeholderClassName, disabled && styles.placeholderDisabled, state.placeholderValue.className);
|
|
84
84
|
}
|
|
85
85
|
return state;
|
|
86
|
-
};
|
|
86
|
+
}; //# sourceMappingURL=useEditorInputStyles.styles.raw.js.map
|
|
@@ -1 +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","
|
|
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","disabled","state","gridArea","paragraph","usePlaceholderClassName","root","input","placeholderValue","display","makeResetStyles","whiteSpace","makeStyles","margin","textAlign","zIndex","tokens","typographyStyles","body1","color","width","placeholderDisabled","colorNeutralForegroundDisabled","styles","mergeClasses","lexicalInitialConfig","inputClassName","theme","useStyles","className","useLexicalStyles","rootClassName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAKaA,qBAAAA;eAAAA;;IAkDHC,6BAAaC;eAAbD;;IAhBRE,iBAAU;eAAVA;;IAnBAC,gBAAW;eAAXA;;IAOQC,uBAAA;eAAAA;;;iCA3BkE;wBACrD;AAIhB,MAAML,wBAA0D;UACrEM;WACAC;sBACAC;AACF;AAEA;;CAEC,SAECC,mBAASC,IAAAA,gCAAA,EAAA;aACTC;IACFA,YAAA;AAEA;AACEP,MAAAA,mBAAWQ,IAAAA,2BAAA,EAAA;eACTC;gBACAC;QACFA,WAAA;IACF;AAEA;AACEC,MAAQV,0BAAAK,IAAAA,gCAAA,EAAA;YACRP;cAEOa;WACJC,cAAAA,CAAAA,uBAAsB;OAEzBA,iCAAA,CAAAC,KAAA;sCACS;QACTC,OAAA;IACF;AAEA;AACEhB,MAAAA,oBAAUO,IAAAA,gCAAA,EAAA;cACF;YACRU;IACFA,OAAG;AAEH;MACEC,YAAAA,IAAAA,2BAAqB,EAAA;yBACLC;QAChBH,OAAAH,cAAA,CAAAM,8BAAA;IACF;AACA;AAME,MAAQrB,gCAAaC,CAAAA;;UAGrB,EACAD,QAAMsB,KAENrB;UAEAA,uBAAwBsB;UAExBtB,gBAAMuB;UACJC,iBAASD;UACTE,SAAOC;cAAE,CAAAC,SAAGC,GAAAA,IAAAA,6BAAkB,EAAA9B,sBAAAM,IAAA,EAAAyB,eAAA7B,MAAAI,IAAA,CAAAuB,SAAA;eAAE,CAAAA,SAASJ,GAAAA,IAAAA,6BAAAA,EAAAA,sBAA0BlB,KAAA,EAAAmB,gBAAAxB,MAAAK,KAAA,CAAAsB,SAAA;UAACJ,oBAAA,GAAA;QACtE,GAAAvB,MAAAuB,oBAAA;QAEAE,OAAIzB;eACFA,kBAAMM;YAMR,GAAAN,MAAAuB,oBAAA,CAAAE,KAAA;QAEA;IACA"}
|
package/lib-commonjs/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui-copilot/react-editor-input",
|
|
3
|
-
"version": "0.4.11-hotfix.
|
|
3
|
+
"version": "0.4.11-hotfix.2",
|
|
4
4
|
"description": "a base rich editor input.",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@fluentui-copilot/chat-input-plugins": "0.4.2-hotfix.
|
|
16
|
-
"@fluentui-copilot/react-chat-input-plugins": "0.4.10-hotfix.
|
|
17
|
-
"@fluentui-copilot/react-text-editor": "0.4.1-hotfix.
|
|
18
|
-
"@fluentui-copilot/tokens": "0.3.11-hotfix.
|
|
15
|
+
"@fluentui-copilot/chat-input-plugins": "0.4.2-hotfix.3",
|
|
16
|
+
"@fluentui-copilot/react-chat-input-plugins": "0.4.10-hotfix.2",
|
|
17
|
+
"@fluentui-copilot/react-text-editor": "0.4.1-hotfix.3",
|
|
18
|
+
"@fluentui-copilot/tokens": "0.3.11-hotfix.2",
|
|
19
19
|
"@swc/helpers": "^0.5.1"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|