@atlaskit/ads-mcp 0.10.0 → 0.11.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/CHANGELOG.md +20 -0
- package/dist/cjs/helpers/analytics.js +2 -2
- package/dist/cjs/index.js +6 -1
- package/dist/cjs/tools/get-tokens/token-structured-content.codegen.js +101 -1
- package/dist/cjs/tools/migration-guides/index.js +78 -0
- package/dist/cjs/tools/migration-guides/migrations/onboarding-to-spotlight.js +55 -0
- package/dist/cjs/tools/migration-guides/registry.js +36 -0
- package/dist/cjs/tools/migration-guides/types.js +1 -0
- package/dist/es2019/helpers/analytics.js +2 -2
- package/dist/es2019/index.js +6 -0
- package/dist/es2019/tools/analyze-a11y/index.js +1 -1
- package/dist/es2019/tools/get-tokens/token-structured-content.codegen.js +101 -1
- package/dist/es2019/tools/migration-guides/index.js +58 -0
- package/dist/es2019/tools/migration-guides/migrations/onboarding-to-spotlight.js +416 -0
- package/dist/es2019/tools/migration-guides/registry.js +30 -0
- package/dist/es2019/tools/migration-guides/types.js +0 -0
- package/dist/esm/helpers/analytics.js +2 -2
- package/dist/esm/index.js +6 -1
- package/dist/esm/tools/get-tokens/token-structured-content.codegen.js +101 -1
- package/dist/esm/tools/migration-guides/index.js +72 -0
- package/dist/esm/tools/migration-guides/migrations/onboarding-to-spotlight.js +49 -0
- package/dist/esm/tools/migration-guides/registry.js +29 -0
- package/dist/esm/tools/migration-guides/types.js +0 -0
- package/dist/types/tools/get-tokens/token-structured-content.codegen.d.ts +1 -1
- package/dist/types/tools/migration-guides/index.d.ts +16 -0
- package/dist/types/tools/migration-guides/migrations/onboarding-to-spotlight.d.ts +4 -0
- package/dist/types/tools/migration-guides/registry.d.ts +19 -0
- package/dist/types/tools/migration-guides/types.d.ts +23 -0
- package/dist/types-ts4.5/tools/get-tokens/token-structured-content.codegen.d.ts +1 -1
- package/dist/types-ts4.5/tools/migration-guides/index.d.ts +19 -0
- package/dist/types-ts4.5/tools/migration-guides/migrations/onboarding-to-spotlight.d.ts +4 -0
- package/dist/types-ts4.5/tools/migration-guides/registry.d.ts +19 -0
- package/dist/types-ts4.5/tools/migration-guides/types.d.ts +23 -0
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Structured content for tokens generated from token-metadata.
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::71826c7e9b24620099bd0316f7a0a305>>
|
|
7
7
|
* @codegenCommand yarn build structured-docs
|
|
8
8
|
*/
|
|
9
9
|
|
|
@@ -137,6 +137,11 @@ export const tokenStructuredContent = [{
|
|
|
137
137
|
name: 'color.text.danger',
|
|
138
138
|
description: 'Use for critical text, such as input field error messaging.',
|
|
139
139
|
exampleValue: '#AE2E24'
|
|
140
|
+
}, {
|
|
141
|
+
content: '# color.text.danger.bolder\n\nUse for text on top of danger semantic labels to ensure accessibility and desired visual appearance.\n\nExample Value: `#5D1F1A`\n',
|
|
142
|
+
name: 'color.text.danger.bolder',
|
|
143
|
+
description: 'Use for text on top of danger semantic labels to ensure accessibility and desired visual appearance.',
|
|
144
|
+
exampleValue: '#5D1F1A'
|
|
140
145
|
}, {
|
|
141
146
|
content: '# color.text.warning\n\nUse for text to emphasize caution, such as in moved lozenges.\n\nExample Value: `#9E4C00`\n',
|
|
142
147
|
name: 'color.text.warning',
|
|
@@ -147,21 +152,41 @@ export const tokenStructuredContent = [{
|
|
|
147
152
|
name: 'color.text.warning.inverse',
|
|
148
153
|
description: 'Use for text when on bold warning backgrounds.',
|
|
149
154
|
exampleValue: '#292A2E'
|
|
155
|
+
}, {
|
|
156
|
+
content: '# color.text.warning.bolder\n\nUse for text on top of warning semantic labels to ensure accessibility and desired visual appearance.\n\nExample Value: `#693200`\n',
|
|
157
|
+
name: 'color.text.warning.bolder',
|
|
158
|
+
description: 'Use for text on top of warning semantic labels to ensure accessibility and desired visual appearance.',
|
|
159
|
+
exampleValue: '#693200'
|
|
150
160
|
}, {
|
|
151
161
|
content: '# color.text.success\n\nUse for text to communicate a favorable outcome, such as input field success messaging.\n\nExample Value: `#4C6B1F`\n',
|
|
152
162
|
name: 'color.text.success',
|
|
153
163
|
description: 'Use for text to communicate a favorable outcome, such as input field success messaging.',
|
|
154
164
|
exampleValue: '#4C6B1F'
|
|
165
|
+
}, {
|
|
166
|
+
content: '# color.text.success.bolder\n\nUse for text on top of success semantic labels to ensure accessibility and desired visual appearance.\n\nExample Value: `#37471F`\n',
|
|
167
|
+
name: 'color.text.success.bolder',
|
|
168
|
+
description: 'Use for text on top of success semantic labels to ensure accessibility and desired visual appearance.',
|
|
169
|
+
exampleValue: '#37471F'
|
|
155
170
|
}, {
|
|
156
171
|
content: '# color.text.discovery\n\nUse for text to emphasize change or something new, such as in new lozenges.\n\nExample Value: `#803FA5`\n',
|
|
157
172
|
name: 'color.text.discovery',
|
|
158
173
|
description: 'Use for text to emphasize change or something new, such as in new lozenges.',
|
|
159
174
|
exampleValue: '#803FA5'
|
|
175
|
+
}, {
|
|
176
|
+
content: '# color.text.discovery.bolder\n\nUse for text on top of discovery semantic labels to ensure accessibility and desired visual appearance.\n\nExample Value: `#48245D`\n',
|
|
177
|
+
name: 'color.text.discovery.bolder',
|
|
178
|
+
description: 'Use for text on top of discovery semantic labels to ensure accessibility and desired visual appearance.',
|
|
179
|
+
exampleValue: '#48245D'
|
|
160
180
|
}, {
|
|
161
181
|
content: '# color.text.information\n\nUse for informative text or to communicate something is in progress, such as in-progress lozenges.\n\nExample Value: `#1558BC`\n',
|
|
162
182
|
name: 'color.text.information',
|
|
163
183
|
description: 'Use for informative text or to communicate something is in progress, such as in-progress lozenges.',
|
|
164
184
|
exampleValue: '#1558BC'
|
|
185
|
+
}, {
|
|
186
|
+
content: '# color.text.information.bolder\n\nUse for text on top of information semantic labels to ensure accessibility and desired visual appearance.\n\nExample Value: `#123263`\n',
|
|
187
|
+
name: 'color.text.information.bolder',
|
|
188
|
+
description: 'Use for text on top of information semantic labels to ensure accessibility and desired visual appearance.',
|
|
189
|
+
exampleValue: '#123263'
|
|
165
190
|
}, {
|
|
166
191
|
content: '# color.text.subtlest\n\nUse for tertiary text, such as meta-data, breadcrumbs, input field placeholder and helper text.\n\nExample Value: `#6B6E76`\n',
|
|
167
192
|
name: 'color.text.subtlest',
|
|
@@ -1192,6 +1217,21 @@ export const tokenStructuredContent = [{
|
|
|
1192
1217
|
name: 'color.background.danger.pressed',
|
|
1193
1218
|
description: 'Pressed state for color.background.danger',
|
|
1194
1219
|
exampleValue: '#FFB8B2'
|
|
1220
|
+
}, {
|
|
1221
|
+
content: '# color.background.danger.subtler\n\nUse for backgrounds of danger lozenges and badges to ensure accessibility and desired visual appearance.\n\nExample Value: `#FFD5D2`\n',
|
|
1222
|
+
name: 'color.background.danger.subtler',
|
|
1223
|
+
description: 'Use for backgrounds of danger lozenges and badges to ensure accessibility and desired visual appearance.',
|
|
1224
|
+
exampleValue: '#FFD5D2'
|
|
1225
|
+
}, {
|
|
1226
|
+
content: '# color.background.danger.subtler.hovered\n\nHovered state of color.background.danger.subtler\n\nExample Value: `#FFB8B2`\n',
|
|
1227
|
+
name: 'color.background.danger.subtler.hovered',
|
|
1228
|
+
description: 'Hovered state of color.background.danger.subtler',
|
|
1229
|
+
exampleValue: '#FFB8B2'
|
|
1230
|
+
}, {
|
|
1231
|
+
content: '# color.background.danger.subtler.pressed\n\nPressed state of color.background.danger.subtler\n\nExample Value: `#FD9891`\n',
|
|
1232
|
+
name: 'color.background.danger.subtler.pressed',
|
|
1233
|
+
description: 'Pressed state of color.background.danger.subtler',
|
|
1234
|
+
exampleValue: '#FD9891'
|
|
1195
1235
|
}, {
|
|
1196
1236
|
content: '# color.background.danger.bold\n\nA vibrant background option for communicating critical information, such as in danger buttons and error banners.\n\nExample Value: `#C9372C`\n',
|
|
1197
1237
|
name: 'color.background.danger.bold',
|
|
@@ -1222,6 +1262,21 @@ export const tokenStructuredContent = [{
|
|
|
1222
1262
|
name: 'color.background.warning.pressed',
|
|
1223
1263
|
description: 'Pressed state for color.background.warning',
|
|
1224
1264
|
exampleValue: '#FBD779'
|
|
1265
|
+
}, {
|
|
1266
|
+
content: '# color.background.warning.subtler\n\nUse for backgrounds of warning lozenges and badges to ensure accessibility and desired visual appearance.\n\nExample Value: `#FCE4A6`\n',
|
|
1267
|
+
name: 'color.background.warning.subtler',
|
|
1268
|
+
description: 'Use for backgrounds of warning lozenges and badges to ensure accessibility and desired visual appearance.',
|
|
1269
|
+
exampleValue: '#FCE4A6'
|
|
1270
|
+
}, {
|
|
1271
|
+
content: '# color.background.warning.subtler.hovered\n\nHovered state of color.background.warning.subtler\n\nExample Value: `#FBD779`\n',
|
|
1272
|
+
name: 'color.background.warning.subtler.hovered',
|
|
1273
|
+
description: 'Hovered state of color.background.warning.subtler',
|
|
1274
|
+
exampleValue: '#FBD779'
|
|
1275
|
+
}, {
|
|
1276
|
+
content: '# color.background.warning.subtler.pressed\n\nPressed state of color.background.warning.subtler\n\nExample Value: `#FBC828`\n',
|
|
1277
|
+
name: 'color.background.warning.subtler.pressed',
|
|
1278
|
+
description: 'Pressed state of color.background.warning.subtler',
|
|
1279
|
+
exampleValue: '#FBC828'
|
|
1225
1280
|
}, {
|
|
1226
1281
|
content: '# color.background.warning.bold\n\nA vibrant background option for communicating caution, such as in warning buttons and warning banners.\n\nExample Value: `#FBC828`\n',
|
|
1227
1282
|
name: 'color.background.warning.bold',
|
|
@@ -1252,6 +1307,21 @@ export const tokenStructuredContent = [{
|
|
|
1252
1307
|
name: 'color.background.success.pressed',
|
|
1253
1308
|
description: 'Pressed state for color.background.success',
|
|
1254
1309
|
exampleValue: '#BDE97C'
|
|
1310
|
+
}, {
|
|
1311
|
+
content: '# color.background.success.subtler\n\nUse for backgrounds of success lozenges and badges to ensure accessibility and desired visual appearance.\n\nExample Value: `#D3F1A7`\n',
|
|
1312
|
+
name: 'color.background.success.subtler',
|
|
1313
|
+
description: 'Use for backgrounds of success lozenges and badges to ensure accessibility and desired visual appearance.',
|
|
1314
|
+
exampleValue: '#D3F1A7'
|
|
1315
|
+
}, {
|
|
1316
|
+
content: '# color.background.success.subtler.hovered\n\nHovered state of color.background.success.subtler\n\nExample Value: `#BDE97C`\n',
|
|
1317
|
+
name: 'color.background.success.subtler.hovered',
|
|
1318
|
+
description: 'Hovered state of color.background.success.subtler',
|
|
1319
|
+
exampleValue: '#BDE97C'
|
|
1320
|
+
}, {
|
|
1321
|
+
content: '# color.background.success.subtler.pressed\n\nPressed state of color.background.success.subtler\n\nExample Value: `#B3DF72`\n',
|
|
1322
|
+
name: 'color.background.success.subtler.pressed',
|
|
1323
|
+
description: 'Pressed state of color.background.success.subtler',
|
|
1324
|
+
exampleValue: '#B3DF72'
|
|
1255
1325
|
}, {
|
|
1256
1326
|
content: '# color.background.success.bold\n\nA vibrant background option for communicating a favorable outcome, such as in checked toggles.\n\nExample Value: `#5B7F24`\n',
|
|
1257
1327
|
name: 'color.background.success.bold',
|
|
@@ -1282,6 +1352,21 @@ export const tokenStructuredContent = [{
|
|
|
1282
1352
|
name: 'color.background.discovery.pressed',
|
|
1283
1353
|
description: 'Pressed state for color.background.discovery',
|
|
1284
1354
|
exampleValue: '#E3BDFA'
|
|
1355
|
+
}, {
|
|
1356
|
+
content: '# color.background.discovery.subtler\n\nUse for backgrounds of discovery lozenges and badges to ensure accessibility and desired visual appearance.\n\nExample Value: `#EED7FC`\n',
|
|
1357
|
+
name: 'color.background.discovery.subtler',
|
|
1358
|
+
description: 'Use for backgrounds of discovery lozenges and badges to ensure accessibility and desired visual appearance.',
|
|
1359
|
+
exampleValue: '#EED7FC'
|
|
1360
|
+
}, {
|
|
1361
|
+
content: '# color.background.discovery.subtler.hovered\n\nHovered state of color.background.discovery.subtler\n\nExample Value: `#E3BDFA`\n',
|
|
1362
|
+
name: 'color.background.discovery.subtler.hovered',
|
|
1363
|
+
description: 'Hovered state of color.background.discovery.subtler',
|
|
1364
|
+
exampleValue: '#E3BDFA'
|
|
1365
|
+
}, {
|
|
1366
|
+
content: '# color.background.discovery.subtler.pressed\n\nPressed state of color.background.discovery.subtler\n\nExample Value: `#D8A0F7`\n',
|
|
1367
|
+
name: 'color.background.discovery.subtler.pressed',
|
|
1368
|
+
description: 'Pressed state of color.background.discovery.subtler',
|
|
1369
|
+
exampleValue: '#D8A0F7'
|
|
1285
1370
|
}, {
|
|
1286
1371
|
content: '# color.background.discovery.bold\n\nA vibrant background option communicating change or something new, such as in onboarding spotlights.\n\nExample Value: `#964AC0`\n',
|
|
1287
1372
|
name: 'color.background.discovery.bold',
|
|
@@ -1312,6 +1397,21 @@ export const tokenStructuredContent = [{
|
|
|
1312
1397
|
name: 'color.background.information.pressed',
|
|
1313
1398
|
description: 'Pressed state of color.background.information',
|
|
1314
1399
|
exampleValue: '#ADCBFB'
|
|
1400
|
+
}, {
|
|
1401
|
+
content: '# color.background.information.subtler\n\nUse for backgrounds of information lozenges and badges to ensure accessibility and desired visual appearance.\n\nExample Value: `#CFE1FD`\n',
|
|
1402
|
+
name: 'color.background.information.subtler',
|
|
1403
|
+
description: 'Use for backgrounds of information lozenges and badges to ensure accessibility and desired visual appearance.',
|
|
1404
|
+
exampleValue: '#CFE1FD'
|
|
1405
|
+
}, {
|
|
1406
|
+
content: '# color.background.information.subtler.hovered\n\nHovered state of color.background.information.subtler\n\nExample Value: `#ADCBFB`\n',
|
|
1407
|
+
name: 'color.background.information.subtler.hovered',
|
|
1408
|
+
description: 'Hovered state of color.background.information.subtler',
|
|
1409
|
+
exampleValue: '#ADCBFB'
|
|
1410
|
+
}, {
|
|
1411
|
+
content: '# color.background.information.subtler.pressed\n\nPressed state of color.background.information.subtler\n\nExample Value: `#8FB8F6`\n',
|
|
1412
|
+
name: 'color.background.information.subtler.pressed',
|
|
1413
|
+
description: 'Pressed state of color.background.information.subtler',
|
|
1414
|
+
exampleValue: '#8FB8F6'
|
|
1315
1415
|
}, {
|
|
1316
1416
|
content: '# color.background.information.bold\n\nA vibrant background option for communicating information or something in-progress.\n\nExample Value: `#1868DB`\n',
|
|
1317
1417
|
name: 'color.background.information.bold',
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { zodToJsonSchema } from '../../helpers';
|
|
3
|
+
import { getAvailableMigrationIds, getAvailableMigrationsDescription, migrationRegistry } from './registry';
|
|
4
|
+
|
|
5
|
+
// Build the enum dynamically from the registry
|
|
6
|
+
const migrationIds = getAvailableMigrationIds();
|
|
7
|
+
export const migrationGuidesInputSchema = z.object({
|
|
8
|
+
migration: z.enum(migrationIds).describe(`The specific migration to perform.\n`)
|
|
9
|
+
});
|
|
10
|
+
export const listMigrationGuidesTool = {
|
|
11
|
+
name: 'ads_migration_guides',
|
|
12
|
+
description: `Provides migration guides for deprecated Atlassian Design System components. Returns before/after examples, best practices, and step-by-step migration instructions.
|
|
13
|
+
|
|
14
|
+
Available migrations:\n${getAvailableMigrationsDescription()}`,
|
|
15
|
+
annotations: {
|
|
16
|
+
title: 'ADS Migration Guides',
|
|
17
|
+
readOnlyHint: true,
|
|
18
|
+
destructiveHint: false,
|
|
19
|
+
idempotentHint: true,
|
|
20
|
+
openWorldHint: false
|
|
21
|
+
},
|
|
22
|
+
inputSchema: zodToJsonSchema(migrationGuidesInputSchema)
|
|
23
|
+
};
|
|
24
|
+
export const migrationGuidesTool = async params => {
|
|
25
|
+
const {
|
|
26
|
+
migration
|
|
27
|
+
} = params;
|
|
28
|
+
const guide = migrationRegistry[migration];
|
|
29
|
+
if (!guide) {
|
|
30
|
+
// This shouldn't happen if the schema validation works, but handle gracefully
|
|
31
|
+
return {
|
|
32
|
+
content: [{
|
|
33
|
+
type: 'text',
|
|
34
|
+
text: JSON.stringify({
|
|
35
|
+
error: `Unknown migration: ${migration}`,
|
|
36
|
+
availableMigrations: getAvailableMigrationIds(),
|
|
37
|
+
suggestion: 'Please use one of the available migration IDs listed above.'
|
|
38
|
+
}, null, 2)
|
|
39
|
+
}]
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
content: [{
|
|
44
|
+
type: 'text',
|
|
45
|
+
text: JSON.stringify({
|
|
46
|
+
migration: guide.id,
|
|
47
|
+
title: guide.title,
|
|
48
|
+
description: guide.description,
|
|
49
|
+
fromPackage: guide.fromPackage,
|
|
50
|
+
toPackage: guide.toPackage,
|
|
51
|
+
examples: guide.examples,
|
|
52
|
+
bestPractices: guide.bestPractices,
|
|
53
|
+
additionalResources: guide.additionalResources,
|
|
54
|
+
nextSteps: ['Review the before/after examples to understand the migration pattern', 'Apply the migration pattern', 'Follow the best practices listed above', 'Test the migrated code thoroughly']
|
|
55
|
+
}, null, 2)
|
|
56
|
+
}]
|
|
57
|
+
};
|
|
58
|
+
};
|
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
const additionalResources = "Visit https://hello.atlassian.net/wiki/spaces/DST/pages/6069774593 or https://atlassian.design/components/spotlight for more context";
|
|
2
|
+
export const onboardingSingleStep = {
|
|
3
|
+
id: 'onboarding-single-step',
|
|
4
|
+
title: 'Single Step Spotlight Migration',
|
|
5
|
+
description: 'Migrate a single step spotlight from @atlaskit/onboarding to @atlaskit/spotlight',
|
|
6
|
+
fromPackage: '@atlaskit/onboarding',
|
|
7
|
+
toPackage: '@atlaskit/spotlight',
|
|
8
|
+
examples: [{
|
|
9
|
+
title: 'Migrate single step spotlight',
|
|
10
|
+
description: 'Replace SpotlightManager, SpotlightTarget, SpotlightTransition, and Spotlight with the new compositional @atlaskit/spotlight components',
|
|
11
|
+
before: `import React, { useState } from 'react';
|
|
12
|
+
import Button from '@atlaskit/button/new';
|
|
13
|
+
import {
|
|
14
|
+
Spotlight,
|
|
15
|
+
SpotlightManager,
|
|
16
|
+
SpotlightTarget,
|
|
17
|
+
SpotlightTransition,
|
|
18
|
+
} from '@atlaskit/onboarding';
|
|
19
|
+
|
|
20
|
+
const OnboardingSpotlight = () => {
|
|
21
|
+
const [isSpotlightActive, setIsSpotlightActive] = useState(false);
|
|
22
|
+
const start = () => setIsSpotlightActive(true);
|
|
23
|
+
const end = () => setIsSpotlightActive(false);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<SpotlightManager>
|
|
27
|
+
<SpotlightTarget name="my-target">
|
|
28
|
+
<Button>Target Element</Button>
|
|
29
|
+
</SpotlightTarget>
|
|
30
|
+
<div>
|
|
31
|
+
<Button appearance="primary" onClick={start}>
|
|
32
|
+
Show spotlight
|
|
33
|
+
</Button>
|
|
34
|
+
</div>
|
|
35
|
+
<SpotlightTransition>
|
|
36
|
+
{isSpotlightActive && (
|
|
37
|
+
<Spotlight
|
|
38
|
+
actions={[
|
|
39
|
+
{
|
|
40
|
+
onClick: end,
|
|
41
|
+
text: 'Got it',
|
|
42
|
+
},
|
|
43
|
+
]}
|
|
44
|
+
heading="Feature Heading"
|
|
45
|
+
target="my-target"
|
|
46
|
+
key="my-target"
|
|
47
|
+
>
|
|
48
|
+
This is the spotlight body content describing the feature.
|
|
49
|
+
</Spotlight>
|
|
50
|
+
)}
|
|
51
|
+
</SpotlightTransition>
|
|
52
|
+
</SpotlightManager>
|
|
53
|
+
);
|
|
54
|
+
};`,
|
|
55
|
+
after: `import React, { useState } from 'react';
|
|
56
|
+
import Button from '@atlaskit/button/new';
|
|
57
|
+
import { Text } from '@atlaskit/primitives/compiled';
|
|
58
|
+
import {
|
|
59
|
+
PopoverContent,
|
|
60
|
+
PopoverProvider,
|
|
61
|
+
PopoverTarget,
|
|
62
|
+
SpotlightActions,
|
|
63
|
+
SpotlightBody,
|
|
64
|
+
SpotlightCard,
|
|
65
|
+
SpotlightControls,
|
|
66
|
+
SpotlightDismissControl,
|
|
67
|
+
SpotlightFooter,
|
|
68
|
+
SpotlightHeader,
|
|
69
|
+
SpotlightHeadline,
|
|
70
|
+
SpotlightPrimaryAction,
|
|
71
|
+
} from '@atlaskit/spotlight';
|
|
72
|
+
|
|
73
|
+
const Spotlight = () => {
|
|
74
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
75
|
+
const dismiss = () => setIsVisible(false);
|
|
76
|
+
const done = () => setIsVisible(false);
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<PopoverProvider>
|
|
80
|
+
<PopoverTarget>
|
|
81
|
+
<Button onClick={() => setIsVisible(true)}>Target Element</Button>
|
|
82
|
+
</PopoverTarget>
|
|
83
|
+
<PopoverContent dismiss={dismiss} placement="bottom-start" isVisible={isVisible}>
|
|
84
|
+
<SpotlightCard>
|
|
85
|
+
<SpotlightHeader>
|
|
86
|
+
<SpotlightHeadline>Feature Heading</SpotlightHeadline>
|
|
87
|
+
<SpotlightControls>
|
|
88
|
+
<SpotlightDismissControl />
|
|
89
|
+
</SpotlightControls>
|
|
90
|
+
</SpotlightHeader>
|
|
91
|
+
<SpotlightBody>
|
|
92
|
+
<Text>This is the spotlight body content describing the feature.</Text>
|
|
93
|
+
</SpotlightBody>
|
|
94
|
+
<SpotlightFooter>
|
|
95
|
+
<SpotlightActions>
|
|
96
|
+
<SpotlightPrimaryAction onClick={done}>Got it</SpotlightPrimaryAction>
|
|
97
|
+
</SpotlightActions>
|
|
98
|
+
</SpotlightFooter>
|
|
99
|
+
</SpotlightCard>
|
|
100
|
+
</PopoverContent>
|
|
101
|
+
</PopoverProvider>
|
|
102
|
+
);
|
|
103
|
+
};`,
|
|
104
|
+
explanation: `Key changes when migrating a single step spotlight:
|
|
105
|
+
1. Replace SpotlightManager with PopoverProvider - the new context provider
|
|
106
|
+
2. Replace SpotlightTarget with PopoverTarget - wraps the element to highlight
|
|
107
|
+
3. Replace SpotlightTransition and Spotlight with PopoverContent containing SpotlightCard - controls visibility and positioning
|
|
108
|
+
4. The 'heading' prop becomes SpotlightHeadline inside SpotlightHeader
|
|
109
|
+
5. The 'actions' array becomes SpotlightActions with SpotlightPrimaryAction (and optionally SpotlightSecondaryAction)
|
|
110
|
+
6. The children content moves into SpotlightBody wrapped with Text component
|
|
111
|
+
7. Add SpotlightDismissControl inside SpotlightControls for the close button
|
|
112
|
+
8. The 'target' prop is no longer needed - PopoverTarget automatically handles this
|
|
113
|
+
9. The 'dialogPlacement' prop becomes 'placement' on PopoverContent (e.g., 'bottom left' → 'bottom-start')`
|
|
114
|
+
}],
|
|
115
|
+
bestPractices: ['Use PopoverProvider as the root wrapper for spotlight functionality', 'PopoverTarget should wrap exactly one child element that will be highlighted', 'Always include SpotlightDismissControl for accessibility - allows users to dismiss via close button', 'Use SpotlightPrimaryAction for the main call-to-action button', 'Wrap body text content in the Text component from @atlaskit/primitives/compiled', 'Map old dialogPlacement values: "bottom left" → "bottom-start", "bottom center" → "bottom", "bottom right" → "bottom-end"'],
|
|
116
|
+
additionalResources
|
|
117
|
+
};
|
|
118
|
+
export const onboardingMultiStep = {
|
|
119
|
+
id: 'onboarding-multi-step',
|
|
120
|
+
title: 'Multi Step Spotlight Tour Migration',
|
|
121
|
+
description: 'Migrate a multi-step spotlight tour from @atlaskit/onboarding to @atlaskit/spotlight',
|
|
122
|
+
fromPackage: '@atlaskit/onboarding',
|
|
123
|
+
toPackage: '@atlaskit/spotlight',
|
|
124
|
+
examples: [{
|
|
125
|
+
title: 'Migrate multi step spotlight tour',
|
|
126
|
+
description: 'Replace the single SpotlightManager pattern with multiple PopoverProvider instances, one for each target in the tour',
|
|
127
|
+
before: `import React, { useState } from 'react';
|
|
128
|
+
import Button, { IconButton } from '@atlaskit/button/new';
|
|
129
|
+
import CommentAddIcon from '@atlaskit/icon/core/comment-add';
|
|
130
|
+
import CopyIcon from '@atlaskit/icon/core/copy';
|
|
131
|
+
import {
|
|
132
|
+
Spotlight,
|
|
133
|
+
SpotlightManager,
|
|
134
|
+
SpotlightTarget,
|
|
135
|
+
SpotlightTransition,
|
|
136
|
+
} from '@atlaskit/onboarding';
|
|
137
|
+
|
|
138
|
+
const OnboardingTour = () => {
|
|
139
|
+
const [activeSpotlight, setActiveSpotlight] = useState<null | number>(null);
|
|
140
|
+
const start = () => setActiveSpotlight(0);
|
|
141
|
+
const next = () => setActiveSpotlight((activeSpotlight || 0) + 1);
|
|
142
|
+
const back = () => setActiveSpotlight((activeSpotlight || 1) - 1);
|
|
143
|
+
const end = () => setActiveSpotlight(null);
|
|
144
|
+
|
|
145
|
+
const renderActiveSpotlight = () => {
|
|
146
|
+
const spotlights = [
|
|
147
|
+
<Spotlight
|
|
148
|
+
actions={[
|
|
149
|
+
{ onClick: () => next(), text: 'Next' },
|
|
150
|
+
{ onClick: () => end(), text: 'Dismiss', appearance: 'subtle' },
|
|
151
|
+
]}
|
|
152
|
+
heading="Add a comment"
|
|
153
|
+
target="comment"
|
|
154
|
+
key="comment"
|
|
155
|
+
>
|
|
156
|
+
Quickly add a comment to the work item.
|
|
157
|
+
</Spotlight>,
|
|
158
|
+
<Spotlight
|
|
159
|
+
actions={[
|
|
160
|
+
{ onClick: () => end(), text: 'Done' },
|
|
161
|
+
{ onClick: () => back(), text: 'Back', appearance: 'subtle' },
|
|
162
|
+
]}
|
|
163
|
+
heading="Copy code"
|
|
164
|
+
target="copy"
|
|
165
|
+
key="copy"
|
|
166
|
+
>
|
|
167
|
+
Click to copy the example code to your clipboard.
|
|
168
|
+
</Spotlight>,
|
|
169
|
+
];
|
|
170
|
+
|
|
171
|
+
if (activeSpotlight === null) {
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
return spotlights[activeSpotlight];
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
return (
|
|
178
|
+
<SpotlightManager>
|
|
179
|
+
<SpotlightTarget name="comment">
|
|
180
|
+
<IconButton icon={CommentAddIcon} label="comment" />
|
|
181
|
+
</SpotlightTarget>
|
|
182
|
+
<SpotlightTarget name="copy">
|
|
183
|
+
<IconButton icon={CopyIcon} label="Copy" />
|
|
184
|
+
</SpotlightTarget>
|
|
185
|
+
<Button appearance="primary" onClick={start}>
|
|
186
|
+
Start tour
|
|
187
|
+
</Button>
|
|
188
|
+
<SpotlightTransition>{renderActiveSpotlight()}</SpotlightTransition>
|
|
189
|
+
</SpotlightManager>
|
|
190
|
+
);
|
|
191
|
+
};`,
|
|
192
|
+
after: `import React, { useState } from 'react';
|
|
193
|
+
import Button, { IconButton } from '@atlaskit/button/new';
|
|
194
|
+
import CommentAddIcon from '@atlaskit/icon/core/comment-add';
|
|
195
|
+
import CopyIcon from '@atlaskit/icon/core/copy';
|
|
196
|
+
import { Text } from '@atlaskit/primitives/compiled';
|
|
197
|
+
import {
|
|
198
|
+
PopoverContent,
|
|
199
|
+
PopoverProvider,
|
|
200
|
+
PopoverTarget,
|
|
201
|
+
SpotlightActions,
|
|
202
|
+
SpotlightBody,
|
|
203
|
+
SpotlightCard,
|
|
204
|
+
SpotlightControls,
|
|
205
|
+
SpotlightDismissControl,
|
|
206
|
+
SpotlightFooter,
|
|
207
|
+
SpotlightHeader,
|
|
208
|
+
SpotlightHeadline,
|
|
209
|
+
SpotlightPrimaryAction,
|
|
210
|
+
SpotlightSecondaryAction,
|
|
211
|
+
SpotlightStepCount,
|
|
212
|
+
} from '@atlaskit/spotlight';
|
|
213
|
+
|
|
214
|
+
const SpotlightTour = () => {
|
|
215
|
+
const [currentStep, setCurrentStep] = useState<number>(0);
|
|
216
|
+
|
|
217
|
+
const dismiss = () => setCurrentStep(0);
|
|
218
|
+
const back = () => setCurrentStep(Math.max(currentStep - 1, 1));
|
|
219
|
+
const next = () => setCurrentStep(Math.min(currentStep + 1, 2));
|
|
220
|
+
const done = () => setCurrentStep(0);
|
|
221
|
+
|
|
222
|
+
return (
|
|
223
|
+
<>
|
|
224
|
+
<PopoverProvider>
|
|
225
|
+
<PopoverTarget>
|
|
226
|
+
<IconButton icon={CommentAddIcon} label="comment" />
|
|
227
|
+
</PopoverTarget>
|
|
228
|
+
<PopoverContent dismiss={dismiss} placement="bottom-start" isVisible={currentStep === 1}>
|
|
229
|
+
<SpotlightCard>
|
|
230
|
+
<SpotlightHeader>
|
|
231
|
+
<SpotlightHeadline>Add a comment</SpotlightHeadline>
|
|
232
|
+
<SpotlightControls>
|
|
233
|
+
<SpotlightDismissControl onClick={dismiss} />
|
|
234
|
+
</SpotlightControls>
|
|
235
|
+
</SpotlightHeader>
|
|
236
|
+
<SpotlightBody>
|
|
237
|
+
<Text>Quickly add a comment to the work item.</Text>
|
|
238
|
+
</SpotlightBody>
|
|
239
|
+
<SpotlightFooter>
|
|
240
|
+
<SpotlightStepCount>1 of 2</SpotlightStepCount>
|
|
241
|
+
<SpotlightActions>
|
|
242
|
+
<SpotlightPrimaryAction onClick={next}>Next</SpotlightPrimaryAction>
|
|
243
|
+
</SpotlightActions>
|
|
244
|
+
</SpotlightFooter>
|
|
245
|
+
</SpotlightCard>
|
|
246
|
+
</PopoverContent>
|
|
247
|
+
</PopoverProvider>
|
|
248
|
+
|
|
249
|
+
<PopoverProvider>
|
|
250
|
+
<PopoverTarget>
|
|
251
|
+
<IconButton icon={CopyIcon} label="Copy" />
|
|
252
|
+
</PopoverTarget>
|
|
253
|
+
<PopoverContent dismiss={dismiss} placement="bottom-start" isVisible={currentStep === 2}>
|
|
254
|
+
<SpotlightCard>
|
|
255
|
+
<SpotlightHeader>
|
|
256
|
+
<SpotlightHeadline>Copy code</SpotlightHeadline>
|
|
257
|
+
<SpotlightControls>
|
|
258
|
+
<SpotlightDismissControl onClick={dismiss} />
|
|
259
|
+
</SpotlightControls>
|
|
260
|
+
</SpotlightHeader>
|
|
261
|
+
<SpotlightBody>
|
|
262
|
+
<Text>Click to copy the example code to your clipboard.</Text>
|
|
263
|
+
</SpotlightBody>
|
|
264
|
+
<SpotlightFooter>
|
|
265
|
+
<SpotlightStepCount>2 of 2</SpotlightStepCount>
|
|
266
|
+
<SpotlightActions>
|
|
267
|
+
<SpotlightSecondaryAction onClick={back}>Back</SpotlightSecondaryAction>
|
|
268
|
+
<SpotlightPrimaryAction onClick={done}>Done</SpotlightPrimaryAction>
|
|
269
|
+
</SpotlightActions>
|
|
270
|
+
</SpotlightFooter>
|
|
271
|
+
</SpotlightCard>
|
|
272
|
+
</PopoverContent>
|
|
273
|
+
</PopoverProvider>
|
|
274
|
+
|
|
275
|
+
<Button appearance="primary" onClick={() => setCurrentStep(1)}>
|
|
276
|
+
Start tour
|
|
277
|
+
</Button>
|
|
278
|
+
</>
|
|
279
|
+
);
|
|
280
|
+
};`,
|
|
281
|
+
explanation: `Key changes when migrating a multi-step spotlight tour:
|
|
282
|
+
1. Replace the single SpotlightManager with multiple PopoverProvider instances - one for each target element
|
|
283
|
+
2. Each target gets its own PopoverProvider > PopoverTarget > PopoverContent structure
|
|
284
|
+
3. The spotlight array pattern is replaced with individual SpotlightCard components per target
|
|
285
|
+
4. Use a single currentStep state (starting at 0 for hidden, 1+ for active steps) instead of null/index
|
|
286
|
+
5. Control visibility with isVisible={currentStep === n} on each PopoverContent
|
|
287
|
+
6. Add SpotlightStepCount component in SpotlightFooter to show progress (e.g., "1 of 3")
|
|
288
|
+
7. Use SpotlightSecondaryAction for "Back" buttons instead of appearance: 'subtle' in the actions array
|
|
289
|
+
8. Use SpotlightPrimaryAction for "Next" and "Done" buttons
|
|
290
|
+
9. The renderActiveSpotlight pattern is no longer needed - visibility is controlled declaratively
|
|
291
|
+
10. Navigation functions use Math.max/Math.min to bound the step range safely`
|
|
292
|
+
}],
|
|
293
|
+
bestPractices: ['Each target element in a tour needs its own PopoverProvider wrapper', 'Use a numeric currentStep state where 0 = hidden, 1+ = active step number', 'Always include SpotlightStepCount in multi-step tours for user orientation', 'First step should only have "Next" action, middle steps have "Back" and "Next", last step has "Back" and "Done"', 'Use SpotlightSecondaryAction for back/dismiss actions and SpotlightPrimaryAction for next/done', 'Include SpotlightDismissControl with onClick={dismiss} so users can exit the tour at any point', 'Bound navigation functions with Math.max/Math.min to prevent invalid step values', 'Preference duplicating Spotlight code instead of trying to have a single `@atlaskit/spotlight` instance that conditionally renders content based on step.'],
|
|
294
|
+
additionalResources
|
|
295
|
+
};
|
|
296
|
+
export const onboardingWithMotion = {
|
|
297
|
+
id: 'onboarding-with-motion',
|
|
298
|
+
title: 'Single Step Spotlight with Motion Migration',
|
|
299
|
+
description: 'Migrate a single step spotlight with entrance animation from @atlaskit/onboarding to @atlaskit/spotlight using @atlaskit/motion',
|
|
300
|
+
fromPackage: '@atlaskit/onboarding',
|
|
301
|
+
toPackage: '@atlaskit/spotlight',
|
|
302
|
+
examples: [{
|
|
303
|
+
title: 'Migrate spotlight with transition animation',
|
|
304
|
+
description: 'Replace SpotlightTransition with FadeIn from @atlaskit/motion wrapped around the SpotlightCard',
|
|
305
|
+
before: `import React, { useState } from 'react';
|
|
306
|
+
import Button from '@atlaskit/button/new';
|
|
307
|
+
import {
|
|
308
|
+
Spotlight,
|
|
309
|
+
SpotlightManager,
|
|
310
|
+
SpotlightTarget,
|
|
311
|
+
SpotlightTransition,
|
|
312
|
+
} from '@atlaskit/onboarding';
|
|
313
|
+
|
|
314
|
+
const OnboardingSpotlightWithTransition = () => {
|
|
315
|
+
const [isSpotlightActive, setIsSpotlightActive] = useState(false);
|
|
316
|
+
const start = () => setIsSpotlightActive(true);
|
|
317
|
+
const end = () => setIsSpotlightActive(false);
|
|
318
|
+
|
|
319
|
+
return (
|
|
320
|
+
<SpotlightManager>
|
|
321
|
+
<SpotlightTarget name="my-target">
|
|
322
|
+
<Button>Target Element</Button>
|
|
323
|
+
</SpotlightTarget>
|
|
324
|
+
<div>
|
|
325
|
+
<Button appearance="primary" onClick={start}>
|
|
326
|
+
Show spotlight
|
|
327
|
+
</Button>
|
|
328
|
+
</div>
|
|
329
|
+
<SpotlightTransition>
|
|
330
|
+
{isSpotlightActive && (
|
|
331
|
+
<Spotlight
|
|
332
|
+
actions={[
|
|
333
|
+
{
|
|
334
|
+
onClick: end,
|
|
335
|
+
text: 'Got it',
|
|
336
|
+
},
|
|
337
|
+
]}
|
|
338
|
+
heading="Feature Heading"
|
|
339
|
+
target="my-target"
|
|
340
|
+
key="my-target"
|
|
341
|
+
>
|
|
342
|
+
This is the spotlight body content describing the feature.
|
|
343
|
+
</Spotlight>
|
|
344
|
+
)}
|
|
345
|
+
</SpotlightTransition>
|
|
346
|
+
</SpotlightManager>
|
|
347
|
+
);
|
|
348
|
+
};`,
|
|
349
|
+
after: `import React, { useState } from 'react';
|
|
350
|
+
import Button from '@atlaskit/button/new';
|
|
351
|
+
import { FadeIn } from '@atlaskit/motion';
|
|
352
|
+
import { Text } from '@atlaskit/primitives/compiled';
|
|
353
|
+
import {
|
|
354
|
+
PopoverContent,
|
|
355
|
+
PopoverProvider,
|
|
356
|
+
PopoverTarget,
|
|
357
|
+
SpotlightActions,
|
|
358
|
+
SpotlightBody,
|
|
359
|
+
SpotlightCard,
|
|
360
|
+
SpotlightControls,
|
|
361
|
+
SpotlightDismissControl,
|
|
362
|
+
SpotlightFooter,
|
|
363
|
+
SpotlightHeader,
|
|
364
|
+
SpotlightHeadline,
|
|
365
|
+
SpotlightPrimaryAction,
|
|
366
|
+
} from '@atlaskit/spotlight';
|
|
367
|
+
|
|
368
|
+
const SpotlightWithMotion = () => {
|
|
369
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
370
|
+
const dismiss = () => setIsVisible(false);
|
|
371
|
+
const done = () => setIsVisible(false);
|
|
372
|
+
|
|
373
|
+
return (
|
|
374
|
+
<PopoverProvider>
|
|
375
|
+
<PopoverTarget>
|
|
376
|
+
<Button onClick={() => setIsVisible(true)}>Target Element</Button>
|
|
377
|
+
</PopoverTarget>
|
|
378
|
+
<PopoverContent done={done} dismiss={dismiss} placement="bottom-start" isVisible={isVisible}>
|
|
379
|
+
<FadeIn entranceDirection="left">
|
|
380
|
+
{(props) => (
|
|
381
|
+
<div {...props}>
|
|
382
|
+
<SpotlightCard>
|
|
383
|
+
<SpotlightHeader>
|
|
384
|
+
<SpotlightHeadline>Feature Heading</SpotlightHeadline>
|
|
385
|
+
<SpotlightControls>
|
|
386
|
+
<SpotlightDismissControl />
|
|
387
|
+
</SpotlightControls>
|
|
388
|
+
</SpotlightHeader>
|
|
389
|
+
<SpotlightBody>
|
|
390
|
+
<Text>This is the spotlight body content describing the feature.</Text>
|
|
391
|
+
</SpotlightBody>
|
|
392
|
+
<SpotlightFooter>
|
|
393
|
+
<SpotlightActions>
|
|
394
|
+
<SpotlightPrimaryAction onClick={done}>Got it</SpotlightPrimaryAction>
|
|
395
|
+
</SpotlightActions>
|
|
396
|
+
</SpotlightFooter>
|
|
397
|
+
</SpotlightCard>
|
|
398
|
+
</div>
|
|
399
|
+
)}
|
|
400
|
+
</FadeIn>
|
|
401
|
+
</PopoverContent>
|
|
402
|
+
</PopoverProvider>
|
|
403
|
+
);
|
|
404
|
+
};`,
|
|
405
|
+
explanation: `Key changes when migrating a spotlight with transition animation:
|
|
406
|
+
1. Replace SpotlightTransition with FadeIn from @atlaskit/motion
|
|
407
|
+
2. Import FadeIn from '@atlaskit/motion' instead of SpotlightTransition from '@atlaskit/onboarding'
|
|
408
|
+
3. FadeIn uses a render props pattern - wrap content in {(props) => <div {...props}>...</div>}
|
|
409
|
+
4. The entranceDirection prop controls animation direction: 'left', 'right', 'top', or 'bottom'
|
|
410
|
+
5. SpotlightCard must be wrapped in a div that receives the animation props
|
|
411
|
+
6. PopoverContent now accepts a 'done' prop in addition to 'dismiss' for completed actions
|
|
412
|
+
7. All other migration changes from single step spotlight apply (PopoverProvider, compositional components, etc.)`
|
|
413
|
+
}],
|
|
414
|
+
bestPractices: ['Use FadeIn from @atlaskit/motion to add entrance animations to spotlights', 'Choose entranceDirection based on spotlight placement (e.g., "left" for right-placed spotlights)', 'Always wrap SpotlightCard in a div that receives the animation props from FadeIn', 'FadeIn uses render props pattern: {(props) => <div {...props}>content</div>}', 'Pass both done and dismiss props to PopoverContent when using motion', 'Motion is optional - only add if the original onboarding spotlight used SpotlightTransition for entrance effects'],
|
|
415
|
+
additionalResources
|
|
416
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migration registry - central place to register all available migrations
|
|
3
|
+
*
|
|
4
|
+
* To add a new migration:
|
|
5
|
+
* 1. Create a new file in ./migrations/ with your MigrationGuide(s)
|
|
6
|
+
* 2. Import and add to the registry below
|
|
7
|
+
* 3. The tool will automatically include it in the available options
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { onboardingMultiStep, onboardingSingleStep, onboardingWithMotion } from './migrations/onboarding-to-spotlight';
|
|
11
|
+
export const migrationRegistry = {
|
|
12
|
+
[onboardingSingleStep.id]: onboardingSingleStep,
|
|
13
|
+
[onboardingMultiStep.id]: onboardingMultiStep,
|
|
14
|
+
[onboardingWithMotion.id]: onboardingWithMotion
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Get all available migration IDs for use in the tool schema
|
|
19
|
+
*/
|
|
20
|
+
export const getAvailableMigrationIds = () => {
|
|
21
|
+
return Object.keys(migrationRegistry);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Get a formatted list of available migrations with descriptions
|
|
26
|
+
* Useful for tool descriptions and help text
|
|
27
|
+
*/
|
|
28
|
+
export const getAvailableMigrationsDescription = () => {
|
|
29
|
+
return Object.values(migrationRegistry).map(m => `- "${m.id}": ${m.description}`).join('\n');
|
|
30
|
+
};
|