@atlaskit/button 16.4.0 → 16.4.1

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 (34) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/codemods/15.1.1-data-testid.tsx +10 -12
  3. package/codemods/__tests__/15.0.0-lite-mode/optimistic.tsx +6 -12
  4. package/codemods/__tests__/15.0.0-lite-mode/shared.tsx +1 -2
  5. package/codemods/__tests__/15.1.1-data-testid/rename-data-testid.tsx +1 -2
  6. package/codemods/helpers/helpers-generic.tsx +10 -12
  7. package/dist/cjs/shared/button-base.js +1 -1
  8. package/dist/cjs/version.json +1 -1
  9. package/dist/es2019/shared/button-base.js +1 -1
  10. package/dist/es2019/version.json +1 -1
  11. package/dist/esm/shared/button-base.js +1 -1
  12. package/dist/esm/version.json +1 -1
  13. package/package.json +3 -11
  14. package/report.api.md +12 -8
  15. package/dist/types-ts4.0/button-group.d.ts +0 -12
  16. package/dist/types-ts4.0/button.d.ts +0 -15
  17. package/dist/types-ts4.0/custom-theme-button/custom-theme-button-types.d.ts +0 -22
  18. package/dist/types-ts4.0/custom-theme-button/custom-theme-button.d.ts +0 -10
  19. package/dist/types-ts4.0/custom-theme-button/index.d.ts +0 -2
  20. package/dist/types-ts4.0/custom-theme-button/theme.d.ts +0 -21
  21. package/dist/types-ts4.0/entry-points/button-group.d.ts +0 -1
  22. package/dist/types-ts4.0/entry-points/custom-theme-button.d.ts +0 -2
  23. package/dist/types-ts4.0/entry-points/loading-button.d.ts +0 -2
  24. package/dist/types-ts4.0/entry-points/standard-button.d.ts +0 -7
  25. package/dist/types-ts4.0/entry-points/types.d.ts +0 -4
  26. package/dist/types-ts4.0/index.d.ts +0 -8
  27. package/dist/types-ts4.0/loading-button.d.ts +0 -15
  28. package/dist/types-ts4.0/shared/block-events.d.ts +0 -4
  29. package/dist/types-ts4.0/shared/button-base.d.ts +0 -10
  30. package/dist/types-ts4.0/shared/colors.d.ts +0 -31
  31. package/dist/types-ts4.0/shared/css.d.ts +0 -22
  32. package/dist/types-ts4.0/shared/get-is-only-single-icon.d.ts +0 -2
  33. package/dist/types-ts4.0/shared/loading-spinner.d.ts +0 -5
  34. package/dist/types-ts4.0/types.d.ts +0 -89
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/button
2
2
 
3
+ ## 16.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
3
9
  ## 16.4.0
4
10
 
5
11
  ### Minor Changes
@@ -87,20 +87,18 @@ export function getNamedImportName({
87
87
  .filter((path) => path.node.source.value === importPath)
88
88
  .find(j.ImportSpecifier)
89
89
  .nodes()
90
- .map(
91
- (specifier): Nullable<string> => {
92
- if (specifier.imported.name === originalName) {
93
- // aliased
94
- if (specifier.local) {
95
- return specifier.local.name;
96
- }
97
- // not aliased
98
- return originalName;
90
+ .map((specifier): Nullable<string> => {
91
+ if (specifier.imported.name === originalName) {
92
+ // aliased
93
+ if (specifier.local) {
94
+ return specifier.local.name;
99
95
  }
96
+ // not aliased
97
+ return originalName;
98
+ }
100
99
 
101
- return null;
102
- },
103
- )
100
+ return null;
101
+ })
104
102
  .filter(Boolean)[0] || null;
105
103
  return name;
106
104
  }
@@ -369,8 +369,7 @@ describe('Non exclusive JSX usage of <Button />', () => {
369
369
 
370
370
  check({
371
371
  transformer,
372
- it:
373
- 'should use standard button if Button is used in JSX and also not in JSX',
372
+ it: 'should use standard button if Button is used in JSX and also not in JSX',
374
373
  original: `
375
374
  import React from 'react';
376
375
  import Button from './our-button';
@@ -419,8 +418,7 @@ describe('Non exclusive JSX usage of <Button />', () => {
419
418
  describe('Spreading props', () => {
420
419
  check({
421
420
  transformer,
422
- it:
423
- 'should try to choose the right button if there are locally spread values (seperate object)',
421
+ it: 'should try to choose the right button if there are locally spread values (seperate object)',
424
422
  original: `
425
423
  import React from 'react';
426
424
  import Button from '@atlaskit/button';
@@ -451,8 +449,7 @@ describe('Spreading props', () => {
451
449
 
452
450
  check({
453
451
  transformer,
454
- it:
455
- 'should try to choose the right button if there are locally spread values (inline object)',
452
+ it: 'should try to choose the right button if there are locally spread values (inline object)',
456
453
  original: `
457
454
  import React from 'react';
458
455
  import Button from '@atlaskit/button';
@@ -475,8 +472,7 @@ describe('Spreading props', () => {
475
472
 
476
473
  check({
477
474
  transformer,
478
- it:
479
- 'should try to choose the right button if there are multiple local spread values',
475
+ it: 'should try to choose the right button if there are multiple local spread values',
480
476
  original: `
481
477
  import React from 'react';
482
478
  import Button from '@atlaskit/button';
@@ -513,8 +509,7 @@ describe('Spreading props', () => {
513
509
 
514
510
  check({
515
511
  transformer,
516
- it:
517
- 'should try to choose the right button if there are locally spread values (custom theme button)',
512
+ it: 'should try to choose the right button if there are locally spread values (custom theme button)',
518
513
  original: `
519
514
  import React from 'react';
520
515
  import Button from '@atlaskit/button';
@@ -549,8 +544,7 @@ describe('Spreading props', () => {
549
544
 
550
545
  check({
551
546
  transformer,
552
- it:
553
- 'should try to choose the right button if there is a spread value being mixed with a local values',
547
+ it: 'should try to choose the right button if there is a spread value being mixed with a local values',
554
548
  original: `
555
549
  import React from 'react';
556
550
  import Button from '@atlaskit/button';
@@ -47,8 +47,7 @@ import { check } from '../_framework';
47
47
  });
48
48
 
49
49
  check({
50
- it:
51
- 'should fallback to a `DSButtonAppearance` type alias if the `Appearance` identifier name is unavailable',
50
+ it: 'should fallback to a `DSButtonAppearance` type alias if the `Appearance` identifier name is unavailable',
52
51
  transformer,
53
52
  original: `
54
53
  import { Appearance } from 'some-other-package';
@@ -135,8 +135,7 @@ check({
135
135
 
136
136
  check({
137
137
  transformer,
138
- it:
139
- 'should add a warning when both the testId and data-testid props are being used',
138
+ it: 'should add a warning when both the testId and data-testid props are being used',
140
139
  original: `
141
140
  import StandardButton from '@atlaskit/button';
142
141
 
@@ -550,19 +550,17 @@ export function changeImportFor({
550
550
  .filter((path) => path.node.source.value === oldPackagePath)
551
551
  .find(j.ImportSpecifier)
552
552
  .nodes()
553
- .map(
554
- (specifier): Nullable<string> => {
555
- if (specifier.imported.name !== currentName) {
556
- return null;
557
- }
558
- // If aliased: return the alias
559
- if (specifier.local && specifier.local.name !== currentName) {
560
- return specifier.local.name;
561
- }
562
-
553
+ .map((specifier): Nullable<string> => {
554
+ if (specifier.imported.name !== currentName) {
563
555
  return null;
564
- },
565
- )
556
+ }
557
+ // If aliased: return the alias
558
+ if (specifier.local && specifier.local.name !== currentName) {
559
+ return specifier.local.name;
560
+ }
561
+
562
+ return null;
563
+ })
566
564
  .filter(Boolean)[0] || null;
567
565
 
568
566
  base
@@ -101,7 +101,7 @@ var _default = /*#__PURE__*/_react.default.forwardRef(function ButtonBase(props,
101
101
  action: 'clicked',
102
102
  componentName: 'button',
103
103
  packageName: "@atlaskit/button",
104
- packageVersion: "16.4.0",
104
+ packageVersion: "16.4.1",
105
105
  analyticsData: analyticsContext
106
106
  }); // Button currently calls preventDefault, which is not standard button behaviour
107
107
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/button",
3
- "version": "16.4.0",
3
+ "version": "16.4.1",
4
4
  "sideEffects": false
5
5
  }
@@ -68,7 +68,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
68
68
  action: 'clicked',
69
69
  componentName: 'button',
70
70
  packageName: "@atlaskit/button",
71
- packageVersion: "16.4.0",
71
+ packageVersion: "16.4.1",
72
72
  analyticsData: analyticsContext
73
73
  }); // Button currently calls preventDefault, which is not standard button behaviour
74
74
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/button",
3
- "version": "16.4.0",
3
+ "version": "16.4.1",
4
4
  "sideEffects": false
5
5
  }
@@ -77,7 +77,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
77
77
  action: 'clicked',
78
78
  componentName: 'button',
79
79
  packageName: "@atlaskit/button",
80
- packageVersion: "16.4.0",
80
+ packageVersion: "16.4.1",
81
81
  analyticsData: analyticsContext
82
82
  }); // Button currently calls preventDefault, which is not standard button behaviour
83
83
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/button",
3
- "version": "16.4.0",
3
+ "version": "16.4.1",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/button",
3
- "version": "16.4.0",
3
+ "version": "16.4.1",
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/"
@@ -12,14 +12,6 @@
12
12
  "module": "dist/esm/index.js",
13
13
  "module:es2019": "dist/es2019/index.js",
14
14
  "types": "dist/types/index.d.ts",
15
- "typesVersions": {
16
- ">=4.0 <4.5": {
17
- "*": [
18
- "dist/types-ts4.0/*",
19
- "dist/types-ts4.0/index.d.ts"
20
- ]
21
- }
22
- },
23
15
  "sideEffects": false,
24
16
  "atlaskit:src": "src/index.tsx",
25
17
  "atlassian": {
@@ -44,7 +36,7 @@
44
36
  "@atlaskit/ds-lib": "^2.1.0",
45
37
  "@atlaskit/spinner": "^15.2.0",
46
38
  "@atlaskit/theme": "^12.2.0",
47
- "@atlaskit/tokens": "^0.10.0",
39
+ "@atlaskit/tokens": "^0.11.0",
48
40
  "@babel/runtime": "^7.0.0",
49
41
  "@emotion/react": "^11.7.1"
50
42
  },
@@ -95,4 +87,4 @@
95
87
  },
96
88
  "homepage": "https://atlassian.design/components/button/",
97
89
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
98
- }
90
+ }
package/report.api.md CHANGED
@@ -73,9 +73,11 @@ export type BaseProps = Combine<
73
73
  >;
74
74
 
75
75
  // @public
76
- const Button: React_2.MemoExoticComponent<React_2.ForwardRefExoticComponent<
77
- ButtonProps & React_2.RefAttributes<HTMLElement>
78
- >>;
76
+ const Button: React_2.MemoExoticComponent<
77
+ React_2.ForwardRefExoticComponent<
78
+ ButtonProps & React_2.RefAttributes<HTMLElement>
79
+ >
80
+ >;
79
81
  export default Button;
80
82
 
81
83
  // @public (undocumented)
@@ -97,11 +99,13 @@ export interface ButtonProps extends BaseProps {}
97
99
  type Combine<First, Second> = Omit<First, keyof Second> & Second;
98
100
 
99
101
  // @public
100
- export const CustomThemeButton: React_2.MemoExoticComponent<React_2.ForwardRefExoticComponent<
101
- Omit<BaseProps, 'overlay'> &
102
- CustomThemeButtonOwnProps &
103
- React_2.RefAttributes<HTMLElement>
104
- >>;
102
+ export const CustomThemeButton: React_2.MemoExoticComponent<
103
+ React_2.ForwardRefExoticComponent<
104
+ Omit<BaseProps, 'overlay'> &
105
+ CustomThemeButtonOwnProps &
106
+ React_2.RefAttributes<HTMLElement>
107
+ >
108
+ >;
105
109
 
106
110
  // @public (undocumented)
107
111
  export type CustomThemeButtonOwnProps = {
@@ -1,12 +0,0 @@
1
- /** @jsx jsx */
2
- import React from 'react';
3
- import { jsx } from '@emotion/react';
4
- import { Appearance } from './types';
5
- export declare type ButtonGroupProps = {
6
- /**
7
- * The appearance to apply to all buttons.
8
- */
9
- appearance?: Appearance;
10
- children?: React.ReactNode;
11
- };
12
- export default function ButtonGroup({ appearance, children, }: ButtonGroupProps): jsx.JSX.Element;
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- import { BaseProps } from './types';
3
- export interface ButtonProps extends BaseProps {
4
- }
5
- /**
6
- * __Button__
7
- *
8
- * A button triggers an event or action. They let users know what will happen next.
9
- *
10
- * - [Examples](https://atlassian.design/components/button/examples)
11
- * - [Code](https://atlassian.design/components/button/code)
12
- * - [Usage](https://atlassian.design/components/button/usage)
13
- */
14
- declare const Button: React.MemoExoticComponent<React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLElement>>>;
15
- export default Button;
@@ -1,22 +0,0 @@
1
- import { CSSObject } from '@emotion/react';
2
- import { ThemeModes } from '@atlaskit/theme/types';
3
- import { BaseProps } from '../types';
4
- export declare type ThemeTokens = {
5
- buttonStyles: CSSObject;
6
- spinnerStyles: CSSObject;
7
- };
8
- export declare type InteractionState = 'disabled' | 'focusSelected' | 'selected' | 'active' | 'hover' | 'focus' | 'default';
9
- export declare type CustomThemeButtonOwnProps = {
10
- isLoading?: boolean;
11
- /**
12
- * Slow + discouraged custom theme API
13
- * See custom theme guide for usage details
14
- */
15
- theme?: (current: (props: ThemeProps) => ThemeTokens, props: ThemeProps) => ThemeTokens;
16
- };
17
- export declare type CustomThemeButtonProps = Omit<BaseProps, 'overlay'> & CustomThemeButtonOwnProps;
18
- export declare type ThemeProps = Partial<CustomThemeButtonProps> & {
19
- state: InteractionState;
20
- iconIsOnlyChild?: boolean;
21
- mode?: ThemeModes;
22
- };
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- /**
3
- * __Custom theme button__
4
- *
5
- * A custom theme button. Avoid using this component. It exists for those already using custom theming, which is hard to use and has performance issues.
6
- *
7
- * - [Examples](https://atlassian.design/components/button/examples#custom-theme-button)
8
- */
9
- declare const CustomThemeButton: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<import("..").BaseProps, "overlay"> & import("./custom-theme-button-types").CustomThemeButtonOwnProps & React.RefAttributes<HTMLElement>>>;
10
- export default CustomThemeButton;
@@ -1,2 +0,0 @@
1
- export { default } from './custom-theme-button';
2
- export { default as Theme } from './theme';
@@ -1,21 +0,0 @@
1
- /// <reference types="react" />
2
- import { CSSObject } from '@emotion/react';
3
- import { InteractionState, ThemeProps, ThemeTokens } from './custom-theme-button-types';
4
- export declare function getCustomCss({ appearance, spacing, mode, isSelected, shouldFitContainer, iconIsOnlyChild, isLoading, state, }: ThemeProps): CSSObject;
5
- export declare function getSpecifiers(styles: CSSObject): CSSObject;
6
- export declare function defaultThemeFn(current: (values: ThemeProps) => ThemeTokens, values: ThemeProps): ThemeTokens;
7
- declare const Theme: {
8
- Consumer: import("react").ComponentType<{
9
- children: (tokens: ThemeTokens) => import("react").ReactNode;
10
- } & Partial<import("./custom-theme-button-types").CustomThemeButtonProps> & {
11
- state: InteractionState;
12
- iconIsOnlyChild?: boolean | undefined;
13
- mode?: import("@atlaskit/theme").ThemeModes | undefined;
14
- }>;
15
- Provider: import("react").ComponentType<{
16
- children?: import("react").ReactNode;
17
- value?: import("@atlaskit/theme/components").ThemeProp<ThemeTokens, ThemeProps> | undefined;
18
- }>;
19
- useTheme: (props: ThemeProps) => ThemeTokens;
20
- };
21
- export default Theme;
@@ -1 +0,0 @@
1
- export { default } from '../button-group';
@@ -1,2 +0,0 @@
1
- export { default, Theme } from '../custom-theme-button';
2
- export type { ThemeTokens, ThemeProps, InteractionState, CustomThemeButtonProps, CustomThemeButtonOwnProps, } from '../custom-theme-button/custom-theme-button-types';
@@ -1,2 +0,0 @@
1
- export { default } from '../loading-button';
2
- export type { LoadingButtonProps, LoadingButtonOwnProps, } from '../loading-button';
@@ -1,7 +0,0 @@
1
- /**
2
- * Must import '@emotion/core' in order to resolve type error
3
- * https://product-fabric.atlassian.net/browse/DSP-3222
4
- */
5
- import '@emotion/react';
6
- export { default } from '../button';
7
- export type { ButtonProps } from '../button';
@@ -1,4 +0,0 @@
1
- export type { Appearance, Spacing, BaseOwnProps, BaseProps } from '../types';
2
- export type { ButtonProps } from './standard-button';
3
- export type { LoadingButtonProps, LoadingButtonOwnProps, } from './loading-button';
4
- export type { ThemeTokens, ThemeProps, InteractionState, CustomThemeButtonProps, CustomThemeButtonOwnProps, } from './custom-theme-button';
@@ -1,8 +0,0 @@
1
- export type { Appearance, Spacing, BaseOwnProps, BaseProps, } from './entry-points/types';
2
- export { default, } from './entry-points/standard-button';
3
- export type { ButtonProps } from './entry-points/standard-button';
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';
7
- export type { ThemeTokens, ThemeProps, InteractionState, CustomThemeButtonProps, CustomThemeButtonOwnProps, } from './entry-points/custom-theme-button';
8
- export { default as ButtonGroup } from './entry-points/button-group';
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- import { BaseProps } from './types';
3
- export declare type LoadingButtonOwnProps = {
4
- isLoading?: boolean;
5
- };
6
- export declare type LoadingButtonProps = Omit<BaseProps, 'overlay'> & LoadingButtonOwnProps;
7
- /**
8
- * __Loading button__
9
- *
10
- * A small wrapper around Button that allows you to show an @atlaskit/spinner as an overlay on the button when you set an isLoading prop to true.
11
- *
12
- * - [Examples](https://atlassian.design/components/button/examples#loading-button)
13
- */
14
- declare const LoadingButton: React.ForwardRefExoticComponent<Omit<BaseProps, "overlay"> & LoadingButtonOwnProps & React.RefAttributes<HTMLElement>>;
15
- export default LoadingButton;
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- export default function blockEvents({ isInteractive, }: {
3
- isInteractive: boolean;
4
- }): React.DOMAttributes<HTMLElement>;
@@ -1,10 +0,0 @@
1
- /** @jsx jsx */
2
- import React from 'react';
3
- import { CSSObject } from '@emotion/react';
4
- declare const _default: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.AllHTMLAttributes<HTMLElement>, "disabled">, "data-testid" | "data-has-overlay"> & {
5
- 'data-testid'?: undefined;
6
- 'data-has-overlay'?: undefined;
7
- }, keyof import("../types").BaseOwnProps> & import("../types").BaseOwnProps & {
8
- buttonCss: CSSObject;
9
- } & React.RefAttributes<HTMLElement>>;
10
- export default _default;
@@ -1,31 +0,0 @@
1
- import { ThemeModes } from '@atlaskit/theme/types';
2
- import { Appearance } from '../types';
3
- export declare type ColorRule = {
4
- [key in ThemeModes]: string;
5
- };
6
- export declare type ColorGroup = {
7
- default: ColorRule;
8
- hover?: ColorRule;
9
- active?: ColorRule;
10
- disabled?: ColorRule;
11
- selected?: ColorRule;
12
- focus?: ColorRule;
13
- focusSelected?: ColorRule;
14
- };
15
- export declare type ColorPreset = {
16
- [key in Appearance]: ColorGroup;
17
- };
18
- export declare type BoxShadowColorGroup = {
19
- focus: ColorRule;
20
- focusSelected: ColorRule;
21
- };
22
- declare type BoxShadowColorPreset = {
23
- [key in Appearance]: BoxShadowColorGroup;
24
- };
25
- declare type Values = {
26
- background: ColorPreset;
27
- boxShadowColor: BoxShadowColorPreset;
28
- color: ColorPreset;
29
- };
30
- declare const values: Values;
31
- export default values;
@@ -1,22 +0,0 @@
1
- import { CSSObject } from '@emotion/react';
2
- import { ThemeModes } from '@atlaskit/theme/types';
3
- import { Appearance, Spacing } from '../types';
4
- export declare type GetCssArgs = {
5
- appearance: Appearance;
6
- spacing: Spacing;
7
- mode: ThemeModes;
8
- isSelected: boolean;
9
- shouldFitContainer: boolean;
10
- isOnlySingleIcon: boolean;
11
- };
12
- export declare function getCss({ appearance, spacing, mode, isSelected, shouldFitContainer, isOnlySingleIcon, }: GetCssArgs): CSSObject;
13
- export declare function getIconStyle({ spacing }: {
14
- spacing: Spacing;
15
- }): import("@emotion/react").SerializedStyles;
16
- export declare function getContentStyle({ spacing }: {
17
- spacing: Spacing;
18
- }): import("@emotion/react").SerializedStyles;
19
- export declare function getFadingCss({ hasOverlay }: {
20
- hasOverlay: boolean;
21
- }): import("@emotion/react").SerializedStyles;
22
- export declare const overlayCss: CSSObject;
@@ -1,2 +0,0 @@
1
- import { BaseProps } from '../types';
2
- export default function getIsOnlySingleIcon({ children, iconBefore, iconAfter, }: Pick<BaseProps, 'children' | 'iconBefore' | 'iconAfter'>): boolean;
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- import { BaseProps } from '../types';
3
- declare type LoadingSpinnerProps = Pick<BaseProps, 'appearance' | 'isDisabled' | 'isSelected' | 'spacing'>;
4
- export default function LoadingSpinner({ spacing, ...rest }: LoadingSpinnerProps): JSX.Element;
5
- export {};
@@ -1,89 +0,0 @@
1
- import React from 'react';
2
- import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
- export declare type Appearance = 'default' | 'danger' | 'link' | 'primary' | 'subtle' | 'subtle-link' | 'warning';
4
- export declare type Spacing = 'compact' | 'default' | 'none';
5
- declare type Combine<First, Second> = Omit<First, keyof Second> & Second;
6
- export declare type BaseOwnProps = {
7
- /**
8
- * The base styling to apply to the button
9
- */
10
- appearance?: Appearance;
11
- /**
12
- * Set the button to autofocus on mount
13
- */
14
- autoFocus?: boolean;
15
- /**
16
- * Add a classname to the button
17
- */
18
- className?: string;
19
- /**
20
- * Used to 'overlay' something over a button. This is commonly used to display a loading spinner
21
- */
22
- overlay?: React.ReactNode;
23
- /**
24
- * Provides a url for buttons being used as a link
25
- */
26
- href?: string;
27
- /**
28
- * Places an icon within the button, after the button's text
29
- */
30
- iconAfter?: React.ReactChild;
31
- /**
32
- * Places an icon within the button, before the button's text
33
- */
34
- iconBefore?: React.ReactChild;
35
- /**
36
- * Set if the button is disabled
37
- */
38
- isDisabled?: boolean;
39
- /**
40
- * Change the style to indicate the button is selected
41
- */
42
- isSelected?: boolean;
43
- /**
44
- * Handler to be called on blur
45
- */
46
- onBlur?: React.FocusEventHandler<HTMLElement>;
47
- /**
48
- * Handler to be called on click. The second argument can be used to track analytics data. See the tutorial in the analytics-next package for details
49
- */
50
- onClick?: (e: React.MouseEvent<HTMLElement>, analyticsEvent: UIAnalyticsEvent) => void;
51
- /**
52
- * Handler to be called on focus
53
- */
54
- onFocus?: React.FocusEventHandler<HTMLElement>;
55
- /**
56
- * Set the amount of padding in the button
57
- */
58
- spacing?: Spacing;
59
- /**
60
- * Pass target down to a link within the button component, if a href is provided
61
- */
62
- target?: React.AnchorHTMLAttributes<HTMLAnchorElement>['target'];
63
- /**
64
- * Pass type down to a button
65
- */
66
- type?: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
67
- /**
68
- * Option to fit button width to its parent width
69
- */
70
- shouldFitContainer?: boolean;
71
- /**
72
- * Text content to be rendered in the button
73
- */
74
- children?: React.ReactNode;
75
- /**
76
- * A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests
77
- */
78
- testId?: string;
79
- component?: React.ComponentType<React.AllHTMLAttributes<HTMLElement>> | React.ElementType;
80
- /**
81
- * Additional information to be included in the `context` of analytics events that come from button
82
- */
83
- analyticsContext?: Record<string, any>;
84
- };
85
- export declare type BaseProps = Combine<Combine<Omit<React.AllHTMLAttributes<HTMLElement>, 'disabled'>, {
86
- 'data-testid'?: never;
87
- 'data-has-overlay'?: never;
88
- }>, BaseOwnProps>;
89
- export {};