@fluentui/react-combobox 9.14.4 → 9.14.5

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,20 +1,37 @@
1
1
  # Change Log - @fluentui/react-combobox
2
2
 
3
- This log was last generated on Tue, 01 Apr 2025 14:05:35 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 16 Apr 2025 19:37:26 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.14.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-combobox_v9.14.5)
8
+
9
+ Wed, 16 Apr 2025 19:37:26 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-combobox_v9.14.4..@fluentui/react-combobox_v9.14.5)
11
+
12
+ ### Patches
13
+
14
+ - fix: ensure that the listbox is labelled by the field label ([PR #34196](https://github.com/microsoft/fluentui/pull/34196) by dmytrokirpa@microsoft.com)
15
+ - Bump @fluentui/react-aria to v9.14.5 ([PR #34166](https://github.com/microsoft/fluentui/pull/34166) by beachball)
16
+ - Bump @fluentui/react-context-selector to v9.1.76 ([PR #34166](https://github.com/microsoft/fluentui/pull/34166) by beachball)
17
+ - Bump @fluentui/react-field to v9.2.5 ([PR #34166](https://github.com/microsoft/fluentui/pull/34166) by beachball)
18
+ - Bump @fluentui/react-jsx-runtime to v9.0.54 ([PR #34166](https://github.com/microsoft/fluentui/pull/34166) by beachball)
19
+ - Bump @fluentui/react-portal to v9.5.5 ([PR #34166](https://github.com/microsoft/fluentui/pull/34166) by beachball)
20
+ - Bump @fluentui/react-positioning to v9.16.7 ([PR #34166](https://github.com/microsoft/fluentui/pull/34166) by beachball)
21
+ - Bump @fluentui/react-tabster to v9.24.5 ([PR #34166](https://github.com/microsoft/fluentui/pull/34166) by beachball)
22
+ - Bump @fluentui/react-utilities to v9.19.0 ([PR #34166](https://github.com/microsoft/fluentui/pull/34166) by beachball)
23
+
7
24
  ## [9.14.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-combobox_v9.14.4)
8
25
 
9
- Tue, 01 Apr 2025 14:05:35 GMT
26
+ Tue, 01 Apr 2025 15:08:02 GMT
10
27
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-combobox_v9.14.3..@fluentui/react-combobox_v9.14.4)
11
28
 
12
29
  ### Patches
13
30
 
14
- - Bump @fluentui/react-aria to v9.14.4 ([PR #34129](https://github.com/microsoft/fluentui/pull/34129) by beachball)
15
- - Bump @fluentui/react-field to v9.2.4 ([PR #34129](https://github.com/microsoft/fluentui/pull/34129) by beachball)
16
- - Bump @fluentui/react-portal to v9.5.4 ([PR #34129](https://github.com/microsoft/fluentui/pull/34129) by beachball)
17
- - Bump @fluentui/react-tabster to v9.24.4 ([PR #34129](https://github.com/microsoft/fluentui/pull/34129) by beachball)
31
+ - Bump @fluentui/react-aria to v9.14.4 ([PR #33909](https://github.com/microsoft/fluentui/pull/33909) by beachball)
32
+ - Bump @fluentui/react-field to v9.2.4 ([PR #33909](https://github.com/microsoft/fluentui/pull/33909) by beachball)
33
+ - Bump @fluentui/react-portal to v9.5.4 ([PR #33909](https://github.com/microsoft/fluentui/pull/33909) by beachball)
34
+ - Bump @fluentui/react-tabster to v9.24.4 ([PR #33909](https://github.com/microsoft/fluentui/pull/33909) by beachball)
18
35
 
19
36
  ## [9.14.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-combobox_v9.14.3)
20
37
 
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import { useFieldControlProps_unstable } from '@fluentui/react-field';
2
3
  import { mergeCallbacks, useId, useEventCallback, slot, isResolvedShorthand, useMergedRefs } from '@fluentui/react-utilities';
3
4
  import { Listbox } from '../Listbox';
4
5
  /**
@@ -17,6 +18,15 @@ import { Listbox } from '../Listbox';
17
18
  ...defaultProps
18
19
  }
19
20
  });
21
+ const fieldControlProps = useFieldControlProps_unstable({
22
+ id: listboxId
23
+ }, {
24
+ supportsLabelFor: true
25
+ });
26
+ // Use the field's label to provide an accessible name for the listbox if it doesn't already have one
27
+ if (listboxSlot && !listboxSlot['aria-label'] && !listboxSlot['aria-labelledby'] && fieldControlProps['aria-labelledby']) {
28
+ listboxSlot['aria-labelledby'] = fieldControlProps['aria-labelledby'];
29
+ }
20
30
  /**
21
31
  * Clicking on the listbox should never blur the trigger
22
32
  * in a combobox
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/useListboxSlot.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n mergeCallbacks,\n useId,\n useEventCallback,\n slot,\n isResolvedShorthand,\n useMergedRefs,\n} from '@fluentui/react-utilities';\nimport type { ExtractSlotProps, Slot, SlotComponentType } from '@fluentui/react-utilities';\nimport type { ComboboxBaseState } from './ComboboxBase.types';\nimport { Listbox } from '../Listbox';\nimport { ListboxProps } from '../Listbox';\n\nexport type UseListboxSlotState = Pick<ComboboxBaseState, 'multiselect'>;\n\ntype UseListboxSlotOptions = {\n state: UseListboxSlotState;\n triggerRef:\n | React.RefObject<HTMLInputElement>\n | React.RefObject<HTMLButtonElement>\n | React.RefObject<HTMLButtonElement | HTMLInputElement>;\n defaultProps?: Partial<ListboxProps>;\n};\n\n/**\n * @internal\n * @returns listbox slot with desired behaviour and props\n */\nexport function useListboxSlot(\n listboxSlotFromProp: Slot<typeof Listbox> | undefined,\n ref: React.Ref<HTMLDivElement>,\n options: UseListboxSlotOptions,\n): SlotComponentType<ExtractSlotProps<Slot<typeof Listbox>>> | undefined {\n const {\n state: { multiselect },\n triggerRef,\n defaultProps,\n } = options;\n\n const listboxId = useId(\n 'fluent-listbox',\n isResolvedShorthand(listboxSlotFromProp) ? listboxSlotFromProp.id : undefined,\n );\n\n const listboxSlot = slot.optional(listboxSlotFromProp, {\n renderByDefault: true,\n elementType: Listbox,\n defaultProps: {\n id: listboxId,\n multiselect,\n tabIndex: undefined,\n ...defaultProps,\n },\n });\n\n /**\n * Clicking on the listbox should never blur the trigger\n * in a combobox\n */\n const onMouseDown = useEventCallback(\n mergeCallbacks((event: React.MouseEvent<HTMLDivElement>) => {\n event.preventDefault();\n }, listboxSlot?.onMouseDown),\n );\n\n const onClick = useEventCallback(\n mergeCallbacks((event: React.MouseEvent<HTMLDivElement>) => {\n event.preventDefault();\n triggerRef.current?.focus();\n }, listboxSlot?.onClick),\n );\n\n const listboxRef = useMergedRefs(listboxSlot?.ref, ref);\n if (listboxSlot) {\n listboxSlot.ref = listboxRef;\n listboxSlot.onMouseDown = onMouseDown;\n listboxSlot.onClick = onClick;\n }\n\n return listboxSlot;\n}\n"],"names":["React","mergeCallbacks","useId","useEventCallback","slot","isResolvedShorthand","useMergedRefs","Listbox","useListboxSlot","listboxSlotFromProp","ref","options","state","multiselect","triggerRef","defaultProps","listboxId","id","undefined","listboxSlot","optional","renderByDefault","elementType","tabIndex","onMouseDown","event","preventDefault","onClick","current","focus","listboxRef"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,cAAc,EACdC,KAAK,EACLC,gBAAgB,EAChBC,IAAI,EACJC,mBAAmB,EACnBC,aAAa,QACR,4BAA4B;AAGnC,SAASC,OAAO,QAAQ,aAAa;AAcrC;;;CAGC,GACD,OAAO,SAASC,eACdC,mBAAqD,EACrDC,GAA8B,EAC9BC,OAA8B;IAE9B,MAAM,EACJC,OAAO,EAAEC,WAAW,EAAE,EACtBC,UAAU,EACVC,YAAY,EACb,GAAGJ;IAEJ,MAAMK,YAAYd,MAChB,kBACAG,oBAAoBI,uBAAuBA,oBAAoBQ,EAAE,GAAGC;IAGtE,MAAMC,cAAcf,KAAKgB,QAAQ,CAACX,qBAAqB;QACrDY,iBAAiB;QACjBC,aAAaf;QACbQ,cAAc;YACZE,IAAID;YACJH;YACAU,UAAUL;YACV,GAAGH,YAAY;QACjB;IACF;IAEA;;;GAGC,GACD,MAAMS,cAAcrB,iBAClBF,eAAe,CAACwB;QACdA,MAAMC,cAAc;IACtB,GAAGP,wBAAAA,kCAAAA,YAAaK,WAAW;IAG7B,MAAMG,UAAUxB,iBACdF,eAAe,CAACwB;YAEdX;QADAW,MAAMC,cAAc;SACpBZ,sBAAAA,WAAWc,OAAO,cAAlBd,0CAAAA,oBAAoBe,KAAK;IAC3B,GAAGV,wBAAAA,kCAAAA,YAAaQ,OAAO;IAGzB,MAAMG,aAAaxB,cAAca,wBAAAA,kCAAAA,YAAaT,GAAG,EAAEA;IACnD,IAAIS,aAAa;QACfA,YAAYT,GAAG,GAAGoB;QAClBX,YAAYK,WAAW,GAAGA;QAC1BL,YAAYQ,OAAO,GAAGA;IACxB;IAEA,OAAOR;AACT"}
1
+ {"version":3,"sources":["../src/utils/useListboxSlot.ts"],"sourcesContent":["import * as React from 'react';\nimport { type FieldControlProps, useFieldControlProps_unstable } from '@fluentui/react-field';\nimport {\n mergeCallbacks,\n useId,\n useEventCallback,\n slot,\n isResolvedShorthand,\n useMergedRefs,\n} from '@fluentui/react-utilities';\nimport type { ExtractSlotProps, Slot, SlotComponentType } from '@fluentui/react-utilities';\nimport type { ComboboxBaseState } from './ComboboxBase.types';\nimport { Listbox } from '../Listbox';\nimport { ListboxProps } from '../Listbox';\n\nexport type UseListboxSlotState = Pick<ComboboxBaseState, 'multiselect'>;\n\ntype UseListboxSlotOptions = {\n state: UseListboxSlotState;\n triggerRef:\n | React.RefObject<HTMLInputElement>\n | React.RefObject<HTMLButtonElement>\n | React.RefObject<HTMLButtonElement | HTMLInputElement>;\n defaultProps?: Partial<ListboxProps>;\n};\n\n/**\n * @internal\n * @returns listbox slot with desired behaviour and props\n */\nexport function useListboxSlot(\n listboxSlotFromProp: Slot<typeof Listbox> | undefined,\n ref: React.Ref<HTMLDivElement>,\n options: UseListboxSlotOptions,\n): SlotComponentType<ExtractSlotProps<Slot<typeof Listbox>>> | undefined {\n const {\n state: { multiselect },\n triggerRef,\n defaultProps,\n } = options;\n\n const listboxId = useId(\n 'fluent-listbox',\n isResolvedShorthand(listboxSlotFromProp) ? listboxSlotFromProp.id : undefined,\n );\n\n const listboxSlot = slot.optional(listboxSlotFromProp, {\n renderByDefault: true,\n elementType: Listbox,\n defaultProps: {\n id: listboxId,\n multiselect,\n tabIndex: undefined,\n ...defaultProps,\n },\n });\n\n const fieldControlProps = useFieldControlProps_unstable({ id: listboxId } as FieldControlProps, {\n supportsLabelFor: true,\n });\n\n // Use the field's label to provide an accessible name for the listbox if it doesn't already have one\n if (\n listboxSlot &&\n !listboxSlot['aria-label'] &&\n !listboxSlot['aria-labelledby'] &&\n fieldControlProps['aria-labelledby']\n ) {\n listboxSlot['aria-labelledby'] = fieldControlProps['aria-labelledby'];\n }\n\n /**\n * Clicking on the listbox should never blur the trigger\n * in a combobox\n */\n const onMouseDown = useEventCallback(\n mergeCallbacks((event: React.MouseEvent<HTMLDivElement>) => {\n event.preventDefault();\n }, listboxSlot?.onMouseDown),\n );\n\n const onClick = useEventCallback(\n mergeCallbacks((event: React.MouseEvent<HTMLDivElement>) => {\n event.preventDefault();\n triggerRef.current?.focus();\n }, listboxSlot?.onClick),\n );\n\n const listboxRef = useMergedRefs(listboxSlot?.ref, ref);\n if (listboxSlot) {\n listboxSlot.ref = listboxRef;\n listboxSlot.onMouseDown = onMouseDown;\n listboxSlot.onClick = onClick;\n }\n\n return listboxSlot;\n}\n"],"names":["React","useFieldControlProps_unstable","mergeCallbacks","useId","useEventCallback","slot","isResolvedShorthand","useMergedRefs","Listbox","useListboxSlot","listboxSlotFromProp","ref","options","state","multiselect","triggerRef","defaultProps","listboxId","id","undefined","listboxSlot","optional","renderByDefault","elementType","tabIndex","fieldControlProps","supportsLabelFor","onMouseDown","event","preventDefault","onClick","current","focus","listboxRef"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAAiCC,6BAA6B,QAAQ,wBAAwB;AAC9F,SACEC,cAAc,EACdC,KAAK,EACLC,gBAAgB,EAChBC,IAAI,EACJC,mBAAmB,EACnBC,aAAa,QACR,4BAA4B;AAGnC,SAASC,OAAO,QAAQ,aAAa;AAcrC;;;CAGC,GACD,OAAO,SAASC,eACdC,mBAAqD,EACrDC,GAA8B,EAC9BC,OAA8B;IAE9B,MAAM,EACJC,OAAO,EAAEC,WAAW,EAAE,EACtBC,UAAU,EACVC,YAAY,EACb,GAAGJ;IAEJ,MAAMK,YAAYd,MAChB,kBACAG,oBAAoBI,uBAAuBA,oBAAoBQ,EAAE,GAAGC;IAGtE,MAAMC,cAAcf,KAAKgB,QAAQ,CAACX,qBAAqB;QACrDY,iBAAiB;QACjBC,aAAaf;QACbQ,cAAc;YACZE,IAAID;YACJH;YACAU,UAAUL;YACV,GAAGH,YAAY;QACjB;IACF;IAEA,MAAMS,oBAAoBxB,8BAA8B;QAAEiB,IAAID;IAAU,GAAwB;QAC9FS,kBAAkB;IACpB;IAEA,qGAAqG;IACrG,IACEN,eACA,CAACA,WAAW,CAAC,aAAa,IAC1B,CAACA,WAAW,CAAC,kBAAkB,IAC/BK,iBAAiB,CAAC,kBAAkB,EACpC;QACAL,WAAW,CAAC,kBAAkB,GAAGK,iBAAiB,CAAC,kBAAkB;IACvE;IAEA;;;GAGC,GACD,MAAME,cAAcvB,iBAClBF,eAAe,CAAC0B;QACdA,MAAMC,cAAc;IACtB,GAAGT,wBAAAA,kCAAAA,YAAaO,WAAW;IAG7B,MAAMG,UAAU1B,iBACdF,eAAe,CAAC0B;YAEdb;QADAa,MAAMC,cAAc;SACpBd,sBAAAA,WAAWgB,OAAO,cAAlBhB,0CAAAA,oBAAoBiB,KAAK;IAC3B,GAAGZ,wBAAAA,kCAAAA,YAAaU,OAAO;IAGzB,MAAMG,aAAa1B,cAAca,wBAAAA,kCAAAA,YAAaT,GAAG,EAAEA;IACnD,IAAIS,aAAa;QACfA,YAAYT,GAAG,GAAGsB;QAClBb,YAAYO,WAAW,GAAGA;QAC1BP,YAAYU,OAAO,GAAGA;IACxB;IAEA,OAAOV;AACT"}
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "useListboxSlot", {
10
10
  });
11
11
  const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
12
  const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
+ const _reactfield = require("@fluentui/react-field");
13
14
  const _reactutilities = require("@fluentui/react-utilities");
14
15
  const _Listbox = require("../Listbox");
15
16
  function useListboxSlot(listboxSlotFromProp, ref, options) {
@@ -25,6 +26,15 @@ function useListboxSlot(listboxSlotFromProp, ref, options) {
25
26
  ...defaultProps
26
27
  }
27
28
  });
29
+ const fieldControlProps = (0, _reactfield.useFieldControlProps_unstable)({
30
+ id: listboxId
31
+ }, {
32
+ supportsLabelFor: true
33
+ });
34
+ // Use the field's label to provide an accessible name for the listbox if it doesn't already have one
35
+ if (listboxSlot && !listboxSlot['aria-label'] && !listboxSlot['aria-labelledby'] && fieldControlProps['aria-labelledby']) {
36
+ listboxSlot['aria-labelledby'] = fieldControlProps['aria-labelledby'];
37
+ }
28
38
  /**
29
39
  * Clicking on the listbox should never blur the trigger
30
40
  * in a combobox
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/useListboxSlot.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n mergeCallbacks,\n useId,\n useEventCallback,\n slot,\n isResolvedShorthand,\n useMergedRefs,\n} from '@fluentui/react-utilities';\nimport type { ExtractSlotProps, Slot, SlotComponentType } from '@fluentui/react-utilities';\nimport type { ComboboxBaseState } from './ComboboxBase.types';\nimport { Listbox } from '../Listbox';\nimport { ListboxProps } from '../Listbox';\n\nexport type UseListboxSlotState = Pick<ComboboxBaseState, 'multiselect'>;\n\ntype UseListboxSlotOptions = {\n state: UseListboxSlotState;\n triggerRef:\n | React.RefObject<HTMLInputElement>\n | React.RefObject<HTMLButtonElement>\n | React.RefObject<HTMLButtonElement | HTMLInputElement>;\n defaultProps?: Partial<ListboxProps>;\n};\n\n/**\n * @internal\n * @returns listbox slot with desired behaviour and props\n */\nexport function useListboxSlot(\n listboxSlotFromProp: Slot<typeof Listbox> | undefined,\n ref: React.Ref<HTMLDivElement>,\n options: UseListboxSlotOptions,\n): SlotComponentType<ExtractSlotProps<Slot<typeof Listbox>>> | undefined {\n const {\n state: { multiselect },\n triggerRef,\n defaultProps,\n } = options;\n\n const listboxId = useId(\n 'fluent-listbox',\n isResolvedShorthand(listboxSlotFromProp) ? listboxSlotFromProp.id : undefined,\n );\n\n const listboxSlot = slot.optional(listboxSlotFromProp, {\n renderByDefault: true,\n elementType: Listbox,\n defaultProps: {\n id: listboxId,\n multiselect,\n tabIndex: undefined,\n ...defaultProps,\n },\n });\n\n /**\n * Clicking on the listbox should never blur the trigger\n * in a combobox\n */\n const onMouseDown = useEventCallback(\n mergeCallbacks((event: React.MouseEvent<HTMLDivElement>) => {\n event.preventDefault();\n }, listboxSlot?.onMouseDown),\n );\n\n const onClick = useEventCallback(\n mergeCallbacks((event: React.MouseEvent<HTMLDivElement>) => {\n event.preventDefault();\n triggerRef.current?.focus();\n }, listboxSlot?.onClick),\n );\n\n const listboxRef = useMergedRefs(listboxSlot?.ref, ref);\n if (listboxSlot) {\n listboxSlot.ref = listboxRef;\n listboxSlot.onMouseDown = onMouseDown;\n listboxSlot.onClick = onClick;\n }\n\n return listboxSlot;\n}\n"],"names":["useListboxSlot","listboxSlotFromProp","ref","options","state","multiselect","triggerRef","defaultProps","listboxId","useId","isResolvedShorthand","id","undefined","listboxSlot","slot","optional","renderByDefault","elementType","Listbox","tabIndex","onMouseDown","useEventCallback","mergeCallbacks","event","preventDefault","onClick","current","focus","listboxRef","useMergedRefs"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BA6BgBA;;;eAAAA;;;;iEA7BO;gCAQhB;yBAGiB;AAkBjB,SAASA,eACdC,mBAAqD,EACrDC,GAA8B,EAC9BC,OAA8B;IAE9B,MAAM,EACJC,OAAO,EAAEC,WAAW,EAAE,EACtBC,UAAU,EACVC,YAAY,EACb,GAAGJ;IAEJ,MAAMK,YAAYC,IAAAA,qBAAAA,EAChB,kBACAC,IAAAA,mCAAAA,EAAoBT,uBAAuBA,oBAAoBU,EAAE,GAAGC;IAGtE,MAAMC,cAAcC,oBAAAA,CAAKC,QAAQ,CAACd,qBAAqB;QACrDe,iBAAiB;QACjBC,aAAaC,gBAAAA;QACbX,cAAc;YACZI,IAAIH;YACJH;YACAc,UAAUP;YACV,GAAGL,YAAY;QACjB;IACF;IAEA;;;GAGC,GACD,MAAMa,cAAcC,IAAAA,gCAAAA,EAClBC,IAAAA,8BAAAA,EAAe,CAACC;QACdA,MAAMC,cAAc;IACtB,GAAGX,gBAAAA,QAAAA,gBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,YAAaO,WAAW;IAG7B,MAAMK,UAAUJ,IAAAA,gCAAAA,EACdC,IAAAA,8BAAAA,EAAe,CAACC;YAEdjB;QADAiB,MAAMC,cAAc;QACpBlB,CAAAA,sBAAAA,WAAWoB,OAAO,AAAPA,MAAO,QAAlBpB,wBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,oBAAoBqB,KAAK;IAC3B,GAAGd,gBAAAA,QAAAA,gBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,YAAaY,OAAO;IAGzB,MAAMG,aAAaC,IAAAA,6BAAAA,EAAchB,gBAAAA,QAAAA,gBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,YAAaX,GAAG,EAAEA;IACnD,IAAIW,aAAa;QACfA,YAAYX,GAAG,GAAG0B;QAClBf,YAAYO,WAAW,GAAGA;QAC1BP,YAAYY,OAAO,GAAGA;IACxB;IAEA,OAAOZ;AACT"}
1
+ {"version":3,"sources":["../src/utils/useListboxSlot.ts"],"sourcesContent":["import * as React from 'react';\nimport { type FieldControlProps, useFieldControlProps_unstable } from '@fluentui/react-field';\nimport {\n mergeCallbacks,\n useId,\n useEventCallback,\n slot,\n isResolvedShorthand,\n useMergedRefs,\n} from '@fluentui/react-utilities';\nimport type { ExtractSlotProps, Slot, SlotComponentType } from '@fluentui/react-utilities';\nimport type { ComboboxBaseState } from './ComboboxBase.types';\nimport { Listbox } from '../Listbox';\nimport { ListboxProps } from '../Listbox';\n\nexport type UseListboxSlotState = Pick<ComboboxBaseState, 'multiselect'>;\n\ntype UseListboxSlotOptions = {\n state: UseListboxSlotState;\n triggerRef:\n | React.RefObject<HTMLInputElement>\n | React.RefObject<HTMLButtonElement>\n | React.RefObject<HTMLButtonElement | HTMLInputElement>;\n defaultProps?: Partial<ListboxProps>;\n};\n\n/**\n * @internal\n * @returns listbox slot with desired behaviour and props\n */\nexport function useListboxSlot(\n listboxSlotFromProp: Slot<typeof Listbox> | undefined,\n ref: React.Ref<HTMLDivElement>,\n options: UseListboxSlotOptions,\n): SlotComponentType<ExtractSlotProps<Slot<typeof Listbox>>> | undefined {\n const {\n state: { multiselect },\n triggerRef,\n defaultProps,\n } = options;\n\n const listboxId = useId(\n 'fluent-listbox',\n isResolvedShorthand(listboxSlotFromProp) ? listboxSlotFromProp.id : undefined,\n );\n\n const listboxSlot = slot.optional(listboxSlotFromProp, {\n renderByDefault: true,\n elementType: Listbox,\n defaultProps: {\n id: listboxId,\n multiselect,\n tabIndex: undefined,\n ...defaultProps,\n },\n });\n\n const fieldControlProps = useFieldControlProps_unstable({ id: listboxId } as FieldControlProps, {\n supportsLabelFor: true,\n });\n\n // Use the field's label to provide an accessible name for the listbox if it doesn't already have one\n if (\n listboxSlot &&\n !listboxSlot['aria-label'] &&\n !listboxSlot['aria-labelledby'] &&\n fieldControlProps['aria-labelledby']\n ) {\n listboxSlot['aria-labelledby'] = fieldControlProps['aria-labelledby'];\n }\n\n /**\n * Clicking on the listbox should never blur the trigger\n * in a combobox\n */\n const onMouseDown = useEventCallback(\n mergeCallbacks((event: React.MouseEvent<HTMLDivElement>) => {\n event.preventDefault();\n }, listboxSlot?.onMouseDown),\n );\n\n const onClick = useEventCallback(\n mergeCallbacks((event: React.MouseEvent<HTMLDivElement>) => {\n event.preventDefault();\n triggerRef.current?.focus();\n }, listboxSlot?.onClick),\n );\n\n const listboxRef = useMergedRefs(listboxSlot?.ref, ref);\n if (listboxSlot) {\n listboxSlot.ref = listboxRef;\n listboxSlot.onMouseDown = onMouseDown;\n listboxSlot.onClick = onClick;\n }\n\n return listboxSlot;\n}\n"],"names":["useListboxSlot","listboxSlotFromProp","ref","options","state","multiselect","triggerRef","defaultProps","listboxId","useId","isResolvedShorthand","id","undefined","listboxSlot","slot","optional","renderByDefault","elementType","Listbox","tabIndex","fieldControlProps","useFieldControlProps_unstable","supportsLabelFor","onMouseDown","useEventCallback","mergeCallbacks","event","preventDefault","onClick","current","focus","listboxRef","useMergedRefs"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BA8BgBA;;;eAAAA;;;;iEA9BO;4BAC+C;gCAQ/D;yBAGiB;AAkBjB,SAASA,eACdC,mBAAqD,EACrDC,GAA8B,EAC9BC,OAA8B;IAE9B,MAAM,EACJC,OAAO,EAAEC,WAAW,EAAE,EACtBC,UAAU,EACVC,YAAY,EACb,GAAGJ;IAEJ,MAAMK,YAAYC,IAAAA,qBAAAA,EAChB,kBACAC,IAAAA,mCAAAA,EAAoBT,uBAAuBA,oBAAoBU,EAAE,GAAGC;IAGtE,MAAMC,cAAcC,oBAAAA,CAAKC,QAAQ,CAACd,qBAAqB;QACrDe,iBAAiB;QACjBC,aAAaC,gBAAAA;QACbX,cAAc;YACZI,IAAIH;YACJH;YACAc,UAAUP;YACV,GAAGL,YAAY;QACjB;IACF;IAEA,MAAMa,oBAAoBC,IAAAA,yCAAAA,EAA8B;QAAEV,IAAIH;IAAU,GAAwB;QAC9Fc,kBAAkB;IACpB;IAEA,qGAAqG;IACrG,IACET,eACA,CAACA,WAAW,CAAC,aAAa,IAC1B,CAACA,WAAW,CAAC,kBAAkB,IAC/BO,iBAAiB,CAAC,kBAAkB,EACpC;QACAP,WAAW,CAAC,kBAAkB,GAAGO,iBAAiB,CAAC,kBAAkB;IACvE;IAEA;;;GAGC,GACD,MAAMG,cAAcC,IAAAA,gCAAAA,EAClBC,IAAAA,8BAAAA,EAAe,CAACC;QACdA,MAAMC,cAAc;IACtB,GAAGd,gBAAAA,QAAAA,gBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,YAAaU,WAAW;IAG7B,MAAMK,UAAUJ,IAAAA,gCAAAA,EACdC,IAAAA,8BAAAA,EAAe,CAACC;YAEdpB;QADAoB,MAAMC,cAAc;QACpBrB,CAAAA,sBAAAA,WAAWuB,OAAO,AAAPA,MAAO,QAAlBvB,wBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,oBAAoBwB,KAAK;IAC3B,GAAGjB,gBAAAA,QAAAA,gBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,YAAae,OAAO;IAGzB,MAAMG,aAAaC,IAAAA,6BAAAA,EAAcnB,gBAAAA,QAAAA,gBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,YAAaX,GAAG,EAAEA;IACnD,IAAIW,aAAa;QACfA,YAAYX,GAAG,GAAG6B;QAClBlB,YAAYU,WAAW,GAAGA;QAC1BV,YAAYe,OAAO,GAAGA;IACxB;IAEA,OAAOf;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-combobox",
3
- "version": "9.14.4",
3
+ "version": "9.14.5",
4
4
  "description": "Fluent UI React Combobox component",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -19,18 +19,18 @@
19
19
  "@fluentui/scripts-cypress": "*"
20
20
  },
21
21
  "dependencies": {
22
- "@fluentui/react-aria": "^9.14.4",
22
+ "@fluentui/react-aria": "^9.14.5",
23
23
  "@fluentui/keyboard-keys": "^9.0.8",
24
- "@fluentui/react-context-selector": "^9.1.75",
25
- "@fluentui/react-field": "^9.2.4",
24
+ "@fluentui/react-context-selector": "^9.1.76",
25
+ "@fluentui/react-field": "^9.2.5",
26
26
  "@fluentui/react-icons": "^2.0.245",
27
- "@fluentui/react-jsx-runtime": "^9.0.53",
28
- "@fluentui/react-portal": "^9.5.4",
29
- "@fluentui/react-positioning": "^9.16.6",
27
+ "@fluentui/react-jsx-runtime": "^9.0.54",
28
+ "@fluentui/react-portal": "^9.5.5",
29
+ "@fluentui/react-positioning": "^9.16.7",
30
30
  "@fluentui/react-shared-contexts": "^9.23.1",
31
- "@fluentui/react-tabster": "^9.24.4",
31
+ "@fluentui/react-tabster": "^9.24.5",
32
32
  "@fluentui/react-theme": "^9.1.24",
33
- "@fluentui/react-utilities": "^9.18.23",
33
+ "@fluentui/react-utilities": "^9.19.0",
34
34
  "@griffel/react": "^1.5.22",
35
35
  "@swc/helpers": "^0.5.1"
36
36
  },