@atlaskit/button 17.22.2 → 18.0.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 (43) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/cjs/new-button/variants/default/button.js +11 -4
  3. package/dist/cjs/new-button/variants/default/link.js +13 -6
  4. package/dist/cjs/new-button/variants/default/use-default-button.js +4 -13
  5. package/dist/cjs/new-button/variants/icon/button.js +14 -7
  6. package/dist/cjs/new-button/variants/icon/link.js +11 -4
  7. package/dist/cjs/new-button/variants/icon/use-icon-button.js +5 -13
  8. package/dist/cjs/new-button/variants/shared/content.js +2 -2
  9. package/dist/cjs/new-button/variants/shared/use-button-base.js +19 -15
  10. package/dist/cjs/old-button/shared/button-base.js +1 -1
  11. package/dist/es2019/new-button/variants/default/button.js +11 -3
  12. package/dist/es2019/new-button/variants/default/link.js +13 -5
  13. package/dist/es2019/new-button/variants/default/use-default-button.js +4 -13
  14. package/dist/es2019/new-button/variants/icon/button.js +14 -6
  15. package/dist/es2019/new-button/variants/icon/link.js +11 -3
  16. package/dist/es2019/new-button/variants/icon/use-icon-button.js +4 -13
  17. package/dist/es2019/new-button/variants/shared/content.js +2 -2
  18. package/dist/es2019/new-button/variants/shared/use-button-base.js +19 -15
  19. package/dist/es2019/old-button/shared/button-base.js +1 -1
  20. package/dist/esm/new-button/variants/default/button.js +11 -4
  21. package/dist/esm/new-button/variants/default/link.js +13 -6
  22. package/dist/esm/new-button/variants/default/use-default-button.js +4 -13
  23. package/dist/esm/new-button/variants/icon/button.js +14 -7
  24. package/dist/esm/new-button/variants/icon/link.js +11 -4
  25. package/dist/esm/new-button/variants/icon/use-icon-button.js +5 -13
  26. package/dist/esm/new-button/variants/shared/content.js +2 -2
  27. package/dist/esm/new-button/variants/shared/use-button-base.js +19 -15
  28. package/dist/esm/old-button/shared/button-base.js +1 -1
  29. package/dist/types/new-button/variants/default/link.d.ts +1 -1
  30. package/dist/types/new-button/variants/default/use-default-button.d.ts +1 -1
  31. package/dist/types/new-button/variants/icon/link.d.ts +1 -1
  32. package/dist/types/new-button/variants/icon/use-icon-button.d.ts +1 -1
  33. package/dist/types/new-button/variants/shared/content.d.ts +2 -2
  34. package/dist/types/new-button/variants/shared/use-button-base.d.ts +2 -2
  35. package/dist/types/new-button/variants/types.d.ts +0 -6
  36. package/dist/types-ts4.5/new-button/variants/default/link.d.ts +1 -1
  37. package/dist/types-ts4.5/new-button/variants/default/use-default-button.d.ts +1 -1
  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/use-icon-button.d.ts +1 -1
  40. package/dist/types-ts4.5/new-button/variants/shared/content.d.ts +2 -2
  41. package/dist/types-ts4.5/new-button/variants/shared/use-button-base.d.ts +2 -2
  42. package/dist/types-ts4.5/new-button/variants/types.d.ts +0 -6
  43. package/package.json +5 -2
@@ -12,6 +12,7 @@ import VisuallyHidden from '@atlaskit/visually-hidden';
12
12
  import { useSplitButtonContext } from '../../containers/split-button/split-button-context';
13
13
  import blockEvents from './block-events';
14
14
  import { LOADING_LABEL } from './constants';
15
+ import renderLoadingOverlay from './loading-overlay';
15
16
  var buttonStyles = xcss({
16
17
  display: 'inline-flex',
17
18
  boxSizing: 'border-box',
@@ -284,6 +285,7 @@ var linkDecorationStyles = xcss({
284
285
  }
285
286
  });
286
287
  var disabledStyles = xcss({
288
+ cursor: 'not-allowed',
287
289
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
288
290
  background: "var(--ds-background-disabled, ".concat(colors.N20A, ")"),
289
291
  // @ts-expect-error
@@ -439,12 +441,9 @@ var circleStyles = xcss({
439
441
  var fullWidthStyles = xcss({
440
442
  width: '100%'
441
443
  });
442
- var loadingOverlayStyles = xcss({
444
+ var loadingStyles = xcss({
443
445
  cursor: 'progress'
444
446
  });
445
- var nonInteractiveStyles = xcss({
446
- cursor: 'not-allowed'
447
- });
448
447
  var iconButtonStyles = xcss({
449
448
  height: "".concat(32 / 14, "em"),
450
449
  width: "".concat(32 / 14, "em"),
@@ -472,7 +471,7 @@ var navigationSplitButtonStyles = xcss({
472
471
  paddingInlineEnd: 'space.075',
473
472
  paddingInlineStart: 'space.075'
474
473
  });
475
- var overlayStyles = xcss({
474
+ var loadingOverlayStyles = xcss({
476
475
  display: 'flex',
477
476
  position: 'absolute',
478
477
  alignItems: 'center',
@@ -526,12 +525,12 @@ var useButtonBase = function useButtonBase(_ref) {
526
525
  onPointerDownCapture = _ref.onPointerDownCapture,
527
526
  onPointerUpCapture = _ref.onPointerUpCapture,
528
527
  onClickCapture = _ref.onClickCapture,
529
- overlay = _ref.overlay,
530
528
  ref = _ref.ref,
531
529
  _ref$shouldFitContain = _ref.shouldFitContainer,
532
530
  shouldFitContainer = _ref$shouldFitContain === void 0 ? false : _ref$shouldFitContain,
533
531
  _ref$spacing = _ref.spacing,
534
532
  propSpacing = _ref$spacing === void 0 ? 'default' : _ref$spacing,
533
+ testId = _ref.testId,
535
534
  ariaLabel = _ref.ariaLabel,
536
535
  ariaLabelledBy = _ref.ariaLabelledBy;
537
536
  var localRef = useRef(null);
@@ -547,9 +546,9 @@ var useButtonBase = function useButtonBase(_ref) {
547
546
  var appearance = getBooleanFF('platform.design-system-team.component-visual-refresh_t8zbo') && isDefaultAppearanceSplitButton ? 'subtle' : (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.appearance) || propAppearance;
548
547
  var spacing = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.spacing) || propSpacing;
549
548
  var isDisabled = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isDisabled) || propIsDisabled;
550
- var hasOverlay = Boolean(overlay);
551
- var isInteractive = !isDisabled && !isLoading && !hasOverlay;
552
- var isEffectivelyDisabled = isDisabled || Boolean(overlay);
549
+ var isInteractive = !isDisabled && !isLoading;
550
+ // Also treat loading buttons as disabled
551
+ var isEffectivelyDisabled = isDisabled || isLoading;
553
552
  var isSelected = propIsSelected && !isDisabled;
554
553
  useAutoFocus(localRef, autoFocus);
555
554
  return _objectSpread({
@@ -560,15 +559,20 @@ var useButtonBase = function useButtonBase(_ref) {
560
559
  // TODO: remove me once we kill color fallbacks
561
560
  isSelected && appearance === 'warning' && selectedWarningStyles,
562
561
  // TODO: remove me once we kill color fallbacks
563
- isSelected && appearance === 'discovery' && selectedDiscoveryStyles, isDisabled && disabledStyles, isCircle && !isSplitButton && circleStyles, spacing === 'compact' && spacingCompactStyles, spacing === 'compact' && (getBooleanFF('platform.design-system-team.button-tokenised-typography-styles') ? tokenizedSpacingCompactStyles : baseSpacingCompactStyles), spacing === 'none' && spacingNoneStyles, spacing === 'none' && getBooleanFF('platform.design-system-team.button-tokenised-typography-styles') && tokenizedSpacingNoneStyles, spacing !== 'none' && hasIconBefore && buttonIconBeforeStyles, spacing !== 'none' && hasIconAfter && buttonIconAfterStyles, isIconButton && iconButtonStyles, isIconButton && spacing === 'compact' && iconButtonCompactStyles, shouldFitContainer && fullWidthStyles, isLoading && loadingOverlayStyles, (isDisabled || hasOverlay && !isLoading) && nonInteractiveStyles, isSplitButton && splitButtonStyles, isNavigationSplitButton && navigationSplitButtonStyles],
564
- // Consider overlay buttons to be effectively disabled
562
+ isSelected && appearance === 'discovery' && selectedDiscoveryStyles, isDisabled && disabledStyles, isCircle && !isSplitButton && circleStyles, spacing === 'compact' && spacingCompactStyles, spacing === 'compact' && (getBooleanFF('platform.design-system-team.button-tokenised-typography-styles') ? tokenizedSpacingCompactStyles : baseSpacingCompactStyles), spacing === 'none' && spacingNoneStyles, spacing === 'none' && getBooleanFF('platform.design-system-team.button-tokenised-typography-styles') && tokenizedSpacingNoneStyles, spacing !== 'none' && hasIconBefore && buttonIconBeforeStyles, spacing !== 'none' && hasIconAfter && buttonIconAfterStyles, isIconButton && iconButtonStyles, isIconButton && spacing === 'compact' && iconButtonCompactStyles, shouldFitContainer && fullWidthStyles, isLoading && loadingStyles, isSplitButton && splitButtonStyles, isNavigationSplitButton && navigationSplitButtonStyles],
565
563
  isDisabled: isEffectivelyDisabled,
566
- children: /*#__PURE__*/React.createElement(Fragment, null, children, overlay ? /*#__PURE__*/React.createElement(Box, {
564
+ children: /*#__PURE__*/React.createElement(Fragment, null, children, isLoading ? /*#__PURE__*/React.createElement(Box, {
567
565
  as: "span",
568
- xcss: overlayStyles
569
- }, overlay) : null, isLoading && (children && !ariaLabel && !ariaLabelledBy || ariaLabelledBy) && /*#__PURE__*/React.createElement(VisuallyHidden, {
566
+ xcss: loadingOverlayStyles
567
+ }, renderLoadingOverlay({
568
+ spacing: spacing,
569
+ appearance: appearance,
570
+ isDisabled: isDisabled,
571
+ isSelected: isSelected,
572
+ testId: testId
573
+ })) : null, isLoading && (children && !ariaLabel && !ariaLabelledBy || ariaLabelledBy) && /*#__PURE__*/React.createElement(VisuallyHidden, {
570
574
  id: loadingLabelId
571
- }, ", Loading")),
575
+ }, LOADING_LABEL)),
572
576
  'aria-label': isLoading && ariaLabel && !ariaLabelledBy ? "".concat(ariaLabel, " ").concat(LOADING_LABEL) : ariaLabel,
573
577
  'aria-labelledby': isLoading && ariaLabelledBy ? "".concat(ariaLabelledBy, " ").concat(loadingLabelId) : ariaLabelledBy
574
578
  }, blockEvents(isEffectivelyDisabled, {
@@ -125,7 +125,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
125
125
  action: 'clicked',
126
126
  componentName: 'button',
127
127
  packageName: "@atlaskit/button",
128
- packageVersion: "17.22.2",
128
+ packageVersion: "18.0.0",
129
129
  analyticsData: analyticsContext
130
130
  });
131
131
 
@@ -2,7 +2,7 @@ import { type Ref } from 'react';
2
2
  import { type AdditionalDefaultLinkVariantProps, type CommonLinkVariantProps } from '../types';
3
3
  import { type CommonDefaultButtonProps } from './types';
4
4
  export type LinkButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonDefaultButtonProps & CommonLinkVariantProps<RouterLinkConfig> & AdditionalDefaultLinkVariantProps;
5
- declare const LinkButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, appearance, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, autoFocus, children, href, iconAfter, iconBefore, interactionName, isDisabled, isSelected, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, shouldFitContainer, spacing, testId, UNSAFE_iconAfter_size, UNSAFE_iconBefore_size, ...rest }: LinkButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
5
+ declare const LinkButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, appearance, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, autoFocus, children, href, iconAfter, iconBefore, interactionName, isDisabled, isSelected, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, shouldFitContainer, spacing, testId, UNSAFE_iconAfter_size, UNSAFE_iconBefore_size, ...unsafeRest }: LinkButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
6
6
  /**
7
7
  * __Link Button__
8
8
  *
@@ -12,5 +12,5 @@ type UseButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagName>
12
12
  *
13
13
  * @private
14
14
  */
15
- declare const useDefaultButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, children, iconAfter, iconBefore, interactionName, isDisabled, isLoading, isSelected, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, ref, shouldFitContainer, spacing, testId, UNSAFE_iconAfter_size, UNSAFE_iconBefore_size, }: UseDefaultButtonArgs<TagName>) => UseButtonReturn<TagName>;
15
+ declare const useDefaultButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, children, iconAfter, iconBefore, interactionName, isDisabled, isLoading, isSelected, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, ref, shouldFitContainer, spacing, testId, UNSAFE_iconAfter_size, UNSAFE_iconBefore_size, }: UseDefaultButtonArgs<TagName>) => UseButtonReturn<TagName>;
16
16
  export default useDefaultButton;
@@ -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>({ "aria-label": preventedAriaLabel, "aria-labelledby": ariaLabelledBy, 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;
5
+ declare const LinkIconButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ "aria-label": preventedAriaLabel, "aria-labelledby": ariaLabelledBy, analyticsContext, appearance, autoFocus, href, icon, interactionName, isDisabled, isSelected, isTooltipDisabled, label, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, shape, spacing, testId, tooltip, UNSAFE_size, ...unsafeRest }: LinkIconButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
6
6
  /**
7
7
  * __Link Icon Button__
8
8
  *
@@ -12,5 +12,5 @@ type UseIconButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagN
12
12
  *
13
13
  * @private
14
14
  */
15
- declare const useIconButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, icon, interactionName, isDisabled, isLoading, isSelected, label, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, ref, shape, shouldFitContainer, spacing, testId, UNSAFE_size, }: UseIconButtonArgs<TagName>) => UseIconButtonReturn<TagName>;
15
+ declare const useIconButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, icon, interactionName, isDisabled, isLoading, isSelected, label, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, ref, shape, shouldFitContainer, spacing, testId, UNSAFE_size, }: UseIconButtonArgs<TagName>) => UseIconButtonReturn<TagName>;
16
16
  export default useIconButton;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  type ContentProps = {
3
3
  children: React.ReactNode;
4
4
  type?: 'text' | 'icon';
5
- hasOverlay: boolean;
5
+ isLoading: boolean;
6
6
  position?: 'before' | 'after';
7
7
  };
8
8
  /**
@@ -10,5 +10,5 @@ type ContentProps = {
10
10
  *
11
11
  * Used for slots within a Button, including icons and text content.
12
12
  */
13
- declare const Content: ({ children, type, hasOverlay, position }: ContentProps) => JSX.Element;
13
+ declare const Content: ({ children, type, isLoading, position }: ContentProps) => JSX.Element;
14
14
  export default Content;
@@ -19,7 +19,7 @@ export type UseButtonBaseArgs<TagName extends HTMLElement> = {
19
19
  isLoading?: boolean;
20
20
  ariaLabel?: string;
21
21
  ariaLabelledBy?: string;
22
- } & Pick<CommonButtonProps<TagName>, 'analyticsContext' | 'autoFocus' | 'interactionName' | 'isDisabled' | 'isSelected' | 'overlay'> & ControlledEvents<TagName>;
22
+ } & Pick<CommonButtonProps<TagName>, 'analyticsContext' | 'autoFocus' | 'interactionName' | 'isDisabled' | 'isSelected' | 'testId'> & ControlledEvents<TagName>;
23
23
  type XCSS = ReturnType<typeof xcss>;
24
24
  export type UseButtonBaseReturn<TagName extends HTMLElement> = {
25
25
  xcss: XCSS | Array<XCSS | false | undefined>;
@@ -42,5 +42,5 @@ export type UseButtonBaseReturn<TagName extends HTMLElement> = {
42
42
  *
43
43
  * @private
44
44
  */
45
- declare const useButtonBase: <TagName extends HTMLElement>({ appearance: propAppearance, autoFocus, isDisabled: propIsDisabled, isLoading, isSelected: propIsSelected, isIconButton, isCircle, hasIconBefore, hasIconAfter, children, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing: propSpacing, ariaLabel, ariaLabelledBy, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
45
+ declare const useButtonBase: <TagName extends HTMLElement>({ appearance: propAppearance, autoFocus, isDisabled: propIsDisabled, isLoading, isSelected: propIsSelected, isIconButton, isCircle, hasIconBefore, hasIconAfter, children, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, ref, shouldFitContainer, spacing: propSpacing, testId, ariaLabel, ariaLabelledBy, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
46
46
  export default useButtonBase;
@@ -16,12 +16,6 @@ export type CommonButtonProps<TagName extends HTMLElement> = {
16
16
  * Set the button to autofocus on mount.
17
17
  */
18
18
  autoFocus?: boolean;
19
- /**
20
- * @deprecated This is no longer supported and will be removed in a future major release. It only existed to support loading spinners, which can now be achieved with the `isLoading` prop.
21
- *
22
- * Used to 'overlay' something over a button. This is commonly used to display a loading spinner.
23
- */
24
- overlay?: React.ReactNode;
25
19
  /**
26
20
  * Disable the button to prevent user interaction.
27
21
  */
@@ -2,7 +2,7 @@ import { type Ref } from 'react';
2
2
  import { type AdditionalDefaultLinkVariantProps, type CommonLinkVariantProps } from '../types';
3
3
  import { type CommonDefaultButtonProps } from './types';
4
4
  export type LinkButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonDefaultButtonProps & CommonLinkVariantProps<RouterLinkConfig> & AdditionalDefaultLinkVariantProps;
5
- declare const LinkButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, appearance, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, autoFocus, children, href, iconAfter, iconBefore, interactionName, isDisabled, isSelected, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, shouldFitContainer, spacing, testId, UNSAFE_iconAfter_size, UNSAFE_iconBefore_size, ...rest }: LinkButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
5
+ declare const LinkButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, appearance, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, autoFocus, children, href, iconAfter, iconBefore, interactionName, isDisabled, isSelected, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, shouldFitContainer, spacing, testId, UNSAFE_iconAfter_size, UNSAFE_iconBefore_size, ...unsafeRest }: LinkButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
6
6
  /**
7
7
  * __Link Button__
8
8
  *
@@ -12,5 +12,5 @@ type UseButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagName>
12
12
  *
13
13
  * @private
14
14
  */
15
- declare const useDefaultButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, children, iconAfter, iconBefore, interactionName, isDisabled, isLoading, isSelected, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, ref, shouldFitContainer, spacing, testId, UNSAFE_iconAfter_size, UNSAFE_iconBefore_size, }: UseDefaultButtonArgs<TagName>) => UseButtonReturn<TagName>;
15
+ declare const useDefaultButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, children, iconAfter, iconBefore, interactionName, isDisabled, isLoading, isSelected, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, ref, shouldFitContainer, spacing, testId, UNSAFE_iconAfter_size, UNSAFE_iconBefore_size, }: UseDefaultButtonArgs<TagName>) => UseButtonReturn<TagName>;
16
16
  export default useDefaultButton;
@@ -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>({ "aria-label": preventedAriaLabel, "aria-labelledby": ariaLabelledBy, 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;
5
+ declare const LinkIconButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ "aria-label": preventedAriaLabel, "aria-labelledby": ariaLabelledBy, analyticsContext, appearance, autoFocus, href, icon, interactionName, isDisabled, isSelected, isTooltipDisabled, label, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, shape, spacing, testId, tooltip, UNSAFE_size, ...unsafeRest }: LinkIconButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
6
6
  /**
7
7
  * __Link Icon Button__
8
8
  *
@@ -12,5 +12,5 @@ type UseIconButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagN
12
12
  *
13
13
  * @private
14
14
  */
15
- declare const useIconButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, icon, interactionName, isDisabled, isLoading, isSelected, label, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, ref, shape, shouldFitContainer, spacing, testId, UNSAFE_size, }: UseIconButtonArgs<TagName>) => UseIconButtonReturn<TagName>;
15
+ declare const useIconButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, icon, interactionName, isDisabled, isLoading, isSelected, label, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, ref, shape, shouldFitContainer, spacing, testId, UNSAFE_size, }: UseIconButtonArgs<TagName>) => UseIconButtonReturn<TagName>;
16
16
  export default useIconButton;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  type ContentProps = {
3
3
  children: React.ReactNode;
4
4
  type?: 'text' | 'icon';
5
- hasOverlay: boolean;
5
+ isLoading: boolean;
6
6
  position?: 'before' | 'after';
7
7
  };
8
8
  /**
@@ -10,5 +10,5 @@ type ContentProps = {
10
10
  *
11
11
  * Used for slots within a Button, including icons and text content.
12
12
  */
13
- declare const Content: ({ children, type, hasOverlay, position }: ContentProps) => JSX.Element;
13
+ declare const Content: ({ children, type, isLoading, position }: ContentProps) => JSX.Element;
14
14
  export default Content;
@@ -19,7 +19,7 @@ export type UseButtonBaseArgs<TagName extends HTMLElement> = {
19
19
  isLoading?: boolean;
20
20
  ariaLabel?: string;
21
21
  ariaLabelledBy?: string;
22
- } & Pick<CommonButtonProps<TagName>, 'analyticsContext' | 'autoFocus' | 'interactionName' | 'isDisabled' | 'isSelected' | 'overlay'> & ControlledEvents<TagName>;
22
+ } & Pick<CommonButtonProps<TagName>, 'analyticsContext' | 'autoFocus' | 'interactionName' | 'isDisabled' | 'isSelected' | 'testId'> & ControlledEvents<TagName>;
23
23
  type XCSS = ReturnType<typeof xcss>;
24
24
  export type UseButtonBaseReturn<TagName extends HTMLElement> = {
25
25
  xcss: XCSS | Array<XCSS | false | undefined>;
@@ -42,5 +42,5 @@ export type UseButtonBaseReturn<TagName extends HTMLElement> = {
42
42
  *
43
43
  * @private
44
44
  */
45
- declare const useButtonBase: <TagName extends HTMLElement>({ appearance: propAppearance, autoFocus, isDisabled: propIsDisabled, isLoading, isSelected: propIsSelected, isIconButton, isCircle, hasIconBefore, hasIconAfter, children, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing: propSpacing, ariaLabel, ariaLabelledBy, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
45
+ declare const useButtonBase: <TagName extends HTMLElement>({ appearance: propAppearance, autoFocus, isDisabled: propIsDisabled, isLoading, isSelected: propIsSelected, isIconButton, isCircle, hasIconBefore, hasIconAfter, children, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, ref, shouldFitContainer, spacing: propSpacing, testId, ariaLabel, ariaLabelledBy, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
46
46
  export default useButtonBase;
@@ -16,12 +16,6 @@ export type CommonButtonProps<TagName extends HTMLElement> = {
16
16
  * Set the button to autofocus on mount.
17
17
  */
18
18
  autoFocus?: boolean;
19
- /**
20
- * @deprecated This is no longer supported and will be removed in a future major release. It only existed to support loading spinners, which can now be achieved with the `isLoading` prop.
21
- *
22
- * Used to 'overlay' something over a button. This is commonly used to display a loading spinner.
23
- */
24
- overlay?: React.ReactNode;
25
19
  /**
26
20
  * Disable the button to prevent user interaction.
27
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/button",
3
- "version": "17.22.2",
3
+ "version": "18.0.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/"
@@ -138,7 +138,7 @@
138
138
  "@atlaskit/primitives": "^8.0.0",
139
139
  "@atlaskit/spinner": "^16.2.0",
140
140
  "@atlaskit/theme": "^12.11.0",
141
- "@atlaskit/tokens": "^1.51.0",
141
+ "@atlaskit/tokens": "^1.52.0",
142
142
  "@atlaskit/tooltip": "^18.5.0",
143
143
  "@atlaskit/visually-hidden": "^1.4.0",
144
144
  "@babel/runtime": "^7.0.0",
@@ -204,6 +204,9 @@
204
204
  "platform.design-system-team.component-visual-refresh_t8zbo": {
205
205
  "type": "boolean"
206
206
  },
207
+ "platform.design-system-team.remove-unsafe-spread-from-new-button_a2xhw": {
208
+ "type": "boolean"
209
+ },
207
210
  "platform.design-system-team.button-render-prop-fix_lyo55": {
208
211
  "type": "boolean"
209
212
  }