@atlaskit/textarea 8.0.1 → 8.0.3

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,22 @@
1
1
  # @atlaskit/textarea
2
2
 
3
+ ## 8.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#129972](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/129972)
8
+ [`b2d69a39e6687`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b2d69a39e6687) -
9
+ Update `@compiled/react` dependency for improved type checking support.
10
+ - Updated dependencies
11
+
12
+ ## 8.0.2
13
+
14
+ ### Patch Changes
15
+
16
+ - [#125737](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/125737)
17
+ [`3715d57838782`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3715d57838782) -
18
+ Update dependencies and remove old codemods.
19
+
3
20
  ## 8.0.1
4
21
 
5
22
  ### Patch Changes
@@ -23,7 +23,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
23
23
  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; }
24
24
  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; }
25
25
  var packageName = "@atlaskit/textarea";
26
- var packageVersion = "8.0.1";
26
+ var packageVersion = "8.0.3";
27
27
  var analyticsParams = {
28
28
  componentName: 'textArea',
29
29
  packageName: packageName,
@@ -7,7 +7,7 @@ import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
7
7
  import { fg } from '@atlaskit/platform-feature-flags';
8
8
  import { B200, N0, N10, N20, N200, N30, N70, N900, R400 } from '@atlaskit/theme/colors';
9
9
  const packageName = "@atlaskit/textarea";
10
- const packageVersion = "8.0.1";
10
+ const packageVersion = "8.0.3";
11
11
  const analyticsParams = {
12
12
  componentName: 'textArea',
13
13
  packageName,
@@ -13,7 +13,7 @@ import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
13
13
  import { fg } from '@atlaskit/platform-feature-flags';
14
14
  import { B200, N0, N10, N20, N200, N30, N70, N900, R400 } from '@atlaskit/theme/colors';
15
15
  var packageName = "@atlaskit/textarea";
16
- var packageVersion = "8.0.1";
16
+ var packageVersion = "8.0.3";
17
17
  var analyticsParams = {
18
18
  componentName: 'textArea',
19
19
  packageName: packageName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/textarea",
3
- "version": "8.0.1",
3
+ "version": "8.0.3",
4
4
  "description": "A text area lets users enter long form text which spans over multiple lines.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -41,29 +41,33 @@
41
41
  "dependencies": {
42
42
  "@atlaskit/analytics-next": "^11.0.0",
43
43
  "@atlaskit/platform-feature-flags": "^1.1.0",
44
- "@atlaskit/primitives": "^14.1.0",
44
+ "@atlaskit/primitives": "^14.2.0",
45
45
  "@atlaskit/theme": "^18.0.0",
46
- "@atlaskit/tokens": "^4.3.0",
46
+ "@atlaskit/tokens": "^4.5.0",
47
47
  "@babel/runtime": "^7.0.0",
48
- "@compiled/react": "^0.18.2"
48
+ "@compiled/react": "^0.18.3"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "react": "^18.2.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@af/accessibility-testing": "*",
55
- "@af/integration-testing": "*",
56
- "@af/visual-regression": "*",
54
+ "@af/accessibility-testing": "^2.0.0",
55
+ "@af/integration-testing": "^0.5.0",
56
+ "@af/visual-regression": "^1.3.0",
57
+ "@atlaskit/button": "^21.1.0",
58
+ "@atlaskit/css": "^0.10.0",
59
+ "@atlaskit/docs": "^10.0.0",
57
60
  "@atlaskit/ds-lib": "^4.0.0",
58
- "@atlaskit/ssr": "*",
59
- "@atlaskit/visual-regression": "*",
60
- "@atlassian/feature-flags-test-utils": "*",
61
- "@testing-library/dom": "^10.1.0",
61
+ "@atlaskit/form": "^12.0.0",
62
+ "@atlaskit/link": "^3.0.0",
63
+ "@atlaskit/section-message": "^8.2.0",
64
+ "@atlaskit/ssr": "^0.4.0",
65
+ "@atlaskit/textarea": "^8.0.0",
66
+ "@atlaskit/visual-regression": "^0.10.0",
62
67
  "@testing-library/react": "^13.4.0",
68
+ "@testing-library/user-event": "^14.4.3",
63
69
  "jest-in-case": "^1.0.2",
64
- "jscodeshift": "^0.13.0",
65
70
  "react-dom": "^18.2.0",
66
- "storybook-addon-performance": "^0.17.3",
67
71
  "typescript": "~5.4.2"
68
72
  },
69
73
  "keywords": [
@@ -1,6 +0,0 @@
1
- import { renameForwardedRefToRef } from './migrates/rename-forwarded-ref-to-ref';
2
- import { createTransformer } from './utils';
3
-
4
- const transformer = createTransformer('@atlaskit/textarea', [renameForwardedRefToRef]);
5
-
6
- export default transformer;
@@ -1,25 +0,0 @@
1
- jest.autoMockOff();
2
-
3
- import transformer from '../4.0.0-lite-mode';
4
-
5
- const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
6
-
7
- describe('Rename ref props', () => {
8
- defineInlineTest(
9
- { default: transformer, parser: 'tsx' },
10
- {},
11
- `
12
- import React, { useRef } from "react";
13
- import TextArea from "@atlaskit/textarea";
14
- const ref = useRef(null);
15
- export default () => <TextArea defaultValue="test" forwardedRef={ref}/>;
16
- `,
17
- `
18
- import React, { useRef } from "react";
19
- import TextArea from "@atlaskit/textarea";
20
- const ref = useRef(null);
21
- export default () => <TextArea defaultValue="test" ref={ref}/>;
22
- `,
23
- 'should apply 1 migrates',
24
- );
25
- });
@@ -1,86 +0,0 @@
1
- jest.autoMockOff();
2
-
3
- import { renameForwardedRefToRef } from '../migrates/rename-forwarded-ref-to-ref';
4
- import { createTransformer } from '../utils';
5
-
6
- const transformer = createTransformer('@atlaskit/textarea', [renameForwardedRefToRef]);
7
-
8
- const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
9
-
10
- describe('Rename forwardedRef prop to ref prop', () => {
11
- defineInlineTest(
12
- { default: transformer, parser: 'tsx' },
13
- {},
14
- `
15
- import React from "react";
16
- import TextArea from "@atlaskit/textarea";
17
- export default () => <TextArea defaultValue="test"/>;
18
- `,
19
- `
20
- import React from "react";
21
- import TextArea from "@atlaskit/textarea";
22
- export default () => <TextArea defaultValue="test"/>;
23
- `,
24
- 'should not rename forwardedRef if it is not provided',
25
- );
26
-
27
- defineInlineTest(
28
- { default: transformer, parser: 'tsx' },
29
- {},
30
- `
31
- import React from "react";
32
- import TextArea from "@atlaskit/textarea";
33
-
34
- const ref = React.createRef<HTMLTextAreaElement>();
35
- export default () => <TextArea defaultValue="test" forwardedRef={ref} />;
36
- `,
37
- `
38
- import React from "react";
39
- import TextArea from "@atlaskit/textarea";
40
-
41
- const ref = React.createRef<HTMLTextAreaElement>();
42
- export default () => <TextArea defaultValue="test" ref={ref} />;
43
- `,
44
- 'should rename forwardedRef to ref',
45
- );
46
-
47
- defineInlineTest(
48
- { default: transformer, parser: 'tsx' },
49
- {},
50
- `
51
- import React from "react";
52
- import SmartTextArea from "@atlaskit/textarea";
53
-
54
- const ref = React.createRef<HTMLTextAreaElement>();
55
- export default () => <SmartTextArea defaultValue="test" forwardedRef={ref} />;
56
- `,
57
- `
58
- import React from "react";
59
- import SmartTextArea from "@atlaskit/textarea";
60
-
61
- const ref = React.createRef<HTMLTextAreaElement>();
62
- export default () => <SmartTextArea defaultValue="test" ref={ref} />;
63
- `,
64
- 'should rename forwardedRef to ref with alias',
65
- );
66
-
67
- defineInlineTest(
68
- { default: transformer, parser: 'tsx' },
69
- {},
70
- `
71
- import React from "react";
72
- import TextArea from "@atlaskit/textarea";
73
-
74
- const ref = useRef<HTMLTextAreaElement>(null);
75
- export default () => <TextArea defaultValue="test" forwardedRef={ref} />;
76
- `,
77
- `
78
- import React from "react";
79
- import TextArea from "@atlaskit/textarea";
80
-
81
- const ref = useRef<HTMLTextAreaElement>(null);
82
- export default () => <TextArea defaultValue="test" ref={ref} />;
83
- `,
84
- 'should rename forwardedRef to ref when using ref via useRef',
85
- );
86
- });
@@ -1,7 +0,0 @@
1
- import { createRenameFuncFor } from '../utils';
2
-
3
- export const renameForwardedRefToRef = createRenameFuncFor(
4
- '@atlaskit/textarea',
5
- 'forwardedRef',
6
- 'ref',
7
- );
@@ -1,161 +0,0 @@
1
- import {
2
- type API,
3
- type ASTPath,
4
- type default as core,
5
- type FileInfo,
6
- type ImportDeclaration,
7
- type JSXAttribute,
8
- type Options,
9
- type StringLiteral,
10
- } from 'jscodeshift';
11
-
12
- function getDefaultSpecifier(j: core.JSCodeshift, source: any, specifier: string) {
13
- const specifiers = source
14
- .find(j.ImportDeclaration)
15
- .filter((path: ASTPath<ImportDeclaration>) => path.node.source.value === specifier)
16
- .find(j.ImportDefaultSpecifier);
17
-
18
- if (!specifiers.length) {
19
- return null;
20
- }
21
- return specifiers.nodes()[0]!.local!.name;
22
- }
23
-
24
- function getJSXAttributesByName(j: core.JSCodeshift, element: ASTPath<any>, attributeName: string) {
25
- return j(element)
26
- .find(j.JSXOpeningElement)
27
- .find(j.JSXAttribute)
28
- .filter((attribute) => {
29
- const matches = j(attribute)
30
- .find(j.JSXIdentifier)
31
- .filter((identifier) => identifier.value.name === attributeName);
32
- return Boolean(matches.length);
33
- });
34
- }
35
-
36
- const isEmpty = (string: StringLiteral): boolean => string && string.value !== '';
37
-
38
- function hasImportDeclaration(j: core.JSCodeshift, source: any, importPath: string) {
39
- const imports = source
40
- .find(j.ImportDeclaration)
41
- .filter((path: ASTPath<ImportDeclaration>) => path.node.source.value === importPath);
42
-
43
- return Boolean(imports.length);
44
- }
45
-
46
- const debug = (component: string) => (j: core.JSCodeshift, source: any) => {
47
- const defaultSpecifier = getDefaultSpecifier(j, source, component);
48
-
49
- if (!defaultSpecifier) {
50
- return;
51
- }
52
-
53
- source.findJSXElements(defaultSpecifier).forEach((element: ASTPath<JSXAttribute>) => {
54
- console.log(element); //eslint-disable-line no-console
55
- });
56
- };
57
-
58
- const createRenameFuncFor =
59
- (component: string, from: string, to: string) => (j: core.JSCodeshift, source: any) => {
60
- const defaultSpecifier = getDefaultSpecifier(j, source, component);
61
-
62
- if (!defaultSpecifier) {
63
- return;
64
- }
65
-
66
- source.findJSXElements(defaultSpecifier).forEach((element: ASTPath<JSXAttribute>) => {
67
- getJSXAttributesByName(j, element, from).forEach((attribute) => {
68
- j(attribute).replaceWith(j.jsxAttribute(j.jsxIdentifier(to), attribute.node.value));
69
- });
70
- });
71
- };
72
-
73
- const createConvertFuncFor =
74
- (component: string, from: string, to: string, predicate?: (value: any) => boolean) =>
75
- (j: core.JSCodeshift, source: any) => {
76
- const defaultSpecifier = getDefaultSpecifier(j, source, component);
77
-
78
- if (!defaultSpecifier) {
79
- return;
80
- }
81
-
82
- source.findJSXElements(defaultSpecifier).forEach((element: ASTPath<JSXAttribute>) => {
83
- getJSXAttributesByName(j, element, from).forEach((attribute) => {
84
- const shouldConvert = (predicate && predicate(attribute.node.value)) || false;
85
- const node = j.jsxAttribute(j.jsxIdentifier(to));
86
- if (shouldConvert) {
87
- j(attribute).insertBefore(node);
88
- }
89
- });
90
- });
91
- };
92
-
93
- const replaceImportStatementFor =
94
- (pkg: string, convertMap: any) => (j: core.JSCodeshift, root: any) => {
95
- root
96
- .find(j.ImportDeclaration)
97
- .filter((path: ASTPath<ImportDeclaration>) => path.node.source.value === pkg)
98
- .forEach((path: ASTPath<ImportDeclaration>) => {
99
- const defaultSpecifier = (path.value.specifiers || []).filter(
100
- (specifier) => specifier.type === 'ImportDefaultSpecifier',
101
- );
102
-
103
- const defaultDeclarations = defaultSpecifier.map((s) => {
104
- return j.importDeclaration([s], j.literal(convertMap['default']));
105
- });
106
-
107
- const otherSpecifier = (path.value.specifiers || []).filter(
108
- (specifier) => specifier.type === 'ImportSpecifier',
109
- );
110
-
111
- j(path).replaceWith(defaultDeclarations);
112
-
113
- const otherDeclarations = otherSpecifier.map((s) => {
114
- const localName = s.local!.name;
115
- if (convertMap[localName]) {
116
- return j.importDeclaration([s], j.literal(convertMap[localName]));
117
- } else {
118
- return j.importDeclaration([s], j.literal(convertMap['*']));
119
- }
120
- });
121
-
122
- j(path).insertAfter(otherDeclarations);
123
- });
124
- };
125
-
126
- const createRenameImportFor =
127
- (component: string, from: string, to: string) => (j: core.JSCodeshift, source: any) => {
128
- source
129
- .find(j.ImportDeclaration)
130
- .filter((path: ASTPath<ImportDeclaration>) => path.node.source.value === component)
131
- .forEach((path: ASTPath<ImportDeclaration>) => {
132
- j(path).replaceWith(j.importDeclaration(path.value.specifiers, j.literal(to)));
133
- });
134
- };
135
-
136
- const createTransformer =
137
- (component: string, migrates: { (j: core.JSCodeshift, source: any): void }[]) =>
138
- (fileInfo: FileInfo, { jscodeshift: j }: API, options: Options) => {
139
- const source = j(fileInfo.source);
140
-
141
- if (!hasImportDeclaration(j, source, component)) {
142
- return fileInfo.source;
143
- }
144
-
145
- migrates.forEach((tf) => tf(j, source));
146
-
147
- return source.toSource(options.printOptions);
148
- };
149
-
150
- export {
151
- getDefaultSpecifier,
152
- getJSXAttributesByName,
153
- hasImportDeclaration,
154
- isEmpty,
155
- createRenameFuncFor,
156
- createConvertFuncFor,
157
- createRenameImportFor,
158
- replaceImportStatementFor,
159
- createTransformer,
160
- debug,
161
- };