@atlaskit/dropdown-menu 12.26.2 → 12.26.4

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.
Files changed (31) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/package.json +5 -6
  3. package/codemods/11.0.0-lite-mode.tsx +0 -51
  4. package/codemods/__tests__/11.0.0-lite-mode.test.tsx +0 -68
  5. package/codemods/__tests__/convert-position.test.tsx +0 -88
  6. package/codemods/__tests__/convert-triggerType.test.tsx +0 -183
  7. package/codemods/__tests__/deprecate-items.test.tsx +0 -108
  8. package/codemods/__tests__/deprecate-onItemActivated.test.tsx +0 -108
  9. package/codemods/__tests__/deprecate-onPositioned.test.tsx +0 -108
  10. package/codemods/__tests__/deprecate-shouldFitContainer.tsx +0 -108
  11. package/codemods/__tests__/rename-imports.tsx +0 -130
  12. package/codemods/__tests__/replace-position-to-placement.test.tsx +0 -84
  13. package/codemods/__tests__/replace-shouldAllowMultipleLine.test.tsx +0 -122
  14. package/codemods/__tests__/update-component-callsites.tsx +0 -64
  15. package/codemods/migrates/convert-trigger-type.tsx +0 -52
  16. package/codemods/migrates/deprecate-autoFocus.tsx +0 -10
  17. package/codemods/migrates/deprecate-boundariesElement.tsx +0 -9
  18. package/codemods/migrates/deprecate-isCompact.tsx +0 -10
  19. package/codemods/migrates/deprecate-isHidden.tsx +0 -10
  20. package/codemods/migrates/deprecate-isMenuFixed.tsx +0 -6
  21. package/codemods/migrates/deprecate-items.tsx +0 -6
  22. package/codemods/migrates/deprecate-onItemActivated.tsx +0 -9
  23. package/codemods/migrates/deprecate-onPositioned.tsx +0 -9
  24. package/codemods/migrates/deprecate-shouldFitContainer.tsx +0 -9
  25. package/codemods/migrates/rename-imports.tsx +0 -22
  26. package/codemods/migrates/replace-position-to-placement.tsx +0 -27
  27. package/codemods/migrates/replace-shouldAllowMultiline.tsx +0 -33
  28. package/codemods/migrates/update-component-callsites.tsx +0 -13
  29. package/codemods/utils/convert-position.tsx +0 -24
  30. package/codemods/utils/create-rename-import.tsx +0 -39
  31. package/codemods/utils/create-update-callsite.tsx +0 -31
@@ -1,10 +0,0 @@
1
- // eslint-disable-next-line @repo/internal/fs/filename-pattern-match
2
- import { createRemoveFuncFor } from '@atlaskit/codemod-utils';
3
-
4
- const deprecateIsCompact = () => [
5
- createRemoveFuncFor('@atlaskit/dropdown-menu', 'DropdownItem', 'isCompact'),
6
- createRemoveFuncFor('@atlaskit/dropdown-menu', 'DropdownItemCheckbox', 'isCompact'),
7
- createRemoveFuncFor('@atlaskit/dropdown-menu', 'DropdownItemRadio', 'isCompact'),
8
- ];
9
-
10
- export default deprecateIsCompact;
@@ -1,10 +0,0 @@
1
- // eslint-disable-next-line @repo/internal/fs/filename-pattern-match
2
- import { createRemoveFuncFor } from '@atlaskit/codemod-utils';
3
-
4
- const deprecateIsHidden = () => [
5
- createRemoveFuncFor('@atlaskit/dropdown-menu', 'DropdownItem', 'isHidden'),
6
- createRemoveFuncFor('@atlaskit/dropdown-menu', 'DropdownItemCheckbox', 'isHidden'),
7
- createRemoveFuncFor('@atlaskit/dropdown-menu', 'DropdownItemRadio', 'isHidden'),
8
- ];
9
-
10
- export default deprecateIsHidden;
@@ -1,6 +0,0 @@
1
- // eslint-disable-next-line @repo/internal/fs/filename-pattern-match
2
- import { createRemoveFuncAddCommentFor } from '@atlaskit/codemod-utils';
3
-
4
- const deprecateItems = createRemoveFuncAddCommentFor('@atlaskit/dropdown-menu', 'isMenuFixed');
5
-
6
- export default deprecateItems;
@@ -1,6 +0,0 @@
1
- // eslint-disable-next-line @repo/internal/fs/filename-pattern-match
2
- import { createRemoveFuncAddCommentFor } from '@atlaskit/codemod-utils';
3
-
4
- const deprecateItems = createRemoveFuncAddCommentFor('@atlaskit/dropdown-menu', 'items');
5
-
6
- export default deprecateItems;
@@ -1,9 +0,0 @@
1
- // eslint-disable-next-line @repo/internal/fs/filename-pattern-match
2
- import { createRemoveFuncAddCommentFor } from '@atlaskit/codemod-utils';
3
-
4
- const deprecateOnItemActivated = createRemoveFuncAddCommentFor(
5
- '@atlaskit/dropdown-menu',
6
- 'onItemActivated',
7
- );
8
-
9
- export default deprecateOnItemActivated;
@@ -1,9 +0,0 @@
1
- // eslint-disable-next-line @repo/internal/fs/filename-pattern-match
2
- import { createRemoveFuncAddCommentFor } from '@atlaskit/codemod-utils';
3
-
4
- const deprecateOnPositioned = createRemoveFuncAddCommentFor(
5
- '@atlaskit/dropdown-menu',
6
- 'onPositioned',
7
- );
8
-
9
- export default deprecateOnPositioned;
@@ -1,9 +0,0 @@
1
- // eslint-disable-next-line @repo/internal/fs/filename-pattern-match
2
- import { createRemoveFuncAddCommentFor } from '@atlaskit/codemod-utils';
3
-
4
- const deprecateShouldFitContainer = createRemoveFuncAddCommentFor(
5
- '@atlaskit/dropdown-menu',
6
- 'shouldFitContainer',
7
- );
8
-
9
- export default deprecateShouldFitContainer;
@@ -1,22 +0,0 @@
1
- import { createRenameImportFor } from '../utils/create-rename-import';
2
-
3
- export const renameDropdownItemGroupRadio = createRenameImportFor({
4
- componentName: 'DropdownItemGroupRadio',
5
- newComponentName: 'DropdownItemRadioGroup',
6
- packagePath: '@atlaskit/dropdown-menu',
7
- isDefaultImport: false,
8
- });
9
-
10
- export const renameDropdownItemGroupCheckbox = createRenameImportFor({
11
- componentName: 'DropdownItemGroupCheckbox',
12
- newComponentName: 'DropdownItemCheckboxGroup',
13
- packagePath: '@atlaskit/dropdown-menu',
14
- isDefaultImport: false,
15
- });
16
-
17
- export const renameDropdownMenuStateless = createRenameImportFor({
18
- componentName: 'DropdownMenuStateless',
19
- newComponentName: 'DropdownMenuStateless',
20
- packagePath: '@atlaskit/dropdown-menu',
21
- isDefaultImport: true,
22
- });
@@ -1,27 +0,0 @@
1
- import type { ASTPath, default as core, JSXElement } from 'jscodeshift';
2
- import { type Collection } from 'jscodeshift/src/Collection';
3
-
4
- import { getDefaultSpecifier, getJSXAttributesByName } from '@atlaskit/codemod-utils';
5
-
6
- import convertPosition from '../utils/convert-position';
7
-
8
- const updatePositionValue = (j: core.JSCodeshift, source: Collection<Node>) => {
9
- const defaultSpecifier = getDefaultSpecifier(j, source, '@atlaskit/dropdown-menu');
10
-
11
- if (!defaultSpecifier) {
12
- return;
13
- }
14
-
15
- source.findJSXElements(defaultSpecifier).forEach((element: ASTPath<JSXElement>) => {
16
- getJSXAttributesByName(j, element, 'position').forEach((attribute: any) => {
17
- j(attribute).replaceWith(
18
- j.jsxAttribute(
19
- j.jsxIdentifier('placement'),
20
- j.literal(convertPosition(attribute.node.value.value)),
21
- ),
22
- );
23
- });
24
- });
25
- };
26
-
27
- export default updatePositionValue;
@@ -1,33 +0,0 @@
1
- /* eslint-disable @repo/internal/fs/filename-pattern-match */
2
- import type { ASTPath, default as core, JSXElement } from 'jscodeshift';
3
- import { type Collection } from 'jscodeshift/src/Collection';
4
-
5
- import { getDefaultSpecifier, getJSXAttributesByName } from '@atlaskit/codemod-utils';
6
-
7
- const replaceShouldAllowMultiline = (j: core.JSCodeshift, source: Collection<Node>) => {
8
- const defaultSpecifier = getDefaultSpecifier(j, source, '@atlaskit/dropdown-menu');
9
-
10
- if (!defaultSpecifier) {
11
- return;
12
- }
13
-
14
- source.findJSXElements(defaultSpecifier).forEach((element: ASTPath<JSXElement>) => {
15
- getJSXAttributesByName(j, element, 'shouldAllowMultiline').forEach((attribute: any) => {
16
- const shouldTitleWrap = j.jsxAttribute(
17
- j.jsxIdentifier('shouldTitleWrap'),
18
- attribute.node.value,
19
- );
20
- const shouldDescriptionWrap = j.jsxAttribute(
21
- j.jsxIdentifier('shouldDescriptionWrap'),
22
- attribute.node.value,
23
- );
24
-
25
- j(attribute).insertBefore(shouldTitleWrap);
26
- j(attribute).insertBefore(shouldDescriptionWrap);
27
-
28
- j(attribute).remove();
29
- });
30
- });
31
- };
32
-
33
- export default replaceShouldAllowMultiline;
@@ -1,13 +0,0 @@
1
- import { createUpdateCallsite } from '../utils/create-update-callsite';
2
-
3
- export const updateDropdownItemGroupCheckboxCallsite = createUpdateCallsite({
4
- componentName: 'DropdownItemGroupCheckbox',
5
- newComponentName: 'DropdownItemCheckboxGroup',
6
- packagePath: '@atlaskit/dropdown-menu',
7
- });
8
-
9
- export const updateDropdownItemGroupRadioCallsite = createUpdateCallsite({
10
- componentName: 'DropdownItemGroupRadio',
11
- newComponentName: 'DropdownItemRadioGroup',
12
- packagePath: '@atlaskit/dropdown-menu',
13
- });
@@ -1,24 +0,0 @@
1
- type Entity = {
2
- [key: string]: string;
3
- };
4
-
5
- const positionMap: Entity = {
6
- 'top left': 'top-start',
7
- 'top center': 'top',
8
- 'top right': 'top-end',
9
- 'right top': 'right-start',
10
- 'right middle': 'right',
11
- 'right bottom': 'right-end',
12
- 'bottom left': 'bottom-start',
13
- 'bottom center': 'bottom',
14
- 'bottom right': 'bottom-end',
15
- 'left top': 'left-start',
16
- 'left middle': 'left',
17
- 'left bottom': 'left-end',
18
- };
19
-
20
- const convertPosition = (position: string | undefined = ''): string => {
21
- return positionMap[position.trim()] || 'bottom-start';
22
- };
23
-
24
- export default convertPosition;
@@ -1,39 +0,0 @@
1
- import type core from 'jscodeshift';
2
- import { type Collection } from 'jscodeshift/src/Collection';
3
-
4
- export const createRenameImportFor =
5
- ({
6
- componentName,
7
- newComponentName,
8
- packagePath,
9
- isDefaultImport,
10
- }: {
11
- componentName: string;
12
- newComponentName: string;
13
- packagePath: string;
14
- isDefaultImport: boolean;
15
- }) =>
16
- (j: core.JSCodeshift, source: Collection<Node>) => {
17
- source
18
- .find(j.ImportDeclaration)
19
- .filter((path) => path.node.source.value === packagePath)
20
- .find(j.ImportSpecifier)
21
- .filter((path) => path.node.imported.name === componentName)
22
- .replaceWith((importSpecifier) => {
23
- const specifier = j.identifier(newComponentName);
24
-
25
- let importAlias;
26
- if (importSpecifier && importSpecifier.node && importSpecifier.node.local) {
27
- importAlias =
28
- importSpecifier.node.local.name !== importSpecifier.node.imported.name
29
- ? j.identifier(importSpecifier.node.local.name)
30
- : null;
31
- }
32
-
33
- return isDefaultImport
34
- ? j.importDefaultSpecifier(importAlias || specifier)
35
- : j.importSpecifier(specifier, importAlias);
36
- });
37
-
38
- return source.toSource();
39
- };
@@ -1,31 +0,0 @@
1
- import type core from 'jscodeshift';
2
- import { type Collection } from 'jscodeshift/src/Collection';
3
-
4
- export const createUpdateCallsite =
5
- ({
6
- componentName,
7
- newComponentName,
8
- packagePath,
9
- }: {
10
- componentName: string;
11
- newComponentName: string;
12
- packagePath: string;
13
- }) =>
14
- (j: core.JSCodeshift, source: Collection<Node>) => {
15
- source
16
- .find(j.JSXElement)
17
- // @ts-ignore
18
- .filter((path) => path.node.openingElement.name.name === componentName)
19
- .replaceWith((element) => {
20
- const elementName = j.jsxIdentifier(newComponentName);
21
- const newComponent = j.jsxElement(
22
- j.jsxOpeningElement(elementName, element.node.openingElement.attributes),
23
- j.jsxClosingElement(elementName),
24
- element.node.children,
25
- );
26
-
27
- return newComponent;
28
- });
29
-
30
- return source.toSource();
31
- };