@atlaskit/button 17.17.2 → 17.17.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +10 -1
  2. package/__perf__/button.tsx +6 -6
  3. package/__perf__/custom.tsx +6 -6
  4. package/__perf__/customised.tsx +1 -3
  5. package/__perf__/utils/example-runner.tsx +32 -36
  6. package/__perf__/utils/interaction-tasks.tsx +65 -86
  7. package/codemods/15.0.0-lite-mode.tsx +32 -36
  8. package/codemods/15.1.1-data-testid.tsx +136 -142
  9. package/codemods/__tests__/15.0.0-lite-mode/optimistic.tsx +121 -121
  10. package/codemods/__tests__/15.0.0-lite-mode/safe.tsx +54 -54
  11. package/codemods/__tests__/15.0.0-lite-mode/shared.tsx +96 -97
  12. package/codemods/__tests__/15.1.1-data-testid/rename-data-testid.tsx +32 -32
  13. package/codemods/__tests__/_framework.tsx +32 -32
  14. package/codemods/helpers/15.0.0-runner.tsx +135 -137
  15. package/codemods/helpers/helpers-generic.tsx +524 -556
  16. package/codemods/optimistic-15.0.0-lite-mode.tsx +208 -231
  17. package/dist/cjs/old-button/shared/button-base.js +1 -1
  18. package/dist/es2019/new-button/variants/default/link.js +2 -2
  19. package/dist/es2019/new-button/variants/icon/link.js +3 -3
  20. package/dist/es2019/old-button/shared/button-base.js +1 -1
  21. package/dist/esm/new-button/variants/default/link.js +2 -2
  22. package/dist/esm/new-button/variants/icon/link.js +3 -3
  23. package/dist/esm/old-button/shared/button-base.js +1 -1
  24. package/dist/types/entry-points/loading-button.d.ts +1 -1
  25. package/dist/types/entry-points/new.d.ts +3 -3
  26. package/dist/types/entry-points/types.d.ts +2 -2
  27. package/dist/types/index.d.ts +3 -3
  28. package/dist/types/new.d.ts +3 -3
  29. package/dist/types-ts4.5/entry-points/loading-button.d.ts +1 -1
  30. package/dist/types-ts4.5/entry-points/new.d.ts +3 -3
  31. package/dist/types-ts4.5/entry-points/types.d.ts +2 -2
  32. package/dist/types-ts4.5/index.d.ts +3 -3
  33. package/dist/types-ts4.5/new.d.ts +3 -3
  34. package/extract-react-types/custom-theme-button-props.tsx +2 -4
  35. package/extract-react-types/legacy-button/custom-theme-button-props.tsx +2 -4
  36. package/extract-react-types/legacy-button/loading-button-props.tsx +1 -1
  37. package/extract-react-types/legacy-button/shared-props.tsx +1 -1
  38. package/extract-react-types/loading-button-props.tsx +1 -1
  39. package/extract-react-types/new-button/containers/split-button/split-button-props.tsx +1 -1
  40. package/extract-react-types/new-button/variants/default/button-props.tsx +1 -1
  41. package/extract-react-types/new-button/variants/default/common-default-button-props.tsx +4 -4
  42. package/extract-react-types/new-button/variants/default/link-button-props.tsx +4 -4
  43. package/extract-react-types/new-button/variants/icon-button/common-icon-button-props.tsx +4 -4
  44. package/extract-react-types/new-button/variants/icon-button/icon-button-props.tsx +1 -1
  45. package/extract-react-types/new-button/variants/icon-button/link-icon-button-props.tsx +2 -4
  46. package/extract-react-types/shared-props.tsx +1 -1
  47. package/package.json +2 -2
  48. package/report.api.md +78 -96
@@ -1,6 +1,6 @@
1
- export { default, type ButtonProps, } from './new-button/variants/default/button';
2
- export { default as LinkButton, type LinkButtonProps, } from './new-button/variants/default/link';
3
- export { default as IconButton, type IconButtonProps, } from './new-button/variants/icon/button';
1
+ export { default, type ButtonProps } from './new-button/variants/default/button';
2
+ export { default as LinkButton, type LinkButtonProps } from './new-button/variants/default/link';
3
+ export { default as IconButton, type IconButtonProps } from './new-button/variants/icon/button';
4
4
  export { default as LinkIconButton, type LinkIconButtonProps, } from './new-button/variants/icon/link';
5
5
  export { SplitButton } from './new-button/containers/split-button';
6
6
  export type { Appearance, Spacing } from './new-button/variants/types';
@@ -1,2 +1,2 @@
1
1
  export { default } from '../old-button/loading-button';
2
- export type { LoadingButtonProps, LoadingButtonOwnProps, } from '../old-button/loading-button';
2
+ export type { LoadingButtonProps, LoadingButtonOwnProps } from '../old-button/loading-button';
@@ -1,6 +1,6 @@
1
- export { default, type ButtonProps, } from '../new-button/variants/default/button';
2
- export { default as LinkButton, type LinkButtonProps, } from '../new-button/variants/default/link';
3
- export { default as IconButton, type IconButtonProps, } from '../new-button/variants/icon/button';
1
+ export { default, type ButtonProps } from '../new-button/variants/default/button';
2
+ export { default as LinkButton, type LinkButtonProps } from '../new-button/variants/default/link';
3
+ export { default as IconButton, type IconButtonProps } from '../new-button/variants/icon/button';
4
4
  export { default as LinkIconButton, type LinkIconButtonProps, } from '../new-button/variants/icon/link';
5
5
  export { SplitButton } from '../new-button/containers/split-button';
6
6
  export type { Appearance, Spacing } from '../new-button/variants/types';
@@ -1,4 +1,4 @@
1
- export type { Appearance, Spacing, BaseOwnProps, BaseProps, } from '../old-button/types';
1
+ export type { Appearance, Spacing, BaseOwnProps, BaseProps } from '../old-button/types';
2
2
  export type { ButtonProps } from './standard-button';
3
- export type { LoadingButtonProps, LoadingButtonOwnProps, } from './loading-button';
3
+ export type { LoadingButtonProps, LoadingButtonOwnProps } from './loading-button';
4
4
  export type { ThemeTokens, ThemeProps, InteractionState, CustomThemeButtonProps, CustomThemeButtonOwnProps, } from './custom-theme-button';
@@ -1,9 +1,9 @@
1
- export type { Appearance, Spacing, BaseOwnProps, BaseProps, } from './entry-points/types';
1
+ export type { Appearance, Spacing, BaseOwnProps, BaseProps } from './entry-points/types';
2
2
  export { default, } from './entry-points/standard-button';
3
3
  export type { ButtonProps } from './entry-points/standard-button';
4
4
  export { default as LoadingButton } from './entry-points/loading-button';
5
- export type { LoadingButtonProps, LoadingButtonOwnProps, } from './entry-points/loading-button';
6
- export { default as CustomThemeButton, Theme, } from './entry-points/custom-theme-button';
5
+ export type { LoadingButtonProps, LoadingButtonOwnProps } from './entry-points/loading-button';
6
+ export { default as CustomThemeButton, Theme } from './entry-points/custom-theme-button';
7
7
  export type { ThemeTokens, ThemeProps, InteractionState, CustomThemeButtonProps, CustomThemeButtonOwnProps, } from './entry-points/custom-theme-button';
8
8
  export { default as ButtonGroup } from './entry-points/button-group';
9
9
  export type { ButtonGroupProps } from './entry-points/button-group';
@@ -1,6 +1,6 @@
1
- export { default, type ButtonProps, } from './new-button/variants/default/button';
2
- export { default as LinkButton, type LinkButtonProps, } from './new-button/variants/default/link';
3
- export { default as IconButton, type IconButtonProps, } from './new-button/variants/icon/button';
1
+ export { default, type ButtonProps } from './new-button/variants/default/button';
2
+ export { default as LinkButton, type LinkButtonProps } from './new-button/variants/default/link';
3
+ export { default as IconButton, type IconButtonProps } from './new-button/variants/icon/button';
4
4
  export { default as LinkIconButton, type LinkIconButtonProps, } from './new-button/variants/icon/link';
5
5
  export { SplitButton } from './new-button/containers/split-button';
6
6
  export type { Appearance, Spacing } from './new-button/variants/types';
@@ -1,7 +1,5 @@
1
1
  import { type CustomThemeButtonOwnProps } from '../src/old-button/custom-theme-button/custom-theme-button-types';
2
2
 
3
- export default function CustomThemeButtonProps(
4
- props: CustomThemeButtonOwnProps,
5
- ) {
6
- return null;
3
+ export default function CustomThemeButtonProps(props: CustomThemeButtonOwnProps) {
4
+ return null;
7
5
  }
@@ -1,7 +1,5 @@
1
1
  import { type CustomThemeButtonOwnProps } from '../../src/old-button/custom-theme-button/custom-theme-button-types';
2
2
 
3
- export default function CustomThemeButtonProps(
4
- props: CustomThemeButtonOwnProps,
5
- ) {
6
- return null;
3
+ export default function CustomThemeButtonProps(props: CustomThemeButtonOwnProps) {
4
+ return null;
7
5
  }
@@ -1,5 +1,5 @@
1
1
  import { type LoadingButtonOwnProps } from '../../src/old-button/loading-button';
2
2
 
3
3
  export default function LoadingButtonProps(props: LoadingButtonOwnProps) {
4
- return null;
4
+ return null;
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import { type BaseOwnProps } from '../../src/old-button/types';
2
2
 
3
3
  export default function SharedProps(props: BaseOwnProps) {
4
- return null;
4
+ return null;
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import { type LoadingButtonOwnProps } from '../src/old-button/loading-button';
2
2
 
3
3
  export default function LoadingButtonProps(props: LoadingButtonOwnProps) {
4
- return null;
4
+ return null;
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import type { SplitButtonProps } from '../../../../src/new-button/containers/split-button/types';
2
2
 
3
3
  export default function SplitProps(props: SplitButtonProps) {
4
- return null;
4
+ return null;
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import { type AdditionalButtonVariantProps } from '../../../../src/new-button/variants/types';
2
2
 
3
3
  export default function ButtonProps(props: AdditionalButtonVariantProps) {
4
- return null;
4
+ return null;
5
5
  }
@@ -1,11 +1,11 @@
1
1
  import { type CommonDefaultButtonProps } from '../../../../src/new-button/variants/default/types';
2
2
  import {
3
- type CommonButtonProps,
4
- type SupportedElements,
3
+ type CommonButtonProps,
4
+ type SupportedElements,
5
5
  } from '../../../../src/new-button/variants/types';
6
6
 
7
7
  export default function CommonDefaultButtonProps(
8
- props: CommonButtonProps<SupportedElements> & CommonDefaultButtonProps,
8
+ props: CommonButtonProps<SupportedElements> & CommonDefaultButtonProps,
9
9
  ) {
10
- return null;
10
+ return null;
11
11
  }
@@ -1,10 +1,10 @@
1
1
  import {
2
- type AdditionalCommonLinkVariantProps,
3
- type AdditionalDefaultLinkVariantProps,
2
+ type AdditionalCommonLinkVariantProps,
3
+ type AdditionalDefaultLinkVariantProps,
4
4
  } from '../../../../src/new-button/variants/types';
5
5
 
6
6
  export default function LinkButtonProps(
7
- props: AdditionalCommonLinkVariantProps & AdditionalDefaultLinkVariantProps,
7
+ props: AdditionalCommonLinkVariantProps & AdditionalDefaultLinkVariantProps,
8
8
  ) {
9
- return null;
9
+ return null;
10
10
  }
@@ -1,11 +1,11 @@
1
1
  import { type CommonIconButtonProps } from '../../../../src/new-button/variants/icon/types';
2
2
  import {
3
- type CommonButtonProps,
4
- type SupportedElements,
3
+ type CommonButtonProps,
4
+ type SupportedElements,
5
5
  } from '../../../../src/new-button/variants/types';
6
6
 
7
7
  export default function CommonProps(
8
- props: CommonButtonProps<SupportedElements> & CommonIconButtonProps,
8
+ props: CommonButtonProps<SupportedElements> & CommonIconButtonProps,
9
9
  ) {
10
- return null;
10
+ return null;
11
11
  }
@@ -1,5 +1,5 @@
1
1
  import { type AdditionalButtonVariantProps } from '../../../../src/new-button/variants/types';
2
2
 
3
3
  export default function IconButtonProps(props: AdditionalButtonVariantProps) {
4
- return null;
4
+ return null;
5
5
  }
@@ -1,7 +1,5 @@
1
1
  import { type AdditionalCommonLinkVariantProps } from '../../../../src/new-button/variants/types';
2
2
 
3
- export default function LinkButtonProps(
4
- props: AdditionalCommonLinkVariantProps,
5
- ) {
6
- return null;
3
+ export default function LinkButtonProps(props: AdditionalCommonLinkVariantProps) {
4
+ return null;
7
5
  }
@@ -1,5 +1,5 @@
1
1
  import { type BaseOwnProps } from '../src/old-button/types';
2
2
 
3
3
  export default function SharedProps(props: BaseOwnProps) {
4
- return null;
4
+ return null;
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/button",
3
- "version": "17.17.2",
3
+ "version": "17.17.3",
4
4
  "description": "A button triggers an event or action. They let users know what will happen next.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -138,7 +138,7 @@
138
138
  "@atlaskit/primitives": "^7.0.0",
139
139
  "@atlaskit/spinner": "^16.1.0",
140
140
  "@atlaskit/theme": "^12.9.0",
141
- "@atlaskit/tokens": "^1.49.0",
141
+ "@atlaskit/tokens": "^1.50.0",
142
142
  "@atlaskit/tooltip": "^18.4.0",
143
143
  "@atlaskit/visually-hidden": "^1.3.0",
144
144
  "@babel/runtime": "^7.0.0",
package/report.api.md CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  ## API Report File for "@atlaskit/button"
4
4
 
5
- > Do not edit this file. This report is auto-generated using [API Extractor](https://api-extractor.com/).
5
+ > Do not edit this file. This report is auto-generated using
6
+ > [API Extractor](https://api-extractor.com/).
6
7
  > [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
7
8
 
8
9
  ### Table of contents
@@ -29,74 +30,64 @@ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
29
30
 
30
31
  // @public (undocumented)
31
32
  export type Appearance =
32
- | 'danger'
33
- | 'default'
34
- | 'link'
35
- | 'primary'
36
- | 'subtle'
37
- | 'subtle-link'
38
- | 'warning';
33
+ | 'danger'
34
+ | 'default'
35
+ | 'link'
36
+ | 'primary'
37
+ | 'subtle'
38
+ | 'subtle-link'
39
+ | 'warning';
39
40
 
40
41
  // @public (undocumented)
41
42
  export type BaseOwnProps = {
42
- appearance?: Appearance;
43
- autoFocus?: boolean;
44
- className?: string;
45
- overlay?: React_2.ReactNode;
46
- href?: string;
47
- iconAfter?: React_2.ReactChild;
48
- iconBefore?: React_2.ReactChild;
49
- isDisabled?: boolean;
50
- isSelected?: boolean;
51
- onBlur?: React_2.FocusEventHandler<HTMLElement>;
52
- onClick?: (
53
- e: React_2.MouseEvent<HTMLElement>,
54
- analyticsEvent: UIAnalyticsEvent,
55
- ) => void;
56
- onFocus?: React_2.FocusEventHandler<HTMLElement>;
57
- spacing?: Spacing;
58
- target?: React_2.AnchorHTMLAttributes<HTMLAnchorElement>['target'];
59
- type?: React_2.ButtonHTMLAttributes<HTMLButtonElement>['type'];
60
- shouldFitContainer?: boolean;
61
- children?: React_2.ReactNode;
62
- testId?: string;
63
- component?:
64
- | React_2.ComponentType<React_2.AllHTMLAttributes<HTMLElement>>
65
- | React_2.ElementType;
66
- interactionName?: string;
67
- analyticsContext?: Record<string, any>;
43
+ appearance?: Appearance;
44
+ autoFocus?: boolean;
45
+ className?: string;
46
+ overlay?: React_2.ReactNode;
47
+ href?: string;
48
+ iconAfter?: React_2.ReactChild;
49
+ iconBefore?: React_2.ReactChild;
50
+ isDisabled?: boolean;
51
+ isSelected?: boolean;
52
+ onBlur?: React_2.FocusEventHandler<HTMLElement>;
53
+ onClick?: (e: React_2.MouseEvent<HTMLElement>, analyticsEvent: UIAnalyticsEvent) => void;
54
+ onFocus?: React_2.FocusEventHandler<HTMLElement>;
55
+ spacing?: Spacing;
56
+ target?: React_2.AnchorHTMLAttributes<HTMLAnchorElement>['target'];
57
+ type?: React_2.ButtonHTMLAttributes<HTMLButtonElement>['type'];
58
+ shouldFitContainer?: boolean;
59
+ children?: React_2.ReactNode;
60
+ testId?: string;
61
+ component?: React_2.ComponentType<React_2.AllHTMLAttributes<HTMLElement>> | React_2.ElementType;
62
+ interactionName?: string;
63
+ analyticsContext?: Record<string, any>;
68
64
  };
69
65
 
70
66
  // @public (undocumented)
71
67
  export type BaseProps = Combine<
72
- Combine<
73
- Omit<React_2.AllHTMLAttributes<HTMLElement>, 'disabled'>,
74
- {
75
- 'data-testid'?: never;
76
- 'data-has-overlay'?: never;
77
- }
78
- >,
79
- BaseOwnProps
68
+ Combine<
69
+ Omit<React_2.AllHTMLAttributes<HTMLElement>, 'disabled'>,
70
+ {
71
+ 'data-testid'?: never;
72
+ 'data-has-overlay'?: never;
73
+ }
74
+ >,
75
+ BaseOwnProps
80
76
  >;
81
77
 
82
78
  // @public
83
79
  const Button: React_2.MemoExoticComponent<
84
- React_2.ForwardRefExoticComponent<
85
- ButtonProps & React_2.RefAttributes<HTMLElement>
86
- >
80
+ React_2.ForwardRefExoticComponent<ButtonProps & React_2.RefAttributes<HTMLElement>>
87
81
  >;
88
82
  export default Button;
89
83
 
90
84
  // @public (undocumented)
91
- export function ButtonGroup({
92
- appearance,
93
- children,
94
- }: ButtonGroupProps): jsx.JSX.Element;
85
+ export function ButtonGroup({ appearance, children }: ButtonGroupProps): jsx.JSX.Element;
95
86
 
96
87
  // @public (undocumented)
97
88
  type ButtonGroupProps = {
98
- appearance?: Appearance;
99
- children?: React_2.ReactNode;
89
+ appearance?: Appearance;
90
+ children?: React_2.ReactNode;
100
91
  };
101
92
 
102
93
  // @public (undocumented)
@@ -107,84 +98,75 @@ type Combine<First, Second> = Omit<First, keyof Second> & Second;
107
98
 
108
99
  // @public
109
100
  export const CustomThemeButton: React_2.MemoExoticComponent<
110
- React_2.ForwardRefExoticComponent<
111
- Omit<BaseProps, 'overlay'> &
112
- CustomThemeButtonOwnProps &
113
- React_2.RefAttributes<HTMLElement>
114
- >
101
+ React_2.ForwardRefExoticComponent<
102
+ Omit<BaseProps, 'overlay'> & CustomThemeButtonOwnProps & React_2.RefAttributes<HTMLElement>
103
+ >
115
104
  >;
116
105
 
117
106
  // @public (undocumented)
118
107
  export type CustomThemeButtonOwnProps = {
119
- isLoading?: boolean;
120
- theme?: (
121
- current: (props: ThemeProps) => ThemeTokens,
122
- props: ThemeProps,
123
- ) => ThemeTokens;
108
+ isLoading?: boolean;
109
+ theme?: (current: (props: ThemeProps) => ThemeTokens, props: ThemeProps) => ThemeTokens;
124
110
  };
125
111
 
126
112
  // @public (undocumented)
127
- export type CustomThemeButtonProps = Omit<BaseProps, 'overlay'> &
128
- CustomThemeButtonOwnProps;
113
+ export type CustomThemeButtonProps = Omit<BaseProps, 'overlay'> & CustomThemeButtonOwnProps;
129
114
 
130
115
  // @public (undocumented)
131
116
  export type InteractionState =
132
- | 'active'
133
- | 'default'
134
- | 'disabled'
135
- | 'focus'
136
- | 'focusSelected'
137
- | 'hover'
138
- | 'selected';
117
+ | 'active'
118
+ | 'default'
119
+ | 'disabled'
120
+ | 'focus'
121
+ | 'focusSelected'
122
+ | 'hover'
123
+ | 'selected';
139
124
 
140
125
  // @public
141
126
  export const LoadingButton: React_2.ForwardRefExoticComponent<
142
- Omit<BaseProps, 'overlay'> &
143
- LoadingButtonOwnProps &
144
- React_2.RefAttributes<HTMLElement>
127
+ Omit<BaseProps, 'overlay'> & LoadingButtonOwnProps & React_2.RefAttributes<HTMLElement>
145
128
  >;
146
129
 
147
130
  // @public (undocumented)
148
131
  export type LoadingButtonOwnProps = {
149
- isLoading?: boolean;
132
+ isLoading?: boolean;
150
133
  };
151
134
 
152
135
  // @public (undocumented)
153
- export type LoadingButtonProps = Omit<BaseProps, 'overlay'> &
154
- LoadingButtonOwnProps;
136
+ export type LoadingButtonProps = Omit<BaseProps, 'overlay'> & LoadingButtonOwnProps;
155
137
 
156
138
  // @public (undocumented)
157
139
  export type Spacing = 'compact' | 'default' | 'none';
158
140
 
159
141
  // @public (undocumented)
160
142
  export const Theme: {
161
- Consumer: ComponentType<
162
- {
163
- children: (tokens: ThemeTokens) => ReactNode;
164
- } & Partial<CustomThemeButtonProps> & {
165
- state: InteractionState;
166
- iconIsOnlyChild?: boolean | undefined;
167
- mode?: ThemeModes_2 | undefined;
168
- }
169
- >;
170
- Provider: ComponentType<{
171
- children?: ReactNode;
172
- value?: ThemeProp<ThemeTokens, ThemeProps> | undefined;
173
- }>;
174
- useTheme: (props: ThemeProps) => ThemeTokens;
143
+ Consumer: ComponentType<
144
+ {
145
+ children: (tokens: ThemeTokens) => ReactNode;
146
+ } & Partial<CustomThemeButtonProps> & {
147
+ state: InteractionState;
148
+ iconIsOnlyChild?: boolean | undefined;
149
+ mode?: ThemeModes_2 | undefined;
150
+ }
151
+ >;
152
+ Provider: ComponentType<{
153
+ children?: ReactNode;
154
+ value?: ThemeProp<ThemeTokens, ThemeProps> | undefined;
155
+ }>;
156
+ useTheme: (props: ThemeProps) => ThemeTokens;
175
157
  };
176
158
 
177
159
  // @public (undocumented)
178
160
  export type ThemeProps = Partial<CustomThemeButtonProps> & {
179
- state: InteractionState;
180
- iconIsOnlyChild?: boolean;
181
- mode?: ThemeModes;
161
+ state: InteractionState;
162
+ iconIsOnlyChild?: boolean;
163
+ mode?: ThemeModes;
182
164
  };
183
165
 
184
166
  // @public (undocumented)
185
167
  export type ThemeTokens = {
186
- buttonStyles: CSSObject;
187
- spinnerStyles: CSSObject;
168
+ buttonStyles: CSSObject;
169
+ spinnerStyles: CSSObject;
188
170
  };
189
171
 
190
172
  // (No @packageDocumentation comment for this package)
@@ -198,7 +180,7 @@ export type ThemeTokens = {
198
180
 
199
181
  ```json
200
182
  {
201
- "react": "^16.8.0"
183
+ "react": "^16.8.0"
202
184
  }
203
185
  ```
204
186