@fluentui-copilot/react-chat-input-plugins 0.0.0-nightly-20240423-0407-d55bcc74.1 → 0.0.0-nightly-20240424-0405-f2067016.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +9 -9
- package/CHANGELOG.md +7 -7
- package/dist/index.d.ts +1 -0
- package/lib/components/ChatInputToken/useChatInputTokenStyles.js +1 -1
- package/lib/components/ChatInputToken/useChatInputTokenStyles.js.map +1 -1
- package/lib/plugins/BasicFunctionality/BasicFunctionality.js +12 -1
- package/lib/plugins/BasicFunctionality/BasicFunctionality.js.map +1 -1
- package/lib-commonjs/components/ChatInputToken/useChatInputTokenStyles.js +4 -4
- package/lib-commonjs/components/ChatInputToken/useChatInputTokenStyles.js.map +1 -1
- package/lib-commonjs/plugins/BasicFunctionality/BasicFunctionality.js +14 -1
- package/lib-commonjs/plugins/BasicFunctionality/BasicFunctionality.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.json
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"name": "@fluentui-copilot/react-chat-input-plugins",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
6
|
-
"tag": "@fluentui-copilot/react-chat-input-plugins_v0.0.0-nightly-
|
|
7
|
-
"version": "0.0.0-nightly-
|
|
5
|
+
"date": "Wed, 24 Apr 2024 04:10:33 GMT",
|
|
6
|
+
"tag": "@fluentui-copilot/react-chat-input-plugins_v0.0.0-nightly-20240424-0405-f2067016.1",
|
|
7
|
+
"version": "0.0.0-nightly-20240424-0405-f2067016.1",
|
|
8
8
|
"comments": {
|
|
9
9
|
"prerelease": [
|
|
10
10
|
{
|
|
@@ -16,20 +16,20 @@
|
|
|
16
16
|
{
|
|
17
17
|
"author": "beachball",
|
|
18
18
|
"package": "@fluentui-copilot/react-chat-input-plugins",
|
|
19
|
-
"comment": "Bump @fluentui-copilot/chat-input-plugins to v0.0.0-nightly-
|
|
20
|
-
"commit": "
|
|
19
|
+
"comment": "Bump @fluentui-copilot/chat-input-plugins to v0.0.0-nightly-20240424-0405-f2067016.1",
|
|
20
|
+
"commit": "6d777f0fe019d3253f818ecb52b3d31e7b0196b3"
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
"author": "beachball",
|
|
24
24
|
"package": "@fluentui-copilot/react-chat-input-plugins",
|
|
25
|
-
"comment": "Bump @fluentui-copilot/react-text-editor to v0.0.0-nightly-
|
|
26
|
-
"commit": "
|
|
25
|
+
"comment": "Bump @fluentui-copilot/react-text-editor to v0.0.0-nightly-20240424-0405-f2067016.1",
|
|
26
|
+
"commit": "6d777f0fe019d3253f818ecb52b3d31e7b0196b3"
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
29
|
"author": "beachball",
|
|
30
30
|
"package": "@fluentui-copilot/react-chat-input-plugins",
|
|
31
|
-
"comment": "Bump @fluentui-copilot/text-editor to v0.0.0-nightly-
|
|
32
|
-
"commit": "
|
|
31
|
+
"comment": "Bump @fluentui-copilot/text-editor to v0.0.0-nightly-20240424-0405-f2067016.1",
|
|
32
|
+
"commit": "6d777f0fe019d3253f818ecb52b3d31e7b0196b3"
|
|
33
33
|
}
|
|
34
34
|
]
|
|
35
35
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
# Change Log - @fluentui-copilot/react-chat-input-plugins
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 24 Apr 2024 04:10:33 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## [0.0.0-nightly-
|
|
7
|
+
## [0.0.0-nightly-20240424-0405-f2067016.1](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-chat-input-plugins_v0.0.0-nightly-20240424-0405-f2067016.1)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-chat-input-plugins_v0.0.3..@fluentui-copilot/react-chat-input-plugins_v0.0.0-nightly-
|
|
9
|
+
Wed, 24 Apr 2024 04:10:33 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-chat-input-plugins_v0.0.3..@fluentui-copilot/react-chat-input-plugins_v0.0.0-nightly-20240424-0405-f2067016.1)
|
|
11
11
|
|
|
12
12
|
### Changes
|
|
13
13
|
|
|
14
14
|
- Release nightly ([commit](https://github.com/microsoft/fluentai/commit/not available) by fluentui-internal@service.microsoft.com)
|
|
15
|
-
- Bump @fluentui-copilot/chat-input-plugins to v0.0.0-nightly-
|
|
16
|
-
- Bump @fluentui-copilot/react-text-editor to v0.0.0-nightly-
|
|
17
|
-
- Bump @fluentui-copilot/text-editor to v0.0.0-nightly-
|
|
15
|
+
- Bump @fluentui-copilot/chat-input-plugins to v0.0.0-nightly-20240424-0405-f2067016.1 ([commit](https://github.com/microsoft/fluentai/commit/6d777f0fe019d3253f818ecb52b3d31e7b0196b3) by beachball)
|
|
16
|
+
- Bump @fluentui-copilot/react-text-editor to v0.0.0-nightly-20240424-0405-f2067016.1 ([commit](https://github.com/microsoft/fluentai/commit/6d777f0fe019d3253f818ecb52b3d31e7b0196b3) by beachball)
|
|
17
|
+
- Bump @fluentui-copilot/text-editor to v0.0.0-nightly-20240424-0405-f2067016.1 ([commit](https://github.com/microsoft/fluentai/commit/6d777f0fe019d3253f818ecb52b3d31e7b0196b3) by beachball)
|
|
18
18
|
|
|
19
19
|
## [0.0.3](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-chat-input-plugins_v0.0.3)
|
|
20
20
|
|
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export declare type BasicFunctionalityPluginProps = {
|
|
|
32
32
|
trimWhitespace?: boolean;
|
|
33
33
|
onCountChanged?: (count: number) => void;
|
|
34
34
|
onContentChange?: (value: string) => void;
|
|
35
|
+
onPaste?: (event: ClipboardEvent) => void;
|
|
35
36
|
};
|
|
36
37
|
|
|
37
38
|
export declare type BasicFunctionalityPluginRef = {
|
|
@@ -5,7 +5,7 @@ export const chatInputTokenClassNames = {
|
|
|
5
5
|
/**
|
|
6
6
|
* Styles for the root slot
|
|
7
7
|
*/
|
|
8
|
-
const useBaseClassName = __resetStyles("
|
|
8
|
+
const useBaseClassName = __resetStyles("rx0et0g", null, [".rx0et0g{font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase200);background-color:var(--colorNeutralBackground3);border-radius:var(--borderRadiusMedium);color:var(--colorNeutralForeground2);padding:var(--spacingVerticalXXS) var(--spacingHorizontalXS);border:var(--strokeWidthThin) solid var(--colorTransparentStroke);-webkit-box-decoration-break:clone;box-decoration-break:clone;white-space:normal;}", ".rx0et0g::before{content:\".\";font-size:0;letter-spacing:var(--spacingHorizontalXS);}", ".rx0et0g::after{content:\".\";font-size:0;letter-spacing:var(--spacingHorizontalXS);}"]);
|
|
9
9
|
/**
|
|
10
10
|
* Apply styling to the ChatInputToken slots based on the state
|
|
11
11
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useChatInputTokenStyles.ts"],"sourcesContent":["import { makeResetStyles, mergeClasses, tokens, typographyStyles } from '@fluentui/react-components';\nimport type { ChatInputTokenSlots, ChatInputTokenState } from './ChatInputToken.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const chatInputTokenClassNames: SlotClassNames<ChatInputTokenSlots> = {\n root: 'fai-ChatInputToken',\n};\n\n/**\n * Styles for the root slot\n */\nconst useBaseClassName = makeResetStyles({\n ...typographyStyles.
|
|
1
|
+
{"version":3,"sources":["useChatInputTokenStyles.ts"],"sourcesContent":["import { makeResetStyles, mergeClasses, tokens, typographyStyles } from '@fluentui/react-components';\nimport type { ChatInputTokenSlots, ChatInputTokenState } from './ChatInputToken.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const chatInputTokenClassNames: SlotClassNames<ChatInputTokenSlots> = {\n root: 'fai-ChatInputToken',\n};\n\n/**\n * Styles for the root slot\n */\nconst useBaseClassName = makeResetStyles({\n ...typographyStyles.caption1,\n backgroundColor: tokens.colorNeutralBackground3,\n borderRadius: tokens.borderRadiusMedium,\n color: tokens.colorNeutralForeground2,\n // We only want half of the horizontal padding to be present when the text wraps, so we add the other half\n // on the ::before and ::after pseudo elements\n padding: `${tokens.spacingVerticalXXS} ${tokens.spacingHorizontalXS}`,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorTransparentStroke}`,\n boxDecorationBreak: 'clone',\n whiteSpace: 'normal',\n\n // Use ::before and ::after instead of just horizontal padding to ensure the cursor doesn't move inside the padding\n '&::before': {\n content: '\".\"', // Use a character to ensure the element has a width\n fontSize: 0,\n letterSpacing: tokens.spacingHorizontalXS,\n },\n '&::after': {\n content: '\".\"', // Use a character to ensure the element has a width\n fontSize: 0,\n letterSpacing: tokens.spacingHorizontalXS,\n },\n});\n\n/**\n * Apply styling to the ChatInputToken slots based on the state\n */\nexport const useChatInputTokenStyles_unstable = (state: ChatInputTokenState): ChatInputTokenState => {\n const baseClassName = useBaseClassName();\n state.root.className = mergeClasses(chatInputTokenClassNames.root, baseClassName, state.root.className);\n\n return state;\n};\n"],"names":["makeResetStyles","mergeClasses","tokens","typographyStyles","chatInputTokenClassNames","root","useBaseClassName","caption1","backgroundColor","colorNeutralBackground3","borderRadius","borderRadiusMedium","color","colorNeutralForeground2","padding","spacingVerticalXXS","spacingHorizontalXS","border","strokeWidthThin","colorTransparentStroke","boxDecorationBreak","whiteSpace","content","fontSize","letterSpacing","useChatInputTokenStyles_unstable","state","baseClassName","className"],"mappings":"AAAA,SAASA,eAAe,EAAEC,YAAY,EAAEC,MAAM,EAAEC,gBAAgB,QAAQ,6BAA6B;AAIrG,OAAO,MAAMC,2BAAgE;IAC3EC,MAAM;AACR,EAAE;AAEF;;CAEC,GACD,MAAMC,mBAAmBN,gBAAgB;IACvC,GAAGG,iBAAiBI,QAAQ;IAC5BC,iBAAiBN,OAAOO,uBAAuB;IAC/CC,cAAcR,OAAOS,kBAAkB;IACvCC,OAAOV,OAAOW,uBAAuB;IACrC,0GAA0G;IAC1G,8CAA8C;IAC9CC,SAAS,CAAC,EAAEZ,OAAOa,kBAAkB,CAAC,CAAC,EAAEb,OAAOc,mBAAmB,CAAC,CAAC;IACrEC,QAAQ,CAAC,EAAEf,OAAOgB,eAAe,CAAC,OAAO,EAAEhB,OAAOiB,sBAAsB,CAAC,CAAC;IAC1EC,oBAAoB;IACpBC,YAAY;IAEZ,mHAAmH;IACnH,aAAa;QACXC,SAAS;QACTC,UAAU;QACVC,eAAetB,OAAOc,mBAAmB;IAC3C;IACA,YAAY;QACVM,SAAS;QACTC,UAAU;QACVC,eAAetB,OAAOc,mBAAmB;IAC3C;AACF;AAEA;;CAEC,GACD,OAAO,MAAMS,mCAAmC,CAACC;IAC/C,MAAMC,gBAAgBrB;IACtBoB,MAAMrB,IAAI,CAACuB,SAAS,GAAG3B,aAAaG,yBAAyBC,IAAI,EAAEsB,eAAeD,MAAMrB,IAAI,CAACuB,SAAS;IAEtG,OAAOF;AACT,EAAE"}
|
|
@@ -7,7 +7,8 @@ export const BasicFunctionalityPlugin = React.forwardRef((props, ref) => {
|
|
|
7
7
|
defaultValue,
|
|
8
8
|
trimWhitespace,
|
|
9
9
|
onCountChanged,
|
|
10
|
-
onContentChange
|
|
10
|
+
onContentChange,
|
|
11
|
+
onPaste
|
|
11
12
|
} = props;
|
|
12
13
|
const [editor] = useLexicalComposerContext();
|
|
13
14
|
const basicFunctionalityImpl = React.useRef(null);
|
|
@@ -39,6 +40,16 @@ export const BasicFunctionalityPlugin = React.forwardRef((props, ref) => {
|
|
|
39
40
|
return (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.deactivateContentCallbacks();
|
|
40
41
|
};
|
|
41
42
|
}, [editor, onContentChange, onCountChanged]);
|
|
43
|
+
React.useEffect(() => {
|
|
44
|
+
if (onPaste) {
|
|
45
|
+
var _basicFunctionalityImpl_current;
|
|
46
|
+
(_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.activatePasteCallback(onPaste);
|
|
47
|
+
}
|
|
48
|
+
return () => {
|
|
49
|
+
var _basicFunctionalityImpl_current;
|
|
50
|
+
return (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.deactivatePasteCallback();
|
|
51
|
+
};
|
|
52
|
+
}, [editor, onPaste]);
|
|
42
53
|
React.useEffect(() => {
|
|
43
54
|
if (trimWhitespace) {
|
|
44
55
|
var _basicFunctionalityImpl_current;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["BasicFunctionality.ts"],"sourcesContent":["import * as React from 'react';\nimport { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-components';\nimport type { IBasicFunctionalityBase } from '@fluentui-copilot/chat-input-plugins';\nimport { BasicFunctionalityBase } from '@fluentui-copilot/chat-input-plugins';\n\nexport type BasicFunctionalityPluginProps = {\n defaultValue?: string;\n // Whether or not to clear the input when only whitespace is remaining\n trimWhitespace?: boolean;\n onCountChanged?: (count: number) => void;\n onContentChange?: (value: string) => void;\n};\n\nexport type BasicFunctionalityPluginRef = {\n setIsDisabled: (isDisabled: boolean) => void;\n};\n\nexport const BasicFunctionalityPlugin = React.forwardRef<BasicFunctionalityPluginRef, BasicFunctionalityPluginProps>(\n (props, ref) => {\n const { defaultValue, trimWhitespace, onCountChanged, onContentChange } = props;\n\n const [editor] = useLexicalComposerContext();\n\n const basicFunctionalityImpl = React.useRef<IBasicFunctionalityBase | null>(null);\n\n useIsomorphicLayoutEffect(() => {\n basicFunctionalityImpl.current = new BasicFunctionalityBase(editor);\n\n return () => basicFunctionalityImpl.current?.cleanup();\n }, [editor]);\n\n React.useImperativeHandle<BasicFunctionalityPluginRef, BasicFunctionalityPluginRef>(ref, () => ({\n setIsDisabled(isDisabled: boolean) {\n basicFunctionalityImpl.current?.setIsDisabled(isDisabled);\n },\n }));\n\n // useIsomporphicLayoutEffect is used to avoid flickering on first render\n useIsomorphicLayoutEffect(() => {\n if (defaultValue) {\n basicFunctionalityImpl.current?.insertDefaultValue(defaultValue);\n }\n }, [editor]);\n\n React.useEffect(() => {\n basicFunctionalityImpl.current?.activateContentCallbacks(onContentChange, onCountChanged);\n return () => basicFunctionalityImpl.current?.deactivateContentCallbacks();\n }, [editor, onContentChange, onCountChanged]);\n\n React.useEffect(() => {\n if (trimWhitespace) {\n basicFunctionalityImpl.current?.activateTrimWhitespace();\n }\n return () => basicFunctionalityImpl.current?.deactivateTrimWhitespace();\n }, [editor, trimWhitespace]);\n\n return null;\n },\n);\n"],"names":["React","useLexicalComposerContext","useIsomorphicLayoutEffect","BasicFunctionalityBase","BasicFunctionalityPlugin","forwardRef","props","ref","defaultValue","trimWhitespace","onCountChanged","onContentChange","editor","basicFunctionalityImpl","useRef","current","cleanup","useImperativeHandle","setIsDisabled","isDisabled","insertDefaultValue","useEffect","activateContentCallbacks","deactivateContentCallbacks","activateTrimWhitespace","deactivateTrimWhitespace"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,yBAAyB,QAAQ,sCAAsC;AAChF,SAASC,yBAAyB,QAAQ,6BAA6B;AAEvE,SAASC,sBAAsB,QAAQ,uCAAuC;
|
|
1
|
+
{"version":3,"sources":["BasicFunctionality.ts"],"sourcesContent":["import * as React from 'react';\nimport { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-components';\nimport type { IBasicFunctionalityBase } from '@fluentui-copilot/chat-input-plugins';\nimport { BasicFunctionalityBase } from '@fluentui-copilot/chat-input-plugins';\n\nexport type BasicFunctionalityPluginProps = {\n defaultValue?: string;\n // Whether or not to clear the input when only whitespace is remaining\n trimWhitespace?: boolean;\n onCountChanged?: (count: number) => void;\n onContentChange?: (value: string) => void;\n onPaste?: (event: ClipboardEvent) => void;\n};\n\nexport type BasicFunctionalityPluginRef = {\n setIsDisabled: (isDisabled: boolean) => void;\n};\n\nexport const BasicFunctionalityPlugin = React.forwardRef<BasicFunctionalityPluginRef, BasicFunctionalityPluginProps>(\n (props, ref) => {\n const { defaultValue, trimWhitespace, onCountChanged, onContentChange, onPaste } = props;\n\n const [editor] = useLexicalComposerContext();\n\n const basicFunctionalityImpl = React.useRef<IBasicFunctionalityBase | null>(null);\n\n useIsomorphicLayoutEffect(() => {\n basicFunctionalityImpl.current = new BasicFunctionalityBase(editor);\n\n return () => basicFunctionalityImpl.current?.cleanup();\n }, [editor]);\n\n React.useImperativeHandle<BasicFunctionalityPluginRef, BasicFunctionalityPluginRef>(ref, () => ({\n setIsDisabled(isDisabled: boolean) {\n basicFunctionalityImpl.current?.setIsDisabled(isDisabled);\n },\n }));\n\n // useIsomporphicLayoutEffect is used to avoid flickering on first render\n useIsomorphicLayoutEffect(() => {\n if (defaultValue) {\n basicFunctionalityImpl.current?.insertDefaultValue(defaultValue);\n }\n }, [editor]);\n\n React.useEffect(() => {\n basicFunctionalityImpl.current?.activateContentCallbacks(onContentChange, onCountChanged);\n return () => basicFunctionalityImpl.current?.deactivateContentCallbacks();\n }, [editor, onContentChange, onCountChanged]);\n\n React.useEffect(() => {\n if (onPaste) {\n basicFunctionalityImpl.current?.activatePasteCallback(onPaste);\n }\n return () => basicFunctionalityImpl.current?.deactivatePasteCallback();\n }, [editor, onPaste]);\n\n React.useEffect(() => {\n if (trimWhitespace) {\n basicFunctionalityImpl.current?.activateTrimWhitespace();\n }\n return () => basicFunctionalityImpl.current?.deactivateTrimWhitespace();\n }, [editor, trimWhitespace]);\n\n return null;\n },\n);\n"],"names":["React","useLexicalComposerContext","useIsomorphicLayoutEffect","BasicFunctionalityBase","BasicFunctionalityPlugin","forwardRef","props","ref","defaultValue","trimWhitespace","onCountChanged","onContentChange","onPaste","editor","basicFunctionalityImpl","useRef","current","cleanup","useImperativeHandle","setIsDisabled","isDisabled","insertDefaultValue","useEffect","activateContentCallbacks","deactivateContentCallbacks","activatePasteCallback","deactivatePasteCallback","activateTrimWhitespace","deactivateTrimWhitespace"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,yBAAyB,QAAQ,sCAAsC;AAChF,SAASC,yBAAyB,QAAQ,6BAA6B;AAEvE,SAASC,sBAAsB,QAAQ,uCAAuC;AAe9E,OAAO,MAAMC,2BAA2BJ,MAAMK,UAAU,CACtD,CAACC,OAAOC;IACN,MAAM,EAAEC,YAAY,EAAEC,cAAc,EAAEC,cAAc,EAAEC,eAAe,EAAEC,OAAO,EAAE,GAAGN;IAEnF,MAAM,CAACO,OAAO,GAAGZ;IAEjB,MAAMa,yBAAyBd,MAAMe,MAAM,CAAiC;IAE5Eb,0BAA0B;QACxBY,uBAAuBE,OAAO,GAAG,IAAIb,uBAAuBU;QAE5D,OAAO;gBAAMC;oBAAAA,kCAAAA,uBAAuBE,OAAO,cAA9BF,sDAAAA,gCAAgCG,OAAO;;IACtD,GAAG;QAACJ;KAAO;IAEXb,MAAMkB,mBAAmB,CAA2DX,KAAK,IAAO,CAAA;YAC9FY,eAAcC,UAAmB;oBAC/BN;iBAAAA,kCAAAA,uBAAuBE,OAAO,cAA9BF,sDAAAA,gCAAgCK,aAAa,CAACC;YAChD;QACF,CAAA;IAEA,yEAAyE;IACzElB,0BAA0B;QACxB,IAAIM,cAAc;gBAChBM;aAAAA,kCAAAA,uBAAuBE,OAAO,cAA9BF,sDAAAA,gCAAgCO,kBAAkB,CAACb;QACrD;IACF,GAAG;QAACK;KAAO;IAEXb,MAAMsB,SAAS,CAAC;YACdR;SAAAA,kCAAAA,uBAAuBE,OAAO,cAA9BF,sDAAAA,gCAAgCS,wBAAwB,CAACZ,iBAAiBD;QAC1E,OAAO;gBAAMI;oBAAAA,kCAAAA,uBAAuBE,OAAO,cAA9BF,sDAAAA,gCAAgCU,0BAA0B;;IACzE,GAAG;QAACX;QAAQF;QAAiBD;KAAe;IAE5CV,MAAMsB,SAAS,CAAC;QACd,IAAIV,SAAS;gBACXE;aAAAA,kCAAAA,uBAAuBE,OAAO,cAA9BF,sDAAAA,gCAAgCW,qBAAqB,CAACb;QACxD;QACA,OAAO;gBAAME;oBAAAA,kCAAAA,uBAAuBE,OAAO,cAA9BF,sDAAAA,gCAAgCY,uBAAuB;;IACtE,GAAG;QAACb;QAAQD;KAAQ;IAEpBZ,MAAMsB,SAAS,CAAC;QACd,IAAIb,gBAAgB;gBAClBK;aAAAA,kCAAAA,uBAAuBE,OAAO,cAA9BF,sDAAAA,gCAAgCa,sBAAsB;QACxD;QACA,OAAO;gBAAMb;oBAAAA,kCAAAA,uBAAuBE,OAAO,cAA9BF,sDAAAA,gCAAgCc,wBAAwB;;IACvE,GAAG;QAACf;QAAQJ;KAAe;IAE3B,OAAO;AACT,GACA"}
|
|
@@ -22,10 +22,10 @@ const chatInputTokenClassNames = {
|
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
24
24
|
* Styles for the root slot
|
|
25
|
-
*/ const useBaseClassName = (0, _reactcomponents.__resetStyles)("
|
|
26
|
-
".
|
|
27
|
-
".
|
|
28
|
-
".
|
|
25
|
+
*/ const useBaseClassName = (0, _reactcomponents.__resetStyles)("rx0et0g", null, [
|
|
26
|
+
".rx0et0g{font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase200);background-color:var(--colorNeutralBackground3);border-radius:var(--borderRadiusMedium);color:var(--colorNeutralForeground2);padding:var(--spacingVerticalXXS) var(--spacingHorizontalXS);border:var(--strokeWidthThin) solid var(--colorTransparentStroke);-webkit-box-decoration-break:clone;box-decoration-break:clone;white-space:normal;}",
|
|
27
|
+
".rx0et0g::before{content:\".\";font-size:0;letter-spacing:var(--spacingHorizontalXS);}",
|
|
28
|
+
".rx0et0g::after{content:\".\";font-size:0;letter-spacing:var(--spacingHorizontalXS);}"
|
|
29
29
|
]);
|
|
30
30
|
const useChatInputTokenStyles_unstable = (state)=>{
|
|
31
31
|
const baseClassName = useBaseClassName();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useChatInputTokenStyles.js"],"sourcesContent":["import { __resetStyles, mergeClasses, tokens, typographyStyles } from '@fluentui/react-components';\nexport const chatInputTokenClassNames = {\n root: 'fai-ChatInputToken'\n};\n/**\n * Styles for the root slot\n */\nconst useBaseClassName = __resetStyles(\"
|
|
1
|
+
{"version":3,"sources":["useChatInputTokenStyles.js"],"sourcesContent":["import { __resetStyles, mergeClasses, tokens, typographyStyles } from '@fluentui/react-components';\nexport const chatInputTokenClassNames = {\n root: 'fai-ChatInputToken'\n};\n/**\n * Styles for the root slot\n */\nconst useBaseClassName = __resetStyles(\"rx0et0g\", null, [\".rx0et0g{font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase200);background-color:var(--colorNeutralBackground3);border-radius:var(--borderRadiusMedium);color:var(--colorNeutralForeground2);padding:var(--spacingVerticalXXS) var(--spacingHorizontalXS);border:var(--strokeWidthThin) solid var(--colorTransparentStroke);-webkit-box-decoration-break:clone;box-decoration-break:clone;white-space:normal;}\", \".rx0et0g::before{content:\\\".\\\";font-size:0;letter-spacing:var(--spacingHorizontalXS);}\", \".rx0et0g::after{content:\\\".\\\";font-size:0;letter-spacing:var(--spacingHorizontalXS);}\"]);\n/**\n * Apply styling to the ChatInputToken slots based on the state\n */\nexport const useChatInputTokenStyles_unstable = state => {\n const baseClassName = useBaseClassName();\n state.root.className = mergeClasses(chatInputTokenClassNames.root, baseClassName, state.root.className);\n return state;\n};\n//# sourceMappingURL=useChatInputTokenStyles.js.map"],"names":["chatInputTokenClassNames","useChatInputTokenStyles_unstable","root","useBaseClassName","__resetStyles","state","baseClassName","className","mergeClasses"],"mappings":";;;;;;;;;;;IACaA,wBAAwB;eAAxBA;;IAUAC,gCAAgC;eAAhCA;;;iCAXyD;AAC/D,MAAMD,2BAA2B;IACtCE,MAAM;AACR;AACA;;CAEC,GACD,MAAMC,mBAAmBC,IAAAA,8BAAa,EAAC,WAAW,MAAM;IAAC;IAAwe;IAA0F;CAAwF;AAI5sB,MAAMH,mCAAmCI,CAAAA;IAC9C,MAAMC,gBAAgBH;IACtBE,MAAMH,IAAI,CAACK,SAAS,GAAGC,IAAAA,6BAAY,EAACR,yBAAyBE,IAAI,EAAEI,eAAeD,MAAMH,IAAI,CAACK,SAAS;IACtG,OAAOF;AACT,GACA,mDAAmD"}
|
|
@@ -14,7 +14,7 @@ const _reacttexteditor = require("@fluentui-copilot/react-text-editor");
|
|
|
14
14
|
const _reactcomponents = require("@fluentui/react-components");
|
|
15
15
|
const _chatinputplugins = require("@fluentui-copilot/chat-input-plugins");
|
|
16
16
|
const BasicFunctionalityPlugin = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
|
|
17
|
-
const { defaultValue, trimWhitespace, onCountChanged, onContentChange } = props;
|
|
17
|
+
const { defaultValue, trimWhitespace, onCountChanged, onContentChange, onPaste } = props;
|
|
18
18
|
const [editor] = (0, _reacttexteditor.useLexicalComposerContext)();
|
|
19
19
|
const basicFunctionalityImpl = _react.useRef(null);
|
|
20
20
|
(0, _reactcomponents.useIsomorphicLayoutEffect)(()=>{
|
|
@@ -53,6 +53,19 @@ const BasicFunctionalityPlugin = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
|
|
|
53
53
|
onContentChange,
|
|
54
54
|
onCountChanged
|
|
55
55
|
]);
|
|
56
|
+
_react.useEffect(()=>{
|
|
57
|
+
if (onPaste) {
|
|
58
|
+
var _basicFunctionalityImpl_current;
|
|
59
|
+
(_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.activatePasteCallback(onPaste);
|
|
60
|
+
}
|
|
61
|
+
return ()=>{
|
|
62
|
+
var _basicFunctionalityImpl_current;
|
|
63
|
+
return (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.deactivatePasteCallback();
|
|
64
|
+
};
|
|
65
|
+
}, [
|
|
66
|
+
editor,
|
|
67
|
+
onPaste
|
|
68
|
+
]);
|
|
56
69
|
_react.useEffect(()=>{
|
|
57
70
|
if (trimWhitespace) {
|
|
58
71
|
var _basicFunctionalityImpl_current;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["BasicFunctionality.js"],"sourcesContent":["import * as React from 'react';\nimport { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-components';\nimport { BasicFunctionalityBase } from '@fluentui-copilot/chat-input-plugins';\nexport const BasicFunctionalityPlugin = React.forwardRef((props, ref) => {\n const {\n defaultValue,\n trimWhitespace,\n onCountChanged,\n onContentChange\n } = props;\n const [editor] = useLexicalComposerContext();\n const basicFunctionalityImpl = React.useRef(null);\n useIsomorphicLayoutEffect(() => {\n basicFunctionalityImpl.current = new BasicFunctionalityBase(editor);\n return () => {\n var _basicFunctionalityImpl_current;\n return (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.cleanup();\n };\n }, [editor]);\n React.useImperativeHandle(ref, () => ({\n setIsDisabled(isDisabled) {\n var _basicFunctionalityImpl_current;\n (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.setIsDisabled(isDisabled);\n }\n }));\n // useIsomporphicLayoutEffect is used to avoid flickering on first render\n useIsomorphicLayoutEffect(() => {\n if (defaultValue) {\n var _basicFunctionalityImpl_current;\n (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.insertDefaultValue(defaultValue);\n }\n }, [editor]);\n React.useEffect(() => {\n var _basicFunctionalityImpl_current;\n (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.activateContentCallbacks(onContentChange, onCountChanged);\n return () => {\n var _basicFunctionalityImpl_current;\n return (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.deactivateContentCallbacks();\n };\n }, [editor, onContentChange, onCountChanged]);\n React.useEffect(() => {\n if (trimWhitespace) {\n var _basicFunctionalityImpl_current;\n (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.activateTrimWhitespace();\n }\n return () => {\n var _basicFunctionalityImpl_current;\n return (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.deactivateTrimWhitespace();\n };\n }, [editor, trimWhitespace]);\n return null;\n});\n//# sourceMappingURL=BasicFunctionality.js.map"],"names":["BasicFunctionalityPlugin","React","forwardRef","props","ref","defaultValue","trimWhitespace","onCountChanged","onContentChange","editor","useLexicalComposerContext","basicFunctionalityImpl","useRef","useIsomorphicLayoutEffect","current","BasicFunctionalityBase","_basicFunctionalityImpl_current","cleanup","useImperativeHandle","setIsDisabled","isDisabled","insertDefaultValue","useEffect","activateContentCallbacks","deactivateContentCallbacks","activateTrimWhitespace","deactivateTrimWhitespace"],"mappings":";;;;+BAIaA;;;eAAAA;;;;iEAJU;iCACmB;iCACA;kCACH;AAChC,MAAMA,yCAA2BC,OAAMC,UAAU,CAAC,CAACC,OAAOC;IAC/D,MAAM,EACJC,YAAY,EACZC,cAAc,EACdC,cAAc,EACdC,eAAe,
|
|
1
|
+
{"version":3,"sources":["BasicFunctionality.js"],"sourcesContent":["import * as React from 'react';\nimport { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-components';\nimport { BasicFunctionalityBase } from '@fluentui-copilot/chat-input-plugins';\nexport const BasicFunctionalityPlugin = React.forwardRef((props, ref) => {\n const {\n defaultValue,\n trimWhitespace,\n onCountChanged,\n onContentChange,\n onPaste\n } = props;\n const [editor] = useLexicalComposerContext();\n const basicFunctionalityImpl = React.useRef(null);\n useIsomorphicLayoutEffect(() => {\n basicFunctionalityImpl.current = new BasicFunctionalityBase(editor);\n return () => {\n var _basicFunctionalityImpl_current;\n return (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.cleanup();\n };\n }, [editor]);\n React.useImperativeHandle(ref, () => ({\n setIsDisabled(isDisabled) {\n var _basicFunctionalityImpl_current;\n (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.setIsDisabled(isDisabled);\n }\n }));\n // useIsomporphicLayoutEffect is used to avoid flickering on first render\n useIsomorphicLayoutEffect(() => {\n if (defaultValue) {\n var _basicFunctionalityImpl_current;\n (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.insertDefaultValue(defaultValue);\n }\n }, [editor]);\n React.useEffect(() => {\n var _basicFunctionalityImpl_current;\n (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.activateContentCallbacks(onContentChange, onCountChanged);\n return () => {\n var _basicFunctionalityImpl_current;\n return (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.deactivateContentCallbacks();\n };\n }, [editor, onContentChange, onCountChanged]);\n React.useEffect(() => {\n if (onPaste) {\n var _basicFunctionalityImpl_current;\n (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.activatePasteCallback(onPaste);\n }\n return () => {\n var _basicFunctionalityImpl_current;\n return (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.deactivatePasteCallback();\n };\n }, [editor, onPaste]);\n React.useEffect(() => {\n if (trimWhitespace) {\n var _basicFunctionalityImpl_current;\n (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.activateTrimWhitespace();\n }\n return () => {\n var _basicFunctionalityImpl_current;\n return (_basicFunctionalityImpl_current = basicFunctionalityImpl.current) === null || _basicFunctionalityImpl_current === void 0 ? void 0 : _basicFunctionalityImpl_current.deactivateTrimWhitespace();\n };\n }, [editor, trimWhitespace]);\n return null;\n});\n//# sourceMappingURL=BasicFunctionality.js.map"],"names":["BasicFunctionalityPlugin","React","forwardRef","props","ref","defaultValue","trimWhitespace","onCountChanged","onContentChange","onPaste","editor","useLexicalComposerContext","basicFunctionalityImpl","useRef","useIsomorphicLayoutEffect","current","BasicFunctionalityBase","_basicFunctionalityImpl_current","cleanup","useImperativeHandle","setIsDisabled","isDisabled","insertDefaultValue","useEffect","activateContentCallbacks","deactivateContentCallbacks","activatePasteCallback","deactivatePasteCallback","activateTrimWhitespace","deactivateTrimWhitespace"],"mappings":";;;;+BAIaA;;;eAAAA;;;;iEAJU;iCACmB;iCACA;kCACH;AAChC,MAAMA,yCAA2BC,OAAMC,UAAU,CAAC,CAACC,OAAOC;IAC/D,MAAM,EACJC,YAAY,EACZC,cAAc,EACdC,cAAc,EACdC,eAAe,EACfC,OAAO,EACR,GAAGN;IACJ,MAAM,CAACO,OAAO,GAAGC,IAAAA,0CAAyB;IAC1C,MAAMC,yBAAyBX,OAAMY,MAAM,CAAC;IAC5CC,IAAAA,0CAAyB,EAAC;QACxBF,uBAAuBG,OAAO,GAAG,IAAIC,wCAAsB,CAACN;QAC5D,OAAO;YACL,IAAIO;YACJ,OAAO,AAACA,CAAAA,kCAAkCL,uBAAuBG,OAAO,AAAD,MAAO,QAAQE,oCAAoC,KAAK,IAAI,KAAK,IAAIA,gCAAgCC,OAAO;QACrL;IACF,GAAG;QAACR;KAAO;IACXT,OAAMkB,mBAAmB,CAACf,KAAK,IAAO,CAAA;YACpCgB,eAAcC,UAAU;gBACtB,IAAIJ;gBACHA,CAAAA,kCAAkCL,uBAAuBG,OAAO,AAAD,MAAO,QAAQE,oCAAoC,KAAK,IAAI,KAAK,IAAIA,gCAAgCG,aAAa,CAACC;YACrL;QACF,CAAA;IACA,yEAAyE;IACzEP,IAAAA,0CAAyB,EAAC;QACxB,IAAIT,cAAc;YAChB,IAAIY;YACHA,CAAAA,kCAAkCL,uBAAuBG,OAAO,AAAD,MAAO,QAAQE,oCAAoC,KAAK,IAAI,KAAK,IAAIA,gCAAgCK,kBAAkB,CAACjB;QAC1L;IACF,GAAG;QAACK;KAAO;IACXT,OAAMsB,SAAS,CAAC;QACd,IAAIN;QACHA,CAAAA,kCAAkCL,uBAAuBG,OAAO,AAAD,MAAO,QAAQE,oCAAoC,KAAK,IAAI,KAAK,IAAIA,gCAAgCO,wBAAwB,CAAChB,iBAAiBD;QAC/M,OAAO;YACL,IAAIU;YACJ,OAAO,AAACA,CAAAA,kCAAkCL,uBAAuBG,OAAO,AAAD,MAAO,QAAQE,oCAAoC,KAAK,IAAI,KAAK,IAAIA,gCAAgCQ,0BAA0B;QACxM;IACF,GAAG;QAACf;QAAQF;QAAiBD;KAAe;IAC5CN,OAAMsB,SAAS,CAAC;QACd,IAAId,SAAS;YACX,IAAIQ;YACHA,CAAAA,kCAAkCL,uBAAuBG,OAAO,AAAD,MAAO,QAAQE,oCAAoC,KAAK,IAAI,KAAK,IAAIA,gCAAgCS,qBAAqB,CAACjB;QAC7L;QACA,OAAO;YACL,IAAIQ;YACJ,OAAO,AAACA,CAAAA,kCAAkCL,uBAAuBG,OAAO,AAAD,MAAO,QAAQE,oCAAoC,KAAK,IAAI,KAAK,IAAIA,gCAAgCU,uBAAuB;QACrM;IACF,GAAG;QAACjB;QAAQD;KAAQ;IACpBR,OAAMsB,SAAS,CAAC;QACd,IAAIjB,gBAAgB;YAClB,IAAIW;YACHA,CAAAA,kCAAkCL,uBAAuBG,OAAO,AAAD,MAAO,QAAQE,oCAAoC,KAAK,IAAI,KAAK,IAAIA,gCAAgCW,sBAAsB;QAC7L;QACA,OAAO;YACL,IAAIX;YACJ,OAAO,AAACA,CAAAA,kCAAkCL,uBAAuBG,OAAO,AAAD,MAAO,QAAQE,oCAAoC,KAAK,IAAI,KAAK,IAAIA,gCAAgCY,wBAAwB;QACtM;IACF,GAAG;QAACnB;QAAQJ;KAAe;IAC3B,OAAO;AACT,IACA,8CAA8C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui-copilot/react-chat-input-plugins",
|
|
3
|
-
"version": "0.0.0-nightly-
|
|
3
|
+
"version": "0.0.0-nightly-20240424-0405-f2067016.1",
|
|
4
4
|
"description": "A Fluent AI package for React-based ChatInput plugins.",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@fluentui-copilot/chat-input-plugins": "0.0.0-nightly-
|
|
16
|
-
"@fluentui-copilot/react-text-editor": "0.0.0-nightly-
|
|
17
|
-
"@fluentui-copilot/text-editor": "0.0.0-nightly-
|
|
15
|
+
"@fluentui-copilot/chat-input-plugins": "0.0.0-nightly-20240424-0405-f2067016.1",
|
|
16
|
+
"@fluentui-copilot/react-text-editor": "0.0.0-nightly-20240424-0405-f2067016.1",
|
|
17
|
+
"@fluentui-copilot/text-editor": "0.0.0-nightly-20240424-0405-f2067016.1",
|
|
18
18
|
"@swc/helpers": "^0.5.1"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|