@carbon/upgrade 11.41.0 → 11.42.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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/upgrade",
3
3
  "description": "A tool for upgrading Carbon versions",
4
- "version": "11.41.0",
4
+ "version": "11.42.0",
5
5
  "license": "Apache-2.0",
6
6
  "bin": {
7
7
  "carbon-upgrade": "./bin/carbon-upgrade.js"
@@ -60,5 +60,5 @@
60
60
  "@ibm/telemetry-js": "^1.5.0",
61
61
  "jscodeshift": "^17.0.0"
62
62
  },
63
- "gitHead": "30ca2b932469a5c89da10cb8d1fa82586ed14018"
63
+ "gitHead": "a57cf8a896fe3fe09c5ab27648cd58947f37360a"
64
64
  }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Copyright IBM Corp. 2026
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import React from 'react';
9
+ import { Tearsheet as MyTearsheet } from '@carbon/ibm-products';
10
+
11
+ // Test: Tearsheet with aliased import
12
+ export const AliasedTearsheet = () => {
13
+ return (
14
+ <MyTearsheet
15
+ open={true}
16
+ onClose={() => {}}
17
+ title="Aliased Tearsheet"
18
+ label="Test">
19
+ <div>Content with alias</div>
20
+ </MyTearsheet>
21
+ );
22
+ };
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Copyright IBM Corp. 2026
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import React from 'react';
9
+ import { preview__Tearsheet as MyTearsheet } from '@carbon/ibm-products';
10
+
11
+ // Test: Tearsheet with aliased import
12
+ export const AliasedTearsheet = () => {
13
+ return (
14
+ <MyTearsheet open={true} onClose={() => {}}>
15
+ <MyTearsheet.Header>
16
+ <MyTearsheet.HeaderContent title="Aliased Tearsheet" label="Test"></MyTearsheet.HeaderContent>
17
+ </MyTearsheet.Header>
18
+ <MyTearsheet.Body>
19
+ <MyTearsheet.MainContent>
20
+
21
+ <div>Content with alias</div>
22
+
23
+ </MyTearsheet.MainContent>
24
+ </MyTearsheet.Body>
25
+ </MyTearsheet>
26
+ );
27
+ };
@@ -0,0 +1,112 @@
1
+ import React from 'react';
2
+ import {
3
+ Tearsheet,
4
+ Tearsheet as MyTearsheet,
5
+ Tearsheet as AnotherSheet,
6
+ } from '@carbon/ibm-products';
7
+ import { Button } from '@carbon/react';
8
+
9
+ // Edge Case 1: Multiple imports with different aliases
10
+ export const MultipleAliases = () => {
11
+ return (
12
+ <>
13
+ <Tearsheet open={true} onClose={() => {}} title="Standard">
14
+ <div>Content 1</div>
15
+ </Tearsheet>
16
+ <MyTearsheet open={true} onClose={() => {}} title="Aliased">
17
+ <div>Content 2</div>
18
+ </MyTearsheet>
19
+ </>
20
+ );
21
+ };
22
+
23
+ // Edge Case 2: No JSX usage (import only)
24
+ export const ImportOnly = () => {
25
+ const config = {
26
+ component: Tearsheet,
27
+ };
28
+ return <div>No Tearsheet JSX here</div>;
29
+ };
30
+
31
+ // Edge Case 3: Tearsheet with no props at all
32
+ export const NoProps = () => {
33
+ return (
34
+ <Tearsheet>
35
+ <div>Minimal</div>
36
+ </Tearsheet>
37
+ );
38
+ };
39
+
40
+ // Edge Case 4: Tearsheet with only root props (no header/footer)
41
+ export const OnlyRootProps = () => {
42
+ return (
43
+ <Tearsheet open={true} onClose={() => {}} variant="wide">
44
+ <div>Just content</div>
45
+ </Tearsheet>
46
+ );
47
+ };
48
+
49
+ // Edge Case 5: Tearsheet with spread props
50
+ export const WithSpread = () => {
51
+ const props = { open: true, onClose: () => {} };
52
+ return (
53
+ <Tearsheet {...props} title="Spread">
54
+ <div>Content</div>
55
+ </Tearsheet>
56
+ );
57
+ };
58
+
59
+ // Edge Case 6: Nested Tearsheets
60
+ export const NestedTearsheets = () => {
61
+ return (
62
+ <Tearsheet open={true} onClose={() => {}} title="Outer">
63
+ <div>
64
+ <Tearsheet open={true} onClose={() => {}} title="Inner">
65
+ <div>Nested content</div>
66
+ </Tearsheet>
67
+ </div>
68
+ </Tearsheet>
69
+ );
70
+ };
71
+
72
+ // Edge Case 7: Tearsheet in conditional
73
+ export const ConditionalTearsheet = ({ show }: { show: boolean }) => {
74
+ return show ? (
75
+ <Tearsheet open={true} onClose={() => {}} title="Conditional">
76
+ <div>Content</div>
77
+ </Tearsheet>
78
+ ) : null;
79
+ };
80
+
81
+ // Edge Case 8: Tearsheet in array map
82
+ export const MappedTearsheets = () => {
83
+ const items = [1, 2, 3];
84
+ return (
85
+ <>
86
+ {items.map((i) => (
87
+ <Tearsheet key={i} open={true} onClose={() => {}} title={`Item ${i}`}>
88
+ <div>Content {i}</div>
89
+ </Tearsheet>
90
+ ))}
91
+ </>
92
+ );
93
+ };
94
+
95
+ // Edge Case 9: Tearsheet with all deprecated props
96
+ export const AllDeprecatedProps = () => {
97
+ return (
98
+ <Tearsheet
99
+ open={true}
100
+ onClose={() => {}}
101
+ slug={<div>Slug</div>}
102
+ influencerPosition="left"
103
+ title="Deprecated">
104
+ <div>Content</div>
105
+ </Tearsheet>
106
+ );
107
+ };
108
+
109
+ // Edge Case 10: Empty Tearsheet
110
+ export const EmptyTearsheet = () => {
111
+ return <Tearsheet open={true} onClose={() => {}} />;
112
+ };
@@ -0,0 +1,193 @@
1
+ import React from 'react';
2
+ import {
3
+ preview__Tearsheet as Tearsheet,
4
+ preview__Tearsheet as MyTearsheet,
5
+ preview__Tearsheet as AnotherSheet,
6
+ } from '@carbon/ibm-products';
7
+ import { Button } from '@carbon/react';
8
+
9
+ // Edge Case 1: Multiple imports with different aliases
10
+ export const MultipleAliases = () => {
11
+ return (<>
12
+ <Tearsheet open={true} onClose={() => {}}>
13
+ <Tearsheet.Header>
14
+ <Tearsheet.HeaderContent title="Standard"></Tearsheet.HeaderContent>
15
+ </Tearsheet.Header>
16
+ <Tearsheet.Body>
17
+ <Tearsheet.MainContent>
18
+
19
+ <div>Content 1</div>
20
+
21
+ </Tearsheet.MainContent>
22
+ </Tearsheet.Body>
23
+ </Tearsheet>
24
+ <MyTearsheet open={true} onClose={() => {}}>
25
+ <MyTearsheet.Header>
26
+ <MyTearsheet.HeaderContent title="Aliased"></MyTearsheet.HeaderContent>
27
+ </MyTearsheet.Header>
28
+ <MyTearsheet.Body>
29
+ <MyTearsheet.MainContent>
30
+
31
+ <div>Content 2</div>
32
+
33
+ </MyTearsheet.MainContent>
34
+ </MyTearsheet.Body>
35
+ </MyTearsheet>
36
+ </>);
37
+ };
38
+
39
+ // Edge Case 2: No JSX usage (import only)
40
+ export const ImportOnly = () => {
41
+ const config = {
42
+ component: Tearsheet,
43
+ };
44
+ return <div>No Tearsheet JSX here</div>;
45
+ };
46
+
47
+ // Edge Case 3: Tearsheet with no props at all
48
+ export const NoProps = () => {
49
+ return (
50
+ <Tearsheet>
51
+ <Tearsheet.Body>
52
+ <Tearsheet.MainContent>
53
+
54
+ <div>Minimal</div>
55
+
56
+ </Tearsheet.MainContent>
57
+ </Tearsheet.Body>
58
+ </Tearsheet>
59
+ );
60
+ };
61
+
62
+ // Edge Case 4: Tearsheet with only root props (no header/footer)
63
+ export const OnlyRootProps = () => {
64
+ return (
65
+ <Tearsheet open={true} onClose={() => {}} variant="wide">
66
+ <Tearsheet.Body>
67
+ <Tearsheet.MainContent>
68
+
69
+ <div>Just content</div>
70
+
71
+ </Tearsheet.MainContent>
72
+ </Tearsheet.Body>
73
+ </Tearsheet>
74
+ );
75
+ };
76
+
77
+ // Edge Case 5: Tearsheet with spread props
78
+ export const WithSpread = () => {
79
+ const props = { open: true, onClose: () => {} };
80
+ return (
81
+ <Tearsheet {...props}>
82
+ <Tearsheet.Header>
83
+ <Tearsheet.HeaderContent title="Spread"></Tearsheet.HeaderContent>
84
+ </Tearsheet.Header>
85
+ <Tearsheet.Body>
86
+ <Tearsheet.MainContent>
87
+
88
+ <div>Content</div>
89
+
90
+ </Tearsheet.MainContent>
91
+ </Tearsheet.Body>
92
+ </Tearsheet>
93
+ );
94
+ };
95
+
96
+ // Edge Case 6: Nested Tearsheets
97
+ export const NestedTearsheets = () => {
98
+ return (
99
+ <Tearsheet open={true} onClose={() => {}}>
100
+ <Tearsheet.Header>
101
+ <Tearsheet.HeaderContent title="Outer"></Tearsheet.HeaderContent>
102
+ </Tearsheet.Header>
103
+ <Tearsheet.Body>
104
+ <Tearsheet.MainContent>
105
+
106
+ <div>
107
+ <Tearsheet open={true} onClose={() => {}}>
108
+ <Tearsheet.Header>
109
+ <Tearsheet.HeaderContent title="Inner"></Tearsheet.HeaderContent>
110
+ </Tearsheet.Header>
111
+ <Tearsheet.Body>
112
+ <Tearsheet.MainContent>
113
+
114
+ <div>Nested content</div>
115
+
116
+ </Tearsheet.MainContent>
117
+ </Tearsheet.Body>
118
+ </Tearsheet>
119
+ </div>
120
+
121
+ </Tearsheet.MainContent>
122
+ </Tearsheet.Body>
123
+ </Tearsheet>
124
+ );
125
+ };
126
+
127
+ // Edge Case 7: Tearsheet in conditional
128
+ export const ConditionalTearsheet = ({ show }: { show: boolean }) => {
129
+ return show ? (
130
+ <Tearsheet open={true} onClose={() => {}}>
131
+ <Tearsheet.Header>
132
+ <Tearsheet.HeaderContent title="Conditional"></Tearsheet.HeaderContent>
133
+ </Tearsheet.Header>
134
+ <Tearsheet.Body>
135
+ <Tearsheet.MainContent>
136
+
137
+ <div>Content</div>
138
+
139
+ </Tearsheet.MainContent>
140
+ </Tearsheet.Body>
141
+ </Tearsheet>
142
+ ) : null;
143
+ };
144
+
145
+ // Edge Case 8: Tearsheet in array map
146
+ export const MappedTearsheets = () => {
147
+ const items = [1, 2, 3];
148
+ return (<>
149
+ {items.map((i) => (
150
+ <Tearsheet key={i} open={true} onClose={() => {}}>
151
+ <Tearsheet.Header>
152
+ <Tearsheet.HeaderContent title={`Item ${i}`}></Tearsheet.HeaderContent>
153
+ </Tearsheet.Header>
154
+ <Tearsheet.Body>
155
+ <Tearsheet.MainContent>
156
+
157
+ <div>Content {i}</div>
158
+
159
+ </Tearsheet.MainContent>
160
+ </Tearsheet.Body>
161
+ </Tearsheet>
162
+ ))}
163
+ </>);
164
+ };
165
+
166
+ // Edge Case 9: Tearsheet with all deprecated props
167
+ export const AllDeprecatedProps = () => {
168
+ return (
169
+ <Tearsheet open={true} onClose={() => {}} decorator={<div>Slug</div>}>
170
+ <Tearsheet.Header>
171
+ <Tearsheet.HeaderContent title="Deprecated"></Tearsheet.HeaderContent>
172
+ </Tearsheet.Header>
173
+ <Tearsheet.Body>
174
+ <Tearsheet.MainContent>
175
+
176
+ <div>Content</div>
177
+
178
+ </Tearsheet.MainContent>
179
+ </Tearsheet.Body>
180
+ </Tearsheet>
181
+ );
182
+ };
183
+
184
+ // Edge Case 10: Empty Tearsheet
185
+ export const EmptyTearsheet = () => {
186
+ return (
187
+ <Tearsheet open={true} onClose={() => {}}>
188
+ <Tearsheet.Body>
189
+ <Tearsheet.MainContent></Tearsheet.MainContent>
190
+ </Tearsheet.Body>
191
+ </Tearsheet>
192
+ );
193
+ };
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { preview__Tearsheet as Tearsheet } from '@carbon/ibm-products';
3
+
4
+ // Test: Already migrated code should not be transformed again (idempotency)
5
+ export const AlreadyMigrated = () => {
6
+ return (
7
+ <Tearsheet open={true} onClose={() => {}}>
8
+ <Tearsheet.Header>
9
+ <Tearsheet.HeaderContent title="Already Migrated" />
10
+ </Tearsheet.Header>
11
+ <Tearsheet.Body>
12
+ <Tearsheet.MainContent>
13
+ <div>Body content</div>
14
+ </Tearsheet.MainContent>
15
+ </Tearsheet.Body>
16
+ </Tearsheet>
17
+ );
18
+ };
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { preview__Tearsheet as Tearsheet } from '@carbon/ibm-products';
3
+
4
+ // Test: Already migrated code should not be transformed again (idempotency)
5
+ export const AlreadyMigrated = () => {
6
+ return (
7
+ <Tearsheet open={true} onClose={() => {}}>
8
+ <Tearsheet.Header>
9
+ <Tearsheet.HeaderContent title="Already Migrated" />
10
+ </Tearsheet.Header>
11
+ <Tearsheet.Body>
12
+ <Tearsheet.MainContent>
13
+ <div>Body content</div>
14
+ </Tearsheet.MainContent>
15
+ </Tearsheet.Body>
16
+ </Tearsheet>
17
+ );
18
+ };
@@ -0,0 +1,202 @@
1
+ import React from 'react';
2
+ import { Tearsheet } from '@carbon/ibm-products';
3
+ import { Button, Form, FormGroup, TextInput } from '@carbon/react';
4
+
5
+ // Test 1: Simple Tearsheet with title and actions
6
+ function SimpleTearsheet() {
7
+ return (
8
+ <Tearsheet
9
+ open={true}
10
+ onClose={() => {}}
11
+ title="Simple Tearsheet"
12
+ label="Customer data"
13
+ actions={[
14
+ { label: 'Cancel', onClick: () => {} },
15
+ { label: 'Submit', onClick: () => {} },
16
+ ]}>
17
+ <Form>
18
+ <TextInput id="name" labelText="Name" />
19
+ </Form>
20
+ </Tearsheet>
21
+ );
22
+ }
23
+
24
+ // Test 2: Tearsheet with influencer
25
+ function TearsheetWithInfluencer() {
26
+ return (
27
+ <Tearsheet
28
+ open={true}
29
+ onClose={() => {}}
30
+ title="With Influencer"
31
+ label="Data"
32
+ description="This is a description"
33
+ influencer={<div>Influencer content</div>}
34
+ influencerWidth="narrow">
35
+ <div>Main content</div>
36
+ </Tearsheet>
37
+ );
38
+ }
39
+
40
+ // Test 3: Tearsheet with navigation
41
+ function TearsheetWithNavigation() {
42
+ return (
43
+ <Tearsheet
44
+ open={true}
45
+ onClose={() => {}}
46
+ title="With Navigation"
47
+ navigation={<div>Navigation tabs</div>}
48
+ actions={[{ label: 'Close', onClick: () => {} }]}>
49
+ <div>Content</div>
50
+ </Tearsheet>
51
+ );
52
+ }
53
+
54
+ // Test 4: Tearsheet with headerActions
55
+ function TearsheetWithHeaderActions() {
56
+ return (
57
+ <Tearsheet
58
+ open={true}
59
+ onClose={() => {}}
60
+ title="With Header Actions"
61
+ label="Label"
62
+ headerActions={<Button>Action</Button>}>
63
+ <div>Content</div>
64
+ </Tearsheet>
65
+ );
66
+ }
67
+
68
+ // Test 5: Tearsheet with deprecated slug prop
69
+ function TearsheetWithSlug() {
70
+ return (
71
+ <Tearsheet
72
+ open={true}
73
+ onClose={() => {}}
74
+ title="With Slug"
75
+ slug={<div>Slug content</div>}>
76
+ <div>Content</div>
77
+ </Tearsheet>
78
+ );
79
+ }
80
+
81
+ // Test 6: Tearsheet with all features
82
+ function CompleteTearsheet() {
83
+ return (
84
+ <Tearsheet
85
+ open={true}
86
+ onClose={() => {}}
87
+ title="Complete Tearsheet"
88
+ label="All features"
89
+ description="This has everything"
90
+ decorator={<div>Decorator</div>}
91
+ influencer={<div>Influencer</div>}
92
+ influencerWidth="wide"
93
+ navigation={<div>Navigation</div>}
94
+ headerActions={<Button>Header Action</Button>}
95
+ actions={[
96
+ { label: 'Cancel', onClick: () => {} },
97
+ { label: 'Submit', onClick: () => {} },
98
+ ]}
99
+ preventCloseOnClickOutside={true}
100
+ variant="wide">
101
+ <Form>
102
+ <TextInput id="field1" labelText="Field 1" />
103
+ <TextInput id="field2" labelText="Field 2" />
104
+ </Form>
105
+ </Tearsheet>
106
+ );
107
+ }
108
+
109
+ // Test 7: Minimal Tearsheet (no header props)
110
+ function MinimalTearsheet() {
111
+ return (
112
+ <Tearsheet open={true} onClose={() => {}}>
113
+ <div>Just content</div>
114
+ </Tearsheet>
115
+ );
116
+ }
117
+
118
+ // Test 8: Tearsheet with deprecated influencerPosition (should be removed)
119
+ function TearsheetWithInfluencerPosition() {
120
+ return (
121
+ <Tearsheet
122
+ open={true}
123
+ onClose={() => {}}
124
+ title="Test"
125
+ influencer={<div>Influencer</div>}
126
+ influencerPosition="left">
127
+ <div>Content</div>
128
+ </Tearsheet>
129
+ );
130
+ }
131
+
132
+ // Test 9: Stacked Tearsheets (multiple tearsheets)
133
+ function StackedTearsheets() {
134
+ const [open1, setOpen1] = React.useState(false);
135
+ const [open2, setOpen2] = React.useState(false);
136
+
137
+ return (
138
+ <>
139
+ <Tearsheet
140
+ open={open1}
141
+ onClose={() => setOpen1(false)}
142
+ title="Tearsheet 1"
143
+ label="First"
144
+ actions={[{ label: 'Close', onClick: () => setOpen1(false) }]}>
145
+ <div>Content 1</div>
146
+ </Tearsheet>
147
+ <Tearsheet
148
+ open={open2}
149
+ onClose={() => setOpen2(false)}
150
+ title="Tearsheet 2"
151
+ label="Second"
152
+ actions={[{ label: 'Close', onClick: () => setOpen2(false) }]}>
153
+ <div>Content 2</div>
154
+ </Tearsheet>
155
+ </>
156
+ );
157
+ }
158
+
159
+ // Test 10: Tearsheet with spread props
160
+ function TearsheetWithSpreadProps() {
161
+ const commonProps = {
162
+ open: true,
163
+ onClose: () => {},
164
+ variant: 'wide',
165
+ };
166
+
167
+ return (
168
+ <Tearsheet {...commonProps} title="With Spread" label="Spread props">
169
+ <div>Content</div>
170
+ </Tearsheet>
171
+ );
172
+ }
173
+
174
+ // Test 11: Tearsheet with complex children
175
+ function TearsheetWithComplexChildren() {
176
+ return (
177
+ <Tearsheet
178
+ open={true}
179
+ onClose={() => {}}
180
+ title="Complex Children"
181
+ actions={[{ label: 'Submit', onClick: () => {} }]}>
182
+ <Form>
183
+ <FormGroup legendText="Section 1">
184
+ <TextInput id="field1" labelText="Field 1" />
185
+ <TextInput id="field2" labelText="Field 2" />
186
+ </FormGroup>
187
+ <FormGroup legendText="Section 2">
188
+ <TextInput id="field3" labelText="Field 3" />
189
+ </FormGroup>
190
+ </Form>
191
+ </Tearsheet>
192
+ );
193
+ }
194
+
195
+ // Test 12: Tearsheet with only decorator (no other header props)
196
+ function TearsheetWithOnlyDecorator() {
197
+ return (
198
+ <Tearsheet open={true} onClose={() => {}} decorator={<div>Decorator</div>}>
199
+ <div>Content</div>
200
+ </Tearsheet>
201
+ );
202
+ }