@atlaskit/blanket 13.0.1 → 13.2.0

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.
@@ -2,61 +2,49 @@
2
2
  import React, { useState } from 'react';
3
3
 
4
4
  import { fireEvent } from '@testing-library/dom';
5
- import {
6
- InteractionTaskArgs,
7
- PublicInteractionTask,
8
- } from 'storybook-addon-performance';
5
+ import { type InteractionTaskArgs, type PublicInteractionTask } from 'storybook-addon-performance';
9
6
 
10
7
  import Blanket from '../src';
11
8
 
12
9
  const BlanketPerformance = () => {
13
- const [isBlanketVisible, setIsBlanketVisible] = useState(true);
14
-
15
- const toggleBlanketVisibility = () => {
16
- setIsBlanketVisible(!isBlanketVisible);
17
- };
18
-
19
- return (
20
- <>
21
- <button
22
- type="button"
23
- onClick={toggleBlanketVisibility}
24
- data-testid="toggleButton"
25
- >
26
- Toggle blanket
27
- </button>
28
-
29
- <Blanket isTinted={isBlanketVisible} shouldAllowClickThrough={true} />
30
- </>
31
- );
10
+ const [isBlanketVisible, setIsBlanketVisible] = useState(true);
11
+
12
+ const toggleBlanketVisibility = () => {
13
+ setIsBlanketVisible(!isBlanketVisible);
14
+ };
15
+
16
+ return (
17
+ <>
18
+ <button type="button" onClick={toggleBlanketVisibility} data-testid="toggleButton">
19
+ Toggle blanket
20
+ </button>
21
+
22
+ <Blanket isTinted={isBlanketVisible} shouldAllowClickThrough={true} />
23
+ </>
24
+ );
32
25
  };
33
26
 
34
27
  const interactionTasks: PublicInteractionTask[] = [
35
- {
36
- name: 'onHide',
37
- description: 'Hide blanket by changing its isTinted prop',
38
- run: async ({
39
- container,
40
- controls,
41
- }: InteractionTaskArgs): Promise<void> => {
42
- const toggleButton = container.querySelector(
43
- `[data-testid="toggleButton"]`,
44
- )!;
45
-
46
- await controls.time(async () => {
47
- await fireEvent.click(toggleButton);
48
- });
49
- },
50
- },
28
+ {
29
+ name: 'onHide',
30
+ description: 'Hide blanket by changing its isTinted prop',
31
+ run: async ({ container, controls }: InteractionTaskArgs): Promise<void> => {
32
+ const toggleButton = container.querySelector(`[data-testid="toggleButton"]`)!;
33
+
34
+ await controls.time(async () => {
35
+ await fireEvent.click(toggleButton);
36
+ });
37
+ },
38
+ },
51
39
  ];
52
40
 
53
41
  BlanketPerformance.story = {
54
- name: 'Hide Blanklet',
55
- parameters: {
56
- performance: {
57
- interactions: interactionTasks,
58
- },
59
- },
42
+ name: 'Hide Blanklet',
43
+ parameters: {
44
+ performance: {
45
+ interactions: interactionTasks,
46
+ },
47
+ },
60
48
  };
61
49
 
62
50
  export default BlanketPerformance;
@@ -2,59 +2,47 @@
2
2
  import React, { useState } from 'react';
3
3
 
4
4
  import { fireEvent } from '@testing-library/dom';
5
- import {
6
- InteractionTaskArgs,
7
- PublicInteractionTask,
8
- } from 'storybook-addon-performance';
5
+ import { type InteractionTaskArgs, type PublicInteractionTask } from 'storybook-addon-performance';
9
6
 
10
7
  import Blanket from '../src';
11
8
 
12
9
  const BlanketPerformance = () => {
13
- const [isBlanketVisible, setIsBlanketVisible] = useState(false);
14
-
15
- const toggleBlanketVisibility = () => {
16
- setIsBlanketVisible(!isBlanketVisible);
17
- };
18
-
19
- return (
20
- <>
21
- <button
22
- type="button"
23
- onClick={toggleBlanketVisibility}
24
- data-testid="toggleButton"
25
- >
26
- Toggle blanket
27
- </button>
28
- <Blanket isTinted={isBlanketVisible} shouldAllowClickThrough={true} />
29
- </>
30
- );
10
+ const [isBlanketVisible, setIsBlanketVisible] = useState(false);
11
+
12
+ const toggleBlanketVisibility = () => {
13
+ setIsBlanketVisible(!isBlanketVisible);
14
+ };
15
+
16
+ return (
17
+ <>
18
+ <button type="button" onClick={toggleBlanketVisibility} data-testid="toggleButton">
19
+ Toggle blanket
20
+ </button>
21
+ <Blanket isTinted={isBlanketVisible} shouldAllowClickThrough={true} />
22
+ </>
23
+ );
31
24
  };
32
25
 
33
26
  const interactionTasks: PublicInteractionTask[] = [
34
- {
35
- name: 'onShow',
36
- description: 'Show blanket by changing its isTinted prop',
37
- run: async ({
38
- container,
39
- controls,
40
- }: InteractionTaskArgs): Promise<void> => {
41
- const toggleButton = container.querySelector(
42
- `[data-testid="toggleButton"]`,
43
- )!;
44
- await controls.time(async () => {
45
- await fireEvent.click(toggleButton);
46
- });
47
- },
48
- },
27
+ {
28
+ name: 'onShow',
29
+ description: 'Show blanket by changing its isTinted prop',
30
+ run: async ({ container, controls }: InteractionTaskArgs): Promise<void> => {
31
+ const toggleButton = container.querySelector(`[data-testid="toggleButton"]`)!;
32
+ await controls.time(async () => {
33
+ await fireEvent.click(toggleButton);
34
+ });
35
+ },
36
+ },
49
37
  ];
50
38
 
51
39
  BlanketPerformance.story = {
52
- name: 'Show Blanklet',
53
- parameters: {
54
- performance: {
55
- interactions: interactionTasks,
56
- },
57
- },
40
+ name: 'Show Blanklet',
41
+ parameters: {
42
+ performance: {
43
+ interactions: interactionTasks,
44
+ },
45
+ },
58
46
  };
59
47
 
60
48
  export default BlanketPerformance;
@@ -4,11 +4,11 @@ import React from 'react';
4
4
  import Blanket from '../src';
5
5
 
6
6
  const BlanketPerformance = () => {
7
- return <Blanket isTinted={true} shouldAllowClickThrough={false} />;
7
+ return <Blanket isTinted={true} shouldAllowClickThrough={false} />;
8
8
  };
9
9
 
10
10
  BlanketPerformance.story = {
11
- name: 'Blanket with shouldAllowClickThrough disabled',
11
+ name: 'Blanket with shouldAllowClickThrough disabled',
12
12
  };
13
13
 
14
14
  export default BlanketPerformance;
@@ -4,11 +4,11 @@ import React from 'react';
4
4
  import Blanket from '../src';
5
5
 
6
6
  const BlanketPerformance = () => {
7
- return <Blanket isTinted={true} shouldAllowClickThrough={true} />;
7
+ return <Blanket isTinted={true} shouldAllowClickThrough={true} />;
8
8
  };
9
9
 
10
10
  BlanketPerformance.story = {
11
- name: 'Blanket with shouldAllowClickThrough enabled',
11
+ name: 'Blanket with shouldAllowClickThrough enabled',
12
12
  };
13
13
 
14
14
  export default BlanketPerformance;
@@ -1,18 +1,15 @@
1
- import { JSCodeshift } from 'jscodeshift';
2
- import { Collection } from 'jscodeshift/src/Collection';
1
+ import { type JSCodeshift } from 'jscodeshift';
2
+ import { type Collection } from 'jscodeshift/src/Collection';
3
3
 
4
- import {
5
- createTransformer,
6
- hasImportDeclaration,
7
- } from '@atlaskit/codemod-utils';
4
+ import { createTransformer, hasImportDeclaration } from '@atlaskit/codemod-utils';
8
5
 
9
6
  import { BLANKET_PACKAGE_NAME } from './internal/constants';
10
7
  import { renameCanClickThrough } from './migrations/rename-canclickthrough-to-shouldallowclickthrough';
11
8
 
12
9
  const transformer = createTransformer(
13
- [renameCanClickThrough],
14
- (j: JSCodeshift, source: Collection<Node>) =>
15
- hasImportDeclaration(j, source, BLANKET_PACKAGE_NAME),
10
+ [renameCanClickThrough],
11
+ (j: JSCodeshift, source: Collection<Node>) =>
12
+ hasImportDeclaration(j, source, BLANKET_PACKAGE_NAME),
16
13
  );
17
14
 
18
15
  export default transformer;
@@ -7,10 +7,10 @@ const transformer = createTransformer([renameCanClickThrough]);
7
7
  const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
8
8
 
9
9
  describe('Blanket codemods', () => {
10
- defineInlineTest(
11
- { default: transformer, parser: 'tsx' },
12
- {},
13
- `
10
+ defineInlineTest(
11
+ { default: transformer, parser: 'tsx' },
12
+ {},
13
+ `
14
14
  import React from 'react';
15
15
  import Blanket from '@atlaskit/blanket';
16
16
 
@@ -22,7 +22,7 @@ describe('Blanket codemods', () => {
22
22
  );
23
23
  }
24
24
  `,
25
- `
25
+ `
26
26
  import React from 'react';
27
27
  import Blanket from '@atlaskit/blanket';
28
28
 
@@ -34,12 +34,12 @@ describe('Blanket codemods', () => {
34
34
  );
35
35
  }
36
36
  `,
37
- `should rename the "canClickThrough" prop to "shouldAllowClickThrough" prop`,
38
- );
39
- defineInlineTest(
40
- { default: transformer, parser: 'tsx' },
41
- {},
42
- `
37
+ `should rename the "canClickThrough" prop to "shouldAllowClickThrough" prop`,
38
+ );
39
+ defineInlineTest(
40
+ { default: transformer, parser: 'tsx' },
41
+ {},
42
+ `
43
43
  import React from 'react';
44
44
  import Blanket from '@atlaskit/blanket';
45
45
 
@@ -51,7 +51,7 @@ describe('Blanket codemods', () => {
51
51
  );
52
52
  }
53
53
  `,
54
- `
54
+ `
55
55
  import React from 'react';
56
56
  import Blanket from '@atlaskit/blanket';
57
57
 
@@ -63,12 +63,12 @@ describe('Blanket codemods', () => {
63
63
  );
64
64
  }
65
65
  `,
66
- `should rename the "canClickThrough" prop to "shouldAllowClickThrough" prop`,
67
- );
68
- defineInlineTest(
69
- { default: transformer, parser: 'tsx' },
70
- {},
71
- `
66
+ `should rename the "canClickThrough" prop to "shouldAllowClickThrough" prop`,
67
+ );
68
+ defineInlineTest(
69
+ { default: transformer, parser: 'tsx' },
70
+ {},
71
+ `
72
72
  import React from 'react';
73
73
  import Blanket from '@atlaskit/blanket';
74
74
 
@@ -82,7 +82,7 @@ describe('Blanket codemods', () => {
82
82
  );
83
83
  }
84
84
  `,
85
- `
85
+ `
86
86
  import React from 'react';
87
87
  import Blanket from '@atlaskit/blanket';
88
88
 
@@ -96,12 +96,12 @@ describe('Blanket codemods', () => {
96
96
  );
97
97
  }
98
98
  `,
99
- `should rename only "canClickThrough" prop and leave other props unaffected`,
100
- );
101
- defineInlineTest(
102
- { default: transformer, parser: 'tsx' },
103
- {},
104
- `
99
+ `should rename only "canClickThrough" prop and leave other props unaffected`,
100
+ );
101
+ defineInlineTest(
102
+ { default: transformer, parser: 'tsx' },
103
+ {},
104
+ `
105
105
  import React from 'react';
106
106
  import Blanket from '@atlaskit/blanket';
107
107
  const shouldAllowClickThrough = false;
@@ -115,7 +115,7 @@ describe('Blanket codemods', () => {
115
115
  );
116
116
  }
117
117
  `,
118
- `
118
+ `
119
119
  import React from 'react';
120
120
  import Blanket from '@atlaskit/blanket';
121
121
  const shouldAllowClickThrough = false;
@@ -129,12 +129,12 @@ describe('Blanket codemods', () => {
129
129
  );
130
130
  }
131
131
  `,
132
- `should rename the "canClickThrough" prop when its value is a variable`,
133
- );
134
- defineInlineTest(
135
- { default: transformer, parser: 'tsx' },
136
- {},
137
- `
132
+ `should rename the "canClickThrough" prop when its value is a variable`,
133
+ );
134
+ defineInlineTest(
135
+ { default: transformer, parser: 'tsx' },
136
+ {},
137
+ `
138
138
  import React from 'react';
139
139
  import Blanket from '@atlaskit/blanket';
140
140
  const shouldAllowClickThrough = false;
@@ -148,7 +148,7 @@ describe('Blanket codemods', () => {
148
148
  );
149
149
  }
150
150
  `,
151
- `
151
+ `
152
152
  import React from 'react';
153
153
  import Blanket from '@atlaskit/blanket';
154
154
  const shouldAllowClickThrough = false;
@@ -162,6 +162,6 @@ describe('Blanket codemods', () => {
162
162
  );
163
163
  }
164
164
  `,
165
- `should rename the "canClickThrough" prop when its value is a complex expression`,
166
- );
165
+ `should rename the "canClickThrough" prop when its value is a complex expression`,
166
+ );
167
167
  });
@@ -1,13 +1,13 @@
1
1
  import { createRenameFuncFor } from '@atlaskit/codemod-utils';
2
2
 
3
3
  import {
4
- BLANKET_PACKAGE_NAME,
5
- NEW_CLICK_THROUGH_PROP_NAME,
6
- OLD_CLICK_THROUGH_PROP_NAME,
4
+ BLANKET_PACKAGE_NAME,
5
+ NEW_CLICK_THROUGH_PROP_NAME,
6
+ OLD_CLICK_THROUGH_PROP_NAME,
7
7
  } from '../internal/constants';
8
8
 
9
9
  export const renameCanClickThrough = createRenameFuncFor(
10
- BLANKET_PACKAGE_NAME,
11
- OLD_CLICK_THROUGH_PROP_NAME,
12
- NEW_CLICK_THROUGH_PROP_NAME,
10
+ BLANKET_PACKAGE_NAME,
11
+ OLD_CLICK_THROUGH_PROP_NAME,
12
+ NEW_CLICK_THROUGH_PROP_NAME,
13
13
  );
@@ -13,9 +13,11 @@ var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
13
13
  var _colors = require("@atlaskit/theme/colors");
14
14
  var _constants = require("@atlaskit/theme/constants");
15
15
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
16
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /** @jsx jsx */
16
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /**
17
+ * @jsxRuntime classic
18
+ */ /** @jsx jsx */
17
19
  var packageName = "@atlaskit/blanket";
18
- var packageVersion = "13.0.1";
20
+ var packageVersion = "13.2.0";
19
21
  var analyticsAttributes = {
20
22
  componentName: 'blanket',
21
23
  packageName: packageName,
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ */
1
4
  /** @jsx jsx */
2
5
  import { forwardRef, memo, useCallback, useRef } from 'react';
3
6
  import { css, jsx } from '@emotion/react';
@@ -6,7 +9,7 @@ import noop from '@atlaskit/ds-lib/noop';
6
9
  import { N100A } from '@atlaskit/theme/colors';
7
10
  import { layers } from '@atlaskit/theme/constants';
8
11
  const packageName = "@atlaskit/blanket";
9
- const packageVersion = "13.0.1";
12
+ const packageVersion = "13.2.0";
10
13
  const analyticsAttributes = {
11
14
  componentName: 'blanket',
12
15
  packageName,
@@ -1,6 +1,9 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ /**
5
+ * @jsxRuntime classic
6
+ */
4
7
  /** @jsx jsx */
5
8
  import { forwardRef, memo, useCallback, useRef } from 'react';
6
9
  import { css, jsx } from '@emotion/react';
@@ -9,7 +12,7 @@ import noop from '@atlaskit/ds-lib/noop';
9
12
  import { N100A } from '@atlaskit/theme/colors';
10
13
  import { layers } from '@atlaskit/theme/constants';
11
14
  var packageName = "@atlaskit/blanket";
12
- var packageVersion = "13.0.1";
15
+ var packageVersion = "13.2.0";
13
16
  var analyticsAttributes = {
14
17
  componentName: 'blanket',
15
18
  packageName: packageName,
@@ -1,12 +1,12 @@
1
- import { ReactNode } from 'react';
2
- import UIAnalyticsEvent from '@atlaskit/analytics-next/UIAnalyticsEvent';
1
+ import { type ReactNode } from 'react';
2
+ import type UIAnalyticsEvent from '@atlaskit/analytics-next/UIAnalyticsEvent';
3
3
  export interface BlanketProps {
4
4
  /**
5
- * Whether mouse events can pierce the blanket. If true, onBlanketClicked will not be fired.
5
+ * Whether mouse events can pass through the blanket. If `true`, `onBlanketClicked` will not be called.
6
6
  */
7
7
  shouldAllowClickThrough?: boolean;
8
8
  /**
9
- * Whether the blanket has a tinted background color.
9
+ * Sets whether the blanket has a tinted background color.
10
10
  */
11
11
  isTinted?: boolean;
12
12
  /**
@@ -24,7 +24,7 @@ export interface BlanketProps {
24
24
  */
25
25
  testId?: string;
26
26
  /**
27
- * The children to be rendered within Blanket.
27
+ * The children to be rendered within the blanket.
28
28
  */
29
29
  children?: ReactNode;
30
30
  }
@@ -1,12 +1,12 @@
1
- import { ReactNode } from 'react';
2
- import UIAnalyticsEvent from '@atlaskit/analytics-next/UIAnalyticsEvent';
1
+ import { type ReactNode } from 'react';
2
+ import type UIAnalyticsEvent from '@atlaskit/analytics-next/UIAnalyticsEvent';
3
3
  export interface BlanketProps {
4
4
  /**
5
- * Whether mouse events can pierce the blanket. If true, onBlanketClicked will not be fired.
5
+ * Whether mouse events can pass through the blanket. If `true`, `onBlanketClicked` will not be called.
6
6
  */
7
7
  shouldAllowClickThrough?: boolean;
8
8
  /**
9
- * Whether the blanket has a tinted background color.
9
+ * Sets whether the blanket has a tinted background color.
10
10
  */
11
11
  isTinted?: boolean;
12
12
  /**
@@ -24,7 +24,7 @@ export interface BlanketProps {
24
24
  */
25
25
  testId?: string;
26
26
  /**
27
- * The children to be rendered within Blanket.
27
+ * The children to be rendered within the blanket.
28
28
  */
29
29
  children?: ReactNode;
30
30
  }