@atlaskit/dropdown-menu 12.21.0 → 12.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/dropdown-menu
2
2
 
3
+ ## 12.21.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#157534](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/157534)
8
+ [`ca0824645f3a5`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ca0824645f3a5) -
9
+ Remove the use of Math.random for the generation of IDs
10
+
3
11
  ## 12.21.0
4
12
 
5
13
  ### Minor Changes
@@ -5,22 +5,14 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.PREFIX = void 0;
7
7
  exports.default = useGeneratedId;
8
- var _react = require("react");
8
+ var _useId = require("@atlaskit/ds-lib/use-id");
9
9
  var PREFIX = exports.PREFIX = 'ds--dropdown--';
10
- var generateRandomString = function generateRandomString() {
11
- return (// This string is used only on client side usually triggered after a user interaction.
12
- // Therefore, so there is no risk of mismatch
13
- // between server and client generated markup.
14
- // eslint-disable-next-line @repo/internal/react/disallow-unstable-values
15
- "".concat(PREFIX).concat(Math.random().toString(16).substr(2, 8))
16
- );
17
- };
18
10
 
19
11
  /**
20
12
  * useGeneratedId generates a random string which remains constant across
21
13
  * renders when called without any parameter.
22
14
  */
23
15
  function useGeneratedId() {
24
- var cachedId = (0, _react.useRef)(generateRandomString());
25
- return cachedId.current;
16
+ var id = (0, _useId.useId)();
17
+ return "".concat(PREFIX).concat(id);
26
18
  }
@@ -1,17 +1,11 @@
1
- import { useRef } from 'react';
1
+ import { useId } from '@atlaskit/ds-lib/use-id';
2
2
  export const PREFIX = 'ds--dropdown--';
3
- const generateRandomString = () =>
4
- // This string is used only on client side usually triggered after a user interaction.
5
- // Therefore, so there is no risk of mismatch
6
- // between server and client generated markup.
7
- // eslint-disable-next-line @repo/internal/react/disallow-unstable-values
8
- `${PREFIX}${Math.random().toString(16).substr(2, 8)}`;
9
3
 
10
4
  /**
11
5
  * useGeneratedId generates a random string which remains constant across
12
6
  * renders when called without any parameter.
13
7
  */
14
8
  export default function useGeneratedId() {
15
- const cachedId = useRef(generateRandomString());
16
- return cachedId.current;
9
+ const id = useId();
10
+ return `${PREFIX}${id}`;
17
11
  }
@@ -1,19 +1,11 @@
1
- import { useRef } from 'react';
1
+ import { useId } from '@atlaskit/ds-lib/use-id';
2
2
  export var PREFIX = 'ds--dropdown--';
3
- var generateRandomString = function generateRandomString() {
4
- return (// This string is used only on client side usually triggered after a user interaction.
5
- // Therefore, so there is no risk of mismatch
6
- // between server and client generated markup.
7
- // eslint-disable-next-line @repo/internal/react/disallow-unstable-values
8
- "".concat(PREFIX).concat(Math.random().toString(16).substr(2, 8))
9
- );
10
- };
11
3
 
12
4
  /**
13
5
  * useGeneratedId generates a random string which remains constant across
14
6
  * renders when called without any parameter.
15
7
  */
16
8
  export default function useGeneratedId() {
17
- var cachedId = useRef(generateRandomString());
18
- return cachedId.current;
9
+ var id = useId();
10
+ return "".concat(PREFIX).concat(id);
19
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/dropdown-menu",
3
- "version": "12.21.0",
3
+ "version": "12.21.1",
4
4
  "description": "A dropdown menu displays a list of actions or options to a user.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -26,7 +26,7 @@
26
26
  "@atlaskit/button": "^20.3.0",
27
27
  "@atlaskit/codemod-utils": "^4.2.0",
28
28
  "@atlaskit/ds-lib": "^3.1.0",
29
- "@atlaskit/icon": "^22.23.0",
29
+ "@atlaskit/icon": "^22.24.0",
30
30
  "@atlaskit/layering": "^0.7.0",
31
31
  "@atlaskit/menu": "^2.13.0",
32
32
  "@atlaskit/platform-feature-flags": "^0.3.0",