@atlaskit/dropdown-menu 12.20.4 → 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,25 @@
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
+
11
+ ## 12.21.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [#155054](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/155054)
16
+ [`5e7c49fc3d545`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5e7c49fc3d545) -
17
+ Updated group title styles to use modernized typography.
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies
22
+
3
23
  ## 12.20.4
4
24
 
5
25
  ### Patch Changes
@@ -1,31 +1,17 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.default = void 0;
7
- var _react = require("@emotion/react");
8
- var _colors = require("@atlaskit/theme/colors");
9
- var _typography = require("@atlaskit/theme/typography");
10
- /**
11
- * @jsxRuntime classic
12
- * @jsx jsx
13
- */
14
-
15
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
16
-
17
- var itemHeadingContentHeight = _typography.headingSizes.h100.lineHeight;
18
- var itemHeadingFontSize = _typography.headingSizes.h100.size;
19
- var headingStyles = (0, _react.css)({
20
- color: "var(--ds-text-subtle, ".concat(_colors.N300, ")"),
21
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
22
- fontSize: itemHeadingFontSize,
23
- fontWeight: "var(--ds-font-weight-bold, 700)",
24
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
25
- lineHeight: itemHeadingContentHeight / itemHeadingFontSize,
26
- paddingBlock: "var(--ds-space-0, 0px)",
27
- paddingInline: "var(--ds-space-200, 16px)",
28
- textTransform: 'uppercase'
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _primitives = require("@atlaskit/primitives");
10
+ var headingStyles = (0, _primitives.xcss)({
11
+ color: 'color.text.subtle',
12
+ font: 'font.heading.xxsmall',
13
+ paddingBlock: 'space.0',
14
+ paddingInline: 'space.200'
29
15
  });
30
16
 
31
17
  /**
@@ -38,12 +24,12 @@ var headingStyles = (0, _react.css)({
38
24
  var GroupTitle = function GroupTitle(_ref) {
39
25
  var id = _ref.id,
40
26
  title = _ref.title;
41
- return (0, _react.jsx)("div", {
27
+ return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
42
28
  "data-ds--menu--heading-item": true,
43
29
  role: "menuitem",
44
30
  id: id,
45
31
  "aria-hidden": "true",
46
- css: headingStyles
32
+ xcss: headingStyles
47
33
  }, title);
48
34
  };
49
35
  var _default = exports.default = GroupTitle;
@@ -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,24 +1,10 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
-
6
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
7
- import { css, jsx } from '@emotion/react';
8
- import { N300 } from '@atlaskit/theme/colors';
9
- import { headingSizes } from '@atlaskit/theme/typography';
10
- const itemHeadingContentHeight = headingSizes.h100.lineHeight;
11
- const itemHeadingFontSize = headingSizes.h100.size;
12
- const headingStyles = css({
13
- color: `var(--ds-text-subtle, ${N300})`,
14
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
15
- fontSize: itemHeadingFontSize,
16
- fontWeight: "var(--ds-font-weight-bold, 700)",
17
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
18
- lineHeight: itemHeadingContentHeight / itemHeadingFontSize,
19
- paddingBlock: "var(--ds-space-0, 0px)",
20
- paddingInline: "var(--ds-space-200, 16px)",
21
- textTransform: 'uppercase'
1
+ import React from 'react';
2
+ import { Box, xcss } from '@atlaskit/primitives';
3
+ const headingStyles = xcss({
4
+ color: 'color.text.subtle',
5
+ font: 'font.heading.xxsmall',
6
+ paddingBlock: 'space.0',
7
+ paddingInline: 'space.200'
22
8
  });
23
9
 
24
10
  /**
@@ -31,11 +17,11 @@ const headingStyles = css({
31
17
  const GroupTitle = ({
32
18
  id,
33
19
  title
34
- }) => jsx("div", {
20
+ }) => /*#__PURE__*/React.createElement(Box, {
35
21
  "data-ds--menu--heading-item": true,
36
22
  role: "menuitem",
37
23
  id: id,
38
24
  "aria-hidden": "true",
39
- css: headingStyles
25
+ xcss: headingStyles
40
26
  }, title);
41
27
  export default GroupTitle;
@@ -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,24 +1,10 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
-
6
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
7
- import { css, jsx } from '@emotion/react';
8
- import { N300 } from '@atlaskit/theme/colors';
9
- import { headingSizes } from '@atlaskit/theme/typography';
10
- var itemHeadingContentHeight = headingSizes.h100.lineHeight;
11
- var itemHeadingFontSize = headingSizes.h100.size;
12
- var headingStyles = css({
13
- color: "var(--ds-text-subtle, ".concat(N300, ")"),
14
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
15
- fontSize: itemHeadingFontSize,
16
- fontWeight: "var(--ds-font-weight-bold, 700)",
17
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
18
- lineHeight: itemHeadingContentHeight / itemHeadingFontSize,
19
- paddingBlock: "var(--ds-space-0, 0px)",
20
- paddingInline: "var(--ds-space-200, 16px)",
21
- textTransform: 'uppercase'
1
+ import React from 'react';
2
+ import { Box, xcss } from '@atlaskit/primitives';
3
+ var headingStyles = xcss({
4
+ color: 'color.text.subtle',
5
+ font: 'font.heading.xxsmall',
6
+ paddingBlock: 'space.0',
7
+ paddingInline: 'space.200'
22
8
  });
23
9
 
24
10
  /**
@@ -31,12 +17,12 @@ var headingStyles = css({
31
17
  var GroupTitle = function GroupTitle(_ref) {
32
18
  var id = _ref.id,
33
19
  title = _ref.title;
34
- return jsx("div", {
20
+ return /*#__PURE__*/React.createElement(Box, {
35
21
  "data-ds--menu--heading-item": true,
36
22
  role: "menuitem",
37
23
  id: id,
38
24
  "aria-hidden": "true",
39
- css: headingStyles
25
+ xcss: headingStyles
40
26
  }, title);
41
27
  };
42
28
  export default GroupTitle;
@@ -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
  }
@@ -1,8 +1,4 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- import { jsx } from '@emotion/react';
1
+ /// <reference types="react" />
6
2
  /**
7
3
  * __Group title__
8
4
  *
@@ -13,5 +9,5 @@ import { jsx } from '@emotion/react';
13
9
  declare const GroupTitle: ({ id, title }: {
14
10
  id: string;
15
11
  title: string;
16
- }) => jsx.JSX.Element;
12
+ }) => JSX.Element;
17
13
  export default GroupTitle;
@@ -1,8 +1,4 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- import { jsx } from '@emotion/react';
1
+ /// <reference types="react" />
6
2
  /**
7
3
  * __Group title__
8
4
  *
@@ -13,5 +9,5 @@ import { jsx } from '@emotion/react';
13
9
  declare const GroupTitle: ({ id, title }: {
14
10
  id: string;
15
11
  title: string;
16
- }) => jsx.JSX.Element;
12
+ }) => JSX.Element;
17
13
  export default GroupTitle;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/dropdown-menu",
3
- "version": "12.20.4",
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/"
@@ -23,14 +23,14 @@
23
23
  "runReact18": true
24
24
  },
25
25
  "dependencies": {
26
- "@atlaskit/button": "^20.2.0",
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.22.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",
33
- "@atlaskit/popup": "^1.28.0",
33
+ "@atlaskit/popup": "^1.29.0",
34
34
  "@atlaskit/primitives": "^12.2.0",
35
35
  "@atlaskit/spinner": "^16.3.0",
36
36
  "@atlaskit/theme": "^14.0.0",