downshift 9.2.0 → 9.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/README.md +6 -7
  2. package/dist/{downshift.cjs.js → downshift.cjs.cjs} +86 -78
  3. package/dist/{downshift.esm.js → downshift.esm.mjs} +86 -78
  4. package/dist/{downshift.native.cjs.js → downshift.native.cjs.cjs} +86 -78
  5. package/dist/{downshift.nativeweb.cjs.js → downshift.nativeweb.cjs.cjs} +86 -78
  6. package/dist/downshift.umd.js +121 -98
  7. package/dist/downshift.umd.js.map +1 -1
  8. package/dist/downshift.umd.min.js +1 -1
  9. package/dist/downshift.umd.min.js.map +1 -1
  10. package/dist/hooks/useCombobox/index.d.ts +12 -12
  11. package/dist/hooks/useSelect/index.d.ts +7 -7
  12. package/dist/hooks/useTagGroup/__tests__/utils/renderTagGroup.d.ts +1 -1
  13. package/dist/hooks/useTagGroup/utils/index.d.ts +1 -1
  14. package/dist/hooks/useTagGroup/utils/useElementIds.d.ts +10 -3
  15. package/dist/hooks/utils.d.ts +0 -27
  16. package/dist/hooks/utils.dropdown/__tests__/useElementIds.legacy.test.d.ts +1 -0
  17. package/dist/hooks/utils.dropdown/__tests__/useElementIds.r18.test.d.ts +1 -0
  18. package/dist/hooks/utils.dropdown/useElementIds.d.ts +18 -0
  19. package/package.json +46 -44
  20. package/preact/dist/{downshift.cjs.js → downshift.cjs.cjs} +86 -78
  21. package/preact/dist/{downshift.esm.js → downshift.esm.mjs} +86 -78
  22. package/preact/dist/downshift.umd.js +97 -81
  23. package/preact/dist/downshift.umd.js.map +1 -1
  24. package/preact/dist/downshift.umd.min.js +1 -10
  25. package/preact/dist/downshift.umd.min.js.map +1 -1
  26. package/preact/package.json +3 -3
  27. /package/dist/hooks/useTagGroup/utils/__tests__/{utils.use-element-ids.r18.test.d.ts → useElementIds.legacy.test.d.ts} +0 -0
  28. /package/dist/hooks/useTagGroup/utils/__tests__/{utils.use-element-ids.test.d.ts → useElementIds.r18.test.d.ts} +0 -0
@@ -15,7 +15,7 @@ declare function useCombobox(userProps?: {}): {
15
15
  onMouseDown: Function;
16
16
  'aria-disabled': boolean;
17
17
  'aria-selected': boolean;
18
- id: any;
18
+ id: string;
19
19
  role: string;
20
20
  };
21
21
  getLabelProps: (labelProps: any) => any;
@@ -26,7 +26,7 @@ declare function useCombobox(userProps?: {}): {
26
26
  }, { suppressRefError }?: {
27
27
  suppressRefError?: boolean | undefined;
28
28
  }) => {
29
- id: any;
29
+ id: string;
30
30
  role: string;
31
31
  'aria-labelledby': string | undefined;
32
32
  onMouseLeave: Function;
@@ -45,13 +45,13 @@ declare function useCombobox(userProps?: {}): {
45
45
  }) => {
46
46
  onChange: Function;
47
47
  onChangeText: Function;
48
- 'aria-activedescendant': any;
48
+ 'aria-activedescendant': string;
49
49
  'aria-autocomplete': string;
50
- 'aria-controls': any;
50
+ 'aria-controls': string;
51
51
  'aria-expanded': any;
52
- 'aria-labelledby': any;
52
+ 'aria-labelledby': string | undefined;
53
53
  autoComplete: string;
54
- id: any;
54
+ id: string;
55
55
  role: string;
56
56
  value: any;
57
57
  };
@@ -61,21 +61,21 @@ declare function useCombobox(userProps?: {}): {
61
61
  refKey?: string | undefined;
62
62
  ref: any;
63
63
  }) => {
64
- 'aria-controls': any;
64
+ 'aria-controls': string;
65
65
  'aria-expanded': any;
66
- id: any;
66
+ id: string;
67
67
  tabIndex: number;
68
68
  } | {
69
69
  onPress: Function;
70
- 'aria-controls': any;
70
+ 'aria-controls': string;
71
71
  'aria-expanded': any;
72
- id: any;
72
+ id: string;
73
73
  tabIndex: number;
74
74
  } | {
75
75
  onClick: Function;
76
- 'aria-controls': any;
76
+ 'aria-controls': string;
77
77
  'aria-expanded': any;
78
- id: any;
78
+ id: string;
79
79
  tabIndex: number;
80
80
  };
81
81
  toggleMenu: () => void;
@@ -10,12 +10,12 @@ declare function useSelect(userProps?: {}): {
10
10
  }, { suppressRefError }?: {
11
11
  suppressRefError?: boolean | undefined;
12
12
  }) => {
13
- 'aria-activedescendant': any;
14
- 'aria-controls': any;
13
+ 'aria-activedescendant': string;
14
+ 'aria-controls': string;
15
15
  'aria-expanded': any;
16
16
  'aria-haspopup': string;
17
17
  'aria-labelledby': string | undefined;
18
- id: any;
18
+ id: string;
19
19
  role: string;
20
20
  tabIndex: number;
21
21
  onBlur: Function;
@@ -23,8 +23,8 @@ declare function useSelect(userProps?: {}): {
23
23
  getLabelProps: ({ onClick, ...labelProps }?: {
24
24
  onClick: any;
25
25
  }) => {
26
- id: any;
27
- htmlFor: any;
26
+ id: string;
27
+ htmlFor: string;
28
28
  onClick: Function;
29
29
  };
30
30
  getMenuProps: ({ onMouseLeave, refKey, ref, ...rest }?: {
@@ -34,7 +34,7 @@ declare function useSelect(userProps?: {}): {
34
34
  }, { suppressRefError }?: {
35
35
  suppressRefError?: boolean | undefined;
36
36
  }) => {
37
- id: any;
37
+ id: string;
38
38
  role: string;
39
39
  'aria-labelledby': string | undefined;
40
40
  onMouseLeave: Function;
@@ -52,7 +52,7 @@ declare function useSelect(userProps?: {}): {
52
52
  }) => {
53
53
  'aria-disabled': boolean;
54
54
  'aria-selected': boolean;
55
- id: any;
55
+ id: string;
56
56
  role: string;
57
57
  };
58
58
  toggleMenu: () => void;
@@ -9,7 +9,7 @@ export declare function renderTagGroup(props?: Partial<UseTagGroupProps<string>>
9
9
  user: import("@testing-library/user-event").UserEvent;
10
10
  container: HTMLElement;
11
11
  baseElement: HTMLElement;
12
- debug: (baseElement?: Document | import("react-dom/client").Container | (Document | import("react-dom/client").Container)[] | undefined, maxLength?: number | undefined, options?: import("pretty-format").PrettyFormatOptions | undefined) => void;
12
+ debug: (baseElement?: any, maxLength?: number | undefined, options?: import("pretty-format").PrettyFormatOptions | undefined) => void;
13
13
  rerender: (ui: React.ReactNode) => void;
14
14
  unmount: () => void;
15
15
  asFragment: () => DocumentFragment;
@@ -1,5 +1,5 @@
1
1
  import PropTypes from 'prop-types';
2
- export { type UseElementIdsProps, type UseElementIdsReturnValue, useElementIds, } from './useElementIds';
2
+ export { useElementIds } from './useElementIds';
3
3
  export { getInitialState } from './getInitialState';
4
4
  export { isStateEqual } from './isStateEqual';
5
5
  export { useAccessibleDescription, A11Y_DESCRIPTION_ELEMENT_ID, } from './useAccessibleDescription';
@@ -1,4 +1,11 @@
1
- import { UseTagGroupProps } from '../index.types';
2
- export type UseElementIdsProps = Pick<UseTagGroupProps<unknown>, 'id' | 'getTagId' | 'tagGroupId'>;
3
- export type UseElementIdsReturnValue = Required<Pick<UseTagGroupProps<unknown>, 'getTagId' | 'tagGroupId'>>;
1
+ type UseElementIdsProps = {
2
+ id?: string;
3
+ tagGroupId?: string;
4
+ getTagId?: (index: number) => string;
5
+ };
6
+ type UseElementIdsReturnValue = {
7
+ tagGroupId: string;
8
+ getTagId: (index: number) => string;
9
+ };
4
10
  export declare const useElementIds: (props: UseElementIdsProps) => UseElementIdsReturnValue;
11
+ export {};
@@ -23,33 +23,6 @@ export function useMouseAndTouchTracker(environment: Window, handleBlur: () => v
23
23
  };
24
24
  export function getHighlightedIndexOnOpen(props: any, state: any, offset: any): any;
25
25
  export function isAcceptedCharacterKey(key: any): boolean;
26
- export const useElementIds: (({ id, labelId, menuId, getItemId, toggleButtonId, inputId, }: {
27
- id: any;
28
- labelId: any;
29
- menuId: any;
30
- getItemId: any;
31
- toggleButtonId: any;
32
- inputId: any;
33
- }) => {
34
- labelId: any;
35
- menuId: any;
36
- getItemId: any;
37
- toggleButtonId: any;
38
- inputId: any;
39
- }) | (({ id, labelId, menuId, getItemId, toggleButtonId, inputId, }: {
40
- id?: string | undefined;
41
- labelId: any;
42
- menuId: any;
43
- getItemId: any;
44
- toggleButtonId: any;
45
- inputId: any;
46
- }) => {
47
- labelId: any;
48
- menuId: any;
49
- getItemId: any;
50
- toggleButtonId: any;
51
- inputId: any;
52
- });
53
26
  /**
54
27
  * Handles selection on Enter / Alt + ArrowUp. Closes the menu and resets the highlighted index, unless there is a highlighted.
55
28
  * In that case, selects the item and resets to defaults for open state and highlighted idex.
@@ -0,0 +1,18 @@
1
+ type UseElementIdsProps = {
2
+ id?: string;
3
+ labelId?: string;
4
+ menuId?: string;
5
+ getItemId?: (index: number) => string;
6
+ toggleButtonId?: string;
7
+ inputId?: string;
8
+ };
9
+ type UseElementIdsReturnValue = {
10
+ labelId: string;
11
+ menuId: string;
12
+ getItemId: (index: number) => string;
13
+ toggleButtonId: string;
14
+ inputId: string;
15
+ };
16
+ export declare const useElementIds: typeof useElementIdsR18;
17
+ declare function useElementIdsR18({ id, labelId, menuId, getItemId, toggleButtonId, inputId, }: UseElementIdsProps): UseElementIdsReturnValue;
18
+ export {};
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "downshift",
3
- "version": "9.2.0",
3
+ "version": "9.3.1",
4
4
  "description": "🏎 A set of primitives to build simple, flexible, WAI-ARIA compliant React autocomplete, combobox or select dropdown components.",
5
- "main": "dist/downshift.cjs.js",
6
- "react-native": "dist/downshift.native.cjs.js",
7
- "module": "dist/downshift.esm.js",
5
+ "main": "dist/downshift.cjs.cjs",
6
+ "react-native": "dist/downshift.native.cjs.cjs",
7
+ "module": "dist/downshift.esm.mjs",
8
8
  "typings": "typings/index.d.ts",
9
9
  "types": "typings/index.d.ts",
10
10
  "sideEffects": false,
@@ -50,13 +50,13 @@
50
50
  ],
51
51
  "exports": {
52
52
  ".": {
53
- "import": "./dist/downshift.esm.js",
54
- "require": "./dist/downshift.cjs.js",
53
+ "import": "./dist/downshift.esm.mjs",
54
+ "require": "./dist/downshift.cjs.cjs",
55
55
  "types": "./typings/index.d.ts",
56
- "default": "./dist/downshift.esm.js"
56
+ "default": "./dist/downshift.esm.mjs"
57
57
  },
58
58
  "./react-native": {
59
- "require": "./dist/downshift.native.cjs.js",
59
+ "require": "./dist/downshift.native.cjs.cjs",
60
60
  "types": "./typings/index.d.ts"
61
61
  }
62
62
  },
@@ -81,58 +81,60 @@
81
81
  "react": ">=16.12.0"
82
82
  },
83
83
  "dependencies": {
84
- "@babel/runtime": "^7.24.5",
85
- "compute-scroll-into-view": "^3.1.0",
84
+ "@babel/runtime": "^7.28.6",
85
+ "compute-scroll-into-view": "^3.1.1",
86
86
  "prop-types": "^15.8.1",
87
- "react-is": "18.2.0",
88
- "tslib": "^2.6.2"
87
+ "react-is": "^18.2.0",
88
+ "tslib": "^2.8.1"
89
89
  },
90
90
  "devDependencies": {
91
- "@babel/helpers": "^7.24.5",
91
+ "@babel/helpers": "^7.28.6",
92
92
  "@babel/plugin-proposal-private-methods": "^7.18.6",
93
93
  "@babel/plugin-proposal-private-property-in-object": "^7.21.11",
94
- "@cypress/webpack-preprocessor": "^6.0.1",
94
+ "@cypress/webpack-preprocessor": "^7.0.2",
95
95
  "@docusaurus/core": "3.3.2",
96
96
  "@docusaurus/module-type-aliases": "3.3.2",
97
97
  "@docusaurus/preset-classic": "3.3.2",
98
98
  "@mdx-js/react": "^3.0.1",
99
- "@rollup/plugin-babel": "^6.0.4",
100
- "@rollup/plugin-commonjs": "^25.0.7",
101
- "@testing-library/cypress": "^10.0.1",
102
- "@testing-library/dom": "^10.1.0",
103
- "@testing-library/jest-dom": "^6.4.5",
104
- "@testing-library/preact": "^2.0.1",
105
- "@testing-library/react": "^15.0.7",
106
- "@testing-library/user-event": "^14.5.2",
107
- "@types/jest": "^29.5.12",
108
- "@types/react": "^18.3.2",
109
- "@typescript-eslint/eslint-plugin": "^7.9.0",
110
- "@typescript-eslint/parser": "^7.9.0",
99
+ "@rollup/plugin-babel": "^6.1.0",
100
+ "@rollup/plugin-commonjs": "^29.0.0",
101
+ "@testing-library/cypress": "^10.1.0",
102
+ "@testing-library/dom": "^10.4.1",
103
+ "@testing-library/jest-dom": "^6.9.1",
104
+ "@testing-library/preact": "^3.2.4",
105
+ "@testing-library/react": "^16.3.2",
106
+ "@testing-library/user-event": "^14.6.1",
107
+ "@types/jest": "^30.0.0",
108
+ "@types/prop-types": "^15.7.15",
109
+ "@types/react": "^18.2.0",
110
+ "@typescript-eslint/eslint-plugin": "^8.54.0",
111
+ "@typescript-eslint/parser": "^8.54.0",
111
112
  "babel-plugin-macros": "^3.1.0",
112
113
  "babel-plugin-no-side-effect-class-properties": "0.0.7",
113
114
  "babel-preset-react-native": "^4.0.1",
114
115
  "buble": "^0.20.0",
115
- "cpy-cli": "^5.0.0",
116
- "cross-env": "^7.0.3",
117
- "cypress": "13.9.0",
118
- "eslint": "^8.56.0",
119
- "eslint-plugin-cypress": "^3.2.0",
120
- "eslint-plugin-react": "7.34.1",
121
- "flow-bin": "^0.236.0",
116
+ "cpy-cli": "^6.0.0",
117
+ "cross-env": "^10.1.0",
118
+ "cypress": "15.9.0",
119
+ "eslint": "^8.57.0",
120
+ "eslint-plugin-cypress": "^3.6.0",
121
+ "eslint-plugin-react": "7.37.5",
122
+ "flow-bin": "^0.299.0",
122
123
  "flow-coverage-report": "^0.8.0",
123
124
  "get-pkg-repo": "5.0.0",
124
- "kcd-scripts": "^15.0.1",
125
- "node-polyfill-webpack-plugin": "^3.0.0",
125
+ "kcd-scripts": "^17.0.0",
126
+ "node-polyfill-webpack-plugin": "^4.1.0",
126
127
  "npm-run-all": "^4.1.5",
127
- "preact": "^10.22.0",
128
- "prism-react-renderer": "^2.3.1",
129
- "react": "18.2.0",
130
- "react-dom": "18.2.0",
131
- "react-native": "^0.74.1",
132
- "react-test-renderer": "18.2.0",
133
- "serve": "^14.2.3",
134
- "start-server-and-test": "^2.0.3",
135
- "typescript": "^5.4.5"
128
+ "preact": "^10.28.2",
129
+ "prism-react-renderer": "^2.4.1",
130
+ "react": "^18.3.1",
131
+ "react-dom": "^18.3.1",
132
+ "react-is": "^18.3.1",
133
+ "react-native": "^0.76.0",
134
+ "react-test-renderer": "^18.3.1",
135
+ "serve": "^14.2.5",
136
+ "start-server-and-test": "^2.1.3",
137
+ "typescript": "^5.9.3"
136
138
  },
137
139
  "eslintConfig": {
138
140
  "parserOptions": {
@@ -1878,54 +1878,6 @@ var defaultStateValues$1 = {
1878
1878
 
1879
1879
  // istanbul ignore next
1880
1880
  var useIsomorphicLayoutEffect = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined' ? React__namespace.useLayoutEffect : React__namespace.useEffect;
1881
-
1882
- // istanbul ignore next
1883
- var useElementIds$1 = 'useId' in React__namespace // Avoid conditional useId call
1884
- ? function useElementIds(_ref) {
1885
- var id = _ref.id,
1886
- labelId = _ref.labelId,
1887
- menuId = _ref.menuId,
1888
- getItemId = _ref.getItemId,
1889
- toggleButtonId = _ref.toggleButtonId,
1890
- inputId = _ref.inputId;
1891
- // Avoid conditional useId call
1892
- var reactId = "downshift-" + React__namespace.useId();
1893
- if (!id) {
1894
- id = reactId;
1895
- }
1896
- var elementIds = React__namespace.useMemo(function () {
1897
- return {
1898
- labelId: labelId || id + "-label",
1899
- menuId: menuId || id + "-menu",
1900
- getItemId: getItemId || function (index) {
1901
- return id + "-item-" + index;
1902
- },
1903
- toggleButtonId: toggleButtonId || id + "-toggle-button",
1904
- inputId: inputId || id + "-input"
1905
- };
1906
- }, [getItemId, id, inputId, labelId, menuId, toggleButtonId]);
1907
- return elementIds;
1908
- } : function useElementIds(_ref2) {
1909
- var _ref2$id = _ref2.id,
1910
- id = _ref2$id === void 0 ? "downshift-" + generateId() : _ref2$id,
1911
- labelId = _ref2.labelId,
1912
- menuId = _ref2.menuId,
1913
- getItemId = _ref2.getItemId,
1914
- toggleButtonId = _ref2.toggleButtonId,
1915
- inputId = _ref2.inputId;
1916
- var elementIds = React__namespace.useMemo(function () {
1917
- return {
1918
- labelId: labelId || id + "-label",
1919
- menuId: menuId || id + "-menu",
1920
- getItemId: getItemId || function (index) {
1921
- return id + "-item-" + index;
1922
- },
1923
- toggleButtonId: toggleButtonId || id + "-toggle-button",
1924
- inputId: inputId || id + "-input"
1925
- };
1926
- }, [getItemId, id, inputId, labelId, menuId, toggleButtonId]);
1927
- return elementIds;
1928
- };
1929
1881
  function isAcceptedCharacterKey(key) {
1930
1882
  return /^\S{1}$/.test(key);
1931
1883
  }
@@ -2088,13 +2040,13 @@ if (process.env.NODE_ENV !== 'production') {
2088
2040
  return setGetterPropCallInfo;
2089
2041
  };
2090
2042
  }
2091
- function useScrollIntoView(_ref3) {
2092
- var highlightedIndex = _ref3.highlightedIndex,
2093
- isOpen = _ref3.isOpen,
2094
- itemRefs = _ref3.itemRefs,
2095
- getItemNodeFromIndex = _ref3.getItemNodeFromIndex,
2096
- menuElement = _ref3.menuElement,
2097
- scrollIntoViewProp = _ref3.scrollIntoView;
2043
+ function useScrollIntoView(_ref) {
2044
+ var highlightedIndex = _ref.highlightedIndex,
2045
+ isOpen = _ref.isOpen,
2046
+ itemRefs = _ref.itemRefs,
2047
+ getItemNodeFromIndex = _ref.getItemNodeFromIndex,
2048
+ menuElement = _ref.menuElement,
2049
+ scrollIntoViewProp = _ref.scrollIntoView;
2098
2050
  // used not to scroll on highlight by mouse.
2099
2051
  var shouldScrollRef = React__namespace.useRef(true);
2100
2052
  // Scroll on highlighted item if change comes from keyboard.
@@ -2116,9 +2068,9 @@ function useScrollIntoView(_ref3) {
2116
2068
  var useControlPropsValidator = noop;
2117
2069
  /* istanbul ignore next */
2118
2070
  if (process.env.NODE_ENV !== 'production') {
2119
- useControlPropsValidator = function useControlPropsValidator(_ref4) {
2120
- var props = _ref4.props,
2121
- state = _ref4.state;
2071
+ useControlPropsValidator = function useControlPropsValidator(_ref2) {
2072
+ var props = _ref2.props,
2073
+ state = _ref2.state;
2122
2074
  // used for checking when props are moving from controlled to uncontrolled.
2123
2075
  var prevPropsRef = React__namespace.useRef(props);
2124
2076
  var isInitialMount = useIsInitialMount();
@@ -2441,6 +2393,56 @@ function downshiftSelectReducer(state, props, action) {
2441
2393
  }
2442
2394
  /* eslint-enable complexity */
2443
2395
 
2396
+ // eslint-disable-next-line @typescript-eslint/dot-notation
2397
+ var reactUseId$1 = React__namespace['useId'];
2398
+ var useElementIds$1 = typeof reactUseId$1 === 'function' ? useElementIdsR18$1 : useElementIdsLegacy$1;
2399
+ function useElementIdsR18$1(_ref) {
2400
+ var id = _ref.id,
2401
+ labelId = _ref.labelId,
2402
+ menuId = _ref.menuId,
2403
+ getItemId = _ref.getItemId,
2404
+ toggleButtonId = _ref.toggleButtonId,
2405
+ inputId = _ref.inputId;
2406
+ var reactId = "downshift-" + reactUseId$1();
2407
+ if (!id) {
2408
+ id = reactId;
2409
+ }
2410
+ var elementIds = React__namespace.useMemo(function () {
2411
+ return {
2412
+ labelId: labelId != null ? labelId : id + "-label",
2413
+ menuId: menuId != null ? menuId : id + "-menu",
2414
+ getItemId: getItemId != null ? getItemId : function (index) {
2415
+ return id + "-item-" + index;
2416
+ },
2417
+ toggleButtonId: toggleButtonId != null ? toggleButtonId : id + "-toggle-button",
2418
+ inputId: inputId != null ? inputId : id + "-input"
2419
+ };
2420
+ }, [getItemId, id, inputId, labelId, menuId, toggleButtonId]);
2421
+ return elementIds;
2422
+ }
2423
+ function useElementIdsLegacy$1(_ref2) {
2424
+ var id = _ref2.id,
2425
+ labelId = _ref2.labelId,
2426
+ menuId = _ref2.menuId,
2427
+ getItemId = _ref2.getItemId,
2428
+ toggleButtonId = _ref2.toggleButtonId,
2429
+ inputId = _ref2.inputId;
2430
+ var baseIdRef = React__namespace.useRef(id != null ? id : "downshift-" + generateId());
2431
+ var baseId = baseIdRef.current;
2432
+ var elementIds = React__namespace.useMemo(function () {
2433
+ return {
2434
+ labelId: labelId != null ? labelId : baseId + "-label",
2435
+ menuId: menuId != null ? menuId : baseId + "-menu",
2436
+ getItemId: getItemId != null ? getItemId : function (index) {
2437
+ return baseId + "-item-" + index;
2438
+ },
2439
+ toggleButtonId: toggleButtonId != null ? toggleButtonId : baseId + "-toggle-button",
2440
+ inputId: inputId != null ? inputId : baseId + "-input"
2441
+ };
2442
+ }, [getItemId, inputId, labelId, menuId, toggleButtonId, baseId]);
2443
+ return elementIds;
2444
+ }
2445
+
2444
2446
  var _excluded$3 = ["onClick"],
2445
2447
  _excluded2$3 = ["onMouseLeave", "refKey", "ref"],
2446
2448
  _excluded3$2 = ["onBlur", "onClick", "onPress", "onKeyDown", "refKey", "ref"],
@@ -4012,38 +4014,44 @@ function useTagGroupReducer(state, _props, action) {
4012
4014
  return _extends({}, state, changes);
4013
4015
  }
4014
4016
 
4017
+ // eslint-disable-next-line @typescript-eslint/dot-notation
4018
+ var reactUseId = React__namespace['useId'];
4019
+
4015
4020
  // istanbul ignore next
4016
- var useElementIds = 'useId' in React__namespace // Avoid conditional useId call
4017
- ? useElementIdsR18 : useElementIdsLegacy;
4021
+ var useElementIds = typeof reactUseId === 'function' ? useElementIdsR18 : useElementIdsLegacy;
4018
4022
  function useElementIdsR18(_ref) {
4019
4023
  var id = _ref.id,
4020
4024
  tagGroupId = _ref.tagGroupId,
4021
4025
  getTagId = _ref.getTagId;
4022
- // Avoid conditional useId call
4023
- var reactId = "downshift-" + React__namespace.useId();
4026
+ var reactId = "downshift-" + reactUseId();
4024
4027
  if (!id) {
4025
4028
  id = reactId;
4026
4029
  }
4027
- var elementIdsRef = React__namespace.useRef({
4028
- tagGroupId: tagGroupId != null ? tagGroupId : id + "-tag-group",
4029
- getTagId: getTagId != null ? getTagId : function (index) {
4030
- return id + "-tag-" + index;
4031
- }
4032
- });
4033
- return elementIdsRef.current;
4030
+ var elementIds = React__namespace.useMemo(function () {
4031
+ return {
4032
+ tagGroupId: tagGroupId != null ? tagGroupId : id + "-tag-group",
4033
+ getTagId: getTagId != null ? getTagId : function (index) {
4034
+ return id + "-tag-" + index;
4035
+ }
4036
+ };
4037
+ }, [getTagId, id, tagGroupId]);
4038
+ return elementIds;
4034
4039
  }
4035
4040
  function useElementIdsLegacy(_ref2) {
4036
- var _ref2$id = _ref2.id,
4037
- id = _ref2$id === void 0 ? "downshift-" + generateId() : _ref2$id,
4041
+ var id = _ref2.id,
4038
4042
  getTagId = _ref2.getTagId,
4039
4043
  tagGroupId = _ref2.tagGroupId;
4040
- var elementIdsRef = React__namespace.useRef({
4041
- tagGroupId: tagGroupId != null ? tagGroupId : id + "-tag-group",
4042
- getTagId: getTagId != null ? getTagId : function (index) {
4043
- return id + "-tag-" + index;
4044
- }
4045
- });
4046
- return elementIdsRef.current;
4044
+ var baseIdRef = React__namespace.useRef(id != null ? id : "downshift-" + generateId());
4045
+ var baseId = baseIdRef.current;
4046
+ var elementIds = React__namespace.useMemo(function () {
4047
+ return {
4048
+ tagGroupId: tagGroupId != null ? tagGroupId : baseId + "-tag-group",
4049
+ getTagId: getTagId != null ? getTagId : function (index) {
4050
+ return baseId + "-tag-" + index;
4051
+ }
4052
+ };
4053
+ }, [getTagId, baseId, tagGroupId]);
4054
+ return elementIds;
4047
4055
  }
4048
4056
 
4049
4057
  function getInitialState(props) {