@atlaskit/button 17.7.2 → 17.9.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 +12 -0
  2. package/dist/cjs/entry-points/standard-button.js +0 -1
  3. package/dist/cjs/new-button/variants/default/button.js +3 -1
  4. package/dist/cjs/new-button/variants/default/use-default-button.js +10 -2
  5. package/dist/cjs/new-button/variants/icon/button.js +3 -1
  6. package/dist/cjs/new-button/variants/icon/use-icon-button.js +9 -2
  7. package/dist/cjs/new-button/variants/shared/colors.js +44 -36
  8. package/dist/cjs/new-button/variants/shared/loading-overlay.js +49 -0
  9. package/dist/cjs/new-button/variants/shared/xcss.js +7 -5
  10. package/dist/cjs/old-button/shared/button-base.js +1 -1
  11. package/dist/es2019/entry-points/standard-button.js +0 -5
  12. package/dist/es2019/new-button/variants/default/button.js +2 -0
  13. package/dist/es2019/new-button/variants/default/use-default-button.js +9 -2
  14. package/dist/es2019/new-button/variants/icon/button.js +2 -0
  15. package/dist/es2019/new-button/variants/icon/use-icon-button.js +9 -2
  16. package/dist/es2019/new-button/variants/shared/colors.js +44 -36
  17. package/dist/es2019/new-button/variants/shared/loading-overlay.js +44 -0
  18. package/dist/es2019/new-button/variants/shared/xcss.js +7 -5
  19. package/dist/es2019/old-button/shared/button-base.js +1 -1
  20. package/dist/esm/entry-points/standard-button.js +0 -5
  21. package/dist/esm/new-button/variants/default/button.js +3 -1
  22. package/dist/esm/new-button/variants/default/use-default-button.js +10 -2
  23. package/dist/esm/new-button/variants/icon/button.js +3 -1
  24. package/dist/esm/new-button/variants/icon/use-icon-button.js +9 -2
  25. package/dist/esm/new-button/variants/shared/colors.js +44 -36
  26. package/dist/esm/new-button/variants/shared/loading-overlay.js +42 -0
  27. package/dist/esm/new-button/variants/shared/xcss.js +7 -5
  28. package/dist/esm/old-button/shared/button-base.js +1 -1
  29. package/dist/types/entry-points/standard-button.d.ts +0 -5
  30. package/dist/types/new-button/variants/default/types.d.ts +4 -0
  31. package/dist/types/new-button/variants/default/use-default-button.d.ts +1 -1
  32. package/dist/types/new-button/variants/icon/types.d.ts +4 -0
  33. package/dist/types/new-button/variants/icon/use-icon-button.d.ts +1 -1
  34. package/dist/types/new-button/variants/shared/colors.d.ts +5 -3
  35. package/dist/types/new-button/variants/shared/loading-overlay.d.ts +8 -0
  36. package/dist/types-ts4.5/entry-points/standard-button.d.ts +0 -5
  37. package/dist/types-ts4.5/new-button/variants/default/types.d.ts +4 -0
  38. package/dist/types-ts4.5/new-button/variants/default/use-default-button.d.ts +1 -1
  39. package/dist/types-ts4.5/new-button/variants/icon/types.d.ts +4 -0
  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/colors.d.ts +5 -3
  42. package/dist/types-ts4.5/new-button/variants/shared/loading-overlay.d.ts +8 -0
  43. package/package.json +5 -5
@@ -11,5 +11,5 @@ type UseIconButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagN
11
11
  *
12
12
  * @private
13
13
  */
14
- declare const useIconButton: <TagName extends HTMLElement>({ analyticsContext, appearance, autoFocus, buttonType, icon: Icon, interactionName, isDisabled, isSelected, label, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shape, shouldFitContainer, spacing, UNSAFE_size, }: UseIconButtonArgs<TagName>) => UseIconButtonReturn<TagName>;
14
+ declare const useIconButton: <TagName extends HTMLElement>({ analyticsContext, appearance, autoFocus, buttonType, icon: Icon, interactionName, isDisabled, isSelected, isLoading, label, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shape, shouldFitContainer, spacing, UNSAFE_size, }: UseIconButtonArgs<TagName>) => UseIconButtonReturn<TagName>;
15
15
  export default useIconButton;
@@ -5,10 +5,12 @@ export type ColorGroup<T extends BackgroundColor | TextColor> = {
5
5
  hover?: T;
6
6
  active?: T;
7
7
  disabled?: T;
8
- selected?: T;
9
8
  };
10
- export type ColorPreset<T extends BackgroundColor | TextColor> = {
11
- [key in Appearance]: ColorGroup<T>;
9
+ export type ColorGroupWithSelected<T extends BackgroundColor | TextColor> = ColorGroup<T> & {
10
+ selected?: ColorGroup<T>;
11
+ };
12
+ export type ColorPreset<T extends BackgroundColor | TextColor> = Record<Appearance, ColorGroupWithSelected<T>> & {
13
+ selected: ColorGroup<T>;
12
14
  };
13
15
  type Values = {
14
16
  background: ColorPreset<BackgroundColor>;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { Appearance, type ButtonSpacing } from '../types';
3
+ export default function renderLoadingOverlay({ appearance, spacing, isDisabled, isSelected, }: {
4
+ spacing?: ButtonSpacing;
5
+ appearance?: Appearance;
6
+ isDisabled?: boolean;
7
+ isSelected?: boolean;
8
+ }): JSX.Element;
@@ -1,7 +1,2 @@
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
1
  export { default } from '../old-button/button';
7
2
  export type { ButtonProps } from '../old-button/button';
@@ -1,6 +1,10 @@
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;
4
8
  /**
5
9
  * Text content to be rendered in the button. Required so that screen readers always have an accessible label provided for the button.
6
10
  */
@@ -11,5 +11,5 @@ type UseButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagName>
11
11
  *
12
12
  * @private
13
13
  */
14
- declare const useDefaultButton: <TagName extends HTMLElement>({ analyticsContext, appearance, autoFocus, buttonType, iconBefore: IconBefore, UNSAFE_iconBefore_size, iconAfter: IconAfter, UNSAFE_iconAfter_size, interactionName, isDisabled, isSelected, children, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing, }: UseDefaultButtonArgs<TagName>) => UseButtonReturn<TagName>;
14
+ declare const useDefaultButton: <TagName extends HTMLElement>({ analyticsContext, appearance, autoFocus, buttonType, iconBefore: IconBefore, UNSAFE_iconBefore_size, iconAfter: IconAfter, UNSAFE_iconAfter_size, interactionName, isDisabled, isSelected, isLoading, children, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing, }: UseDefaultButtonArgs<TagName>) => UseButtonReturn<TagName>;
15
15
  export default useDefaultButton;
@@ -1,5 +1,9 @@
1
1
  import { type IconButtonAppearance, type IconButtonSpacing, type IconProp, type IconSize } from '../types';
2
2
  export type CommonIconButtonProps = {
3
+ /**
4
+ * Conditionally show a spinner over the top of a button
5
+ */
6
+ isLoading?: boolean;
3
7
  /**
4
8
  * The button style variation.
5
9
  */
@@ -11,5 +11,5 @@ type UseIconButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagN
11
11
  *
12
12
  * @private
13
13
  */
14
- declare const useIconButton: <TagName extends HTMLElement>({ analyticsContext, appearance, autoFocus, buttonType, icon: Icon, interactionName, isDisabled, isSelected, label, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shape, shouldFitContainer, spacing, UNSAFE_size, }: UseIconButtonArgs<TagName>) => UseIconButtonReturn<TagName>;
14
+ declare const useIconButton: <TagName extends HTMLElement>({ analyticsContext, appearance, autoFocus, buttonType, icon: Icon, interactionName, isDisabled, isSelected, isLoading, label, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shape, shouldFitContainer, spacing, UNSAFE_size, }: UseIconButtonArgs<TagName>) => UseIconButtonReturn<TagName>;
15
15
  export default useIconButton;
@@ -5,10 +5,12 @@ export type ColorGroup<T extends BackgroundColor | TextColor> = {
5
5
  hover?: T;
6
6
  active?: T;
7
7
  disabled?: T;
8
- selected?: T;
9
8
  };
10
- export type ColorPreset<T extends BackgroundColor | TextColor> = {
11
- [key in Appearance]: ColorGroup<T>;
9
+ export type ColorGroupWithSelected<T extends BackgroundColor | TextColor> = ColorGroup<T> & {
10
+ selected?: ColorGroup<T>;
11
+ };
12
+ export type ColorPreset<T extends BackgroundColor | TextColor> = Record<Appearance, ColorGroupWithSelected<T>> & {
13
+ selected: ColorGroup<T>;
12
14
  };
13
15
  type Values = {
14
16
  background: ColorPreset<BackgroundColor>;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { Appearance, type ButtonSpacing } from '../types';
3
+ export default function renderLoadingOverlay({ appearance, spacing, isDisabled, isSelected, }: {
4
+ spacing?: ButtonSpacing;
5
+ appearance?: Appearance;
6
+ isDisabled?: boolean;
7
+ isSelected?: boolean;
8
+ }): JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/button",
3
- "version": "17.7.2",
3
+ "version": "17.9.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/"
@@ -87,10 +87,10 @@
87
87
  "@atlaskit/focus-ring": "^1.3.0",
88
88
  "@atlaskit/icon": "^22.1.0",
89
89
  "@atlaskit/interaction-context": "^2.1.0",
90
- "@atlaskit/primitives": "^5.1.0",
90
+ "@atlaskit/primitives": "^5.5.0",
91
91
  "@atlaskit/spinner": "^16.0.0",
92
- "@atlaskit/theme": "^12.6.0",
93
- "@atlaskit/tokens": "^1.42.0",
92
+ "@atlaskit/theme": "^12.7.0",
93
+ "@atlaskit/tokens": "^1.43.0",
94
94
  "@atlaskit/visually-hidden": "^1.2.4",
95
95
  "@babel/runtime": "^7.0.0",
96
96
  "@emotion/react": "^11.7.1"
@@ -102,7 +102,7 @@
102
102
  "@af/accessibility-testing": "*",
103
103
  "@af/integration-testing": "*",
104
104
  "@af/visual-regression": "*",
105
- "@atlaskit/app-provider": "^1.0.0",
105
+ "@atlaskit/app-provider": "^1.2.0",
106
106
  "@atlaskit/ssr": "*",
107
107
  "@atlaskit/visual-regression": "*",
108
108
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",