@fluentui-copilot/react-prompt-listbox 0.10.2 → 0.10.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.json CHANGED
@@ -2,7 +2,22 @@
2
2
  "name": "@fluentui-copilot/react-prompt-listbox",
3
3
  "entries": [
4
4
  {
5
- "date": "Tue, 01 Jul 2025 14:43:47 GMT",
5
+ "date": "Thu, 17 Jul 2025 17:49:25 GMT",
6
+ "tag": "@fluentui-copilot/react-prompt-listbox_v0.10.3",
7
+ "version": "0.10.3",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "hochelmartin@gmail.com",
12
+ "package": "@fluentui-copilot/react-prompt-listbox",
13
+ "commit": "fef5160c07333e8d9996952a305b34e357604919",
14
+ "comment": "feat: enable griffel raw styles"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Tue, 01 Jul 2025 14:45:29 GMT",
6
21
  "tag": "@fluentui-copilot/react-prompt-listbox_v0.10.2",
7
22
  "version": "0.10.2",
8
23
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,21 @@
1
1
  # Change Log - @fluentui-copilot/react-prompt-listbox
2
2
 
3
- This log was last generated on Tue, 01 Jul 2025 14:43:47 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 17 Jul 2025 17:49:25 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [0.10.3](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-prompt-listbox_v0.10.3)
8
+
9
+ Thu, 17 Jul 2025 17:49:25 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-prompt-listbox_v0.10.2..@fluentui-copilot/react-prompt-listbox_v0.10.3)
11
+
12
+ ### Patches
13
+
14
+ - feat: enable griffel raw styles ([PR #3227](https://github.com/microsoft/fluentai/pull/3227) by hochelmartin@gmail.com)
15
+
7
16
  ## [0.10.2](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-prompt-listbox_v0.10.2)
8
17
 
9
- Tue, 01 Jul 2025 14:43:47 GMT
18
+ Tue, 01 Jul 2025 14:45:29 GMT
10
19
  [Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-prompt-listbox_v0.10.0..@fluentui-copilot/react-prompt-listbox_v0.10.2)
11
20
 
12
21
  ### Patches
@@ -1,53 +1,55 @@
1
1
  import { createPresenceComponent, motionTokens } from '@fluentui/react-components';
2
- const collapseMotion = ({
3
- element
4
- }) => {
5
- const fromOpacity = 0;
6
- const toOpacity = 1;
7
- const fromHeight = '0';
8
- const toHeight = `${element.scrollHeight}px`;
9
- const overflow = 'hidden';
10
- const duration = motionTokens.durationNormal;
11
- const easing = motionTokens.curveEasyEaseMax;
12
- const enterKeyframes = [{
13
- opacity: fromOpacity,
14
- maxHeight: fromHeight,
15
- overflow
16
- },
17
- // Transition to the height of the content, at 99.99% of the duration.
18
- {
19
- opacity: toOpacity,
20
- maxHeight: toHeight,
21
- offset: 0.9999,
22
- overflow
23
- },
24
- // On completion, remove the maxHeight because the content might need to expand later.
25
- {
26
- opacity: toOpacity,
27
- maxHeight: 'unset',
28
- overflow
29
- }];
30
- const exitKeyframes = [{
31
- opacity: toOpacity,
32
- maxHeight: toHeight,
33
- overflow
34
- }, {
35
- opacity: fromOpacity,
36
- maxHeight: fromHeight,
37
- overflow
38
- }];
39
- return {
40
- enter: {
41
- duration,
42
- easing,
43
- keyframes: enterKeyframes
44
- },
45
- exit: {
46
- duration,
47
- easing,
48
- keyframes: exitKeyframes
49
- }
50
- };
2
+ const collapseMotion = ({ element })=>{
3
+ const fromOpacity = 0;
4
+ const toOpacity = 1;
5
+ const fromHeight = '0';
6
+ const toHeight = `${element.scrollHeight}px`;
7
+ const overflow = 'hidden';
8
+ const duration = motionTokens.durationNormal;
9
+ const easing = motionTokens.curveEasyEaseMax;
10
+ const enterKeyframes = [
11
+ {
12
+ opacity: fromOpacity,
13
+ maxHeight: fromHeight,
14
+ overflow
15
+ },
16
+ // Transition to the height of the content, at 99.99% of the duration.
17
+ {
18
+ opacity: toOpacity,
19
+ maxHeight: toHeight,
20
+ offset: 0.9999,
21
+ overflow
22
+ },
23
+ // On completion, remove the maxHeight because the content might need to expand later.
24
+ {
25
+ opacity: toOpacity,
26
+ maxHeight: 'unset',
27
+ overflow
28
+ }
29
+ ];
30
+ const exitKeyframes = [
31
+ {
32
+ opacity: toOpacity,
33
+ maxHeight: toHeight,
34
+ overflow
35
+ },
36
+ {
37
+ opacity: fromOpacity,
38
+ maxHeight: fromHeight,
39
+ overflow
40
+ }
41
+ ];
42
+ return {
43
+ enter: {
44
+ duration,
45
+ easing,
46
+ keyframes: enterKeyframes
47
+ },
48
+ exit: {
49
+ duration,
50
+ easing,
51
+ keyframes: exitKeyframes
52
+ }
53
+ };
51
54
  };
52
55
  export const PromptListboxMotion = createPresenceComponent(collapseMotion);
53
- //# sourceMappingURL=PromptListboxMotion.js.map
@@ -1,28 +1,26 @@
1
1
  // Brought from Fluent UI
2
2
  import { resolvePositioningShorthand, usePositioning } from '@fluentui/react-positioning';
3
3
  export function useListboxPositioning(props) {
4
- const {
5
- positioning,
6
- fluid
7
- } = props;
8
- const fallbackPositions = ['below'];
9
- // popper options
10
- const popperOptions = {
11
- position: 'below',
12
- align: 'start',
13
- offset: {
14
- crossAxis: 0,
15
- mainAxis: 2
16
- },
17
- fallbackPositions: fallbackPositions,
18
- matchTargetSize: fluid ? 'width' : undefined,
19
- autoSize: true,
20
- ...resolvePositioningShorthand(positioning)
21
- };
22
- const {
23
- containerRef: listboxRef,
24
- targetRef: anchorRef
25
- } = usePositioning(popperOptions);
26
- return [listboxRef, anchorRef];
4
+ const { positioning, fluid } = props;
5
+ const fallbackPositions = [
6
+ 'below'
7
+ ];
8
+ // popper options
9
+ const popperOptions = {
10
+ position: 'below',
11
+ align: 'start',
12
+ offset: {
13
+ crossAxis: 0,
14
+ mainAxis: 2
15
+ },
16
+ fallbackPositions: fallbackPositions,
17
+ matchTargetSize: fluid ? 'width' : undefined,
18
+ autoSize: true,
19
+ ...resolvePositioningShorthand(positioning)
20
+ };
21
+ const { containerRef: listboxRef, targetRef: anchorRef } = usePositioning(popperOptions);
22
+ return [
23
+ listboxRef,
24
+ anchorRef
25
+ ];
27
26
  }
28
- //# sourceMappingURL=useListboxPositioning.js.map
@@ -6,134 +6,119 @@ import { CursorPositionPlugin } from '../../plugins/CursorPositionPlugin';
6
6
  import { useListboxPositioning } from './useListboxPositioning';
7
7
  import { Portal } from '@fluentui/react-components';
8
8
  export function usePromptListboxFunctionality(params) {
9
- var _params_listboxProps, _params_listboxProps1;
10
- const {
11
- fluid = false,
12
- allowArrowUpNavigation = false,
13
- onSelectionModeChange
14
- } = params;
15
- const [open, setOpen] = useControllableState({
16
- state: params.open,
17
- defaultState: params.defaultOpen,
18
- initialState: false
19
- });
20
- const [cursorPosition, setCursorPosition] = React.useState('end');
21
- const overrideActionHandler = (e, {
22
- activeOption,
23
- action,
24
- activeDescendantController,
25
- isInSelectionMode
26
- }) => {
27
- var _params_overrideActionHandler;
28
- const atStart = allowArrowUpNavigation && (cursorPosition === 'start' || cursorPosition === 'start-end');
29
- const atEnd = cursorPosition === 'end' || cursorPosition === 'start-end';
30
- let newAction = undefined;
31
- let newIsInSelection = undefined;
32
- const firstOption = activeDescendantController.first({
33
- passive: true
9
+ var _params_listboxProps, _params_listboxProps1;
10
+ const { fluid = false, allowArrowUpNavigation = false, onSelectionModeChange } = params;
11
+ const [open, setOpen] = useControllableState({
12
+ state: params.open,
13
+ defaultState: params.defaultOpen,
14
+ initialState: false
34
15
  });
35
- switch (action) {
36
- case 'Next':
37
- if (!isInSelectionMode && !atEnd) {
38
- newAction = 'Type';
39
- newIsInSelection = false;
16
+ const [cursorPosition, setCursorPosition] = React.useState('end');
17
+ const overrideActionHandler = (e, { activeOption, action, activeDescendantController, isInSelectionMode })=>{
18
+ var _params_overrideActionHandler;
19
+ const atStart = allowArrowUpNavigation && (cursorPosition === 'start' || cursorPosition === 'start-end');
20
+ const atEnd = cursorPosition === 'end' || cursorPosition === 'start-end';
21
+ let newAction = undefined;
22
+ let newIsInSelection = undefined;
23
+ const firstOption = activeDescendantController.first({
24
+ passive: true
25
+ });
26
+ switch(action){
27
+ case 'Next':
28
+ if (!isInSelectionMode && !atEnd) {
29
+ newAction = 'Type';
30
+ newIsInSelection = false;
31
+ }
32
+ break;
33
+ case 'Previous':
34
+ if (!isInSelectionMode && !atStart) {
35
+ newAction = 'Type';
36
+ newIsInSelection = false;
37
+ } else if (isInSelectionMode && !allowArrowUpNavigation && atEnd && activeOption !== undefined && activeOption.id === firstOption) {
38
+ newAction = 'Type';
39
+ newIsInSelection = false;
40
+ e.preventDefault();
41
+ }
42
+ break;
43
+ case 'First':
44
+ case 'Last':
45
+ case 'PageDown':
46
+ case 'PageUp':
47
+ if (!isInSelectionMode) {
48
+ newAction = 'Type';
49
+ newIsInSelection = false;
50
+ }
51
+ break;
40
52
  }
41
- break;
42
- case 'Previous':
43
- if (!isInSelectionMode && !atStart) {
44
- newAction = 'Type';
45
- newIsInSelection = false;
46
- } else if (isInSelectionMode && !allowArrowUpNavigation && atEnd && activeOption !== undefined && activeOption.id === firstOption) {
47
- newAction = 'Type';
48
- newIsInSelection = false;
49
- e.preventDefault();
50
- }
51
- break;
52
- case 'First':
53
- case 'Last':
54
- case 'PageDown':
55
- case 'PageUp':
56
- if (!isInSelectionMode) {
57
- newAction = 'Type';
58
- newIsInSelection = false;
53
+ const userOverrides = (_params_overrideActionHandler = params.overrideActionHandler) === null || _params_overrideActionHandler === void 0 ? void 0 : _params_overrideActionHandler.call(params, e, {
54
+ activeOption,
55
+ action,
56
+ activeDescendantController,
57
+ isInSelectionMode
58
+ });
59
+ return {
60
+ action: newAction,
61
+ isInSelectionMode: newIsInSelection,
62
+ ...userOverrides
63
+ };
64
+ };
65
+ const baseListboxFunctionality = useInputListboxFunctionality({
66
+ ...params,
67
+ onSelectionModeChange,
68
+ overrideActionHandler
69
+ });
70
+ const { onBlur: baseOnBlur, onKeyDown: baseOnKeyDown, ref: triggerRef, isInSelectionMode } = baseListboxFunctionality.triggerProps;
71
+ const onFocus = (event)=>{
72
+ if (event.target === event.currentTarget) {
73
+ var _params_onOpenChange;
74
+ setOpen(true);
75
+ (_params_onOpenChange = params.onOpenChange) === null || _params_onOpenChange === void 0 ? void 0 : _params_onOpenChange.call(params, event, {
76
+ event,
77
+ type: 'focus',
78
+ open: true
79
+ });
59
80
  }
60
- break;
61
- }
62
- const userOverrides = (_params_overrideActionHandler = params.overrideActionHandler) === null || _params_overrideActionHandler === void 0 ? void 0 : _params_overrideActionHandler.call(params, e, {
63
- activeOption,
64
- action,
65
- activeDescendantController,
66
- isInSelectionMode
81
+ };
82
+ const onBlur = useEventCallback(mergeCallbacks(baseOnBlur, (e)=>{
83
+ var _params_onOpenChange;
84
+ setOpen(false);
85
+ (_params_onOpenChange = params.onOpenChange) === null || _params_onOpenChange === void 0 ? void 0 : _params_onOpenChange.call(params, e, {
86
+ event: e,
87
+ type: 'focus',
88
+ open: false
89
+ });
90
+ }));
91
+ const [listboxRef, anchorRef] = useListboxPositioning({
92
+ fluid,
93
+ positioning: params.positioning
67
94
  });
95
+ const listboxId = useId('prompt-listbox', (_params_listboxProps = params.listboxProps) === null || _params_listboxProps === void 0 ? void 0 : _params_listboxProps.id);
96
+ const cursorPositionPlugin = /*#__PURE__*/ React.createElement(CursorPositionPlugin, {
97
+ setCursorPosition: setCursorPosition
98
+ });
99
+ const innerListbox = /*#__PURE__*/ React.createElement(InputListbox, {
100
+ ...params.listboxProps,
101
+ ...baseListboxFunctionality.inputListboxProps,
102
+ id: listboxId,
103
+ ref: useMergedRefs(baseListboxFunctionality.inputListboxProps.ref, listboxRef, (_params_listboxProps1 = params.listboxProps) === null || _params_listboxProps1 === void 0 ? void 0 : _params_listboxProps1.ref)
104
+ });
105
+ const listbox = /*#__PURE__*/ React.createElement(PromptListboxMotion, {
106
+ visible: open
107
+ }, /*#__PURE__*/ React.createElement("span", {
108
+ "aria-owns": open ? listboxId : undefined
109
+ }, open && (params.inline ? innerListbox : /*#__PURE__*/ React.createElement(Portal, {
110
+ mountNode: params.mountNode
111
+ }, innerListbox))));
68
112
  return {
69
- action: newAction,
70
- isInSelectionMode: newIsInSelection,
71
- ...userOverrides
113
+ promptListbox: listbox,
114
+ cursorPositionPlugin,
115
+ triggerProps: {
116
+ ref: triggerRef,
117
+ isInSelectionMode,
118
+ onFocus,
119
+ onKeyDown: baseOnKeyDown,
120
+ onBlur
121
+ },
122
+ containerRef: anchorRef
72
123
  };
73
- };
74
- const baseListboxFunctionality = useInputListboxFunctionality({
75
- ...params,
76
- onSelectionModeChange,
77
- overrideActionHandler
78
- });
79
- const {
80
- onBlur: baseOnBlur,
81
- onKeyDown: baseOnKeyDown,
82
- ref: triggerRef,
83
- isInSelectionMode
84
- } = baseListboxFunctionality.triggerProps;
85
- const onFocus = event => {
86
- if (event.target === event.currentTarget) {
87
- var _params_onOpenChange;
88
- setOpen(true);
89
- (_params_onOpenChange = params.onOpenChange) === null || _params_onOpenChange === void 0 ? void 0 : _params_onOpenChange.call(params, event, {
90
- event,
91
- type: 'focus',
92
- open: true
93
- });
94
- }
95
- };
96
- const onBlur = useEventCallback(mergeCallbacks(baseOnBlur, e => {
97
- var _params_onOpenChange;
98
- setOpen(false);
99
- (_params_onOpenChange = params.onOpenChange) === null || _params_onOpenChange === void 0 ? void 0 : _params_onOpenChange.call(params, e, {
100
- event: e,
101
- type: 'focus',
102
- open: false
103
- });
104
- }));
105
- const [listboxRef, anchorRef] = useListboxPositioning({
106
- fluid,
107
- positioning: params.positioning
108
- });
109
- const listboxId = useId('prompt-listbox', (_params_listboxProps = params.listboxProps) === null || _params_listboxProps === void 0 ? void 0 : _params_listboxProps.id);
110
- const cursorPositionPlugin = /*#__PURE__*/React.createElement(CursorPositionPlugin, {
111
- setCursorPosition: setCursorPosition
112
- });
113
- const innerListbox = /*#__PURE__*/React.createElement(InputListbox, {
114
- ...params.listboxProps,
115
- ...baseListboxFunctionality.inputListboxProps,
116
- id: listboxId,
117
- ref: useMergedRefs(baseListboxFunctionality.inputListboxProps.ref, listboxRef, (_params_listboxProps1 = params.listboxProps) === null || _params_listboxProps1 === void 0 ? void 0 : _params_listboxProps1.ref)
118
- });
119
- const listbox = /*#__PURE__*/React.createElement(PromptListboxMotion, {
120
- visible: open
121
- }, /*#__PURE__*/React.createElement("span", {
122
- "aria-owns": open ? listboxId : undefined
123
- }, open && (params.inline ? innerListbox : /*#__PURE__*/React.createElement(Portal, {
124
- mountNode: params.mountNode
125
- }, innerListbox))));
126
- return {
127
- promptListbox: listbox,
128
- cursorPositionPlugin,
129
- triggerProps: {
130
- ref: triggerRef,
131
- isInSelectionMode,
132
- onFocus,
133
- onKeyDown: baseOnKeyDown,
134
- onBlur
135
- },
136
- containerRef: anchorRef
137
- };
138
124
  }
139
- //# sourceMappingURL=usePromptListboxFunctionalityV2.js.map
package/lib/index.js CHANGED
@@ -1,3 +1,2 @@
1
1
  export { usePromptListboxFunctionality } from './components/utils/usePromptListboxFunctionalityV2';
2
2
  export { Option, optionClassNames, renderOption_unstable, useOption_unstable, useInputListboxOptionStyles_unstable } from '@fluentui-copilot/react-input-listbox';
3
- //# sourceMappingURL=index.js.map
@@ -1,43 +1,43 @@
1
1
  import { $isSentinelNode } from '@fluentui-copilot/chat-input-plugins';
2
2
  import { SELECTION_CHANGE_COMMAND, $getSelection, useLexicalComposerContext, $isRangeSelection, $isElementNode, COMMAND_PRIORITY_HIGH } from '@fluentui-copilot/react-text-editor';
3
3
  import * as React from 'react';
4
- export const CursorPositionPlugin = ({
5
- setCursorPosition
6
- }) => {
7
- const [editor] = useLexicalComposerContext();
8
- React.useEffect(() => {
9
- const $selectionChangeHandler = () => {
10
- const selection = $getSelection();
11
- // If selection is null, the cursor is not active in the editor and we should just noop
12
- if (selection === null || !$isRangeSelection(selection) || !selection.isCollapsed()) {
13
- setCursorPosition('between-text');
14
- return false;
15
- }
16
- // Should only be one node in the selection because the selection is collapsed
17
- const selectedNode = selection.getNodes().at(0);
18
- // If there's no selected node, focus isn't in the editor
19
- if (!selectedNode) {
20
- return false;
21
- }
22
- // If there are no leaf nodes, the paragraph node will be selected
23
- if ($isElementNode(selectedNode)) {
24
- setCursorPosition('start-end');
25
- return false;
26
- } else if ($isSentinelNode(selectedNode) && !selectedNode.getNextSibling()) {
27
- setCursorPosition('end');
28
- return false;
29
- } else if ($isSentinelNode(selectedNode.getNextSibling()) && selection.focus.offset === selectedNode.getTextContentSize()) {
30
- setCursorPosition('end');
31
- return false;
32
- } else if (selectedNode.getPreviousSibling() === null && selection.focus.offset === 0) {
33
- setCursorPosition('start');
34
- return false;
35
- }
36
- setCursorPosition('between-text');
37
- return false;
38
- };
39
- return editor.registerCommand(SELECTION_CHANGE_COMMAND, $selectionChangeHandler, COMMAND_PRIORITY_HIGH);
40
- }, [editor, setCursorPosition]);
41
- return null;
4
+ export const CursorPositionPlugin = ({ setCursorPosition })=>{
5
+ const [editor] = useLexicalComposerContext();
6
+ React.useEffect(()=>{
7
+ const $selectionChangeHandler = ()=>{
8
+ const selection = $getSelection();
9
+ // If selection is null, the cursor is not active in the editor and we should just noop
10
+ if (selection === null || !$isRangeSelection(selection) || !selection.isCollapsed()) {
11
+ setCursorPosition('between-text');
12
+ return false;
13
+ }
14
+ // Should only be one node in the selection because the selection is collapsed
15
+ const selectedNode = selection.getNodes().at(0);
16
+ // If there's no selected node, focus isn't in the editor
17
+ if (!selectedNode) {
18
+ return false;
19
+ }
20
+ // If there are no leaf nodes, the paragraph node will be selected
21
+ if ($isElementNode(selectedNode)) {
22
+ setCursorPosition('start-end');
23
+ return false;
24
+ } else if ($isSentinelNode(selectedNode) && !selectedNode.getNextSibling()) {
25
+ setCursorPosition('end');
26
+ return false;
27
+ } else if ($isSentinelNode(selectedNode.getNextSibling()) && selection.focus.offset === selectedNode.getTextContentSize()) {
28
+ setCursorPosition('end');
29
+ return false;
30
+ } else if (selectedNode.getPreviousSibling() === null && selection.focus.offset === 0) {
31
+ setCursorPosition('start');
32
+ return false;
33
+ }
34
+ setCursorPosition('between-text');
35
+ return false;
36
+ };
37
+ return editor.registerCommand(SELECTION_CHANGE_COMMAND, $selectionChangeHandler, COMMAND_PRIORITY_HIGH);
38
+ }, [
39
+ editor,
40
+ setCursorPosition
41
+ ]);
42
+ return null;
42
43
  };
43
- //# sourceMappingURL=CursorPositionPlugin.js.map
@@ -62,4 +62,4 @@ const collapseMotion = ({ element })=>{
62
62
  }
63
63
  };
64
64
  };
65
- const PromptListboxMotion = (0, _reactcomponents.createPresenceComponent)(collapseMotion); //# sourceMappingURL=PromptListboxMotion.js.map
65
+ const PromptListboxMotion = (0, _reactcomponents.createPresenceComponent)(collapseMotion);
@@ -1 +1 @@
1
- {"version":3,"sources":["PromptListboxMotion.ts"],"sourcesContent":["import { createPresenceComponent, motionTokens } from '@fluentui/react-components';\nimport type { PresenceMotionFn } from '@fluentui/react-components';\n\nconst collapseMotion: PresenceMotionFn = ({ element }) => {\n const fromOpacity = 0;\n const toOpacity = 1;\n const fromHeight = '0';\n const toHeight = `${element.scrollHeight}px`;\n const overflow = 'hidden';\n\n const duration = motionTokens.durationNormal;\n const easing = motionTokens.curveEasyEaseMax;\n\n const enterKeyframes = [\n { opacity: fromOpacity, maxHeight: fromHeight, overflow },\n // Transition to the height of the content, at 99.99% of the duration.\n { opacity: toOpacity, maxHeight: toHeight, offset: 0.9999, overflow },\n // On completion, remove the maxHeight because the content might need to expand later.\n { opacity: toOpacity, maxHeight: 'unset', overflow },\n ];\n\n const exitKeyframes = [\n { opacity: toOpacity, maxHeight: toHeight, overflow },\n { opacity: fromOpacity, maxHeight: fromHeight, overflow },\n ];\n\n return {\n enter: { duration, easing, keyframes: enterKeyframes },\n exit: { duration, easing, keyframes: exitKeyframes },\n };\n};\n\nexport const PromptListboxMotion: ReturnType<typeof createPresenceComponent<{}>> =\n createPresenceComponent(collapseMotion);\n"],"names":["PromptListboxMotion","collapseMotion","fromOpacity","fromHeight","toOpacity","toHeight","duration","motionTokens","durationNormal","overflow","enterKeyframes","easing","curveEasyEaseMax","maxHeight","offset","exitKeyframes","opacity","createPresenceComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BA4BuDA;;;eAAAA;;;iCA5BD;AAGtD,MAAMC,iBAAmC,CAAC,SACxC;UAEAC,cAAMC;UACNC,YAAMC;UACNF,aAAiB;UAEjBE,WAAMC,CAAAA,EAAWC,QAAAA,YAAaC,CAAAA,EAAAA,CAAAA;UAC9BC,WAAeF;UAEfD,WAAMI,6BAAiB,CAAAF,cAAA;UACrBG,SAAAJ,6BAAA,CAAAK,gBAAA;2BAAWV;QAAAA;qBAAaW;uBAAuBJ;;;8EAE/C;;qBAAsBI;uBAAqBC;oBAAgBL;;;8FAE3D;;qBAAsBI;uBAAoBJ;;;;UAG5CM,gBAAMA;QAAAA;qBACJX;uBAAEY;;;;qBAAkDd;uBACpDC;;;;;eAAwD;YACzDG;YAEDK;uBACSD;;;;;uBACDK;;;;MAA6Cf,sBAAAiB,IAAAA,wCAAA,EAAAhB,gEACrD"}
1
+ {"version":3,"sources":["PromptListboxMotion.ts"],"sourcesContent":["import { createPresenceComponent, motionTokens } from '@fluentui/react-components';\nimport type { PresenceMotionFn } from '@fluentui/react-components';\n\nconst collapseMotion: PresenceMotionFn = ({ element }) => {\n const fromOpacity = 0;\n const toOpacity = 1;\n const fromHeight = '0';\n const toHeight = `${element.scrollHeight}px`;\n const overflow = 'hidden';\n\n const duration = motionTokens.durationNormal;\n const easing = motionTokens.curveEasyEaseMax;\n\n const enterKeyframes = [\n { opacity: fromOpacity, maxHeight: fromHeight, overflow },\n // Transition to the height of the content, at 99.99% of the duration.\n { opacity: toOpacity, maxHeight: toHeight, offset: 0.9999, overflow },\n // On completion, remove the maxHeight because the content might need to expand later.\n { opacity: toOpacity, maxHeight: 'unset', overflow },\n ];\n\n const exitKeyframes = [\n { opacity: toOpacity, maxHeight: toHeight, overflow },\n { opacity: fromOpacity, maxHeight: fromHeight, overflow },\n ];\n\n return {\n enter: { duration, easing, keyframes: enterKeyframes },\n exit: { duration, easing, keyframes: exitKeyframes },\n };\n};\n\nexport const PromptListboxMotion: ReturnType<typeof createPresenceComponent<{}>> =\n createPresenceComponent(collapseMotion);\n"],"names":["PromptListboxMotion","collapseMotion","element","fromOpacity","toOpacity","fromHeight","toHeight","scrollHeight","overflow","duration","motionTokens","durationNormal","easing","curveEasyEaseMax","enterKeyframes","opacity","maxHeight","offset","exitKeyframes","enter","keyframes","exit","createPresenceComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAgCaA;;;eAAAA;;;iCAhCyC;AAGtD,MAAMC,iBAAmC,CAAC,EAAEC,OAAO,EAAE;IACnD,MAAMC,cAAc;IACpB,MAAMC,YAAY;IAClB,MAAMC,aAAa;IACnB,MAAMC,WAAW,CAAC,EAAEJ,QAAQK,YAAY,CAAC,EAAE,CAAC;IAC5C,MAAMC,WAAW;IAEjB,MAAMC,WAAWC,6BAAAA,CAAaC,cAAc;IAC5C,MAAMC,SAASF,6BAAAA,CAAaG,gBAAgB;IAE5C,MAAMC,iBAAiB;QACrB;YAAEC,SAASZ;YAAaa,WAAWX;YAAYG;QAAS;QACxD,sEAAsE;QACtE;YAAEO,SAASX;YAAWY,WAAWV;YAAUW,QAAQ;YAAQT;QAAS;QACpE,sFAAsF;QACtF;YAAEO,SAASX;YAAWY,WAAW;YAASR;QAAS;KACpD;IAED,MAAMU,gBAAgB;QACpB;YAAEH,SAASX;YAAWY,WAAWV;YAAUE;QAAS;QACpD;YAAEO,SAASZ;YAAaa,WAAWX;YAAYG;QAAS;KACzD;IAED,OAAO;QACLW,OAAO;YAAEV;YAAUG;YAAQQ,WAAWN;QAAe;QACrDO,MAAM;YAAEZ;YAAUG;YAAQQ,WAAWF;QAAc;IACrD;AACF;AAEO,MAAMlB,sBACXsB,IAAAA,wCAAAA,EAAwBrB"}
@@ -33,4 +33,4 @@ function useListboxPositioning(props) {
33
33
  listboxRef,
34
34
  anchorRef
35
35
  ];
36
- } //# sourceMappingURL=useListboxPositioning.js.map
36
+ }
@@ -1 +1 @@
1
- {"version":3,"sources":["useListboxPositioning.ts"],"sourcesContent":["// Brought from Fluent UI\n\nimport { resolvePositioningShorthand, usePositioning } from '@fluentui/react-positioning';\nimport type * as React from 'react';\nimport type { UsePromptListboxFunctionalityParams } from './usePromptListboxFunctionalityV2';\nimport type { PositioningShorthandValue } from '@fluentui/react-positioning';\n\nexport function useListboxPositioning<AnchorElementType extends HTMLElement = HTMLSpanElement>(\n props: Pick<UsePromptListboxFunctionalityParams, 'fluid' | 'positioning'>,\n): [listboxRef: React.RefObject<HTMLSpanElement>, anchorRef: React.RefObject<AnchorElementType>] {\n const { positioning, fluid } = props;\n\n const fallbackPositions: PositioningShorthandValue[] = ['below'];\n\n // popper options\n const popperOptions = {\n position: 'below' as const,\n align: 'start' as const,\n offset: { crossAxis: 0, mainAxis: 2 },\n fallbackPositions: fallbackPositions,\n matchTargetSize: fluid ? ('width' as const) : undefined,\n autoSize: true,\n ...resolvePositioningShorthand(positioning),\n };\n\n const { containerRef: listboxRef, targetRef: anchorRef } = usePositioning(popperOptions);\n\n return [listboxRef, anchorRef];\n}\n"],"names":["useListboxPositioning","props","positioning","fallbackPositions","popperOptions","position","align","offset","crossAxis","mainAxis","matchTargetSize","fluid","undefined","resolvePositioningShorthand","listboxRef","anchorRef","usePositioning"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,yBAAyB;;;;;+BAOTA;;;eAAAA;;;kCAL4C;AAKrD,SAASA,sBACdC,KAAyE;UAEzE,EAEAC,WAAMC,OAAkD,KAAQF;UAEhEE,oBAAiB;QAAA;KAAA;qBACXC;UACJC,gBAAU;kBACVC;eACAC;gBAAUC;uBAAcC;sBAAY;;2BAEpCC;yBACUC,QAAA,UAAAC;kBACPC;QACL,GAAAA,IAAAA,6CAAA,EAAAX,YAAA;;UAIA,gBAAQY,UAAAA,aAAYC,SAAAA,KAAUC,IAAAA,gCAAA,EAAAZ;IAChC,OAAA;QAAAU;QAAAC;KAAA"}
1
+ {"version":3,"sources":["useListboxPositioning.ts"],"sourcesContent":["// Brought from Fluent UI\n\nimport { resolvePositioningShorthand, usePositioning } from '@fluentui/react-positioning';\nimport type * as React from 'react';\nimport type { UsePromptListboxFunctionalityParams } from './usePromptListboxFunctionalityV2';\nimport type { PositioningShorthandValue } from '@fluentui/react-positioning';\n\nexport function useListboxPositioning<AnchorElementType extends HTMLElement = HTMLSpanElement>(\n props: Pick<UsePromptListboxFunctionalityParams, 'fluid' | 'positioning'>,\n): [listboxRef: React.RefObject<HTMLSpanElement>, anchorRef: React.RefObject<AnchorElementType>] {\n const { positioning, fluid } = props;\n\n const fallbackPositions: PositioningShorthandValue[] = ['below'];\n\n // popper options\n const popperOptions = {\n position: 'below' as const,\n align: 'start' as const,\n offset: { crossAxis: 0, mainAxis: 2 },\n fallbackPositions: fallbackPositions,\n matchTargetSize: fluid ? ('width' as const) : undefined,\n autoSize: true,\n ...resolvePositioningShorthand(positioning),\n };\n\n const { containerRef: listboxRef, targetRef: anchorRef } = usePositioning(popperOptions);\n\n return [listboxRef, anchorRef];\n}\n"],"names":["useListboxPositioning","props","positioning","fluid","fallbackPositions","popperOptions","position","align","offset","crossAxis","mainAxis","matchTargetSize","undefined","autoSize","resolvePositioningShorthand","containerRef","listboxRef","targetRef","anchorRef","usePositioning"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,yBAAyB;;;;;+BAOTA;;;eAAAA;;;kCAL4C;AAKrD,SAASA,sBACdC,KAAyE;IAEzE,MAAM,EAAEC,WAAW,EAAEC,KAAK,EAAE,GAAGF;IAE/B,MAAMG,oBAAiD;QAAC;KAAQ;IAEhE,iBAAiB;IACjB,MAAMC,gBAAgB;QACpBC,UAAU;QACVC,OAAO;QACPC,QAAQ;YAAEC,WAAW;YAAGC,UAAU;QAAE;QACpCN,mBAAmBA;QACnBO,iBAAiBR,QAAS,UAAoBS;QAC9CC,UAAU;QACV,GAAGC,IAAAA,6CAAAA,EAA4BZ,YAAY;IAC7C;IAEA,MAAM,EAAEa,cAAcC,UAAU,EAAEC,WAAWC,SAAS,EAAE,GAAGC,IAAAA,gCAAAA,EAAed;IAE1E,OAAO;QAACW;QAAYE;KAAU;AAChC"}
@@ -132,4 +132,4 @@ function usePromptListboxFunctionality(params) {
132
132
  },
133
133
  containerRef: anchorRef
134
134
  };
135
- } //# sourceMappingURL=usePromptListboxFunctionalityV2.js.map
135
+ }
@@ -1 +1 @@
1
- {"version":3,"sources":["usePromptListboxFunctionalityV2.tsx"],"sourcesContent":["import * as React from 'react';\nimport { InputListbox, useInputListboxFunctionality } from '@fluentui-copilot/react-input-listbox';\nimport { PromptListboxMotion } from '../motion/PromptListboxMotion';\nimport {\n mergeCallbacks,\n useControllableState,\n useEventCallback,\n useId,\n useMergedRefs,\n} from '@fluentui/react-utilities';\nimport { CursorPositionPlugin } from '../../plugins/CursorPositionPlugin';\nimport { useListboxPositioning } from './useListboxPositioning';\nimport { Portal } from '@fluentui/react-components';\nimport type { EventData, EventHandler } from '@fluentui/react-utilities';\nimport type {\n InputListboxAction,\n InputListboxProps,\n UseInputListboxFunctionalityParams,\n OverrideActionHandler,\n} from '@fluentui-copilot/react-input-listbox';\nimport type { PortalProps } from '@fluentui/react-components';\nimport type { CursorPosition } from '../../plugins/CursorPositionPlugin';\nimport type { EditorInputProps } from '@fluentui-copilot/react-editor-input';\nimport type { PositioningShorthand } from '@fluentui/react-positioning';\n\nexport type OnOpenChangeData = (\n | EventData<'click', React.MouseEvent<HTMLSpanElement>>\n | EventData<'focus', React.FocusEvent<HTMLSpanElement>>\n | EventData<'keyboard', React.KeyboardEvent<HTMLSpanElement>>\n) & {\n open: boolean;\n};\n\nexport type UsePromptListboxFunctionalityParams = UseInputListboxFunctionalityParams & {\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: EventHandler<OnOpenChangeData>;\n positioning?: PositioningShorthand;\n\n /**\n * Whether the listbox's width should take all the available space or only\n * the required space.\n *\n * @default false\n */\n fluid?: boolean;\n\n /**\n * Props to be passed to the InputListbox component\n */\n listboxProps?: Partial<InputListboxProps> & {\n ref?: React.RefObject<HTMLDivElement>;\n };\n\n /**\n * Whether to allow reaching the listbox options by arrowing up at the start of the input.\n * Note, this prop is meant to be used with the following positioning props:\n * ```ts\n * usePromptListboxFunctionality({\n * positioning: {\n * position: 'above',\n * fallbackPositions: ['above']\n * }\n * });\n * ```\n * This is useful when using PromptListbox with other components such as ChatInput since\n * the input will always stay at the bottom therefore the listbox would always get cut.\n *\n * @default false\n */\n allowArrowUpNavigation?: boolean;\n\n /**\n * Whether to render the listbox inline or use a portal.\n */\n inline?: boolean;\n} & Pick<PortalProps, 'mountNode'>;\n\nexport type UsePromptListboxFunctionality<ContainerElementType extends HTMLElement> = {\n /**\n * Component to be rendered in the Input component. This should be passed to the listbox prop.\n */\n promptListbox: JSX.Element;\n /**\n * Props to be spread in the PromptInput, these props are needed for the keyboard behavior to\n * work correctly.\n */\n triggerProps: {\n ref: React.RefObject<HTMLSpanElement>;\n /**\n * Whether the listbox is being used to go through options or the user is currently typing.\n */\n isInSelectionMode: boolean;\n } & Required<Pick<EditorInputProps, 'onBlur' | 'onFocus' | 'onKeyDown'>>;\n\n /**\n * Ref used to point which element the listbox should be anchored to. Most use cases\n * will provide this prop to the PromptInput's EditorInput (since this is the root slot,\n * this is provided directly to the component and not the slot).\n *\n * Note: If the containerRef is the same as the trigger, the ref provided in triggerProps needs\n * to be merged with this one using `useMergedRefs(containerRef, triggerProps.ref);`\n */\n containerRef: React.RefObject<ContainerElementType>;\n /**\n * Plugin used to tell where the cursor is in the EditorInput, this is important for the\n * keyboard behavior. This should be passed as children in the PromptInput.\n */\n cursorPositionPlugin: JSX.Element;\n};\n\nexport function usePromptListboxFunctionality<\n TriggerElementType extends HTMLElement = HTMLSpanElement,\n ContainerElementType extends HTMLElement = HTMLDivElement,\n>(params: UsePromptListboxFunctionalityParams): UsePromptListboxFunctionality<ContainerElementType> {\n const { fluid = false, allowArrowUpNavigation = false, onSelectionModeChange } = params;\n const [open, setOpen] = useControllableState({\n state: params.open,\n defaultState: params.defaultOpen,\n initialState: false,\n });\n const [cursorPosition, setCursorPosition] = React.useState<CursorPosition>('end');\n\n const overrideActionHandler: OverrideActionHandler = (\n e,\n { activeOption, action, activeDescendantController, isInSelectionMode },\n ) => {\n const atStart = allowArrowUpNavigation && (cursorPosition === 'start' || cursorPosition === 'start-end');\n const atEnd = cursorPosition === 'end' || cursorPosition === 'start-end';\n let newAction: InputListboxAction | undefined = undefined;\n let newIsInSelection: boolean | undefined = undefined;\n const firstOption = activeDescendantController.first({ passive: true });\n\n switch (action) {\n case 'Next':\n if (!isInSelectionMode && !atEnd) {\n newAction = 'Type';\n newIsInSelection = false;\n }\n break;\n case 'Previous':\n if (!isInSelectionMode && !atStart) {\n newAction = 'Type';\n newIsInSelection = false;\n } else if (\n isInSelectionMode &&\n !allowArrowUpNavigation &&\n atEnd &&\n activeOption !== undefined &&\n activeOption.id === firstOption\n ) {\n newAction = 'Type';\n newIsInSelection = false;\n e.preventDefault();\n }\n break;\n case 'First':\n case 'Last':\n case 'PageDown':\n case 'PageUp':\n if (!isInSelectionMode) {\n newAction = 'Type';\n newIsInSelection = false;\n }\n break;\n }\n\n const userOverrides = params.overrideActionHandler?.(e, {\n activeOption,\n action,\n activeDescendantController,\n isInSelectionMode,\n });\n\n return { action: newAction, isInSelectionMode: newIsInSelection, ...userOverrides };\n };\n\n const baseListboxFunctionality = useInputListboxFunctionality<TriggerElementType>({\n ...params,\n onSelectionModeChange,\n overrideActionHandler,\n });\n const {\n onBlur: baseOnBlur,\n onKeyDown: baseOnKeyDown,\n ref: triggerRef,\n isInSelectionMode,\n } = baseListboxFunctionality.triggerProps;\n\n const onFocus = (event: React.FocusEvent<HTMLSpanElement>) => {\n if (event.target === event.currentTarget) {\n setOpen(true);\n params.onOpenChange?.(event, { event, type: 'focus', open: true });\n }\n };\n\n const onBlur = useEventCallback(\n mergeCallbacks(baseOnBlur, (e: React.FocusEvent<TriggerElementType>) => {\n setOpen(false);\n params.onOpenChange?.(e, { event: e, type: 'focus', open: false });\n }),\n );\n\n const [listboxRef, anchorRef] = useListboxPositioning<ContainerElementType>({\n fluid,\n positioning: params.positioning,\n });\n\n const listboxId = useId('prompt-listbox', params.listboxProps?.id);\n const cursorPositionPlugin = <CursorPositionPlugin setCursorPosition={setCursorPosition} />;\n const innerListbox = (\n <InputListbox\n {...params.listboxProps}\n {...baseListboxFunctionality.inputListboxProps}\n id={listboxId}\n ref={useMergedRefs(baseListboxFunctionality.inputListboxProps.ref, listboxRef, params.listboxProps?.ref)}\n />\n );\n const listbox = (\n <PromptListboxMotion visible={open}>\n <span aria-owns={open ? listboxId : undefined}>\n {open && (params.inline ? innerListbox : <Portal mountNode={params.mountNode}>{innerListbox}</Portal>)}\n </span>\n </PromptListboxMotion>\n );\n\n return {\n promptListbox: listbox,\n cursorPositionPlugin,\n triggerProps: {\n ref: triggerRef,\n isInSelectionMode,\n onFocus,\n onKeyDown: baseOnKeyDown,\n onBlur,\n },\n containerRef: anchorRef,\n };\n}\n"],"names":["usePromptListboxFunctionality","params","fluid","open","setOpen","useControllableState","state","cursorPosition","defaultState","overrideActionHandler","e","React","undefined","newIsInSelection","allowArrowUpNavigation","atEnd","activeDescendantController","first","isInSelectionMode","newAction","atStart","activeOption","id","firstOption","userOverrides","_params_overrideActionHandler","call","action","baseOnBlur","event","useInputListboxFunctionality","onKeyDown","baseOnKeyDown","ref","triggerRef","useEventCallback","triggerProps","onOpenChange","_params_onOpenChange","type","listboxRef","onBlur","cursorPositionPlugin","setCursorPosition","innerListbox","InputListbox","baseListboxFunctionality","listboxId","listbox","useListboxPositioning","PromptListboxMotion","positioning","inline","listboxProps","Portal","mountNode","createElement","CursorPositionPlugin","promptListbox","inputListboxProps","containerRef","anchorRef"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"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"}
1
+ {"version":3,"sources":["usePromptListboxFunctionalityV2.tsx"],"sourcesContent":["import * as React from 'react';\nimport { InputListbox, useInputListboxFunctionality } from '@fluentui-copilot/react-input-listbox';\nimport { PromptListboxMotion } from '../motion/PromptListboxMotion';\nimport {\n mergeCallbacks,\n useControllableState,\n useEventCallback,\n useId,\n useMergedRefs,\n} from '@fluentui/react-utilities';\nimport { CursorPositionPlugin } from '../../plugins/CursorPositionPlugin';\nimport { useListboxPositioning } from './useListboxPositioning';\nimport { Portal } from '@fluentui/react-components';\nimport type { EventData, EventHandler } from '@fluentui/react-utilities';\nimport type {\n InputListboxAction,\n InputListboxProps,\n UseInputListboxFunctionalityParams,\n OverrideActionHandler,\n} from '@fluentui-copilot/react-input-listbox';\nimport type { PortalProps } from '@fluentui/react-components';\nimport type { CursorPosition } from '../../plugins/CursorPositionPlugin';\nimport type { EditorInputProps } from '@fluentui-copilot/react-editor-input';\nimport type { PositioningShorthand } from '@fluentui/react-positioning';\n\nexport type OnOpenChangeData = (\n | EventData<'click', React.MouseEvent<HTMLSpanElement>>\n | EventData<'focus', React.FocusEvent<HTMLSpanElement>>\n | EventData<'keyboard', React.KeyboardEvent<HTMLSpanElement>>\n) & {\n open: boolean;\n};\n\nexport type UsePromptListboxFunctionalityParams = UseInputListboxFunctionalityParams & {\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: EventHandler<OnOpenChangeData>;\n positioning?: PositioningShorthand;\n\n /**\n * Whether the listbox's width should take all the available space or only\n * the required space.\n *\n * @default false\n */\n fluid?: boolean;\n\n /**\n * Props to be passed to the InputListbox component\n */\n listboxProps?: Partial<InputListboxProps> & {\n ref?: React.RefObject<HTMLDivElement>;\n };\n\n /**\n * Whether to allow reaching the listbox options by arrowing up at the start of the input.\n * Note, this prop is meant to be used with the following positioning props:\n * ```ts\n * usePromptListboxFunctionality({\n * positioning: {\n * position: 'above',\n * fallbackPositions: ['above']\n * }\n * });\n * ```\n * This is useful when using PromptListbox with other components such as ChatInput since\n * the input will always stay at the bottom therefore the listbox would always get cut.\n *\n * @default false\n */\n allowArrowUpNavigation?: boolean;\n\n /**\n * Whether to render the listbox inline or use a portal.\n */\n inline?: boolean;\n} & Pick<PortalProps, 'mountNode'>;\n\nexport type UsePromptListboxFunctionality<ContainerElementType extends HTMLElement> = {\n /**\n * Component to be rendered in the Input component. This should be passed to the listbox prop.\n */\n promptListbox: JSX.Element;\n /**\n * Props to be spread in the PromptInput, these props are needed for the keyboard behavior to\n * work correctly.\n */\n triggerProps: {\n ref: React.RefObject<HTMLSpanElement>;\n /**\n * Whether the listbox is being used to go through options or the user is currently typing.\n */\n isInSelectionMode: boolean;\n } & Required<Pick<EditorInputProps, 'onBlur' | 'onFocus' | 'onKeyDown'>>;\n\n /**\n * Ref used to point which element the listbox should be anchored to. Most use cases\n * will provide this prop to the PromptInput's EditorInput (since this is the root slot,\n * this is provided directly to the component and not the slot).\n *\n * Note: If the containerRef is the same as the trigger, the ref provided in triggerProps needs\n * to be merged with this one using `useMergedRefs(containerRef, triggerProps.ref);`\n */\n containerRef: React.RefObject<ContainerElementType>;\n /**\n * Plugin used to tell where the cursor is in the EditorInput, this is important for the\n * keyboard behavior. This should be passed as children in the PromptInput.\n */\n cursorPositionPlugin: JSX.Element;\n};\n\nexport function usePromptListboxFunctionality<\n TriggerElementType extends HTMLElement = HTMLSpanElement,\n ContainerElementType extends HTMLElement = HTMLDivElement,\n>(params: UsePromptListboxFunctionalityParams): UsePromptListboxFunctionality<ContainerElementType> {\n const { fluid = false, allowArrowUpNavigation = false, onSelectionModeChange } = params;\n const [open, setOpen] = useControllableState({\n state: params.open,\n defaultState: params.defaultOpen,\n initialState: false,\n });\n const [cursorPosition, setCursorPosition] = React.useState<CursorPosition>('end');\n\n const overrideActionHandler: OverrideActionHandler = (\n e,\n { activeOption, action, activeDescendantController, isInSelectionMode },\n ) => {\n const atStart = allowArrowUpNavigation && (cursorPosition === 'start' || cursorPosition === 'start-end');\n const atEnd = cursorPosition === 'end' || cursorPosition === 'start-end';\n let newAction: InputListboxAction | undefined = undefined;\n let newIsInSelection: boolean | undefined = undefined;\n const firstOption = activeDescendantController.first({ passive: true });\n\n switch (action) {\n case 'Next':\n if (!isInSelectionMode && !atEnd) {\n newAction = 'Type';\n newIsInSelection = false;\n }\n break;\n case 'Previous':\n if (!isInSelectionMode && !atStart) {\n newAction = 'Type';\n newIsInSelection = false;\n } else if (\n isInSelectionMode &&\n !allowArrowUpNavigation &&\n atEnd &&\n activeOption !== undefined &&\n activeOption.id === firstOption\n ) {\n newAction = 'Type';\n newIsInSelection = false;\n e.preventDefault();\n }\n break;\n case 'First':\n case 'Last':\n case 'PageDown':\n case 'PageUp':\n if (!isInSelectionMode) {\n newAction = 'Type';\n newIsInSelection = false;\n }\n break;\n }\n\n const userOverrides = params.overrideActionHandler?.(e, {\n activeOption,\n action,\n activeDescendantController,\n isInSelectionMode,\n });\n\n return { action: newAction, isInSelectionMode: newIsInSelection, ...userOverrides };\n };\n\n const baseListboxFunctionality = useInputListboxFunctionality<TriggerElementType>({\n ...params,\n onSelectionModeChange,\n overrideActionHandler,\n });\n const {\n onBlur: baseOnBlur,\n onKeyDown: baseOnKeyDown,\n ref: triggerRef,\n isInSelectionMode,\n } = baseListboxFunctionality.triggerProps;\n\n const onFocus = (event: React.FocusEvent<HTMLSpanElement>) => {\n if (event.target === event.currentTarget) {\n setOpen(true);\n params.onOpenChange?.(event, { event, type: 'focus', open: true });\n }\n };\n\n const onBlur = useEventCallback(\n mergeCallbacks(baseOnBlur, (e: React.FocusEvent<TriggerElementType>) => {\n setOpen(false);\n params.onOpenChange?.(e, { event: e, type: 'focus', open: false });\n }),\n );\n\n const [listboxRef, anchorRef] = useListboxPositioning<ContainerElementType>({\n fluid,\n positioning: params.positioning,\n });\n\n const listboxId = useId('prompt-listbox', params.listboxProps?.id);\n const cursorPositionPlugin = <CursorPositionPlugin setCursorPosition={setCursorPosition} />;\n const innerListbox = (\n <InputListbox\n {...params.listboxProps}\n {...baseListboxFunctionality.inputListboxProps}\n id={listboxId}\n ref={useMergedRefs(baseListboxFunctionality.inputListboxProps.ref, listboxRef, params.listboxProps?.ref)}\n />\n );\n const listbox = (\n <PromptListboxMotion visible={open}>\n <span aria-owns={open ? listboxId : undefined}>\n {open && (params.inline ? innerListbox : <Portal mountNode={params.mountNode}>{innerListbox}</Portal>)}\n </span>\n </PromptListboxMotion>\n );\n\n return {\n promptListbox: listbox,\n cursorPositionPlugin,\n triggerProps: {\n ref: triggerRef,\n isInSelectionMode,\n onFocus,\n onKeyDown: baseOnKeyDown,\n onBlur,\n },\n containerRef: anchorRef,\n };\n}\n"],"names":["usePromptListboxFunctionality","params","fluid","allowArrowUpNavigation","onSelectionModeChange","open","setOpen","useControllableState","state","defaultState","defaultOpen","initialState","cursorPosition","setCursorPosition","React","useState","overrideActionHandler","e","activeOption","action","activeDescendantController","isInSelectionMode","atStart","atEnd","newAction","undefined","newIsInSelection","firstOption","first","passive","id","preventDefault","userOverrides","baseListboxFunctionality","useInputListboxFunctionality","onBlur","baseOnBlur","onKeyDown","baseOnKeyDown","ref","triggerRef","triggerProps","onFocus","event","target","currentTarget","onOpenChange","type","useEventCallback","mergeCallbacks","listboxRef","anchorRef","useListboxPositioning","positioning","listboxId","useId","listboxProps","cursorPositionPlugin","createElement","CursorPositionPlugin","innerListbox","InputListbox","inputListboxProps","useMergedRefs","listbox","PromptListboxMotion","visible","span","aria-owns","inline","Portal","mountNode","promptListbox","containerRef"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"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"}
@@ -30,4 +30,3 @@ _export(exports, {
30
30
  });
31
31
  const _usePromptListboxFunctionalityV2 = require("./components/utils/usePromptListboxFunctionalityV2");
32
32
  const _reactinputlistbox = require("@fluentui-copilot/react-input-listbox");
33
- //# sourceMappingURL=index.js.map
@@ -51,4 +51,4 @@ const CursorPositionPlugin = ({ setCursorPosition })=>{
51
51
  setCursorPosition
52
52
  ]);
53
53
  return null;
54
- }; //# sourceMappingURL=CursorPositionPlugin.js.map
54
+ };
@@ -1 +1 @@
1
- {"version":3,"sources":["CursorPositionPlugin.ts"],"sourcesContent":["import { $isSentinelNode } from '@fluentui-copilot/chat-input-plugins';\nimport {\n SELECTION_CHANGE_COMMAND,\n $getSelection,\n useLexicalComposerContext,\n $isRangeSelection,\n $isElementNode,\n COMMAND_PRIORITY_HIGH,\n} from '@fluentui-copilot/react-text-editor';\nimport * as React from 'react';\n\n/**\n * Position the cursor is in based on it's content. The goal\n * is to track whether the cursor is at the end of the input\n * or between text.\n */\nexport type CursorPosition = 'start' | 'between-text' | 'end' | 'start-end';\n\nexport type CursorPositionPluginProps = {\n setCursorPosition: (position: CursorPosition) => void;\n};\n\nexport const CursorPositionPlugin: React.FunctionComponent<CursorPositionPluginProps> = ({ setCursorPosition }) => {\n const [editor] = useLexicalComposerContext();\n\n React.useEffect(() => {\n const $selectionChangeHandler = () => {\n const selection = $getSelection();\n // If selection is null, the cursor is not active in the editor and we should just noop\n if (selection === null || !$isRangeSelection(selection) || !selection.isCollapsed()) {\n setCursorPosition('between-text');\n return false;\n }\n\n // Should only be one node in the selection because the selection is collapsed\n const selectedNode = selection.getNodes().at(0);\n // If there's no selected node, focus isn't in the editor\n if (!selectedNode) {\n return false;\n }\n\n // If there are no leaf nodes, the paragraph node will be selected\n if ($isElementNode(selectedNode)) {\n setCursorPosition('start-end');\n return false;\n }\n\n // if the selection node is a sentinel and it matches the sentinel at the end\n else if ($isSentinelNode(selectedNode) && !selectedNode.getNextSibling()) {\n setCursorPosition('end');\n return false;\n }\n\n // else if the selection node is not a sentinel, check that the next sibling node is a sentinel\n // and check if the focus offset is in the last position of the node.\n else if (\n $isSentinelNode(selectedNode.getNextSibling()) &&\n selection.focus.offset === selectedNode.getTextContentSize()\n ) {\n setCursorPosition('end');\n return false;\n }\n\n // else if the selection node is not at the end and is not a sentinel, check if there's a previous\n // sibling and that we are at the start. If that's the case we are at the start.\n else if (selectedNode.getPreviousSibling() === null && selection.focus.offset === 0) {\n setCursorPosition('start');\n return false;\n }\n\n setCursorPosition('between-text');\n return false;\n };\n\n return editor.registerCommand(SELECTION_CHANGE_COMMAND, $selectionChangeHandler, COMMAND_PRIORITY_HIGH);\n }, [editor, setCursorPosition]);\n\n return null;\n};\n"],"names":["CursorPositionPlugin","editor","$selectionChangeHandler","selection","$isRangeSelection","isCollapsed","selectedNode","getNodes","at","$isSentinelNode","getNextSibling","focus","offset","getTextContentSize","getPreviousSibling","setCursorPosition"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAsBaA;;;eAAAA;;;;kCAtBmB;iCAQzB;iEACgB;AAahB,MAAMA,uBAA2E,CAAC,mBACzE;UAGZ,CAAAC,OAAMC,GAAAA,IAAAA,0CAA0B;oBAC9B,CAAMC;wCACN;kBACAA,YAAIA,IAAAA,8BAAc;mGACE;8BACX,QAAA,CAAAC,IAAAA,kCAAA,EAAAD,cAAA,CAAAA,UAAAE,WAAA,IAAA;kCACT;uBAEA;;0FAEyD;kBACzDC,eAAKA,UAAcC,QAAA,GAAAC,EAAA,CAAA;qEACV;+BACT;uBAEA;;8EAEoB;mDACX,EAAAF,eAAA;kCAIAG;;uBAEPA,IAAAA,iCAAO,EAAAH,iBAAA,CAAAA,aAAAI,cAAA,IAAA;kCAMPD;;uBAIAA,IAAAA,iCAAO,EAAAH,aAAAI,cAAA,OAAAP,UAAAQ,KAAA,CAAAC,MAAA,KAAAN,aAAAO,kBAAA,IAAA;kCAKAP;;uBAEPA,aAAOQ,kBAAA,OAAA,QAAAX,UAAAQ,KAAA,CAAAC,MAAA,KAAA,GAAA;kCACT;uBAEAG;;8BAEF;mBAEA;QACF;eAAId,OAAAA,eAAAA,CAAAA,yCAAAA,EAAAA,yBAAAA,sCAAAA;;;QAAQc;KAAAA;WAAkB;GAGhC,gDAAE"}
1
+ {"version":3,"sources":["CursorPositionPlugin.ts"],"sourcesContent":["import { $isSentinelNode } from '@fluentui-copilot/chat-input-plugins';\nimport {\n SELECTION_CHANGE_COMMAND,\n $getSelection,\n useLexicalComposerContext,\n $isRangeSelection,\n $isElementNode,\n COMMAND_PRIORITY_HIGH,\n} from '@fluentui-copilot/react-text-editor';\nimport * as React from 'react';\n\n/**\n * Position the cursor is in based on it's content. The goal\n * is to track whether the cursor is at the end of the input\n * or between text.\n */\nexport type CursorPosition = 'start' | 'between-text' | 'end' | 'start-end';\n\nexport type CursorPositionPluginProps = {\n setCursorPosition: (position: CursorPosition) => void;\n};\n\nexport const CursorPositionPlugin: React.FunctionComponent<CursorPositionPluginProps> = ({ setCursorPosition }) => {\n const [editor] = useLexicalComposerContext();\n\n React.useEffect(() => {\n const $selectionChangeHandler = () => {\n const selection = $getSelection();\n // If selection is null, the cursor is not active in the editor and we should just noop\n if (selection === null || !$isRangeSelection(selection) || !selection.isCollapsed()) {\n setCursorPosition('between-text');\n return false;\n }\n\n // Should only be one node in the selection because the selection is collapsed\n const selectedNode = selection.getNodes().at(0);\n // If there's no selected node, focus isn't in the editor\n if (!selectedNode) {\n return false;\n }\n\n // If there are no leaf nodes, the paragraph node will be selected\n if ($isElementNode(selectedNode)) {\n setCursorPosition('start-end');\n return false;\n }\n\n // if the selection node is a sentinel and it matches the sentinel at the end\n else if ($isSentinelNode(selectedNode) && !selectedNode.getNextSibling()) {\n setCursorPosition('end');\n return false;\n }\n\n // else if the selection node is not a sentinel, check that the next sibling node is a sentinel\n // and check if the focus offset is in the last position of the node.\n else if (\n $isSentinelNode(selectedNode.getNextSibling()) &&\n selection.focus.offset === selectedNode.getTextContentSize()\n ) {\n setCursorPosition('end');\n return false;\n }\n\n // else if the selection node is not at the end and is not a sentinel, check if there's a previous\n // sibling and that we are at the start. If that's the case we are at the start.\n else if (selectedNode.getPreviousSibling() === null && selection.focus.offset === 0) {\n setCursorPosition('start');\n return false;\n }\n\n setCursorPosition('between-text');\n return false;\n };\n\n return editor.registerCommand(SELECTION_CHANGE_COMMAND, $selectionChangeHandler, COMMAND_PRIORITY_HIGH);\n }, [editor, setCursorPosition]);\n\n return null;\n};\n"],"names":["CursorPositionPlugin","setCursorPosition","editor","useLexicalComposerContext","React","useEffect","$selectionChangeHandler","selection","$getSelection","$isRangeSelection","isCollapsed","selectedNode","getNodes","at","$isElementNode","$isSentinelNode","getNextSibling","focus","offset","getTextContentSize","getPreviousSibling","registerCommand","SELECTION_CHANGE_COMMAND","COMMAND_PRIORITY_HIGH"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAsBaA;;;eAAAA;;;;kCAtBmB;iCAQzB;iEACgB;AAahB,MAAMA,uBAA2E,CAAC,EAAEC,iBAAiB,EAAE;IAC5G,MAAM,CAACC,OAAO,GAAGC,IAAAA,0CAAAA;IAEjBC,OAAMC,SAAS,CAAC;QACd,MAAMC,0BAA0B;YAC9B,MAAMC,YAAYC,IAAAA,8BAAAA;YAClB,uFAAuF;YACvF,IAAID,cAAc,QAAQ,CAACE,IAAAA,kCAAAA,EAAkBF,cAAc,CAACA,UAAUG,WAAW,IAAI;gBACnFT,kBAAkB;gBAClB,OAAO;YACT;YAEA,8EAA8E;YAC9E,MAAMU,eAAeJ,UAAUK,QAAQ,GAAGC,EAAE,CAAC;YAC7C,yDAAyD;YACzD,IAAI,CAACF,cAAc;gBACjB,OAAO;YACT;YAEA,kEAAkE;YAClE,IAAIG,IAAAA,+BAAAA,EAAeH,eAAe;gBAChCV,kBAAkB;gBAClB,OAAO;YACT,OAGK,IAAIc,IAAAA,iCAAAA,EAAgBJ,iBAAiB,CAACA,aAAaK,cAAc,IAAI;gBACxEf,kBAAkB;gBAClB,OAAO;YACT,OAIK,IACHc,IAAAA,iCAAAA,EAAgBJ,aAAaK,cAAc,OAC3CT,UAAUU,KAAK,CAACC,MAAM,KAAKP,aAAaQ,kBAAkB,IAC1D;gBACAlB,kBAAkB;gBAClB,OAAO;YACT,OAIK,IAAIU,aAAaS,kBAAkB,OAAO,QAAQb,UAAUU,KAAK,CAACC,MAAM,KAAK,GAAG;gBACnFjB,kBAAkB;gBAClB,OAAO;YACT;YAEAA,kBAAkB;YAClB,OAAO;QACT;QAEA,OAAOC,OAAOmB,eAAe,CAACC,yCAAAA,EAA0BhB,yBAAyBiB,sCAAAA;IACnF,GAAG;QAACrB;QAAQD;KAAkB;IAE9B,OAAO;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui-copilot/react-prompt-listbox",
3
- "version": "0.10.2",
3
+ "version": "0.10.4",
4
4
  "description": "PromptListbox for input components using EditorInput.",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -12,15 +12,15 @@
12
12
  },
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
- "@fluentui-copilot/chat-input-plugins": "^0.5.0",
16
- "@fluentui-copilot/react-chat-input-plugins": "^0.5.2",
17
- "@fluentui-copilot/react-editor-input": "^0.5.2",
18
- "@fluentui-copilot/react-input-listbox": "^0.4.2",
19
- "@fluentui-copilot/react-prompt-input": "^0.10.2",
20
- "@fluentui-copilot/react-provider": "^0.12.2",
21
- "@fluentui-copilot/react-text-editor": "^0.4.1",
22
- "@fluentui-copilot/text-editor": "^0.3.1",
23
- "@fluentui-copilot/tokens": "^0.3.11",
15
+ "@fluentui-copilot/chat-input-plugins": "^0.5.1",
16
+ "@fluentui-copilot/react-chat-input-plugins": "^0.5.4",
17
+ "@fluentui-copilot/react-editor-input": "^0.5.4",
18
+ "@fluentui-copilot/react-input-listbox": "^0.4.4",
19
+ "@fluentui-copilot/react-prompt-input": "^0.10.4",
20
+ "@fluentui-copilot/react-provider": "^0.12.4",
21
+ "@fluentui-copilot/react-text-editor": "^0.4.2",
22
+ "@fluentui-copilot/text-editor": "^0.3.2",
23
+ "@fluentui-copilot/tokens": "^0.3.13",
24
24
  "@swc/helpers": "^0.5.1"
25
25
  },
26
26
  "peerDependencies": {