@fluentui/react-combobox 9.5.35 → 9.5.37

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 CHANGED
@@ -1,12 +1,36 @@
1
1
  # Change Log - @fluentui/react-combobox
2
2
 
3
- This log was last generated on Mon, 18 Dec 2023 17:47:03 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 03 Jan 2024 09:22:08 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.5.37](https://github.com/microsoft/fluentui/tree/@fluentui/react-combobox_v9.5.37)
8
+
9
+ Wed, 03 Jan 2024 09:22:08 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-combobox_v9.5.36..@fluentui/react-combobox_v9.5.37)
11
+
12
+ ### Patches
13
+
14
+ - fix: trigger focus should mount hidden listbox ([PR #30133](https://github.com/microsoft/fluentui/pull/30133) by lingfan.gao@microsoft.com)
15
+ - Bump @fluentui/react-context-selector to v9.1.45 ([PR #30163](https://github.com/microsoft/fluentui/pull/30163) by beachball)
16
+ - Bump @fluentui/react-field to v9.1.46 ([PR #30163](https://github.com/microsoft/fluentui/pull/30163) by beachball)
17
+ - Bump @fluentui/react-jsx-runtime to v9.0.23 ([PR #30163](https://github.com/microsoft/fluentui/pull/30163) by beachball)
18
+ - Bump @fluentui/react-portal to v9.4.6 ([PR #30163](https://github.com/microsoft/fluentui/pull/30163) by beachball)
19
+ - Bump @fluentui/react-positioning to v9.10.6 ([PR #30163](https://github.com/microsoft/fluentui/pull/30163) by beachball)
20
+ - Bump @fluentui/react-utilities to v9.15.5 ([PR #30163](https://github.com/microsoft/fluentui/pull/30163) by beachball)
21
+
22
+ ## [9.5.36](https://github.com/microsoft/fluentui/tree/@fluentui/react-combobox_v9.5.36)
23
+
24
+ Thu, 21 Dec 2023 17:00:41 GMT
25
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-combobox_v9.5.35..@fluentui/react-combobox_v9.5.36)
26
+
27
+ ### Patches
28
+
29
+ - fix: make hover color in contrast theme accessible. ([PR #30101](https://github.com/microsoft/fluentui/pull/30101) by yuanboxue@microsoft.com)
30
+
7
31
  ## [9.5.35](https://github.com/microsoft/fluentui/tree/@fluentui/react-combobox_v9.5.35)
8
32
 
9
- Mon, 18 Dec 2023 17:47:03 GMT
33
+ Mon, 18 Dec 2023 17:48:16 GMT
10
34
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-combobox_v9.5.34..@fluentui/react-combobox_v9.5.35)
11
35
 
12
36
  ### Patches
package/dist/index.d.ts CHANGED
@@ -91,7 +91,6 @@ declare type ComboboxBaseState = Required<Pick<ComboboxBaseProps, 'appearance' |
91
91
  activeOption?: OptionValue;
92
92
  focusVisible: boolean;
93
93
  /**
94
- * @deprecated - no longer used internally
95
94
  * whether the combobox/dropdown currently has focus
96
95
  */
97
96
  hasFocus: boolean;
@@ -102,9 +101,6 @@ declare type ComboboxBaseState = Required<Pick<ComboboxBaseProps, 'appearance' |
102
101
  ignoreNextBlur: React_2.MutableRefObject<boolean>;
103
102
  setActiveOption: React_2.Dispatch<React_2.SetStateAction<OptionValue | undefined>>;
104
103
  setFocusVisible(focusVisible: boolean): void;
105
- /**
106
- * @deprecated - no longer used internally
107
- */
108
104
  setHasFocus(hasFocus: boolean): void;
109
105
  setOpen(event: ComboboxBaseOpenEvents, newState: boolean): void;
110
106
  setValue(newValue: string | undefined): void;
@@ -26,7 +26,7 @@ import { useInputTriggerSlot } from './useInputTriggerSlot';
26
26
  ...props,
27
27
  editable: true
28
28
  });
29
- const { open, selectOption, setOpen, setValue, value } = baseState;
29
+ const { open, selectOption, setOpen, setValue, value, hasFocus } = baseState;
30
30
  const [comboboxPopupRef, comboboxTargetRef] = useComboboxPositioning(props);
31
31
  const { disabled, freeform, inlinePopup } = props;
32
32
  const comboId = useId('combobox-');
@@ -87,7 +87,7 @@ import { useInputTriggerSlot } from './useInputTriggerSlot';
87
87
  },
88
88
  root: rootSlot,
89
89
  input: triggerSlot,
90
- listbox: open ? listbox : undefined,
90
+ listbox: open || hasFocus ? listbox : undefined,
91
91
  expandIcon: slot.optional(props.expandIcon, {
92
92
  renderByDefault: true,
93
93
  defaultProps: {
@@ -1 +1 @@
1
- {"version":3,"sources":["useCombobox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useFieldControlProps_unstable } from '@fluentui/react-field';\nimport { ChevronDownRegular as ChevronDownIcon } from '@fluentui/react-icons';\nimport {\n getPartitionedNativeProps,\n mergeCallbacks,\n useEventCallback,\n useId,\n useMergedRefs,\n slot,\n} from '@fluentui/react-utilities';\nimport { useComboboxBaseState } from '../../utils/useComboboxBaseState';\nimport { useComboboxPositioning } from '../../utils/useComboboxPositioning';\nimport { Listbox } from '../Listbox/Listbox';\nimport type { SelectionEvents } from '../../utils/Selection.types';\nimport type { OptionValue } from '../../utils/OptionCollection.types';\nimport type { ComboboxProps, ComboboxState } from './Combobox.types';\nimport { useListboxSlot } from '../../utils/useListboxSlot';\nimport { useInputTriggerSlot } from './useInputTriggerSlot';\n\n/**\n * Create the state required to render Combobox.\n *\n * The returned state can be modified with hooks such as useComboboxStyles_unstable,\n * before being passed to renderCombobox_unstable.\n *\n * @param props - props from this instance of Combobox\n * @param ref - reference to root HTMLElement of Combobox\n */\nexport const useCombobox_unstable = (props: ComboboxProps, ref: React.Ref<HTMLInputElement>): ComboboxState => {\n // Merge props from surrounding <Field>, if any\n props = useFieldControlProps_unstable(props, { supportsLabelFor: true, supportsRequired: true, supportsSize: true });\n\n const baseState = useComboboxBaseState({ ...props, editable: true });\n const { open, selectOption, setOpen, setValue, value } = baseState;\n const [comboboxPopupRef, comboboxTargetRef] = useComboboxPositioning(props);\n const { disabled, freeform, inlinePopup } = props;\n const comboId = useId('combobox-');\n\n const { primary: triggerNativeProps, root: rootNativeProps } = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'input',\n excludedPropNames: ['children', 'size'],\n });\n\n // reset any typed value when an option is selected\n baseState.selectOption = (ev: SelectionEvents, option: OptionValue) => {\n setValue(undefined);\n selectOption(ev, option);\n };\n\n baseState.setOpen = (ev, newState: boolean) => {\n if (disabled) {\n return;\n }\n\n if (!newState && !freeform) {\n setValue(undefined);\n }\n\n setOpen(ev, newState);\n };\n\n const triggerRef = React.useRef<HTMLInputElement>(null);\n\n const listbox = useListboxSlot(props.listbox, comboboxPopupRef, {\n state: baseState,\n triggerRef,\n defaultProps: {\n children: props.children,\n },\n });\n\n const triggerSlot = useInputTriggerSlot(props.input ?? {}, useMergedRefs(triggerRef, ref), {\n state: baseState,\n freeform,\n defaultProps: {\n type: 'text',\n value: value ?? '',\n ...triggerNativeProps,\n },\n });\n\n const rootSlot = slot.always(props.root, {\n defaultProps: {\n 'aria-owns': !inlinePopup && open ? listbox?.id : undefined,\n ...rootNativeProps,\n },\n elementType: 'div',\n });\n rootSlot.ref = useMergedRefs(rootSlot.ref, comboboxTargetRef);\n\n const state: ComboboxState = {\n components: { root: 'div', input: 'input', expandIcon: 'span', listbox: Listbox },\n root: rootSlot,\n input: triggerSlot,\n listbox: open ? listbox : undefined,\n expandIcon: slot.optional(props.expandIcon, {\n renderByDefault: true,\n defaultProps: {\n 'aria-expanded': open,\n children: <ChevronDownIcon />,\n role: 'button',\n },\n elementType: 'span',\n }),\n ...baseState,\n };\n\n /* handle open/close + focus change when clicking expandIcon */\n const { onMouseDown: onIconMouseDown } = state.expandIcon || {};\n\n const onExpandIconMouseDown = useEventCallback(\n mergeCallbacks(onIconMouseDown, (event: React.MouseEvent<HTMLSpanElement>) => {\n event.preventDefault();\n state.setOpen(event, !state.open);\n triggerRef.current?.focus();\n }),\n );\n\n if (state.expandIcon) {\n state.expandIcon.onMouseDown = onExpandIconMouseDown;\n\n // If there is no explicit aria-label, calculate default accName attribute for expandIcon button,\n // using the following steps:\n // 1. If there is an aria-label, it is \"Open [aria-label]\"\n // 2. If there is an aria-labelledby, it is \"Open [aria-labelledby target]\" (using aria-labelledby + ids)\n // 3. If there is no aria-label/ledby attr, it falls back to \"Open\"\n // We can't fall back to a label/htmlFor name because of https://github.com/w3c/accname/issues/179\n const hasExpandLabel = state.expandIcon['aria-label'] || state.expandIcon['aria-labelledby'];\n const defaultOpenString = 'Open'; // this is english-only since it is the fallback\n if (!hasExpandLabel) {\n if (props['aria-labelledby']) {\n const chevronId = state.expandIcon.id ?? `${comboId}-chevron`;\n const chevronLabelledBy = `${chevronId} ${state.input['aria-labelledby']}`;\n\n state.expandIcon['aria-label'] = defaultOpenString;\n state.expandIcon.id = chevronId;\n state.expandIcon['aria-labelledby'] = chevronLabelledBy;\n } else if (props['aria-label']) {\n state.expandIcon['aria-label'] = `${defaultOpenString} ${props['aria-label']}`;\n } else {\n state.expandIcon['aria-label'] = defaultOpenString;\n }\n }\n }\n\n return state;\n};\n"],"names":["React","useFieldControlProps_unstable","ChevronDownRegular","ChevronDownIcon","getPartitionedNativeProps","mergeCallbacks","useEventCallback","useId","useMergedRefs","slot","useComboboxBaseState","useComboboxPositioning","Listbox","useListboxSlot","useInputTriggerSlot","useCombobox_unstable","props","ref","supportsLabelFor","supportsRequired","supportsSize","baseState","editable","open","selectOption","setOpen","setValue","value","comboboxPopupRef","comboboxTargetRef","disabled","freeform","inlinePopup","comboId","primary","triggerNativeProps","root","rootNativeProps","primarySlotTagName","excludedPropNames","ev","option","undefined","newState","triggerRef","useRef","listbox","state","defaultProps","children","triggerSlot","input","type","rootSlot","always","id","elementType","components","expandIcon","optional","renderByDefault","role","onMouseDown","onIconMouseDown","onExpandIconMouseDown","event","preventDefault","current","focus","hasExpandLabel","defaultOpenString","chevronId","chevronLabelledBy"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,6BAA6B,QAAQ,wBAAwB;AACtE,SAASC,sBAAsBC,eAAe,QAAQ,wBAAwB;AAC9E,SACEC,yBAAyB,EACzBC,cAAc,EACdC,gBAAgB,EAChBC,KAAK,EACLC,aAAa,EACbC,IAAI,QACC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ACI,WAAW,GAAGE;QAE/B,iGAAiG;QACjG,6BAA6B;QAC7B,0DAA0D;QAC1D,yGAAyG;QACzG,mEAAmE;QACnE,kGAAkG;QAClG,MAAMK,iBAAiBtB,MAAMW,UAAU,CAAC,aAAa,IAAIX,MAAMW,UAAU,CAAC,kBAAkB;QAC5F,MAAMY,oBAAoB,QAAQ,gDAAgD;QAClF,IAAI,CAACD,gBAAgB;YACnB,IAAIrD,KAAK,CAAC,kBAAkB,EAAE;oBACV+B;gBAAlB,MAAMwB,YAAYxB,CAAAA,uBAAAA,MAAMW,UAAU,CAACH,EAAE,cAAnBR,kCAAAA,uBAAuB,CAAC,EAAEd,QAAQ,QAAQ,CAAC;gBAC7D,MAAMuC,oBAAoB,CAAC,EAAED,UAAU,CAAC,EAAExB,MAAMI,KAAK,CAAC,kBAAkB,CAAC,CAAC;gBAE1EJ,MAAMW,UAAU,CAAC,aAAa,GAAGY;gBACjCvB,MAAMW,UAAU,CAACH,EAAE,GAAGgB;gBACtBxB,MAAMW,UAAU,CAAC,kBAAkB,GAAGc;YACxC,OAAO,IAAIxD,KAAK,CAAC,aAAa,EAAE;gBAC9B+B,MAAMW,UAAU,CAAC,aAAa,GAAG,CAAC,EAAEY,kBAAkB,CAAC,EAAEtD,KAAK,CAAC,aAAa,CAAC,CAAC;YAChF,OAAO;gBACL+B,MAAMW,UAAU,CAAC,aAAa,GAAGY;YACnC;QACF;IACF;IAEA,OAAOvB;AACT,EAAE"}
1
+ {"version":3,"sources":["useCombobox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useFieldControlProps_unstable } from '@fluentui/react-field';\nimport { ChevronDownRegular as ChevronDownIcon } from '@fluentui/react-icons';\nimport {\n getPartitionedNativeProps,\n mergeCallbacks,\n useEventCallback,\n useId,\n useMergedRefs,\n slot,\n} from '@fluentui/react-utilities';\nimport { useComboboxBaseState } from '../../utils/useComboboxBaseState';\nimport { useComboboxPositioning } from '../../utils/useComboboxPositioning';\nimport { Listbox } from '../Listbox/Listbox';\nimport type { SelectionEvents } from '../../utils/Selection.types';\nimport type { OptionValue } from '../../utils/OptionCollection.types';\nimport type { ComboboxProps, ComboboxState } from './Combobox.types';\nimport { useListboxSlot } from '../../utils/useListboxSlot';\nimport { useInputTriggerSlot } from './useInputTriggerSlot';\n\n/**\n * Create the state required to render Combobox.\n *\n * The returned state can be modified with hooks such as useComboboxStyles_unstable,\n * before being passed to renderCombobox_unstable.\n *\n * @param props - props from this instance of Combobox\n * @param ref - reference to root HTMLElement of Combobox\n */\nexport const useCombobox_unstable = (props: ComboboxProps, ref: React.Ref<HTMLInputElement>): ComboboxState => {\n // Merge props from surrounding <Field>, if any\n props = useFieldControlProps_unstable(props, { supportsLabelFor: true, supportsRequired: true, supportsSize: true });\n\n const baseState = useComboboxBaseState({ ...props, editable: true });\n const { open, selectOption, setOpen, setValue, value, hasFocus } = baseState;\n const [comboboxPopupRef, comboboxTargetRef] = useComboboxPositioning(props);\n const { disabled, freeform, inlinePopup } = props;\n const comboId = useId('combobox-');\n\n const { primary: triggerNativeProps, root: rootNativeProps } = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'input',\n excludedPropNames: ['children', 'size'],\n });\n\n // reset any typed value when an option is selected\n baseState.selectOption = (ev: SelectionEvents, option: OptionValue) => {\n setValue(undefined);\n selectOption(ev, option);\n };\n\n baseState.setOpen = (ev, newState: boolean) => {\n if (disabled) {\n return;\n }\n\n if (!newState && !freeform) {\n setValue(undefined);\n }\n\n setOpen(ev, newState);\n };\n\n const triggerRef = React.useRef<HTMLInputElement>(null);\n\n const listbox = useListboxSlot(props.listbox, comboboxPopupRef, {\n state: baseState,\n triggerRef,\n defaultProps: {\n children: props.children,\n },\n });\n\n const triggerSlot = useInputTriggerSlot(props.input ?? {}, useMergedRefs(triggerRef, ref), {\n state: baseState,\n freeform,\n defaultProps: {\n type: 'text',\n value: value ?? '',\n ...triggerNativeProps,\n },\n });\n\n const rootSlot = slot.always(props.root, {\n defaultProps: {\n 'aria-owns': !inlinePopup && open ? listbox?.id : undefined,\n ...rootNativeProps,\n },\n elementType: 'div',\n });\n rootSlot.ref = useMergedRefs(rootSlot.ref, comboboxTargetRef);\n\n const state: ComboboxState = {\n components: { root: 'div', input: 'input', expandIcon: 'span', listbox: Listbox },\n root: rootSlot,\n input: triggerSlot,\n listbox: open || hasFocus ? listbox : undefined,\n expandIcon: slot.optional(props.expandIcon, {\n renderByDefault: true,\n defaultProps: {\n 'aria-expanded': open,\n children: <ChevronDownIcon />,\n role: 'button',\n },\n elementType: 'span',\n }),\n ...baseState,\n };\n\n /* handle open/close + focus change when clicking expandIcon */\n const { onMouseDown: onIconMouseDown } = state.expandIcon || {};\n\n const onExpandIconMouseDown = useEventCallback(\n mergeCallbacks(onIconMouseDown, (event: React.MouseEvent<HTMLSpanElement>) => {\n event.preventDefault();\n state.setOpen(event, !state.open);\n triggerRef.current?.focus();\n }),\n );\n\n if (state.expandIcon) {\n state.expandIcon.onMouseDown = onExpandIconMouseDown;\n\n // If there is no explicit aria-label, calculate default accName attribute for expandIcon button,\n // using the following steps:\n // 1. If there is an aria-label, it is \"Open [aria-label]\"\n // 2. If there is an aria-labelledby, it is \"Open [aria-labelledby target]\" (using aria-labelledby + ids)\n // 3. If there is no aria-label/ledby attr, it falls back to \"Open\"\n // We can't fall back to a label/htmlFor name because of https://github.com/w3c/accname/issues/179\n const hasExpandLabel = state.expandIcon['aria-label'] || state.expandIcon['aria-labelledby'];\n const defaultOpenString = 'Open'; // this is english-only since it is the fallback\n if (!hasExpandLabel) {\n if (props['aria-labelledby']) {\n const chevronId = state.expandIcon.id ?? `${comboId}-chevron`;\n const chevronLabelledBy = `${chevronId} ${state.input['aria-labelledby']}`;\n\n state.expandIcon['aria-label'] = defaultOpenString;\n state.expandIcon.id = chevronId;\n state.expandIcon['aria-labelledby'] = chevronLabelledBy;\n } else if (props['aria-label']) {\n state.expandIcon['aria-label'] = `${defaultOpenString} ${props['aria-label']}`;\n } else {\n state.expandIcon['aria-label'] = defaultOpenString;\n }\n }\n }\n\n return state;\n};\n"],"names":["React","useFieldControlProps_unstable","ChevronDownRegular","ChevronDownIcon","getPartitionedNativeProps","mergeCallbacks","useEventCallback","useId","useMergedRefs","slot","useComboboxBaseState","useComboboxPositioning","Listbox","useListboxSlot","useInputTriggerSlot","useCombobox_unstable","props","ref","supportsLabelFor","supportsRequired","supportsSize","baseState","editable","open","selectOption","setOpen","setValue","value","hasFocus","comboboxPopupRef","comboboxTargetRef","disabled","freeform","inlinePopup","comboId","primary","triggerNativeProps","root","rootNativeProps","primarySlotTagName","excludedPropNames","ev","option","undefined","newState","triggerRef","useRef","listbox","state","defaultProps","children","triggerSlot","input","type","rootSlot","always","id","elementType","components","expandIcon","optional","renderByDefault","role","onMouseDown","onIconMouseDown","onExpandIconMouseDown","event","preventDefault","current","focus","hasExpandLabel","defaultOpenString","chevronId","chevronLabelledBy"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,6BAA6B,QAAQ,wBAAwB;AACtE,SAASC,sBAAsBC,eAAe,QAAQ,wBAAwB;AAC9E,SACEC,yBAAyB,EACzBC,cAAc,EACdC,gBAAgB,EAChBC,KAAK,EACLC,aAAa,EACbC,IAAI,QACC,4BAA4B;AACnC,SAASC,oBAAoB,QAAQ,mCAAmC;AACxE,SAASC,sBAAsB,QAAQ,qCAAqC;AAC5E,SAASC,OAAO,QAAQ,qBAAqB;AAI7C,SAASC,cAAc,QAAQ,6BAA6B;AAC5D,SAASC,mBAAmB,QAAQ,wBAAwB;AAE5D;;;;;;;;CAQC,GACD,OAAO,MAAMC,uBAAuB,CAACC,OAAsBC;IACzD,+CAA+C;IAC/CD,QAAQf,8BAA8Be,OAAO;QAAEE,kBAAkB;QAAMC,kBAAkB;QAAMC,cAAc;IAAK;IAElH,MAAMC,YAAYX,qBAAqB;QAAE,GAAGM,KAAK;QAAEM,UAAU;IAAK;IAClE,MAAM,EAAEC,IAAI,EAAEC,YAAY,EAAEC,OAAO,EAAEC,QAAQ,EAA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AAED,UAAU,CAAC,EAAExB,MAAMI,KAAK,CAAC,kBAAkB,CAAC,CAAC;gBAE1EJ,MAAMW,UAAU,CAAC,aAAa,GAAGY;gBACjCvB,MAAMW,UAAU,CAACH,EAAE,GAAGgB;gBACtBxB,MAAMW,UAAU,CAAC,kBAAkB,GAAGc;YACxC,OAAO,IAAIzD,KAAK,CAAC,aAAa,EAAE;gBAC9BgC,MAAMW,UAAU,CAAC,aAAa,GAAG,CAAC,EAAEY,kBAAkB,CAAC,EAAEvD,KAAK,CAAC,aAAa,CAAC,CAAC;YAChF,OAAO;gBACLgC,MAAMW,UAAU,CAAC,aAAa,GAAGY;YACnC;QACF;IACF;IAEA,OAAOvB;AACT,EAAE"}
@@ -22,7 +22,7 @@ import { useButtonTriggerSlot } from './useButtonTriggerSlot';
22
22
  supportsSize: true
23
23
  });
24
24
  const baseState = useComboboxBaseState(props);
25
- const { open } = baseState;
25
+ const { open, hasFocus } = baseState;
26
26
  const { primary: triggerNativeProps, root: rootNativeProps } = getPartitionedNativeProps({
27
27
  props,
28
28
  primarySlotTagName: 'button',
@@ -67,7 +67,7 @@ import { useButtonTriggerSlot } from './useButtonTriggerSlot';
67
67
  },
68
68
  root: rootSlot,
69
69
  button: trigger,
70
- listbox: open ? listbox : undefined,
70
+ listbox: open || hasFocus ? listbox : undefined,
71
71
  expandIcon: slot.optional(props.expandIcon, {
72
72
  renderByDefault: true,
73
73
  defaultProps: {
@@ -1 +1 @@
1
- {"version":3,"sources":["useDropdown.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useFieldControlProps_unstable } from '@fluentui/react-field';\nimport { ChevronDownRegular as ChevronDownIcon } from '@fluentui/react-icons';\nimport { getPartitionedNativeProps, useMergedRefs, slot } from '@fluentui/react-utilities';\nimport { useComboboxBaseState } from '../../utils/useComboboxBaseState';\nimport { useComboboxPositioning } from '../../utils/useComboboxPositioning';\nimport { Listbox } from '../Listbox/Listbox';\nimport type { DropdownProps, DropdownState } from './Dropdown.types';\nimport { useListboxSlot } from '../../utils/useListboxSlot';\nimport { useButtonTriggerSlot } from './useButtonTriggerSlot';\n\n/**\n * Create the state required to render Dropdown.\n *\n * The returned state can be modified with hooks such as useDropdownStyles_unstable,\n * before being passed to renderDropdown_unstable.\n *\n * @param props - props from this instance of Dropdown\n * @param ref - reference to root HTMLElement of Dropdown\n */\nexport const useDropdown_unstable = (props: DropdownProps, ref: React.Ref<HTMLButtonElement>): DropdownState => {\n // Merge props from surrounding <Field>, if any\n props = useFieldControlProps_unstable(props, { supportsLabelFor: true, supportsSize: true });\n\n const baseState = useComboboxBaseState(props);\n const { open } = baseState;\n\n const { primary: triggerNativeProps, root: rootNativeProps } = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'button',\n excludedPropNames: ['children'],\n });\n\n const [comboboxPopupRef, comboboxTargetRef] = useComboboxPositioning(props);\n\n const triggerRef = React.useRef<HTMLButtonElement>(null);\n const listbox = useListboxSlot(props.listbox, comboboxPopupRef, {\n state: baseState,\n triggerRef,\n defaultProps: {\n children: props.children,\n },\n });\n\n const trigger = useButtonTriggerSlot(props.button ?? {}, useMergedRefs(triggerRef, ref), {\n state: baseState,\n defaultProps: {\n type: 'button',\n tabIndex: 0,\n children: baseState.value || props.placeholder,\n ...triggerNativeProps,\n },\n });\n\n const rootSlot = slot.always(props.root, {\n defaultProps: {\n 'aria-owns': !props.inlinePopup && open ? listbox?.id : undefined,\n children: props.children,\n ...rootNativeProps,\n },\n elementType: 'div',\n });\n rootSlot.ref = useMergedRefs(rootSlot.ref, comboboxTargetRef);\n\n const state: DropdownState = {\n components: { root: 'div', button: 'button', expandIcon: 'span', listbox: Listbox },\n root: rootSlot,\n button: trigger,\n listbox: open ? listbox : undefined,\n expandIcon: slot.optional(props.expandIcon, {\n renderByDefault: true,\n defaultProps: {\n children: <ChevronDownIcon />,\n },\n elementType: 'span',\n }),\n placeholderVisible: !baseState.value && !!props.placeholder,\n ...baseState,\n };\n\n return state;\n};\n"],"names":["React","useFieldControlProps_unstable","ChevronDownRegular","ChevronDownIcon","getPartitionedNativeProps","useMergedRefs","slot","useComboboxBaseState","useComboboxPositioning","Listbox","useListboxSlot","useButtonTriggerSlot","useDropdown_unstable","props","ref","supportsLabelFor","supportsSize","baseState","open","primary","triggerNativeProps","root","rootNativeProps","primarySlotTagName","excludedPropNames","comboboxPopupRef","comboboxTargetRef","triggerRef","useRef","listbox","state","defaultProps","children","trigger","button","type","tabIndex","value","placeholder","rootSlot","always","inlinePopup","id","undefined","elementType","components","expandIcon","optional","renderByDefault","placeholderVisible"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,6BAA6B,QAAQ,wBAAwB;AACtE,SAASC,sBAAsBC,eAAe,QAAQ,wBAAwB;AAC9E,SAASC,yBAAyB,EAAEC,aAAa,EAAEC,IAAI,QAAQ,4BAA4B;AAC3F,SAASC,oBAAoB,QAAQ,mCAAmC;AACxE,SAASC,sBAAsB,QAAQ,qCAAqC;AAC5E,SAASC,OAAO,QAAQ,qBAAqB;AAE7C,SAASC,cAAc,QAAQ,6BAA6B;AAC5D,SAASC,oBAAoB,QAAQ,yBAAyB;AAE9D;;;;;;;;CAQC,GACD,OAAO,MAAMC,uBAAuB,CAACC,OAAsBC;IACzD,+CAA+C;IAC/CD,QAAQZ,8BAA8BY,OAAO;QAAEE,kBAAkB;QAAMC,cAAc;IAAK;IAE1F,MAAMC,YAAYV,qBAAqBM;IACvC,MAAM,EAAEK,IAAI,EAAE,GAAGD;IAEjB,MAAM,EAAEE,SAASC,kBAAkB,EAAEC,MAAMC,eAAe,EAAE,GAAGlB,0BAA0B;QACvFS;QACAU,oBAAoB;QACpBC,mBAAmB;YAAC;SAAW;IACjC;IAEA,MAAM,CAACC,kBAAkBC,kBAAkB,GAAGlB,uBAAuBK;IAErE,MAAMc,aAAa3B,MAAM4B,MAAM,CAAoB;IACnD,MAAMC,UAAUnB,eAAeG,MAAMgB,OAAO,EAAEJ,kBAAkB;QAC9DK,OAAOb;QACPU;QACAI,cAAc;YACZC,UAAUnB,MAAMmB,QAAQ;QAC1B;IACF;QAEqCnB;IAArC,MAAMoB,UAAUtB,qBAAqBE,CAAAA,gBAAAA,MAAMqB,MAAM,cAAZrB,2BAAAA,gBAAgB,CAAC,GAAGR,cAAcsB,YAAYb,MAAM;QACvFgB,OAAOb;QACPc,cAAc;YACZI,MAAM;YACNC,UAAU;YACVJ,UAAUf,UAAUoB,KAAK,IAAIxB,MAAMyB,WAAW;YAC9C,GAAGlB,kBAAkB;QACvB;IACF;IAEA,MAAMmB,WAAWjC,KAAKkC,MAAM,CAAC3B,MAAMQ,IAAI,EAAE;QACvCU,cAAc;YACZ,aAAa,CAAClB,MAAM4B,WAAW,IAAIvB,OAAOW,oBAAAA,8BAAAA,QAASa,EAAE,GAAGC;YACxDX,UAAUnB,MAAMmB,QAAQ;YACxB,GAAGV,eAAe;QACpB;QACAsB,aAAa;IACf;IACAL,SAASzB,GAAG,GAAGT,cAAckC,SAASzB,GAAG,EAAEY;IAE3C,MAAMI,QAAuB;QAC3Be,YAAY;YAAExB,MAAM;YAAOa,QAAQ;YAAUY,YAAY;YAAQjB,SAASpB;QAAQ;QAClFY,MAAMkB;QACNL,QAAQD;QACRJ,SAASX,OAAOW,UAAUc;QAC1BG,YAAYxC,KAAKyC,QAAQ,CAAClC,MAAMiC,UAAU,EAAE;YAC1CE,iBAAiB;YACjBjB,cAAc;gBACZC,wBAAU,oBAAC7B;YACb;YACAyC,aAAa;QACf;QACAK,oBAAoB,CAAChC,UAAUoB,KAAK,IAAI,CAAC,CAACxB,MAAMyB,WAAW;QAC3D,GAAGrB,SAAS;IACd;IAEA,OAAOa;AACT,EAAE"}
1
+ {"version":3,"sources":["useDropdown.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useFieldControlProps_unstable } from '@fluentui/react-field';\nimport { ChevronDownRegular as ChevronDownIcon } from '@fluentui/react-icons';\nimport { getPartitionedNativeProps, useMergedRefs, slot } from '@fluentui/react-utilities';\nimport { useComboboxBaseState } from '../../utils/useComboboxBaseState';\nimport { useComboboxPositioning } from '../../utils/useComboboxPositioning';\nimport { Listbox } from '../Listbox/Listbox';\nimport type { DropdownProps, DropdownState } from './Dropdown.types';\nimport { useListboxSlot } from '../../utils/useListboxSlot';\nimport { useButtonTriggerSlot } from './useButtonTriggerSlot';\n\n/**\n * Create the state required to render Dropdown.\n *\n * The returned state can be modified with hooks such as useDropdownStyles_unstable,\n * before being passed to renderDropdown_unstable.\n *\n * @param props - props from this instance of Dropdown\n * @param ref - reference to root HTMLElement of Dropdown\n */\nexport const useDropdown_unstable = (props: DropdownProps, ref: React.Ref<HTMLButtonElement>): DropdownState => {\n // Merge props from surrounding <Field>, if any\n props = useFieldControlProps_unstable(props, { supportsLabelFor: true, supportsSize: true });\n\n const baseState = useComboboxBaseState(props);\n const { open, hasFocus } = baseState;\n\n const { primary: triggerNativeProps, root: rootNativeProps } = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'button',\n excludedPropNames: ['children'],\n });\n\n const [comboboxPopupRef, comboboxTargetRef] = useComboboxPositioning(props);\n\n const triggerRef = React.useRef<HTMLButtonElement>(null);\n const listbox = useListboxSlot(props.listbox, comboboxPopupRef, {\n state: baseState,\n triggerRef,\n defaultProps: {\n children: props.children,\n },\n });\n\n const trigger = useButtonTriggerSlot(props.button ?? {}, useMergedRefs(triggerRef, ref), {\n state: baseState,\n defaultProps: {\n type: 'button',\n tabIndex: 0,\n children: baseState.value || props.placeholder,\n ...triggerNativeProps,\n },\n });\n\n const rootSlot = slot.always(props.root, {\n defaultProps: {\n 'aria-owns': !props.inlinePopup && open ? listbox?.id : undefined,\n children: props.children,\n ...rootNativeProps,\n },\n elementType: 'div',\n });\n rootSlot.ref = useMergedRefs(rootSlot.ref, comboboxTargetRef);\n\n const state: DropdownState = {\n components: { root: 'div', button: 'button', expandIcon: 'span', listbox: Listbox },\n root: rootSlot,\n button: trigger,\n listbox: open || hasFocus ? listbox : undefined,\n expandIcon: slot.optional(props.expandIcon, {\n renderByDefault: true,\n defaultProps: {\n children: <ChevronDownIcon />,\n },\n elementType: 'span',\n }),\n placeholderVisible: !baseState.value && !!props.placeholder,\n ...baseState,\n };\n\n return state;\n};\n"],"names":["React","useFieldControlProps_unstable","ChevronDownRegular","ChevronDownIcon","getPartitionedNativeProps","useMergedRefs","slot","useComboboxBaseState","useComboboxPositioning","Listbox","useListboxSlot","useButtonTriggerSlot","useDropdown_unstable","props","ref","supportsLabelFor","supportsSize","baseState","open","hasFocus","primary","triggerNativeProps","root","rootNativeProps","primarySlotTagName","excludedPropNames","comboboxPopupRef","comboboxTargetRef","triggerRef","useRef","listbox","state","defaultProps","children","trigger","button","type","tabIndex","value","placeholder","rootSlot","always","inlinePopup","id","undefined","elementType","components","expandIcon","optional","renderByDefault","placeholderVisible"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,6BAA6B,QAAQ,wBAAwB;AACtE,SAASC,sBAAsBC,eAAe,QAAQ,wBAAwB;AAC9E,SAASC,yBAAyB,EAAEC,aAAa,EAAEC,IAAI,QAAQ,4BAA4B;AAC3F,SAASC,oBAAoB,QAAQ,mCAAmC;AACxE,SAASC,sBAAsB,QAAQ,qCAAqC;AAC5E,SAASC,OAAO,QAAQ,qBAAqB;AAE7C,SAASC,cAAc,QAAQ,6BAA6B;AAC5D,SAASC,oBAAoB,QAAQ,yBAAyB;AAE9D;;;;;;;;CAQC,GACD,OAAO,MAAMC,uBAAuB,CAACC,OAAsBC;IACzD,+CAA+C;IAC/CD,QAAQZ,8BAA8BY,OAAO;QAAEE,kBAAkB;QAAMC,cAAc;IAAK;IAE1F,MAAMC,YAAYV,qBAAqBM;IACvC,MAAM,EAAEK,IAAI,EAAEC,QAAQ,EAAE,GAAGF;IAE3B,MAAM,EAAEG,SAASC,kBAAkB,EAAEC,MAAMC,eAAe,EAAE,GAAGnB,0BAA0B;QACvFS;QACAW,oBAAoB;QACpBC,mBAAmB;YAAC;SAAW;IACjC;IAEA,MAAM,CAACC,kBAAkB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PURE__*/__styles({
27
27
  uwmqm3: ["f1f5gg8d", "f1vdfbxk"],
28
28
  qhf8xq: "f10pi13n",
29
29
  Jwef8y: "f1knas48",
30
- ecr2s2: "fb40n2d"
30
+ Bi91k9c: "feu1g3u",
31
+ zqbkvg: "fo79ri9",
32
+ h82x05: ["f1osiabc", "f1e8le25"],
33
+ cqj998: "f1yusjty",
34
+ j3hlsh: ["f1e8le25", "f1osiabc"],
35
+ ecr2s2: "fb40n2d",
36
+ lj723h: "f1g4hkjv",
37
+ Btxx2vb: "f1lnr2zp",
38
+ sltcwy: ["f1ogfk9z", "f1g7j8ec"],
39
+ dnwvvm: "fiuf46r",
40
+ Blyvkvs: ["f1g7j8ec", "f1ogfk9z"]
31
41
  },
32
42
  active: {
33
43
  Bsft5z2: "f13zj6fq",
@@ -58,7 +68,17 @@ const useStyles = /*#__PURE__*/__styles({
58
68
  disabled: {
59
69
  sj55zd: "f1s2aq7o",
60
70
  Jwef8y: "f9ql6rf",
71
+ Bi91k9c: "fvgxktp",
72
+ zqbkvg: "f185j3qj",
73
+ h82x05: ["f1dligi3", "f1vydzie"],
74
+ cqj998: "fjw1di3",
75
+ j3hlsh: ["f1vydzie", "f1dligi3"],
61
76
  ecr2s2: "fgj9um3",
77
+ lj723h: "f19wldhg",
78
+ Btxx2vb: "f1ss0kt2",
79
+ sltcwy: ["f1t6oli3", "fjy9ci8"],
80
+ dnwvvm: "fresaxk",
81
+ Blyvkvs: ["fjy9ci8", "f1t6oli3"],
62
82
  Bbusuzp: "f1dcs8yz"
63
83
  },
64
84
  selected: {},
@@ -110,11 +130,17 @@ const useStyles = /*#__PURE__*/__styles({
110
130
  checkDisabled: {
111
131
  sj55zd: "f1s2aq7o",
112
132
  Bbusuzp: "f1dcs8yz"
133
+ },
134
+ multiselectCheckDisabled: {
135
+ g2u3we: "f1r1t4y1",
136
+ h3c5rm: ["fmj8ijw", "figx54m"],
137
+ B9xav0g: "f360ss8",
138
+ zhjwy3: ["figx54m", "fmj8ijw"]
113
139
  }
114
140
  }, {
115
- d: [".f122n59{align-items:center;}", ".f1aa9q02{border-bottom-right-radius:var(--borderRadiusMedium);}", ".f16jpd5f{border-bottom-left-radius:var(--borderRadiusMedium);}", ".f1jar5jt{border-top-right-radius:var(--borderRadiusMedium);}", ".fyu767a{border-top-left-radius:var(--borderRadiusMedium);}", ".f19n0e5{color:var(--colorNeutralForeground1);}", ".f1ufnopg{column-gap:var(--spacingHorizontalXS);}", ".f1k6fduh{cursor:pointer;}", ".f22iagw{display:flex;}", ".fk6fouc{font-family:var(--fontFamilyBase);}", ".fkhj508{font-size:var(--fontSizeBase300);}", ".f1i3iumi{line-height:var(--lineHeightBase300);}", ".fp2oml8{padding-top:var(--spacingVerticalSNudge);}", ".f1vdfbxk{padding-right:var(--spacingHorizontalS);}", ".f1f5gg8d{padding-left:var(--spacingHorizontalS);}", ".f1tdddsa{padding-bottom:var(--spacingVerticalSNudge);}", ".f10pi13n{position:relative;}", ".f13zj6fq::after{content:\"\";}", ".f1mdlcz9::after{position:absolute;}", ".f1nwj1ja::after{pointer-events:none;}", ".ffmd2fr::after{z-index:1;}", ".f8rth92::after{border-top-style:solid;}", ".flthirb::after{border-right-style:solid;}", ".ftkbnf5::after{border-left-style:solid;}", ".f1lh990p::after{border-bottom-style:solid;}", ".fc9v8v1::after{border-top-width:2px;}", ".f1mwfetb::after{border-right-width:2px;}", ".f18mat8f::after{border-left-width:2px;}", ".f1cb6c3::after{border-bottom-width:2px;}", ".f1ibwz09::after{border-bottom-right-radius:var(--borderRadiusMedium);}", ".f1kp91vd::after{border-bottom-left-radius:var(--borderRadiusMedium);}", ".f1pix4dl::after{border-top-right-radius:var(--borderRadiusMedium);}", ".f13nd1z4::after{border-top-left-radius:var(--borderRadiusMedium);}", ".f1qw5sz7::after{border-top-color:var(--colorStrokeFocus2);}", ".f19va7ni::after{border-right-color:var(--colorStrokeFocus2);}", ".f1a9v3mw::after{border-left-color:var(--colorStrokeFocus2);}", ".fkkziue::after{border-bottom-color:var(--colorStrokeFocus2);}", ".f1a97anr::after{top:-2px;}", ".f5226zp::after{bottom:-2px;}", ".fa2bdqt::after{left:-2px;}", ".fei6g0k::after{right:-2px;}", ".f1s2aq7o{color:var(--colorNeutralForegroundDisabled);}", ".fod5ikn{font-size:var(--fontSizeBase400);}", ".f18b9hdq{margin-left:calc(var(--spacingHorizontalXXS) * -1);}", ".fn6qj8t{margin-right:calc(var(--spacingHorizontalXXS) * -1);}", ".f1xk557c{margin-right:var(--spacingHorizontalXXS);}", ".f1h9en5y{margin-left:var(--spacingHorizontalXXS);}", ".fd7fpy0{visibility:hidden;}", ".fvc9v3g svg{display:block;}", ".f1022m68{visibility:visible;}", ".f192inf7{border-top-width:var(--strokeWidthThin);}", ".f5tn483{border-right-width:var(--strokeWidthThin);}", ".f1ojsxk5{border-left-width:var(--strokeWidthThin);}", ".f1vxd6vx{border-bottom-width:var(--strokeWidthThin);}", ".fzkkow9{border-top-style:solid;}", ".fcdblym{border-right-style:solid;}", ".fjik90z{border-left-style:solid;}", ".fg706s2{border-bottom-style:solid;}", ".fq0vr37{border-top-color:var(--colorNeutralStrokeAccessible);}", ".f1byw159{border-right-color:var(--colorNeutralStrokeAccessible);}", ".f11cr0be{border-left-color:var(--colorNeutralStrokeAccessible);}", ".f1c1zstj{border-bottom-color:var(--colorNeutralStrokeAccessible);}", ".f1g3puop{border-bottom-right-radius:var(--borderRadiusSmall);}", ".fi2rrw2{border-bottom-left-radius:var(--borderRadiusSmall);}", ".f1rstyi9{border-top-right-radius:var(--borderRadiusSmall);}", ".f1s4nn1u{border-top-left-radius:var(--borderRadiusSmall);}", ".f1ewtqcl{box-sizing:border-box;}", ".f4d9j23{justify-content:center;}", ".f1w9h62z{fill:currentColor;}", ".f1ugzwwg{font-size:12px;}", ".fd461yt{height:16px;}", ".fjw5fx7{width:16px;}", ".ftywsgz{background-color:var(--colorCompoundBrandBackground);}", ".fqpbvvt{color:var(--colorNeutralForegroundInverted);}", ".f3xi7mh{border-top-color:var(--colorCompoundBrandBackground);}", ".ftovhe4{border-right-color:var(--colorCompoundBrandBackground);}", ".f1wczvin{border-left-color:var(--colorCompoundBrandBackground);}", ".f68vbr6{border-bottom-color:var(--colorCompoundBrandBackground);}"],
116
- h: [".f1knas48:hover{background-color:var(--colorNeutralBackground1Hover);}", ".f9ql6rf:hover{background-color:var(--colorTransparentBackground);}"],
117
- a: [".fb40n2d:active{background-color:var(--colorNeutralBackground1Pressed);}", ".fgj9um3:active{background-color:var(--colorTransparentBackground);}"],
141
+ d: [".f122n59{align-items:center;}", ".f1aa9q02{border-bottom-right-radius:var(--borderRadiusMedium);}", ".f16jpd5f{border-bottom-left-radius:var(--borderRadiusMedium);}", ".f1jar5jt{border-top-right-radius:var(--borderRadiusMedium);}", ".fyu767a{border-top-left-radius:var(--borderRadiusMedium);}", ".f19n0e5{color:var(--colorNeutralForeground1);}", ".f1ufnopg{column-gap:var(--spacingHorizontalXS);}", ".f1k6fduh{cursor:pointer;}", ".f22iagw{display:flex;}", ".fk6fouc{font-family:var(--fontFamilyBase);}", ".fkhj508{font-size:var(--fontSizeBase300);}", ".f1i3iumi{line-height:var(--lineHeightBase300);}", ".fp2oml8{padding-top:var(--spacingVerticalSNudge);}", ".f1vdfbxk{padding-right:var(--spacingHorizontalS);}", ".f1f5gg8d{padding-left:var(--spacingHorizontalS);}", ".f1tdddsa{padding-bottom:var(--spacingVerticalSNudge);}", ".f10pi13n{position:relative;}", ".f13zj6fq::after{content:\"\";}", ".f1mdlcz9::after{position:absolute;}", ".f1nwj1ja::after{pointer-events:none;}", ".ffmd2fr::after{z-index:1;}", ".f8rth92::after{border-top-style:solid;}", ".flthirb::after{border-right-style:solid;}", ".ftkbnf5::after{border-left-style:solid;}", ".f1lh990p::after{border-bottom-style:solid;}", ".fc9v8v1::after{border-top-width:2px;}", ".f1mwfetb::after{border-right-width:2px;}", ".f18mat8f::after{border-left-width:2px;}", ".f1cb6c3::after{border-bottom-width:2px;}", ".f1ibwz09::after{border-bottom-right-radius:var(--borderRadiusMedium);}", ".f1kp91vd::after{border-bottom-left-radius:var(--borderRadiusMedium);}", ".f1pix4dl::after{border-top-right-radius:var(--borderRadiusMedium);}", ".f13nd1z4::after{border-top-left-radius:var(--borderRadiusMedium);}", ".f1qw5sz7::after{border-top-color:var(--colorStrokeFocus2);}", ".f19va7ni::after{border-right-color:var(--colorStrokeFocus2);}", ".f1a9v3mw::after{border-left-color:var(--colorStrokeFocus2);}", ".fkkziue::after{border-bottom-color:var(--colorStrokeFocus2);}", ".f1a97anr::after{top:-2px;}", ".f5226zp::after{bottom:-2px;}", ".fa2bdqt::after{left:-2px;}", ".fei6g0k::after{right:-2px;}", ".f1s2aq7o{color:var(--colorNeutralForegroundDisabled);}", ".fod5ikn{font-size:var(--fontSizeBase400);}", ".f18b9hdq{margin-left:calc(var(--spacingHorizontalXXS) * -1);}", ".fn6qj8t{margin-right:calc(var(--spacingHorizontalXXS) * -1);}", ".f1xk557c{margin-right:var(--spacingHorizontalXXS);}", ".f1h9en5y{margin-left:var(--spacingHorizontalXXS);}", ".fd7fpy0{visibility:hidden;}", ".fvc9v3g svg{display:block;}", ".f1022m68{visibility:visible;}", ".f192inf7{border-top-width:var(--strokeWidthThin);}", ".f5tn483{border-right-width:var(--strokeWidthThin);}", ".f1ojsxk5{border-left-width:var(--strokeWidthThin);}", ".f1vxd6vx{border-bottom-width:var(--strokeWidthThin);}", ".fzkkow9{border-top-style:solid;}", ".fcdblym{border-right-style:solid;}", ".fjik90z{border-left-style:solid;}", ".fg706s2{border-bottom-style:solid;}", ".fq0vr37{border-top-color:var(--colorNeutralStrokeAccessible);}", ".f1byw159{border-right-color:var(--colorNeutralStrokeAccessible);}", ".f11cr0be{border-left-color:var(--colorNeutralStrokeAccessible);}", ".f1c1zstj{border-bottom-color:var(--colorNeutralStrokeAccessible);}", ".f1g3puop{border-bottom-right-radius:var(--borderRadiusSmall);}", ".fi2rrw2{border-bottom-left-radius:var(--borderRadiusSmall);}", ".f1rstyi9{border-top-right-radius:var(--borderRadiusSmall);}", ".f1s4nn1u{border-top-left-radius:var(--borderRadiusSmall);}", ".f1ewtqcl{box-sizing:border-box;}", ".f4d9j23{justify-content:center;}", ".f1w9h62z{fill:currentColor;}", ".f1ugzwwg{font-size:12px;}", ".fd461yt{height:16px;}", ".fjw5fx7{width:16px;}", ".ftywsgz{background-color:var(--colorCompoundBrandBackground);}", ".fqpbvvt{color:var(--colorNeutralForegroundInverted);}", ".f3xi7mh{border-top-color:var(--colorCompoundBrandBackground);}", ".ftovhe4{border-right-color:var(--colorCompoundBrandBackground);}", ".f1wczvin{border-left-color:var(--colorCompoundBrandBackground);}", ".f68vbr6{border-bottom-color:var(--colorCompoundBrandBackground);}", ".f1r1t4y1{border-top-color:var(--colorNeutralForegroundDisabled);}", ".fmj8ijw{border-right-color:var(--colorNeutralForegroundDisabled);}", ".figx54m{border-left-color:var(--colorNeutralForegroundDisabled);}", ".f360ss8{border-bottom-color:var(--colorNeutralForegroundDisabled);}"],
142
+ h: [".f1knas48:hover{background-color:var(--colorNeutralBackground1Hover);}", ".feu1g3u:hover{color:var(--colorNeutralForeground1Hover);}", ".fo79ri9:hover .fui-Option__checkIcon{border-top-color:var(--colorNeutralForeground1Hover);}", ".f1osiabc:hover .fui-Option__checkIcon{border-right-color:var(--colorNeutralForeground1Hover);}", ".f1e8le25:hover .fui-Option__checkIcon{border-left-color:var(--colorNeutralForeground1Hover);}", ".f1yusjty:hover .fui-Option__checkIcon{border-bottom-color:var(--colorNeutralForeground1Hover);}", ".f9ql6rf:hover{background-color:var(--colorTransparentBackground);}", ".fvgxktp:hover{color:var(--colorNeutralForegroundDisabled);}", ".f185j3qj:hover .fui-Option__checkIcon{border-top-color:var(--colorNeutralForegroundDisabled);}", ".f1dligi3:hover .fui-Option__checkIcon{border-right-color:var(--colorNeutralForegroundDisabled);}", ".f1vydzie:hover .fui-Option__checkIcon{border-left-color:var(--colorNeutralForegroundDisabled);}", ".fjw1di3:hover .fui-Option__checkIcon{border-bottom-color:var(--colorNeutralForegroundDisabled);}"],
143
+ a: [".fb40n2d:active{background-color:var(--colorNeutralBackground1Pressed);}", ".f1g4hkjv:active{color:var(--colorNeutralForeground1Pressed);}", ".f1lnr2zp:active .fui-Option__checkIcon{border-top-color:var(--colorNeutralForeground1Hover);}", ".f1ogfk9z:active .fui-Option__checkIcon{border-right-color:var(--colorNeutralForeground1Hover);}", ".f1g7j8ec:active .fui-Option__checkIcon{border-left-color:var(--colorNeutralForeground1Hover);}", ".fiuf46r:active .fui-Option__checkIcon{border-bottom-color:var(--colorNeutralForeground1Hover);}", ".fgj9um3:active{background-color:var(--colorTransparentBackground);}", ".f19wldhg:active{color:var(--colorNeutralForegroundDisabled);}", ".f1ss0kt2:active .fui-Option__checkIcon{border-top-color:var(--colorNeutralForegroundDisabled);}", ".f1t6oli3:active .fui-Option__checkIcon{border-right-color:var(--colorNeutralForegroundDisabled);}", ".fjy9ci8:active .fui-Option__checkIcon{border-left-color:var(--colorNeutralForegroundDisabled);}", ".fresaxk:active .fui-Option__checkIcon{border-bottom-color:var(--colorNeutralForegroundDisabled);}"],
118
144
  m: [["@media (forced-colors: active){.f1dcs8yz{color:GrayText;}}", {
119
145
  m: "(forced-colors: active)"
120
146
  }]]
@@ -133,7 +159,7 @@ export const useOptionStyles_unstable = state => {
133
159
  const styles = useStyles();
134
160
  state.root.className = mergeClasses(optionClassNames.root, styles.root, active && focusVisible && styles.active, disabled && styles.disabled, selected && styles.selected, state.root.className);
135
161
  if (state.checkIcon) {
136
- state.checkIcon.className = mergeClasses(optionClassNames.checkIcon, styles.checkIcon, multiselect && styles.multiselectCheck, selected && styles.selectedCheck, selected && multiselect && styles.selectedMultiselectCheck, disabled && styles.checkDisabled, state.checkIcon.className);
162
+ state.checkIcon.className = mergeClasses(optionClassNames.checkIcon, styles.checkIcon, multiselect && styles.multiselectCheck, selected && styles.selectedCheck, selected && multiselect && styles.selectedMultiselectCheck, disabled && styles.checkDisabled, disabled && multiselect && styles.multiselectCheckDisabled, state.checkIcon.className);
137
163
  }
138
164
  return state;
139
165
  };
@@ -1 +1 @@
1
- {"version":3,"names":["tokens","__styles","mergeClasses","shorthands","optionClassNames","root","checkIcon","useStyles","Bt984gj","Bbmb7ep","Beyfa6y","B7oj6ja","Btl43ni","sj55zd","i8kkvl","Bceei9c","mc9l5x","Bahqtrf","Be2twd7","Bg96gwp","z8tnut","z189sj","Byoj8tv","uwmqm3","qhf8xq","Jwef8y","ecr2s2","active","Bsft5z2","E3zdtr","B80jsxd","t2ki1e","Bm2nyyq","Barhvk9","Bw17bha","vfts7","xrcqlc","Ihftqj","Bcgy8vk","Bhxzhr1","B3778ie","d9w3h3","Bl18szs","B4j8arr","B0n5ga8","s924m2","B1q35kw","Gp14am","bn5sak","By385i5","Eqx8gd","B1piin3","disabled","Bbusuzp","selected","Frg6f3","t21cq0","Bcdw1i0","Bo70h7d","selectedCheck","multiselectCheck","B4j52fo","Bekrc4i","Bn0qgzm","ibv6hh","icvyot","vrafjx","oivjwe","wvpqe5","g2u3we","h3c5rm","B9xav0g","zhjwy3","B7ck84d","Brf1p80","Bkfmm31","Bqenvij","a9b677","selectedMultiselectCheck","De3pzq","checkDisabled","d","h","a","m","useOptionStyles_unstable","state","focusVisible","multiselect","styles","className"],"sources":["useOptionStyles.styles.js"],"sourcesContent":["import { tokens } from '@fluentui/react-theme';\nimport { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nexport const optionClassNames = {\n root: 'fui-Option',\n checkIcon: 'fui-Option__checkIcon'\n};\n/**\n * Styles for the root slot\n */ const useStyles = makeStyles({\n root: {\n alignItems: 'center',\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n color: tokens.colorNeutralForeground1,\n columnGap: tokens.spacingHorizontalXS,\n cursor: 'pointer',\n display: 'flex',\n fontFamily: tokens.fontFamilyBase,\n fontSize: tokens.fontSizeBase300,\n lineHeight: tokens.lineHeightBase300,\n ...shorthands.padding(tokens.spacingVerticalSNudge, tokens.spacingHorizontalS),\n position: 'relative',\n '&:hover': {\n backgroundColor: tokens.colorNeutralBackground1Hover\n },\n '&:active': {\n backgroundColor: tokens.colorNeutralBackground1Pressed\n }\n },\n active: {\n // taken from @fluentui/react-tabster\n // cannot use createFocusIndicatorStyle() directly, since we aren't using the :focus selector\n '::after': {\n content: '\"\"',\n position: 'absolute',\n pointerEvents: 'none',\n zIndex: 1,\n ...shorthands.borderStyle('solid'),\n ...shorthands.borderWidth('2px'),\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n ...shorthands.borderColor(tokens.colorStrokeFocus2),\n top: '-2px',\n bottom: '-2px',\n left: '-2px',\n right: '-2px'\n }\n },\n disabled: {\n color: tokens.colorNeutralForegroundDisabled,\n '&:hover': {\n backgroundColor: tokens.colorTransparentBackground\n },\n '&:active': {\n backgroundColor: tokens.colorTransparentBackground\n },\n '@media (forced-colors: active)': {\n color: 'GrayText'\n }\n },\n selected: {},\n checkIcon: {\n fontSize: tokens.fontSizeBase400,\n // Shift icon(s) to the left to give text content extra spacing without needing an extra node\n // This is done instead of gap since the extra space only exists between icon > content, not icon > icon\n marginLeft: `calc(${tokens.spacingHorizontalXXS} * -1)`,\n marginRight: tokens.spacingHorizontalXXS,\n visibility: 'hidden',\n '& svg': {\n display: 'block'\n }\n },\n selectedCheck: {\n visibility: 'visible'\n },\n multiselectCheck: {\n ...shorthands.border(tokens.strokeWidthThin, 'solid', tokens.colorNeutralStrokeAccessible),\n ...shorthands.borderRadius(tokens.borderRadiusSmall),\n boxSizing: 'border-box',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n fill: 'currentColor',\n fontSize: '12px',\n height: '16px',\n width: '16px',\n visibility: 'visible'\n },\n selectedMultiselectCheck: {\n backgroundColor: tokens.colorCompoundBrandBackground,\n color: tokens.colorNeutralForegroundInverted,\n ...shorthands.borderColor(tokens.colorCompoundBrandBackground)\n },\n checkDisabled: {\n color: tokens.colorNeutralForegroundDisabled,\n '@media (forced-colors: active)': {\n color: 'GrayText'\n }\n }\n});\n/**\n * Apply styling to the Option slots based on the state\n */ export const useOptionStyles_unstable = (state)=>{\n const { active, disabled, focusVisible, multiselect, selected } = state;\n const styles = useStyles();\n state.root.className = mergeClasses(optionClassNames.root, styles.root, active && focusVisible && styles.active, disabled && styles.disabled, selected && styles.selected, state.root.className);\n if (state.checkIcon) {\n state.checkIcon.className = mergeClasses(optionClassNames.checkIcon, styles.checkIcon, multiselect && styles.multiselectCheck, selected && styles.selectedCheck, selected && multiselect && styles.selectedMultiselectCheck, disabled && styles.checkDisabled, state.checkIcon.className);\n }\n return state;\n};\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,uBAAuB;AAC9C,SAAAC,QAAA,EAAqBC,YAAY,EAAEC,UAAU,QAAQ,gBAAgB;AACrE,OAAO,MAAMC,gBAAgB,GAAG;EAC5BC,IAAI,EAAE,YAAY;EAClBC,SAAS,EAAE;AACf,CAAC;AACD;AACA;AACA;AAAI,MAAMC,SAAS,gBAAGN,QAAA;EAAAI,IAAA;IAAAG,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;EAAA;EAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,KAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;EAAAC,QAAA;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EE,QAAQ,IAAImC,MAAM,CAACnC,QAAQ,EAAEgC,KAAK,CAACjF,IAAI,CAACqF,SAAS,CAAC;EAChM,IAAIJ,KAAK,CAAChF,SAAS,EAAE;IACjBgF,KAAK,CAAChF,SAAS,CAACoF,SAAS,GAAGxF,YAAY,CAACE,gBAAgB,CAACE,SAAS,EAAEmF,MAAM,CAACnF,SAAS,EAAEkF,WAAW,IAAIC,MAAM,CAAC7B,gBAAgB,EAAEN,QAAQ,IAAImC,MAAM,CAAC9B,aAAa,EAAEL,QAAQ,IAAIkC,WAAW,IAAIC,MAAM,CAACX,wBAAwB,EAAE1B,QAAQ,IAAIqC,MAAM,CAACT,aAAa,EAAEM,KAAK,CAAChF,SAAS,CAACoF,SAAS,CAAC;EAC7R;EACA,OAAOJ,KAAK;AAChB,CAAC"}
1
+ {"version":3,"names":["tokens","__styles","mergeClasses","shorthands","optionClassNames","root","checkIcon","useStyles","Bt984gj","Bbmb7ep","Beyfa6y","B7oj6ja","Btl43ni","sj55zd","i8kkvl","Bceei9c","mc9l5x","Bahqtrf","Be2twd7","Bg96gwp","z8tnut","z189sj","Byoj8tv","uwmqm3","qhf8xq","Jwef8y","Bi91k9c","zqbkvg","h82x05","cqj998","j3hlsh","ecr2s2","lj723h","Btxx2vb","sltcwy","dnwvvm","Blyvkvs","active","Bsft5z2","E3zdtr","B80jsxd","t2ki1e","Bm2nyyq","Barhvk9","Bw17bha","vfts7","xrcqlc","Ihftqj","Bcgy8vk","Bhxzhr1","B3778ie","d9w3h3","Bl18szs","B4j8arr","B0n5ga8","s924m2","B1q35kw","Gp14am","bn5sak","By385i5","Eqx8gd","B1piin3","disabled","Bbusuzp","selected","Frg6f3","t21cq0","Bcdw1i0","Bo70h7d","selectedCheck","multiselectCheck","B4j52fo","Bekrc4i","Bn0qgzm","ibv6hh","icvyot","vrafjx","oivjwe","wvpqe5","g2u3we","h3c5rm","B9xav0g","zhjwy3","B7ck84d","Brf1p80","Bkfmm31","Bqenvij","a9b677","selectedMultiselectCheck","De3pzq","checkDisabled","multiselectCheckDisabled","d","h","a","m","useOptionStyles_unstable","state","focusVisible","multiselect","styles","className"],"sources":["useOptionStyles.styles.js"],"sourcesContent":["import { tokens } from '@fluentui/react-theme';\nimport { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nexport const optionClassNames = {\n root: 'fui-Option',\n checkIcon: 'fui-Option__checkIcon'\n};\n/**\n * Styles for the root slot\n */ const useStyles = makeStyles({\n root: {\n alignItems: 'center',\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n color: tokens.colorNeutralForeground1,\n columnGap: tokens.spacingHorizontalXS,\n cursor: 'pointer',\n display: 'flex',\n fontFamily: tokens.fontFamilyBase,\n fontSize: tokens.fontSizeBase300,\n lineHeight: tokens.lineHeightBase300,\n ...shorthands.padding(tokens.spacingVerticalSNudge, tokens.spacingHorizontalS),\n position: 'relative',\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground1Hover,\n color: tokens.colorNeutralForeground1Hover,\n [`& .${optionClassNames.checkIcon}`]: shorthands.borderColor(tokens.colorNeutralForeground1Hover)\n },\n ':active': {\n backgroundColor: tokens.colorNeutralBackground1Pressed,\n color: tokens.colorNeutralForeground1Pressed,\n [`& .${optionClassNames.checkIcon}`]: shorthands.borderColor(tokens.colorNeutralForeground1Hover)\n }\n },\n active: {\n // taken from @fluentui/react-tabster\n // cannot use createFocusIndicatorStyle() directly, since we aren't using the :focus selector\n '::after': {\n content: '\"\"',\n position: 'absolute',\n pointerEvents: 'none',\n zIndex: 1,\n ...shorthands.borderStyle('solid'),\n ...shorthands.borderWidth('2px'),\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n ...shorthands.borderColor(tokens.colorStrokeFocus2),\n top: '-2px',\n bottom: '-2px',\n left: '-2px',\n right: '-2px'\n }\n },\n disabled: {\n color: tokens.colorNeutralForegroundDisabled,\n ':hover': {\n backgroundColor: tokens.colorTransparentBackground,\n color: tokens.colorNeutralForegroundDisabled,\n [`& .${optionClassNames.checkIcon}`]: shorthands.borderColor(tokens.colorNeutralForegroundDisabled)\n },\n ':active': {\n backgroundColor: tokens.colorTransparentBackground,\n color: tokens.colorNeutralForegroundDisabled,\n [`& .${optionClassNames.checkIcon}`]: shorthands.borderColor(tokens.colorNeutralForegroundDisabled)\n },\n '@media (forced-colors: active)': {\n color: 'GrayText'\n }\n },\n selected: {},\n checkIcon: {\n fontSize: tokens.fontSizeBase400,\n // Shift icon(s) to the left to give text content extra spacing without needing an extra node\n // This is done instead of gap since the extra space only exists between icon > content, not icon > icon\n marginLeft: `calc(${tokens.spacingHorizontalXXS} * -1)`,\n marginRight: tokens.spacingHorizontalXXS,\n visibility: 'hidden',\n '& svg': {\n display: 'block'\n }\n },\n selectedCheck: {\n visibility: 'visible'\n },\n multiselectCheck: {\n ...shorthands.border(tokens.strokeWidthThin, 'solid', tokens.colorNeutralStrokeAccessible),\n ...shorthands.borderRadius(tokens.borderRadiusSmall),\n boxSizing: 'border-box',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n fill: 'currentColor',\n fontSize: '12px',\n height: '16px',\n width: '16px',\n visibility: 'visible'\n },\n selectedMultiselectCheck: {\n backgroundColor: tokens.colorCompoundBrandBackground,\n color: tokens.colorNeutralForegroundInverted,\n ...shorthands.borderColor(tokens.colorCompoundBrandBackground)\n },\n checkDisabled: {\n color: tokens.colorNeutralForegroundDisabled,\n '@media (forced-colors: active)': {\n color: 'GrayText'\n }\n },\n multiselectCheckDisabled: shorthands.borderColor(tokens.colorNeutralForegroundDisabled)\n});\n/**\n * Apply styling to the Option slots based on the state\n */ export const useOptionStyles_unstable = (state)=>{\n const { active, disabled, focusVisible, multiselect, selected } = state;\n const styles = useStyles();\n state.root.className = mergeClasses(optionClassNames.root, styles.root, active && focusVisible && styles.active, disabled && styles.disabled, selected && styles.selected, state.root.className);\n if (state.checkIcon) {\n state.checkIcon.className = mergeClasses(optionClassNames.checkIcon, styles.checkIcon, multiselect && styles.multiselectCheck, selected && styles.selectedCheck, selected && multiselect && styles.selectedMultiselectCheck, disabled && styles.checkDisabled, disabled && multiselect && styles.multiselectCheckDisabled, state.checkIcon.className);\n }\n return state;\n};\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,uBAAuB;AAC9C,SAAAC,QAAA,EAAqBC,YAAY,EAAEC,UAAU,QAAQ,gBAAgB;AACrE,OAAO,MAAMC,gBAAgB,GAAG;EAC5BC,IAAI,EAAE,YAAY;EAClBC,SAAS,EAAE;AACf,CAAC;AACD;AACA;AACA;AAAI,MAAMC,SAAS,gBAAGN,QAAA;EAAAI,IAAA;IAAAG,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;EAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,KAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;EAAAC,QAAA;IAAAjD,MAAA;IAAAY,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,O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YAAY,IAAIE,MAAM,CAAC/D,MAAM,EAAEyB,QAAQ,IAAIsC,MAAM,CAACtC,QAAQ,EAAEE,QAAQ,IAAIoC,MAAM,CAACpC,QAAQ,EAAEiC,KAAK,CAAC5F,IAAI,CAACgG,SAAS,CAAC;EAChM,IAAIJ,KAAK,CAAC3F,SAAS,EAAE;IACjB2F,KAAK,CAAC3F,SAAS,CAAC+F,SAAS,GAAGnG,YAAY,CAACE,gBAAgB,CAACE,SAAS,EAAE8F,MAAM,CAAC9F,SAAS,EAAE6F,WAAW,IAAIC,MAAM,CAAC9B,gBAAgB,EAAEN,QAAQ,IAAIoC,MAAM,CAAC/B,aAAa,EAAEL,QAAQ,IAAImC,WAAW,IAAIC,MAAM,CAACZ,wBAAwB,EAAE1B,QAAQ,IAAIsC,MAAM,CAACV,aAAa,EAAE5B,QAAQ,IAAIqC,WAAW,IAAIC,MAAM,CAACT,wBAAwB,EAAEM,KAAK,CAAC3F,SAAS,CAAC+F,SAAS,CAAC;EACzV;EACA,OAAOJ,KAAK;AAChB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["ComboboxBase.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { PositioningShorthand } from '@fluentui/react-positioning';\nimport type { ComboboxContextValue } from '../contexts/ComboboxContext';\nimport type { OptionValue, OptionCollectionState } from '../utils/OptionCollection.types';\nimport { SelectionProps, SelectionState } from '../utils/Selection.types';\nimport { PortalProps } from '@fluentui/react-portal';\n\n/**\n * ComboboxBase Props\n * Shared types between Combobox and Dropdown components\n */\nexport type ComboboxBaseProps = SelectionProps &\n Pick<PortalProps, 'mountNode'> & {\n /**\n * Controls the colors and borders of the combobox trigger.\n * @default 'outline'\n */\n appearance?: 'filled-darker' | 'filled-lighter' | 'outline' | 'underline';\n\n /**\n * The default open state when open is uncontrolled\n */\n defaultOpen?: boolean;\n\n /**\n * The default value displayed in the trigger input or button when the combobox's value is uncontrolled\n */\n defaultValue?: string;\n\n /**\n * Render the combobox's popup inline in the DOM.\n * This has accessibility benefits, particularly for touch screen readers.\n */\n inlinePopup?: boolean;\n\n /**\n * Callback when the open/closed state of the dropdown changes\n */\n onOpenChange?: (e: ComboboxBaseOpenEvents, data: ComboboxBaseOpenChangeData) => void;\n\n /**\n * Sets the open/closed state of the dropdown.\n * Use together with onOpenChange to fully control the dropdown's visibility\n */\n open?: boolean;\n\n /**\n * If set, the placeholder will show when no value is selected\n */\n placeholder?: string;\n\n /**\n * Configure the positioning of the combobox dropdown\n *\n * @defaultvalue below\n */\n positioning?: PositioningShorthand;\n\n /**\n * Controls the size of the combobox faceplate\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * The value displayed by the Combobox.\n * Use this with `onOptionSelect` to directly control the displayed value string\n */\n value?: string;\n };\n\n/**\n * State used in rendering Combobox\n */\nexport type ComboboxBaseState = Required<Pick<ComboboxBaseProps, 'appearance' | 'open' | 'inlinePopup' | 'size'>> &\n Pick<ComboboxBaseProps, 'mountNode' | 'placeholder' | 'value' | 'multiselect'> &\n OptionCollectionState &\n SelectionState & {\n /* Option data for the currently highlighted option (not the selected option) */\n activeOption?: OptionValue;\n\n // Whether the keyboard focus outline style should be visible\n focusVisible: boolean;\n\n /**\n * @deprecated - no longer used internally\n * whether the combobox/dropdown currently has focus\n */\n hasFocus: boolean;\n\n /**\n * @deprecated - no longer used internally\n * Whether the next blur event should be ignored, and the combobox/dropdown will not close.\n */\n ignoreNextBlur: React.MutableRefObject<boolean>;\n\n setActiveOption: React.Dispatch<React.SetStateAction<OptionValue | undefined>>;\n\n setFocusVisible(focusVisible: boolean): void;\n\n /**\n * @deprecated - no longer used internally\n */\n setHasFocus(hasFocus: boolean): void;\n\n setOpen(event: ComboboxBaseOpenEvents, newState: boolean): void;\n\n setValue(newValue: string | undefined): void;\n };\n\n/**\n * Data for the Combobox onOpenChange event.\n */\nexport type ComboboxBaseOpenChangeData = {\n open: boolean;\n};\n\n/* Possible event types for onOpen */\nexport type ComboboxBaseOpenEvents =\n | React.MouseEvent<HTMLElement>\n | React.KeyboardEvent<HTMLElement>\n | React.FocusEvent<HTMLElement>;\n\nexport type ComboboxBaseContextValues = {\n combobox: ComboboxContextValue;\n};\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
1
+ {"version":3,"sources":["ComboboxBase.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { PositioningShorthand } from '@fluentui/react-positioning';\nimport type { ComboboxContextValue } from '../contexts/ComboboxContext';\nimport type { OptionValue, OptionCollectionState } from '../utils/OptionCollection.types';\nimport { SelectionProps, SelectionState } from '../utils/Selection.types';\nimport { PortalProps } from '@fluentui/react-portal';\n\n/**\n * ComboboxBase Props\n * Shared types between Combobox and Dropdown components\n */\nexport type ComboboxBaseProps = SelectionProps &\n Pick<PortalProps, 'mountNode'> & {\n /**\n * Controls the colors and borders of the combobox trigger.\n * @default 'outline'\n */\n appearance?: 'filled-darker' | 'filled-lighter' | 'outline' | 'underline';\n\n /**\n * The default open state when open is uncontrolled\n */\n defaultOpen?: boolean;\n\n /**\n * The default value displayed in the trigger input or button when the combobox's value is uncontrolled\n */\n defaultValue?: string;\n\n /**\n * Render the combobox's popup inline in the DOM.\n * This has accessibility benefits, particularly for touch screen readers.\n */\n inlinePopup?: boolean;\n\n /**\n * Callback when the open/closed state of the dropdown changes\n */\n onOpenChange?: (e: ComboboxBaseOpenEvents, data: ComboboxBaseOpenChangeData) => void;\n\n /**\n * Sets the open/closed state of the dropdown.\n * Use together with onOpenChange to fully control the dropdown's visibility\n */\n open?: boolean;\n\n /**\n * If set, the placeholder will show when no value is selected\n */\n placeholder?: string;\n\n /**\n * Configure the positioning of the combobox dropdown\n *\n * @defaultvalue below\n */\n positioning?: PositioningShorthand;\n\n /**\n * Controls the size of the combobox faceplate\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * The value displayed by the Combobox.\n * Use this with `onOptionSelect` to directly control the displayed value string\n */\n value?: string;\n };\n\n/**\n * State used in rendering Combobox\n */\nexport type ComboboxBaseState = Required<Pick<ComboboxBaseProps, 'appearance' | 'open' | 'inlinePopup' | 'size'>> &\n Pick<ComboboxBaseProps, 'mountNode' | 'placeholder' | 'value' | 'multiselect'> &\n OptionCollectionState &\n SelectionState & {\n /* Option data for the currently highlighted option (not the selected option) */\n activeOption?: OptionValue;\n\n // Whether the keyboard focus outline style should be visible\n focusVisible: boolean;\n\n /**\n * whether the combobox/dropdown currently has focus\n */\n hasFocus: boolean;\n\n /**\n * @deprecated - no longer used internally\n * Whether the next blur event should be ignored, and the combobox/dropdown will not close.\n */\n ignoreNextBlur: React.MutableRefObject<boolean>;\n\n setActiveOption: React.Dispatch<React.SetStateAction<OptionValue | undefined>>;\n\n setFocusVisible(focusVisible: boolean): void;\n\n setHasFocus(hasFocus: boolean): void;\n\n setOpen(event: ComboboxBaseOpenEvents, newState: boolean): void;\n\n setValue(newValue: string | undefined): void;\n };\n\n/**\n * Data for the Combobox onOpenChange event.\n */\nexport type ComboboxBaseOpenChangeData = {\n open: boolean;\n};\n\n/* Possible event types for onOpen */\nexport type ComboboxBaseOpenEvents =\n | React.MouseEvent<HTMLElement>\n | React.KeyboardEvent<HTMLElement>\n | React.FocusEvent<HTMLElement>;\n\nexport type ComboboxBaseContextValues = {\n combobox: ComboboxContextValue;\n};\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
@@ -13,6 +13,7 @@ import { useSelection } from '../utils/useSelection';
13
13
  // tabster/keyborg doesn't work here, since the actual keyboard focus target doesn't move
14
14
  const [focusVisible, setFocusVisible] = React.useState(false);
15
15
  // track focused state to conditionally render collapsed listbox
16
+ // when the trigger is focused - the listbox should but hidden until the open state is changed
16
17
  const [hasFocus, setHasFocus] = React.useState(false);
17
18
  const ignoreNextBlur = React.useRef(false);
18
19
  const selectionState = useSelection(props);
@@ -1 +1 @@
1
- {"version":3,"sources":["useComboboxBaseState.ts"],"sourcesContent":["import * as React from 'react';\nimport { useControllableState, useFirstMount } from '@fluentui/react-utilities';\nimport { useOptionCollection } from '../utils/useOptionCollection';\nimport { OptionValue } from '../utils/OptionCollection.types';\nimport { useSelection } from '../utils/useSelection';\nimport type { ComboboxBaseProps, ComboboxBaseOpenEvents, ComboboxBaseState } from './ComboboxBase.types';\n\n/**\n * State shared between Combobox and Dropdown components\n */\nexport const useComboboxBaseState = (\n props: ComboboxBaseProps & { children?: React.ReactNode; editable?: boolean },\n): ComboboxBaseState => {\n const {\n appearance = 'outline',\n children,\n editable = false,\n inlinePopup = false,\n mountNode = undefined,\n multiselect,\n onOpenChange,\n size = 'medium',\n } = props;\n\n const optionCollection = useOptionCollection();\n const { getOptionAtIndex, getOptionsMatchingValue } = optionCollection;\n\n const [activeOption, setActiveOption] = React.useState<OptionValue | undefined>();\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\n // track focused state to conditionally render collapsed listbox\n const [hasFocus, setHasFocus] = React.useState(false);\n\n const ignoreNextBlur = React.useRef(false);\n\n const selectionState = useSelection(props);\n const { selectedOptions } = selectionState;\n\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\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\n // handle defaultValue here, so it is overridden by selection\n if (isFirstMount && props.defaultValue !== undefined) {\n return props.defaultValue;\n }\n\n const selectedOptionsText = getOptionsMatchingValue(optionValue => {\n return selectedOptions.includes(optionValue);\n }).map(option => option.text);\n\n if (multiselect) {\n // editable inputs should not display multiple selected options in the input as text\n return editable ? '' : selectedOptionsText.join(', ');\n }\n\n return selectedOptionsText[0];\n\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 }, [controllableValue, editable, getOptionsMatchingValue, multiselect, props.defaultValue, 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\n const setOpen = React.useCallback(\n (event: ComboboxBaseOpenEvents, newState: boolean) => {\n onOpenChange?.(event, { open: newState });\n setOpenState(newState);\n },\n [onOpenChange, setOpenState],\n );\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 }\n // default to starting at the first option\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 }, [open, children]);\n\n return {\n ...optionCollection,\n ...selectionState,\n activeOption,\n appearance,\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":["React","useControllableState","useFirstMount","useOptionCollection","useSelection","useComboboxBaseState","props","appearance","children","editable","inlinePopup","mountNode","undefined","multiselect","onOpenChange","size","optionCollection","getOptionAtIndex","getOptionsMatchingValue","activeOption","setActiveOption","useState","focusVisible","setFocusVisible","hasFocus","setHasFocus","ignoreNextBlur","useRef","selectionState","selectedOptions","isFirstMount","controllableValue","setValue","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":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,oBAAoB,EAAEC,aAAa,QAAQ,4BAA4B;AAChF,SAASC,mBAAmB,QAAQ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AAoBM,IAAI,CAAC;QAClD;QAEA,OAAON,mBAAmB,CAAC,EAAE;IAE7B,kDAAkD;IAClD,0EAA0E;IAC1E,4CAA4C;IAC5C,uDAAuD;IACzD,GAAG;QAACP;QAAmBtB;QAAUS;QAAyBL;QAAaP,MAAM+B,YAAY;QAAER;KAAgB;IAE3G,6DAA6D;IAC7D,MAAM,CAACgB,MAAMC,aAAa,GAAG7C,qBAAqB;QAChDgC,OAAO3B,MAAMuC,IAAI;QACjBE,cAAczC,MAAM0C,WAAW;QAC/Bb,cAAc;IAChB;IAEA,MAAMc,UAAUjD,MAAMkD,WAAW,CAC/B,CAACC,OAA+BC;QAC9BtC,yBAAAA,mCAAAA,aAAeqC,OAAO;YAAEN,MAAMO;QAAS;QACvCN,aAAaM;IACf,GACA;QAACtC;QAAcgC;KAAa;IAG9B,iEAAiE;IACjE9C,MAAMqD,SAAS,CAAC;QACd,IAAIR,QAAQ,CAAC1B,cAAc;YACzB,sFAAsF;YACtF,IAAI,CAACN,eAAegB,gBAAgByB,MAAM,GAAG,GAAG;gBAC9C,MAAMC,iBAAiBrC,wBAAwBsC,CAAAA,IAAKA,MAAM3B,eAAe,CAAC,EAAE,EAAE4B,GAAG;gBACjFF,kBAAkBnC,gBAAgBmC;YACpC,OAEK;gBACHnC,gBAAgBH,iBAAiB;YACnC;QACF,OAAO,IAAI,CAAC4B,MAAM;YAChB,uCAAuC;YACvCzB,gBAAgBR;QAClB;IACA,+EAA+E;IAC/E,uDAAuD;IACzD,GAAG;QAACiC;QAAMrC;KAAS;IAEnB,OAAO;QACL,GAAGQ,gBAAgB;QACnB,GAAGY,cAAc;QACjBT;QACAZ;QACAe;QACAE;QACAE;QACAhB;QACAC;QACAkC;QACAzB;QACAG;QACAE;QACAwB;QACAjB;QACAjB;QACAmB;QACArB;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["useComboboxBaseState.ts"],"sourcesContent":["import * as React from 'react';\nimport { useControllableState, useFirstMount } from '@fluentui/react-utilities';\nimport { useOptionCollection } from '../utils/useOptionCollection';\nimport { OptionValue } from '../utils/OptionCollection.types';\nimport { useSelection } from '../utils/useSelection';\nimport type { ComboboxBaseProps, ComboboxBaseOpenEvents, ComboboxBaseState } from './ComboboxBase.types';\n\n/**\n * State shared between Combobox and Dropdown components\n */\nexport const useComboboxBaseState = (\n props: ComboboxBaseProps & { children?: React.ReactNode; editable?: boolean },\n): ComboboxBaseState => {\n const {\n appearance = 'outline',\n children,\n editable = false,\n inlinePopup = false,\n mountNode = undefined,\n multiselect,\n onOpenChange,\n size = 'medium',\n } = props;\n\n const optionCollection = useOptionCollection();\n const { getOptionAtIndex, getOptionsMatchingValue } = optionCollection;\n\n const [activeOption, setActiveOption] = React.useState<OptionValue | undefined>();\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\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\n const ignoreNextBlur = React.useRef(false);\n\n const selectionState = useSelection(props);\n const { selectedOptions } = selectionState;\n\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\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\n // handle defaultValue here, so it is overridden by selection\n if (isFirstMount && props.defaultValue !== undefined) {\n return props.defaultValue;\n }\n\n const selectedOptionsText = getOptionsMatchingValue(optionValue => {\n return selectedOptions.includes(optionValue);\n }).map(option => option.text);\n\n if (multiselect) {\n // editable inputs should not display multiple selected options in the input as text\n return editable ? '' : selectedOptionsText.join(', ');\n }\n\n return selectedOptionsText[0];\n\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 }, [controllableValue, editable, getOptionsMatchingValue, multiselect, props.defaultValue, 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\n const setOpen = React.useCallback(\n (event: ComboboxBaseOpenEvents, newState: boolean) => {\n onOpenChange?.(event, { open: newState });\n setOpenState(newState);\n },\n [onOpenChange, setOpenState],\n );\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 }\n // default to starting at the first option\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 }, [open, children]);\n\n return {\n ...optionCollection,\n ...selectionState,\n activeOption,\n appearance,\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":["React","useControllableState","useFirstMount","useOptionCollection","useSelection","useComboboxBaseState","props","appearance","children","editable","inlinePopup","mountNode","undefined","multiselect","onOpenChange","size","optionCollection","getOptionAtIndex","getOptionsMatchingValue","activeOption","setActiveOption","useState","focusVisible","setFocusVisible","hasFocus","setHasFocus","ignoreNextBlur","useRef","selectionState","selectedOptions","isFirstMount","controllableValue","setValue","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":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,oBAAoB,EAAEC,aAAa,QAAQ,4BAA4B;AAChF,SA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
  * Shared trigger behaviour for combobox and dropdown
6
6
  * @returns trigger slot with desired behaviour and props
7
7
  */ export function useTriggerSlot(triggerSlotFromProp, ref, options) {
8
- const { state: { activeOption, getCount, getIndexOfId, getOptionAtIndex, open, selectOption, setActiveOption, setFocusVisible, setOpen, multiselect }, defaultProps, elementType } = options;
8
+ const { state: { activeOption, getCount, getIndexOfId, getOptionAtIndex, open, selectOption, setActiveOption, setFocusVisible, setOpen, multiselect, setHasFocus }, defaultProps, elementType } = options;
9
9
  const trigger = slot.always(triggerSlotFromProp, {
10
10
  defaultProps: {
11
11
  type: 'text',
@@ -22,7 +22,13 @@ import { getDropdownActionFromKey, getIndexFromAction } from '../utils/dropdownK
22
22
  // the trigger should open/close the popup on click or blur
23
23
  trigger.onBlur = mergeCallbacks((event)=>{
24
24
  setOpen(event, false);
25
+ setHasFocus(false);
25
26
  }, trigger.onBlur);
27
+ trigger.onFocus = mergeCallbacks((event)=>{
28
+ if (event.target === event.currentTarget) {
29
+ setHasFocus(true);
30
+ }
31
+ }, trigger.onFocus);
26
32
  trigger.onClick = mergeCallbacks((event)=>{
27
33
  setOpen(event, !open);
28
34
  }, trigger.onClick);
@@ -1 +1 @@
1
- {"version":3,"sources":["useTriggerSlot.ts"],"sourcesContent":["import * as React from 'react';\nimport { mergeCallbacks, slot, useMergedRefs } from '@fluentui/react-utilities';\nimport type { ExtractSlotProps, Slot, SlotComponentType } from '@fluentui/react-utilities';\nimport { getDropdownActionFromKey, getIndexFromAction } from '../utils/dropdownKeyActions';\nimport type { ComboboxBaseState } from './ComboboxBase.types';\n\nexport type UseTriggerSlotState = Pick<\n ComboboxBaseState,\n | 'activeOption'\n | 'getCount'\n | 'getIndexOfId'\n | 'getOptionAtIndex'\n | 'open'\n | 'selectOption'\n | 'setActiveOption'\n | 'setFocusVisible'\n | 'setOpen'\n | 'multiselect'\n | 'value'\n>;\n\ntype UseTriggerSlotOptions = {\n state: UseTriggerSlotState;\n defaultProps: unknown;\n};\n\nexport function useTriggerSlot(\n triggerSlotFromProp: NonNullable<Slot<'button'>>,\n ref: React.Ref<HTMLButtonElement>,\n options: UseTriggerSlotOptions & { elementType: 'button' },\n): SlotComponentType<ExtractSlotProps<Slot<'button'>>>;\n\nexport function useTriggerSlot(\n triggerSlotFromProp: NonNullable<Slot<'input'>>,\n ref: React.Ref<HTMLInputElement>,\n options: UseTriggerSlotOptions & { elementType: 'input' },\n): SlotComponentType<ExtractSlotProps<Slot<'input'>>>;\n\n/**\n * Shared trigger behaviour for combobox and dropdown\n * @returns trigger slot with desired behaviour and props\n */\nexport function useTriggerSlot(\n triggerSlotFromProp: NonNullable<Slot<'input'>> | NonNullable<Slot<'button'>>,\n ref: React.Ref<HTMLButtonElement> | React.Ref<HTMLInputElement>,\n options: UseTriggerSlotOptions & { elementType: 'input' | 'button' },\n): SlotComponentType<ExtractSlotProps<Slot<'button'>>> | SlotComponentType<ExtractSlotProps<Slot<'input'>>> {\n const {\n state: {\n activeOption,\n getCount,\n getIndexOfId,\n getOptionAtIndex,\n open,\n selectOption,\n setActiveOption,\n setFocusVisible,\n setOpen,\n multiselect,\n },\n defaultProps,\n elementType,\n } = options;\n\n const trigger = slot.always(triggerSlotFromProp, {\n defaultProps: {\n type: 'text',\n 'aria-expanded': open,\n 'aria-activedescendant': open ? activeOption?.id : undefined,\n role: 'combobox',\n ...(typeof defaultProps === 'object' && defaultProps),\n },\n elementType,\n });\n\n // handle trigger focus/blur\n const triggerRef = React.useRef<HTMLButtonElement | HTMLInputElement>(null);\n trigger.ref = useMergedRefs(triggerRef, trigger.ref, ref) as React.Ref<HTMLButtonElement & HTMLInputElement>;\n\n // the trigger should open/close the popup on click or blur\n trigger.onBlur = mergeCallbacks((event: React.FocusEvent<HTMLButtonElement> & React.FocusEvent<HTMLInputElement>) => {\n setOpen(event, false);\n }, trigger.onBlur);\n\n trigger.onClick = mergeCallbacks(\n (event: React.MouseEvent<HTMLButtonElement> & React.MouseEvent<HTMLInputElement>) => {\n setOpen(event, !open);\n },\n trigger.onClick,\n );\n\n // handle combobox keyboard interaction\n trigger.onKeyDown = mergeCallbacks(\n (event: React.KeyboardEvent<HTMLButtonElement> & React.KeyboardEvent<HTMLInputElement>) => {\n const action = getDropdownActionFromKey(event, { open, multiselect });\n const maxIndex = getCount() - 1;\n const activeIndex = activeOption ? getIndexOfId(activeOption.id) : -1;\n let newIndex = activeIndex;\n\n switch (action) {\n case 'Open':\n event.preventDefault();\n setFocusVisible(true);\n setOpen(event, true);\n break;\n case 'Close':\n // stop propagation for escape key to avoid dismissing any parent popups\n event.stopPropagation();\n event.preventDefault();\n setOpen(event, false);\n break;\n case 'CloseSelect':\n !multiselect && !activeOption?.disabled && setOpen(event, false);\n // fallthrough\n case 'Select':\n activeOption && selectOption(event, activeOption);\n event.preventDefault();\n break;\n case 'Tab':\n !multiselect && activeOption && selectOption(event, activeOption);\n break;\n default:\n newIndex = getIndexFromAction(action, activeIndex, maxIndex);\n }\n if (newIndex !== activeIndex) {\n // prevent default page scroll/keyboard action if the index changed\n event.preventDefault();\n setActiveOption(getOptionAtIndex(newIndex));\n setFocusVisible(true);\n }\n },\n trigger.onKeyDown,\n );\n\n trigger.onMouseOver = mergeCallbacks(\n (event: React.MouseEvent<HTMLButtonElement> & React.MouseEvent<HTMLInputElement>) => {\n setFocusVisible(false);\n },\n trigger.onMouseOver,\n );\n\n // TODO fix cast\n return trigger as SlotComponentType<ExtractSlotProps<Slot<'input'>>>;\n}\n"],"names":["React","mergeCallbacks","slot","useMergedRefs","getDropdownActionFromKey","getIndexFromAction","useTriggerSlot","triggerSlotFromProp","ref","options","state","activeOption","getCount","getIndexOfId","getOptionAtIndex","open","selectOption","setActiveOption","setFocusVisible","setOpen","multiselect","defaultProps","elementType","trigger","always","type","id","undefined","role","triggerRef","useRef","onBlur","event","onClick","onKeyDown","action","maxIndex","activeIndex","newIndex","preventDefault","stopPropagation","disabled","onMouseOver"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,cAAc,EAA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;gBACf;YACF,KAAK;gBACH,wEAAwE;gBACxEA,MAAMQ,eAAe;gBACrBR,MAAMO,cAAc;gBACpBpB,QAAQa,OAAO;gBACf;YACF,KAAK;gBACH,CAACZ,eAAe,EAACT,yBAAAA,mCAAAA,aAAc8B,QAAQ,KAAItB,QAAQa,OAAO;YAC5D,cAAc;YACd,KAAK;gBACHrB,gBAAgBK,aAAagB,OAAOrB;gBACpCqB,MAAMO,cAAc;gBACpB;YACF,KAAK;gBACH,CAACnB,eAAeT,gBAAgBK,aAAagB,OAAOrB;gBACpD;YACF;gBACE2B,WAAWjC,mBAAmB8B,QAAQE,aAAaD;QACvD;QACA,IAAIE,aAAaD,aAAa;YAC5B,mEAAmE;YACnEL,MAAMO,cAAc;YACpBtB,gBAAgBH,iBAAiBwB;YACjCpB,gBAAgB;QAClB;IACF,GACAK,QAAQW,SAAS;IAGnBX,QAAQmB,WAAW,GAAGzC,eACpB,CAAC+B;QACCd,gBAAgB;IAClB,GACAK,QAAQmB,WAAW;IAGrB,gBAAgB;IAChB,OAAOnB;AACT"}
1
+ {"version":3,"sources":["useTriggerSlot.ts"],"sourcesContent":["import * as React from 'react';\nimport { mergeCallbacks, slot, useMergedRefs } from '@fluentui/react-utilities';\nimport type { ExtractSlotProps, Slot, SlotComponentType } from '@fluentui/react-utilities';\nimport { getDropdownActionFromKey, getIndexFromAction } from '../utils/dropdownKeyActions';\nimport type { ComboboxBaseState } from './ComboboxBase.types';\n\nexport type UseTriggerSlotState = Pick<\n ComboboxBaseState,\n | 'activeOption'\n | 'getCount'\n | 'getIndexOfId'\n | 'getOptionAtIndex'\n | 'open'\n | 'selectOption'\n | 'setActiveOption'\n | 'setFocusVisible'\n | 'setOpen'\n | 'multiselect'\n | 'value'\n | 'setHasFocus'\n>;\n\ntype UseTriggerSlotOptions = {\n state: UseTriggerSlotState;\n defaultProps: unknown;\n};\n\nexport function useTriggerSlot(\n triggerSlotFromProp: NonNullable<Slot<'button'>>,\n ref: React.Ref<HTMLButtonElement>,\n options: UseTriggerSlotOptions & { elementType: 'button' },\n): SlotComponentType<ExtractSlotProps<Slot<'button'>>>;\n\nexport function useTriggerSlot(\n triggerSlotFromProp: NonNullable<Slot<'input'>>,\n ref: React.Ref<HTMLInputElement>,\n options: UseTriggerSlotOptions & { elementType: 'input' },\n): SlotComponentType<ExtractSlotProps<Slot<'input'>>>;\n\n/**\n * Shared trigger behaviour for combobox and dropdown\n * @returns trigger slot with desired behaviour and props\n */\nexport function useTriggerSlot(\n triggerSlotFromProp: NonNullable<Slot<'input'>> | NonNullable<Slot<'button'>>,\n ref: React.Ref<HTMLButtonElement> | React.Ref<HTMLInputElement>,\n options: UseTriggerSlotOptions & { elementType: 'input' | 'button' },\n): SlotComponentType<ExtractSlotProps<Slot<'button'>>> | SlotComponentType<ExtractSlotProps<Slot<'input'>>> {\n const {\n state: {\n activeOption,\n getCount,\n getIndexOfId,\n getOptionAtIndex,\n open,\n selectOption,\n setActiveOption,\n setFocusVisible,\n setOpen,\n multiselect,\n setHasFocus,\n },\n defaultProps,\n elementType,\n } = options;\n\n const trigger = slot.always(triggerSlotFromProp, {\n defaultProps: {\n type: 'text',\n 'aria-expanded': open,\n 'aria-activedescendant': open ? activeOption?.id : undefined,\n role: 'combobox',\n ...(typeof defaultProps === 'object' && defaultProps),\n },\n elementType,\n });\n\n // handle trigger focus/blur\n const triggerRef = React.useRef<HTMLButtonElement | HTMLInputElement>(null);\n trigger.ref = useMergedRefs(triggerRef, trigger.ref, ref) as React.Ref<HTMLButtonElement & HTMLInputElement>;\n\n // the trigger should open/close the popup on click or blur\n trigger.onBlur = mergeCallbacks((event: React.FocusEvent<HTMLButtonElement> & React.FocusEvent<HTMLInputElement>) => {\n setOpen(event, false);\n setHasFocus(false);\n }, trigger.onBlur);\n\n trigger.onFocus = mergeCallbacks(\n (event: React.FocusEvent<HTMLButtonElement> & React.FocusEvent<HTMLInputElement>) => {\n if (event.target === event.currentTarget) {\n setHasFocus(true);\n }\n },\n trigger.onFocus,\n );\n trigger.onClick = mergeCallbacks(\n (event: React.MouseEvent<HTMLButtonElement> & React.MouseEvent<HTMLInputElement>) => {\n setOpen(event, !open);\n },\n trigger.onClick,\n );\n\n // handle combobox keyboard interaction\n trigger.onKeyDown = mergeCallbacks(\n (event: React.KeyboardEvent<HTMLButtonElement> & React.KeyboardEvent<HTMLInputElement>) => {\n const action = getDropdownActionFromKey(event, { open, multiselect });\n const maxIndex = getCount() - 1;\n const activeIndex = activeOption ? getIndexOfId(activeOption.id) : -1;\n let newIndex = activeIndex;\n\n switch (action) {\n case 'Open':\n event.preventDefault();\n setFocusVisible(true);\n setOpen(event, true);\n break;\n case 'Close':\n // stop propagation for escape key to avoid dismissing any parent popups\n event.stopPropagation();\n event.preventDefault();\n setOpen(event, false);\n break;\n case 'CloseSelect':\n !multiselect && !activeOption?.disabled && setOpen(event, false);\n // fallthrough\n case 'Select':\n activeOption && selectOption(event, activeOption);\n event.preventDefault();\n break;\n case 'Tab':\n !multiselect && activeOption && selectOption(event, activeOption);\n break;\n default:\n newIndex = getIndexFromAction(action, activeIndex, maxIndex);\n }\n if (newIndex !== activeIndex) {\n // prevent default page scroll/keyboard action if the index changed\n event.preventDefault();\n setActiveOption(getOptionAtIndex(newIndex));\n setFocusVisible(true);\n }\n },\n trigger.onKeyDown,\n );\n\n trigger.onMouseOver = mergeCallbacks(\n (event: React.MouseEvent<HTMLButtonElement> & React.MouseEvent<HTMLInputElement>) => {\n setFocusVisible(false);\n },\n trigger.onMouseOver,\n );\n\n // TODO fix cast\n return trigger as SlotComponentType<ExtractSlotProps<Slot<'input'>>>;\n}\n"],"names":["React","mergeCallbacks","slot","useMergedRefs","getDropdownActionFromKey","getIndexFromAction","useTriggerSlot","triggerSlotFromProp","ref","options","state","activeOption","getCount","getIndexOfId","getOptionAtIndex","open","selectOption","setActiveOption","setFocusVisible","setOpen","multiselect","setHasFocus","defaultProps","elementType","trigger","always","type","id","undefined","role","triggerRef","useRef","onBlur","event","onFocus","target","currentTarget","onClick","onKeyDown","action","maxIndex","activeIndex","newIndex","preventDefault","stopPropagation","disabled","onMouseOver"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,cAAc,EAAEC,IAAI,EAAEC,aAAa,QAAQ,4BAA4B;AAEhF,SAASC,wBAAwB,EAAEC,kBAAkB,QAAQ,8BAA8B;AAoC3F;;;CAGC,GACD,OAAO,SAASC,eACdC,mBAA6E,EAC7EC,GAA+D,EAC/DC,OAAoE;IAEpE,MAAM,EACJC,OAAO,EACLC,YAAY,EACZC,QAAQ,EACRC,YAAY,EACZC,gBAAgB,EAChBC,IAAI,EACJC,YAAY,EACZC,eAAe,EACfC,eAAe,EACfC,OAAO,EACPC,WAAW,EACXC,WAAW,EACZ,EACDC,YAAY,EACZC,WAAW,EACZ,GAAGd;IAEJ,MAAMe,UAAUtB,KAAKuB,MAAM,CAAClB,qBAAqB;QAC/Ce,cAAc;YACZI,MAAM;YACN,iBAAiBX;YACjB,yBAAyBA,OAAOJ,yBAAAA,mCAAAA,aAAcgB,EAAE,GAAGC;YACnDC,MAAM;YACN,GAAI,OAAOP,iBAAiB,YAAYA,YAAY;QACtD;QACAC;IACF;IAEA,4BAA4B;IAC5B,MAAMO,aAAa9B,MAAM+B,MAAM,CAAuC;IACtEP,QAAQhB,GAAG,GAAGL,cAAc2B,YAAYN,QAAQhB,GAAG,EAAEA;IAErD,2DAA2D;IAC3DgB,QAAQQ,MAAM,GAAG/B,eAAe,CAACgC;QAC/Bd,QAAQc,OAAO;QACfZ,YAAY;IACd,GAAGG,QAAQQ,MAAM;IAEjBR,QAAQU,OAAO,GAAGjC,eAChB,CAACgC;QACC,IAAIA,MAAME,MAAM,KAAKF,MAAMG,aAAa,EAAE;YACxCf,YAAY;QACd;IACF,GACAG,QAAQU,OAAO;IAEjBV,QAAQa,OAAO,GAAGpC,eAChB,CAACgC;QACCd,QAAQc,OAAO,CAAClB;IAClB,GACAS,QAAQa,OAAO;IAGjB,uCAAuC;IACvCb,QAAQc,SAAS,GAAGrC,eAClB,CAACgC;QACC,MAAMM,SAASnC,yBAAyB6B,OAAO;YAAElB;YAAMK;QAAY;QACnE,MAAMoB,WAAW5B,aAAa;QAC9B,MAAM6B,cAAc9B,eAAeE,aAAaF,aAAagB,EAAE,IAAI,CAAC;QACpE,IAAIe,WAAWD;QAEf,OAAQF;YACN,KAAK;gBACHN,MAAMU,cAAc;gBACpBzB,gBAAgB;gBAChBC,QAAQc,OAAO;gBACf;YACF,KAAK;gBACH,wEAAwE;gBACxEA,MAAMW,eAAe;gBACrBX,MAAMU,cAAc;gBACpBxB,QAAQc,OAAO;gBACf;YACF,KAAK;gBACH,CAACb,eAAe,EAACT,yBAAAA,mCAAAA,aAAckC,QAAQ,KAAI1B,QAAQc,OAAO;YAC5D,cAAc;YACd,KAAK;gBACHtB,gBAAgBK,aAAaiB,OAAOtB;gBACpCsB,MAAMU,cAAc;gBACpB;YACF,KAAK;gBACH,CAACvB,eAAeT,gBAAgBK,aAAaiB,OAAOtB;gBACpD;YACF;gBACE+B,WAAWrC,mBAAmBkC,QAAQE,aAAaD;QACvD;QACA,IAAIE,aAAaD,aAAa;YAC5B,mEAAmE;YACnER,MAAMU,cAAc;YACpB1B,gBAAgBH,iBAAiB4B;YACjCxB,gBAAgB;QAClB;IACF,GACAM,QAAQc,SAAS;IAGnBd,QAAQsB,WAAW,GAAG7C,eACpB,CAACgC;QACCf,gBAAgB;IAClB,GACAM,QAAQsB,WAAW;IAGrB,gBAAgB;IAChB,OAAOtB;AACT"}
@@ -29,7 +29,7 @@ const useCombobox_unstable = (props, ref)=>{
29
29
  ...props,
30
30
  editable: true
31
31
  });
32
- const { open, selectOption, setOpen, setValue, value } = baseState;
32
+ const { open, selectOption, setOpen, setValue, value, hasFocus } = baseState;
33
33
  const [comboboxPopupRef, comboboxTargetRef] = (0, _useComboboxPositioning.useComboboxPositioning)(props);
34
34
  const { disabled, freeform, inlinePopup } = props;
35
35
  const comboId = (0, _reactutilities.useId)('combobox-');
@@ -90,7 +90,7 @@ const useCombobox_unstable = (props, ref)=>{
90
90
  },
91
91
  root: rootSlot,
92
92
  input: triggerSlot,
93
- listbox: open ? listbox : undefined,
93
+ listbox: open || hasFocus ? listbox : undefined,
94
94
  expandIcon: _reactutilities.slot.optional(props.expandIcon, {
95
95
  renderByDefault: true,
96
96
  defaultProps: {
@@ -1 +1 @@
1
- {"version":3,"sources":["useCombobox.js"],"sourcesContent":["import * as React from 'react';\nimport { useFieldControlProps_unstable } from '@fluentui/react-field';\nimport { ChevronDownRegular as ChevronDownIcon } from '@fluentui/react-icons';\nimport { getPartitionedNativeProps, mergeCallbacks, useEventCallback, useId, useMergedRefs, slot } from '@fluentui/react-utilities';\nimport { useComboboxBaseState } from '../../utils/useComboboxBaseState';\nimport { useComboboxPositioning } from '../../utils/useComboboxPositioning';\nimport { Listbox } from '../Listbox/Listbox';\nimport { useListboxSlot } from '../../utils/useListboxSlot';\nimport { useInputTriggerSlot } from './useInputTriggerSlot';\n/**\n * Create the state required to render Combobox.\n *\n * The returned state can be modified with hooks such as useComboboxStyles_unstable,\n * before being passed to renderCombobox_unstable.\n *\n * @param props - props from this instance of Combobox\n * @param ref - reference to root HTMLElement of Combobox\n */ export const useCombobox_unstable = (props, ref)=>{\n // Merge props from surrounding <Field>, if any\n props = useFieldControlProps_unstable(props, {\n supportsLabelFor: true,\n supportsRequired: true,\n supportsSize: true\n });\n const baseState = useComboboxBaseState({\n ...props,\n editable: true\n });\n const { open, selectOption, setOpen, setValue, value } = baseState;\n const [comboboxPopupRef, comboboxTargetRef] = useComboboxPositioning(props);\n const { disabled, freeform, inlinePopup } = props;\n const comboId = useId('combobox-');\n const { primary: triggerNativeProps, root: rootNativeProps } = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'input',\n excludedPropNames: [\n 'children',\n 'size'\n ]\n });\n // reset any typed value when an option is selected\n baseState.selectOption = (ev, option)=>{\n setValue(undefined);\n selectOption(ev, option);\n };\n baseState.setOpen = (ev, newState)=>{\n if (disabled) {\n return;\n }\n if (!newState && !freeform) {\n setValue(undefined);\n }\n setOpen(ev, newState);\n };\n const triggerRef = React.useRef(null);\n const listbox = useListboxSlot(props.listbox, comboboxPopupRef, {\n state: baseState,\n triggerRef,\n defaultProps: {\n children: props.children\n }\n });\n var _props_input;\n const triggerSlot = useInputTriggerSlot((_props_input = props.input) !== null && _props_input !== void 0 ? _props_input : {}, useMergedRefs(triggerRef, ref), {\n state: baseState,\n freeform,\n defaultProps: {\n type: 'text',\n value: value !== null && value !== void 0 ? value : '',\n ...triggerNativeProps\n }\n });\n const rootSlot = slot.always(props.root, {\n defaultProps: {\n 'aria-owns': !inlinePopup && open ? listbox === null || listbox === void 0 ? void 0 : listbox.id : undefined,\n ...rootNativeProps\n },\n elementType: 'div'\n });\n rootSlot.ref = useMergedRefs(rootSlot.ref, comboboxTargetRef);\n const state = {\n components: {\n root: 'div',\n input: 'input',\n expandIcon: 'span',\n listbox: Listbox\n },\n root: rootSlot,\n input: triggerSlot,\n listbox: open ? listbox : undefined,\n expandIcon: slot.optional(props.expandIcon, {\n renderByDefault: true,\n defaultProps: {\n 'aria-expanded': open,\n children: /*#__PURE__*/ React.createElement(ChevronDownIcon, null),\n role: 'button'\n },\n elementType: 'span'\n }),\n ...baseState\n };\n /* handle open/close + focus change when clicking expandIcon */ const { onMouseDown: onIconMouseDown } = state.expandIcon || {};\n const onExpandIconMouseDown = useEventCallback(mergeCallbacks(onIconMouseDown, (event)=>{\n var _triggerRef_current;\n event.preventDefault();\n state.setOpen(event, !state.open);\n (_triggerRef_current = triggerRef.current) === null || _triggerRef_current === void 0 ? void 0 : _triggerRef_current.focus();\n }));\n if (state.expandIcon) {\n state.expandIcon.onMouseDown = onExpandIconMouseDown;\n // If there is no explicit aria-label, calculate default accName attribute for expandIcon button,\n // using the following steps:\n // 1. If there is an aria-label, it is \"Open [aria-label]\"\n // 2. If there is an aria-labelledby, it is \"Open [aria-labelledby target]\" (using aria-labelledby + ids)\n // 3. If there is no aria-label/ledby attr, it falls back to \"Open\"\n // We can't fall back to a label/htmlFor name because of https://github.com/w3c/accname/issues/179\n const hasExpandLabel = state.expandIcon['aria-label'] || state.expandIcon['aria-labelledby'];\n const defaultOpenString = 'Open'; // this is english-only since it is the fallback\n if (!hasExpandLabel) {\n if (props['aria-labelledby']) {\n var _state_expandIcon_id;\n const chevronId = (_state_expandIcon_id = state.expandIcon.id) !== null && _state_expandIcon_id !== void 0 ? _state_expandIcon_id : `${comboId}-chevron`;\n const chevronLabelledBy = `${chevronId} ${state.input['aria-labelledby']}`;\n state.expandIcon['aria-label'] = defaultOpenString;\n state.expandIcon.id = chevronId;\n state.expandIcon['aria-labelledby'] = chevronLabelledBy;\n } else if (props['aria-label']) {\n state.expandIcon['aria-label'] = `${defaultOpenString} ${props['aria-label']}`;\n } else {\n state.expandIcon['aria-label'] = defaultOpenString;\n }\n }\n }\n return state;\n};\n"],"names":["useCombobox_unstable","props","ref","useFieldControlProps_unstable","supportsLabelFor","supportsRequired","supportsSize","baseState","useComboboxBaseState","editable","open","selectOption","setOpen","setValue","value","comboboxPopupRef","comboboxTargetRef","useComboboxPositioning","disabled","freeform","inlinePopup","comboId","useId","primary","triggerNativeProps","root","rootNativeProps","getPartitionedNativeProps","primarySlotTagName","excludedPropNames","ev","option","undefined","newState","triggerRef","React","useRef","listbox","useListboxSlot","state","defaultProps","children","_props_input","triggerSlot","useInputTriggerSlot","input","useMergedRefs","type","rootSlot","slot","always","id","elementType","components","expandIcon","Listbox","optional","renderByDefault","createElement","ChevronDownIcon","role","onMouseDown","onIconMouseDown","onExpandIconMouseDown","useEventCallback","mergeCallbacks","event","_triggerRef_current","preventDefault","current","focus","hasExpandLabel","defaultOpenString","_state_expandIcon_id","chevronId","chevronLabelledBy"],"mappings":";;;;+BAiBiBA;;;eAAAA;;;;iEAjBM;4BACuB;4BACQ;gCACkD;sCACnE;wCACE;yBACf;gCACO;qCACK;AASzB,MAAMA,uBAAuB,CAACC,OAAOC;IAC5C,+CAA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AE;QAClBf,MAAMe,UAAU,CAACO,WAAW,GAAGE;QAC/B,iGAAiG;QACjG,6BAA6B;QAC7B,0DAA0D;QAC1D,yGAAyG;QACzG,mEAAmE;QACnE,kGAAkG;QAClG,MAAMQ,iBAAiBhC,MAAMe,UAAU,CAAC,aAAa,IAAIf,MAAMe,UAAU,CAAC,kBAAkB;QAC5F,MAAMkB,oBAAoB,QAAQ,gDAAgD;QAClF,IAAI,CAACD,gBAAgB;YACjB,IAAItE,KAAK,CAAC,kBAAkB,EAAE;gBAC1B,IAAIwE;gBACJ,MAAMC,YAAY,AAACD,CAAAA,uBAAuBlC,MAAMe,UAAU,CAACH,EAAE,AAAD,MAAO,QAAQsB,yBAAyB,KAAK,IAAIA,uBAAuB,CAAC,EAAEpD,QAAQ,QAAQ,CAAC;gBACxJ,MAAMsD,oBAAoB,CAAC,EAAED,UAAU,CAAC,EAAEnC,MAAMM,KAAK,CAAC,kBAAkB,CAAC,CAAC;gBAC1EN,MAAMe,UAAU,CAAC,aAAa,GAAGkB;gBACjCjC,MAAMe,UAAU,CAACH,EAAE,GAAGuB;gBACtBnC,MAAMe,UAAU,CAAC,kBAAkB,GAAGqB;YAC1C,OAAO,IAAI1E,KAAK,CAAC,aAAa,EAAE;gBAC5BsC,MAAMe,UAAU,CAAC,aAAa,GAAG,CAAC,EAAEkB,kBAAkB,CAAC,EAAEvE,KAAK,CAAC,aAAa,CAAC,CAAC;YAClF,OAAO;gBACHsC,MAAMe,UAAU,CAAC,aAAa,GAAGkB;YACrC;QACJ;IACJ;IACA,OAAOjC;AACX"}
1
+ {"version":3,"sources":["useCombobox.js"],"sourcesContent":["import * as React from 'react';\nimport { useFieldControlProps_unstable } from '@fluentui/react-field';\nimport { ChevronDownRegular as ChevronDownIcon } from '@fluentui/react-icons';\nimport { getPartitionedNativeProps, mergeCallbacks, useEventCallback, useId, useMergedRefs, slot } from '@fluentui/react-utilities';\nimport { useComboboxBaseState } from '../../utils/useComboboxBaseState';\nimport { useComboboxPositioning } from '../../utils/useComboboxPositioning';\nimport { Listbox } from '../Listbox/Listbox';\nimport { useListboxSlot } from '../../utils/useListboxSlot';\nimport { useInputTriggerSlot } from './useInputTriggerSlot';\n/**\n * Create the state required to render Combobox.\n *\n * The returned state can be modified with hooks such as useComboboxStyles_unstable,\n * before being passed to renderCombobox_unstable.\n *\n * @param props - props from this instance of Combobox\n * @param ref - reference to root HTMLElement of Combobox\n */ export const useCombobox_unstable = (props, ref)=>{\n // Merge props from surrounding <Field>, if any\n props = useFieldControlProps_unstable(props, {\n supportsLabelFor: true,\n supportsRequired: true,\n supportsSize: true\n });\n const baseState = useComboboxBaseState({\n ...props,\n editable: true\n });\n const { open, selectOption, setOpen, setValue, value, hasFocus } = baseState;\n const [comboboxPopupRef, comboboxTargetRef] = useComboboxPositioning(props);\n const { disabled, freeform, inlinePopup } = props;\n const comboId = useId('combobox-');\n const { primary: triggerNativeProps, root: rootNativeProps } = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'input',\n excludedPropNames: [\n 'children',\n 'size'\n ]\n });\n // reset any typed value when an option is selected\n baseState.selectOption = (ev, option)=>{\n setValue(undefined);\n selectOption(ev, option);\n };\n baseState.setOpen = (ev, newState)=>{\n if (disabled) {\n return;\n }\n if (!newState && !freeform) {\n setValue(undefined);\n }\n setOpen(ev, newState);\n };\n const triggerRef = React.useRef(null);\n const listbox = useListboxSlot(props.listbox, comboboxPopupRef, {\n state: baseState,\n triggerRef,\n defaultProps: {\n children: props.children\n }\n });\n var _props_input;\n const triggerSlot = useInputTriggerSlot((_props_input = props.input) !== null && _props_input !== void 0 ? _props_input : {}, useMergedRefs(triggerRef, ref), {\n state: baseState,\n freeform,\n defaultProps: {\n type: 'text',\n value: value !== null && value !== void 0 ? value : '',\n ...triggerNativeProps\n }\n });\n const rootSlot = slot.always(props.root, {\n defaultProps: {\n 'aria-owns': !inlinePopup && open ? listbox === null || listbox === void 0 ? void 0 : listbox.id : undefined,\n ...rootNativeProps\n },\n elementType: 'div'\n });\n rootSlot.ref = useMergedRefs(rootSlot.ref, comboboxTargetRef);\n const state = {\n components: {\n root: 'div',\n input: 'input',\n expandIcon: 'span',\n listbox: Listbox\n },\n root: rootSlot,\n input: triggerSlot,\n listbox: open || hasFocus ? listbox : undefined,\n expandIcon: slot.optional(props.expandIcon, {\n renderByDefault: true,\n defaultProps: {\n 'aria-expanded': open,\n children: /*#__PURE__*/ React.createElement(ChevronDownIcon, null),\n role: 'button'\n },\n elementType: 'span'\n }),\n ...baseState\n };\n /* handle open/close + focus change when clicking expandIcon */ const { onMouseDown: onIconMouseDown } = state.expandIcon || {};\n const onExpandIconMouseDown = useEventCallback(mergeCallbacks(onIconMouseDown, (event)=>{\n var _triggerRef_current;\n event.preventDefault();\n state.setOpen(event, !state.open);\n (_triggerRef_current = triggerRef.current) === null || _triggerRef_current === void 0 ? void 0 : _triggerRef_current.focus();\n }));\n if (state.expandIcon) {\n state.expandIcon.onMouseDown = onExpandIconMouseDown;\n // If there is no explicit aria-label, calculate default accName attribute for expandIcon button,\n // using the following steps:\n // 1. If there is an aria-label, it is \"Open [aria-label]\"\n // 2. If there is an aria-labelledby, it is \"Open [aria-labelledby target]\" (using aria-labelledby + ids)\n // 3. If there is no aria-label/ledby attr, it falls back to \"Open\"\n // We can't fall back to a label/htmlFor name because of https://github.com/w3c/accname/issues/179\n const hasExpandLabel = state.expandIcon['aria-label'] || state.expandIcon['aria-labelledby'];\n const defaultOpenString = 'Open'; // this is english-only since it is the fallback\n if (!hasExpandLabel) {\n if (props['aria-labelledby']) {\n var _state_expandIcon_id;\n const chevronId = (_state_expandIcon_id = state.expandIcon.id) !== null && _state_expandIcon_id !== void 0 ? _state_expandIcon_id : `${comboId}-chevron`;\n const chevronLabelledBy = `${chevronId} ${state.input['aria-labelledby']}`;\n state.expandIcon['aria-label'] = defaultOpenString;\n state.expandIcon.id = chevronId;\n state.expandIcon['aria-labelledby'] = chevronLabelledBy;\n } else if (props['aria-label']) {\n state.expandIcon['aria-label'] = `${defaultOpenString} ${props['aria-label']}`;\n } else {\n state.expandIcon['aria-label'] = defaultOpenString;\n }\n }\n }\n return state;\n};\n"],"names":["useCombobox_unstable","props","ref","useFieldControlProps_unstable","supportsLabelFor","supportsRequired","supportsSize","baseState","useComboboxBaseState","editable","open","selectOption","setOpen","setValue","value","hasFocus","comboboxPopupRef","comboboxTargetRef","useComboboxPositioning","disabled","freeform","inlinePopup","comboId","useId","primary","triggerNativeProps","root","rootNativeProps","getPartitionedNativeProps","primarySlotTagName","excludedPropNames","ev","option","undefined","newState","triggerRef","React","useRef","listbox","useListboxSlot","state","defaultProps","children","_props_input","triggerSlot","useInputTriggerSlot","input","useMergedRefs","type","rootSlot","slot","always","id","elementType","components","expandIcon","Listbox","optional","renderByDefault","createElement","ChevronDownIcon","role","onMouseDown","onIconMouseDown","onExpandIconMouseDown","useEventCallback","mergeCallbacks","event","_triggerRef_current","preventDefault","current","focus","hasExpandLabel","defaultOpenString","_state_expandIcon_id","chevronId","chevronLabelledBy"],"mappings":";;;;+BAiBiBA;;;eAAAA;;;;iEAjBM;4BACuB;4BACQ;gCACkD;sCACnE;wCACE;yBACf;gCACO;qCACK;AASzB,MAAMA,uBAAuB,CAACC,OAAOC;IAC5C,+CAA+C;IAC/CD,QAAQE,IAAAA,yCAA6B,EAACF,OAAO;QACzCG,kBAAkB;QAClBC,kBAAkB;QAClBC,cAAc;IAClB;IACA,MAAMC,YAAYC,IAAAA,0CAAoB,EAAC;QACnC,GAAGP,KAAK;QACRQ,UAAU;IACd;IACA,MAAM,EAAEC,IAAI,EAAEC,YAAY,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGR;IACnE,MAAM,CAACS,kBAAkBC,kBAAkB,GAAGC,IAAAA,8CAAsB,EAACjB;IACrE,MAAM,EAAEkB,QAAQ,EAAEC,QAAQ,EAAEC,WAAW,EAAE,GAAGpB;IAC5C,MAAMqB,UAAUC,IAAAA,qBAAK,EAAC;IACtB,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K,IAAIA,uBAAuB,CAAC,EAAEpD,QAAQ,QAAQ,CAAC;gBACxJ,MAAMsD,oBAAoB,CAAC,EAAED,UAAU,CAAC,EAAEnC,MAAMM,KAAK,CAAC,kBAAkB,CAAC,CAAC;gBAC1EN,MAAMe,UAAU,CAAC,aAAa,GAAGkB;gBACjCjC,MAAMe,UAAU,CAACH,EAAE,GAAGuB;gBACtBnC,MAAMe,UAAU,CAAC,kBAAkB,GAAGqB;YAC1C,OAAO,IAAI3E,KAAK,CAAC,aAAa,EAAE;gBAC5BuC,MAAMe,UAAU,CAAC,aAAa,GAAG,CAAC,EAAEkB,kBAAkB,CAAC,EAAExE,KAAK,CAAC,aAAa,CAAC,CAAC;YAClF,OAAO;gBACHuC,MAAMe,UAAU,CAAC,aAAa,GAAGkB;YACrC;QACJ;IACJ;IACA,OAAOjC;AACX"}
@@ -25,7 +25,7 @@ const useDropdown_unstable = (props, ref)=>{
25
25
  supportsSize: true
26
26
  });
27
27
  const baseState = (0, _useComboboxBaseState.useComboboxBaseState)(props);
28
- const { open } = baseState;
28
+ const { open, hasFocus } = baseState;
29
29
  const { primary: triggerNativeProps, root: rootNativeProps } = (0, _reactutilities.getPartitionedNativeProps)({
30
30
  props,
31
31
  primarySlotTagName: 'button',
@@ -70,7 +70,7 @@ const useDropdown_unstable = (props, ref)=>{
70
70
  },
71
71
  root: rootSlot,
72
72
  button: trigger,
73
- listbox: open ? listbox : undefined,
73
+ listbox: open || hasFocus ? listbox : undefined,
74
74
  expandIcon: _reactutilities.slot.optional(props.expandIcon, {
75
75
  renderByDefault: true,
76
76
  defaultProps: {
@@ -1 +1 @@
1
- {"version":3,"sources":["useDropdown.js"],"sourcesContent":["import * as React from 'react';\nimport { useFieldControlProps_unstable } from '@fluentui/react-field';\nimport { ChevronDownRegular as ChevronDownIcon } from '@fluentui/react-icons';\nimport { getPartitionedNativeProps, useMergedRefs, slot } from '@fluentui/react-utilities';\nimport { useComboboxBaseState } from '../../utils/useComboboxBaseState';\nimport { useComboboxPositioning } from '../../utils/useComboboxPositioning';\nimport { Listbox } from '../Listbox/Listbox';\nimport { useListboxSlot } from '../../utils/useListboxSlot';\nimport { useButtonTriggerSlot } from './useButtonTriggerSlot';\n/**\n * Create the state required to render Dropdown.\n *\n * The returned state can be modified with hooks such as useDropdownStyles_unstable,\n * before being passed to renderDropdown_unstable.\n *\n * @param props - props from this instance of Dropdown\n * @param ref - reference to root HTMLElement of Dropdown\n */ export const useDropdown_unstable = (props, ref)=>{\n // Merge props from surrounding <Field>, if any\n props = useFieldControlProps_unstable(props, {\n supportsLabelFor: true,\n supportsSize: true\n });\n const baseState = useComboboxBaseState(props);\n const { open } = baseState;\n const { primary: triggerNativeProps, root: rootNativeProps } = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'button',\n excludedPropNames: [\n 'children'\n ]\n });\n const [comboboxPopupRef, comboboxTargetRef] = useComboboxPositioning(props);\n const triggerRef = React.useRef(null);\n const listbox = useListboxSlot(props.listbox, comboboxPopupRef, {\n state: baseState,\n triggerRef,\n defaultProps: {\n children: props.children\n }\n });\n var _props_button;\n const trigger = useButtonTriggerSlot((_props_button = props.button) !== null && _props_button !== void 0 ? _props_button : {}, useMergedRefs(triggerRef, ref), {\n state: baseState,\n defaultProps: {\n type: 'button',\n tabIndex: 0,\n children: baseState.value || props.placeholder,\n ...triggerNativeProps\n }\n });\n const rootSlot = slot.always(props.root, {\n defaultProps: {\n 'aria-owns': !props.inlinePopup && open ? listbox === null || listbox === void 0 ? void 0 : listbox.id : undefined,\n children: props.children,\n ...rootNativeProps\n },\n elementType: 'div'\n });\n rootSlot.ref = useMergedRefs(rootSlot.ref, comboboxTargetRef);\n const state = {\n components: {\n root: 'div',\n button: 'button',\n expandIcon: 'span',\n listbox: Listbox\n },\n root: rootSlot,\n button: trigger,\n listbox: open ? listbox : undefined,\n expandIcon: slot.optional(props.expandIcon, {\n renderByDefault: true,\n defaultProps: {\n children: /*#__PURE__*/ React.createElement(ChevronDownIcon, null)\n },\n elementType: 'span'\n }),\n placeholderVisible: !baseState.value && !!props.placeholder,\n ...baseState\n };\n return state;\n};\n"],"names":["useDropdown_unstable","props","ref","useFieldControlProps_unstable","supportsLabelFor","supportsSize","baseState","useComboboxBaseState","open","primary","triggerNativeProps","root","rootNativeProps","getPartitionedNativeProps","primarySlotTagName","excludedPropNames","comboboxPopupRef","comboboxTargetRef","useComboboxPositioning","triggerRef","React","useRef","listbox","useListboxSlot","state","defaultProps","children","_props_button","trigger","useButtonTriggerSlot","button","useMergedRefs","type","tabIndex","value","placeholder","rootSlot","slot","always","inlinePopup","id","undefined","elementType","components","expandIcon","Listbox","optional","renderByDefault","createElement","ChevronDownIcon","placeholderVisible"],"mappings":";;;;+BAiBiBA;;;eAAAA;;;;iEAjBM;4BACuB;4BACQ;gCACS;sCAC1B;wCACE;yBACf;gCACO;sCACM;AAS1B,MAAMA,uBAAuB,CAACC,OAAOC;IAC5C,+CAA+C;IAC/CD,QAAQE,IAAAA,yCAA6B,EAACF,OAAO;QACzCG,kBAAkB;QAClBC,cAAc;IAClB;IACA,MAAMC,YAAYC,IAAAA,0CAAoB,EAACN;IACvC,MAAM,EAAEO,IAAI,EAAE,GAAGF;IACjB,MAAM,EAAEG,SAASC,kBAAkB,EAAEC,MAAMC,eAAe,EAAE,GAAGC,IAAAA,yCAAyB,EAAC;QACrFZ;QACAa,oBAAoB;QACpBC,mBAAmB;YACf;SACH;IACL;IACA,MAAM,CAACC,kBAAkBC,kBAAkB,GAAGC,IAAAA,8CAAsB,EAACjB;IACrE,MAAMkB,aAAaC,OAAMC,MAAM,CAAC;IAChC,MAAMC,UAAUC,IAAAA,8BAAc,EAACtB,MAAMqB,OAAO,EAAEN,kBAAkB;QAC5DQ,OAAOlB;QACPa;QACAM,cAAc;YACVC,UAAUzB,MAAMyB,QAAQ;QAC5B;IACJ;IACA,IAAIC;IACJ,MAAMC,UAAUC,IAAAA,0CAAoB,EAAC,AAACF,CAAAA,gBAAgB1B,MAAM6B,MAAM,AAAD,MAAO,QAAQH,kBAAkB,KAAK,IAAIA,gBAAgB,CAAC,GAAGI,IAAAA,6BAAa,EAACZ,YAAYjB,MAAM;QAC3JsB,OAAOlB;QACPmB,cAAc;YACVO,MAAM;YACNC,UAAU;YACVP,UAAUpB,UAAU4B,KAAK,IAAIjC,MAAMkC,WAAW;YAC9C,GAAGzB,kBAAkB;QACzB;IACJ;IACA,MAAM0B,WAAWC,oBAAI,CAACC,MAAM,CAACrC,MAAMU,IAAI,EAAE;QACrCc,cAAc;YACV,aAAa,CAACxB,MAAMsC,WAAW,IAAI/B,OAAOc,YAAY,QAAQA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQkB,EAAE,GAAGC;YACzGf,UAAUzB,MAAMyB,QAAQ;YACxB,GAAGd,eAAe;QACtB;QACA8B,aAAa;IACjB;IACAN,SAASlC,GAAG,GAAG6B,IAAAA,6BAAa,EAACK,SAASlC,GAAG,EAAEe;IAC3C,MAAMO,QAAQ;QACVmB,YAAY;YACRhC,MAAM;YACNmB,QAAQ;YACRc,YAAY;YACZtB,SAASuB,gBAAO;QACpB;QACAlC,MAAMyB;QACNN,QAAQF;QACRN,SAASd,OAAOc,UAAUmB;QAC1BG,YAAYP,oBAAI,CAACS,QAAQ,CAAC7C,MAAM2C,UAAU,EAAE;YACxCG,iBAAiB;YACjBtB,cAAc;gBACVC,UAAU,WAAW,GAAGN,OAAM4B,aAAa,CAACC,8BAAe,EAAE;YACjE;YACAP,aAAa;QACjB;QACAQ,oBAAoB,CAAC5C,UAAU4B,KAAK,IAAI,CAAC,CAACjC,MAAMkC,WAAW;QAC3D,GAAG7B,SAAS;IAChB;IACA,OAAOkB;AACX"}
1
+ {"version":3,"sources":["useDropdown.js"],"sourcesContent":["import * as React from 'react';\nimport { useFieldControlProps_unstable } from '@fluentui/react-field';\nimport { ChevronDownRegular as ChevronDownIcon } from '@fluentui/react-icons';\nimport { getPartitionedNativeProps, useMergedRefs, slot } from '@fluentui/react-utilities';\nimport { useComboboxBaseState } from '../../utils/useComboboxBaseState';\nimport { useComboboxPositioning } from '../../utils/useComboboxPositioning';\nimport { Listbox } from '../Listbox/Listbox';\nimport { useListboxSlot } from '../../utils/useListboxSlot';\nimport { useButtonTriggerSlot } from './useButtonTriggerSlot';\n/**\n * Create the state required to render Dropdown.\n *\n * The returned state can be modified with hooks such as useDropdownStyles_unstable,\n * before being passed to renderDropdown_unstable.\n *\n * @param props - props from this instance of Dropdown\n * @param ref - reference to root HTMLElement of Dropdown\n */ export const useDropdown_unstable = (props, ref)=>{\n // Merge props from surrounding <Field>, if any\n props = useFieldControlProps_unstable(props, {\n supportsLabelFor: true,\n supportsSize: true\n });\n const baseState = useComboboxBaseState(props);\n const { open, hasFocus } = baseState;\n const { primary: triggerNativeProps, root: rootNativeProps } = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'button',\n excludedPropNames: [\n 'children'\n ]\n });\n const [comboboxPopupRef, comboboxTargetRef] = useComboboxPositioning(props);\n const triggerRef = React.useRef(null);\n const listbox = useListboxSlot(props.listbox, comboboxPopupRef, {\n state: baseState,\n triggerRef,\n defaultProps: {\n children: props.children\n }\n });\n var _props_button;\n const trigger = useButtonTriggerSlot((_props_button = props.button) !== null && _props_button !== void 0 ? _props_button : {}, useMergedRefs(triggerRef, ref), {\n state: baseState,\n defaultProps: {\n type: 'button',\n tabIndex: 0,\n children: baseState.value || props.placeholder,\n ...triggerNativeProps\n }\n });\n const rootSlot = slot.always(props.root, {\n defaultProps: {\n 'aria-owns': !props.inlinePopup && open ? listbox === null || listbox === void 0 ? void 0 : listbox.id : undefined,\n children: props.children,\n ...rootNativeProps\n },\n elementType: 'div'\n });\n rootSlot.ref = useMergedRefs(rootSlot.ref, comboboxTargetRef);\n const state = {\n components: {\n root: 'div',\n button: 'button',\n expandIcon: 'span',\n listbox: Listbox\n },\n root: rootSlot,\n button: trigger,\n listbox: open || hasFocus ? listbox : undefined,\n expandIcon: slot.optional(props.expandIcon, {\n renderByDefault: true,\n defaultProps: {\n children: /*#__PURE__*/ React.createElement(ChevronDownIcon, null)\n },\n elementType: 'span'\n }),\n placeholderVisible: !baseState.value && !!props.placeholder,\n ...baseState\n };\n return state;\n};\n"],"names":["useDropdown_unstable","props","ref","useFieldControlProps_unstable","supportsLabelFor","supportsSize","baseState","useComboboxBaseState","open","hasFocus","primary","triggerNativeProps","root","rootNativeProps","getPartitionedNativeProps","primarySlotTagName","excludedPropNames","comboboxPopupRef","comboboxTargetRef","useComboboxPositioning","triggerRef","React","useRef","listbox","useListboxSlot","state","defaultProps","children","_props_button","trigger","useButtonTriggerSlot","button","useMergedRefs","type","tabIndex","value","placeholder","rootSlot","slot","always","inlinePopup","id","undefined","elementType","components","expandIcon","Listbox","optional","renderByDefault","createElement","ChevronDownIcon","placeholderVisible"],"mappings":";;;;+BAiBiBA;;;eAAAA;;;;iEAjBM;4BACuB;4BACQ;gCACS;sCAC1B;wCACE;yBACf;gCACO;sCACM;AAS1B,MAAMA,uBAAuB,CAACC,OAAOC;IAC5C,+CAA+C;IAC/CD,QAAQE,IAAAA,yCAA6B,EAACF,OAAO;QACzCG,kBAAkB;QAClBC,cAAc;IAClB;IACA,MAAMC,YAAYC,IAAAA,0CAAoB,EAACN;IACvC,MAAM,EAAEO,IAAI,EAAEC,QAAQ,EAAE,GAAGH;IAC3B,MAAM,EAAEI,SAASC,kBAAkB,EAAEC,MAAMC,eAAe,EAAE,GAAGC,IAAAA,yCAAyB,EAAC;QACrFb;QACAc,oBAAoB;QACpBC,mBAAmB;YACf;SACH;IACL;IACA,MAAM,CAACC,kBAAkBC,kBAAkB,GAAGC,IAAAA,8CAAsB,EAAClB;IACrE,MAAMmB,aAAaC,OAAMC,MAAM,CAAC;IAChC,MAAMC,UAAUC,IAAAA,8BAAc,EAACvB,MAAMsB,OAAO,EAAEN,kBAAkB;QAC5DQ,OAAOnB;QACPc;QACAM,cAAc;YACVC,UAAU1B,MAAM0B,QAAQ;QAC5B;IACJ;IACA,IAAIC;IACJ,MAAMC,UAAU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9c: "feu1g3u",
65
+ zqbkvg: "fo79ri9",
66
+ h82x05: [
67
+ "f1osiabc",
68
+ "f1e8le25"
69
+ ],
70
+ cqj998: "f1yusjty",
71
+ j3hlsh: [
72
+ "f1e8le25",
73
+ "f1osiabc"
74
+ ],
75
+ ecr2s2: "fb40n2d",
76
+ lj723h: "f1g4hkjv",
77
+ Btxx2vb: "f1lnr2zp",
78
+ sltcwy: [
79
+ "f1ogfk9z",
80
+ "f1g7j8ec"
81
+ ],
82
+ dnwvvm: "fiuf46r",
83
+ Blyvkvs: [
84
+ "f1g7j8ec",
85
+ "f1ogfk9z"
86
+ ]
65
87
  },
66
88
  active: {
67
89
  Bsft5z2: "f13zj6fq",
@@ -128,7 +150,29 @@ const optionClassNames = {
128
150
  disabled: {
129
151
  sj55zd: "f1s2aq7o",
130
152
  Jwef8y: "f9ql6rf",
153
+ Bi91k9c: "fvgxktp",
154
+ zqbkvg: "f185j3qj",
155
+ h82x05: [
156
+ "f1dligi3",
157
+ "f1vydzie"
158
+ ],
159
+ cqj998: "fjw1di3",
160
+ j3hlsh: [
161
+ "f1vydzie",
162
+ "f1dligi3"
163
+ ],
131
164
  ecr2s2: "fgj9um3",
165
+ lj723h: "f19wldhg",
166
+ Btxx2vb: "f1ss0kt2",
167
+ sltcwy: [
168
+ "f1t6oli3",
169
+ "fjy9ci8"
170
+ ],
171
+ dnwvvm: "fresaxk",
172
+ Blyvkvs: [
173
+ "fjy9ci8",
174
+ "f1t6oli3"
175
+ ],
132
176
  Bbusuzp: "f1dcs8yz"
133
177
  },
134
178
  selected: {},
@@ -222,6 +266,18 @@ const optionClassNames = {
222
266
  checkDisabled: {
223
267
  sj55zd: "f1s2aq7o",
224
268
  Bbusuzp: "f1dcs8yz"
269
+ },
270
+ multiselectCheckDisabled: {
271
+ g2u3we: "f1r1t4y1",
272
+ h3c5rm: [
273
+ "fmj8ijw",
274
+ "figx54m"
275
+ ],
276
+ B9xav0g: "f360ss8",
277
+ zhjwy3: [
278
+ "figx54m",
279
+ "fmj8ijw"
280
+ ]
225
281
  }
226
282
  }, {
227
283
  d: [
@@ -302,15 +358,39 @@ const optionClassNames = {
302
358
  ".f3xi7mh{border-top-color:var(--colorCompoundBrandBackground);}",
303
359
  ".ftovhe4{border-right-color:var(--colorCompoundBrandBackground);}",
304
360
  ".f1wczvin{border-left-color:var(--colorCompoundBrandBackground);}",
305
- ".f68vbr6{border-bottom-color:var(--colorCompoundBrandBackground);}"
361
+ ".f68vbr6{border-bottom-color:var(--colorCompoundBrandBackground);}",
362
+ ".f1r1t4y1{border-top-color:var(--colorNeutralForegroundDisabled);}",
363
+ ".fmj8ijw{border-right-color:var(--colorNeutralForegroundDisabled);}",
364
+ ".figx54m{border-left-color:var(--colorNeutralForegroundDisabled);}",
365
+ ".f360ss8{border-bottom-color:var(--colorNeutralForegroundDisabled);}"
306
366
  ],
307
367
  h: [
308
368
  ".f1knas48:hover{background-color:var(--colorNeutralBackground1Hover);}",
309
- ".f9ql6rf:hover{background-color:var(--colorTransparentBackground);}"
369
+ ".feu1g3u:hover{color:var(--colorNeutralForeground1Hover);}",
370
+ ".fo79ri9:hover .fui-Option__checkIcon{border-top-color:var(--colorNeutralForeground1Hover);}",
371
+ ".f1osiabc:hover .fui-Option__checkIcon{border-right-color:var(--colorNeutralForeground1Hover);}",
372
+ ".f1e8le25:hover .fui-Option__checkIcon{border-left-color:var(--colorNeutralForeground1Hover);}",
373
+ ".f1yusjty:hover .fui-Option__checkIcon{border-bottom-color:var(--colorNeutralForeground1Hover);}",
374
+ ".f9ql6rf:hover{background-color:var(--colorTransparentBackground);}",
375
+ ".fvgxktp:hover{color:var(--colorNeutralForegroundDisabled);}",
376
+ ".f185j3qj:hover .fui-Option__checkIcon{border-top-color:var(--colorNeutralForegroundDisabled);}",
377
+ ".f1dligi3:hover .fui-Option__checkIcon{border-right-color:var(--colorNeutralForegroundDisabled);}",
378
+ ".f1vydzie:hover .fui-Option__checkIcon{border-left-color:var(--colorNeutralForegroundDisabled);}",
379
+ ".fjw1di3:hover .fui-Option__checkIcon{border-bottom-color:var(--colorNeutralForegroundDisabled);}"
310
380
  ],
311
381
  a: [
312
382
  ".fb40n2d:active{background-color:var(--colorNeutralBackground1Pressed);}",
313
- ".fgj9um3:active{background-color:var(--colorTransparentBackground);}"
383
+ ".f1g4hkjv:active{color:var(--colorNeutralForeground1Pressed);}",
384
+ ".f1lnr2zp:active .fui-Option__checkIcon{border-top-color:var(--colorNeutralForeground1Hover);}",
385
+ ".f1ogfk9z:active .fui-Option__checkIcon{border-right-color:var(--colorNeutralForeground1Hover);}",
386
+ ".f1g7j8ec:active .fui-Option__checkIcon{border-left-color:var(--colorNeutralForeground1Hover);}",
387
+ ".fiuf46r:active .fui-Option__checkIcon{border-bottom-color:var(--colorNeutralForeground1Hover);}",
388
+ ".fgj9um3:active{background-color:var(--colorTransparentBackground);}",
389
+ ".f19wldhg:active{color:var(--colorNeutralForegroundDisabled);}",
390
+ ".f1ss0kt2:active .fui-Option__checkIcon{border-top-color:var(--colorNeutralForegroundDisabled);}",
391
+ ".f1t6oli3:active .fui-Option__checkIcon{border-right-color:var(--colorNeutralForegroundDisabled);}",
392
+ ".fjy9ci8:active .fui-Option__checkIcon{border-left-color:var(--colorNeutralForegroundDisabled);}",
393
+ ".fresaxk:active .fui-Option__checkIcon{border-bottom-color:var(--colorNeutralForegroundDisabled);}"
314
394
  ],
315
395
  m: [
316
396
  [
@@ -326,7 +406,7 @@ const useOptionStyles_unstable = (state)=>{
326
406
  const styles = useStyles();
327
407
  state.root.className = (0, _react.mergeClasses)(optionClassNames.root, styles.root, active && focusVisible && styles.active, disabled && styles.disabled, selected && styles.selected, state.root.className);
328
408
  if (state.checkIcon) {
329
- state.checkIcon.className = (0, _react.mergeClasses)(optionClassNames.checkIcon, styles.checkIcon, multiselect && styles.multiselectCheck, selected && styles.selectedCheck, selected && multiselect && styles.selectedMultiselectCheck, disabled && styles.checkDisabled, state.checkIcon.className);
409
+ state.checkIcon.className = (0, _react.mergeClasses)(optionClassNames.checkIcon, styles.checkIcon, multiselect && styles.multiselectCheck, selected && styles.selectedCheck, selected && multiselect && styles.selectedMultiselectCheck, disabled && styles.checkDisabled, disabled && multiselect && styles.multiselectCheckDisabled, state.checkIcon.className);
330
410
  }
331
411
  return state;
332
412
  }; //# sourceMappingURL=useOptionStyles.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["useOptionStyles.styles.js"],"sourcesContent":["import { tokens } from '@fluentui/react-theme';\nimport { __styles, mergeClasses, shorthands } from '@griffel/react';\nexport const optionClassNames = {\n root: 'fui-Option',\n checkIcon: 'fui-Option__checkIcon'\n};\n/**\n * Styles for the root slot\n */\nconst useStyles = /*#__PURE__*/__styles({\n root: {\n Bt984gj: \"f122n59\",\n Bbmb7ep: [\"f1aa9q02\", \"f16jpd5f\"],\n Beyfa6y: [\"f16jpd5f\", \"f1aa9q02\"],\n B7oj6ja: [\"f1jar5jt\", \"fyu767a\"],\n Btl43ni: [\"fyu767a\", \"f1jar5jt\"],\n sj55zd: \"f19n0e5\",\n i8kkvl: \"f1ufnopg\",\n Bceei9c: \"f1k6fduh\",\n mc9l5x: \"f22iagw\",\n Bahqtrf: \"fk6fouc\",\n Be2twd7: \"fkhj508\",\n Bg96gwp: \"f1i3iumi\",\n z8tnut: \"fp2oml8\",\n z189sj: [\"f1vdfbxk\", \"f1f5gg8d\"],\n Byoj8tv: \"f1tdddsa\",\n uwmqm3: [\"f1f5gg8d\", \"f1vdfbxk\"],\n qhf8xq: \"f10pi13n\",\n Jwef8y: \"f1knas48\",\n ecr2s2: \"fb40n2d\"\n },\n active: {\n Bsft5z2: \"f13zj6fq\",\n E3zdtr: \"f1mdlcz9\",\n B80jsxd: \"f1nwj1ja\",\n t2ki1e: \"ffmd2fr\",\n Bm2nyyq: \"f8rth92\",\n Barhvk9: [\"flthirb\", \"ftkbnf5\"],\n Bw17bha: \"f1lh990p\",\n vfts7: [\"ftkbnf5\", \"flthirb\"],\n xrcqlc: \"fc9v8v1\",\n Ihftqj: [\"f1mwfetb\", \"f18mat8f\"],\n Bcgy8vk: \"f1cb6c3\",\n Bhxzhr1: [\"f18mat8f\", \"f1mwfetb\"],\n B3778ie: [\"f1ibwz09\", \"f1kp91vd\"],\n d9w3h3: [\"f1kp91vd\", \"f1ibwz09\"],\n Bl18szs: [\"f1pix4dl\", \"f13nd1z4\"],\n B4j8arr: [\"f13nd1z4\", \"f1pix4dl\"],\n B0n5ga8: \"f1qw5sz7\",\n s924m2: [\"f19va7ni\", \"f1a9v3mw\"],\n B1q35kw: \"fkkziue\",\n Gp14am: [\"f1a9v3mw\", \"f19va7ni\"],\n bn5sak: \"f1a97anr\",\n By385i5: \"f5226zp\",\n Eqx8gd: [\"fa2bdqt\", \"fei6g0k\"],\n B1piin3: [\"fei6g0k\", \"fa2bdqt\"]\n },\n disabled: {\n sj55zd: \"f1s2aq7o\",\n Jwef8y: \"f9ql6rf\",\n ecr2s2: \"fgj9um3\",\n Bbusuzp: \"f1dcs8yz\"\n },\n selected: {},\n checkIcon: {\n Be2twd7: \"fod5ikn\",\n Frg6f3: [\"f18b9hdq\", \"fn6qj8t\"],\n t21cq0: [\"f1xk557c\", \"f1h9en5y\"],\n Bcdw1i0: \"fd7fpy0\",\n Bo70h7d: \"fvc9v3g\"\n },\n selectedCheck: {\n Bcdw1i0: \"f1022m68\"\n },\n multiselectCheck: {\n B4j52fo: \"f192inf7\",\n Bekrc4i: [\"f5tn483\", \"f1ojsxk5\"],\n Bn0qgzm: \"f1vxd6vx\",\n ibv6hh: [\"f1ojsxk5\", \"f5tn483\"],\n icvyot: \"fzkkow9\",\n vrafjx: [\"fcdblym\", \"fjik90z\"],\n oivjwe: \"fg706s2\",\n wvpqe5: [\"fjik90z\", \"fcdblym\"],\n g2u3we: \"fq0vr37\",\n h3c5rm: [\"f1byw159\", \"f11cr0be\"],\n B9xav0g: \"f1c1zstj\",\n zhjwy3: [\"f11cr0be\", \"f1byw159\"],\n Bbmb7ep: [\"f1g3puop\", \"fi2rrw2\"],\n Beyfa6y: [\"fi2rrw2\", \"f1g3puop\"],\n B7oj6ja: [\"f1rstyi9\", \"f1s4nn1u\"],\n Btl43ni: [\"f1s4nn1u\", \"f1rstyi9\"],\n B7ck84d: \"f1ewtqcl\",\n mc9l5x: \"f22iagw\",\n Bt984gj: \"f122n59\",\n Brf1p80: \"f4d9j23\",\n Bkfmm31: \"f1w9h62z\",\n Be2twd7: \"f1ugzwwg\",\n Bqenvij: \"fd461yt\",\n a9b677: \"fjw5fx7\",\n Bcdw1i0: \"f1022m68\"\n },\n selectedMultiselectCheck: {\n De3pzq: \"ftywsgz\",\n sj55zd: \"fqpbvvt\",\n g2u3we: \"f3xi7mh\",\n h3c5rm: [\"ftovhe4\", \"f1wczvin\"],\n B9xav0g: \"f68vbr6\",\n zhjwy3: [\"f1wczvin\", \"ftovhe4\"]\n },\n checkDisabled: {\n sj55zd: \"f1s2aq7o\",\n Bbusuzp: \"f1dcs8yz\"\n }\n}, {\n d: [\".f122n59{align-items:center;}\", \".f1aa9q02{border-bottom-right-radius:var(--borderRadiusMedium);}\", \".f16jpd5f{border-bottom-left-radius:var(--borderRadiusMedium);}\", \".f1jar5jt{border-top-right-radius:var(--borderRadiusMedium);}\", \".fyu767a{border-top-left-radius:var(--borderRadiusMedium);}\", \".f19n0e5{color:var(--colorNeutralForeground1);}\", \".f1ufnopg{column-gap:var(--spacingHorizontalXS);}\", \".f1k6fduh{cursor:pointer;}\", \".f22iagw{display:flex;}\", \".fk6fouc{font-family:var(--fontFamilyBase);}\", \".fkhj508{font-size:var(--fontSizeBase300);}\", \".f1i3iumi{line-height:var(--lineHeightBase300);}\", \".fp2oml8{padding-top:var(--spacingVerticalSNudge);}\", \".f1vdfbxk{padding-right:var(--spacingHorizontalS);}\", \".f1f5gg8d{padding-left:var(--spacingHorizontalS);}\", \".f1tdddsa{padding-bottom:var(--spacingVerticalSNudge);}\", \".f10pi13n{position:relative;}\", \".f13zj6fq::after{content:\\\"\\\";}\", \".f1mdlcz9::after{position:absolute;}\", \".f1nwj1ja::after{pointer-events:none;}\", \".ffmd2fr::after{z-index:1;}\", \".f8rth92::after{border-top-style:solid;}\", \".flthirb::after{border-right-style:solid;}\", \".ftkbnf5::after{border-left-style:solid;}\", \".f1lh990p::after{border-bottom-style:solid;}\", \".fc9v8v1::after{border-top-width:2px;}\", \".f1mwfetb::after{border-right-width:2px;}\", \".f18mat8f::after{border-left-width:2px;}\", \".f1cb6c3::after{border-bottom-width:2px;}\", \".f1ibwz09::after{border-bottom-right-radius:var(--borderRadiusMedium);}\", \".f1kp91vd::after{border-bottom-left-radius:var(--borderRadiusMedium);}\", \".f1pix4dl::after{border-top-right-radius:var(--borderRadiusMedium);}\", \".f13nd1z4::after{border-top-left-radius:var(--borderRadiusMedium);}\", \".f1qw5sz7::after{border-top-color:var(--colorStrokeFocus2);}\", \".f19va7ni::after{border-right-color:var(--colorStrokeFocus2);}\", \".f1a9v3mw::after{border-left-color:var(--colorStrokeFocus2);}\", \".fkkziue::after{border-bottom-color:var(--colorStrokeFocus2);}\", \".f1a97anr::after{top:-2px;}\", \".f5226zp::after{bottom:-2px;}\", \".fa2bdqt::after{left:-2px;}\", \".fei6g0k::after{right:-2px;}\", \".f1s2aq7o{color:var(--colorNeutralForegroundDisabled);}\", \".fod5ikn{font-size:var(--fontSizeBase400);}\", \".f18b9hdq{margin-left:calc(var(--spacingHorizontalXXS) * -1);}\", \".fn6qj8t{margin-right:calc(var(--spacingHorizontalXXS) * -1);}\", \".f1xk557c{margin-right:var(--spacingHorizontalXXS);}\", \".f1h9en5y{margin-left:var(--spacingHorizontalXXS);}\", \".fd7fpy0{visibility:hidden;}\", \".fvc9v3g svg{display:block;}\", \".f1022m68{visibility:visible;}\", \".f192inf7{border-top-width:var(--strokeWidthThin);}\", \".f5tn483{border-right-width:var(--strokeWidthThin);}\", \".f1ojsxk5{border-left-width:var(--strokeWidthThin);}\", \".f1vxd6vx{border-bottom-width:var(--strokeWidthThin);}\", \".fzkkow9{border-top-style:solid;}\", \".fcdblym{border-right-style:solid;}\", \".fjik90z{border-left-style:solid;}\", \".fg706s2{border-bottom-style:solid;}\", \".fq0vr37{border-top-color:var(--colorNeutralStrokeAccessible);}\", \".f1byw159{border-right-color:var(--colorNeutralStrokeAccessible);}\", \".f11cr0be{border-left-color:var(--colorNeutralStrokeAccessible);}\", \".f1c1zstj{border-bottom-color:var(--colorNeutralStrokeAccessible);}\", \".f1g3puop{border-bottom-right-radius:var(--borderRadiusSmall);}\", \".fi2rrw2{border-bottom-left-radius:var(--borderRadiusSmall);}\", \".f1rstyi9{border-top-right-radius:var(--borderRadiusSmall);}\", \".f1s4nn1u{border-top-left-radius:var(--borderRadiusSmall);}\", \".f1ewtqcl{box-sizing:border-box;}\", \".f4d9j23{justify-content:center;}\", \".f1w9h62z{fill:currentColor;}\", \".f1ugzwwg{font-size:12px;}\", \".fd461yt{height:16px;}\", \".fjw5fx7{width:16px;}\", \".ftywsgz{background-color:var(--colorCompoundBrandBackground);}\", \".fqpbvvt{color:var(--colorNeutralForegroundInverted);}\", \".f3xi7mh{border-top-color:var(--colorCompoundBrandBackground);}\", \".ftovhe4{border-right-color:var(--colorCompoundBrandBackground);}\", \".f1wczvin{border-left-color:var(--colorCompoundBrandBackground);}\", \".f68vbr6{border-bottom-color:var(--colorCompoundBrandBackground);}\"],\n h: [\".f1knas48:hover{background-color:var(--colorNeutralBackground1Hover);}\", \".f9ql6rf:hover{background-color:var(--colorTransparentBackground);}\"],\n a: [\".fb40n2d:active{background-color:var(--colorNeutralBackground1Pressed);}\", \".fgj9um3:active{background-color:var(--colorTransparentBackground);}\"],\n m: [[\"@media (forced-colors: active){.f1dcs8yz{color:GrayText;}}\", {\n m: \"(forced-colors: active)\"\n }]]\n});\n/**\n * Apply styling to the Option slots based on the state\n */\nexport const useOptionStyles_unstable = state => {\n const {\n active,\n disabled,\n focusVisible,\n multiselect,\n selected\n } = state;\n const styles = useStyles();\n state.root.className = mergeClasses(optionClassNames.root, styles.root, active && focusVisible && styles.active, disabled && styles.disabled, selected && styles.selected, state.root.className);\n if (state.checkIcon) {\n state.checkIcon.className = mergeClasses(optionClassNames.checkIcon, styles.checkIcon, multiselect && styles.multiselectCheck, selected && styles.selectedCheck, selected && multiselect && styles.selectedMultiselectCheck, disabled && styles.checkDisabled, state.checkIcon.className);\n }\n return state;\n};\n//# sourceMappingURL=useOptionStyles.styles.js.map"],"names":["optionClassNames","useOptionStyles_unstable","root","checkIcon","useStyles","__styles","Bt984gj","Bbmb7ep","Beyfa6y","B7oj6ja","Btl43ni","sj55zd","i8kkvl","Bceei9c","mc9l5x","Bahqtrf","Be2twd7","Bg96gwp","z8tnut","z189sj","Byoj8tv","uwmqm3","qhf8xq","Jwef8y","ecr2s2","active","Bsft5z2","E3zdtr","B80jsxd","t2ki1e","Bm2nyyq","Barhvk9","Bw17bha","vfts7","xrcqlc","Ihftqj","Bcgy8vk","Bhxzhr1","B3778ie","d9w3h3","Bl18szs","B4j8arr","B0n5ga8","s924m2","B1q35kw","Gp14am","bn5sak","By385i5","Eqx8gd","B1piin3","disabled","Bbusuzp","selected","Frg6f3","t21cq0","Bcdw1i0","Bo70h7d","selectedCheck","multiselectCheck","B4j52fo","Bekrc4i","Bn0qgzm","ibv6hh","icvyot","vrafjx","oivjwe","wvpqe5","g2u3we","h3c5rm","B9xav0g","zhjwy3","B7ck84d","Brf1p80","Bkfmm31","Bqenvij","a9b677","selectedMultiselectCheck","De3pzq","checkDisabled","d","h","a","m","state","focusVisible","multiselect","styles","className","mergeClasses"],"mappings":";;;;;;;;;;;IAEaA,gBAAgB;eAAhBA;;IA0HAC,wBAAwB;eAAxBA;;;uBA3HsC;AAC5C,MAAMD,mBAAmB;IAC9BE,MAAM;IACNC,WAAW;AACb;AACA;;CAEC,GACD,MAAMC,YAAY,WAAW,GAAEC,IAAAA,eAAQ,EAAC;IACtCH,MAAM;QACJI,SAAS;QACTC,SAAS;YAAC;YAAY;SAAW;QACjCC,SAAS;YAAC;YAAY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;KAAuE;IACvJC,GAAG;QAAC;YAAC;YAA8D;gBACjEA,GAAG;YACL;SAAE;KAAC;AACL;AAIO,MAAMjF,2BAA2BkF,CAAAA;IACtC,MAAM,EACJ1D,MAAM,EACNyB,QAAQ,EACRkC,YAAY,EACZC,WAAW,EACXjC,QAAQ,EACT,GAAG+B;IACJ,MAAMG,SAASlF;IACf+E,MAAMjF,IAAI,CAACqF,SAAS,GAAGC,IAAAA,mBAAY,EAACxF,iBAAiBE,IAAI,EAAEoF,OAAOpF,IAAI,EAAEuB,UAAU2D,gBAAgBE,OAAO7D,MAAM,EAAEyB,YAAYoC,OAAOpC,QAAQ,EAAEE,YAAYkC,OAAOlC,QAAQ,EAAE+B,MAAMjF,IAAI,CAACqF,SAAS;IAC/L,IAAIJ,MAAMhF,SAAS,EAAE;QACnBgF,MAAMhF,SAAS,CAACoF,SAAS,GAAGC,IAAAA,mBAAY,EAACxF,iBAAiBG,SAAS,EAAEmF,OAAOnF,SAAS,EAAEkF,eAAeC,OAAO5B,gBAAgB,EAAEN,YAAYkC,OAAO7B,aAAa,EAAEL,YAAYiC,eAAeC,OAAOV,wBAAwB,EAAE1B,YAAYoC,OAAOR,aAAa,EAAEK,MAAMhF,SAAS,CAACoF,SAAS;IAC1R;IACA,OAAOJ;AACT,GACA,kDAAkD"}
1
+ {"version":3,"sources":["useOptionStyles.styles.js"],"sourcesContent":["import { tokens } from '@fluentui/react-theme';\nimport { __styles, mergeClasses, shorthands } from '@griffel/react';\nexport const optionClassNames = {\n root: 'fui-Option',\n checkIcon: 'fui-Option__checkIcon'\n};\n/**\n * Styles for the root slot\n */\nconst useStyles = /*#__PURE__*/__styles({\n root: {\n Bt984gj: \"f122n59\",\n Bbmb7ep: [\"f1aa9q02\", \"f16jpd5f\"],\n Beyfa6y: [\"f16jpd5f\", \"f1aa9q02\"],\n B7oj6ja: [\"f1jar5jt\", \"fyu767a\"],\n Btl43ni: [\"fyu767a\", \"f1jar5jt\"],\n sj55zd: \"f19n0e5\",\n i8kkvl: \"f1ufnopg\",\n Bceei9c: \"f1k6fduh\",\n mc9l5x: \"f22iagw\",\n Bahqtrf: \"fk6fouc\",\n Be2twd7: \"fkhj508\",\n Bg96gwp: \"f1i3iumi\",\n z8tnut: \"fp2oml8\",\n z189sj: [\"f1vdfbxk\", \"f1f5gg8d\"],\n Byoj8tv: \"f1tdddsa\",\n uwmqm3: [\"f1f5gg8d\", \"f1vdfbxk\"],\n qhf8xq: \"f10pi13n\",\n Jwef8y: \"f1knas48\",\n Bi91k9c: \"feu1g3u\",\n zqbkvg: \"fo79ri9\",\n h82x05: [\"f1osiabc\", \"f1e8le25\"],\n cqj998: \"f1yusjty\",\n j3hlsh: [\"f1e8le25\", \"f1osiabc\"],\n ecr2s2: \"fb40n2d\",\n lj723h: \"f1g4hkjv\",\n Btxx2vb: \"f1lnr2zp\",\n sltcwy: [\"f1ogfk9z\", \"f1g7j8ec\"],\n dnwvvm: \"fiuf46r\",\n Blyvkvs: [\"f1g7j8ec\", \"f1ogfk9z\"]\n },\n active: {\n Bsft5z2: \"f13zj6fq\",\n E3zdtr: \"f1mdlcz9\",\n B80jsxd: \"f1nwj1ja\",\n t2ki1e: \"ffmd2fr\",\n Bm2nyyq: \"f8rth92\",\n Barhvk9: [\"flthirb\", \"ftkbnf5\"],\n Bw17bha: \"f1lh990p\",\n vfts7: [\"ftkbnf5\", \"flthirb\"],\n xrcqlc: \"fc9v8v1\",\n Ihftqj: [\"f1mwfetb\", \"f18mat8f\"],\n Bcgy8vk: \"f1cb6c3\",\n Bhxzhr1: [\"f18mat8f\", \"f1mwfetb\"],\n B3778ie: [\"f1ibwz09\", \"f1kp91vd\"],\n d9w3h3: [\"f1kp91vd\", \"f1ibwz09\"],\n Bl18szs: [\"f1pix4dl\", \"f13nd1z4\"],\n B4j8arr: [\"f13nd1z4\", \"f1pix4dl\"],\n B0n5ga8: \"f1qw5sz7\",\n s924m2: [\"f19va7ni\", \"f1a9v3mw\"],\n B1q35kw: \"fkkziue\",\n Gp14am: [\"f1a9v3mw\", \"f19va7ni\"],\n bn5sak: \"f1a97anr\",\n By385i5: \"f5226zp\",\n Eqx8gd: [\"fa2bdqt\", \"fei6g0k\"],\n B1piin3: [\"fei6g0k\", \"fa2bdqt\"]\n },\n disabled: {\n sj55zd: \"f1s2aq7o\",\n Jwef8y: \"f9ql6rf\",\n Bi91k9c: \"fvgxktp\",\n zqbkvg: \"f185j3qj\",\n h82x05: [\"f1dligi3\", \"f1vydzie\"],\n cqj998: \"fjw1di3\",\n j3hlsh: [\"f1vydzie\", \"f1dligi3\"],\n ecr2s2: \"fgj9um3\",\n lj723h: \"f19wldhg\",\n Btxx2vb: \"f1ss0kt2\",\n sltcwy: [\"f1t6oli3\", \"fjy9ci8\"],\n dnwvvm: \"fresaxk\",\n Blyvkvs: [\"fjy9ci8\", \"f1t6oli3\"],\n Bbusuzp: \"f1dcs8yz\"\n },\n selected: {},\n checkIcon: {\n Be2twd7: \"fod5ikn\",\n Frg6f3: [\"f18b9hdq\", \"fn6qj8t\"],\n t21cq0: [\"f1xk557c\", \"f1h9en5y\"],\n Bcdw1i0: \"fd7fpy0\",\n Bo70h7d: \"fvc9v3g\"\n },\n selectedCheck: {\n Bcdw1i0: \"f1022m68\"\n },\n multiselectCheck: {\n B4j52fo: \"f192inf7\",\n Bekrc4i: [\"f5tn483\", \"f1ojsxk5\"],\n Bn0qgzm: \"f1vxd6vx\",\n ibv6hh: [\"f1ojsxk5\", \"f5tn483\"],\n icvyot: \"fzkkow9\",\n vrafjx: [\"fcdblym\", \"fjik90z\"],\n oivjwe: \"fg706s2\",\n wvpqe5: [\"fjik90z\", \"fcdblym\"],\n g2u3we: \"fq0vr37\",\n h3c5rm: [\"f1byw159\", \"f11cr0be\"],\n B9xav0g: \"f1c1zstj\",\n zhjwy3: [\"f11cr0be\", \"f1byw159\"],\n Bbmb7ep: [\"f1g3puop\", \"fi2rrw2\"],\n Beyfa6y: [\"fi2rrw2\", \"f1g3puop\"],\n B7oj6ja: [\"f1rstyi9\", \"f1s4nn1u\"],\n Btl43ni: [\"f1s4nn1u\", \"f1rstyi9\"],\n B7ck84d: \"f1ewtqcl\",\n mc9l5x: \"f22iagw\",\n Bt984gj: \"f122n59\",\n Brf1p80: \"f4d9j23\",\n Bkfmm31: \"f1w9h62z\",\n Be2twd7: \"f1ugzwwg\",\n Bqenvij: \"fd461yt\",\n a9b677: \"fjw5fx7\",\n Bcdw1i0: \"f1022m68\"\n },\n selectedMultiselectCheck: {\n De3pzq: \"ftywsgz\",\n sj55zd: \"fqpbvvt\",\n g2u3we: \"f3xi7mh\",\n h3c5rm: [\"ftovhe4\", \"f1wczvin\"],\n B9xav0g: \"f68vbr6\",\n zhjwy3: [\"f1wczvin\", \"ftovhe4\"]\n },\n checkDisabled: {\n sj55zd: \"f1s2aq7o\",\n Bbusuzp: \"f1dcs8yz\"\n },\n multiselectCheckDisabled: {\n g2u3we: \"f1r1t4y1\",\n h3c5rm: [\"fmj8ijw\", \"figx54m\"],\n B9xav0g: \"f360ss8\",\n zhjwy3: [\"figx54m\", \"fmj8ijw\"]\n }\n}, {\n d: [\".f122n59{align-items:center;}\", \".f1aa9q02{border-bottom-right-radius:var(--borderRadiusMedium);}\", \".f16jpd5f{border-bottom-left-radius:var(--borderRadiusMedium);}\", \".f1jar5jt{border-top-right-radius:var(--borderRadiusMedium);}\", \".fyu767a{border-top-left-radius:var(--borderRadiusMedium);}\", \".f19n0e5{color:var(--colorNeutralForeground1);}\", \".f1ufnopg{column-gap:var(--spacingHorizontalXS);}\", \".f1k6fduh{cursor:pointer;}\", \".f22iagw{display:flex;}\", \".fk6fouc{font-family:var(--fontFamilyBase);}\", \".fkhj508{font-size:var(--fontSizeBase300);}\", \".f1i3iumi{line-height:var(--lineHeightBase300);}\", \".fp2oml8{padding-top:var(--spacingVerticalSNudge);}\", \".f1vdfbxk{padding-right:var(--spacingHorizontalS);}\", \".f1f5gg8d{padding-left:var(--spacingHorizontalS);}\", \".f1tdddsa{padding-bottom:var(--spacingVerticalSNudge);}\", \".f10pi13n{position:relative;}\", \".f13zj6fq::after{content:\\\"\\\";}\", \".f1mdlcz9::after{position:absolute;}\", \".f1nwj1ja::after{pointer-events:none;}\", \".ffmd2fr::after{z-index:1;}\", \".f8rth92::after{border-top-style:solid;}\", \".flthirb::after{border-right-style:solid;}\", \".ftkbnf5::after{border-left-style:solid;}\", \".f1lh990p::after{border-bottom-style:solid;}\", \".fc9v8v1::after{border-top-width:2px;}\", \".f1mwfetb::after{border-right-width:2px;}\", \".f18mat8f::after{border-left-width:2px;}\", \".f1cb6c3::after{border-bottom-width:2px;}\", \".f1ibwz09::after{border-bottom-right-radius:var(--borderRadiusMedium);}\", \".f1kp91vd::after{border-bottom-left-radius:var(--borderRadiusMedium);}\", \".f1pix4dl::after{border-top-right-radius:var(--borderRadiusMedium);}\", \".f13nd1z4::after{border-top-left-radius:var(--borderRadiusMedium);}\", \".f1qw5sz7::after{border-top-color:var(--colorStrokeFocus2);}\", \".f19va7ni::after{border-right-color:var(--colorStrokeFocus2);}\", \".f1a9v3mw::after{border-left-color:var(--colorStrokeFocus2);}\", \".fkkziue::after{border-bottom-color:var(--colorStrokeFocus2);}\", \".f1a97anr::after{top:-2px;}\", \".f5226zp::after{bottom:-2px;}\", \".fa2bdqt::after{left:-2px;}\", \".fei6g0k::after{right:-2px;}\", \".f1s2aq7o{color:var(--colorNeutralForegroundDisabled);}\", \".fod5ikn{font-size:var(--fontSizeBase400);}\", \".f18b9hdq{margin-left:calc(var(--spacingHorizontalXXS) * -1);}\", \".fn6qj8t{margin-right:calc(var(--spacingHorizontalXXS) * -1);}\", \".f1xk557c{margin-right:var(--spacingHorizontalXXS);}\", \".f1h9en5y{margin-left:var(--spacingHorizontalXXS);}\", \".fd7fpy0{visibility:hidden;}\", \".fvc9v3g svg{display:block;}\", \".f1022m68{visibility:visible;}\", \".f192inf7{border-top-width:var(--strokeWidthThin);}\", \".f5tn483{border-right-width:var(--strokeWidthThin);}\", \".f1ojsxk5{border-left-width:var(--strokeWidthThin);}\", \".f1vxd6vx{border-bottom-width:var(--strokeWidthThin);}\", \".fzkkow9{border-top-style:solid;}\", \".fcdblym{border-right-style:solid;}\", \".fjik90z{border-left-style:solid;}\", \".fg706s2{border-bottom-style:solid;}\", \".fq0vr37{border-top-color:var(--colorNeutralStrokeAccessible);}\", \".f1byw159{border-right-color:var(--colorNeutralStrokeAccessible);}\", \".f11cr0be{border-left-color:var(--colorNeutralStrokeAccessible);}\", \".f1c1zstj{border-bottom-color:var(--colorNeutralStrokeAccessible);}\", \".f1g3puop{border-bottom-right-radius:var(--borderRadiusSmall);}\", \".fi2rrw2{border-bottom-left-radius:var(--borderRadiusSmall);}\", \".f1rstyi9{border-top-right-radius:var(--borderRadiusSmall);}\", \".f1s4nn1u{border-top-left-radius:var(--borderRadiusSmall);}\", \".f1ewtqcl{box-sizing:border-box;}\", \".f4d9j23{justify-content:center;}\", \".f1w9h62z{fill:currentColor;}\", \".f1ugzwwg{font-size:12px;}\", \".fd461yt{height:16px;}\", \".fjw5fx7{width:16px;}\", \".ftywsgz{background-color:var(--colorCompoundBrandBackground);}\", \".fqpbvvt{color:var(--colorNeutralForegroundInverted);}\", \".f3xi7mh{border-top-color:var(--colorCompoundBrandBackground);}\", \".ftovhe4{border-right-color:var(--colorCompoundBrandBackground);}\", \".f1wczvin{border-left-color:var(--colorCompoundBrandBackground);}\", \".f68vbr6{border-bottom-color:var(--colorCompoundBrandBackground);}\", \".f1r1t4y1{border-top-color:var(--colorNeutralForegroundDisabled);}\", \".fmj8ijw{border-right-color:var(--colorNeutralForegroundDisabled);}\", \".figx54m{border-left-color:var(--colorNeutralForegroundDisabled);}\", \".f360ss8{border-bottom-color:var(--colorNeutralForegroundDisabled);}\"],\n h: [\".f1knas48:hover{background-color:var(--colorNeutralBackground1Hover);}\", \".feu1g3u:hover{color:var(--colorNeutralForeground1Hover);}\", \".fo79ri9:hover .fui-Option__checkIcon{border-top-color:var(--colorNeutralForeground1Hover);}\", \".f1osiabc:hover .fui-Option__checkIcon{border-right-color:var(--colorNeutralForeground1Hover);}\", \".f1e8le25:hover .fui-Option__checkIcon{border-left-color:var(--colorNeutralForeground1Hover);}\", \".f1yusjty:hover .fui-Option__checkIcon{border-bottom-color:var(--colorNeutralForeground1Hover);}\", \".f9ql6rf:hover{background-color:var(--colorTransparentBackground);}\", \".fvgxktp:hover{color:var(--colorNeutralForegroundDisabled);}\", \".f185j3qj:hover .fui-Option__checkIcon{border-top-color:var(--colorNeutralForegroundDisabled);}\", \".f1dligi3:hover .fui-Option__checkIcon{border-right-color:var(--colorNeutralForegroundDisabled);}\", \".f1vydzie:hover .fui-Option__checkIcon{border-left-color:var(--colorNeutralForegroundDisabled);}\", \".fjw1di3:hover .fui-Option__checkIcon{border-bottom-color:var(--colorNeutralForegroundDisabled);}\"],\n a: [\".fb40n2d:active{background-color:var(--colorNeutralBackground1Pressed);}\", \".f1g4hkjv:active{color:var(--colorNeutralForeground1Pressed);}\", \".f1lnr2zp:active .fui-Option__checkIcon{border-top-color:var(--colorNeutralForeground1Hover);}\", \".f1ogfk9z:active .fui-Option__checkIcon{border-right-color:var(--colorNeutralForeground1Hover);}\", \".f1g7j8ec:active .fui-Option__checkIcon{border-left-color:var(--colorNeutralForeground1Hover);}\", \".fiuf46r:active .fui-Option__checkIcon{border-bottom-color:var(--colorNeutralForeground1Hover);}\", \".fgj9um3:active{background-color:var(--colorTransparentBackground);}\", \".f19wldhg:active{color:var(--colorNeutralForegroundDisabled);}\", \".f1ss0kt2:active .fui-Option__checkIcon{border-top-color:var(--colorNeutralForegroundDisabled);}\", \".f1t6oli3:active .fui-Option__checkIcon{border-right-color:var(--colorNeutralForegroundDisabled);}\", \".fjy9ci8:active .fui-Option__checkIcon{border-left-color:var(--colorNeutralForegroundDisabled);}\", \".fresaxk:active .fui-Option__checkIcon{border-bottom-color:var(--colorNeutralForegroundDisabled);}\"],\n m: [[\"@media (forced-colors: active){.f1dcs8yz{color:GrayText;}}\", {\n m: \"(forced-colors: active)\"\n }]]\n});\n/**\n * Apply styling to the Option slots based on the state\n */\nexport const useOptionStyles_unstable = state => {\n const {\n active,\n disabled,\n focusVisible,\n multiselect,\n selected\n } = state;\n const styles = useStyles();\n state.root.className = mergeClasses(optionClassNames.root, styles.root, active && focusVisible && styles.active, disabled && styles.disabled, selected && styles.selected, state.root.className);\n if (state.checkIcon) {\n state.checkIcon.className = mergeClasses(optionClassNames.checkIcon, styles.checkIcon, multiselect && styles.multiselectCheck, selected && styles.selectedCheck, selected && multiselect && styles.selectedMultiselectCheck, disabled && styles.checkDisabled, disabled && multiselect && styles.multiselectCheckDisabled, state.checkIcon.className);\n }\n return state;\n};\n//# sourceMappingURL=useOptionStyles.styles.js.map"],"names":["optionClassNames","useOptionStyles_unstable","root","checkIcon","useStyles","__styles","Bt984gj","Bbmb7ep","Beyfa6y","B7oj6ja","Btl43ni","sj55zd","i8kkvl","Bceei9c","mc9l5x","Bahqtrf","Be2twd7","Bg96gwp","z8tnut","z189sj","Byoj8tv","uwmqm3","qhf8xq","Jwef8y","Bi91k9c","zqbkvg","h82x05","cqj998","j3hlsh","ecr2s2","lj723h","Btxx2vb","sltcwy","dnwvvm","Blyvkvs","active","Bsft5z2","E3zdtr","B80jsxd","t2ki1e","Bm2nyyq","Barhvk9","Bw17bha","vfts7","xrcqlc","Ihftqj","Bcgy8vk","Bhxzhr1","B3778ie","d9w3h3","Bl18szs","B4j8arr","B0n5ga8","s924m2","B1q35kw","Gp14am","bn5sak","By385i5","Eqx8gd","B1piin3","disabled","Bbusuzp","selected","Frg6f3","t21cq0","Bcdw1i0","Bo70h7d","selectedCheck","multiselectCheck","B4j52fo","Bekrc4i","Bn0qgzm","ibv6hh","icvyot","vrafjx","oivjwe","wvpqe5","g2u3we","h3c5rm","B9xav0g","zhjwy3","B7ck84d","Brf1p80","Bkfmm31","Bqenvij","a9b677","selectedMultiselectCheck","De3pzq","checkDisabled","multiselectCheckDisabled","d","h","a","m","state","focusVisible","multiselect","styles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5F,IAAI,CAACgG,SAAS,GAAGC,IAAAA,mBAAY,EAACnG,iBAAiBE,IAAI,EAAE+F,OAAO/F,IAAI,EAAEiC,UAAU4D,gBAAgBE,OAAO9D,MAAM,EAAEyB,YAAYqC,OAAOrC,QAAQ,EAAEE,YAAYmC,OAAOnC,QAAQ,EAAEgC,MAAM5F,IAAI,CAACgG,SAAS;IAC/L,IAAIJ,MAAM3F,SAAS,EAAE;QACnB2F,MAAM3F,SAAS,CAAC+F,SAAS,GAAGC,IAAAA,mBAAY,EAACnG,iBAAiBG,SAAS,EAAE8F,OAAO9F,SAAS,EAAE6F,eAAeC,OAAO7B,gBAAgB,EAAEN,YAAYmC,OAAO9B,aAAa,EAAEL,YAAYkC,eAAeC,OAAOX,wBAAwB,EAAE1B,YAAYqC,OAAOT,aAAa,EAAE5B,YAAYoC,eAAeC,OAAOR,wBAAwB,EAAEK,MAAM3F,SAAS,CAAC+F,SAAS;IACtV;IACA,OAAOJ;AACT,GACA,kDAAkD"}
@@ -22,6 +22,7 @@ const useComboboxBaseState = (props)=>{
22
22
  // tabster/keyborg doesn't work here, since the actual keyboard focus target doesn't move
23
23
  const [focusVisible, setFocusVisible] = _react.useState(false);
24
24
  // track focused state to conditionally render collapsed listbox
25
+ // when the trigger is focused - the listbox should but hidden until the open state is changed
25
26
  const [hasFocus, setHasFocus] = _react.useState(false);
26
27
  const ignoreNextBlur = _react.useRef(false);
27
28
  const selectionState = (0, _useSelection.useSelection)(props);
@@ -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, 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 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 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","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,WAAW,KAAK,EAAEC,cAAc,KAAK,EAAEC,YAAYC,SAAS,EAAEC,WAAW,EAAEC,YAAY,EAAEC,OAAO,QAAQ,EAAE,GAAGT;IACvJ,MAAMU,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,MAAM,CAACG,UAAUC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IACjB,GAAG;QACC3C;QACAqC;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;QACA1C;KACH;IACD,OAAO;QACH,GAAGQ,gBAAgB;QACnB,GAAGc,cAAc;QACjBV;QACAb;QACAiB;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, 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 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","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,WAAW,KAAK,EAAEC,cAAc,KAAK,EAAEC,YAAYC,SAAS,EAAEC,WAAW,EAAEC,YAAY,EAAEC,OAAO,QAAQ,EAAE,GAAGT;IACvJ,MAAMU,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,QAAQ,CAAC;IAC/C,MAAMK,iBAAiBN,OAAMO,MAAM,CAAC;IACpC,MAAMC,iBAAiBC,IAAAA,0BAAY,EAACzB;IACpC,MAAM,EAAE0B,eAAe,EAAE,GAAGF;IAC5B,+EAA+E;IAC/E,MAAMG,eAAeC,IAAAA,6BAAa;IAClC,MAAM,CA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AAM7B,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;QACA1C;KACH;IACD,OAAO;QACH,GAAGQ,gBAAgB;QACnB,GAAGc,cAAc;QACjBV;QACAb;QACAiB;QACAE;QACAE;QACAlB;QACAC;QACAuC;QACA7B;QACAI;QACAE;QACA2B;QACAlB;QACArB;QACAwB;QACA1B;IACJ;AACJ"}
@@ -13,7 +13,7 @@ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
13
  const _reactutilities = require("@fluentui/react-utilities");
14
14
  const _dropdownKeyActions = require("../utils/dropdownKeyActions");
15
15
  function useTriggerSlot(triggerSlotFromProp, ref, options) {
16
- const { state: { activeOption, getCount, getIndexOfId, getOptionAtIndex, open, selectOption, setActiveOption, setFocusVisible, setOpen, multiselect }, defaultProps, elementType } = options;
16
+ const { state: { activeOption, getCount, getIndexOfId, getOptionAtIndex, open, selectOption, setActiveOption, setFocusVisible, setOpen, multiselect, setHasFocus }, defaultProps, elementType } = options;
17
17
  const trigger = _reactutilities.slot.always(triggerSlotFromProp, {
18
18
  defaultProps: {
19
19
  type: 'text',
@@ -30,7 +30,13 @@ function useTriggerSlot(triggerSlotFromProp, ref, options) {
30
30
  // the trigger should open/close the popup on click or blur
31
31
  trigger.onBlur = (0, _reactutilities.mergeCallbacks)((event)=>{
32
32
  setOpen(event, false);
33
+ setHasFocus(false);
33
34
  }, trigger.onBlur);
35
+ trigger.onFocus = (0, _reactutilities.mergeCallbacks)((event)=>{
36
+ if (event.target === event.currentTarget) {
37
+ setHasFocus(true);
38
+ }
39
+ }, trigger.onFocus);
34
40
  trigger.onClick = (0, _reactutilities.mergeCallbacks)((event)=>{
35
41
  setOpen(event, !open);
36
42
  }, trigger.onClick);
@@ -1 +1 @@
1
- {"version":3,"sources":["useTriggerSlot.js"],"sourcesContent":["import * as React from 'react';\nimport { mergeCallbacks, slot, useMergedRefs } from '@fluentui/react-utilities';\nimport { getDropdownActionFromKey, getIndexFromAction } 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: { activeOption, getCount, getIndexOfId, getOptionAtIndex, open, selectOption, setActiveOption, setFocusVisible, setOpen, multiselect }, defaultProps, elementType } = options;\n const trigger = slot.always(triggerSlotFromProp, {\n defaultProps: {\n type: 'text',\n 'aria-expanded': open,\n 'aria-activedescendant': open ? activeOption === null || activeOption === void 0 ? void 0 : activeOption.id : undefined,\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 }, trigger.onBlur);\n trigger.onClick = mergeCallbacks((event)=>{\n setOpen(event, !open);\n }, trigger.onClick);\n // handle combobox keyboard interaction\n trigger.onKeyDown = mergeCallbacks((event)=>{\n const action = getDropdownActionFromKey(event, {\n open,\n multiselect\n });\n const maxIndex = getCount() - 1;\n const activeIndex = activeOption ? getIndexOfId(activeOption.id) : -1;\n let newIndex = activeIndex;\n switch(action){\n case 'Open':\n event.preventDefault();\n setFocusVisible(true);\n setOpen(event, true);\n break;\n case 'Close':\n // stop propagation for escape key to avoid dismissing any parent popups\n event.stopPropagation();\n event.preventDefault();\n setOpen(event, false);\n break;\n case 'CloseSelect':\n !multiselect && !(activeOption === null || activeOption === void 0 ? void 0 : activeOption.disabled) && setOpen(event, false);\n // fallthrough\n case 'Select':\n activeOption && selectOption(event, activeOption);\n event.preventDefault();\n break;\n case 'Tab':\n !multiselect && activeOption && selectOption(event, activeOption);\n break;\n default:\n newIndex = getIndexFromAction(action, activeIndex, maxIndex);\n }\n if (newIndex !== activeIndex) {\n // prevent default page scroll/keyboard action if the index changed\n event.preventDefault();\n setActiveOption(getOptionAtIndex(newIndex));\n setFocusVisible(true);\n }\n }, trigger.onKeyDown);\n trigger.onMouseOver = mergeCallbacks((event)=>{\n setFocusVisible(false);\n }, trigger.onMouseOver);\n // TODO fix cast\n return trigger;\n}\n"],"names":["useTriggerSlot","triggerSlotFromProp","ref","options","state","activeOption","getCount","getIndexOfId","getOptionAtIndex","open","selectOption","setActiveOption","setFocusVisible","setOpen","multiselect","defaultProps","elementType","trigger","slot","always","type","id","undefined","role","triggerRef","React","useRef","useMergedRefs","onBlur","mergeCallbacks","event","onClick","onKeyDown","action","getDropdownActionFromKey","maxIndex","activeIndex","newIndex","preventDefault","stopPropagation","disabled","getIndexFromAction","onMouseOver"],"mappings":";;;;+BAMoBA;;;eAAAA;;;;iEANG;gCAC6B;oCACS;AAIlD,SAASA,eAAeC,mBAAmB,EAAEC,GAAG,EAAEC,OAAO;IAChE,MAAM,EAAEC,OAAO,EAAEC,YAAY,EAAEC,QAAQ,EAAEC,YAAY,EAAEC,gBAAgB,EAAEC,IAAI,EAAEC,YAAY,EAAEC,eAAe,EAAEC,eAAe,EAAEC,OAAO,EAAEC,WAAW,EAAE,EAAEC,YAAY,EAAEC,WAAW,EAAE,GAAGb;IACrL,MAAMc,UAAUC,oBAAI,CAACC,MAAM,CAAClB,qBAAqB;QAC7Cc,cAAc;YACVK,MAAM;YACN,iBAAiBX;YACjB,yBAAyBA,OAAOJ,iBAAiB,QAAQA,iBAAiB,KAAK,IAAI,KAAK,IAAIA,aAAagB,EAAE,GAAGC;YAC9GC,MAAM;YACN,GAAG,OAAOR,iBAAiB,YAAYA,YAAY;QACvD;QACAC;IACJ;IACA,4BAA4B;IAC5B,MAAMQ,aAAaC,OAAMC,MAAM,CAAC;IAChCT,QAAQf,GAAG,GA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pBf,QAAQyB,WAAW,GAAGb,IAAAA,8BAAc,EAAC,CAACC;QAClClB,gBAAgB;IACpB,GAAGK,QAAQyB,WAAW;IACtB,gBAAgB;IAChB,OAAOzB;AACX"}
1
+ {"version":3,"sources":["useTriggerSlot.js"],"sourcesContent":["import * as React from 'react';\nimport { mergeCallbacks, slot, useMergedRefs } from '@fluentui/react-utilities';\nimport { getDropdownActionFromKey, getIndexFromAction } 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: { activeOption, getCount, getIndexOfId, getOptionAtIndex, open, selectOption, setActiveOption, setFocusVisible, setOpen, multiselect, setHasFocus }, defaultProps, elementType } = options;\n const trigger = slot.always(triggerSlotFromProp, {\n defaultProps: {\n type: 'text',\n 'aria-expanded': open,\n 'aria-activedescendant': open ? activeOption === null || activeOption === void 0 ? void 0 : activeOption.id : undefined,\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((event)=>{\n const action = getDropdownActionFromKey(event, {\n open,\n multiselect\n });\n const maxIndex = getCount() - 1;\n const activeIndex = activeOption ? getIndexOfId(activeOption.id) : -1;\n let newIndex = activeIndex;\n switch(action){\n case 'Open':\n event.preventDefault();\n setFocusVisible(true);\n setOpen(event, true);\n break;\n case 'Close':\n // stop propagation for escape key to avoid dismissing any parent popups\n event.stopPropagation();\n event.preventDefault();\n setOpen(event, false);\n break;\n case 'CloseSelect':\n !multiselect && !(activeOption === null || activeOption === void 0 ? void 0 : activeOption.disabled) && setOpen(event, false);\n // fallthrough\n case 'Select':\n activeOption && selectOption(event, activeOption);\n event.preventDefault();\n break;\n case 'Tab':\n !multiselect && activeOption && selectOption(event, activeOption);\n break;\n default:\n newIndex = getIndexFromAction(action, activeIndex, maxIndex);\n }\n if (newIndex !== activeIndex) {\n // prevent default page scroll/keyboard action if the index changed\n event.preventDefault();\n setActiveOption(getOptionAtIndex(newIndex));\n setFocusVisible(true);\n }\n }, trigger.onKeyDown);\n trigger.onMouseOver = mergeCallbacks((event)=>{\n setFocusVisible(false);\n }, trigger.onMouseOver);\n // TODO fix cast\n return trigger;\n}\n"],"names":["useTriggerSlot","triggerSlotFromProp","ref","options","state","activeOption","getCount","getIndexOfId","getOptionAtIndex","open","selectOption","setActiveOption","setFocusVisible","setOpen","multiselect","setHasFocus","defaultProps","elementType","trigger","slot","always","type","id","undefined","role","triggerRef","React","useRef","useMergedRefs","onBlur","mergeCallbacks","event","onFocus","target","currentTarget","onClick","onKeyDown","action","getDropdownActionFromKey","maxIndex","activeIndex","newIndex","preventDefault","stopPropagation","disabled","getIndexFromAction","onMouseOver"],"mappings":";;;;+BAMoBA;;;eAAAA;;;;iEANG;gCAC6B;oCACS;AAIlD,SAASA,eAAeC,mBAAmB,EAAEC,GAAG,EAAEC,OAAO;IAChE,MAAM,EAAEC,OAAO,EAAEC,YAAY,EAAEC,QAAQ,EAAEC,YAAY,EAAEC,gBAAgB,EAAEC,IAAI,EAAEC,YAAY,EAAEC,eAAe,EAAEC,eAAe,EAAEC,OAAO,EAAEC,WAAW,EAAEC,WAAW,EAAE,EAAEC,YAAY,EAAEC,WAAW,EAAE,GAAGd;IAClM,MAAMe,UAAUC,oBAAI,CAACC,MAAM,CAACnB,qBAAqB;QAC7Ce,cAAc;YACVK,MAAM;YACN,iBAAiBZ;YACj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IAAIA,aAAauC,QAAQ,AAAD,KAAM/B,QAAQkB,OAAO;YAC3H,cAAc;YACd,KAAK;gBACD1B,gBAAgBK,aAAaqB,OAAO1B;gBACpC0B,MAAMW,cAAc;gBACpB;YACJ,KAAK;gBACD,CAAC5B,eAAeT,gBAAgBK,aAAaqB,OAAO1B;gBACpD;YACJ;gBACIoC,WAAWI,IAAAA,sCAAkB,EAACR,QAAQG,aAAaD;QAC3D;QACA,IAAIE,aAAaD,aAAa;YAC1B,mEAAmE;YACnET,MAAMW,cAAc;YACpB/B,gBAAgBH,iBAAiBiC;YACjC7B,gBAAgB;QACpB;IACJ,GAAGM,QAAQkB,SAAS;IACpBlB,QAAQ4B,WAAW,GAAGhB,IAAAA,8BAAc,EAAC,CAACC;QAClCnB,gBAAgB;IACpB,GAAGM,QAAQ4B,WAAW;IACtB,gBAAgB;IAChB,OAAO5B;AACX"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-combobox",
3
- "version": "9.5.35",
3
+ "version": "9.5.37",
4
4
  "description": "Fluent UI React Combobox component",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -34,15 +34,15 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@fluentui/keyboard-keys": "^9.0.7",
37
- "@fluentui/react-context-selector": "^9.1.44",
38
- "@fluentui/react-field": "^9.1.45",
37
+ "@fluentui/react-context-selector": "^9.1.45",
38
+ "@fluentui/react-field": "^9.1.46",
39
39
  "@fluentui/react-icons": "^2.0.217",
40
- "@fluentui/react-jsx-runtime": "^9.0.22",
41
- "@fluentui/react-portal": "^9.4.5",
42
- "@fluentui/react-positioning": "^9.10.5",
40
+ "@fluentui/react-jsx-runtime": "^9.0.23",
41
+ "@fluentui/react-portal": "^9.4.6",
42
+ "@fluentui/react-positioning": "^9.10.6",
43
43
  "@fluentui/react-shared-contexts": "^9.13.2",
44
44
  "@fluentui/react-theme": "^9.1.16",
45
- "@fluentui/react-utilities": "^9.15.4",
45
+ "@fluentui/react-utilities": "^9.15.5",
46
46
  "@griffel/react": "^1.5.14",
47
47
  "@swc/helpers": "^0.5.1"
48
48
  },