@atlaskit/button 16.10.2 → 16.12.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 (105) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/entry-points/new.js +8 -1
  3. package/dist/cjs/entry-points/unsafe.js +40 -1
  4. package/dist/cjs/new-button/containers/split-button/index.js +50 -0
  5. package/dist/cjs/new-button/containers/split-button/split-button-context.js +37 -0
  6. package/dist/cjs/new-button/containers/split-button/split-button.js +137 -0
  7. package/dist/cjs/new-button/containers/split-button/types.js +5 -0
  8. package/dist/cjs/new-button/containers/split-button/utils.js +23 -0
  9. package/dist/cjs/new-button/variants/default/link.js +47 -42
  10. package/dist/cjs/new-button/variants/icon/link.js +47 -42
  11. package/dist/cjs/new-button/variants/shared/use-button-base.js +19 -6
  12. package/dist/cjs/new-button/variants/shared/xcss.js +52 -10
  13. package/dist/cjs/old-button/shared/button-base.js +1 -1
  14. package/dist/cjs/utils/variants.js +73 -8
  15. package/dist/es2019/entry-points/new.js +2 -1
  16. package/dist/es2019/entry-points/unsafe.js +4 -1
  17. package/dist/es2019/new-button/containers/split-button/index.js +3 -0
  18. package/dist/es2019/new-button/containers/split-button/split-button-context.js +31 -0
  19. package/dist/es2019/new-button/containers/split-button/split-button.js +129 -0
  20. package/dist/es2019/new-button/containers/split-button/types.js +1 -0
  21. package/dist/es2019/new-button/containers/split-button/utils.js +12 -0
  22. package/dist/es2019/new-button/variants/default/button.js +0 -1
  23. package/dist/es2019/new-button/variants/default/link.js +45 -44
  24. package/dist/es2019/new-button/variants/icon/button.js +0 -1
  25. package/dist/es2019/new-button/variants/icon/link.js +45 -44
  26. package/dist/es2019/new-button/variants/shared/use-button-base.js +19 -6
  27. package/dist/es2019/new-button/variants/shared/xcss.js +54 -10
  28. package/dist/es2019/old-button/shared/button-base.js +1 -1
  29. package/dist/es2019/utils/variants.js +69 -6
  30. package/dist/esm/entry-points/new.js +2 -1
  31. package/dist/esm/entry-points/unsafe.js +4 -1
  32. package/dist/esm/new-button/containers/split-button/index.js +3 -0
  33. package/dist/esm/new-button/containers/split-button/split-button-context.js +31 -0
  34. package/dist/esm/new-button/containers/split-button/split-button.js +131 -0
  35. package/dist/esm/new-button/containers/split-button/types.js +1 -0
  36. package/dist/esm/new-button/containers/split-button/utils.js +16 -0
  37. package/dist/esm/new-button/variants/default/link.js +44 -42
  38. package/dist/esm/new-button/variants/icon/link.js +44 -42
  39. package/dist/esm/new-button/variants/shared/use-button-base.js +19 -6
  40. package/dist/esm/new-button/variants/shared/xcss.js +51 -10
  41. package/dist/esm/old-button/shared/button-base.js +1 -1
  42. package/dist/esm/utils/variants.js +75 -6
  43. package/dist/types/entry-points/new.d.ts +1 -0
  44. package/dist/types/entry-points/unsafe.d.ts +3 -0
  45. package/dist/types/new-button/containers/split-button/index.d.ts +3 -0
  46. package/dist/types/new-button/containers/split-button/split-button-context.d.ts +47 -0
  47. package/dist/types/new-button/containers/split-button/split-button.d.ts +47 -0
  48. package/dist/types/new-button/containers/split-button/types.d.ts +4 -0
  49. package/dist/types/new-button/containers/split-button/utils.d.ts +5 -0
  50. package/dist/types/new-button/variants/default/button.d.ts +3 -5
  51. package/dist/types/new-button/variants/default/link.d.ts +10 -7
  52. package/dist/types/new-button/variants/icon/button.d.ts +3 -5
  53. package/dist/types/new-button/variants/icon/link.d.ts +11 -8
  54. package/dist/types/new-button/variants/shared/use-button-base.d.ts +1 -1
  55. package/dist/types/new-button/variants/shared/xcss.d.ts +14 -1
  56. package/dist/types/new-button/variants/types.d.ts +11 -1
  57. package/dist/types/old-button/types.d.ts +2 -2
  58. package/dist/types/utils/variants.d.ts +25 -3
  59. package/dist/types-ts4.5/containers/button-group.d.ts +12 -0
  60. package/dist/types-ts4.5/entry-points/button-group.d.ts +1 -0
  61. package/dist/types-ts4.5/entry-points/custom-theme-button.d.ts +2 -0
  62. package/dist/types-ts4.5/entry-points/loading-button.d.ts +2 -0
  63. package/dist/types-ts4.5/entry-points/new.d.ts +6 -0
  64. package/dist/types-ts4.5/entry-points/standard-button.d.ts +7 -0
  65. package/dist/types-ts4.5/entry-points/types.d.ts +4 -0
  66. package/dist/types-ts4.5/entry-points/unsafe.d.ts +4 -0
  67. package/dist/types-ts4.5/index.d.ts +8 -0
  68. package/dist/types-ts4.5/new-button/containers/split-button/index.d.ts +3 -0
  69. package/dist/types-ts4.5/new-button/containers/split-button/split-button-context.d.ts +47 -0
  70. package/dist/types-ts4.5/new-button/containers/split-button/split-button.d.ts +47 -0
  71. package/dist/types-ts4.5/new-button/containers/split-button/types.d.ts +4 -0
  72. package/dist/types-ts4.5/new-button/containers/split-button/utils.d.ts +5 -0
  73. package/dist/types-ts4.5/new-button/variants/default/button.d.ts +17 -0
  74. package/dist/types-ts4.5/new-button/variants/default/link.d.ts +20 -0
  75. package/dist/types-ts4.5/new-button/variants/default/types.d.ts +15 -0
  76. package/dist/types-ts4.5/new-button/variants/default/use-default-button.d.ts +15 -0
  77. package/dist/types-ts4.5/new-button/variants/icon/button.d.ts +15 -0
  78. package/dist/types-ts4.5/new-button/variants/icon/link.d.ts +20 -0
  79. package/dist/types-ts4.5/new-button/variants/icon/types.d.ts +8 -0
  80. package/dist/types-ts4.5/new-button/variants/icon/use-icon-button.d.ts +15 -0
  81. package/dist/types-ts4.5/new-button/variants/shared/block-events.d.ts +2 -0
  82. package/dist/types-ts4.5/new-button/variants/shared/colors.d.ts +18 -0
  83. package/dist/types-ts4.5/new-button/variants/shared/content.d.ts +13 -0
  84. package/dist/types-ts4.5/new-button/variants/shared/use-button-base.d.ts +37 -0
  85. package/dist/types-ts4.5/new-button/variants/shared/xcss.d.ts +31 -0
  86. package/dist/types-ts4.5/new-button/variants/types.d.ts +79 -0
  87. package/dist/types-ts4.5/old-button/button.d.ts +15 -0
  88. package/dist/types-ts4.5/old-button/custom-theme-button/custom-theme-button-types.d.ts +22 -0
  89. package/dist/types-ts4.5/old-button/custom-theme-button/custom-theme-button.d.ts +10 -0
  90. package/dist/types-ts4.5/old-button/custom-theme-button/index.d.ts +2 -0
  91. package/dist/types-ts4.5/old-button/custom-theme-button/theme.d.ts +21 -0
  92. package/dist/types-ts4.5/old-button/loading-button.d.ts +15 -0
  93. package/dist/types-ts4.5/old-button/shared/block-events.d.ts +4 -0
  94. package/dist/types-ts4.5/old-button/shared/button-base.d.ts +10 -0
  95. package/dist/types-ts4.5/old-button/shared/colors.d.ts +23 -0
  96. package/dist/types-ts4.5/old-button/shared/css.d.ts +22 -0
  97. package/dist/types-ts4.5/old-button/shared/get-if-visually-hidden-children.d.ts +2 -0
  98. package/dist/types-ts4.5/old-button/shared/get-is-only-single-icon.d.ts +2 -0
  99. package/dist/types-ts4.5/old-button/shared/loading-spinner.d.ts +5 -0
  100. package/dist/types-ts4.5/old-button/types.d.ts +94 -0
  101. package/dist/types-ts4.5/utils/appearances.d.ts +3 -0
  102. package/dist/types-ts4.5/utils/spacing.d.ts +3 -0
  103. package/dist/types-ts4.5/utils/variants.d.ts +37 -0
  104. package/package.json +4 -3
  105. package/tmp/api-report-tmp.d.ts +133 -0
@@ -1,9 +1,7 @@
1
1
  import React from 'react';
2
- import { type AdditionalHTMLElementPropsExtender, type CombinedButtonProps } from '../types';
2
+ import { type CommonButtonVariantProps } from '../types';
3
3
  import { type CommonDefaultButtonProps } from './types';
4
- type Element = HTMLButtonElement;
5
- type AdditionalHTMLElementProps = AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<Element>>;
6
- export type ButtonProps = CommonDefaultButtonProps & CombinedButtonProps<Element, AdditionalHTMLElementProps>;
4
+ export type ButtonProps = CommonDefaultButtonProps & CommonButtonVariantProps;
7
5
  /**
8
6
  * __Button__
9
7
  *
@@ -15,5 +13,5 @@ export type ButtonProps = CommonDefaultButtonProps & CombinedButtonProps<Element
15
13
  * - [Code](https://atlassian.design/components/button/code)
16
14
  * - [Usage](https://atlassian.design/components/button/usage)
17
15
  */
18
- declare const Button: React.MemoExoticComponent<React.ForwardRefExoticComponent<CommonDefaultButtonProps & Omit<AdditionalHTMLElementProps, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>>;
16
+ declare const Button: React.MemoExoticComponent<React.ForwardRefExoticComponent<CommonDefaultButtonProps & Omit<import("../types").AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<HTMLButtonElement>>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>>;
19
17
  export default Button;
@@ -1,17 +1,20 @@
1
- import React from 'react';
2
- import { type AdditionalHTMLElementPropsExtender, type CombinedButtonProps } from '../types';
1
+ import React, { type Ref } from 'react';
2
+ import { type CommonLinkVariantProps } from '../types';
3
3
  import { type CommonDefaultButtonProps } from './types';
4
- type Element = HTMLAnchorElement;
5
- type AdditionalHTMLElementProps = AdditionalHTMLElementPropsExtender<React.AnchorHTMLAttributes<Element>>;
6
- export type LinkButtonProps = CommonDefaultButtonProps & CombinedButtonProps<Element, AdditionalHTMLElementProps>;
4
+ export type LinkButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonDefaultButtonProps & CommonLinkVariantProps<RouterLinkConfig>;
5
+ declare const LinkButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, autoFocus, appearance, spacing, isDisabled, isSelected, iconBefore, iconAfter, children, shouldFitContainer, interactionName, overlay, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, testId, href, ...rest }: LinkButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
7
6
  /**
8
7
  * __Link Button__
9
8
  *
10
- * A link button renders a link in the style of a button.
9
+ * Renders a link in the style of a button.
11
10
  *
12
11
  * - [Examples](https://atlassian.design/components/button/examples)
13
12
  * - [Code](https://atlassian.design/components/button/code)
14
13
  * - [Usage](https://atlassian.design/components/button/usage)
15
14
  */
16
- declare const LinkButton: React.MemoExoticComponent<React.ForwardRefExoticComponent<CommonDefaultButtonProps & Omit<AdditionalHTMLElementProps, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & React.RefAttributes<HTMLAnchorElement>>>;
15
+ declare const LinkButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonDefaultButtonProps & {
16
+ href: string | RouterLinkConfig;
17
+ } & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & {
18
+ ref?: React.Ref<HTMLAnchorElement> | undefined;
19
+ }) => ReturnType<typeof LinkButtonBase>;
17
20
  export default LinkButton;
@@ -1,9 +1,7 @@
1
1
  import React from 'react';
2
- import { type AdditionalHTMLElementPropsExtender, type CombinedButtonProps } from '../types';
2
+ import { type CommonButtonVariantProps } from '../types';
3
3
  import { type CommonIconButtonProps } from './types';
4
- type Element = HTMLButtonElement;
5
- type AdditionalHTMLElementProps = AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<Element>>;
6
- export type IconButtonProps = CommonIconButtonProps & CombinedButtonProps<Element, AdditionalHTMLElementProps>;
4
+ export type IconButtonProps = CommonIconButtonProps & CommonButtonVariantProps;
7
5
  /**
8
6
  * __Icon Button__
9
7
  *
@@ -13,5 +11,5 @@ export type IconButtonProps = CommonIconButtonProps & CombinedButtonProps<Elemen
13
11
  * - [Code](https://atlassian.design/components/button/code)
14
12
  * - [Usage](https://atlassian.design/components/button/usage)
15
13
  */
16
- declare const IconButton: React.MemoExoticComponent<React.ForwardRefExoticComponent<CommonIconButtonProps & Omit<AdditionalHTMLElementProps, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>>;
14
+ declare const IconButton: React.MemoExoticComponent<React.ForwardRefExoticComponent<CommonIconButtonProps & Omit<import("../types").AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<HTMLButtonElement>>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>>;
17
15
  export default IconButton;
@@ -1,17 +1,20 @@
1
- import React from 'react';
2
- import { type AdditionalHTMLElementPropsExtender, type CombinedButtonProps } from '../types';
1
+ import React, { type Ref } from 'react';
2
+ import { type CommonLinkVariantProps } from '../types';
3
3
  import { type CommonIconButtonProps } from './types';
4
- type Element = HTMLAnchorElement;
5
- type AdditionalHTMLElementProps = AdditionalHTMLElementPropsExtender<React.AnchorHTMLAttributes<Element>>;
6
- export type LinkIconButtonProps = CommonIconButtonProps & CombinedButtonProps<Element, AdditionalHTMLElementProps>;
4
+ export type LinkIconButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonIconButtonProps & CommonLinkVariantProps<RouterLinkConfig>;
5
+ declare const LinkIconButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, autoFocus, appearance, spacing, isDisabled, isSelected, icon, children, interactionName, overlay, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, testId, href, ...rest }: LinkIconButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
7
6
  /**
8
- * __Link Button__
7
+ * __Link Icon Button__
9
8
  *
10
- * A link button renders a link in the style of a button.
9
+ * Renders a link in the style of an icon button.
11
10
  *
12
11
  * - [Examples](https://atlassian.design/components/button/examples)
13
12
  * - [Code](https://atlassian.design/components/button/code)
14
13
  * - [Usage](https://atlassian.design/components/button/usage)
15
14
  */
16
- declare const LinkIconButton: React.MemoExoticComponent<React.ForwardRefExoticComponent<CommonIconButtonProps & Omit<AdditionalHTMLElementProps, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & React.RefAttributes<HTMLAnchorElement>>>;
15
+ declare const LinkIconButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonIconButtonProps & {
16
+ href: string | RouterLinkConfig;
17
+ } & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & {
18
+ ref?: React.Ref<HTMLAnchorElement> | undefined;
19
+ }) => ReturnType<typeof LinkIconButtonBase>;
17
20
  export default LinkIconButton;
@@ -33,5 +33,5 @@ export type UseButtonBaseReturn<TagName extends HTMLElement> = {
33
33
  *
34
34
  * @private
35
35
  */
36
- declare const useButtonBase: <TagName extends HTMLElement>({ analyticsContext, appearance, autoFocus, buttonType, interactionName, isDisabled, isSelected, isIconButton, hasIconBefore, hasIconAfter, children, onClick: providedOnClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
36
+ declare const useButtonBase: <TagName extends HTMLElement>({ analyticsContext, appearance: propAppearance, autoFocus, buttonType, interactionName, isDisabled: propIsDisabled, isSelected, isIconButton, hasIconBefore, hasIconAfter, children, onClick: providedOnClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing: propSpacing, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
37
37
  export default useButtonBase;
@@ -1,10 +1,15 @@
1
1
  import { xcss } from '@atlaskit/primitives';
2
2
  import { type Appearance, type Spacing } from '../types';
3
+ export declare const heights: {
4
+ [key in Spacing]: string;
5
+ };
3
6
  export type GetXCSSArgs = {
4
7
  appearance: Appearance;
5
8
  spacing: Spacing;
6
9
  isDisabled: boolean;
7
10
  isSelected: boolean;
11
+ isHighlighted: boolean;
12
+ isActiveOverSelected: boolean;
8
13
  shouldFitContainer: boolean;
9
14
  hasOverlay: boolean;
10
15
  isIconButton: boolean;
@@ -14,5 +19,13 @@ export type GetXCSSArgs = {
14
19
  * If the button is a LinkButton
15
20
  */
16
21
  isLink: boolean;
22
+ /**
23
+ * If the button is a SplitButton
24
+ */
25
+ isSplit: boolean;
26
+ /**
27
+ * If the button is a PrimarySplitButton used in atlassian-navigation
28
+ */
29
+ isNavigationSplit: boolean;
17
30
  };
18
- export declare function getXCSS({ appearance, spacing, isDisabled, isSelected, isIconButton, shouldFitContainer, isLink, hasOverlay, hasIconBefore, hasIconAfter, }: GetXCSSArgs): ReturnType<typeof xcss>;
31
+ export declare function getXCSS({ appearance, spacing, isDisabled, isSelected, isHighlighted, isActiveOverSelected, isIconButton, shouldFitContainer, isLink, isSplit, isNavigationSplit, hasOverlay, hasIconBefore, hasIconAfter, }: GetXCSSArgs): ReturnType<typeof xcss>;
@@ -63,7 +63,17 @@ export type AdditionalHTMLElementPropsExtender<Props extends SupportedElementAtt
63
63
  'data-testid'?: never;
64
64
  }>;
65
65
  /**
66
- * Combines common buttom props with additional HTML attributes.
66
+ * Combines common button props with additional HTML attributes.
67
67
  */
68
68
  export type CombinedButtonProps<TagName extends HTMLElement, HTMLAttributes extends SupportedElementAttributes> = Combine<HTMLAttributes, CommonButtonProps<TagName>>;
69
+ /**
70
+ * Common props for Button `<button>` variants
71
+ */
72
+ export type CommonButtonVariantProps = CombinedButtonProps<HTMLButtonElement, AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<HTMLButtonElement>>>;
73
+ /**
74
+ * Common props for Link `<a>` Button variants
75
+ */
76
+ export type CommonLinkVariantProps<RouterLinkConfig extends Record<string, any> = never> = {
77
+ href: string | RouterLinkConfig;
78
+ } & CombinedButtonProps<HTMLAnchorElement, AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>>>;
69
79
  export {};
@@ -78,8 +78,8 @@ export type BaseOwnProps = {
78
78
  testId?: string;
79
79
  component?: React.ComponentType<React.AllHTMLAttributes<HTMLElement>> | React.ElementType;
80
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
81
+ * An optional name used to identify this component to press listeners. For example, interaction tracing. For more information,
82
+ * see [UFO integration into Design System components](https://go.atlassian.com/react-ufo-dst-integration)
83
83
  */
84
84
  interactionName?: string;
85
85
  /**
@@ -1,5 +1,7 @@
1
1
  import React from 'react';
2
2
  import Button from '../new-button/variants/default/button';
3
+ import { LinkButtonProps } from '../new-button/variants/default/link';
4
+ import { LinkIconButtonProps } from '../new-button/variants/icon/link';
3
5
  export type Variant = {
4
6
  name: string;
5
7
  Component: typeof Button | typeof LinkButtonRender;
@@ -8,8 +10,28 @@ export type Variant = {
8
10
  */
9
11
  elementType: typeof HTMLButtonElement | typeof HTMLAnchorElement;
10
12
  };
11
- declare const LinkButtonRender: React.ForwardRefExoticComponent<import("../new-button/variants/default/types").CommonDefaultButtonProps & Omit<Omit<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "style" | "disabled" | "className" | "role">, "data-testid"> & {
12
- 'data-testid'?: undefined;
13
- }, keyof import("../new-button/variants/types").CommonButtonProps<TagName>> & import("../new-button/variants/types").CommonButtonProps<HTMLAnchorElement> & React.RefAttributes<HTMLAnchorElement>>;
13
+ declare const LinkButtonRender: React.ForwardRefExoticComponent<Omit<LinkButtonProps<never>, "href"> & {
14
+ href?: string | undefined;
15
+ } & React.RefAttributes<HTMLAnchorElement>>;
14
16
  export declare const variants: Variant[];
15
17
  export default variants;
18
+ export declare const linkButtonVariants: ({
19
+ name: string;
20
+ Component: React.ForwardRefExoticComponent<Omit<LinkButtonProps<never>, "href"> & {
21
+ href?: string | undefined;
22
+ } & React.RefAttributes<HTMLAnchorElement>>;
23
+ elementType: {
24
+ new (): HTMLAnchorElement;
25
+ prototype: HTMLAnchorElement;
26
+ };
27
+ } | {
28
+ name: string;
29
+ Component: React.ForwardRefExoticComponent<Omit<LinkIconButtonProps<never>, "href" | "icon"> & {
30
+ href?: string | undefined;
31
+ icon?: React.ReactChild | undefined;
32
+ } & React.RefAttributes<HTMLAnchorElement>>;
33
+ elementType: {
34
+ new (): HTMLAnchorElement;
35
+ prototype: HTMLAnchorElement;
36
+ };
37
+ })[];
@@ -0,0 +1,12 @@
1
+ /** @jsx jsx */
2
+ import React from 'react';
3
+ import { jsx } from '@emotion/react';
4
+ import { Appearance } from '../old-button/types';
5
+ export 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;
@@ -0,0 +1 @@
1
+ export { default } from '../containers/button-group';
@@ -0,0 +1,2 @@
1
+ export { default, Theme } from '../old-button/custom-theme-button';
2
+ export type { ThemeTokens, ThemeProps, InteractionState, CustomThemeButtonProps, CustomThemeButtonOwnProps, } from '../old-button/custom-theme-button/custom-theme-button-types';
@@ -0,0 +1,2 @@
1
+ export { default } from '../old-button/loading-button';
2
+ export type { LoadingButtonProps, LoadingButtonOwnProps, } from '../old-button/loading-button';
@@ -0,0 +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';
4
+ export { default as LinkIconButton, type LinkIconButtonProps, } from '../new-button/variants/icon/link';
5
+ export { SplitButton } from '../new-button/containers/split-button';
6
+ export type { Appearance, Spacing } from '../new-button/variants/types';
@@ -0,0 +1,7 @@
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 '../old-button/button';
7
+ export type { ButtonProps } from '../old-button/button';
@@ -0,0 +1,4 @@
1
+ export type { Appearance, Spacing, BaseOwnProps, BaseProps, } from '../old-button/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';
@@ -0,0 +1,4 @@
1
+ export { default as UNSAFE_BUTTON } from '../new-button/variants/default/button';
2
+ export { default as UNSAFE_ICON_BUTTON } from '../new-button/variants/icon/button';
3
+ export { SplitButton as UNSAFE_SPLIT_BUTTON, SplitButtonContainer as UNSAFE_SPLIT_BUTTON_CONTAINER, Divider as UNSAFE_DIVIDER, getActions as UNSAFE_GET_ACTIONS, } from '../new-button/containers/split-button';
4
+ export { SplitButtonContext as UNSAFE_SPLIT_BUTTON_CONTEXT } from '../new-button/containers/split-button/split-button-context';
@@ -0,0 +1,8 @@
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';
@@ -0,0 +1,3 @@
1
+ export { SplitButton, SplitButtonWithSlots, Divider, SplitButtonContainer, } from './split-button';
2
+ export { getActions } from './utils';
3
+ export { SplitButtonContext, useSplitButtonContext, } from './split-button-context';
@@ -0,0 +1,47 @@
1
+ /// <reference types="react" />
2
+ import { SplitButtonAppearance, SplitButtonSpacing } from './types';
3
+ type NavigationSplitButtonContextProps = {
4
+ appearance: 'navigation';
5
+ isHighlighted: boolean;
6
+ };
7
+ type MainSplitButtonContextProps = {
8
+ appearance: SplitButtonAppearance;
9
+ spacing: SplitButtonSpacing;
10
+ isDisabled: boolean;
11
+ };
12
+ type SplitButtonContextProps = NavigationSplitButtonContextProps | MainSplitButtonContextProps;
13
+ /**
14
+ * TODO: Add jsdoc
15
+ */
16
+ export declare const SplitButtonContext: import("react").Context<SplitButtonContextProps | undefined>;
17
+ type UseSplitButtonContext = {
18
+ appearance: SplitButtonAppearance | 'subtle';
19
+ spacing: SplitButtonSpacing;
20
+ isDisabled: boolean;
21
+ /**
22
+ * isSelected state has limited relevance (e.g. dropdown-menu trigger button).
23
+ * There is no isSelected state for color variants (e.g. primary, danger, warning).
24
+ * Hens we provide ability to override the isSelected state with isActiveOverSelected to display `active` state instead of `selected` state.
25
+ */
26
+ isActiveOverSelected: boolean;
27
+ isNavigationSplitButton: boolean;
28
+ isHighlighted: boolean;
29
+ };
30
+ type NavigationSplitButtonContext = UseSplitButtonContext & {
31
+ appearance: 'subtle';
32
+ spacing: 'default';
33
+ isDisabled: false;
34
+ isActiveOverSelected: false;
35
+ isNavigationSplitButton: true;
36
+ isHighlighted: boolean;
37
+ };
38
+ type MainSplitButtonContext = UseSplitButtonContext & {
39
+ appearance: SplitButtonAppearance;
40
+ spacing: SplitButtonSpacing;
41
+ isDisabled: boolean;
42
+ isActiveOverSelected: true;
43
+ isNavigationSplitButton: false;
44
+ isHighlighted: false;
45
+ };
46
+ export declare const useSplitButtonContext: () => NavigationSplitButtonContext | MainSplitButtonContext | undefined;
47
+ export {};
@@ -0,0 +1,47 @@
1
+ /** @jsx jsx */
2
+ import { type ReactNode } from 'react';
3
+ import { jsx } from '@emotion/react';
4
+ import type { SplitButtonAppearance, SplitButtonContextAppearance, SplitButtonSpacing } from './types';
5
+ type DividerProps = {
6
+ appearance: SplitButtonContextAppearance;
7
+ spacing: SplitButtonSpacing;
8
+ isDisabled?: boolean;
9
+ };
10
+ /**
11
+ * TODO: Add JSDoc
12
+ */
13
+ export declare const Divider: ({ appearance, spacing, isDisabled, }: DividerProps) => jsx.JSX.Element;
14
+ /**
15
+ * TODO: Add JSdoc
16
+ */
17
+ export declare const SplitButtonContainer: ({ children }: {
18
+ children: ReactNode;
19
+ }) => jsx.JSX.Element;
20
+ type SplitButtonProps = {
21
+ /**
22
+ * Only two children are allowed.
23
+ * First child is the primary action, second child is the secondary action.
24
+ * The assumption is that for both children trees there is a button reading the context.
25
+ */
26
+ children: ReactNode;
27
+ appearance?: SplitButtonAppearance;
28
+ spacing?: SplitButtonSpacing;
29
+ isDisabled?: boolean;
30
+ };
31
+ /**
32
+ * TODO: Add description when adding docs
33
+ */
34
+ export declare const SplitButton: ({ children, appearance, spacing, isDisabled, }: SplitButtonProps) => jsx.JSX.Element;
35
+ type SplitButtonWithSlotsProps = {
36
+ primaryAction: ReactNode;
37
+ secondaryAction: ReactNode;
38
+ appearance?: SplitButtonAppearance;
39
+ spacing?: SplitButtonSpacing;
40
+ isDisabled?: boolean;
41
+ isSelected?: boolean;
42
+ };
43
+ /**
44
+ * TODO: Decide on API
45
+ */
46
+ export declare const SplitButtonWithSlots: ({ primaryAction, secondaryAction, appearance, spacing, isDisabled, }: SplitButtonWithSlotsProps) => jsx.JSX.Element;
47
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { Appearance, Spacing } from '../../variants/types';
2
+ export type SplitButtonAppearance = Extract<Appearance, 'default' | 'primary' | 'danger' | 'warning'>;
3
+ export type SplitButtonContextAppearance = SplitButtonAppearance | 'navigation';
4
+ export type SplitButtonSpacing = Extract<Spacing, 'default' | 'compact'>;
@@ -0,0 +1,5 @@
1
+ import { type ReactNode } from 'react';
2
+ export declare const getActions: (children: ReactNode) => {
3
+ PrimaryAction: import("react").ReactChild | import("react").ReactFragment | import("react").ReactPortal;
4
+ SecondaryAction: import("react").ReactChild | import("react").ReactFragment | import("react").ReactPortal;
5
+ };
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { type CommonButtonVariantProps } from '../types';
3
+ import { type CommonDefaultButtonProps } from './types';
4
+ export type ButtonProps = CommonDefaultButtonProps & CommonButtonVariantProps;
5
+ /**
6
+ * __Button__
7
+ *
8
+ * @warning __UNSAFE__ Button is not yet safe for production use.
9
+ *
10
+ * A button triggers an event or action.
11
+ *
12
+ * - [Examples](https://atlassian.design/components/button/examples)
13
+ * - [Code](https://atlassian.design/components/button/code)
14
+ * - [Usage](https://atlassian.design/components/button/usage)
15
+ */
16
+ declare const Button: React.MemoExoticComponent<React.ForwardRefExoticComponent<CommonDefaultButtonProps & Omit<import("../types").AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<HTMLButtonElement>>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>>;
17
+ export default Button;
@@ -0,0 +1,20 @@
1
+ import React, { type Ref } from 'react';
2
+ import { type CommonLinkVariantProps } from '../types';
3
+ import { type CommonDefaultButtonProps } from './types';
4
+ export type LinkButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonDefaultButtonProps & CommonLinkVariantProps<RouterLinkConfig>;
5
+ declare const LinkButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, autoFocus, appearance, spacing, isDisabled, isSelected, iconBefore, iconAfter, children, shouldFitContainer, interactionName, overlay, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, testId, href, ...rest }: LinkButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
6
+ /**
7
+ * __Link Button__
8
+ *
9
+ * Renders a link in the style of a button.
10
+ *
11
+ * - [Examples](https://atlassian.design/components/button/examples)
12
+ * - [Code](https://atlassian.design/components/button/code)
13
+ * - [Usage](https://atlassian.design/components/button/usage)
14
+ */
15
+ declare const LinkButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonDefaultButtonProps & {
16
+ href: string | RouterLinkConfig;
17
+ } & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & {
18
+ ref?: React.Ref<HTMLAnchorElement> | undefined;
19
+ }) => ReturnType<typeof LinkButtonBase>;
20
+ export default LinkButton;
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ export type CommonDefaultButtonProps = {
3
+ /**
4
+ * Places an icon within the button, after the button's text
5
+ */
6
+ iconAfter?: React.ReactChild;
7
+ /**
8
+ * Places an icon within the button, before the button's text
9
+ */
10
+ iconBefore?: React.ReactChild;
11
+ /**
12
+ * Option to fit button width to its parent width
13
+ */
14
+ shouldFitContainer?: boolean;
15
+ };
@@ -0,0 +1,15 @@
1
+ import { type UseButtonBaseArgs, type UseButtonBaseReturn } from '../shared/use-button-base';
2
+ import { type CommonDefaultButtonProps } from './types';
3
+ type UseDefaultButtonArgs<TagName extends HTMLElement> = UseButtonBaseArgs<TagName> & CommonDefaultButtonProps;
4
+ type UseButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagName>;
5
+ /**
6
+ * __Use default button base__
7
+ *
8
+ * A React hook that accepts a set of default Button props,
9
+ * and processes them to return consistent base props for usage
10
+ * across Button and LinkButton variants.
11
+ *
12
+ * @private
13
+ */
14
+ declare const useDefaultButton: <TagName extends HTMLElement>({ analyticsContext, appearance, autoFocus, buttonType, iconBefore, iconAfter, interactionName, isDisabled, isSelected, children, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing, }: UseDefaultButtonArgs<TagName>) => UseButtonReturn<TagName>;
15
+ export default useDefaultButton;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { type CommonButtonVariantProps } from '../types';
3
+ import { type CommonIconButtonProps } from './types';
4
+ export type IconButtonProps = CommonIconButtonProps & CommonButtonVariantProps;
5
+ /**
6
+ * __Icon Button__
7
+ *
8
+ * TODO: Description
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 IconButton: React.MemoExoticComponent<React.ForwardRefExoticComponent<CommonIconButtonProps & Omit<import("../types").AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<HTMLButtonElement>>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>>;
15
+ export default IconButton;
@@ -0,0 +1,20 @@
1
+ import React, { type Ref } from 'react';
2
+ import { type CommonLinkVariantProps } from '../types';
3
+ import { type CommonIconButtonProps } from './types';
4
+ export type LinkIconButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonIconButtonProps & CommonLinkVariantProps<RouterLinkConfig>;
5
+ declare const LinkIconButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, autoFocus, appearance, spacing, isDisabled, isSelected, icon, children, interactionName, overlay, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, testId, href, ...rest }: LinkIconButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
6
+ /**
7
+ * __Link Icon Button__
8
+ *
9
+ * Renders a link in the style of an icon button.
10
+ *
11
+ * - [Examples](https://atlassian.design/components/button/examples)
12
+ * - [Code](https://atlassian.design/components/button/code)
13
+ * - [Usage](https://atlassian.design/components/button/usage)
14
+ */
15
+ declare const LinkIconButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonIconButtonProps & {
16
+ href: string | RouterLinkConfig;
17
+ } & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & {
18
+ ref?: React.Ref<HTMLAnchorElement> | undefined;
19
+ }) => ReturnType<typeof LinkIconButtonBase>;
20
+ export default LinkIconButton;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ export type CommonIconButtonProps = {
3
+ /**
4
+ * TODO: Consider locking-down icon props by converting from slot props to component props
5
+ * Places an icon within the button, after the button's text
6
+ */
7
+ icon: React.ReactChild;
8
+ };
@@ -0,0 +1,15 @@
1
+ import { type UseButtonBaseArgs, type UseButtonBaseReturn } from '../shared/use-button-base';
2
+ import { type CommonIconButtonProps } from './types';
3
+ type UseIconButtonArgs<TagName extends HTMLElement> = UseButtonBaseArgs<TagName> & CommonIconButtonProps;
4
+ type UseIconButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagName>;
5
+ /**
6
+ * __Use icon button__
7
+ *
8
+ * A React hook that accepts a set of icon Button props,
9
+ * and processes them to return consistent base props for usage
10
+ * across IconButton and LinkIconButton variants.
11
+ *
12
+ * @private
13
+ */
14
+ declare const useIconButton: <TagName extends HTMLElement>({ analyticsContext, appearance, autoFocus, buttonType, icon, interactionName, isDisabled, isSelected, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing, }: UseIconButtonArgs<TagName>) => UseIconButtonReturn<TagName>;
15
+ export default useIconButton;
@@ -0,0 +1,2 @@
1
+ import { type ControlledEvents } from './use-button-base';
2
+ export default function blockEvents<TagName extends HTMLElement>(shouldBlockEvents: boolean, events: ControlledEvents<TagName>): ControlledEvents<TagName>;
@@ -0,0 +1,18 @@
1
+ import { type BackgroundColor, type TextColor } from '@atlaskit/primitives';
2
+ import { type Appearance } from '../types';
3
+ export type ColorGroup<T extends BackgroundColor | TextColor> = {
4
+ default: T;
5
+ hover?: T;
6
+ active?: T;
7
+ disabled?: T;
8
+ selected?: T;
9
+ };
10
+ export type ColorPreset<T extends BackgroundColor | TextColor> = {
11
+ [key in Appearance]: ColorGroup<T>;
12
+ };
13
+ type Values = {
14
+ background: ColorPreset<BackgroundColor>;
15
+ color: ColorPreset<TextColor>;
16
+ };
17
+ declare const values: Values;
18
+ export default values;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ type ContentProps = {
3
+ children: React.ReactNode;
4
+ type?: 'text' | 'icon';
5
+ hasOverlay: boolean;
6
+ };
7
+ /**
8
+ * __Content__
9
+ *
10
+ * Used for slots within a Button, including icons and text content.
11
+ */
12
+ declare const Content: ({ children, type, hasOverlay }: ContentProps) => JSX.Element;
13
+ export default Content;
@@ -0,0 +1,37 @@
1
+ import React from 'react';
2
+ import { xcss } from '@atlaskit/primitives';
3
+ import { type CommonButtonProps } from '../types';
4
+ export type ControlledEvents<TagName extends HTMLElement> = Pick<React.DOMAttributes<TagName>, 'onMouseDownCapture' | 'onMouseUpCapture' | 'onKeyDownCapture' | 'onKeyUpCapture' | 'onTouchStartCapture' | 'onTouchEndCapture' | 'onPointerDownCapture' | 'onPointerUpCapture' | 'onClickCapture' | 'onClick'>;
5
+ export type ControlledEventsPassed<TagName extends HTMLElement> = Omit<ControlledEvents<TagName>, 'onClick'> & Pick<CommonButtonProps<TagName>, 'onClick'>;
6
+ export type UseButtonBaseArgs<TagName extends HTMLElement> = {
7
+ ref: React.Ref<TagName>;
8
+ /**
9
+ * The type of button. Used to pass action subject context to analytics.
10
+ */
11
+ buttonType: 'button' | 'link';
12
+ isIconButton?: boolean;
13
+ hasIconBefore?: boolean;
14
+ hasIconAfter?: boolean;
15
+ shouldFitContainer?: boolean;
16
+ } & Pick<CommonButtonProps<TagName>, 'analyticsContext' | 'appearance' | 'autoFocus' | 'children' | 'interactionName' | 'isDisabled' | 'isSelected' | 'overlay' | 'spacing'> & ControlledEventsPassed<TagName>;
17
+ export type UseButtonBaseReturn<TagName extends HTMLElement> = {
18
+ xcss: ReturnType<typeof xcss>;
19
+ ref(node: TagName | null): void;
20
+ children: React.ReactNode;
21
+ isDisabled: boolean;
22
+ } & ControlledEvents<TagName>;
23
+ /**
24
+ * __Use button base__
25
+ *
26
+ * A React hook that accepts a set of common Button props,
27
+ * and processes them to return consistent base props for usage
28
+ * across various Button components.
29
+ *
30
+ * It also:
31
+ * - Implements auto focus when enabled.
32
+ * - Appends the `onClick` event with UFO analytics tracking.
33
+ *
34
+ * @private
35
+ */
36
+ declare const useButtonBase: <TagName extends HTMLElement>({ analyticsContext, appearance: propAppearance, autoFocus, buttonType, interactionName, isDisabled: propIsDisabled, isSelected, isIconButton, hasIconBefore, hasIconAfter, children, onClick: providedOnClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing: propSpacing, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
37
+ export default useButtonBase;