@atlaskit/textarea 8.0.0 → 8.0.2
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 +14 -0
- package/dist/cjs/text-area.compiled.css +4 -4
- package/dist/cjs/text-area.js +5 -5
- package/dist/es2019/text-area.compiled.css +4 -4
- package/dist/es2019/text-area.js +5 -5
- package/dist/esm/text-area.compiled.css +4 -4
- package/dist/esm/text-area.js +5 -5
- package/package.json +17 -13
- package/codemods/4.0.0-lite-mode.tsx +0 -6
- package/codemods/__tests__/4.0.0-lite-mode.tsx +0 -25
- package/codemods/__tests__/rename-forwarded-ref-to-ref.tsx +0 -86
- package/codemods/migrates/rename-forwarded-ref-to-ref.tsx +0 -7
- package/codemods/utils.tsx +0 -161
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/textarea
|
|
2
2
|
|
|
3
|
+
## 8.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#125737](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/125737)
|
|
8
|
+
[`3715d57838782`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3715d57838782) -
|
|
9
|
+
Update dependencies and remove old codemods.
|
|
10
|
+
|
|
11
|
+
## 8.0.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 8.0.0
|
|
4
18
|
|
|
5
19
|
### Major Changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
.
|
|
2
|
-
.
|
|
1
|
+
._11c81ixg{font:var(--ds-font-body-large,normal 400 1pc/24px ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
2
|
+
._11c82smr{font:var(--ds-font-body,normal 400 14px/20px ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
3
3
|
._2rko1sit{border-radius:var(--ds-border-radius,3px)}
|
|
4
4
|
._v5641gs0{transition:var(--_19uzta9)}
|
|
5
5
|
._153gksl0[data-invalid]:not(:focus){border-color:var(--_1u9fbts)}
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
._2hwxidpf{margin-right:0}
|
|
54
54
|
._6zpvh9qi:hover:not(:read-only):not(:focus)[data-invalid]{box-shadow:var(--_1l1juom)}
|
|
55
55
|
._cfjqkb7n:disabled{-webkit-opacity:1}
|
|
56
|
+
._ect41gqc{font-family:var(--ds-font-family-body,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
56
57
|
._ect41odn{font-family:var(--ds-font-family-code,ui-monospace,Menlo,"Segoe UI Mono","Ubuntu Mono",monospace)}
|
|
57
|
-
._ect41sbm{font-family:var(--ds-font-family-body,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,system-ui,"Helvetica Neue",sans-serif)}
|
|
58
58
|
._i0dl1osq{flex-basis:100%}
|
|
59
59
|
._ibjd12ci:hover:not(:read-only):not(:focus)[data-invalid]{background-color:var(--_1z08gfx)}
|
|
60
60
|
._j5dh13gf:disabled{cursor:not-allowed}
|
|
@@ -85,4 +85,4 @@
|
|
|
85
85
|
._jomrr01l:focus{background-color:var(--ds-background-input-pressed,#fff)}
|
|
86
86
|
._ndzbkwt5[data-invalid]:focus{background-color:var(--_t0vtv2)}
|
|
87
87
|
._qu18syzs:disabled:focus{background-color:var(--ds-background-disabled,#091e4208)}
|
|
88
|
-
@media (min-width:30rem){.
|
|
88
|
+
@media (min-width:30rem){._1tn22smr{font:var(--ds-font-body,normal 400 14px/20px ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}._14mdudxr{font-family:var(--ds-font-family-code,ui-monospace,Menlo,"Segoe UI Mono","Ubuntu Mono",monospace)!important}}
|
package/dist/cjs/text-area.js
CHANGED
|
@@ -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.
|
|
26
|
+
var packageVersion = "8.0.2";
|
|
27
27
|
var analyticsParams = {
|
|
28
28
|
componentName: 'textArea',
|
|
29
29
|
packageName: packageName,
|
|
@@ -42,9 +42,9 @@ var appearanceStyles = {
|
|
|
42
42
|
none: "_1dqoglyw _kp821j28 _1ltx1j28 _19wt1j28 _12ym1j28 _19qkv77o _zedr12x7 _1dbiv77o _1etu12x7 _1itd12x7 _wg6012x7 _1a4912x7 _17km12x7 _858u1j28 _jomr1j28 _7ehi3sij"
|
|
43
43
|
};
|
|
44
44
|
var fontStyles = {
|
|
45
|
-
default: "
|
|
46
|
-
monospace: "_ect41odn
|
|
47
|
-
large: "
|
|
45
|
+
default: "_ect41gqc",
|
|
46
|
+
monospace: "_ect41odn _1tn22smr _14mdudxr",
|
|
47
|
+
large: "_11c81ixg _1tn22smr"
|
|
48
48
|
};
|
|
49
49
|
var resizeStyles = {
|
|
50
50
|
horizontal: "_14zg1e08",
|
|
@@ -145,7 +145,7 @@ var InnerTextArea = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
145
145
|
onFocus: onFocusWithAnalytics,
|
|
146
146
|
rows: minimumRows
|
|
147
147
|
}, rest, {
|
|
148
|
-
className: (0, _runtime.ax)(["_19pkidpf _2hwxidpf _otyridpf _18u0idpf _16jlkb7n _1o9zkb7n _i0dl1osq _2rko1sit
|
|
148
|
+
className: (0, _runtime.ax)(["_19pkidpf _2hwxidpf _otyridpf _18u0idpf _16jlkb7n _1o9zkb7n _i0dl1osq _2rko1sit _11c82smr _12ji1r31 _1qu2glyw _12y31o36 _1reo1wug _18m91wug _v5641gs0 _189ee4h9 _1e0c1ule _vchhusvi _1bsb1osq _1ul9idpf _p12f1osq _kqswh2mm _syazovqm _slp31hna _153gksl0 _usy41kd8 _1a2sh9qi _vbqbhxcb _j5dh13gf _cfjqkb7n _k3o7n7od _1goxglyw _13xeglyw _1fraksl0 _ibjd12ci _6zpvh9qi _19k01ouc _1idrpsu8 _1lephxcb _nmhq1fiz _1n388sxn _1luh3zdg _ndzbkwt5 _1vj0119y", appearanceStyles[appearance], (0, _platformFeatureFlags.fg)('platform_design_system_team_safari_input_fix') && fontStyles['large'], fontStyles[isMonospaced ? 'monospace' : 'default'], resizeStyles[resize], "_uzq71d1b _16lw1cn1"]),
|
|
149
149
|
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
150
150
|
maxHeight: maxHeight,
|
|
151
151
|
"--_5xk3r4": (0, _runtime.ix)("var(--ds-text, ".concat(_colors.N900, ")")),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
.
|
|
2
|
-
.
|
|
1
|
+
._11c81ixg{font:var(--ds-font-body-large,normal 400 1pc/24px ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
2
|
+
._11c82smr{font:var(--ds-font-body,normal 400 14px/20px ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
3
3
|
._2rko1sit{border-radius:var(--ds-border-radius,3px)}
|
|
4
4
|
._v564r5cv{transition:background-color .2s ease-in-out,border-color .2s ease-in-out}
|
|
5
5
|
._153g78r2[data-invalid]:not(:focus){border-color:var(--ds-border-danger,#de350b)}
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
._2hwxidpf{margin-right:0}
|
|
54
54
|
._6zpvr6rt:hover:not(:read-only):not(:focus)[data-invalid]{box-shadow:inset 0 0 0 var(--ds-border-width,1px) var(--ds-border-danger,#de350b)}
|
|
55
55
|
._cfjqkb7n:disabled{-webkit-opacity:1}
|
|
56
|
+
._ect41gqc{font-family:var(--ds-font-family-body,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
56
57
|
._ect41odn{font-family:var(--ds-font-family-code,ui-monospace,Menlo,"Segoe UI Mono","Ubuntu Mono",monospace)}
|
|
57
|
-
._ect41sbm{font-family:var(--ds-font-family-body,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,system-ui,"Helvetica Neue",sans-serif)}
|
|
58
58
|
._i0dl1osq{flex-basis:100%}
|
|
59
59
|
._ibjd10ko:hover:not(:read-only):not(:focus)[data-invalid]{background-color:var(--ds-background-input-hovered,#ebecf0)}
|
|
60
60
|
._j5dh13gf:disabled{cursor:not-allowed}
|
|
@@ -85,4 +85,4 @@
|
|
|
85
85
|
._jomrr01l:focus{background-color:var(--ds-background-input-pressed,#fff)}
|
|
86
86
|
._ndzbr01l[data-invalid]:focus{background-color:var(--ds-background-input-pressed,#fff)}
|
|
87
87
|
._qu18syzs:disabled:focus{background-color:var(--ds-background-disabled,#091e4208)}
|
|
88
|
-
@media (min-width:30rem){.
|
|
88
|
+
@media (min-width:30rem){._1tn22smr{font:var(--ds-font-body,normal 400 14px/20px ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}._14mdudxr{font-family:var(--ds-font-family-code,ui-monospace,Menlo,"Segoe UI Mono","Ubuntu Mono",monospace)!important}}
|
package/dist/es2019/text-area.js
CHANGED
|
@@ -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.
|
|
10
|
+
const packageVersion = "8.0.2";
|
|
11
11
|
const analyticsParams = {
|
|
12
12
|
componentName: 'textArea',
|
|
13
13
|
packageName,
|
|
@@ -26,9 +26,9 @@ const appearanceStyles = {
|
|
|
26
26
|
none: "_1dqoglyw _kp821j28 _1ltx1j28 _19wt1j28 _12ym1j28 _19qkv77o _zedr12x7 _1dbiv77o _1etu12x7 _1itd12x7 _wg6012x7 _1a4912x7 _17km12x7 _858u1j28 _jomr1j28 _7ehi3sij"
|
|
27
27
|
};
|
|
28
28
|
const fontStyles = {
|
|
29
|
-
default: "
|
|
30
|
-
monospace: "_ect41odn
|
|
31
|
-
large: "
|
|
29
|
+
default: "_ect41gqc",
|
|
30
|
+
monospace: "_ect41odn _1tn22smr _14mdudxr",
|
|
31
|
+
large: "_11c81ixg _1tn22smr"
|
|
32
32
|
};
|
|
33
33
|
const resizeStyles = {
|
|
34
34
|
horizontal: "_14zg1e08",
|
|
@@ -121,7 +121,7 @@ const InnerTextArea = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
121
121
|
onFocus: onFocusWithAnalytics,
|
|
122
122
|
rows: minimumRows
|
|
123
123
|
}, rest, {
|
|
124
|
-
className: ax(["_19pkidpf _2hwxidpf _otyridpf _18u0idpf _16jlkb7n _1o9zkb7n _i0dl1osq _2rko1sit
|
|
124
|
+
className: ax(["_19pkidpf _2hwxidpf _otyridpf _18u0idpf _16jlkb7n _1o9zkb7n _i0dl1osq _2rko1sit _11c82smr _12ji1r31 _1qu2glyw _12y31o36 _1reo1wug _18m91wug _v564r5cv _189ee4h9 _1e0c1ule _vchhusvi _1bsb1osq _1ul9idpf _p12f1osq _kqswh2mm _syazj3m3 _slp31hna _153g78r2 _usy4mag2 _1a2sr6rt _vbqb9jg2 _j5dh13gf _cfjqkb7n _k3o7n7od _1goxglyw _13xeglyw _1fra78r2 _ibjd10ko _6zpvr6rt _19k01y1w _1idr1wmz _1lep9jg2 _nmhq1fiz _1n388sxn _1luh194a _ndzbr01l _1vj01cu8", appearanceStyles[appearance], fg('platform_design_system_team_safari_input_fix') && fontStyles['large'], fontStyles[isMonospaced ? 'monospace' : 'default'], resizeStyles[resize], "_uzq71i7i _16lwuel1"]),
|
|
125
125
|
style: {
|
|
126
126
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
127
127
|
...style,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
.
|
|
2
|
-
.
|
|
1
|
+
._11c81ixg{font:var(--ds-font-body-large,normal 400 1pc/24px ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
2
|
+
._11c82smr{font:var(--ds-font-body,normal 400 14px/20px ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
3
3
|
._2rko1sit{border-radius:var(--ds-border-radius,3px)}
|
|
4
4
|
._v5641gs0{transition:var(--_19uzta9)}
|
|
5
5
|
._153gksl0[data-invalid]:not(:focus){border-color:var(--_1u9fbts)}
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
._2hwxidpf{margin-right:0}
|
|
54
54
|
._6zpvh9qi:hover:not(:read-only):not(:focus)[data-invalid]{box-shadow:var(--_1l1juom)}
|
|
55
55
|
._cfjqkb7n:disabled{-webkit-opacity:1}
|
|
56
|
+
._ect41gqc{font-family:var(--ds-font-family-body,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
56
57
|
._ect41odn{font-family:var(--ds-font-family-code,ui-monospace,Menlo,"Segoe UI Mono","Ubuntu Mono",monospace)}
|
|
57
|
-
._ect41sbm{font-family:var(--ds-font-family-body,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,system-ui,"Helvetica Neue",sans-serif)}
|
|
58
58
|
._i0dl1osq{flex-basis:100%}
|
|
59
59
|
._ibjd12ci:hover:not(:read-only):not(:focus)[data-invalid]{background-color:var(--_1z08gfx)}
|
|
60
60
|
._j5dh13gf:disabled{cursor:not-allowed}
|
|
@@ -85,4 +85,4 @@
|
|
|
85
85
|
._jomrr01l:focus{background-color:var(--ds-background-input-pressed,#fff)}
|
|
86
86
|
._ndzbkwt5[data-invalid]:focus{background-color:var(--_t0vtv2)}
|
|
87
87
|
._qu18syzs:disabled:focus{background-color:var(--ds-background-disabled,#091e4208)}
|
|
88
|
-
@media (min-width:30rem){.
|
|
88
|
+
@media (min-width:30rem){._1tn22smr{font:var(--ds-font-body,normal 400 14px/20px ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}._14mdudxr{font-family:var(--ds-font-family-code,ui-monospace,Menlo,"Segoe UI Mono","Ubuntu Mono",monospace)!important}}
|
package/dist/esm/text-area.js
CHANGED
|
@@ -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.
|
|
16
|
+
var packageVersion = "8.0.2";
|
|
17
17
|
var analyticsParams = {
|
|
18
18
|
componentName: 'textArea',
|
|
19
19
|
packageName: packageName,
|
|
@@ -32,9 +32,9 @@ var appearanceStyles = {
|
|
|
32
32
|
none: "_1dqoglyw _kp821j28 _1ltx1j28 _19wt1j28 _12ym1j28 _19qkv77o _zedr12x7 _1dbiv77o _1etu12x7 _1itd12x7 _wg6012x7 _1a4912x7 _17km12x7 _858u1j28 _jomr1j28 _7ehi3sij"
|
|
33
33
|
};
|
|
34
34
|
var fontStyles = {
|
|
35
|
-
default: "
|
|
36
|
-
monospace: "_ect41odn
|
|
37
|
-
large: "
|
|
35
|
+
default: "_ect41gqc",
|
|
36
|
+
monospace: "_ect41odn _1tn22smr _14mdudxr",
|
|
37
|
+
large: "_11c81ixg _1tn22smr"
|
|
38
38
|
};
|
|
39
39
|
var resizeStyles = {
|
|
40
40
|
horizontal: "_14zg1e08",
|
|
@@ -135,7 +135,7 @@ var InnerTextArea = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
135
135
|
onFocus: onFocusWithAnalytics,
|
|
136
136
|
rows: minimumRows
|
|
137
137
|
}, rest, {
|
|
138
|
-
className: ax(["_19pkidpf _2hwxidpf _otyridpf _18u0idpf _16jlkb7n _1o9zkb7n _i0dl1osq _2rko1sit
|
|
138
|
+
className: ax(["_19pkidpf _2hwxidpf _otyridpf _18u0idpf _16jlkb7n _1o9zkb7n _i0dl1osq _2rko1sit _11c82smr _12ji1r31 _1qu2glyw _12y31o36 _1reo1wug _18m91wug _v5641gs0 _189ee4h9 _1e0c1ule _vchhusvi _1bsb1osq _1ul9idpf _p12f1osq _kqswh2mm _syazovqm _slp31hna _153gksl0 _usy41kd8 _1a2sh9qi _vbqbhxcb _j5dh13gf _cfjqkb7n _k3o7n7od _1goxglyw _13xeglyw _1fraksl0 _ibjd12ci _6zpvh9qi _19k01ouc _1idrpsu8 _1lephxcb _nmhq1fiz _1n388sxn _1luh3zdg _ndzbkwt5 _1vj0119y", appearanceStyles[appearance], fg('platform_design_system_team_safari_input_fix') && fontStyles['large'], fontStyles[isMonospaced ? 'monospace' : 'default'], resizeStyles[resize], "_uzq71d1b _16lw1cn1"]),
|
|
139
139
|
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
140
140
|
maxHeight: maxHeight,
|
|
141
141
|
"--_5xk3r4": ix("var(--ds-text, ".concat(N900, ")")),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/textarea",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.2",
|
|
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,9 +41,9 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@atlaskit/analytics-next": "^11.0.0",
|
|
43
43
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
44
|
-
"@atlaskit/primitives": "^14.
|
|
45
|
-
"@atlaskit/theme": "^
|
|
46
|
-
"@atlaskit/tokens": "^4.
|
|
44
|
+
"@atlaskit/primitives": "^14.1.0",
|
|
45
|
+
"@atlaskit/theme": "^18.0.0",
|
|
46
|
+
"@atlaskit/tokens": "^4.4.0",
|
|
47
47
|
"@babel/runtime": "^7.0.0",
|
|
48
48
|
"@compiled/react": "^0.18.2"
|
|
49
49
|
},
|
|
@@ -51,19 +51,23 @@
|
|
|
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/
|
|
59
|
-
"@atlaskit/
|
|
60
|
-
"@
|
|
61
|
-
"@
|
|
61
|
+
"@atlaskit/form": "^12.0.0",
|
|
62
|
+
"@atlaskit/link": "^3.0.0",
|
|
63
|
+
"@atlaskit/section-message": "^8.1.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,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
|
-
});
|
package/codemods/utils.tsx
DELETED
|
@@ -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
|
-
};
|