@fluentui/react-combobox 9.7.5 → 9.8.0
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.md +26 -5
- package/dist/index.d.ts +54 -11
- package/lib/components/Combobox/Combobox.types.js.map +1 -1
- package/lib/components/Combobox/renderCombobox.js +15 -11
- package/lib/components/Combobox/renderCombobox.js.map +1 -1
- package/lib/components/Combobox/useCombobox.js +12 -4
- package/lib/components/Combobox/useCombobox.js.map +1 -1
- package/lib/components/Combobox/useInputTriggerSlot.js +14 -12
- package/lib/components/Combobox/useInputTriggerSlot.js.map +1 -1
- package/lib/components/Dropdown/Dropdown.types.js.map +1 -1
- package/lib/components/Dropdown/renderDropdown.js +19 -15
- package/lib/components/Dropdown/renderDropdown.js.map +1 -1
- package/lib/components/Dropdown/useButtonTriggerSlot.js +51 -31
- package/lib/components/Dropdown/useButtonTriggerSlot.js.map +1 -1
- package/lib/components/Dropdown/useDropdown.js +14 -4
- package/lib/components/Dropdown/useDropdown.js.map +1 -1
- package/lib/components/Listbox/Listbox.types.js.map +1 -1
- package/lib/components/Listbox/renderListbox.js +7 -3
- package/lib/components/Listbox/renderListbox.js.map +1 -1
- package/lib/components/Listbox/useListbox.js +43 -35
- package/lib/components/Listbox/useListbox.js.map +1 -1
- package/lib/components/Option/Option.types.js.map +1 -1
- package/lib/components/Option/useOption.js +7 -11
- package/lib/components/Option/useOption.js.map +1 -1
- package/lib/components/Option/useOptionStyles.styles.js +27 -28
- package/lib/components/Option/useOptionStyles.styles.js.map +1 -1
- package/lib/contexts/useComboboxContextValues.js +14 -5
- package/lib/contexts/useComboboxContextValues.js.map +1 -1
- package/lib/contexts/useListboxContextValues.js +12 -5
- package/lib/contexts/useListboxContextValues.js.map +1 -1
- package/lib/utils/ComboboxBase.types.js.map +1 -1
- package/lib/utils/OptionCollection.types.js.map +1 -1
- package/lib/utils/Selection.types.js.map +1 -1
- package/lib/utils/dropdownKeyActions.js +0 -21
- package/lib/utils/dropdownKeyActions.js.map +1 -1
- package/lib/utils/useComboboxBaseState.js +52 -14
- package/lib/utils/useComboboxBaseState.js.map +1 -1
- package/lib/utils/useOptionCollection.js +18 -45
- package/lib/utils/useOptionCollection.js.map +1 -1
- package/lib/utils/useTriggerSlot.js +86 -33
- package/lib/utils/useTriggerSlot.js.map +1 -1
- package/lib-commonjs/components/Combobox/renderCombobox.js +15 -11
- package/lib-commonjs/components/Combobox/renderCombobox.js.map +1 -1
- package/lib-commonjs/components/Combobox/useCombobox.js +12 -4
- package/lib-commonjs/components/Combobox/useCombobox.js.map +1 -1
- package/lib-commonjs/components/Combobox/useInputTriggerSlot.js +14 -12
- package/lib-commonjs/components/Combobox/useInputTriggerSlot.js.map +1 -1
- package/lib-commonjs/components/Dropdown/renderDropdown.js +19 -15
- package/lib-commonjs/components/Dropdown/renderDropdown.js.map +1 -1
- package/lib-commonjs/components/Dropdown/useButtonTriggerSlot.js +51 -31
- package/lib-commonjs/components/Dropdown/useButtonTriggerSlot.js.map +1 -1
- package/lib-commonjs/components/Dropdown/useDropdown.js +14 -4
- package/lib-commonjs/components/Dropdown/useDropdown.js.map +1 -1
- package/lib-commonjs/components/Listbox/renderListbox.js +7 -3
- package/lib-commonjs/components/Listbox/renderListbox.js.map +1 -1
- package/lib-commonjs/components/Listbox/useListbox.js +42 -34
- package/lib-commonjs/components/Listbox/useListbox.js.map +1 -1
- package/lib-commonjs/components/Option/useOption.js +7 -11
- package/lib-commonjs/components/Option/useOption.js.map +1 -1
- package/lib-commonjs/components/Option/useOptionStyles.styles.js +85 -85
- package/lib-commonjs/components/Option/useOptionStyles.styles.js.map +1 -1
- package/lib-commonjs/contexts/useComboboxContextValues.js +13 -5
- package/lib-commonjs/contexts/useComboboxContextValues.js.map +1 -1
- package/lib-commonjs/contexts/useListboxContextValues.js +13 -5
- package/lib-commonjs/contexts/useListboxContextValues.js.map +1 -1
- package/lib-commonjs/utils/dropdownKeyActions.js +3 -30
- package/lib-commonjs/utils/dropdownKeyActions.js.map +1 -1
- package/lib-commonjs/utils/useComboboxBaseState.js +52 -14
- package/lib-commonjs/utils/useComboboxBaseState.js.map +1 -1
- package/lib-commonjs/utils/useOptionCollection.js +18 -45
- package/lib-commonjs/utils/useOptionCollection.js.map +1 -1
- package/lib-commonjs/utils/useTriggerSlot.js +84 -31
- package/lib-commonjs/utils/useTriggerSlot.js.map +1 -1
- package/package.json +9 -8
- package/lib/utils/useScrollOptionsIntoView.js +0 -29
- package/lib/utils/useScrollOptionsIntoView.js.map +0 -1
- package/lib-commonjs/utils/useScrollOptionsIntoView.js +0 -40
- package/lib-commonjs/utils/useScrollOptionsIntoView.js.map +0 -1
|
@@ -14,10 +14,36 @@ const _reactutilities = require("@fluentui/react-utilities");
|
|
|
14
14
|
const _useOptionCollection = require("../utils/useOptionCollection");
|
|
15
15
|
const _useSelection = require("../utils/useSelection");
|
|
16
16
|
const useComboboxBaseState = (props)=>{
|
|
17
|
-
const { appearance = 'outline', children, clearable = false, editable = false, inlinePopup = false, mountNode = undefined, multiselect, onOpenChange, size = 'medium' } = props;
|
|
17
|
+
const { appearance = 'outline', children, clearable = false, editable = false, inlinePopup = false, mountNode = undefined, multiselect, onOpenChange, size = 'medium', activeDescendantController } = props;
|
|
18
18
|
const optionCollection = (0, _useOptionCollection.useOptionCollection)();
|
|
19
|
-
const {
|
|
20
|
-
const
|
|
19
|
+
const { getOptionsMatchingValue } = optionCollection;
|
|
20
|
+
const { getOptionById } = optionCollection;
|
|
21
|
+
const getActiveOption = _react.useCallback(()=>{
|
|
22
|
+
const activeOptionId = activeDescendantController.active();
|
|
23
|
+
return activeOptionId ? getOptionById(activeOptionId) : undefined;
|
|
24
|
+
}, [
|
|
25
|
+
activeDescendantController,
|
|
26
|
+
getOptionById
|
|
27
|
+
]);
|
|
28
|
+
// Keeping some kind of backwards compatible functionality here
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
30
|
+
const UNSAFE_activeOption = getActiveOption();
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
32
|
+
const UNSAFE_setActiveOption = _react.useCallback((option)=>{
|
|
33
|
+
let nextOption = undefined;
|
|
34
|
+
if (typeof option === 'function') {
|
|
35
|
+
const activeOption = getActiveOption();
|
|
36
|
+
nextOption = option(activeOption);
|
|
37
|
+
}
|
|
38
|
+
if (nextOption) {
|
|
39
|
+
activeDescendantController.focus(nextOption.id);
|
|
40
|
+
} else {
|
|
41
|
+
activeDescendantController.blur();
|
|
42
|
+
}
|
|
43
|
+
}, [
|
|
44
|
+
activeDescendantController,
|
|
45
|
+
getActiveOption
|
|
46
|
+
]);
|
|
21
47
|
// track whether keyboard focus outline should be shown
|
|
22
48
|
// tabster/keyborg doesn't work here, since the actual keyboard focus target doesn't move
|
|
23
49
|
const [focusVisible, setFocusVisible] = _react.useState(false);
|
|
@@ -77,30 +103,42 @@ const useComboboxBaseState = (props)=>{
|
|
|
77
103
|
onOpenChange,
|
|
78
104
|
setOpenState
|
|
79
105
|
]);
|
|
80
|
-
// update active option based on change in open state
|
|
106
|
+
// update active option based on change in open state
|
|
81
107
|
_react.useEffect(()=>{
|
|
82
|
-
if (open
|
|
108
|
+
if (open) {
|
|
83
109
|
// if it is single-select and there is a selected option, start at the selected option
|
|
84
110
|
if (!multiselect && selectedOptions.length > 0) {
|
|
85
111
|
const selectedOption = getOptionsMatchingValue((v)=>v === selectedOptions[0]).pop();
|
|
86
|
-
selectedOption
|
|
87
|
-
|
|
88
|
-
|
|
112
|
+
if (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.id) {
|
|
113
|
+
activeDescendantController.focus(selectedOption.id);
|
|
114
|
+
}
|
|
89
115
|
}
|
|
90
|
-
} else
|
|
91
|
-
|
|
92
|
-
setActiveOption(undefined);
|
|
116
|
+
} else {
|
|
117
|
+
activeDescendantController.blur();
|
|
93
118
|
}
|
|
94
119
|
// this should only be run in response to changes in the open state or children
|
|
95
120
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
96
121
|
}, [
|
|
97
122
|
open,
|
|
98
|
-
|
|
123
|
+
activeDescendantController
|
|
124
|
+
]);
|
|
125
|
+
// Fallback focus when children are updated in an open popover results in no item being focused
|
|
126
|
+
_react.useEffect(()=>{
|
|
127
|
+
if (open) {
|
|
128
|
+
if (!activeDescendantController.active()) {
|
|
129
|
+
activeDescendantController.first();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
// this should only be run in response to changes in the open state or children
|
|
133
|
+
}, [
|
|
134
|
+
open,
|
|
135
|
+
children,
|
|
136
|
+
activeDescendantController
|
|
99
137
|
]);
|
|
100
138
|
return {
|
|
101
139
|
...optionCollection,
|
|
102
140
|
...selectionState,
|
|
103
|
-
activeOption,
|
|
141
|
+
activeOption: UNSAFE_activeOption,
|
|
104
142
|
appearance,
|
|
105
143
|
clearable,
|
|
106
144
|
focusVisible,
|
|
@@ -109,7 +147,7 @@ const useComboboxBaseState = (props)=>{
|
|
|
109
147
|
inlinePopup,
|
|
110
148
|
mountNode,
|
|
111
149
|
open,
|
|
112
|
-
setActiveOption,
|
|
150
|
+
setActiveOption: UNSAFE_setActiveOption,
|
|
113
151
|
setFocusVisible,
|
|
114
152
|
setHasFocus,
|
|
115
153
|
setOpen,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useComboboxBaseState.js"],"sourcesContent":["import * as React from 'react';\nimport { useControllableState, useFirstMount } from '@fluentui/react-utilities';\nimport { useOptionCollection } from '../utils/useOptionCollection';\nimport { useSelection } from '../utils/useSelection';\n/**\n * State shared between Combobox and Dropdown components\n */ export const useComboboxBaseState = (props)=>{\n const { appearance = 'outline', children, clearable = false, editable = false, inlinePopup = false, mountNode = undefined, multiselect, onOpenChange, size = 'medium' } = props;\n const optionCollection = useOptionCollection();\n const { getOptionAtIndex, getOptionsMatchingValue } = optionCollection;\n const [activeOption, setActiveOption] = React.useState();\n // track whether keyboard focus outline should be shown\n // tabster/keyborg doesn't work here, since the actual keyboard focus target doesn't move\n const [focusVisible, setFocusVisible] = React.useState(false);\n // track focused state to conditionally render collapsed listbox\n // when the trigger is focused - the listbox should but hidden until the open state is changed\n const [hasFocus, setHasFocus] = React.useState(false);\n const ignoreNextBlur = React.useRef(false);\n const selectionState = useSelection(props);\n const { selectedOptions } = selectionState;\n // calculate value based on props, internal value changes, and selected options\n const isFirstMount = useFirstMount();\n const [controllableValue, setValue] = useControllableState({\n state: props.value,\n initialState: undefined\n });\n const value = React.useMemo(()=>{\n // don't compute the value if it is defined through props or setValue,\n if (controllableValue !== undefined) {\n return controllableValue;\n }\n // handle defaultValue here, so it is overridden by selection\n if (isFirstMount && props.defaultValue !== undefined) {\n return props.defaultValue;\n }\n const selectedOptionsText = getOptionsMatchingValue((optionValue)=>{\n return selectedOptions.includes(optionValue);\n }).map((option)=>option.text);\n if (multiselect) {\n // editable inputs should not display multiple selected options in the input as text\n return editable ? '' : selectedOptionsText.join(', ');\n }\n return selectedOptionsText[0];\n // do not change value after isFirstMount changes,\n // we do not want to accidentally override defaultValue on a second render\n // unless another value is intentionally set\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n controllableValue,\n editable,\n getOptionsMatchingValue,\n multiselect,\n props.defaultValue,\n selectedOptions\n ]);\n // Handle open state, which is shared with options in context\n const [open, setOpenState] = useControllableState({\n state: props.open,\n defaultState: props.defaultOpen,\n initialState: false\n });\n const setOpen = React.useCallback((event, newState)=>{\n onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(event, {\n open: newState\n });\n setOpenState(newState);\n }, [\n onOpenChange,\n setOpenState\n ]);\n // update active option based on change in open state or children\n React.useEffect(()=>{\n if (open && !activeOption) {\n // if it is single-select and there is a selected option, start at the selected option\n if (!multiselect && selectedOptions.length > 0) {\n const selectedOption = getOptionsMatchingValue((v)=>v === selectedOptions[0]).pop();\n selectedOption && setActiveOption(selectedOption);\n } else {\n setActiveOption(getOptionAtIndex(0));\n }\n } else if (!open) {\n // reset the active option when closing\n setActiveOption(undefined);\n }\n // this should only be run in response to changes in the open state or children\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n open,\n children\n ]);\n return {\n ...optionCollection,\n ...selectionState,\n activeOption,\n appearance,\n clearable,\n focusVisible,\n hasFocus,\n ignoreNextBlur,\n inlinePopup,\n mountNode,\n open,\n setActiveOption,\n setFocusVisible,\n setHasFocus,\n setOpen,\n setValue,\n size,\n value,\n multiselect\n };\n};\n"],"names":["useComboboxBaseState","props","appearance","children","clearable","editable","inlinePopup","mountNode","undefined","multiselect","onOpenChange","size","optionCollection","useOptionCollection","getOptionAtIndex","getOptionsMatchingValue","activeOption","setActiveOption","React","useState","focusVisible","setFocusVisible","hasFocus","setHasFocus","ignoreNextBlur","useRef","selectionState","useSelection","selectedOptions","isFirstMount","useFirstMount","controllableValue","setValue","useControllableState","state","value","initialState","useMemo","defaultValue","selectedOptionsText","optionValue","includes","map","option","text","join","open","setOpenState","defaultState","defaultOpen","setOpen","useCallback","event","newState","useEffect","length","selectedOption","v","pop"],"mappings":";;;;+BAMiBA;;;eAAAA;;;;iEANM;gCAC6B;qCAChB;8BACP;AAGlB,MAAMA,uBAAuB,CAACC;IACrC,MAAM,EAAEC,aAAa,SAAS,EAAEC,QAAQ,EAAEC,YAAY,KAAK,EAAEC,WAAW,KAAK,EAAEC,cAAc,KAAK,EAAEC,YAAYC,SAAS,EAAEC,WAAW,EAAEC,YAAY,EAAEC,OAAO,QAAQ,EAAE,GAAGV;IAC1K,MAAMW,mBAAmBC,IAAAA,wCAAmB;IAC5C,MAAM,EAAEC,gBAAgB,EAAEC,uBAAuB,EAAE,GAAGH;IACtD,MAAM,CAACI,cAAcC,gBAAgB,GAAGC,OAAMC,QAAQ;IACtD,uDAAuD;IACvD,yFAAyF;IACzF,MAAM,CAACC,cAAcC,gBAAgB,GAAGH,OAAMC,QAAQ,CAAC;IACvD,gEAAgE;IAChE,8FAA8F;IAC9F,MAAM,CAACG,UAAUC,YAAY,GAAGL,OAAMC,Q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ACAqC;KACH;IACD,iEAAiE;IACjE7B,OAAMoC,SAAS,CAAC;QACZ,IAAIR,QAAQ,CAAC9B,cAAc;YACvB,sFAAsF;YACtF,IAAI,CAACP,eAAemB,gBAAgB2B,MAAM,GAAG,GAAG;gBAC5C,MAAMC,iBAAiBzC,wBAAwB,CAAC0C,IAAIA,MAAM7B,eAAe,CAAC,EAAE,EAAE8B,GAAG;gBACjFF,kBAAkBvC,gBAAgBuC;YACtC,OAAO;gBACHvC,gBAAgBH,iBAAiB;YACrC;QACJ,OAAO,IAAI,CAACgC,MAAM;YACd,uCAAuC;YACvC7B,gBAAgBT;QACpB;IACJ,+EAA+E;IAC/E,uDAAuD;IACvD,GAAG;QACCsC;QACA3C;KACH;IACD,OAAO;QACH,GAAGS,gBAAgB;QACnB,GAAGc,cAAc;QACjBV;QACAd;QACAE;QACAgB;QACAE;QACAE;QACAlB;QACAC;QACAuC;QACA7B;QACAI;QACAE;QACA2B;QACAlB;QACArB;QACAwB;QACA1B;IACJ;AACJ"}
|
|
1
|
+
{"version":3,"sources":["useComboboxBaseState.js"],"sourcesContent":["import * as React from 'react';\nimport { useControllableState, useFirstMount } from '@fluentui/react-utilities';\nimport { useOptionCollection } from '../utils/useOptionCollection';\nimport { useSelection } from '../utils/useSelection';\n/**\n * State shared between Combobox and Dropdown components\n */ export const useComboboxBaseState = (props)=>{\n const { appearance = 'outline', children, clearable = false, editable = false, inlinePopup = false, mountNode = undefined, multiselect, onOpenChange, size = 'medium', activeDescendantController } = props;\n const optionCollection = useOptionCollection();\n const { getOptionsMatchingValue } = optionCollection;\n const { getOptionById } = optionCollection;\n const getActiveOption = React.useCallback(()=>{\n const activeOptionId = activeDescendantController.active();\n return activeOptionId ? getOptionById(activeOptionId) : undefined;\n }, [\n activeDescendantController,\n getOptionById\n ]);\n // Keeping some kind of backwards compatible functionality here\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const UNSAFE_activeOption = getActiveOption();\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const UNSAFE_setActiveOption = React.useCallback((option)=>{\n let nextOption = undefined;\n if (typeof option === 'function') {\n const activeOption = getActiveOption();\n nextOption = option(activeOption);\n }\n if (nextOption) {\n activeDescendantController.focus(nextOption.id);\n } else {\n activeDescendantController.blur();\n }\n }, [\n activeDescendantController,\n getActiveOption\n ]);\n // track whether keyboard focus outline should be shown\n // tabster/keyborg doesn't work here, since the actual keyboard focus target doesn't move\n const [focusVisible, setFocusVisible] = React.useState(false);\n // track focused state to conditionally render collapsed listbox\n // when the trigger is focused - the listbox should but hidden until the open state is changed\n const [hasFocus, setHasFocus] = React.useState(false);\n const ignoreNextBlur = React.useRef(false);\n const selectionState = useSelection(props);\n const { selectedOptions } = selectionState;\n // calculate value based on props, internal value changes, and selected options\n const isFirstMount = useFirstMount();\n const [controllableValue, setValue] = useControllableState({\n state: props.value,\n initialState: undefined\n });\n const value = React.useMemo(()=>{\n // don't compute the value if it is defined through props or setValue,\n if (controllableValue !== undefined) {\n return controllableValue;\n }\n // handle defaultValue here, so it is overridden by selection\n if (isFirstMount && props.defaultValue !== undefined) {\n return props.defaultValue;\n }\n const selectedOptionsText = getOptionsMatchingValue((optionValue)=>{\n return selectedOptions.includes(optionValue);\n }).map((option)=>option.text);\n if (multiselect) {\n // editable inputs should not display multiple selected options in the input as text\n return editable ? '' : selectedOptionsText.join(', ');\n }\n return selectedOptionsText[0];\n // do not change value after isFirstMount changes,\n // we do not want to accidentally override defaultValue on a second render\n // unless another value is intentionally set\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n controllableValue,\n editable,\n getOptionsMatchingValue,\n multiselect,\n props.defaultValue,\n selectedOptions\n ]);\n // Handle open state, which is shared with options in context\n const [open, setOpenState] = useControllableState({\n state: props.open,\n defaultState: props.defaultOpen,\n initialState: false\n });\n const setOpen = React.useCallback((event, newState)=>{\n onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(event, {\n open: newState\n });\n setOpenState(newState);\n }, [\n onOpenChange,\n setOpenState\n ]);\n // update active option based on change in open state\n React.useEffect(()=>{\n if (open) {\n // if it is single-select and there is a selected option, start at the selected option\n if (!multiselect && selectedOptions.length > 0) {\n const selectedOption = getOptionsMatchingValue((v)=>v === selectedOptions[0]).pop();\n if (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.id) {\n activeDescendantController.focus(selectedOption.id);\n }\n }\n } else {\n activeDescendantController.blur();\n }\n // this should only be run in response to changes in the open state or children\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n open,\n activeDescendantController\n ]);\n // Fallback focus when children are updated in an open popover results in no item being focused\n React.useEffect(()=>{\n if (open) {\n if (!activeDescendantController.active()) {\n activeDescendantController.first();\n }\n }\n // this should only be run in response to changes in the open state or children\n }, [\n open,\n children,\n activeDescendantController\n ]);\n return {\n ...optionCollection,\n ...selectionState,\n activeOption: UNSAFE_activeOption,\n appearance,\n clearable,\n focusVisible,\n hasFocus,\n ignoreNextBlur,\n inlinePopup,\n mountNode,\n open,\n setActiveOption: UNSAFE_setActiveOption,\n setFocusVisible,\n setHasFocus,\n setOpen,\n setValue,\n size,\n value,\n multiselect\n };\n};\n"],"names":["useComboboxBaseState","props","appearance","children","clearable","editable","inlinePopup","mountNode","undefined","multiselect","onOpenChange","size","activeDescendantController","optionCollection","useOptionCollection","getOptionsMatchingValue","getOptionById","getActiveOption","React","useCallback","activeOptionId","active","UNSAFE_activeOption","UNSAFE_setActiveOption","option","nextOption","activeOption","focus","id","blur","focusVisible","setFocusVisible","useState","hasFocus","setHasFocus","ignoreNextBlur","useRef","selectionState","useSelection","selectedOptions","isFirstMount","useFirstMount","controllableValue","setValue","useControllableState","state","value","initialState","useMemo","defaultValue","selectedOptionsText","optionValue","includes","map","text","join","open","setOpenState","defaultState","defaultOpen","setOpen","event","newState","useEffect","length","selectedOption","v","pop","first","setActiveOption"],"mappings":";;;;+BAMiBA;;;eAAAA;;;;iEANM;gCAC6B;qCAChB;8BACP;AAGlB,MAAMA,uBAAuB,CAACC;IAC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IAAIF,mBAAmB,QAAQA,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAerC,EAAE,EAAE;oBACnFhB,2BAA2Be,KAAK,CAACsC,eAAerC,EAAE;gBACtD;YACJ;QACJ,OAAO;YACHhB,2BAA2BiB,IAAI;QACnC;IACJ,+EAA+E;IAC/E,uDAAuD;IACvD,GAAG;QACC2B;QACA5C;KACH;IACD,+FAA+F;IAC/FM,OAAM6C,SAAS,CAAC;QACZ,IAAIP,MAAM;YACN,IAAI,CAAC5C,2BAA2BS,MAAM,IAAI;gBACtCT,2BAA2BwD,KAAK;YACpC;QACJ;IACJ,+EAA+E;IAC/E,GAAG;QACCZ;QACArD;QACAS;KACH;IACD,OAAO;QACH,GAAGC,gBAAgB;QACnB,GAAGwB,cAAc;QACjBX,cAAcJ;QACdpB;QACAE;QACA0B;QACAG;QACAE;QACA7B;QACAC;QACAiD;QACAa,iBAAiB9C;QACjBQ;QACAG;QACA0B;QACAjB;QACAhC;QACAmC;QACArC;IACJ;AACJ"}
|
|
@@ -11,23 +11,26 @@ Object.defineProperty(exports, "useOptionCollection", {
|
|
|
11
11
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
12
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
13
|
const useOptionCollection = ()=>{
|
|
14
|
-
const
|
|
14
|
+
const optionsById = _react.useRef(new Map());
|
|
15
15
|
const collectionAPI = _react.useMemo(()=>{
|
|
16
|
-
const getCount = ()=>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
const getIndexOfId = (id)=>nodes.current.findIndex((node)=>node.option.id === id);
|
|
16
|
+
const getCount = ()=>optionsById.current.size;
|
|
17
|
+
// index searches are no longer used
|
|
18
|
+
const getOptionAtIndex = ()=>undefined;
|
|
19
|
+
const getIndexOfId = ()=>-1;
|
|
22
20
|
const getOptionById = (id)=>{
|
|
23
|
-
|
|
24
|
-
return item === null || item === void 0 ? void 0 : item.option;
|
|
21
|
+
return optionsById.current.get(id);
|
|
25
22
|
};
|
|
26
23
|
const getOptionsMatchingText = (matcher)=>{
|
|
27
|
-
return
|
|
24
|
+
return Array.from(optionsById.current.values()).filter(({ text })=>matcher(text));
|
|
28
25
|
};
|
|
29
26
|
const getOptionsMatchingValue = (matcher)=>{
|
|
30
|
-
|
|
27
|
+
const matches = [];
|
|
28
|
+
for (const option of optionsById.current.values()){
|
|
29
|
+
if (matcher(option.value)) {
|
|
30
|
+
matches.push(option);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return matches;
|
|
31
34
|
};
|
|
32
35
|
return {
|
|
33
36
|
getCount,
|
|
@@ -38,43 +41,13 @@ const useOptionCollection = ()=>{
|
|
|
38
41
|
getOptionsMatchingValue
|
|
39
42
|
};
|
|
40
43
|
}, []);
|
|
41
|
-
const registerOption = _react.useCallback((option
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (!node.element || !element) {
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
if (node.option.id === option.id) {
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
50
|
-
// use the DOM method compareDocumentPosition to order the current node against registered nodes
|
|
51
|
-
// eslint-disable-next-line no-bitwise
|
|
52
|
-
return node.element.compareDocumentPosition(element) & Node.DOCUMENT_POSITION_PRECEDING;
|
|
53
|
-
});
|
|
54
|
-
// do not register the option if it already exists
|
|
55
|
-
if (((_nodes_current_index = nodes.current[index]) === null || _nodes_current_index === void 0 ? void 0 : _nodes_current_index.option.id) !== option.id) {
|
|
56
|
-
const newItem = {
|
|
57
|
-
element,
|
|
58
|
-
option
|
|
59
|
-
};
|
|
60
|
-
// If an index is not found we will push the element to the end.
|
|
61
|
-
if (index === -1) {
|
|
62
|
-
nodes.current = [
|
|
63
|
-
...nodes.current,
|
|
64
|
-
newItem
|
|
65
|
-
];
|
|
66
|
-
} else {
|
|
67
|
-
nodes.current.splice(index, 0, newItem);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
// return the unregister function
|
|
71
|
-
return ()=>{
|
|
72
|
-
nodes.current = nodes.current.filter((node)=>node.option.id !== option.id);
|
|
73
|
-
};
|
|
44
|
+
const registerOption = _react.useCallback((option)=>{
|
|
45
|
+
optionsById.current.set(option.id, option);
|
|
46
|
+
return ()=>optionsById.current.delete(option.id);
|
|
74
47
|
}, []);
|
|
75
48
|
return {
|
|
76
49
|
...collectionAPI,
|
|
77
|
-
options:
|
|
50
|
+
options: Array.from(optionsById.current.values()),
|
|
78
51
|
registerOption
|
|
79
52
|
};
|
|
80
53
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useOptionCollection.js"],"sourcesContent":["import * as React from 'react';\n/**\n * A hook for managing a collection of child Options\n */ export const useOptionCollection = ()=>{\n const
|
|
1
|
+
{"version":3,"sources":["useOptionCollection.js"],"sourcesContent":["import * as React from 'react';\n/**\n * A hook for managing a collection of child Options\n */ export const useOptionCollection = ()=>{\n const optionsById = React.useRef(new Map());\n const collectionAPI = React.useMemo(()=>{\n const getCount = ()=>optionsById.current.size;\n // index searches are no longer used\n const getOptionAtIndex = ()=>undefined;\n const getIndexOfId = ()=>-1;\n const getOptionById = (id)=>{\n return optionsById.current.get(id);\n };\n const getOptionsMatchingText = (matcher)=>{\n return Array.from(optionsById.current.values()).filter(({ text })=>matcher(text));\n };\n const getOptionsMatchingValue = (matcher)=>{\n const matches = [];\n for (const option of optionsById.current.values()){\n if (matcher(option.value)) {\n matches.push(option);\n }\n }\n return matches;\n };\n return {\n getCount,\n getOptionAtIndex,\n getIndexOfId,\n getOptionById,\n getOptionsMatchingText,\n getOptionsMatchingValue\n };\n }, []);\n const registerOption = React.useCallback((option)=>{\n optionsById.current.set(option.id, option);\n return ()=>optionsById.current.delete(option.id);\n }, []);\n return {\n ...collectionAPI,\n options: Array.from(optionsById.current.values()),\n registerOption\n };\n};\n"],"names":["useOptionCollection","optionsById","React","useRef","Map","collectionAPI","useMemo","getCount","current","size","getOptionAtIndex","undefined","getIndexOfId","getOptionById","id","get","getOptionsMatchingText","matcher","Array","from","values","filter","text","getOptionsMatchingValue","matches","option","value","push","registerOption","useCallback","set","delete","options"],"mappings":";;;;+BAGiBA;;;eAAAA;;;;iEAHM;AAGZ,MAAMA,sBAAsB;IACnC,MAAMC,cAAcC,OAAMC,MAAM,CAAC,IAAIC;IACrC,MAAMC,gBAAgBH,OAAMI,OAAO,CAAC;QAChC,MAAMC,WAAW,IAAIN,YAAYO,OAAO,CAACC,IAAI;QAC7C,oCAAoC;QACpC,MAAMC,mBAAmB,IAAIC;QAC7B,MAAMC,eAAe,IAAI,CAAC;QAC1B,MAAMC,gBAAgB,CAACC;YACnB,OAAOb,YAAYO,OAAO,CAACO,GAAG,CAACD;QACnC;QACA,MAAME,yBAAyB,CAACC;YAC5B,OAAOC,MAAMC,IAAI,CAAClB,YAAYO,OAAO,CAACY,MAAM,IAAIC,MAAM,CAAC,CAAC,EAAEC,IAAI,EAAE,GAAGL,QAAQK;QAC/E;QACA,MAAMC,0BAA0B,CAACN;YAC7B,MAAMO,UAAU,EAAE;YAClB,KAAK,MAAMC,UAAUxB,YAAYO,OAAO,CAACY,MAAM,GAAG;gBAC9C,IAAIH,QAAQQ,OAAOC,KAAK,GAAG;oBACvBF,QAAQG,IAAI,CAACF;gBACjB;YACJ;YACA,OAAOD;QACX;QACA,OAAO;YACHjB;YACAG;YACAE;YACAC;YACAG;YACAO;QACJ;IACJ,GAAG,EAAE;IACL,MAAMK,iBAAiB1B,OAAM2B,WAAW,CAAC,CAACJ;QACtCxB,YAAYO,OAAO,CAACsB,GAAG,CAACL,OAAOX,EAAE,EAAEW;QACnC,OAAO,IAAIxB,YAAYO,OAAO,CAACuB,MAAM,CAACN,OAAOX,EAAE;IACnD,GAAG,EAAE;IACL,OAAO;QACH,GAAGT,aAAa;QAChB2B,SAASd,MAAMC,IAAI,CAAClB,YAAYO,OAAO,CAACY,MAAM;QAC9CQ;IACJ;AACJ"}
|
|
@@ -10,15 +10,15 @@ Object.defineProperty(exports, "useTriggerSlot", {
|
|
|
10
10
|
});
|
|
11
11
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
12
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
|
+
const _reacttabster = require("@fluentui/react-tabster");
|
|
13
14
|
const _reactutilities = require("@fluentui/react-utilities");
|
|
14
15
|
const _dropdownKeyActions = require("../utils/dropdownKeyActions");
|
|
15
16
|
function useTriggerSlot(triggerSlotFromProp, ref, options) {
|
|
16
|
-
const { state: {
|
|
17
|
+
const { state: { open, setOpen, setHasFocus }, defaultProps, elementType, activeDescendantController } = options;
|
|
17
18
|
const trigger = _reactutilities.slot.always(triggerSlotFromProp, {
|
|
18
19
|
defaultProps: {
|
|
19
20
|
type: 'text',
|
|
20
21
|
'aria-expanded': open,
|
|
21
|
-
'aria-activedescendant': open ? activeOption === null || activeOption === void 0 ? void 0 : activeOption.id : undefined,
|
|
22
22
|
role: 'combobox',
|
|
23
23
|
...typeof defaultProps === 'object' && defaultProps
|
|
24
24
|
},
|
|
@@ -41,49 +41,102 @@ function useTriggerSlot(triggerSlotFromProp, ref, options) {
|
|
|
41
41
|
setOpen(event, !open);
|
|
42
42
|
}, trigger.onClick);
|
|
43
43
|
// handle combobox keyboard interaction
|
|
44
|
-
trigger.onKeyDown = (0, _reactutilities.mergeCallbacks)((
|
|
45
|
-
|
|
44
|
+
trigger.onKeyDown = (0, _reactutilities.mergeCallbacks)(useTriggerKeydown({
|
|
45
|
+
activeDescendantController,
|
|
46
|
+
...options.state
|
|
47
|
+
}), trigger.onKeyDown);
|
|
48
|
+
return trigger;
|
|
49
|
+
}
|
|
50
|
+
function useTriggerKeydown(options) {
|
|
51
|
+
const { activeDescendantController, getOptionById, setOpen, selectOption, multiselect, open } = options;
|
|
52
|
+
const getActiveOption = _react.useCallback(()=>{
|
|
53
|
+
const activeOptionId = activeDescendantController.active();
|
|
54
|
+
return activeOptionId ? getOptionById(activeOptionId) : undefined;
|
|
55
|
+
}, [
|
|
56
|
+
activeDescendantController,
|
|
57
|
+
getOptionById
|
|
58
|
+
]);
|
|
59
|
+
const first = ()=>{
|
|
60
|
+
activeDescendantController.first();
|
|
61
|
+
};
|
|
62
|
+
const next = (activeOption)=>{
|
|
63
|
+
if (activeOption) {
|
|
64
|
+
activeDescendantController.next();
|
|
65
|
+
} else {
|
|
66
|
+
activeDescendantController.first();
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const previous = (activeOption)=>{
|
|
70
|
+
if (activeOption) {
|
|
71
|
+
activeDescendantController.prev();
|
|
72
|
+
} else {
|
|
73
|
+
activeDescendantController.first();
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const pageUp = ()=>{
|
|
77
|
+
for(let i = 0; i < 10; i++){
|
|
78
|
+
activeDescendantController.prev();
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const pageDown = ()=>{
|
|
82
|
+
for(let i = 0; i < 10; i++){
|
|
83
|
+
activeDescendantController.next();
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
const setKeyboardNavigation = (0, _reacttabster.useSetKeyboardNavigation)();
|
|
87
|
+
return (0, _reactutilities.useEventCallback)((e)=>{
|
|
88
|
+
const action = (0, _dropdownKeyActions.getDropdownActionFromKey)(e, {
|
|
46
89
|
open,
|
|
47
90
|
multiselect
|
|
48
91
|
});
|
|
49
|
-
const
|
|
50
|
-
const activeIndex = activeOption ? getIndexOfId(activeOption.id) : -1;
|
|
51
|
-
let newIndex = activeIndex;
|
|
92
|
+
const activeOption = getActiveOption();
|
|
52
93
|
switch(action){
|
|
94
|
+
case 'First':
|
|
95
|
+
case 'Next':
|
|
96
|
+
case 'Previous':
|
|
97
|
+
case 'PageDown':
|
|
98
|
+
case 'PageUp':
|
|
53
99
|
case 'Open':
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
100
|
+
case 'Close':
|
|
101
|
+
case 'CloseSelect':
|
|
102
|
+
case 'Select':
|
|
103
|
+
e.preventDefault();
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
setKeyboardNavigation(true);
|
|
107
|
+
switch(action){
|
|
108
|
+
case 'First':
|
|
109
|
+
first();
|
|
110
|
+
break;
|
|
111
|
+
case 'Next':
|
|
112
|
+
next(activeOption);
|
|
113
|
+
break;
|
|
114
|
+
case 'Previous':
|
|
115
|
+
previous(activeOption);
|
|
116
|
+
break;
|
|
117
|
+
case 'PageDown':
|
|
118
|
+
pageDown();
|
|
119
|
+
break;
|
|
120
|
+
case 'PageUp':
|
|
121
|
+
pageUp();
|
|
122
|
+
break;
|
|
123
|
+
case 'Open':
|
|
124
|
+
setOpen(e, true);
|
|
57
125
|
break;
|
|
58
126
|
case 'Close':
|
|
59
127
|
// stop propagation for escape key to avoid dismissing any parent popups
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
setOpen(event, false);
|
|
128
|
+
e.stopPropagation();
|
|
129
|
+
setOpen(e, false);
|
|
63
130
|
break;
|
|
64
131
|
case 'CloseSelect':
|
|
65
|
-
!multiselect && !(activeOption === null || activeOption === void 0 ? void 0 : activeOption.disabled) && setOpen(
|
|
132
|
+
!multiselect && !(activeOption === null || activeOption === void 0 ? void 0 : activeOption.disabled) && setOpen(e, false);
|
|
66
133
|
// fallthrough
|
|
67
134
|
case 'Select':
|
|
68
|
-
activeOption && selectOption(
|
|
69
|
-
event.preventDefault();
|
|
135
|
+
activeOption && selectOption(e, activeOption);
|
|
70
136
|
break;
|
|
71
137
|
case 'Tab':
|
|
72
|
-
!multiselect && activeOption && selectOption(
|
|
138
|
+
!multiselect && activeOption && selectOption(e, activeOption);
|
|
73
139
|
break;
|
|
74
|
-
default:
|
|
75
|
-
newIndex = (0, _dropdownKeyActions.getIndexFromAction)(action, activeIndex, maxIndex);
|
|
76
|
-
}
|
|
77
|
-
if (newIndex !== activeIndex) {
|
|
78
|
-
// prevent default page scroll/keyboard action if the index changed
|
|
79
|
-
event.preventDefault();
|
|
80
|
-
setActiveOption(getOptionAtIndex(newIndex));
|
|
81
|
-
setFocusVisible(true);
|
|
82
140
|
}
|
|
83
|
-
}
|
|
84
|
-
trigger.onMouseOver = (0, _reactutilities.mergeCallbacks)((event)=>{
|
|
85
|
-
setFocusVisible(false);
|
|
86
|
-
}, trigger.onMouseOver);
|
|
87
|
-
// TODO fix cast
|
|
88
|
-
return trigger;
|
|
141
|
+
});
|
|
89
142
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useTriggerSlot.js"],"sourcesContent":["import * as React from 'react';\nimport { mergeCallbacks, slot, useMergedRefs } from '@fluentui/react-utilities';\nimport { getDropdownActionFromKey
|
|
1
|
+
{"version":3,"sources":["useTriggerSlot.js"],"sourcesContent":["import * as React from 'react';\nimport { useSetKeyboardNavigation } from '@fluentui/react-tabster';\nimport { mergeCallbacks, slot, useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\nimport { getDropdownActionFromKey } from '../utils/dropdownKeyActions';\n/**\n * Shared trigger behaviour for combobox and dropdown\n * @returns trigger slot with desired behaviour and props\n */ export function useTriggerSlot(triggerSlotFromProp, ref, options) {\n const { state: { open, setOpen, setHasFocus }, defaultProps, elementType, activeDescendantController } = options;\n const trigger = slot.always(triggerSlotFromProp, {\n defaultProps: {\n type: 'text',\n 'aria-expanded': open,\n role: 'combobox',\n ...typeof defaultProps === 'object' && defaultProps\n },\n elementType\n });\n // handle trigger focus/blur\n const triggerRef = React.useRef(null);\n trigger.ref = useMergedRefs(triggerRef, trigger.ref, ref);\n // the trigger should open/close the popup on click or blur\n trigger.onBlur = mergeCallbacks((event)=>{\n setOpen(event, false);\n setHasFocus(false);\n }, trigger.onBlur);\n trigger.onFocus = mergeCallbacks((event)=>{\n if (event.target === event.currentTarget) {\n setHasFocus(true);\n }\n }, trigger.onFocus);\n trigger.onClick = mergeCallbacks((event)=>{\n setOpen(event, !open);\n }, trigger.onClick);\n // handle combobox keyboard interaction\n trigger.onKeyDown = mergeCallbacks(useTriggerKeydown({\n activeDescendantController,\n ...options.state\n }), trigger.onKeyDown);\n return trigger;\n}\nfunction useTriggerKeydown(options) {\n const { activeDescendantController, getOptionById, setOpen, selectOption, multiselect, open } = options;\n const getActiveOption = React.useCallback(()=>{\n const activeOptionId = activeDescendantController.active();\n return activeOptionId ? getOptionById(activeOptionId) : undefined;\n }, [\n activeDescendantController,\n getOptionById\n ]);\n const first = ()=>{\n activeDescendantController.first();\n };\n const next = (activeOption)=>{\n if (activeOption) {\n activeDescendantController.next();\n } else {\n activeDescendantController.first();\n }\n };\n const previous = (activeOption)=>{\n if (activeOption) {\n activeDescendantController.prev();\n } else {\n activeDescendantController.first();\n }\n };\n const pageUp = ()=>{\n for(let i = 0; i < 10; i++){\n activeDescendantController.prev();\n }\n };\n const pageDown = ()=>{\n for(let i = 0; i < 10; i++){\n activeDescendantController.next();\n }\n };\n const setKeyboardNavigation = useSetKeyboardNavigation();\n return useEventCallback((e)=>{\n const action = getDropdownActionFromKey(e, {\n open,\n multiselect\n });\n const activeOption = getActiveOption();\n switch(action){\n case 'First':\n case 'Next':\n case 'Previous':\n case 'PageDown':\n case 'PageUp':\n case 'Open':\n case 'Close':\n case 'CloseSelect':\n case 'Select':\n e.preventDefault();\n break;\n }\n setKeyboardNavigation(true);\n switch(action){\n case 'First':\n first();\n break;\n case 'Next':\n next(activeOption);\n break;\n case 'Previous':\n previous(activeOption);\n break;\n case 'PageDown':\n pageDown();\n break;\n case 'PageUp':\n pageUp();\n break;\n case 'Open':\n setOpen(e, true);\n break;\n case 'Close':\n // stop propagation for escape key to avoid dismissing any parent popups\n e.stopPropagation();\n setOpen(e, false);\n break;\n case 'CloseSelect':\n !multiselect && !(activeOption === null || activeOption === void 0 ? void 0 : activeOption.disabled) && setOpen(e, false);\n // fallthrough\n case 'Select':\n activeOption && selectOption(e, activeOption);\n break;\n case 'Tab':\n !multiselect && activeOption && selectOption(e, activeOption);\n break;\n }\n });\n}\n"],"names":["useTriggerSlot","triggerSlotFromProp","ref","options","state","open","setOpen","setHasFocus","defaultProps","elementType","activeDescendantController","trigger","slot","always","type","role","triggerRef","React","useRef","useMergedRefs","onBlur","mergeCallbacks","event","onFocus","target","currentTarget","onClick","onKeyDown","useTriggerKeydown","getOptionById","selectOption","multiselect","getActiveOption","useCallback","activeOptionId","active","undefined","first","next","activeOption","previous","prev","pageUp","i","pageDown","setKeyboardNavigation","useSetKeyboardNavigation","useEventCallback","e","action","getDropdownActionFromKey","preventDefault","stopPropagation","disabled"],"mappings":";;;;+BAOoBA;;;eAAAA;;;;iEAPG;8BACkB;gCAC6B;oCAC7B;AAI9B,SAASA,eAAeC,mBAAmB,EAAEC,GAAG,EAAEC,OAAO;IAChE,MAAM,EAAEC,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,WAAW,EAAE,EAAEC,YAAY,EAAEC,WAAW,EAAEC,0BAA0B,EAAE,GAAGP;IACzG,MAAMQ,UAAUC,oBAAI,CAACC,MAAM,CAACZ,qBAAqB;QAC7CO,cAAc;YACVM,MAAM;YACN,iBAAiBT;YACjBU,MAAM;YACN,GAAG,OAAOP,iBAAiB,YAAYA,YAAY;QACvD;QACAC;IACJ;IACA,4BAA4B;IAC5B,MAAMO,aAAaC,OAAMC,MAAM,CAAC;IAChCP,QAAQT,GAAG,GAAGiB,IAAAA,6BAAa,EAACH,YAAYL,QAAQT,GAAG,EAAEA;IACrD,2DAA2D;IAC3DS,QAAQS,MAAM,GAAGC,IAAAA,8BAAc,EAAC,CAACC;QAC7BhB,QAAQgB,OAAO;QACff,YAAY;IAChB,GAAGI,QAAQS,MAAM;IACjBT,QAAQY,OAAO,GAAGF,IAAAA,8BAAc,EAAC,CAACC;QAC9B,IAAIA,MAAME,MAAM,KAAKF,MAAMG,aAAa,EAAE;YACtClB,YAAY;QAChB;IACJ,GAAGI,QAAQY,OAAO;IAClBZ,QAAQe,OAAO,GAAGL,IAAAA,8BAAc,EAAC,CAACC;QAC9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ACL,KAAK;YACL,KAAK;YACL,KAAK;YACL,KAAK;gBACDD,EAAEG,cAAc;gBAChB;QACR;QACAN,sBAAsB;QACtB,OAAOI;YACH,KAAK;gBACDZ;gBACA;YACJ,KAAK;gBACDC,KAAKC;gBACL;YACJ,KAAK;gBACDC,SAASD;gBACT;YACJ,KAAK;gBACDK;gBACA;YACJ,KAAK;gBACDF;gBACA;YACJ,KAAK;gBACDpC,QAAQ0C,GAAG;gBACX;YACJ,KAAK;gBACD,wEAAwE;gBACxEA,EAAEI,eAAe;gBACjB9C,QAAQ0C,GAAG;gBACX;YACJ,KAAK;gBACD,CAACjB,eAAe,CAAEQ,CAAAA,iBAAiB,QAAQA,iBAAiB,KAAK,IAAI,KAAK,IAAIA,aAAac,QAAQ,AAAD,KAAM/C,QAAQ0C,GAAG;YACvH,cAAc;YACd,KAAK;gBACDT,gBAAgBT,aAAakB,GAAGT;gBAChC;YACJ,KAAK;gBACD,CAACR,eAAeQ,gBAAgBT,aAAakB,GAAGT;gBAChD;QACR;IACJ;AACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-combobox",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.8.0",
|
|
4
4
|
"description": "Fluent UI React Combobox component",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -33,17 +33,18 @@
|
|
|
33
33
|
"@fluentui/scripts-tasks": "*"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
+
"@fluentui/react-aria": "^9.9.0",
|
|
36
37
|
"@fluentui/keyboard-keys": "^9.0.7",
|
|
37
|
-
"@fluentui/react-context-selector": "^9.1.
|
|
38
|
-
"@fluentui/react-field": "^9.1.
|
|
38
|
+
"@fluentui/react-context-selector": "^9.1.52",
|
|
39
|
+
"@fluentui/react-field": "^9.1.54",
|
|
39
40
|
"@fluentui/react-icons": "^2.0.224",
|
|
40
|
-
"@fluentui/react-jsx-runtime": "^9.0.
|
|
41
|
-
"@fluentui/react-portal": "^9.4.
|
|
42
|
-
"@fluentui/react-positioning": "^9.13.
|
|
41
|
+
"@fluentui/react-jsx-runtime": "^9.0.30",
|
|
42
|
+
"@fluentui/react-portal": "^9.4.14",
|
|
43
|
+
"@fluentui/react-positioning": "^9.13.4",
|
|
43
44
|
"@fluentui/react-shared-contexts": "^9.14.0",
|
|
44
|
-
"@fluentui/react-tabster": "^9.19.
|
|
45
|
+
"@fluentui/react-tabster": "^9.19.1",
|
|
45
46
|
"@fluentui/react-theme": "^9.1.16",
|
|
46
|
-
"@fluentui/react-utilities": "^9.18.
|
|
47
|
+
"@fluentui/react-utilities": "^9.18.1",
|
|
47
48
|
"@griffel/react": "^1.5.14",
|
|
48
49
|
"@swc/helpers": "^0.5.1"
|
|
49
50
|
},
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { canUseDOM } from '@fluentui/react-utilities';
|
|
3
|
-
export function useScrollOptionsIntoView(state) {
|
|
4
|
-
const { activeOption } = state;
|
|
5
|
-
const scrollContainerRef = React.useRef(null);
|
|
6
|
-
React.useEffect(()=>{
|
|
7
|
-
if (scrollContainerRef.current && activeOption && canUseDOM()) {
|
|
8
|
-
const activeOptionElement = scrollContainerRef.current.querySelector(`#${activeOption.id}`);
|
|
9
|
-
if (!activeOptionElement) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
const { offsetHeight, offsetTop } = activeOptionElement;
|
|
13
|
-
const { offsetHeight: parentOffsetHeight, scrollTop } = scrollContainerRef.current;
|
|
14
|
-
const isAbove = offsetTop < scrollTop;
|
|
15
|
-
const isBelow = offsetTop + offsetHeight > scrollTop + parentOffsetHeight;
|
|
16
|
-
// add a small buffer for general visual nicety
|
|
17
|
-
// it looks slightly better if the option has some space from the top/bottom while arrowing
|
|
18
|
-
const buffer = 2;
|
|
19
|
-
if (isAbove) {
|
|
20
|
-
scrollContainerRef.current.scrollTo(0, offsetTop - buffer);
|
|
21
|
-
} else if (isBelow) {
|
|
22
|
-
scrollContainerRef.current.scrollTo(0, offsetTop - parentOffsetHeight + offsetHeight + buffer);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}, [
|
|
26
|
-
activeOption
|
|
27
|
-
]);
|
|
28
|
-
return scrollContainerRef;
|
|
29
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["useScrollOptionsIntoView.ts"],"sourcesContent":["import * as React from 'react';\nimport { canUseDOM } from '@fluentui/react-utilities';\nimport { ListboxState } from '../Listbox';\n\nexport function useScrollOptionsIntoView(state: ListboxState): React.Ref<HTMLDivElement> {\n const { activeOption } = state;\n const scrollContainerRef = React.useRef<HTMLDivElement>(null);\n\n React.useEffect(() => {\n if (scrollContainerRef.current && activeOption && canUseDOM()) {\n const activeOptionElement = scrollContainerRef.current.querySelector(`#${activeOption.id}`) as HTMLElement;\n\n if (!activeOptionElement) {\n return;\n }\n\n const { offsetHeight, offsetTop } = activeOptionElement;\n const { offsetHeight: parentOffsetHeight, scrollTop } = scrollContainerRef.current;\n\n const isAbove = offsetTop < scrollTop;\n const isBelow = offsetTop + offsetHeight > scrollTop + parentOffsetHeight;\n\n // add a small buffer for general visual nicety\n // it looks slightly better if the option has some space from the top/bottom while arrowing\n const buffer = 2;\n\n if (isAbove) {\n scrollContainerRef.current.scrollTo(0, offsetTop - buffer);\n } else if (isBelow) {\n scrollContainerRef.current.scrollTo(0, offsetTop - parentOffsetHeight + offsetHeight + buffer);\n }\n }\n }, [activeOption]);\n\n return scrollContainerRef;\n}\n"],"names":["React","canUseDOM","useScrollOptionsIntoView","state","activeOption","scrollContainerRef","useRef","useEffect","current","activeOptionElement","querySelector","id","offsetHeight","offsetTop","parentOffsetHeight","scrollTop","isAbove","isBelow","buffer","scrollTo"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,SAAS,QAAQ,4BAA4B;AAGtD,OAAO,SAASC,yBAAyBC,KAAmB;IAC1D,MAAM,EAAEC,YAAY,EAAE,GAAGD;IACzB,MAAME,qBAAqBL,MAAMM,MAAM,CAAiB;IAExDN,MAAMO,SAAS,CAAC;QACd,IAAIF,mBAAmBG,OAAO,IAAIJ,gBAAgBH,aAAa;YAC7D,MAAMQ,sBAAsBJ,mBAAmBG,OAAO,CAACE,aAAa,CAAC,CAAC,CAAC,EAAEN,aAAaO,EAAE,CAAC,CAAC;YAE1F,IAAI,CAACF,qBAAqB;gBACxB;YACF;YAEA,MAAM,EAAEG,YAAY,EAAEC,SAAS,EAAE,GAAGJ;YACpC,MAAM,EAAEG,cAAcE,kBAAkB,EAAEC,SAAS,EAAE,GAAGV,mBAAmBG,OAAO;YAElF,MAAMQ,UAAUH,YAAYE;YAC5B,MAAME,UAAUJ,YAAYD,eAAeG,YAAYD;YAEvD,+CAA+C;YAC/C,2FAA2F;YAC3F,MAAMI,SAAS;YAEf,IAAIF,SAAS;gBACXX,mBAAmBG,OAAO,CAACW,QAAQ,CAAC,GAAGN,YAAYK;YACrD,OAAO,IAAID,SAAS;gBAClBZ,mBAAmBG,OAAO,CAACW,QAAQ,CAAC,GAAGN,YAAYC,qBAAqBF,eAAeM;YACzF;QACF;IACF,GAAG;QAACd;KAAa;IAEjB,OAAOC;AACT"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "useScrollOptionsIntoView", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return useScrollOptionsIntoView;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
|
-
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
|
-
const _reactutilities = require("@fluentui/react-utilities");
|
|
14
|
-
function useScrollOptionsIntoView(state) {
|
|
15
|
-
const { activeOption } = state;
|
|
16
|
-
const scrollContainerRef = _react.useRef(null);
|
|
17
|
-
_react.useEffect(()=>{
|
|
18
|
-
if (scrollContainerRef.current && activeOption && (0, _reactutilities.canUseDOM)()) {
|
|
19
|
-
const activeOptionElement = scrollContainerRef.current.querySelector(`#${activeOption.id}`);
|
|
20
|
-
if (!activeOptionElement) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
const { offsetHeight, offsetTop } = activeOptionElement;
|
|
24
|
-
const { offsetHeight: parentOffsetHeight, scrollTop } = scrollContainerRef.current;
|
|
25
|
-
const isAbove = offsetTop < scrollTop;
|
|
26
|
-
const isBelow = offsetTop + offsetHeight > scrollTop + parentOffsetHeight;
|
|
27
|
-
// add a small buffer for general visual nicety
|
|
28
|
-
// it looks slightly better if the option has some space from the top/bottom while arrowing
|
|
29
|
-
const buffer = 2;
|
|
30
|
-
if (isAbove) {
|
|
31
|
-
scrollContainerRef.current.scrollTo(0, offsetTop - buffer);
|
|
32
|
-
} else if (isBelow) {
|
|
33
|
-
scrollContainerRef.current.scrollTo(0, offsetTop - parentOffsetHeight + offsetHeight + buffer);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}, [
|
|
37
|
-
activeOption
|
|
38
|
-
]);
|
|
39
|
-
return scrollContainerRef;
|
|
40
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["useScrollOptionsIntoView.js"],"sourcesContent":["import * as React from 'react';\nimport { canUseDOM } from '@fluentui/react-utilities';\nexport function useScrollOptionsIntoView(state) {\n const { activeOption } = state;\n const scrollContainerRef = React.useRef(null);\n React.useEffect(()=>{\n if (scrollContainerRef.current && activeOption && canUseDOM()) {\n const activeOptionElement = scrollContainerRef.current.querySelector(`#${activeOption.id}`);\n if (!activeOptionElement) {\n return;\n }\n const { offsetHeight, offsetTop } = activeOptionElement;\n const { offsetHeight: parentOffsetHeight, scrollTop } = scrollContainerRef.current;\n const isAbove = offsetTop < scrollTop;\n const isBelow = offsetTop + offsetHeight > scrollTop + parentOffsetHeight;\n // add a small buffer for general visual nicety\n // it looks slightly better if the option has some space from the top/bottom while arrowing\n const buffer = 2;\n if (isAbove) {\n scrollContainerRef.current.scrollTo(0, offsetTop - buffer);\n } else if (isBelow) {\n scrollContainerRef.current.scrollTo(0, offsetTop - parentOffsetHeight + offsetHeight + buffer);\n }\n }\n }, [\n activeOption\n ]);\n return scrollContainerRef;\n}\n"],"names":["useScrollOptionsIntoView","state","activeOption","scrollContainerRef","React","useRef","useEffect","current","canUseDOM","activeOptionElement","querySelector","id","offsetHeight","offsetTop","parentOffsetHeight","scrollTop","isAbove","isBelow","buffer","scrollTo"],"mappings":";;;;+BAEgBA;;;eAAAA;;;;iEAFO;gCACG;AACnB,SAASA,yBAAyBC,KAAK;IAC1C,MAAM,EAAEC,YAAY,EAAE,GAAGD;IACzB,MAAME,qBAAqBC,OAAMC,MAAM,CAAC;IACxCD,OAAME,SAAS,CAAC;QACZ,IAAIH,mBAAmBI,OAAO,IAAIL,gBAAgBM,IAAAA,yBAAS,KAAI;YAC3D,MAAMC,sBAAsBN,mBAAmBI,OAAO,CAACG,aAAa,CAAC,CAAC,CAAC,EAAER,aAAaS,EAAE,CAAC,CAAC;YAC1F,IAAI,CAACF,qBAAqB;gBACtB;YACJ;YACA,MAAM,EAAEG,YAAY,EAAEC,SAAS,EAAE,GAAGJ;YACpC,MAAM,EAAEG,cAAcE,kBAAkB,EAAEC,SAAS,EAAE,GAAGZ,mBAAmBI,OAAO;YAClF,MAAMS,UAAUH,YAAYE;YAC5B,MAAME,UAAUJ,YAAYD,eAAeG,YAAYD;YACvD,+CAA+C;YAC/C,2FAA2F;YAC3F,MAAMI,SAAS;YACf,IAAIF,SAAS;gBACTb,mBAAmBI,OAAO,CAACY,QAAQ,CAAC,GAAGN,YAAYK;YACvD,OAAO,IAAID,SAAS;gBAChBd,mBAAmBI,OAAO,CAACY,QAAQ,CAAC,GAAGN,YAAYC,qBAAqBF,eAAeM;YAC3F;QACJ;IACJ,GAAG;QACChB;KACH;IACD,OAAOC;AACX"}
|