@fluentui-copilot/react-editor-input 0.0.0-nightly-20251002-0405-17b34fb7.1 → 0.0.0-nightly-20251010-0406-7df7c6d1.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 +3 -3
- package/CHANGELOG.md +4 -4
- package/package.json +9 -9
- package/dist/index.d.ts +0 -165
- package/lib/AnimatedPlaceholder.js +0 -1
- package/lib/AnimatedPlaceholder.js.map +0 -1
- package/lib/EditorInput.js +0 -1
- package/lib/EditorInput.js.map +0 -1
- package/lib/components/AnimatedPlaceholder/AnimatedPlaceholder.js +0 -10
- package/lib/components/AnimatedPlaceholder/AnimatedPlaceholder.js.map +0 -1
- package/lib/components/AnimatedPlaceholder/AnimatedPlaceholder.types.js +0 -3
- package/lib/components/AnimatedPlaceholder/AnimatedPlaceholder.types.js.map +0 -1
- package/lib/components/AnimatedPlaceholder/index.js +0 -4
- package/lib/components/AnimatedPlaceholder/index.js.map +0 -1
- package/lib/components/AnimatedPlaceholder/placeholderMotion.js +0 -46
- package/lib/components/AnimatedPlaceholder/placeholderMotion.js.map +0 -1
- package/lib/components/AnimatedPlaceholder/renderAnimatedPlaceholder.js +0 -12
- package/lib/components/AnimatedPlaceholder/renderAnimatedPlaceholder.js.map +0 -1
- package/lib/components/AnimatedPlaceholder/useAnimatedPlaceholder.js +0 -54
- package/lib/components/AnimatedPlaceholder/useAnimatedPlaceholder.js.map +0 -1
- package/lib/components/AnimatedPlaceholder/useAnimatedPlaceholderStyles.styles.js +0 -23
- package/lib/components/AnimatedPlaceholder/useAnimatedPlaceholderStyles.styles.js.map +0 -1
- package/lib/components/AnimatedPlaceholder/useAnimatedPlaceholderStyles.styles.raw.js +0 -21
- package/lib/components/AnimatedPlaceholder/useAnimatedPlaceholderStyles.styles.raw.js.map +0 -1
- package/lib/components/EditorInput/EditorInput.js +0 -11
- package/lib/components/EditorInput/EditorInput.js.map +0 -1
- package/lib/components/EditorInput/EditorInput.types.js +0 -3
- package/lib/components/EditorInput/EditorInput.types.js.map +0 -1
- package/lib/components/EditorInput/index.js +0 -4
- package/lib/components/EditorInput/index.js.map +0 -1
- package/lib/components/EditorInput/renderEditorInput.js +0 -35
- package/lib/components/EditorInput/renderEditorInput.js.map +0 -1
- package/lib/components/EditorInput/useEditorInput.js +0 -159
- package/lib/components/EditorInput/useEditorInput.js.map +0 -1
- package/lib/components/EditorInput/useEditorInputStyles.styles.js +0 -65
- package/lib/components/EditorInput/useEditorInputStyles.styles.js.map +0 -1
- package/lib/components/EditorInput/useEditorInputStyles.styles.raw.js +0 -61
- package/lib/components/EditorInput/useEditorInputStyles.styles.raw.js.map +0 -1
- package/lib/index.js +0 -2
- package/lib/index.js.map +0 -1
- package/lib-commonjs/AnimatedPlaceholder.js +0 -28
- package/lib-commonjs/AnimatedPlaceholder.js.map +0 -1
- package/lib-commonjs/EditorInput.js +0 -37
- package/lib-commonjs/EditorInput.js.map +0 -1
- package/lib-commonjs/components/AnimatedPlaceholder/AnimatedPlaceholder.js +0 -21
- package/lib-commonjs/components/AnimatedPlaceholder/AnimatedPlaceholder.js.map +0 -1
- package/lib-commonjs/components/AnimatedPlaceholder/AnimatedPlaceholder.types.js +0 -6
- package/lib-commonjs/components/AnimatedPlaceholder/AnimatedPlaceholder.types.js.map +0 -1
- package/lib-commonjs/components/AnimatedPlaceholder/index.js +0 -31
- package/lib-commonjs/components/AnimatedPlaceholder/index.js.map +0 -1
- package/lib-commonjs/components/AnimatedPlaceholder/placeholderMotion.js +0 -56
- package/lib-commonjs/components/AnimatedPlaceholder/placeholderMotion.js.map +0 -1
- package/lib-commonjs/components/AnimatedPlaceholder/renderAnimatedPlaceholder.js +0 -20
- package/lib-commonjs/components/AnimatedPlaceholder/renderAnimatedPlaceholder.js.map +0 -1
- package/lib-commonjs/components/AnimatedPlaceholder/useAnimatedPlaceholder.js +0 -57
- package/lib-commonjs/components/AnimatedPlaceholder/useAnimatedPlaceholder.js.map +0 -1
- package/lib-commonjs/components/AnimatedPlaceholder/useAnimatedPlaceholderStyles.styles.js +0 -37
- package/lib-commonjs/components/AnimatedPlaceholder/useAnimatedPlaceholderStyles.styles.js.map +0 -1
- package/lib-commonjs/components/AnimatedPlaceholder/useAnimatedPlaceholderStyles.styles.raw.js +0 -37
- package/lib-commonjs/components/AnimatedPlaceholder/useAnimatedPlaceholderStyles.styles.raw.js.map +0 -1
- package/lib-commonjs/components/EditorInput/EditorInput.js +0 -21
- package/lib-commonjs/components/EditorInput/EditorInput.js.map +0 -1
- package/lib-commonjs/components/EditorInput/EditorInput.types.js +0 -6
- package/lib-commonjs/components/EditorInput/EditorInput.types.js.map +0 -1
- package/lib-commonjs/components/EditorInput/index.js +0 -40
- package/lib-commonjs/components/EditorInput/index.js.map +0 -1
- package/lib-commonjs/components/EditorInput/renderEditorInput.js +0 -43
- package/lib-commonjs/components/EditorInput/renderEditorInput.js.map +0 -1
- package/lib-commonjs/components/EditorInput/useEditorInput.js +0 -159
- package/lib-commonjs/components/EditorInput/useEditorInput.js.map +0 -1
- package/lib-commonjs/components/EditorInput/useEditorInputStyles.styles.js +0 -99
- package/lib-commonjs/components/EditorInput/useEditorInputStyles.styles.js.map +0 -1
- package/lib-commonjs/components/EditorInput/useEditorInputStyles.styles.raw.js +0 -86
- package/lib-commonjs/components/EditorInput/useEditorInputStyles.styles.raw.js.map +0 -1
- package/lib-commonjs/index.js +0 -44
- package/lib-commonjs/index.js.map +0 -1
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "useAnimatedPlaceholder_unstable", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return useAnimatedPlaceholder_unstable;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
|
-
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
|
-
const _reactcomponents = require("@fluentui/react-components");
|
|
14
|
-
const _placeholderMotion = require("./placeholderMotion");
|
|
15
|
-
const _reactmotion = require("@fluentui/react-motion");
|
|
16
|
-
const useAnimatedPlaceholder_unstable = (props, ref)=>{
|
|
17
|
-
const { placeholderValue } = props;
|
|
18
|
-
const [placeholder, setPlaceholder] = _react.useState(placeholderValue);
|
|
19
|
-
const [visible, setVisible] = _react.useState(true);
|
|
20
|
-
_react.useEffect(()=>{
|
|
21
|
-
if (placeholderValue !== placeholder) {
|
|
22
|
-
setVisible(false);
|
|
23
|
-
}
|
|
24
|
-
}, [
|
|
25
|
-
placeholder,
|
|
26
|
-
placeholderValue
|
|
27
|
-
]);
|
|
28
|
-
const onMotionFinish = ()=>{
|
|
29
|
-
setPlaceholder(placeholderValue);
|
|
30
|
-
setVisible(true);
|
|
31
|
-
};
|
|
32
|
-
return {
|
|
33
|
-
components: {
|
|
34
|
-
root: 'div',
|
|
35
|
-
motion: _placeholderMotion.PlaceholderMotion,
|
|
36
|
-
placeholder: 'div'
|
|
37
|
-
},
|
|
38
|
-
root: _reactcomponents.slot.always((0, _reactcomponents.getIntrinsicElementProps)('div', {
|
|
39
|
-
ref,
|
|
40
|
-
...props
|
|
41
|
-
}), {
|
|
42
|
-
elementType: 'div'
|
|
43
|
-
}),
|
|
44
|
-
motion: (0, _reactmotion.presenceMotionSlot)(props.motion, {
|
|
45
|
-
elementType: _placeholderMotion.PlaceholderMotion,
|
|
46
|
-
defaultProps: {
|
|
47
|
-
visible: visible,
|
|
48
|
-
onMotionFinish: onMotionFinish
|
|
49
|
-
}
|
|
50
|
-
}),
|
|
51
|
-
placeholder: _reactcomponents.slot.always((0, _reactcomponents.getIntrinsicElementProps)('div', {
|
|
52
|
-
children: placeholder
|
|
53
|
-
}), {
|
|
54
|
-
elementType: 'div'
|
|
55
|
-
})
|
|
56
|
-
};
|
|
57
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["useAnimatedPlaceholder.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-components';\nimport type { AnimatedPlaceholderProps, AnimatedPlaceholderState } from './AnimatedPlaceholder.types';\nimport { PlaceholderMotion } from './placeholderMotion';\nimport { presenceMotionSlot } from '@fluentui/react-motion';\n\n/**\n * Create the state required to render AnimatedPlaceholder.\n *\n * The returned state can be modified with hooks such as useAnimatedPlaceholderStyles_unstable,\n * before being passed to renderAnimatedPlaceholder_unstable.\n *\n * @param props - props from this instance of AnimatedPlaceholder\n * @param ref - reference to root HTMLElement of AnimatedPlaceholder\n */\nexport const useAnimatedPlaceholder_unstable = (\n props: AnimatedPlaceholderProps,\n ref: React.Ref<HTMLDivElement>,\n): AnimatedPlaceholderState => {\n const { placeholderValue } = props;\n\n const [placeholder, setPlaceholder] = React.useState(placeholderValue);\n const [visible, setVisible] = React.useState(true);\n\n React.useEffect(() => {\n if (placeholderValue !== placeholder) {\n setVisible(false);\n }\n }, [placeholder, placeholderValue]);\n\n const onMotionFinish = () => {\n setPlaceholder(placeholderValue);\n setVisible(true);\n };\n\n return {\n components: {\n root: 'div',\n motion: PlaceholderMotion,\n placeholder: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref,\n ...props,\n }),\n { elementType: 'div' },\n ),\n motion: presenceMotionSlot<{}>(props.motion, {\n elementType: PlaceholderMotion,\n defaultProps: {\n visible: visible,\n onMotionFinish: onMotionFinish,\n },\n }),\n placeholder: slot.always(\n getIntrinsicElementProps('div', {\n children: placeholder,\n }),\n { elementType: 'div' },\n ),\n };\n};\n"],"names":["useAnimatedPlaceholder_unstable","props","ref","placeholderValue","placeholder","setPlaceholder","React","useState","visible","setVisible","useEffect","onMotionFinish","components","root","motion","PlaceholderMotion","slot","always","getIntrinsicElementProps","elementType","presenceMotionSlot","defaultProps","children"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAeaA;;;eAAAA;;;;iEAfU;iCACwB;mCAEb;6BACC;AAW5B,MAAMA,kCAAkC,CAC7CC,OACAC;IAEA,MAAM,EAAEC,gBAAgB,EAAE,GAAGF;IAE7B,MAAM,CAACG,aAAaC,eAAe,GAAGC,OAAMC,QAAQ,CAACJ;IACrD,MAAM,CAACK,SAASC,WAAW,GAAGH,OAAMC,QAAQ,CAAC;IAE7CD,OAAMI,SAAS,CAAC;QACd,IAAIP,qBAAqBC,aAAa;YACpCK,WAAW;QACb;IACF,GAAG;QAACL;QAAaD;KAAiB;IAElC,MAAMQ,iBAAiB;QACrBN,eAAeF;QACfM,WAAW;IACb;IAEA,OAAO;QACLG,YAAY;YACVC,MAAM;YACNC,QAAQC,oCAAAA;YACRX,aAAa;QACf;QACAS,MAAMG,qBAAAA,CAAKC,MAAM,CACfC,IAAAA,yCAAAA,EAAyB,OAAO;YAC9BhB;YACA,GAAGD,KAAK;QACV,IACA;YAAEkB,aAAa;QAAM;QAEvBL,QAAQM,IAAAA,+BAAAA,EAAuBnB,MAAMa,MAAM,EAAE;YAC3CK,aAAaJ,oCAAAA;YACbM,cAAc;gBACZb,SAASA;gBACTG,gBAAgBA;YAClB;QACF;QACAP,aAAaY,qBAAAA,CAAKC,MAAM,CACtBC,IAAAA,yCAAAA,EAAyB,OAAO;YAC9BI,UAAUlB;QACZ,IACA;YAAEe,aAAa;QAAM;IAEzB;AACF"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
animatedPlaceholderClassNames: function() {
|
|
13
|
-
return animatedPlaceholderClassNames;
|
|
14
|
-
},
|
|
15
|
-
useAnimatedPlaceholderStyles_unstable: function() {
|
|
16
|
-
return useAnimatedPlaceholderStyles_unstable;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
const _reactcomponents = require("@fluentui/react-components");
|
|
20
|
-
const animatedPlaceholderClassNames = {
|
|
21
|
-
root: 'fai-AnimatedPlaceholder',
|
|
22
|
-
placeholder: 'fai-AnimatedPlaceholder__placeholder'
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Styles for the root slot
|
|
26
|
-
*/ const useRootClassNames = (0, _reactcomponents.__resetStyles)("r7ukxtn", null, [
|
|
27
|
-
".r7ukxtn{overflow:clip;}"
|
|
28
|
-
]);
|
|
29
|
-
const useAnimatedPlaceholderStyles_unstable = (state)=>{
|
|
30
|
-
'use no memo';
|
|
31
|
-
const rootClassNames = useRootClassNames();
|
|
32
|
-
state.root.className = (0, _reactcomponents.mergeClasses)(animatedPlaceholderClassNames.root, rootClassNames, state.root.className);
|
|
33
|
-
if (state.placeholder) {
|
|
34
|
-
state.placeholder.className = (0, _reactcomponents.mergeClasses)(animatedPlaceholderClassNames.placeholder, state.placeholder.className);
|
|
35
|
-
}
|
|
36
|
-
return state;
|
|
37
|
-
}; //# sourceMappingURL=useAnimatedPlaceholderStyles.styles.js.map
|
package/lib-commonjs/components/AnimatedPlaceholder/useAnimatedPlaceholderStyles.styles.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["useAnimatedPlaceholderStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, mergeClasses } from '@fluentui/react-components';\nimport type { AnimatedPlaceholderSlots, AnimatedPlaceholderState } from './AnimatedPlaceholder.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const animatedPlaceholderClassNames: SlotClassNames<Omit<AnimatedPlaceholderSlots, 'motion'>> = {\n root: 'fai-AnimatedPlaceholder',\n placeholder: 'fai-AnimatedPlaceholder__placeholder',\n};\n\n/**\n * Styles for the root slot\n */\nconst useRootClassNames = makeResetStyles({\n overflow: 'clip',\n});\n\n/**\n * Apply styling to the AnimatedPlaceholder slots based on the state\n */\nexport const useAnimatedPlaceholderStyles_unstable = (state: AnimatedPlaceholderState): AnimatedPlaceholderState => {\n 'use no memo';\n\n const rootClassNames = useRootClassNames();\n state.root.className = mergeClasses(animatedPlaceholderClassNames.root, rootClassNames, state.root.className);\n\n if (state.placeholder) {\n state.placeholder.className = mergeClasses(animatedPlaceholderClassNames.placeholder, state.placeholder.className);\n }\n\n return state;\n};\n"],"names":["animatedPlaceholderClassNames","useAnimatedPlaceholderStyles_unstable","root","placeholder","overflow","__resetStyles","state","useRootClassNames","mergeClasses","rootClassNames","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAIaA,6BAAAA;eAAAA;;IAeNC,qCAAMA;eAANA;;;iCAnB+B;AAI/B,MAAMD,gCAA0F;UACrGE;iBACAC;AACF;AAEA;;CAEC,SAECC,oBAAUC,IAAAA,8BAAA,EAAA,WAAA,MAAA;IAAA;CAAA;AAMZ,MAAOJ,wCAAMA,CAAAA;;UAIXK,iBAAoBC;UAEhBD,IAAAA,CAAAA,SAAMH,GAAWK,IAAAA,6BAAE,EAAAR,8BAAAE,IAAA,EAAAO,gBAAAH,MAAAJ,IAAA,CAAAQ,SAAA;cACrBJ,WAAMH,EAAW;QACnBG,MAAAH,WAAA,CAAAO,SAAA,GAAAF,IAAAA,6BAAA,EAAAR,8BAAAG,WAAA,EAAAG,MAAAH,WAAA,CAAAO,SAAA;;IAGA,OAAAJ"}
|
package/lib-commonjs/components/AnimatedPlaceholder/useAnimatedPlaceholderStyles.styles.raw.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
animatedPlaceholderClassNames: function() {
|
|
13
|
-
return animatedPlaceholderClassNames;
|
|
14
|
-
},
|
|
15
|
-
useAnimatedPlaceholderStyles_unstable: function() {
|
|
16
|
-
return useAnimatedPlaceholderStyles_unstable;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
const _reactcomponents = require("@fluentui/react-components");
|
|
20
|
-
const animatedPlaceholderClassNames = {
|
|
21
|
-
root: 'fai-AnimatedPlaceholder',
|
|
22
|
-
placeholder: 'fai-AnimatedPlaceholder__placeholder'
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Styles for the root slot
|
|
26
|
-
*/ const useRootClassNames = (0, _reactcomponents.makeResetStyles)({
|
|
27
|
-
overflow: 'clip'
|
|
28
|
-
});
|
|
29
|
-
const useAnimatedPlaceholderStyles_unstable = (state)=>{
|
|
30
|
-
'use no memo';
|
|
31
|
-
const rootClassNames = useRootClassNames();
|
|
32
|
-
state.root.className = (0, _reactcomponents.mergeClasses)(animatedPlaceholderClassNames.root, rootClassNames, state.root.className);
|
|
33
|
-
if (state.placeholder) {
|
|
34
|
-
state.placeholder.className = (0, _reactcomponents.mergeClasses)(animatedPlaceholderClassNames.placeholder, state.placeholder.className);
|
|
35
|
-
}
|
|
36
|
-
return state;
|
|
37
|
-
};
|
package/lib-commonjs/components/AnimatedPlaceholder/useAnimatedPlaceholderStyles.styles.raw.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["useAnimatedPlaceholderStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, mergeClasses } from '@fluentui/react-components';\nimport type { AnimatedPlaceholderSlots, AnimatedPlaceholderState } from './AnimatedPlaceholder.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const animatedPlaceholderClassNames: SlotClassNames<Omit<AnimatedPlaceholderSlots, 'motion'>> = {\n root: 'fai-AnimatedPlaceholder',\n placeholder: 'fai-AnimatedPlaceholder__placeholder',\n};\n\n/**\n * Styles for the root slot\n */\nconst useRootClassNames = makeResetStyles({\n overflow: 'clip',\n});\n\n/**\n * Apply styling to the AnimatedPlaceholder slots based on the state\n */\nexport const useAnimatedPlaceholderStyles_unstable = (state: AnimatedPlaceholderState): AnimatedPlaceholderState => {\n 'use no memo';\n\n const rootClassNames = useRootClassNames();\n state.root.className = mergeClasses(animatedPlaceholderClassNames.root, rootClassNames, state.root.className);\n\n if (state.placeholder) {\n state.placeholder.className = mergeClasses(animatedPlaceholderClassNames.placeholder, state.placeholder.className);\n }\n\n return state;\n};\n"],"names":["animatedPlaceholderClassNames","useAnimatedPlaceholderStyles_unstable","root","placeholder","useRootClassNames","makeResetStyles","overflow","state","rootClassNames","className","mergeClasses"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAIaA,6BAAAA;eAAAA;;IAeAC,qCAAAA;eAAAA;;;iCAnBiC;AAIvC,MAAMD,gCAA0F;IACrGE,MAAM;IACNC,aAAa;AACf;AAEA;;CAEC,GACD,MAAMC,oBAAoBC,IAAAA,gCAAAA,EAAgB;IACxCC,UAAU;AACZ;AAKO,MAAML,wCAAwC,CAACM;IACpD;IAEA,MAAMC,iBAAiBJ;IACvBG,MAAML,IAAI,CAACO,SAAS,GAAGC,IAAAA,6BAAAA,EAAaV,8BAA8BE,IAAI,EAAEM,gBAAgBD,MAAML,IAAI,CAACO,SAAS;IAE5G,IAAIF,MAAMJ,WAAW,EAAE;QACrBI,MAAMJ,WAAW,CAACM,SAAS,GAAGC,IAAAA,6BAAAA,EAAaV,8BAA8BG,WAAW,EAAEI,MAAMJ,WAAW,CAACM,SAAS;IACnH;IAEA,OAAOF;AACT"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "EditorInput", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return EditorInput;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
|
-
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
|
-
const _useEditorInput = require("./useEditorInput");
|
|
14
|
-
const _renderEditorInput = require("./renderEditorInput");
|
|
15
|
-
const _useEditorInputStylesstyles = require("./useEditorInputStyles.styles");
|
|
16
|
-
const EditorInput = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
|
|
17
|
-
const state = (0, _useEditorInput.useEditorInput_unstable)(props, ref);
|
|
18
|
-
(0, _useEditorInputStylesstyles.useEditorInputStyles_unstable)(state);
|
|
19
|
-
return (0, _renderEditorInput.renderEditorInput_unstable)(state);
|
|
20
|
-
});
|
|
21
|
-
EditorInput.displayName = 'EditorInput';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["EditorInput.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useEditorInput_unstable } from './useEditorInput';\nimport { renderEditorInput_unstable } from './renderEditorInput';\nimport { useEditorInputStyles_unstable } from './useEditorInputStyles.styles';\nimport type { EditorInputProps } from './EditorInput.types';\nimport type { ForwardRefComponent } from '@fluentui/react-components';\n\n// EditorInput component - TODO: add more docs\nexport const EditorInput: ForwardRefComponent<EditorInputProps> = React.forwardRef((props, ref) => {\n const state = useEditorInput_unstable(props, ref);\n\n useEditorInputStyles_unstable(state);\n return renderEditorInput_unstable(state);\n});\n\nEditorInput.displayName = 'EditorInput';\n"],"names":["EditorInput","React","forwardRef","props","ref","state","useEditorInput_unstable","useEditorInputStyles_unstable","renderEditorInput_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQaA;;;eAAAA;;;;iEARU;gCACiB;mCACG;4CACG;AAKvC,MAAMA,cAAAA,WAAAA,GAAqDC,OAAMC,UAAU,CAAC,CAACC,OAAOC;IACzF,MAAMC,QAAQC,IAAAA,uCAAAA,EAAwBH,OAAOC;IAE7CG,IAAAA,yDAAAA,EAA8BF;IAC9B,OAAOG,IAAAA,6CAAAA,EAA2BH;AACpC;AAEAL,YAAYS,WAAW,GAAG"}
|
|
@@ -1 +0,0 @@
|
|
|
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 * Called when the default value is given to the editor.\n * If `defaultValue` was a function, this will be called with the state of the editor after\n * calling that function.\n * If `defaultValue` was a string, this will be called with the same string.\n */\n onDefaultValueSet?: (defaultValue: string) => void;\n /**\n * Callback for when the user changes the value.\n * TODO: Add proper event type for callback\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onChange?: (ev: any, data: EditorInputValueData) => void;\n /**\n * Callback for when content is pasted into the Editor.\n */\n onPaste?: (ev: ClipboardEvent) => void;\n /**\n * When true, the input will be cleared when only whitespace is remaining.\n * @default false\n */\n trimWhiteSpace?: boolean;\n /**\n * Used to register any custom nodes used by plugins added. Can also be used to override the default nodes.\n */\n customNodes?: InitialConfigType['nodes'];\n /**\n * The plugin which is in charge of initializing Lexical and is given the `input` and `placeholder` slots\n * @default LexicalPlainTextPlugin\n */\n textPlugin?: typeof LexicalPlainTextPlugin;\n /**\n * Controls whether history is tracked to provide undo and redo functionality\n * @default true\n */\n history?: boolean;\n\n editorRef?: React.RefObject<LexicalEditor | null>;\n\n /**\n * Customize the default styles of elements inserted by Lexical in the editor.\n */\n customTheme?: InitialConfigType['theme'];\n\n /**\n * Whether or not to enable the sentinel node. The sentinel node is a node that is inserted at the end of the editor\n * The SentinelNode fixes a Safari bug in lexical versions below 0.20.1\n * @default true\n */\n isSentinelNodeEnabled?: boolean;\n};\n\n/**\n * State used in rendering EditorInput\n */\nexport type EditorInputState = ComponentState<EditorInputSlots> &\n Required<\n Pick<\n EditorInputProps,\n 'disabled' | 'textPlugin' | 'history' | 'trimWhiteSpace' | 'editorRef' | 'isSentinelNodeEnabled'\n >\n > &\n Partial<Pick<EditorInputProps, 'onPaste'>> & {\n lexicalInitialConfig: InitialConfigType;\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":"AAyFA;;CAEC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
EditorInput: function() {
|
|
13
|
-
return _EditorInput.EditorInput;
|
|
14
|
-
},
|
|
15
|
-
editorInputClassNames: function() {
|
|
16
|
-
return _useEditorInputStylesstyles.editorInputClassNames;
|
|
17
|
-
},
|
|
18
|
-
renderEditorInput_unstable: function() {
|
|
19
|
-
return _renderEditorInput.renderEditorInput_unstable;
|
|
20
|
-
},
|
|
21
|
-
useEditorInputStyles_unstable: function() {
|
|
22
|
-
return _useEditorInputStylesstyles.useEditorInputStyles_unstable;
|
|
23
|
-
},
|
|
24
|
-
useEditorInput_unstable: function() {
|
|
25
|
-
return _useEditorInput.useEditorInput_unstable;
|
|
26
|
-
},
|
|
27
|
-
useInputClassName: function() {
|
|
28
|
-
return _useEditorInputStylesstyles.useInputClassName;
|
|
29
|
-
},
|
|
30
|
-
useLexicalStyles: function() {
|
|
31
|
-
return _useEditorInputStylesstyles.useLexicalStyles;
|
|
32
|
-
},
|
|
33
|
-
usePlaceholderClassName: function() {
|
|
34
|
-
return _useEditorInputStylesstyles.usePlaceholderClassName;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
const _EditorInput = require("./EditorInput");
|
|
38
|
-
const _renderEditorInput = require("./renderEditorInput");
|
|
39
|
-
const _useEditorInput = require("./useEditorInput");
|
|
40
|
-
const _useEditorInputStylesstyles = require("./useEditorInputStyles.styles");
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export { EditorInput } from './EditorInput';\nexport type { EditorInputProps, EditorInputSlots, EditorInputState, EditorInputValueData } from './EditorInput.types';\nexport { renderEditorInput_unstable } from './renderEditorInput';\nexport { useEditorInput_unstable } from './useEditorInput';\nexport { editorInputClassNames, useEditorInputStyles_unstable, useInputClassName, useLexicalStyles, usePlaceholderClassName } from './useEditorInputStyles.styles';\n"],"names":["EditorInput","editorInputClassNames","renderEditorInput_unstable","useEditorInputStyles_unstable","useEditorInput_unstable","useInputClassName","useLexicalStyles","usePlaceholderClassName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAASA,WAAW;eAAXA,wBAAW;;IAIXC,qBAAqB;eAArBA,iDAAqB;;IAFrBC,0BAA0B;eAA1BA,6CAA0B;;IAEHC,6BAA6B;eAA7BA,yDAA6B;;IADpDC,uBAAuB;eAAvBA,uCAAuB;;IAC+BC,iBAAiB;eAAjBA,6CAAiB;;IAAEC,gBAAgB;eAAhBA,4CAAgB;;IAAEC,uBAAuB;eAAvBA,mDAAuB;;;6BAJ/F;mCAEe;gCACH;4CAC2F"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "renderEditorInput_unstable", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return renderEditorInput_unstable;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
|
|
12
|
-
const _reactcomponents = require("@fluentui/react-components");
|
|
13
|
-
const _reacttexteditor = require("@fluentui-copilot/react-text-editor");
|
|
14
|
-
const _reactchatinputplugins = require("@fluentui-copilot/react-chat-input-plugins");
|
|
15
|
-
const renderEditorInput_unstable = (state)=>{
|
|
16
|
-
(0, _reactcomponents.assertSlots)(state);
|
|
17
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(state.root, {
|
|
18
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_reacttexteditor.LexicalComposer, {
|
|
19
|
-
initialConfig: state.lexicalInitialConfig,
|
|
20
|
-
children: [
|
|
21
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(state.textPlugin, {
|
|
22
|
-
contentEditable: /*#__PURE__*/ (0, _jsxruntime.jsx)(state.input, {}),
|
|
23
|
-
ErrorBoundary: _reacttexteditor.LexicalErrorBoundary,
|
|
24
|
-
placeholder: state.placeholderValue ? /*#__PURE__*/ (0, _jsxruntime.jsx)(state.placeholderValue, {}) : null
|
|
25
|
-
}),
|
|
26
|
-
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
27
|
-
children: [
|
|
28
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactchatinputplugins.BasicFunctionalityPlugin, {
|
|
29
|
-
onContentChange: state.handleOnChange,
|
|
30
|
-
onPaste: state.onPaste,
|
|
31
|
-
trimWhitespace: state.trimWhiteSpace,
|
|
32
|
-
isSentinelNodeEnabled: state.isSentinelNodeEnabled
|
|
33
|
-
}),
|
|
34
|
-
state.history && /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacttexteditor.LexicalHistoryPlugin, {})
|
|
35
|
-
]
|
|
36
|
-
}),
|
|
37
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reacttexteditor.LexicalEditorRefPlugin, {
|
|
38
|
-
editorRef: state.editorRef
|
|
39
|
-
})
|
|
40
|
-
]
|
|
41
|
-
})
|
|
42
|
-
});
|
|
43
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
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 isSentinelNodeEnabled={state.isSentinelNodeEnabled}\n />\n {state.history && <LexicalHistoryPlugin />}\n </>\n <LexicalEditorRefPlugin editorRef={state.editorRef} />\n </LexicalComposer>\n </state.root>\n );\n};\n"],"names":["renderEditorInput_unstable","state","assertSlots","_jsx","root","_jsxs","LexicalComposer","initialConfig","lexicalInitialConfig","textPlugin","contentEditable","input","ErrorBoundary","LexicalErrorBoundary","placeholder","placeholderValue","_Fragment","BasicFunctionalityPlugin","onContentChange","handleOnChange","onPaste","trimWhitespace","trimWhiteSpace","isSentinelNodeEnabled","history","LexicalHistoryPlugin","LexicalEditorRefPlugin","editorRef"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAgBaA;;;eAAAA;;;4BAfb;iCAE4B;iCAOrB;uCACkC;AAKlC,MAAMA,6BAA6B,CAACC;IACzCC,IAAAA,4BAAAA,EAA8BD;IAE9B,OAAA,WAAA,GACEE,IAAAA,eAAA,EAACF,MAAMG,IAAI,EAAA;kBACT,WAAA,GAAAC,IAAAA,gBAAA,EAACC,gCAAAA,EAAAA;YAAgBC,eAAeN,MAAMO,oBAAoB;;8BACxDL,IAAAA,eAAA,EAACF,MAAMQ,UAAU,EAAA;oBACfC,iBAAAA,WAAAA,GAAiBP,IAAAA,eAAA,EAACF,MAAMU,KAAK,EAAA,CAAA;oBAC7BC,eAAeC,qCAAAA;oBACfC,aAAab,MAAMc,gBAAgB,GAAA,WAAA,GAAGZ,IAAAA,eAAA,EAACF,MAAMc,gBAAgB,EAAA,CAAA,KAAM;;8BAErEV,IAAAA,gBAAA,EAAAW,oBAAA,EAAA;;sCACEb,IAAAA,eAAA,EAACc,+CAAAA,EAAAA;4BACCC,iBAAiBjB,MAAMkB,cAAc;4BACrCC,SAASnB,MAAMmB,OAAO;4BACtBC,gBAAgBpB,MAAMqB,cAAc;4BACpCC,uBAAuBtB,MAAMsB,qBAAqB;;wBAEnDtB,MAAMuB,OAAO,IAAA,WAAA,GAAIrB,IAAAA,eAAA,EAACsB,qCAAAA,EAAAA,CAAAA;;;8BAErBtB,IAAAA,eAAA,EAACuB,uCAAAA,EAAAA;oBAAuBC,WAAW1B,MAAM0B,SAAS;;;;;AAI1D"}
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "useEditorInput_unstable", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return useEditorInput_unstable;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
|
-
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
|
-
const _reactcomponents = require("@fluentui/react-components");
|
|
14
|
-
const _chatinputplugins = require("@fluentui-copilot/chat-input-plugins");
|
|
15
|
-
const _reacttexteditor = require("@fluentui-copilot/react-text-editor");
|
|
16
|
-
const _reactutilities = require("@fluentui/react-utilities");
|
|
17
|
-
const useEditorInput_unstable = (props, ref)=>{
|
|
18
|
-
const { onChange, onPaste, trimWhiteSpace = false, textPlugin = _reacttexteditor.LexicalPlainTextPlugin, history = true, editorRef: userEditorRef, customTheme, isSentinelNodeEnabled = true } = props;
|
|
19
|
-
const { root, primary } = (0, _reactcomponents.getPartitionedNativeProps)({
|
|
20
|
-
primarySlotTagName: 'span',
|
|
21
|
-
props,
|
|
22
|
-
excludedPropNames: [
|
|
23
|
-
'onChange',
|
|
24
|
-
'onPaste',
|
|
25
|
-
'defaultValue'
|
|
26
|
-
]
|
|
27
|
-
});
|
|
28
|
-
const editorRef = (0, _reactcomponents.useMergedRefs)(_react.useRef(null), userEditorRef);
|
|
29
|
-
// The disabled state can also be changed by lexical (e.g. by a custom plugin) so
|
|
30
|
-
// we use `useControllableState` to coordinate
|
|
31
|
-
const [disabled, setDisabled] = (0, _reactutilities.useControllableState)({
|
|
32
|
-
state: props.disabled,
|
|
33
|
-
initialState: false
|
|
34
|
-
});
|
|
35
|
-
const customNodes = props.customNodes ? [
|
|
36
|
-
...props.customNodes,
|
|
37
|
-
_chatinputplugins.SentinelNode
|
|
38
|
-
] : [
|
|
39
|
-
_chatinputplugins.SentinelNode
|
|
40
|
-
];
|
|
41
|
-
const spanRef = _react.useCallback((span)=>{
|
|
42
|
-
var _editorRef_current;
|
|
43
|
-
(_editorRef_current = editorRef.current) === null || _editorRef_current === void 0 ? void 0 : _editorRef_current.setRootElement(span);
|
|
44
|
-
}, [
|
|
45
|
-
editorRef
|
|
46
|
-
]);
|
|
47
|
-
// Update lexical when disabled changes
|
|
48
|
-
(0, _reactcomponents.useIsomorphicLayoutEffect)(()=>{
|
|
49
|
-
if (editorRef.current) {
|
|
50
|
-
var _editorRef_current;
|
|
51
|
-
(_editorRef_current = editorRef.current) === null || _editorRef_current === void 0 ? void 0 : _editorRef_current.setEditable(!disabled);
|
|
52
|
-
}
|
|
53
|
-
}, [
|
|
54
|
-
disabled
|
|
55
|
-
]);
|
|
56
|
-
(0, _reactcomponents.useIsomorphicLayoutEffect)(()=>{
|
|
57
|
-
if (editorRef.current) {
|
|
58
|
-
var _editorRef_current;
|
|
59
|
-
return (0, _reacttexteditor.mergeRegister)(editorRef.current.registerEditableListener((isEditable)=>{
|
|
60
|
-
setDisabled(!isEditable);
|
|
61
|
-
}), (_editorRef_current = editorRef.current) === null || _editorRef_current === void 0 ? void 0 : _editorRef_current.registerRootListener((root)=>{
|
|
62
|
-
if (!root) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
// Remove lexical's inline style so we can apply our own
|
|
66
|
-
// Lexical needs the whitespace style to be either `pre` or `pre-wrap` to work correctly
|
|
67
|
-
root.style.whiteSpace = '';
|
|
68
|
-
}));
|
|
69
|
-
}
|
|
70
|
-
}, [
|
|
71
|
-
editorRef
|
|
72
|
-
]);
|
|
73
|
-
const handleOnChange = _react.useCallback((newValue)=>{
|
|
74
|
-
onChange === null || onChange === void 0 ? void 0 : onChange({}, {
|
|
75
|
-
value: newValue
|
|
76
|
-
});
|
|
77
|
-
}, [
|
|
78
|
-
onChange
|
|
79
|
-
]);
|
|
80
|
-
const defaultValueFunction = useDefaultValueFunction(props);
|
|
81
|
-
const placeholderValue = _reactcomponents.slot.optional(props.placeholderValue, {
|
|
82
|
-
elementType: 'span'
|
|
83
|
-
});
|
|
84
|
-
const placeholderId = (0, _reactcomponents.useId)('chat-input-placeholder', placeholderValue === null || placeholderValue === void 0 ? void 0 : placeholderValue.id);
|
|
85
|
-
if (placeholderValue) {
|
|
86
|
-
placeholderValue.id = placeholderId;
|
|
87
|
-
}
|
|
88
|
-
return {
|
|
89
|
-
components: {
|
|
90
|
-
root: 'span',
|
|
91
|
-
input: 'span',
|
|
92
|
-
placeholderValue: 'span'
|
|
93
|
-
},
|
|
94
|
-
root: _reactcomponents.slot.always(props.root, {
|
|
95
|
-
defaultProps: {
|
|
96
|
-
...root
|
|
97
|
-
},
|
|
98
|
-
elementType: 'span'
|
|
99
|
-
}),
|
|
100
|
-
input: _reactcomponents.slot.always(props.input, {
|
|
101
|
-
defaultProps: {
|
|
102
|
-
ref: (0, _reactcomponents.useMergedRefs)(ref, spanRef),
|
|
103
|
-
role: 'textbox',
|
|
104
|
-
contentEditable: !disabled,
|
|
105
|
-
'aria-readonly': disabled ? true : undefined,
|
|
106
|
-
disabled,
|
|
107
|
-
suppressContentEditableWarning: true,
|
|
108
|
-
tabIndex: disabled ? undefined : 0,
|
|
109
|
-
...primary,
|
|
110
|
-
'aria-describedby': primary['aria-describedby'] ? `${primary['aria-describedby']} ${placeholderId}` : placeholderId
|
|
111
|
-
},
|
|
112
|
-
elementType: 'span'
|
|
113
|
-
}),
|
|
114
|
-
placeholderValue,
|
|
115
|
-
lexicalInitialConfig: {
|
|
116
|
-
namespace: 'fai-EditorInput',
|
|
117
|
-
onError: console.error,
|
|
118
|
-
nodes: customNodes,
|
|
119
|
-
editorState: defaultValueFunction,
|
|
120
|
-
theme: customTheme
|
|
121
|
-
},
|
|
122
|
-
editorRef,
|
|
123
|
-
disabled,
|
|
124
|
-
textPlugin,
|
|
125
|
-
onPaste,
|
|
126
|
-
handleOnChange,
|
|
127
|
-
trimWhiteSpace,
|
|
128
|
-
history,
|
|
129
|
-
isSentinelNodeEnabled
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
function useDefaultValueFunction(props) {
|
|
133
|
-
var _targetDocument_defaultView;
|
|
134
|
-
const { targetDocument } = (0, _reactcomponents.useFluent)();
|
|
135
|
-
const requestAnimationFrame = targetDocument === null || targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.requestAnimationFrame;
|
|
136
|
-
const [defaultValueFunction] = _react.useState(()=>{
|
|
137
|
-
const { defaultValue, onDefaultValueSet } = props;
|
|
138
|
-
if (defaultValue === undefined) {
|
|
139
|
-
return undefined;
|
|
140
|
-
}
|
|
141
|
-
const insertDefaultValueFunction = typeof defaultValue === 'function' ? defaultValue : ()=>{
|
|
142
|
-
(0, _reacttexteditor.$insertNodes)([
|
|
143
|
-
(0, _reacttexteditor.$createTextNode)(defaultValue)
|
|
144
|
-
]);
|
|
145
|
-
};
|
|
146
|
-
// After the defaultValue function has run, read back the result and give
|
|
147
|
-
// it to the onDefaultValueSet callback.
|
|
148
|
-
const readDefaultValueFunction = onDefaultValueSet ? ()=>{
|
|
149
|
-
const text = (0, _reacttexteditor.$getRoot)().getTextContent().replace(_chatinputplugins.SENTINEL_VALUE, '');
|
|
150
|
-
// This runs while rendering `LexicalComposer` so delay calling back into the parent
|
|
151
|
-
// until after finished rendering `LexicalComposer`
|
|
152
|
-
requestAnimationFrame === null || requestAnimationFrame === void 0 ? void 0 : requestAnimationFrame(()=>{
|
|
153
|
-
onDefaultValueSet === null || onDefaultValueSet === void 0 ? void 0 : onDefaultValueSet(text);
|
|
154
|
-
});
|
|
155
|
-
} : undefined;
|
|
156
|
-
return (0, _reactutilities.mergeCallbacks)(insertDefaultValueFunction, readDefaultValueFunction);
|
|
157
|
-
});
|
|
158
|
-
return defaultValueFunction;
|
|
159
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["useEditorInput.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n getPartitionedNativeProps,\n slot,\n useFluent,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n} from '@fluentui/react-components';\nimport type { EditorInputProps, EditorInputState } from './EditorInput.types';\nimport { SentinelNode, SENTINEL_VALUE } from '@fluentui-copilot/chat-input-plugins';\nimport type { LexicalEditor } from '@fluentui-copilot/react-text-editor';\nimport { $createTextNode, $insertNodes } from '@fluentui-copilot/react-text-editor';\nimport { $getRoot } from '@fluentui-copilot/react-text-editor';\nimport { LexicalPlainTextPlugin, mergeRegister } from '@fluentui-copilot/react-text-editor';\nimport { mergeCallbacks, useControllableState } from '@fluentui/react-utilities';\n\n/**\n * Create the state required to render EditorInput.\n *\n * The returned state can be modified with hooks such as useEditorInputStyles_unstable,\n * before being passed to renderEditorInput_unstable.\n *\n * @param props - props from this instance of EditorInput\n * @param ref - reference to root HTMLElement of EditorInput\n */\nexport const useEditorInput_unstable = (props: EditorInputProps, ref: React.Ref<HTMLSpanElement>): EditorInputState => {\n const {\n onChange,\n onPaste,\n trimWhiteSpace = false,\n textPlugin = LexicalPlainTextPlugin,\n history = true,\n editorRef: userEditorRef,\n customTheme,\n isSentinelNodeEnabled = true,\n } = props;\n const { root, primary } = getPartitionedNativeProps({\n primarySlotTagName: 'span',\n props,\n excludedPropNames: ['onChange', 'onPaste', 'defaultValue'],\n });\n\n const editorRef = useMergedRefs(React.useRef<LexicalEditor>(null), userEditorRef);\n // The disabled state can also be changed by lexical (e.g. by a custom plugin) so\n // we use `useControllableState` to coordinate\n const [disabled, setDisabled] = useControllableState({\n state: props.disabled,\n initialState: false,\n });\n\n const customNodes = props.customNodes ? [...props.customNodes, SentinelNode] : [SentinelNode];\n\n const spanRef = React.useCallback(\n (span: HTMLSpanElement | null) => {\n // Register the `input` span with lexical\n editorRef.current?.setRootElement(span);\n },\n [editorRef],\n );\n\n // Update lexical when disabled changes\n useIsomorphicLayoutEffect(() => {\n if (editorRef.current) {\n editorRef.current?.setEditable(!disabled);\n }\n }, [disabled]);\n\n useIsomorphicLayoutEffect(() => {\n if (editorRef.current) {\n return mergeRegister(\n editorRef.current.registerEditableListener(isEditable => {\n setDisabled(!isEditable);\n }),\n editorRef.current?.registerRootListener(root => {\n if (!root) {\n return;\n }\n\n // Remove lexical's inline style so we can apply our own\n // Lexical needs the whitespace style to be either `pre` or `pre-wrap` to work correctly\n root.style.whiteSpace = '';\n }),\n );\n }\n }, [editorRef]);\n\n const handleOnChange = React.useCallback(\n (newValue: string) => {\n onChange?.({}, { value: newValue });\n },\n [onChange],\n );\n\n const defaultValueFunction = useDefaultValueFunction(props);\n\n const placeholderValue = slot.optional(props.placeholderValue, { elementType: 'span' });\n const placeholderId = useId('chat-input-placeholder', placeholderValue?.id);\n if (placeholderValue) {\n placeholderValue.id = placeholderId;\n }\n\n return {\n components: {\n root: 'span',\n input: 'span',\n placeholderValue: 'span',\n },\n root: slot.always(props.root, { defaultProps: { ...root }, elementType: 'span' }),\n input: slot.always(props.input, {\n defaultProps: {\n ref: useMergedRefs(ref, spanRef),\n role: 'textbox',\n contentEditable: !disabled,\n 'aria-readonly': disabled ? true : undefined,\n disabled,\n suppressContentEditableWarning: true,\n tabIndex: disabled ? undefined : 0,\n ...primary,\n 'aria-describedby': primary['aria-describedby']\n ? `${primary['aria-describedby']} ${placeholderId}`\n : placeholderId,\n },\n elementType: 'span',\n }),\n placeholderValue,\n lexicalInitialConfig: {\n namespace: 'fai-EditorInput',\n onError: console.error,\n nodes: customNodes,\n editorState: defaultValueFunction,\n theme: customTheme,\n },\n editorRef,\n disabled,\n textPlugin,\n onPaste,\n handleOnChange,\n trimWhiteSpace,\n history,\n isSentinelNodeEnabled,\n };\n};\n\nfunction useDefaultValueFunction(props: EditorInputProps) {\n const { targetDocument } = useFluent();\n const requestAnimationFrame = targetDocument?.defaultView?.requestAnimationFrame;\n\n const [defaultValueFunction] = React.useState(() => {\n const { defaultValue, onDefaultValueSet } = props;\n if (defaultValue === undefined) {\n return undefined;\n }\n\n const insertDefaultValueFunction =\n typeof defaultValue === 'function'\n ? defaultValue\n : () => {\n $insertNodes([$createTextNode(defaultValue)]);\n };\n\n // After the defaultValue function has run, read back the result and give\n // it to the onDefaultValueSet callback.\n const readDefaultValueFunction = onDefaultValueSet\n ? () => {\n const text = $getRoot().getTextContent().replace(SENTINEL_VALUE, '');\n\n // This runs while rendering `LexicalComposer` so delay calling back into the parent\n // until after finished rendering `LexicalComposer`\n requestAnimationFrame?.(() => {\n onDefaultValueSet?.(text);\n });\n }\n : undefined;\n\n return mergeCallbacks(insertDefaultValueFunction, readDefaultValueFunction);\n });\n\n return defaultValueFunction;\n}\n"],"names":["useEditorInput_unstable","props","ref","onChange","onPaste","trimWhiteSpace","textPlugin","LexicalPlainTextPlugin","history","editorRef","userEditorRef","customTheme","isSentinelNodeEnabled","root","primary","getPartitionedNativeProps","primarySlotTagName","excludedPropNames","useMergedRefs","React","useRef","disabled","setDisabled","useControllableState","state","initialState","customNodes","SentinelNode","spanRef","useCallback","span","current","setRootElement","useIsomorphicLayoutEffect","setEditable","mergeRegister","registerEditableListener","isEditable","registerRootListener","style","whiteSpace","handleOnChange","newValue","value","defaultValueFunction","useDefaultValueFunction","placeholderValue","slot","optional","elementType","placeholderId","useId","id","components","input","always","defaultProps","role","contentEditable","undefined","suppressContentEditableWarning","tabIndex","lexicalInitialConfig","namespace","onError","console","error","nodes","editorState","theme","targetDocument","useFluent","requestAnimationFrame","defaultView","useState","defaultValue","onDefaultValueSet","insertDefaultValueFunction","$insertNodes","$createTextNode","readDefaultValueFunction","text","$getRoot","getTextContent","replace","SENTINEL_VALUE","mergeCallbacks"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QAC9C;QAEN,yEAAyE;QACzE,wCAAwC;QACxC,MAAMK,2BAA2BJ,oBAC7B;YACE,MAAMK,OAAOC,IAAAA,yBAAAA,IAAWC,cAAc,GAAGC,OAAO,CAACC,gCAAAA,EAAgB;YAEjE,oFAAoF;YACpF,mDAAmD;YACnDb,0BAAAA,QAAAA,0BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,sBAAwB;gBACtBI,sBAAAA,QAAAA,sBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,kBAAoBK;YACtB;QACF,IACAtB;QAEJ,OAAO2B,IAAAA,8BAAAA,EAAeT,4BAA4BG;IACpD;IAEA,OAAOpC;AACT"}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
editorInputClassNames: function() {
|
|
13
|
-
return editorInputClassNames;
|
|
14
|
-
},
|
|
15
|
-
useEditorInputStyles_unstable: function() {
|
|
16
|
-
return useEditorInputStyles_unstable;
|
|
17
|
-
},
|
|
18
|
-
useInputClassName: function() {
|
|
19
|
-
return useInputClassName;
|
|
20
|
-
},
|
|
21
|
-
useLexicalStyles: function() {
|
|
22
|
-
return useLexicalStyles;
|
|
23
|
-
},
|
|
24
|
-
usePlaceholderClassName: function() {
|
|
25
|
-
return usePlaceholderClassName;
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
const _reactcomponents = require("@fluentui/react-components");
|
|
29
|
-
const editorInputClassNames = {
|
|
30
|
-
root: 'fai-EditorInput',
|
|
31
|
-
input: 'fai-EditorInput__input',
|
|
32
|
-
placeholderValue: 'fai-EditorInput__placeholderValue'
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Styles for the root slot
|
|
36
|
-
*/ const useRootClassName = (0, _reactcomponents.__resetStyles)("r1x54j0a", null, [
|
|
37
|
-
".r1x54j0a{display:inline-grid;white-space:pre-wrap;}"
|
|
38
|
-
]);
|
|
39
|
-
const useLexicalStyles = (0, _reactcomponents.__styles)({
|
|
40
|
-
paragraph: {
|
|
41
|
-
jrapky: 0,
|
|
42
|
-
Frg6f3: 0,
|
|
43
|
-
t21cq0: 0,
|
|
44
|
-
B6of3ja: 0,
|
|
45
|
-
B74szlk: "f1s184ao",
|
|
46
|
-
fsow6f: "fpgzoln"
|
|
47
|
-
}
|
|
48
|
-
}, {
|
|
49
|
-
d: [
|
|
50
|
-
[
|
|
51
|
-
".f1s184ao{margin:0;}",
|
|
52
|
-
{
|
|
53
|
-
p: -1
|
|
54
|
-
}
|
|
55
|
-
],
|
|
56
|
-
".fpgzoln{text-align:start;}"
|
|
57
|
-
]
|
|
58
|
-
});
|
|
59
|
-
const usePlaceholderClassName = (0, _reactcomponents.__resetStyles)("rrmx5oh", null, {
|
|
60
|
-
r: [
|
|
61
|
-
".rrmx5oh{z-index:0;grid-area:1/1/1/1;color:var(--colorNeutralForeground4);font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase300);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase300);}"
|
|
62
|
-
],
|
|
63
|
-
s: [
|
|
64
|
-
"@media (forced-colors: active){.rrmx5oh{color:GrayText;}}"
|
|
65
|
-
]
|
|
66
|
-
});
|
|
67
|
-
const useInputClassName = (0, _reactcomponents.__resetStyles)("r18fti29", null, [
|
|
68
|
-
".r18fti29{grid-area:1/1/1/1;z-index:1;width:100%;}"
|
|
69
|
-
]);
|
|
70
|
-
const useStyles = (0, _reactcomponents.__styles)({
|
|
71
|
-
placeholderDisabled: {
|
|
72
|
-
sj55zd: "f1s2aq7o"
|
|
73
|
-
}
|
|
74
|
-
}, {
|
|
75
|
-
d: [
|
|
76
|
-
".f1s2aq7o{color:var(--colorNeutralForegroundDisabled);}"
|
|
77
|
-
]
|
|
78
|
-
});
|
|
79
|
-
const useEditorInputStyles_unstable = (state)=>{
|
|
80
|
-
'use no memo';
|
|
81
|
-
const { disabled } = state;
|
|
82
|
-
const placeholderClassName = usePlaceholderClassName();
|
|
83
|
-
const rootClassName = useRootClassName();
|
|
84
|
-
const inputClassName = useInputClassName();
|
|
85
|
-
const styles = useStyles();
|
|
86
|
-
state.root.className = (0, _reactcomponents.mergeClasses)(editorInputClassNames.root, rootClassName, state.root.className);
|
|
87
|
-
state.input.className = (0, _reactcomponents.mergeClasses)(editorInputClassNames.input, inputClassName, state.input.className);
|
|
88
|
-
state.lexicalInitialConfig = {
|
|
89
|
-
...state.lexicalInitialConfig,
|
|
90
|
-
theme: {
|
|
91
|
-
...useLexicalStyles(),
|
|
92
|
-
...state.lexicalInitialConfig.theme
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
if (state.placeholderValue) {
|
|
96
|
-
state.placeholderValue.className = (0, _reactcomponents.mergeClasses)(editorInputClassNames.placeholderValue, placeholderClassName, disabled && styles.placeholderDisabled, state.placeholderValue.className);
|
|
97
|
-
}
|
|
98
|
-
return state;
|
|
99
|
-
}; //# sourceMappingURL=useEditorInputStyles.styles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["useEditorInputStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@fluentui/react-components';\nimport { tokens, typographyStyles } from '@fluentui-copilot/tokens';\nimport type { SlotClassNames } from '@fluentui/react-components';\nimport type { EditorInputSlots, EditorInputState } from './EditorInput.types';\n\nexport const editorInputClassNames: SlotClassNames<EditorInputSlots> = {\n root: 'fai-EditorInput',\n input: 'fai-EditorInput__input',\n placeholderValue: 'fai-EditorInput__placeholderValue',\n};\n\n/**\n * Styles for the root slot\n */\nconst useRootClassName = makeResetStyles({\n display: 'inline-grid',\n whiteSpace: 'pre-wrap',\n});\n\nexport const useLexicalStyles = makeStyles({\n paragraph: {\n margin: 0,\n textAlign: 'start',\n },\n});\n\nexport const usePlaceholderClassName = makeResetStyles({\n zIndex: 0,\n gridArea: '1 / 1 / 1 / 1',\n\n color: tokens.colorNeutralForeground4,\n ...typographyStyles.body1,\n\n '@media (forced-colors: active)': {\n color: 'GrayText',\n },\n});\n\nexport const useInputClassName = makeResetStyles({\n gridArea: '1 / 1 / 1 / 1',\n zIndex: 1,\n width: '100%',\n});\n\nconst useStyles = makeStyles({\n placeholderDisabled: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n});\n/**\n * Apply styling to the EditorInput slots based on the state\n */\nexport const useEditorInputStyles_unstable = (state: EditorInputState): EditorInputState => {\n 'use no memo';\n\n const { disabled } = state;\n const placeholderClassName = usePlaceholderClassName();\n const rootClassName = useRootClassName();\n const inputClassName = useInputClassName();\n const styles = useStyles();\n\n state.root.className = mergeClasses(editorInputClassNames.root, rootClassName, state.root.className);\n\n state.input.className = mergeClasses(editorInputClassNames.input, inputClassName, state.input.className);\n\n 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","color","root","input","placeholderValue","display","__resetStyles","__styles","paragraph","jrapky","margin","textAlign","B74szlk","fsow6f","s","zIndex","sj55zd","disabled","rootClassName","state","placeholderClassName","useStyles","useRootClassName","useInputClassName","lexicalInitialConfig","className","theme","mergeClasses","inputClassName","useLexicalStyles","styles","placeholderDisabled"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","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