@atlaskit/button 16.4.0 → 16.5.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +17 -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 +11 -3
  8. package/dist/cjs/version.json +1 -1
  9. package/dist/es2019/shared/button-base.js +11 -3
  10. package/dist/es2019/version.json +1 -1
  11. package/dist/esm/shared/button-base.js +12 -4
  12. package/dist/esm/version.json +1 -1
  13. package/dist/types/types.d.ts +5 -0
  14. package/package.json +6 -13
  15. package/report.api.md +30 -18
  16. package/dist/types-ts4.0/button-group.d.ts +0 -12
  17. package/dist/types-ts4.0/button.d.ts +0 -15
  18. package/dist/types-ts4.0/custom-theme-button/custom-theme-button-types.d.ts +0 -22
  19. package/dist/types-ts4.0/custom-theme-button/custom-theme-button.d.ts +0 -10
  20. package/dist/types-ts4.0/custom-theme-button/index.d.ts +0 -2
  21. package/dist/types-ts4.0/custom-theme-button/theme.d.ts +0 -21
  22. package/dist/types-ts4.0/entry-points/button-group.d.ts +0 -1
  23. package/dist/types-ts4.0/entry-points/custom-theme-button.d.ts +0 -2
  24. package/dist/types-ts4.0/entry-points/loading-button.d.ts +0 -2
  25. package/dist/types-ts4.0/entry-points/standard-button.d.ts +0 -7
  26. package/dist/types-ts4.0/entry-points/types.d.ts +0 -4
  27. package/dist/types-ts4.0/index.d.ts +0 -8
  28. package/dist/types-ts4.0/loading-button.d.ts +0 -15
  29. package/dist/types-ts4.0/shared/block-events.d.ts +0 -4
  30. package/dist/types-ts4.0/shared/button-base.d.ts +0 -10
  31. package/dist/types-ts4.0/shared/colors.d.ts +0 -31
  32. package/dist/types-ts4.0/shared/css.d.ts +0 -22
  33. package/dist/types-ts4.0/shared/get-is-only-single-icon.d.ts +0 -2
  34. package/dist/types-ts4.0/shared/loading-spinner.d.ts +0 -5
  35. package/dist/types-ts4.0/types.d.ts +0 -89
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/button
2
2
 
3
+ ## 16.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`71799e16ae6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/71799e16ae6) - Introduce InteractionContext to @atlaskit/button
8
+
9
+ ### Patch Changes
10
+
11
+ - [`3c76f243e7f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3c76f243e7f) - InteractionContext is nullable
12
+ - Updated dependencies
13
+
14
+ ## 16.4.1
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies
19
+
3
20
  ## 16.4.0
4
21
 
5
22
  ### 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
@@ -23,13 +23,15 @@ var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
23
23
 
24
24
  var _useAutoFocus = _interopRequireDefault(require("@atlaskit/ds-lib/use-auto-focus"));
25
25
 
26
+ var _interactionContext = _interopRequireDefault(require("@atlaskit/interaction-context"));
27
+
26
28
  var _colors = require("@atlaskit/theme/colors");
27
29
 
28
30
  var _blockEvents = _interopRequireDefault(require("./block-events"));
29
31
 
30
32
  var _css = require("./css");
31
33
 
32
- var _excluded = ["appearance", "buttonCss", "spacing", "autoFocus", "isDisabled", "shouldFitContainer", "isSelected", "iconBefore", "iconAfter", "children", "className", "href", "overlay", "tabIndex", "type", "onMouseDown", "onClick", "component", "testId", "analyticsContext"];
34
+ var _excluded = ["appearance", "buttonCss", "spacing", "autoFocus", "isDisabled", "shouldFitContainer", "isSelected", "iconBefore", "iconAfter", "children", "className", "href", "overlay", "tabIndex", "type", "onMouseDown", "onClick", "component", "testId", "interactionName", "analyticsContext"];
33
35
 
34
36
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
35
37
 
@@ -76,6 +78,7 @@ var _default = /*#__PURE__*/_react.default.forwardRef(function ButtonBase(props,
76
78
  _props$component = props.component,
77
79
  Component = _props$component === void 0 ? href ? 'a' : 'button' : _props$component,
78
80
  testId = props.testId,
81
+ interactionName = props.interactionName,
79
82
  analyticsContext = props.analyticsContext,
80
83
  rest = (0, _objectWithoutProperties2.default)(props, _excluded);
81
84
  var ourRef = (0, _react.useRef)();
@@ -96,12 +99,17 @@ var _default = /*#__PURE__*/_react.default.forwardRef(function ButtonBase(props,
96
99
  }, [ourRef, ref]); // Cross browser auto focusing is pretty broken, so we are doing it ourselves
97
100
 
98
101
  (0, _useAutoFocus.default)(ourRef, autoFocus);
102
+ var interactionContext = (0, _react.useContext)(_interactionContext.default);
103
+ var handleClick = (0, _react.useCallback)(function (e, analyticsEvent) {
104
+ interactionContext && interactionContext.tracePress(interactionName, e.timeStamp);
105
+ providedOnClick(e, analyticsEvent);
106
+ }, [providedOnClick, interactionContext, interactionName]);
99
107
  var onClick = (0, _analyticsNext.usePlatformLeafEventHandler)({
100
- fn: providedOnClick,
108
+ fn: handleClick,
101
109
  action: 'clicked',
102
110
  componentName: 'button',
103
111
  packageName: "@atlaskit/button",
104
- packageVersion: "16.4.0",
112
+ packageVersion: "16.5.0",
105
113
  analyticsData: analyticsContext
106
114
  }); // Button currently calls preventDefault, which is not standard button behaviour
107
115
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/button",
3
- "version": "16.4.0",
3
+ "version": "16.5.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,11 +1,13 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
3
  /** @jsx jsx */
4
- import React, { useCallback, useEffect, useRef } from 'react';
4
+ import React, { useCallback, useContext, useEffect, useRef } from 'react';
5
5
  import { css, jsx } from '@emotion/react';
6
6
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
7
7
  import noop from '@atlaskit/ds-lib/noop';
8
8
  import useAutoFocus from '@atlaskit/ds-lib/use-auto-focus';
9
+ // eslint-disable-next-line no-duplicate-imports
10
+ import InteractionContext from '@atlaskit/interaction-context';
9
11
  import { N500 } from '@atlaskit/theme/colors';
10
12
  import blockEvents from './block-events';
11
13
  import { getContentStyle, getFadingCss, getIconStyle, overlayCss } from './css'; // Disabled buttons will still publish events for nested elements in webkit.
@@ -41,6 +43,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
41
43
  // else default to anchor if there is a href, and button if there is no href
42
44
  component: Component = href ? 'a' : 'button',
43
45
  testId,
46
+ interactionName,
44
47
  // I don't think this should be in button, but for now it is
45
48
  analyticsContext,
46
49
  ...rest
@@ -63,12 +66,17 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
63
66
  }, [ourRef, ref]); // Cross browser auto focusing is pretty broken, so we are doing it ourselves
64
67
 
65
68
  useAutoFocus(ourRef, autoFocus);
69
+ const interactionContext = useContext(InteractionContext);
70
+ const handleClick = useCallback((e, analyticsEvent) => {
71
+ interactionContext && interactionContext.tracePress(interactionName, e.timeStamp);
72
+ providedOnClick(e, analyticsEvent);
73
+ }, [providedOnClick, interactionContext, interactionName]);
66
74
  const onClick = usePlatformLeafEventHandler({
67
- fn: providedOnClick,
75
+ fn: handleClick,
68
76
  action: 'clicked',
69
77
  componentName: 'button',
70
78
  packageName: "@atlaskit/button",
71
- packageVersion: "16.4.0",
79
+ packageVersion: "16.5.0",
72
80
  analyticsData: analyticsContext
73
81
  }); // Button currently calls preventDefault, which is not standard button behaviour
74
82
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/button",
3
- "version": "16.4.0",
3
+ "version": "16.5.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,13 +1,15 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["appearance", "buttonCss", "spacing", "autoFocus", "isDisabled", "shouldFitContainer", "isSelected", "iconBefore", "iconAfter", "children", "className", "href", "overlay", "tabIndex", "type", "onMouseDown", "onClick", "component", "testId", "analyticsContext"];
3
+ var _excluded = ["appearance", "buttonCss", "spacing", "autoFocus", "isDisabled", "shouldFitContainer", "isSelected", "iconBefore", "iconAfter", "children", "className", "href", "overlay", "tabIndex", "type", "onMouseDown", "onClick", "component", "testId", "interactionName", "analyticsContext"];
4
4
 
5
5
  /** @jsx jsx */
6
- import React, { useCallback, useEffect, useRef } from 'react';
6
+ import React, { useCallback, useContext, useEffect, useRef } from 'react';
7
7
  import { css, jsx } from '@emotion/react';
8
8
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
9
9
  import noop from '@atlaskit/ds-lib/noop';
10
10
  import useAutoFocus from '@atlaskit/ds-lib/use-auto-focus';
11
+ // eslint-disable-next-line no-duplicate-imports
12
+ import InteractionContext from '@atlaskit/interaction-context';
11
13
  import { N500 } from '@atlaskit/theme/colors';
12
14
  import blockEvents from './block-events';
13
15
  import { getContentStyle, getFadingCss, getIconStyle, overlayCss } from './css'; // Disabled buttons will still publish events for nested elements in webkit.
@@ -51,6 +53,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
51
53
  _props$component = props.component,
52
54
  Component = _props$component === void 0 ? href ? 'a' : 'button' : _props$component,
53
55
  testId = props.testId,
56
+ interactionName = props.interactionName,
54
57
  analyticsContext = props.analyticsContext,
55
58
  rest = _objectWithoutProperties(props, _excluded);
56
59
 
@@ -72,12 +75,17 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
72
75
  }, [ourRef, ref]); // Cross browser auto focusing is pretty broken, so we are doing it ourselves
73
76
 
74
77
  useAutoFocus(ourRef, autoFocus);
78
+ var interactionContext = useContext(InteractionContext);
79
+ var handleClick = useCallback(function (e, analyticsEvent) {
80
+ interactionContext && interactionContext.tracePress(interactionName, e.timeStamp);
81
+ providedOnClick(e, analyticsEvent);
82
+ }, [providedOnClick, interactionContext, interactionName]);
75
83
  var onClick = usePlatformLeafEventHandler({
76
- fn: providedOnClick,
84
+ fn: handleClick,
77
85
  action: 'clicked',
78
86
  componentName: 'button',
79
87
  packageName: "@atlaskit/button",
80
- packageVersion: "16.4.0",
88
+ packageVersion: "16.5.0",
81
89
  analyticsData: analyticsContext
82
90
  }); // Button currently calls preventDefault, which is not standard button behaviour
83
91
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/button",
3
- "version": "16.4.0",
3
+ "version": "16.5.0",
4
4
  "sideEffects": false
5
5
  }
@@ -77,6 +77,11 @@ export declare type BaseOwnProps = {
77
77
  */
78
78
  testId?: string;
79
79
  component?: React.ComponentType<React.AllHTMLAttributes<HTMLElement>> | React.ElementType;
80
+ /**
81
+ * An optional name used to identify this component to press listeners. E.g. interaction tracing
82
+ * @see https://hello.atlassian.net/wiki/spaces/UFO/pages/2010358949/UFO+Integration+into+Design+System+components
83
+ */
84
+ interactionName?: string;
80
85
  /**
81
86
  * Additional information to be included in the `context` of analytics events that come from button
82
87
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/button",
3
- "version": "16.4.0",
3
+ "version": "16.5.0",
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": {
@@ -42,9 +34,10 @@
42
34
  "dependencies": {
43
35
  "@atlaskit/analytics-next": "^8.2.0",
44
36
  "@atlaskit/ds-lib": "^2.1.0",
45
- "@atlaskit/spinner": "^15.2.0",
37
+ "@atlaskit/interaction-context": "^2.0.0",
38
+ "@atlaskit/spinner": "^15.3.0",
46
39
  "@atlaskit/theme": "^12.2.0",
47
- "@atlaskit/tokens": "^0.10.0",
40
+ "@atlaskit/tokens": "^0.11.0",
48
41
  "@babel/runtime": "^7.0.0",
49
42
  "@emotion/react": "^11.7.1"
50
43
  },
@@ -57,7 +50,7 @@
57
50
  "@atlaskit/icon": "^21.11.0",
58
51
  "@atlaskit/logo": "^13.10.0",
59
52
  "@atlaskit/section-message": "^6.3.0",
60
- "@atlaskit/select": "^15.7.0",
53
+ "@atlaskit/select": "^16.0.0",
61
54
  "@atlaskit/ssr": "*",
62
55
  "@atlaskit/visual-regression": "*",
63
56
  "@atlaskit/webdriver-runner": "*",
@@ -95,4 +88,4 @@
95
88
  },
96
89
  "homepage": "https://atlassian.design/components/button/",
97
90
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
98
- }
91
+ }
package/report.api.md CHANGED
@@ -1,12 +1,17 @@
1
+ <!-- API Report Version: 2.2 -->
2
+
1
3
  ## API Report File for "@atlaskit/button"
2
4
 
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
5
+ > Do not edit this file. This report is auto-generated using [API Extractor](https://api-extractor.com/).
6
+ > [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
7
+
8
+ ### Table of contents
4
9
 
5
- <!--
6
- Generated API Report version: 2.0
7
- -->
10
+ - [Main Entry Types](#main-entry-types)
8
11
 
9
- [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
12
+ ### Main Entry Types
13
+
14
+ <!--SECTION START: Main Entry Types-->
10
15
 
11
16
  ```ts
12
17
  /// <reference types="react" />
@@ -23,8 +28,8 @@ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
23
28
 
24
29
  // @public (undocumented)
25
30
  export type Appearance =
26
- | 'default'
27
31
  | 'danger'
32
+ | 'default'
28
33
  | 'link'
29
34
  | 'primary'
30
35
  | 'subtle'
@@ -57,6 +62,7 @@ export type BaseOwnProps = {
57
62
  component?:
58
63
  | React_2.ComponentType<React_2.AllHTMLAttributes<HTMLElement>>
59
64
  | React_2.ElementType;
65
+ interactionName?: string;
60
66
  analyticsContext?: Record<string, any>;
61
67
  };
62
68
 
@@ -73,9 +79,11 @@ export type BaseProps = Combine<
73
79
  >;
74
80
 
75
81
  // @public
76
- const Button: React_2.MemoExoticComponent<React_2.ForwardRefExoticComponent<
77
- ButtonProps & React_2.RefAttributes<HTMLElement>
78
- >>;
82
+ const Button: React_2.MemoExoticComponent<
83
+ React_2.ForwardRefExoticComponent<
84
+ ButtonProps & React_2.RefAttributes<HTMLElement>
85
+ >
86
+ >;
79
87
  export default Button;
80
88
 
81
89
  // @public (undocumented)
@@ -97,11 +105,13 @@ export interface ButtonProps extends BaseProps {}
97
105
  type Combine<First, Second> = Omit<First, keyof Second> & Second;
98
106
 
99
107
  // @public
100
- export const CustomThemeButton: React_2.MemoExoticComponent<React_2.ForwardRefExoticComponent<
101
- Omit<BaseProps, 'overlay'> &
102
- CustomThemeButtonOwnProps &
103
- React_2.RefAttributes<HTMLElement>
104
- >>;
108
+ export const CustomThemeButton: React_2.MemoExoticComponent<
109
+ React_2.ForwardRefExoticComponent<
110
+ Omit<BaseProps, 'overlay'> &
111
+ CustomThemeButtonOwnProps &
112
+ React_2.RefAttributes<HTMLElement>
113
+ >
114
+ >;
105
115
 
106
116
  // @public (undocumented)
107
117
  export type CustomThemeButtonOwnProps = {
@@ -118,13 +128,13 @@ export type CustomThemeButtonProps = Omit<BaseProps, 'overlay'> &
118
128
 
119
129
  // @public (undocumented)
120
130
  export type InteractionState =
131
+ | 'active'
132
+ | 'default'
121
133
  | 'disabled'
134
+ | 'focus'
122
135
  | 'focusSelected'
123
- | 'selected'
124
- | 'active'
125
136
  | 'hover'
126
- | 'focus'
127
- | 'default';
137
+ | 'selected';
128
138
 
129
139
  // @public
130
140
  export const LoadingButton: React_2.ForwardRefExoticComponent<
@@ -178,3 +188,5 @@ export type ThemeTokens = {
178
188
 
179
189
  // (No @packageDocumentation comment for this package)
180
190
  ```
191
+
192
+ <!--SECTION END: Main Entry Types-->
@@ -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 {};