@fluentui-copilot/react-prompt-listbox 0.7.1 → 0.7.2-hotfix.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 +36 -0
- package/CHANGELOG.md +20 -1
- package/dist/index.d.ts +4 -5
- package/lib/PromptListbox.js +0 -1
- package/lib/PromptOption.js +0 -1
- package/lib/components/PromptListbox/PromptListbox.js +5 -7
- package/lib/components/PromptListbox/PromptListbox.types.js +1 -2
- package/lib/components/PromptListbox/index.js +0 -1
- package/lib/components/PromptListbox/renderPromptListbox.js +17 -21
- package/lib/components/PromptListbox/usePromptListbox.js +53 -67
- package/lib/components/PromptListbox/usePromptListboxContextValues.js +22 -30
- package/lib/components/PromptListbox/usePromptListboxStyles.styles.raw.js +31 -0
- package/lib/components/PromptListbox/usePromptListboxStyles.styles.raw.js.map +1 -0
- package/lib/components/PromptOption/PromptOption.js +4 -6
- package/lib/components/PromptOption/PromptOption.types.js +1 -2
- package/lib/components/PromptOption/index.js +0 -1
- package/lib/components/PromptOption/renderPromptOption.js +4 -6
- package/lib/components/PromptOption/usePromptOption.js +84 -84
- package/lib/components/PromptOption/usePromptOptionStyles.styles.raw.js +68 -0
- package/lib/components/PromptOption/usePromptOptionStyles.styles.raw.js.map +1 -0
- package/lib/components/motion/PromptListboxMotion.js +52 -50
- package/lib/components/utils/OptionCollection.types.js +1 -2
- package/lib/components/utils/PromptListboxFunctionality.types.js +1 -2
- package/lib/components/utils/PromptListboxFunctionality.types.js.map +1 -1
- package/lib/components/utils/Selection.types.js +1 -2
- package/lib/components/utils/dropdownKeyActions.js +49 -60
- package/lib/components/utils/useListboxPositioning.js +22 -24
- package/lib/components/utils/useOptionCollection.js +30 -32
- package/lib/components/utils/usePromptListboxFunctionality.js +121 -123
- package/lib/components/utils/usePromptListboxFunctionalityV2.js +109 -124
- package/lib/components/utils/useSelection.js +57 -49
- package/lib/components/utils/useTriggerKeyDown.js +124 -133
- package/lib/index.js +0 -1
- package/lib/plugins/CursorPositionPlugin.js +39 -39
- package/lib-commonjs/PromptListbox.js +0 -1
- package/lib-commonjs/PromptOption.js +0 -1
- package/lib-commonjs/components/PromptListbox/PromptListbox.js +1 -1
- package/lib-commonjs/components/PromptListbox/PromptListbox.js.map +1 -1
- package/lib-commonjs/components/PromptListbox/PromptListbox.types.js +0 -1
- package/lib-commonjs/components/PromptListbox/index.js +0 -1
- package/lib-commonjs/components/PromptListbox/renderPromptListbox.js +1 -1
- package/lib-commonjs/components/PromptListbox/renderPromptListbox.js.map +1 -1
- package/lib-commonjs/components/PromptListbox/usePromptListbox.js +1 -1
- package/lib-commonjs/components/PromptListbox/usePromptListbox.js.map +1 -1
- package/lib-commonjs/components/PromptListbox/usePromptListboxContextValues.js +1 -1
- package/lib-commonjs/components/PromptListbox/usePromptListboxContextValues.js.map +1 -1
- package/lib-commonjs/components/PromptListbox/usePromptListboxStyles.styles.raw.js +47 -0
- package/lib-commonjs/components/PromptListbox/usePromptListboxStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/PromptOption/PromptOption.js +1 -1
- package/lib-commonjs/components/PromptOption/PromptOption.js.map +1 -1
- package/lib-commonjs/components/PromptOption/PromptOption.types.js +0 -1
- package/lib-commonjs/components/PromptOption/index.js +0 -1
- package/lib-commonjs/components/PromptOption/renderPromptOption.js +1 -1
- package/lib-commonjs/components/PromptOption/renderPromptOption.js.map +1 -1
- package/lib-commonjs/components/PromptOption/usePromptOption.js +1 -1
- package/lib-commonjs/components/PromptOption/usePromptOption.js.map +1 -1
- package/lib-commonjs/components/PromptOption/usePromptOptionStyles.styles.raw.js +84 -0
- package/lib-commonjs/components/PromptOption/usePromptOptionStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/motion/PromptListboxMotion.js +1 -1
- package/lib-commonjs/components/motion/PromptListboxMotion.js.map +1 -1
- package/lib-commonjs/components/utils/OptionCollection.types.js +0 -1
- package/lib-commonjs/components/utils/PromptListboxFunctionality.types.js +0 -1
- package/lib-commonjs/components/utils/PromptListboxFunctionality.types.js.map +1 -1
- package/lib-commonjs/components/utils/Selection.types.js +0 -1
- package/lib-commonjs/components/utils/dropdownKeyActions.js +1 -1
- package/lib-commonjs/components/utils/dropdownKeyActions.js.map +1 -1
- package/lib-commonjs/components/utils/useListboxPositioning.js +1 -1
- package/lib-commonjs/components/utils/useListboxPositioning.js.map +1 -1
- package/lib-commonjs/components/utils/useOptionCollection.js +1 -1
- package/lib-commonjs/components/utils/useOptionCollection.js.map +1 -1
- package/lib-commonjs/components/utils/usePromptListboxFunctionality.js +1 -1
- package/lib-commonjs/components/utils/usePromptListboxFunctionality.js.map +1 -1
- package/lib-commonjs/components/utils/usePromptListboxFunctionalityV2.js +1 -1
- package/lib-commonjs/components/utils/usePromptListboxFunctionalityV2.js.map +1 -1
- package/lib-commonjs/components/utils/useSelection.js +1 -1
- package/lib-commonjs/components/utils/useSelection.js.map +1 -1
- package/lib-commonjs/components/utils/useTriggerKeyDown.js +1 -1
- package/lib-commonjs/components/utils/useTriggerKeyDown.js.map +1 -1
- package/lib-commonjs/index.js +0 -1
- package/lib-commonjs/plugins/CursorPositionPlugin.js +1 -1
- package/lib-commonjs/plugins/CursorPositionPlugin.js.map +1 -1
- package/package.json +21 -24
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui-copilot/react-prompt-listbox",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"date": "Wed, 06 Aug 2025 16:01:29 GMT",
|
|
6
|
+
"tag": "@fluentui-copilot/react-prompt-listbox_v0.7.2-hotfix.1",
|
|
7
|
+
"version": "0.7.2-hotfix.1",
|
|
8
|
+
"comments": {
|
|
9
|
+
"prerelease": [
|
|
10
|
+
{
|
|
11
|
+
"author": "hochelmartin@gmail.com",
|
|
12
|
+
"package": "@fluentui-copilot/react-prompt-listbox",
|
|
13
|
+
"commit": "cb43a5bd5258c678c965fddff7e7d5a95f9d0396",
|
|
14
|
+
"comment": "release: prepare hotfix 0.25.3-hotfix.1"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Wed, 30 Apr 2025 01:47:49 GMT",
|
|
21
|
+
"tag": "@fluentui-copilot/react-prompt-listbox_v0.7.2",
|
|
22
|
+
"version": "0.7.2",
|
|
23
|
+
"comments": {
|
|
24
|
+
"patch": [
|
|
25
|
+
{
|
|
26
|
+
"author": "tristan.watanabe@gmail.com",
|
|
27
|
+
"package": "@fluentui-copilot/react-prompt-listbox",
|
|
28
|
+
"commit": "1391e0a7243d050db30fcc27547fd3e91df0162c",
|
|
29
|
+
"comment": "chore: use named import when importing react for improved tree shaking."
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"author": "owcampbe@microsoft.com",
|
|
33
|
+
"package": "@fluentui-copilot/react-prompt-listbox",
|
|
34
|
+
"commit": "5a9efb11481fbe2c9bd25c8825ec4a9b991050ab",
|
|
35
|
+
"comment": "chore: Bump @fluentui/react-components to 9.58.3."
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
},
|
|
4
40
|
{
|
|
5
41
|
"date": "Thu, 20 Mar 2025 17:00:43 GMT",
|
|
6
42
|
"tag": "@fluentui-copilot/react-prompt-listbox_v0.6.0",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,28 @@
|
|
|
1
1
|
# Change Log - @fluentui-copilot/react-prompt-listbox
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 06 Aug 2025 16:01:29 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [0.7.2-hotfix.1](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-prompt-listbox_v0.7.2-hotfix.1)
|
|
8
|
+
|
|
9
|
+
Wed, 06 Aug 2025 16:01:29 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-prompt-listbox_v0.7.2..@fluentui-copilot/react-prompt-listbox_v0.7.2-hotfix.1)
|
|
11
|
+
|
|
12
|
+
### Changes
|
|
13
|
+
|
|
14
|
+
- release: prepare hotfix 0.25.3-hotfix.1 ([PR #3280](https://github.com/microsoft/fluentai/pull/3280) by hochelmartin@gmail.com)
|
|
15
|
+
|
|
16
|
+
## [0.7.2](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-prompt-listbox_v0.7.2)
|
|
17
|
+
|
|
18
|
+
Wed, 30 Apr 2025 01:47:49 GMT
|
|
19
|
+
[Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-prompt-listbox_v0.6.0..@fluentui-copilot/react-prompt-listbox_v0.7.2)
|
|
20
|
+
|
|
21
|
+
### Patches
|
|
22
|
+
|
|
23
|
+
- chore: use named import when importing react for improved tree shaking. ([PR #2956](https://github.com/microsoft/fluentai/pull/2956) by tristan.watanabe@gmail.com)
|
|
24
|
+
- chore: Bump @fluentui/react-components to 9.58.3. ([PR #2963](https://github.com/microsoft/fluentai/pull/2963) by owcampbe@microsoft.com)
|
|
25
|
+
|
|
7
26
|
## [0.6.0](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-prompt-listbox_v0.6.0)
|
|
8
27
|
|
|
9
28
|
Thu, 20 Mar 2025 17:00:43 GMT
|
package/dist/index.d.ts
CHANGED
|
@@ -31,7 +31,6 @@ import type { PortalProps } from '@fluentui/react-components';
|
|
|
31
31
|
import type { PositioningShorthand } from '@fluentui/react-positioning';
|
|
32
32
|
import type { PositioningShorthand as PositioningShorthand_2 } from '@fluentui/react-components';
|
|
33
33
|
import * as React_2 from 'react';
|
|
34
|
-
import type { default as React_3 } from 'react';
|
|
35
34
|
import { renderOption_unstable } from '@fluentui-copilot/react-input-listbox';
|
|
36
35
|
import type { Slot } from '@fluentui/react-components';
|
|
37
36
|
import type { SlotClassNames } from '@fluentui/react-components';
|
|
@@ -45,7 +44,7 @@ export declare type OnOpenChangeData = (EventData<'click', React_2.MouseEvent<HT
|
|
|
45
44
|
open: boolean;
|
|
46
45
|
};
|
|
47
46
|
|
|
48
|
-
export declare type OnOpenChangeDataDeprecated = (EventData<'click',
|
|
47
|
+
export declare type OnOpenChangeDataDeprecated = (EventData<'click', React_2.MouseEvent<HTMLSpanElement>> | EventData<'focus', React_2.FocusEvent<HTMLSpanElement>> | EventData<'keyboard', React_2.KeyboardEvent<HTMLSpanElement>>) & {
|
|
49
48
|
open: boolean;
|
|
50
49
|
};
|
|
51
50
|
|
|
@@ -94,7 +93,7 @@ export { OverrideActionHandlerOptions }
|
|
|
94
93
|
export { OverrideActionHandlerResult }
|
|
95
94
|
|
|
96
95
|
export declare type ProcessedPromptListboxPropsDeprecated = Partial<Omit<PromptListboxProps, 'activeDescendantController' | 'multiselect'>> & {
|
|
97
|
-
ref?:
|
|
96
|
+
ref?: React_2.MutableRefObject<any>;
|
|
98
97
|
};
|
|
99
98
|
|
|
100
99
|
/**@deprecated - use InputListbox instead */
|
|
@@ -253,7 +252,7 @@ export declare type UsePromptListboxFunctionalityDeprecated = {
|
|
|
253
252
|
* work correctly.
|
|
254
253
|
*/
|
|
255
254
|
triggerProps: {
|
|
256
|
-
ref:
|
|
255
|
+
ref: React_2.RefObject<HTMLSpanElement>;
|
|
257
256
|
/**
|
|
258
257
|
* Whether the listbox is being used to go through options or the user is currently typing.
|
|
259
258
|
*/
|
|
@@ -267,7 +266,7 @@ export declare type UsePromptListboxFunctionalityDeprecated = {
|
|
|
267
266
|
* Note: If the containerRef is the same as the trigger, the ref provided in triggerProps needs
|
|
268
267
|
* to be merged with this one using `useMergedRefs(containerRef, triggerProps.ref);`
|
|
269
268
|
*/
|
|
270
|
-
containerRef:
|
|
269
|
+
containerRef: React_2.MutableRefObject<any>;
|
|
271
270
|
/**
|
|
272
271
|
* Plugin used to tell where the cursor is in the EditorInput, this is important for the
|
|
273
272
|
* keyboard behavior. This should be passed as children in the PromptInput.
|
package/lib/PromptListbox.js
CHANGED
package/lib/PromptOption.js
CHANGED
|
@@ -3,12 +3,10 @@ import { usePromptListbox_unstable } from './usePromptListbox';
|
|
|
3
3
|
import { renderPromptListbox_unstable } from './renderPromptListbox';
|
|
4
4
|
import { usePromptListboxStyles_unstable } from './usePromptListboxStyles.styles';
|
|
5
5
|
import { usePromptListboxContextValues } from './usePromptListboxContextValues';
|
|
6
|
-
/**@deprecated - use InputListbox instead */
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return renderPromptListbox_unstable(state, contextValues);
|
|
6
|
+
/**@deprecated - use InputListbox instead */ export const PromptListbox = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
7
|
+
const state = usePromptListbox_unstable(props, ref);
|
|
8
|
+
const contextValues = usePromptListboxContextValues(state);
|
|
9
|
+
usePromptListboxStyles_unstable(state);
|
|
10
|
+
return renderPromptListbox_unstable(state, contextValues);
|
|
12
11
|
});
|
|
13
12
|
PromptListbox.displayName = 'PromptListbox';
|
|
14
|
-
//# sourceMappingURL=PromptListbox.js.map
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export {};
|
|
2
|
-
//# sourceMappingURL=PromptListbox.types.js.map
|
|
1
|
+
export { };
|
|
@@ -2,4 +2,3 @@ export { PromptListbox } from './PromptListbox';
|
|
|
2
2
|
export { renderPromptListbox_unstable } from './renderPromptListbox';
|
|
3
3
|
export { usePromptListbox_unstable } from './usePromptListbox';
|
|
4
4
|
export { promptListboxClassNames, usePromptListboxStyles_unstable } from './usePromptListboxStyles.styles';
|
|
5
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,26 +1,22 @@
|
|
|
1
|
-
import { jsx as _jsx } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
2
|
import { assertSlots, ListboxProvider, Portal } from '@fluentui/react-components';
|
|
3
3
|
import { ActiveDescendantContextProvider } from '@fluentui/react-aria';
|
|
4
4
|
/**
|
|
5
5
|
* Render the final JSX of PromptListbox
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
})
|
|
23
|
-
})
|
|
24
|
-
});
|
|
6
|
+
*/ export const renderPromptListbox_unstable = (state, contextValues)=>{
|
|
7
|
+
assertSlots(state);
|
|
8
|
+
const { open } = state;
|
|
9
|
+
return /*#__PURE__*/ _jsx(ListboxProvider, {
|
|
10
|
+
value: contextValues.listbox,
|
|
11
|
+
children: /*#__PURE__*/ _jsx(ActiveDescendantContextProvider, {
|
|
12
|
+
value: contextValues.activeDescendant,
|
|
13
|
+
children: /*#__PURE__*/ _jsx("span", {
|
|
14
|
+
"aria-owns": open ? state.root.id : undefined,
|
|
15
|
+
children: open && (state.inlinePopup ? /*#__PURE__*/ _jsx(state.root, {}) : /*#__PURE__*/ _jsx(Portal, {
|
|
16
|
+
mountNode: state.mountNode,
|
|
17
|
+
children: /*#__PURE__*/ _jsx(state.root, {})
|
|
18
|
+
}))
|
|
19
|
+
})
|
|
20
|
+
})
|
|
21
|
+
});
|
|
25
22
|
};
|
|
26
|
-
//# sourceMappingURL=renderPromptListbox.js.map
|
|
@@ -9,74 +9,60 @@ import { mergeCallbacks, useEventCallback, useId } from '@fluentui/react-utiliti
|
|
|
9
9
|
*
|
|
10
10
|
* @param props - props from this instance of PromptListbox
|
|
11
11
|
* @param ref - reference to root HTMLElement of PromptListbox
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
selectOption,
|
|
25
|
-
registerOption
|
|
26
|
-
} = props;
|
|
27
|
-
const listboxId = useId('prompt-listbox', id);
|
|
28
|
-
const onActiveDescendantChange = useEventCallback(event => {
|
|
29
|
-
const previousOption = event.detail.previousId ? getOptionById(event.detail.previousId) : null;
|
|
30
|
-
const nextOption = getOptionById(event.detail.id);
|
|
31
|
-
onActiveOptionChange === null || onActiveOptionChange === void 0 ? void 0 : onActiveOptionChange(event, {
|
|
32
|
-
event,
|
|
33
|
-
type: 'change',
|
|
34
|
-
previousOption,
|
|
35
|
-
nextOption
|
|
12
|
+
*/ export const usePromptListbox_unstable = (props, ref)=>{
|
|
13
|
+
const { id, onActiveOptionChange, inlinePopup = false, mountNode = undefined, open = true, activeDescendantController, getOptionById, getOptionsMatchingValue, selectedOptions, selectOption, registerOption } = props;
|
|
14
|
+
const listboxId = useId('prompt-listbox', id);
|
|
15
|
+
const onActiveDescendantChange = useEventCallback((event)=>{
|
|
16
|
+
const previousOption = event.detail.previousId ? getOptionById(event.detail.previousId) : null;
|
|
17
|
+
const nextOption = getOptionById(event.detail.id);
|
|
18
|
+
onActiveOptionChange === null || onActiveOptionChange === void 0 ? void 0 : onActiveOptionChange(event, {
|
|
19
|
+
event,
|
|
20
|
+
type: 'change',
|
|
21
|
+
previousOption,
|
|
22
|
+
nextOption
|
|
23
|
+
});
|
|
36
24
|
});
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return state;
|
|
25
|
+
const state = {
|
|
26
|
+
...deprecatedPropsDefaults,
|
|
27
|
+
open,
|
|
28
|
+
getOptionById,
|
|
29
|
+
getOptionsMatchingValue,
|
|
30
|
+
selectedOptions,
|
|
31
|
+
selectOption,
|
|
32
|
+
registerOption,
|
|
33
|
+
onActiveDescendantChange,
|
|
34
|
+
activeDescendantController,
|
|
35
|
+
inlinePopup,
|
|
36
|
+
mountNode,
|
|
37
|
+
components: {
|
|
38
|
+
root: Listbox
|
|
39
|
+
},
|
|
40
|
+
root: slot.always({
|
|
41
|
+
...props,
|
|
42
|
+
selectedOptions
|
|
43
|
+
}, {
|
|
44
|
+
defaultProps: {
|
|
45
|
+
disableAutoFocus: true,
|
|
46
|
+
id: listboxId,
|
|
47
|
+
tabIndex: undefined,
|
|
48
|
+
role: 'listbox'
|
|
49
|
+
},
|
|
50
|
+
elementType: Listbox
|
|
51
|
+
})
|
|
52
|
+
};
|
|
53
|
+
state.root.ref = useMergedRefs(ref, state.root.ref);
|
|
54
|
+
state.root.onMouseDown = useEventCallback(mergeCallbacks((event)=>{
|
|
55
|
+
event.preventDefault();
|
|
56
|
+
}, state.root.onMouseDown));
|
|
57
|
+
state.root.onClick = useEventCallback(mergeCallbacks((event)=>{
|
|
58
|
+
event.preventDefault();
|
|
59
|
+
}, state.root.onClick));
|
|
60
|
+
return state;
|
|
74
61
|
};
|
|
75
|
-
const noop = ()
|
|
62
|
+
const noop = ()=>null;
|
|
76
63
|
const deprecatedPropsDefaults = {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
64
|
+
activeOption: undefined,
|
|
65
|
+
focusVisible: false,
|
|
66
|
+
setActiveOption: noop,
|
|
67
|
+
onOptionClick: noop
|
|
81
68
|
};
|
|
82
|
-
//# sourceMappingURL=usePromptListbox.js.map
|
|
@@ -1,33 +1,25 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
export function usePromptListboxContextValues(state) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
onOptionClick,
|
|
26
|
-
onActiveDescendantChange
|
|
27
|
-
};
|
|
28
|
-
return {
|
|
29
|
-
activeDescendant,
|
|
30
|
-
listbox
|
|
31
|
-
};
|
|
3
|
+
const { getOptionById, getOptionsMatchingValue, registerOption, selectedOptions, selectOption, activeDescendantController, onOptionClick, onActiveDescendantChange } = state;
|
|
4
|
+
const activeDescendant = React.useMemo(()=>({
|
|
5
|
+
controller: activeDescendantController
|
|
6
|
+
}), [
|
|
7
|
+
activeDescendantController
|
|
8
|
+
]);
|
|
9
|
+
const listbox = {
|
|
10
|
+
activeOption: undefined,
|
|
11
|
+
focusVisible: false,
|
|
12
|
+
getOptionById,
|
|
13
|
+
getOptionsMatchingValue,
|
|
14
|
+
registerOption,
|
|
15
|
+
selectedOptions,
|
|
16
|
+
selectOption,
|
|
17
|
+
setActiveOption: ()=>null,
|
|
18
|
+
onOptionClick,
|
|
19
|
+
onActiveDescendantChange
|
|
20
|
+
};
|
|
21
|
+
return {
|
|
22
|
+
activeDescendant,
|
|
23
|
+
listbox
|
|
24
|
+
};
|
|
32
25
|
}
|
|
33
|
-
//# sourceMappingURL=usePromptListboxContextValues.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { makeStyles, mergeClasses } from '@fluentui/react-components';
|
|
2
|
+
import { tokens } from '@fluentui-copilot/tokens';
|
|
3
|
+
export const promptListboxClassNames = {
|
|
4
|
+
root: 'fai-PromptListbox'
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Styles for the root slot
|
|
8
|
+
*/ const useStyles = makeStyles({
|
|
9
|
+
listbox: {
|
|
10
|
+
boxShadow: tokens.shadow16,
|
|
11
|
+
borderRadius: tokens.borderRadiusMedium,
|
|
12
|
+
maxHeight: '80vh',
|
|
13
|
+
boxSizing: 'border-box'
|
|
14
|
+
},
|
|
15
|
+
listboxCollapsed: {
|
|
16
|
+
display: 'none'
|
|
17
|
+
},
|
|
18
|
+
// When rendering inline, the popupSurface will be rendered under relatively positioned elements such as Input.
|
|
19
|
+
// This is due to the surface being positioned as absolute, therefore zIndex: 1 ensures that won't happen.
|
|
20
|
+
inlineListbox: {
|
|
21
|
+
zIndex: 1
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* Apply styling to the PromptListbox slots based on the state
|
|
26
|
+
*/ export const usePromptListboxStyles_unstable = (state)=>{
|
|
27
|
+
'use no memo';
|
|
28
|
+
const styles = useStyles();
|
|
29
|
+
state.root.className = mergeClasses(promptListboxClassNames.root, styles.listbox, state.inlinePopup && styles.inlineListbox, !state.open && styles.listboxCollapsed, state.root.className);
|
|
30
|
+
return state;
|
|
31
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["usePromptListboxStyles.styles.ts"],"sourcesContent":["import { makeStyles, mergeClasses } from '@fluentui/react-components';\nimport { tokens } from '@fluentui-copilot/tokens';\nimport type { PromptListboxSlots, PromptListboxState } from './PromptListbox.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const promptListboxClassNames: SlotClassNames<PromptListboxSlots> = {\n root: 'fai-PromptListbox',\n};\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n listbox: {\n boxShadow: tokens.shadow16,\n borderRadius: tokens.borderRadiusMedium,\n maxHeight: '80vh',\n boxSizing: 'border-box',\n },\n\n listboxCollapsed: {\n display: 'none',\n },\n\n // When rendering inline, the popupSurface will be rendered under relatively positioned elements such as Input.\n // This is due to the surface being positioned as absolute, therefore zIndex: 1 ensures that won't happen.\n inlineListbox: {\n zIndex: 1,\n },\n});\n\n/**\n * Apply styling to the PromptListbox slots based on the state\n */\nexport const usePromptListboxStyles_unstable = (state: PromptListboxState): PromptListboxState => {\n 'use no memo';\n\n const styles = useStyles();\n state.root.className = mergeClasses(\n promptListboxClassNames.root,\n styles.listbox,\n state.inlinePopup && styles.inlineListbox,\n !state.open && styles.listboxCollapsed,\n state.root.className,\n );\n\n return state;\n};\n"],"names":["makeStyles","mergeClasses","tokens","promptListboxClassNames","root","useStyles","listbox","boxShadow","shadow16","borderRadius","borderRadiusMedium","maxHeight","boxSizing","listboxCollapsed","display","inlineListbox","zIndex","usePromptListboxStyles_unstable","state","styles","className","inlinePopup","open"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,UAAU,EAAEC,YAAY,QAAQ,6BAA6B;AACtE,SAASC,MAAM,QAAQ,2BAA2B;AAIlD,OAAO,MAAMC,0BAA8D;IACzEC,MAAM;AACR,EAAE;AAEF;;CAEC,GACD,MAAMC,YAAYL,WAAW;IAC3BM,SAAS;QACPC,WAAWL,OAAOM,QAAQ;QAC1BC,cAAcP,OAAOQ,kBAAkB;QACvCC,WAAW;QACXC,WAAW;IACb;IAEAC,kBAAkB;QAChBC,SAAS;IACX;IAEA,+GAA+G;IAC/G,0GAA0G;IAC1GC,eAAe;QACbC,QAAQ;IACV;AACF;AAEA;;CAEC,GACD,OAAO,MAAMC,kCAAkC,CAACC;IAC9C;IAEA,MAAMC,SAASd;IACfa,MAAMd,IAAI,CAACgB,SAAS,GAAGnB,aACrBE,wBAAwBC,IAAI,EAC5Be,OAAOb,OAAO,EACdY,MAAMG,WAAW,IAAIF,OAAOJ,aAAa,EACzC,CAACG,MAAMI,IAAI,IAAIH,OAAON,gBAAgB,EACtCK,MAAMd,IAAI,CAACgB,SAAS;IAGtB,OAAOF;AACT,EAAE"}
|
|
@@ -2,11 +2,9 @@ import * as React from 'react';
|
|
|
2
2
|
import { usePromptOption_unstable } from './usePromptOption';
|
|
3
3
|
import { renderPromptOption_unstable } from './renderPromptOption';
|
|
4
4
|
import { usePromptOptionStyles_unstable } from './usePromptOptionStyles.styles';
|
|
5
|
-
/**@deprecated - use Option instead */
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return renderPromptOption_unstable(state);
|
|
5
|
+
/**@deprecated - use Option instead */ export const PromptOption = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
6
|
+
const state = usePromptOption_unstable(props, ref);
|
|
7
|
+
usePromptOptionStyles_unstable(state);
|
|
8
|
+
return renderPromptOption_unstable(state);
|
|
10
9
|
});
|
|
11
10
|
PromptOption.displayName = 'PromptOption';
|
|
12
|
-
//# sourceMappingURL=PromptOption.js.map
|
|
@@ -2,4 +2,3 @@ export { PromptOption } from './PromptOption';
|
|
|
2
2
|
export { renderPromptOption_unstable } from './renderPromptOption';
|
|
3
3
|
export { usePromptOption_unstable } from './usePromptOption';
|
|
4
4
|
export { promptOptionClassNames, usePromptOptionStyles_unstable } from './usePromptOptionStyles.styles';
|
|
5
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { jsx as _jsx } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
2
|
import { assertSlots } from '@fluentui/react-components';
|
|
3
3
|
/**
|
|
4
4
|
* Render the final JSX of PromptOption
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return /*#__PURE__*/_jsx(state.root, {});
|
|
5
|
+
*/ export const renderPromptOption_unstable = (state)=>{
|
|
6
|
+
assertSlots(state);
|
|
7
|
+
return /*#__PURE__*/ _jsx(state.root, {});
|
|
9
8
|
};
|
|
10
|
-
//# sourceMappingURL=renderPromptOption.js.map
|