@atlaskit/button 17.9.0 → 17.11.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 (48) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/new-button/variants/default/use-default-button.js +1 -0
  3. package/dist/cjs/new-button/variants/icon/button.js +105 -15
  4. package/dist/cjs/new-button/variants/icon/link.js +111 -14
  5. package/dist/cjs/new-button/variants/icon/use-icon-button.js +1 -0
  6. package/dist/cjs/new-button/variants/shared/loading-overlay.js +1 -4
  7. package/dist/cjs/new-button/variants/shared/use-button-base.js +4 -1
  8. package/dist/cjs/new-button/variants/shared/xcss.js +9 -3
  9. package/dist/cjs/old-button/shared/button-base.js +1 -1
  10. package/dist/es2019/new-button/variants/default/use-default-button.js +1 -0
  11. package/dist/es2019/new-button/variants/icon/button.js +101 -14
  12. package/dist/es2019/new-button/variants/icon/link.js +107 -13
  13. package/dist/es2019/new-button/variants/icon/use-icon-button.js +1 -0
  14. package/dist/es2019/new-button/variants/shared/loading-overlay.js +1 -4
  15. package/dist/es2019/new-button/variants/shared/use-button-base.js +3 -1
  16. package/dist/es2019/new-button/variants/shared/xcss.js +8 -2
  17. package/dist/es2019/old-button/shared/button-base.js +1 -1
  18. package/dist/esm/new-button/variants/default/use-default-button.js +1 -0
  19. package/dist/esm/new-button/variants/icon/button.js +105 -15
  20. package/dist/esm/new-button/variants/icon/link.js +111 -14
  21. package/dist/esm/new-button/variants/icon/use-icon-button.js +1 -0
  22. package/dist/esm/new-button/variants/shared/loading-overlay.js +1 -4
  23. package/dist/esm/new-button/variants/shared/use-button-base.js +4 -1
  24. package/dist/esm/new-button/variants/shared/xcss.js +9 -3
  25. package/dist/esm/old-button/shared/button-base.js +1 -1
  26. package/dist/types/containers/button-group.d.ts +4 -4
  27. package/dist/types/new-button/variants/default/types.d.ts +0 -4
  28. package/dist/types/new-button/variants/icon/link.d.ts +1 -1
  29. package/dist/types/new-button/variants/icon/types.d.ts +16 -6
  30. package/dist/types/new-button/variants/icon/use-icon-button.d.ts +1 -1
  31. package/dist/types/new-button/variants/shared/use-button-base.d.ts +2 -1
  32. package/dist/types/new-button/variants/shared/xcss.d.ts +2 -1
  33. package/dist/types/new-button/variants/types.d.ts +4 -0
  34. package/dist/types/old-button/types.d.ts +20 -20
  35. package/dist/types/utils/variants.d.ts +2 -2
  36. package/dist/types-ts4.5/containers/button-group.d.ts +4 -4
  37. package/dist/types-ts4.5/new-button/variants/default/types.d.ts +0 -4
  38. package/dist/types-ts4.5/new-button/variants/icon/link.d.ts +1 -1
  39. package/dist/types-ts4.5/new-button/variants/icon/types.d.ts +16 -6
  40. package/dist/types-ts4.5/new-button/variants/icon/use-icon-button.d.ts +1 -1
  41. package/dist/types-ts4.5/new-button/variants/shared/use-button-base.d.ts +2 -1
  42. package/dist/types-ts4.5/new-button/variants/shared/xcss.d.ts +2 -1
  43. package/dist/types-ts4.5/new-button/variants/types.d.ts +4 -0
  44. package/dist/types-ts4.5/old-button/types.d.ts +20 -20
  45. package/dist/types-ts4.5/utils/variants.d.ts +2 -2
  46. package/extract-react-types/new-button/variants/default/{common-props.tsx → common-default-button-props.tsx} +1 -1
  47. package/extract-react-types/new-button/variants/icon-button/icon-button-props.tsx +5 -0
  48. package/package.json +2 -1
@@ -4,11 +4,11 @@ import { jsx } from '@emotion/react';
4
4
  import { Appearance } from '../old-button/types';
5
5
  export type ButtonGroupProps = {
6
6
  /**
7
- * The appearance to apply to all buttons
7
+ * The appearance to apply to all buttons.
8
8
  */
9
9
  appearance?: Appearance;
10
10
  /**
11
- * The buttons to render inside the Button Group
11
+ * The buttons to render inside the button group.
12
12
  */
13
13
  children?: React.ReactNode;
14
14
  /**
@@ -16,12 +16,12 @@ export type ButtonGroupProps = {
16
16
  */
17
17
  testId?: string;
18
18
  /**
19
- * Refers to an aria-label attribute. Sets an accessible name for ButtonGroup wrapper to announce it to users of assistive technology.
19
+ * Refers to an `aria-label` attribute. Sets an accessible name for the button group wrapper to announce it to users of assistive technology.
20
20
  * Usage of either this, or the `titleId` attribute is strongly recommended.
21
21
  */
22
22
  label?: string;
23
23
  /**
24
- * Id referenced by the ButtonGroup wrapper's aria-labelledby attribute. This id should be assigned to the group-button title element.
24
+ * ID referenced by the button group wrapper's `aria-labelledby` attribute. This ID should be assigned to the group-button title element.
25
25
  * Usage of either this, or the `label` attribute is strongly recommended.
26
26
  */
27
27
  titleId?: string;
@@ -1,10 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { type ButtonSpacing, type IconProp, type IconSize } from '../types';
3
3
  export type CommonDefaultButtonProps = {
4
- /**
5
- * Conditionally show a spinner over the top of a button
6
- */
7
- isLoading?: boolean;
8
4
  /**
9
5
  * Text content to be rendered in the button. Required so that screen readers always have an accessible label provided for the button.
10
6
  */
@@ -2,7 +2,7 @@ import { type Ref } from 'react';
2
2
  import { type CommonLinkVariantProps } from '../types';
3
3
  import { type CommonIconButtonProps } from './types';
4
4
  export type LinkIconButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonIconButtonProps & CommonLinkVariantProps<RouterLinkConfig>;
5
- declare const LinkIconButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, interactionName, autoFocus, appearance, spacing, isDisabled, isSelected, icon, label, overlay, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, shape, testId, UNSAFE_size, href, "aria-label": preventedAriaLabel, ...rest }: LinkIconButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
5
+ declare const LinkIconButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ "aria-label": preventedAriaLabel, analyticsContext, appearance, autoFocus, href, icon, interactionName, isDisabled, isSelected, isTooltipDisabled, label, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, shape, spacing, testId, tooltip, UNSAFE_size, ...rest }: LinkIconButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
6
6
  /**
7
7
  * __Link Icon Button__
8
8
  *
@@ -1,9 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { TooltipProps } from '@atlaskit/tooltip';
1
3
  import { type IconButtonAppearance, type IconButtonSpacing, type IconProp, type IconSize } from '../types';
2
4
  export type CommonIconButtonProps = {
3
- /**
4
- * Conditionally show a spinner over the top of a button
5
- */
6
- isLoading?: boolean;
5
+ 'aria-label'?: never;
7
6
  /**
8
7
  * The button style variation.
9
8
  */
@@ -12,11 +11,18 @@ export type CommonIconButtonProps = {
12
11
  * Places an icon within the button.
13
12
  */
14
13
  icon: IconProp;
14
+ /**
15
+ * Conditionally show a spinner over the top of a button.
16
+ */
17
+ isLoading?: boolean;
18
+ /**
19
+ * Prevent a tooltip from showing. Use sparingly.
20
+ */
21
+ isTooltipDisabled?: boolean;
15
22
  /**
16
23
  * Provide an accessible label, often used by screen readers.
17
24
  */
18
- label: string;
19
- 'aria-label'?: never;
25
+ label: React.ReactNode;
20
26
  /**
21
27
  * Set the shape of the icon, defaults to square with rounded corners.
22
28
  */
@@ -25,6 +31,10 @@ export type CommonIconButtonProps = {
25
31
  * Controls the amount of padding in the button.
26
32
  */
27
33
  spacing?: IconButtonSpacing;
34
+ /**
35
+ * Props passed down to the Tooltip component.
36
+ */
37
+ tooltip?: Partial<Omit<TooltipProps, 'children'>>;
28
38
  /**
29
39
  * Set the size of the icon. `medium` is default, so it does not need to be specified.
30
40
  * This is UNSAFE as it will be removed in future in favor of a 100% bounded API.
@@ -1,6 +1,6 @@
1
1
  import { type UseButtonBaseArgs, type UseButtonBaseReturn } from '../shared/use-button-base';
2
2
  import { type CommonIconButtonProps } from './types';
3
- type UseIconButtonArgs<TagName extends HTMLElement> = Omit<UseButtonBaseArgs<TagName>, 'children'> & CommonIconButtonProps;
3
+ type UseIconButtonArgs<TagName extends HTMLElement> = Omit<UseButtonBaseArgs<TagName>, 'children'> & Omit<CommonIconButtonProps, 'isTooltipDisabled' | 'tooltip'>;
4
4
  type UseIconButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagName>;
5
5
  /**
6
6
  * __Use icon button__
@@ -16,6 +16,7 @@ export type UseButtonBaseArgs<TagName extends HTMLElement> = {
16
16
  appearance?: Appearance;
17
17
  children: React.ReactNode;
18
18
  spacing?: Spacing;
19
+ isLoading?: boolean;
19
20
  } & Pick<CommonButtonProps<TagName>, 'analyticsContext' | 'autoFocus' | 'interactionName' | 'isDisabled' | 'isSelected' | 'overlay'> & ControlledEvents<TagName>;
20
21
  export type UseButtonBaseReturn<TagName extends HTMLElement> = {
21
22
  xcss: ReturnType<typeof xcss>;
@@ -36,5 +37,5 @@ export type UseButtonBaseReturn<TagName extends HTMLElement> = {
36
37
  *
37
38
  * @private
38
39
  */
39
- declare const useButtonBase: <TagName extends HTMLElement>({ appearance: propAppearance, autoFocus, buttonType, isDisabled: propIsDisabled, isSelected, isIconButton, isCircle, hasIconBefore, hasIconAfter, children, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing: propSpacing, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
40
+ declare const useButtonBase: <TagName extends HTMLElement>({ appearance: propAppearance, autoFocus, buttonType, isDisabled: propIsDisabled, isLoading, isSelected, isIconButton, isCircle, hasIconBefore, hasIconAfter, children, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing: propSpacing, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
40
41
  export default useButtonBase;
@@ -7,6 +7,7 @@ export type GetXCSSArgs = {
7
7
  appearance: Appearance;
8
8
  spacing: Spacing;
9
9
  isDisabled: boolean;
10
+ isLoading: boolean;
10
11
  isSelected: boolean;
11
12
  isHighlighted: boolean;
12
13
  isActiveOverSelected: boolean;
@@ -29,4 +30,4 @@ export type GetXCSSArgs = {
29
30
  */
30
31
  isNavigationSplit: boolean;
31
32
  };
32
- export declare function getXCSS({ appearance, spacing, isDisabled, isSelected, isHighlighted, isActiveOverSelected, isIconButton, isCircle, shouldFitContainer, isLink, isSplit, isNavigationSplit, hasOverlay, hasIconBefore, hasIconAfter, }: GetXCSSArgs): ReturnType<typeof xcss>;
33
+ export declare function getXCSS({ appearance, spacing, isDisabled, isSelected, isLoading, isHighlighted, isActiveOverSelected, isIconButton, isCircle, shouldFitContainer, isLink, isSplit, isNavigationSplit, hasOverlay, hasIconBefore, hasIconAfter, }: GetXCSSArgs): ReturnType<typeof xcss>;
@@ -67,6 +67,10 @@ export type AdditionalButtonVariantProps = {
67
67
  * The button style variation.
68
68
  */
69
69
  appearance?: ButtonAppearance;
70
+ /**
71
+ * Conditionally show a spinner over the top of a button
72
+ */
73
+ isLoading?: boolean;
70
74
  };
71
75
  /**
72
76
  * Combines common button props with additional HTML attributes
@@ -5,85 +5,85 @@ export type Spacing = 'compact' | 'default' | 'none';
5
5
  type Combine<First, Second> = Omit<First, keyof Second> & Second;
6
6
  export type BaseOwnProps = {
7
7
  /**
8
- * The base styling to apply to the button
8
+ * The base styling to apply to the button.
9
9
  */
10
10
  appearance?: Appearance;
11
11
  /**
12
- * Set the button to autofocus on mount
12
+ * Set the button to autofocus on mount.
13
13
  */
14
14
  autoFocus?: boolean;
15
15
  /**
16
- * Add a classname to the button
16
+ * Add a classname to the button.
17
17
  */
18
18
  className?: string;
19
19
  /**
20
- * Used to 'overlay' something over a button. This is commonly used to display a loading spinner
20
+ * Used to 'overlay' something over a button. This is commonly used to display a loading spinner.
21
21
  */
22
22
  overlay?: React.ReactNode;
23
23
  /**
24
- * Provides a url for buttons being used as a link
24
+ * Provides a URL that's used when the button is a link styled as a button.
25
25
  */
26
26
  href?: string;
27
27
  /**
28
- * Places an icon within the button, after the button's text
28
+ * Places an icon within the button, after the button's text.
29
29
  */
30
30
  iconAfter?: React.ReactChild;
31
31
  /**
32
- * Places an icon within the button, before the button's text
32
+ * Places an icon within the button, before the button's text.
33
33
  */
34
34
  iconBefore?: React.ReactChild;
35
35
  /**
36
- * Set if the button is disabled
36
+ * Set if the button is disabled.
37
37
  */
38
38
  isDisabled?: boolean;
39
39
  /**
40
- * Change the style to indicate the button is selected
40
+ * Change the style to indicate the button is selected.
41
41
  */
42
42
  isSelected?: boolean;
43
43
  /**
44
- * Handler to be called on blur
44
+ * Handler to be called on blur.
45
45
  */
46
46
  onBlur?: React.FocusEventHandler<HTMLElement>;
47
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
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
49
  */
50
50
  onClick?: (e: React.MouseEvent<HTMLElement>, analyticsEvent: UIAnalyticsEvent) => void;
51
51
  /**
52
- * Handler to be called on focus
52
+ * Handler to be called on focus.
53
53
  */
54
54
  onFocus?: React.FocusEventHandler<HTMLElement>;
55
55
  /**
56
- * Set the amount of padding in the button
56
+ * Set the amount of padding in the button.
57
57
  */
58
58
  spacing?: Spacing;
59
59
  /**
60
- * Pass target down to a link within the button component, if a href is provided
60
+ * Pass target down to the button. If a href is provided, this will be a semantic link styled as a button.
61
61
  */
62
62
  target?: React.AnchorHTMLAttributes<HTMLAnchorElement>['target'];
63
63
  /**
64
- * Pass type down to a button
64
+ * Pass type down to the button.
65
65
  */
66
66
  type?: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
67
67
  /**
68
- * Option to fit button width to its parent width
68
+ * Option to fit button width to its parent width.
69
69
  */
70
70
  shouldFitContainer?: boolean;
71
71
  /**
72
- * Text content to be rendered in the button
72
+ * Text content to be rendered in the button.
73
73
  */
74
74
  children?: React.ReactNode;
75
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
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
77
  */
78
78
  testId?: string;
79
79
  component?: React.ComponentType<React.AllHTMLAttributes<HTMLElement>> | React.ElementType;
80
80
  /**
81
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)
82
+ * see [UFO integration into Design System components](https://go.atlassian.com/react-ufo-dst-integration).
83
83
  */
84
84
  interactionName?: string;
85
85
  /**
86
- * Additional information to be included in the `context` of analytics events that come from button
86
+ * Additional information to be included in the `context` of analytics events that come from button.
87
87
  */
88
88
  analyticsContext?: Record<string, any>;
89
89
  };
@@ -42,12 +42,12 @@ declare const LinkButtonRender: React.ForwardRefExoticComponent<Omit<LinkButtonP
42
42
  } & React.RefAttributes<HTMLAnchorElement>>;
43
43
  declare const IconButtonRender: React.ForwardRefExoticComponent<Omit<IconButtonProps, "label" | "icon"> & {
44
44
  icon?: import("../new-button/variants/types").IconProp | undefined;
45
- label?: string | undefined;
45
+ label?: IconButtonProps['label'];
46
46
  } & React.RefAttributes<HTMLButtonElement>>;
47
47
  declare const LinkIconButtonRender: React.ForwardRefExoticComponent<Omit<LinkIconButtonProps, "label" | "href" | "icon"> & {
48
48
  href?: string | undefined;
49
49
  icon?: import("../new-button/variants/types").IconProp | undefined;
50
- label?: string | undefined;
50
+ label?: LinkIconButtonProps['label'];
51
51
  } & React.RefAttributes<HTMLAnchorElement>>;
52
52
  declare const variants: Variant[];
53
53
  export declare const defaultButtonVariants: DefaultButtonVariants[];
@@ -4,11 +4,11 @@ import { jsx } from '@emotion/react';
4
4
  import { Appearance } from '../old-button/types';
5
5
  export type ButtonGroupProps = {
6
6
  /**
7
- * The appearance to apply to all buttons
7
+ * The appearance to apply to all buttons.
8
8
  */
9
9
  appearance?: Appearance;
10
10
  /**
11
- * The buttons to render inside the Button Group
11
+ * The buttons to render inside the button group.
12
12
  */
13
13
  children?: React.ReactNode;
14
14
  /**
@@ -16,12 +16,12 @@ export type ButtonGroupProps = {
16
16
  */
17
17
  testId?: string;
18
18
  /**
19
- * Refers to an aria-label attribute. Sets an accessible name for ButtonGroup wrapper to announce it to users of assistive technology.
19
+ * Refers to an `aria-label` attribute. Sets an accessible name for the button group wrapper to announce it to users of assistive technology.
20
20
  * Usage of either this, or the `titleId` attribute is strongly recommended.
21
21
  */
22
22
  label?: string;
23
23
  /**
24
- * Id referenced by the ButtonGroup wrapper's aria-labelledby attribute. This id should be assigned to the group-button title element.
24
+ * ID referenced by the button group wrapper's `aria-labelledby` attribute. This ID should be assigned to the group-button title element.
25
25
  * Usage of either this, or the `label` attribute is strongly recommended.
26
26
  */
27
27
  titleId?: string;
@@ -1,10 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { type ButtonSpacing, type IconProp, type IconSize } from '../types';
3
3
  export type CommonDefaultButtonProps = {
4
- /**
5
- * Conditionally show a spinner over the top of a button
6
- */
7
- isLoading?: boolean;
8
4
  /**
9
5
  * Text content to be rendered in the button. Required so that screen readers always have an accessible label provided for the button.
10
6
  */
@@ -2,7 +2,7 @@ import { type Ref } from 'react';
2
2
  import { type CommonLinkVariantProps } from '../types';
3
3
  import { type CommonIconButtonProps } from './types';
4
4
  export type LinkIconButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonIconButtonProps & CommonLinkVariantProps<RouterLinkConfig>;
5
- declare const LinkIconButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, interactionName, autoFocus, appearance, spacing, isDisabled, isSelected, icon, label, overlay, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, shape, testId, UNSAFE_size, href, "aria-label": preventedAriaLabel, ...rest }: LinkIconButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
5
+ declare const LinkIconButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ "aria-label": preventedAriaLabel, analyticsContext, appearance, autoFocus, href, icon, interactionName, isDisabled, isSelected, isTooltipDisabled, label, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, shape, spacing, testId, tooltip, UNSAFE_size, ...rest }: LinkIconButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
6
6
  /**
7
7
  * __Link Icon Button__
8
8
  *
@@ -1,9 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { TooltipProps } from '@atlaskit/tooltip';
1
3
  import { type IconButtonAppearance, type IconButtonSpacing, type IconProp, type IconSize } from '../types';
2
4
  export type CommonIconButtonProps = {
3
- /**
4
- * Conditionally show a spinner over the top of a button
5
- */
6
- isLoading?: boolean;
5
+ 'aria-label'?: never;
7
6
  /**
8
7
  * The button style variation.
9
8
  */
@@ -12,11 +11,18 @@ export type CommonIconButtonProps = {
12
11
  * Places an icon within the button.
13
12
  */
14
13
  icon: IconProp;
14
+ /**
15
+ * Conditionally show a spinner over the top of a button.
16
+ */
17
+ isLoading?: boolean;
18
+ /**
19
+ * Prevent a tooltip from showing. Use sparingly.
20
+ */
21
+ isTooltipDisabled?: boolean;
15
22
  /**
16
23
  * Provide an accessible label, often used by screen readers.
17
24
  */
18
- label: string;
19
- 'aria-label'?: never;
25
+ label: React.ReactNode;
20
26
  /**
21
27
  * Set the shape of the icon, defaults to square with rounded corners.
22
28
  */
@@ -25,6 +31,10 @@ export type CommonIconButtonProps = {
25
31
  * Controls the amount of padding in the button.
26
32
  */
27
33
  spacing?: IconButtonSpacing;
34
+ /**
35
+ * Props passed down to the Tooltip component.
36
+ */
37
+ tooltip?: Partial<Omit<TooltipProps, 'children'>>;
28
38
  /**
29
39
  * Set the size of the icon. `medium` is default, so it does not need to be specified.
30
40
  * This is UNSAFE as it will be removed in future in favor of a 100% bounded API.
@@ -1,6 +1,6 @@
1
1
  import { type UseButtonBaseArgs, type UseButtonBaseReturn } from '../shared/use-button-base';
2
2
  import { type CommonIconButtonProps } from './types';
3
- type UseIconButtonArgs<TagName extends HTMLElement> = Omit<UseButtonBaseArgs<TagName>, 'children'> & CommonIconButtonProps;
3
+ type UseIconButtonArgs<TagName extends HTMLElement> = Omit<UseButtonBaseArgs<TagName>, 'children'> & Omit<CommonIconButtonProps, 'isTooltipDisabled' | 'tooltip'>;
4
4
  type UseIconButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagName>;
5
5
  /**
6
6
  * __Use icon button__
@@ -16,6 +16,7 @@ export type UseButtonBaseArgs<TagName extends HTMLElement> = {
16
16
  appearance?: Appearance;
17
17
  children: React.ReactNode;
18
18
  spacing?: Spacing;
19
+ isLoading?: boolean;
19
20
  } & Pick<CommonButtonProps<TagName>, 'analyticsContext' | 'autoFocus' | 'interactionName' | 'isDisabled' | 'isSelected' | 'overlay'> & ControlledEvents<TagName>;
20
21
  export type UseButtonBaseReturn<TagName extends HTMLElement> = {
21
22
  xcss: ReturnType<typeof xcss>;
@@ -36,5 +37,5 @@ export type UseButtonBaseReturn<TagName extends HTMLElement> = {
36
37
  *
37
38
  * @private
38
39
  */
39
- declare const useButtonBase: <TagName extends HTMLElement>({ appearance: propAppearance, autoFocus, buttonType, isDisabled: propIsDisabled, isSelected, isIconButton, isCircle, hasIconBefore, hasIconAfter, children, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing: propSpacing, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
40
+ declare const useButtonBase: <TagName extends HTMLElement>({ appearance: propAppearance, autoFocus, buttonType, isDisabled: propIsDisabled, isLoading, isSelected, isIconButton, isCircle, hasIconBefore, hasIconAfter, children, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing: propSpacing, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
40
41
  export default useButtonBase;
@@ -7,6 +7,7 @@ export type GetXCSSArgs = {
7
7
  appearance: Appearance;
8
8
  spacing: Spacing;
9
9
  isDisabled: boolean;
10
+ isLoading: boolean;
10
11
  isSelected: boolean;
11
12
  isHighlighted: boolean;
12
13
  isActiveOverSelected: boolean;
@@ -29,4 +30,4 @@ export type GetXCSSArgs = {
29
30
  */
30
31
  isNavigationSplit: boolean;
31
32
  };
32
- export declare function getXCSS({ appearance, spacing, isDisabled, isSelected, isHighlighted, isActiveOverSelected, isIconButton, isCircle, shouldFitContainer, isLink, isSplit, isNavigationSplit, hasOverlay, hasIconBefore, hasIconAfter, }: GetXCSSArgs): ReturnType<typeof xcss>;
33
+ export declare function getXCSS({ appearance, spacing, isDisabled, isSelected, isLoading, isHighlighted, isActiveOverSelected, isIconButton, isCircle, shouldFitContainer, isLink, isSplit, isNavigationSplit, hasOverlay, hasIconBefore, hasIconAfter, }: GetXCSSArgs): ReturnType<typeof xcss>;
@@ -67,6 +67,10 @@ export type AdditionalButtonVariantProps = {
67
67
  * The button style variation.
68
68
  */
69
69
  appearance?: ButtonAppearance;
70
+ /**
71
+ * Conditionally show a spinner over the top of a button
72
+ */
73
+ isLoading?: boolean;
70
74
  };
71
75
  /**
72
76
  * Combines common button props with additional HTML attributes
@@ -5,85 +5,85 @@ export type Spacing = 'compact' | 'default' | 'none';
5
5
  type Combine<First, Second> = Omit<First, keyof Second> & Second;
6
6
  export type BaseOwnProps = {
7
7
  /**
8
- * The base styling to apply to the button
8
+ * The base styling to apply to the button.
9
9
  */
10
10
  appearance?: Appearance;
11
11
  /**
12
- * Set the button to autofocus on mount
12
+ * Set the button to autofocus on mount.
13
13
  */
14
14
  autoFocus?: boolean;
15
15
  /**
16
- * Add a classname to the button
16
+ * Add a classname to the button.
17
17
  */
18
18
  className?: string;
19
19
  /**
20
- * Used to 'overlay' something over a button. This is commonly used to display a loading spinner
20
+ * Used to 'overlay' something over a button. This is commonly used to display a loading spinner.
21
21
  */
22
22
  overlay?: React.ReactNode;
23
23
  /**
24
- * Provides a url for buttons being used as a link
24
+ * Provides a URL that's used when the button is a link styled as a button.
25
25
  */
26
26
  href?: string;
27
27
  /**
28
- * Places an icon within the button, after the button's text
28
+ * Places an icon within the button, after the button's text.
29
29
  */
30
30
  iconAfter?: React.ReactChild;
31
31
  /**
32
- * Places an icon within the button, before the button's text
32
+ * Places an icon within the button, before the button's text.
33
33
  */
34
34
  iconBefore?: React.ReactChild;
35
35
  /**
36
- * Set if the button is disabled
36
+ * Set if the button is disabled.
37
37
  */
38
38
  isDisabled?: boolean;
39
39
  /**
40
- * Change the style to indicate the button is selected
40
+ * Change the style to indicate the button is selected.
41
41
  */
42
42
  isSelected?: boolean;
43
43
  /**
44
- * Handler to be called on blur
44
+ * Handler to be called on blur.
45
45
  */
46
46
  onBlur?: React.FocusEventHandler<HTMLElement>;
47
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
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
49
  */
50
50
  onClick?: (e: React.MouseEvent<HTMLElement>, analyticsEvent: UIAnalyticsEvent) => void;
51
51
  /**
52
- * Handler to be called on focus
52
+ * Handler to be called on focus.
53
53
  */
54
54
  onFocus?: React.FocusEventHandler<HTMLElement>;
55
55
  /**
56
- * Set the amount of padding in the button
56
+ * Set the amount of padding in the button.
57
57
  */
58
58
  spacing?: Spacing;
59
59
  /**
60
- * Pass target down to a link within the button component, if a href is provided
60
+ * Pass target down to the button. If a href is provided, this will be a semantic link styled as a button.
61
61
  */
62
62
  target?: React.AnchorHTMLAttributes<HTMLAnchorElement>['target'];
63
63
  /**
64
- * Pass type down to a button
64
+ * Pass type down to the button.
65
65
  */
66
66
  type?: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
67
67
  /**
68
- * Option to fit button width to its parent width
68
+ * Option to fit button width to its parent width.
69
69
  */
70
70
  shouldFitContainer?: boolean;
71
71
  /**
72
- * Text content to be rendered in the button
72
+ * Text content to be rendered in the button.
73
73
  */
74
74
  children?: React.ReactNode;
75
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
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
77
  */
78
78
  testId?: string;
79
79
  component?: React.ComponentType<React.AllHTMLAttributes<HTMLElement>> | React.ElementType;
80
80
  /**
81
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)
82
+ * see [UFO integration into Design System components](https://go.atlassian.com/react-ufo-dst-integration).
83
83
  */
84
84
  interactionName?: string;
85
85
  /**
86
- * Additional information to be included in the `context` of analytics events that come from button
86
+ * Additional information to be included in the `context` of analytics events that come from button.
87
87
  */
88
88
  analyticsContext?: Record<string, any>;
89
89
  };
@@ -42,12 +42,12 @@ declare const LinkButtonRender: React.ForwardRefExoticComponent<Omit<LinkButtonP
42
42
  } & React.RefAttributes<HTMLAnchorElement>>;
43
43
  declare const IconButtonRender: React.ForwardRefExoticComponent<Omit<IconButtonProps, "label" | "icon"> & {
44
44
  icon?: import("../new-button/variants/types").IconProp | undefined;
45
- label?: string | undefined;
45
+ label?: IconButtonProps['label'];
46
46
  } & React.RefAttributes<HTMLButtonElement>>;
47
47
  declare const LinkIconButtonRender: React.ForwardRefExoticComponent<Omit<LinkIconButtonProps, "label" | "href" | "icon"> & {
48
48
  href?: string | undefined;
49
49
  icon?: import("../new-button/variants/types").IconProp | undefined;
50
- label?: string | undefined;
50
+ label?: LinkIconButtonProps['label'];
51
51
  } & React.RefAttributes<HTMLAnchorElement>>;
52
52
  declare const variants: Variant[];
53
53
  export declare const defaultButtonVariants: DefaultButtonVariants[];
@@ -4,7 +4,7 @@ import {
4
4
  type SupportedElements,
5
5
  } from '../../../../src/new-button/variants/types';
6
6
 
7
- export default function CommonProps(
7
+ export default function CommonDefaultButtonProps(
8
8
  props: CommonButtonProps<SupportedElements> & CommonDefaultButtonProps,
9
9
  ) {
10
10
  return null;
@@ -0,0 +1,5 @@
1
+ import { AdditionalButtonVariantProps } from '../../../../src/new-button/variants/types';
2
+
3
+ export default function IconButtonProps(props: AdditionalButtonVariantProps) {
4
+ return null;
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/button",
3
- "version": "17.9.0",
3
+ "version": "17.11.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/"
@@ -91,6 +91,7 @@
91
91
  "@atlaskit/spinner": "^16.0.0",
92
92
  "@atlaskit/theme": "^12.7.0",
93
93
  "@atlaskit/tokens": "^1.43.0",
94
+ "@atlaskit/tooltip": "^18.1.3",
94
95
  "@atlaskit/visually-hidden": "^1.2.4",
95
96
  "@babel/runtime": "^7.0.0",
96
97
  "@emotion/react": "^11.7.1"