@atlaskit/button 16.10.1 → 16.10.2

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 (80) hide show
  1. package/CHANGELOG.md +66 -60
  2. package/dist/cjs/containers/button-group.js +1 -0
  3. package/dist/cjs/new-button/variants/default/button.js +1 -2
  4. package/dist/cjs/new-button/variants/default/link.js +1 -2
  5. package/dist/cjs/new-button/variants/default/use-default-button.js +11 -16
  6. package/dist/cjs/new-button/variants/icon/button.js +1 -2
  7. package/dist/cjs/new-button/variants/icon/link.js +1 -2
  8. package/dist/cjs/new-button/variants/icon/use-icon-button.js +6 -10
  9. package/dist/cjs/new-button/variants/shared/colors.js +1 -2
  10. package/dist/cjs/new-button/variants/shared/content.js +51 -0
  11. package/dist/cjs/new-button/variants/shared/use-button-base.js +14 -4
  12. package/dist/cjs/new-button/variants/shared/xcss.js +1 -43
  13. package/dist/cjs/old-button/button.js +1 -2
  14. package/dist/cjs/old-button/custom-theme-button/custom-theme-button.js +1 -2
  15. package/dist/cjs/old-button/custom-theme-button/theme.js +1 -2
  16. package/dist/cjs/old-button/loading-button.js +1 -2
  17. package/dist/cjs/old-button/shared/button-base.js +9 -9
  18. package/dist/cjs/old-button/shared/colors.js +1 -2
  19. package/dist/cjs/old-button/shared/css.js +2 -3
  20. package/dist/cjs/old-button/shared/get-if-visually-hidden-children.js +2 -3
  21. package/dist/cjs/utils/appearances.js +1 -2
  22. package/dist/cjs/utils/spacing.js +1 -2
  23. package/dist/cjs/utils/variants.js +2 -4
  24. package/dist/es2019/containers/button-group.js +1 -0
  25. package/dist/es2019/new-button/variants/default/use-default-button.js +10 -14
  26. package/dist/es2019/new-button/variants/icon/use-icon-button.js +5 -8
  27. package/dist/es2019/new-button/variants/shared/content.js +43 -0
  28. package/dist/es2019/new-button/variants/shared/use-button-base.js +14 -3
  29. package/dist/es2019/new-button/variants/shared/xcss.js +1 -38
  30. package/dist/es2019/old-button/shared/button-base.js +7 -6
  31. package/dist/esm/containers/button-group.js +1 -0
  32. package/dist/esm/new-button/variants/default/use-default-button.js +10 -14
  33. package/dist/esm/new-button/variants/icon/use-icon-button.js +5 -8
  34. package/dist/esm/new-button/variants/shared/content.js +44 -0
  35. package/dist/esm/new-button/variants/shared/use-button-base.js +14 -3
  36. package/dist/esm/new-button/variants/shared/xcss.js +1 -37
  37. package/dist/esm/old-button/shared/button-base.js +7 -6
  38. package/dist/types/new-button/variants/shared/content.d.ts +13 -0
  39. package/dist/types/new-button/variants/shared/xcss.d.ts +0 -6
  40. package/package.json +6 -6
  41. package/dist/types-ts4.5/containers/button-group.d.ts +0 -12
  42. package/dist/types-ts4.5/entry-points/button-group.d.ts +0 -1
  43. package/dist/types-ts4.5/entry-points/custom-theme-button.d.ts +0 -2
  44. package/dist/types-ts4.5/entry-points/loading-button.d.ts +0 -2
  45. package/dist/types-ts4.5/entry-points/new.d.ts +0 -5
  46. package/dist/types-ts4.5/entry-points/standard-button.d.ts +0 -7
  47. package/dist/types-ts4.5/entry-points/types.d.ts +0 -4
  48. package/dist/types-ts4.5/entry-points/unsafe.d.ts +0 -1
  49. package/dist/types-ts4.5/index.d.ts +0 -8
  50. package/dist/types-ts4.5/new-button/variants/default/button.d.ts +0 -19
  51. package/dist/types-ts4.5/new-button/variants/default/link.d.ts +0 -17
  52. package/dist/types-ts4.5/new-button/variants/default/types.d.ts +0 -15
  53. package/dist/types-ts4.5/new-button/variants/default/use-default-button.d.ts +0 -15
  54. package/dist/types-ts4.5/new-button/variants/icon/button.d.ts +0 -17
  55. package/dist/types-ts4.5/new-button/variants/icon/link.d.ts +0 -17
  56. package/dist/types-ts4.5/new-button/variants/icon/types.d.ts +0 -8
  57. package/dist/types-ts4.5/new-button/variants/icon/use-icon-button.d.ts +0 -15
  58. package/dist/types-ts4.5/new-button/variants/shared/block-events.d.ts +0 -2
  59. package/dist/types-ts4.5/new-button/variants/shared/colors.d.ts +0 -18
  60. package/dist/types-ts4.5/new-button/variants/shared/use-button-base.d.ts +0 -37
  61. package/dist/types-ts4.5/new-button/variants/shared/xcss.d.ts +0 -24
  62. package/dist/types-ts4.5/new-button/variants/types.d.ts +0 -69
  63. package/dist/types-ts4.5/old-button/button.d.ts +0 -15
  64. package/dist/types-ts4.5/old-button/custom-theme-button/custom-theme-button-types.d.ts +0 -22
  65. package/dist/types-ts4.5/old-button/custom-theme-button/custom-theme-button.d.ts +0 -10
  66. package/dist/types-ts4.5/old-button/custom-theme-button/index.d.ts +0 -2
  67. package/dist/types-ts4.5/old-button/custom-theme-button/theme.d.ts +0 -21
  68. package/dist/types-ts4.5/old-button/loading-button.d.ts +0 -15
  69. package/dist/types-ts4.5/old-button/shared/block-events.d.ts +0 -4
  70. package/dist/types-ts4.5/old-button/shared/button-base.d.ts +0 -10
  71. package/dist/types-ts4.5/old-button/shared/colors.d.ts +0 -23
  72. package/dist/types-ts4.5/old-button/shared/css.d.ts +0 -22
  73. package/dist/types-ts4.5/old-button/shared/get-if-visually-hidden-children.d.ts +0 -2
  74. package/dist/types-ts4.5/old-button/shared/get-is-only-single-icon.d.ts +0 -2
  75. package/dist/types-ts4.5/old-button/shared/loading-spinner.d.ts +0 -5
  76. package/dist/types-ts4.5/old-button/types.d.ts +0 -94
  77. package/dist/types-ts4.5/utils/appearances.d.ts +0 -3
  78. package/dist/types-ts4.5/utils/spacing.d.ts +0 -3
  79. package/dist/types-ts4.5/utils/variants.d.ts +0 -15
  80. package/tmp/api-report-tmp.d.ts +0 -133
@@ -1,2 +0,0 @@
1
- export { default } from './custom-theme-button';
2
- export { default as Theme } from './theme';
@@ -1,21 +0,0 @@
1
- /// <reference types="react" />
2
- import { CSSObject } from '@emotion/react';
3
- import { InteractionState, ThemeProps, ThemeTokens } from './custom-theme-button-types';
4
- export declare function getCustomCss({ appearance, spacing, mode, isSelected, shouldFitContainer, iconIsOnlyChild, isLoading, state, }: ThemeProps): CSSObject;
5
- export declare function getSpecifiers(styles: CSSObject): CSSObject;
6
- export declare function defaultThemeFn(current: (values: ThemeProps) => ThemeTokens, values: ThemeProps): ThemeTokens;
7
- declare const Theme: {
8
- Consumer: import("react").ComponentType<{
9
- children: (tokens: ThemeTokens) => import("react").ReactNode;
10
- } & Partial<import("./custom-theme-button-types").CustomThemeButtonProps> & {
11
- state: InteractionState;
12
- iconIsOnlyChild?: boolean | undefined;
13
- mode?: import("@atlaskit/theme").ThemeModes | undefined;
14
- }>;
15
- Provider: import("react").ComponentType<{
16
- children?: import("react").ReactNode;
17
- value?: import("@atlaskit/theme/components").ThemeProp<ThemeTokens, ThemeProps> | undefined;
18
- }>;
19
- useTheme: (props: ThemeProps) => ThemeTokens;
20
- };
21
- export default Theme;
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- import { BaseProps } from './types';
3
- export type LoadingButtonOwnProps = {
4
- isLoading?: boolean;
5
- };
6
- export type LoadingButtonProps = Omit<BaseProps, 'overlay'> & LoadingButtonOwnProps;
7
- /**
8
- * __Loading button__
9
- *
10
- * A small wrapper around Button that allows you to show an @atlaskit/spinner as an overlay on the button when you set an isLoading prop to true.
11
- *
12
- * - [Examples](https://atlassian.design/components/button/examples#loading-button)
13
- */
14
- declare const LoadingButton: React.ForwardRefExoticComponent<Omit<BaseProps, "overlay"> & LoadingButtonOwnProps & React.RefAttributes<HTMLElement>>;
15
- export default LoadingButton;
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- export default function blockEvents({ isInteractive, }: {
3
- isInteractive: boolean;
4
- }): React.DOMAttributes<HTMLElement>;
@@ -1,10 +0,0 @@
1
- /** @jsx jsx */
2
- import React from 'react';
3
- import { CSSObject } from '@emotion/react';
4
- declare const _default: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.AllHTMLAttributes<HTMLElement>, "disabled">, "data-testid" | "data-has-overlay"> & {
5
- 'data-testid'?: undefined;
6
- 'data-has-overlay'?: undefined;
7
- }, keyof import("../types").BaseOwnProps> & import("../types").BaseOwnProps & {
8
- buttonCss: CSSObject;
9
- } & React.RefAttributes<HTMLElement>>;
10
- export default _default;
@@ -1,23 +0,0 @@
1
- import { ThemeModes } from '@atlaskit/theme/types';
2
- import { Appearance } from '../types';
3
- export type ColorRule = {
4
- [key in ThemeModes]: string;
5
- };
6
- export type ColorGroup = {
7
- default: ColorRule;
8
- hover?: ColorRule;
9
- active?: ColorRule;
10
- disabled?: ColorRule;
11
- selected?: ColorRule;
12
- focus?: ColorRule;
13
- focusSelected?: ColorRule;
14
- };
15
- export type ColorPreset = {
16
- [key in Appearance]: ColorGroup;
17
- };
18
- type Values = {
19
- background: ColorPreset;
20
- color: ColorPreset;
21
- };
22
- declare const values: Values;
23
- export default values;
@@ -1,22 +0,0 @@
1
- import { CSSObject } from '@emotion/react';
2
- import { ThemeModes } from '@atlaskit/theme/types';
3
- import { Appearance, Spacing } from '../types';
4
- export type GetCssArgs = {
5
- appearance: Appearance;
6
- spacing: Spacing;
7
- mode: ThemeModes;
8
- isSelected: boolean;
9
- shouldFitContainer: boolean;
10
- isOnlySingleIcon: boolean;
11
- };
12
- export declare function getCss({ appearance, spacing, mode, isSelected, shouldFitContainer, isOnlySingleIcon, }: GetCssArgs): CSSObject;
13
- export declare function getIconStyle({ spacing }: {
14
- spacing: Spacing;
15
- }): import("@emotion/react").SerializedStyles;
16
- export declare function getContentStyle({ spacing }: {
17
- spacing: Spacing;
18
- }): import("@emotion/react").SerializedStyles;
19
- export declare function getFadingCss({ hasOverlay }: {
20
- hasOverlay: boolean;
21
- }): import("@emotion/react").SerializedStyles;
22
- export declare const overlayCss: CSSObject;
@@ -1,2 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- export declare const getIfVisuallyHiddenChildren: (children: ReactNode) => boolean | "" | 0 | null | undefined;
@@ -1,2 +0,0 @@
1
- import { BaseProps } from '../types';
2
- export default function getIsOnlySingleIcon({ children, iconBefore, iconAfter, }: Pick<BaseProps, 'children' | 'iconBefore' | 'iconAfter'>): boolean;
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- import { BaseProps } from '../types';
3
- type LoadingSpinnerProps = Pick<BaseProps, 'appearance' | 'isDisabled' | 'isSelected' | 'spacing'>;
4
- export default function LoadingSpinner({ appearance, isDisabled, isSelected, spacing, }: LoadingSpinnerProps): JSX.Element;
5
- export {};
@@ -1,94 +0,0 @@
1
- import React from 'react';
2
- import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
- export type Appearance = 'default' | 'danger' | 'link' | 'primary' | 'subtle' | 'subtle-link' | 'warning';
4
- export type Spacing = 'compact' | 'default' | 'none';
5
- type Combine<First, Second> = Omit<First, keyof Second> & Second;
6
- export type BaseOwnProps = {
7
- /**
8
- * The base styling to apply to the button
9
- */
10
- appearance?: Appearance;
11
- /**
12
- * Set the button to autofocus on mount
13
- */
14
- autoFocus?: boolean;
15
- /**
16
- * Add a classname to the button
17
- */
18
- className?: string;
19
- /**
20
- * Used to 'overlay' something over a button. This is commonly used to display a loading spinner
21
- */
22
- overlay?: React.ReactNode;
23
- /**
24
- * Provides a url for buttons being used as a link
25
- */
26
- href?: string;
27
- /**
28
- * Places an icon within the button, after the button's text
29
- */
30
- iconAfter?: React.ReactChild;
31
- /**
32
- * Places an icon within the button, before the button's text
33
- */
34
- iconBefore?: React.ReactChild;
35
- /**
36
- * Set if the button is disabled
37
- */
38
- isDisabled?: boolean;
39
- /**
40
- * Change the style to indicate the button is selected
41
- */
42
- isSelected?: boolean;
43
- /**
44
- * Handler to be called on blur
45
- */
46
- onBlur?: React.FocusEventHandler<HTMLElement>;
47
- /**
48
- * Handler to be called on click. The second argument can be used to track analytics data. See the tutorial in the analytics-next package for details
49
- */
50
- onClick?: (e: React.MouseEvent<HTMLElement>, analyticsEvent: UIAnalyticsEvent) => void;
51
- /**
52
- * Handler to be called on focus
53
- */
54
- onFocus?: React.FocusEventHandler<HTMLElement>;
55
- /**
56
- * Set the amount of padding in the button
57
- */
58
- spacing?: Spacing;
59
- /**
60
- * Pass target down to a link within the button component, if a href is provided
61
- */
62
- target?: React.AnchorHTMLAttributes<HTMLAnchorElement>['target'];
63
- /**
64
- * Pass type down to a button
65
- */
66
- type?: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
67
- /**
68
- * Option to fit button width to its parent width
69
- */
70
- shouldFitContainer?: boolean;
71
- /**
72
- * Text content to be rendered in the button
73
- */
74
- children?: React.ReactNode;
75
- /**
76
- * A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests
77
- */
78
- testId?: string;
79
- component?: React.ComponentType<React.AllHTMLAttributes<HTMLElement>> | React.ElementType;
80
- /**
81
- * An optional name used to identify this component to press listeners. E.g. interaction tracing
82
- * @see https://hello.atlassian.net/wiki/spaces/UFO/pages/2010358949/UFO+Integration+into+Design+System+components
83
- */
84
- interactionName?: string;
85
- /**
86
- * Additional information to be included in the `context` of analytics events that come from button
87
- */
88
- analyticsContext?: Record<string, any>;
89
- };
90
- export type BaseProps = Combine<Combine<Omit<React.AllHTMLAttributes<HTMLElement>, 'disabled'>, {
91
- 'data-testid'?: never;
92
- 'data-has-overlay'?: never;
93
- }>, BaseOwnProps>;
94
- export {};
@@ -1,3 +0,0 @@
1
- import { type Appearance } from '../new-button/variants/types';
2
- declare const appearances: Appearance[];
3
- export default appearances;
@@ -1,3 +0,0 @@
1
- import { type Spacing } from '../new-button/variants/types';
2
- declare const spacing: Spacing[];
3
- export default spacing;
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- import Button from '../new-button/variants/default/button';
3
- export type Variant = {
4
- name: string;
5
- Component: typeof Button | typeof LinkButtonRender;
6
- /**
7
- * Expected element rendered as underlying button
8
- */
9
- elementType: typeof HTMLButtonElement | typeof HTMLAnchorElement;
10
- };
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>>;
14
- export declare const variants: Variant[];
15
- export default variants;
@@ -1,133 +0,0 @@
1
- ## API Report File for "@atlaskit/button"
2
-
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
-
5
- ```ts
6
-
7
- /// <reference types="react" />
8
-
9
- import { ComponentType } from 'react';
10
- import { CSSObject } from '@emotion/react';
11
- import { jsx } from '@emotion/react';
12
- import { default as React_2 } from 'react';
13
- import { ReactNode } from 'react';
14
- import { ThemeModes } from '@atlaskit/theme/types';
15
- import { ThemeModes as ThemeModes_2 } from '@atlaskit/theme';
16
- import { ThemeProp } from '@atlaskit/theme/components';
17
- import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
18
-
19
- // @public (undocumented)
20
- export type Appearance = 'danger' | 'default' | 'link' | 'primary' | 'subtle' | 'subtle-link' | 'warning';
21
-
22
- // @public (undocumented)
23
- export type BaseOwnProps = {
24
- appearance?: Appearance;
25
- autoFocus?: boolean;
26
- className?: string;
27
- overlay?: React_2.ReactNode;
28
- href?: string;
29
- iconAfter?: React_2.ReactChild;
30
- iconBefore?: React_2.ReactChild;
31
- isDisabled?: boolean;
32
- isSelected?: boolean;
33
- onBlur?: React_2.FocusEventHandler<HTMLElement>;
34
- onClick?: (e: React_2.MouseEvent<HTMLElement>, analyticsEvent: UIAnalyticsEvent) => void;
35
- onFocus?: React_2.FocusEventHandler<HTMLElement>;
36
- spacing?: Spacing;
37
- target?: React_2.AnchorHTMLAttributes<HTMLAnchorElement>['target'];
38
- type?: React_2.ButtonHTMLAttributes<HTMLButtonElement>['type'];
39
- shouldFitContainer?: boolean;
40
- children?: React_2.ReactNode;
41
- testId?: string;
42
- component?: React_2.ComponentType<React_2.AllHTMLAttributes<HTMLElement>> | React_2.ElementType;
43
- interactionName?: string;
44
- analyticsContext?: Record<string, any>;
45
- };
46
-
47
- // @public (undocumented)
48
- export type BaseProps = Combine<Combine<Omit<React_2.AllHTMLAttributes<HTMLElement>, 'disabled'>, {
49
- 'data-testid'?: never;
50
- 'data-has-overlay'?: never;
51
- }>, BaseOwnProps>;
52
-
53
- // @public
54
- const Button: React_2.MemoExoticComponent<React_2.ForwardRefExoticComponent<ButtonProps & React_2.RefAttributes<HTMLElement>>>;
55
- export default Button;
56
-
57
- // @public (undocumented)
58
- export function ButtonGroup({ appearance, children, }: ButtonGroupProps): jsx.JSX.Element;
59
-
60
- // @public (undocumented)
61
- type ButtonGroupProps = {
62
- appearance?: Appearance;
63
- children?: React_2.ReactNode;
64
- };
65
-
66
- // @public (undocumented)
67
- export interface ButtonProps extends BaseProps {
68
- }
69
-
70
- // @public (undocumented)
71
- type Combine<First, Second> = Omit<First, keyof Second> & Second;
72
-
73
- // @public
74
- export const CustomThemeButton: React_2.MemoExoticComponent<React_2.ForwardRefExoticComponent<Omit<BaseProps, "overlay"> & CustomThemeButtonOwnProps & React_2.RefAttributes<HTMLElement>>>;
75
-
76
- // @public (undocumented)
77
- export type CustomThemeButtonOwnProps = {
78
- isLoading?: boolean;
79
- theme?: (current: (props: ThemeProps) => ThemeTokens, props: ThemeProps) => ThemeTokens;
80
- };
81
-
82
- // @public (undocumented)
83
- export type CustomThemeButtonProps = Omit<BaseProps, 'overlay'> & CustomThemeButtonOwnProps;
84
-
85
- // @public (undocumented)
86
- export type InteractionState = 'active' | 'default' | 'disabled' | 'focus' | 'focusSelected' | 'hover' | 'selected';
87
-
88
- // @public
89
- export const LoadingButton: React_2.ForwardRefExoticComponent<Omit<BaseProps, "overlay"> & LoadingButtonOwnProps & React_2.RefAttributes<HTMLElement>>;
90
-
91
- // @public (undocumented)
92
- export type LoadingButtonOwnProps = {
93
- isLoading?: boolean;
94
- };
95
-
96
- // @public (undocumented)
97
- export type LoadingButtonProps = Omit<BaseProps, 'overlay'> & LoadingButtonOwnProps;
98
-
99
- // @public (undocumented)
100
- export type Spacing = 'compact' | 'default' | 'none';
101
-
102
- // @public (undocumented)
103
- export const Theme: {
104
- Consumer: ComponentType< {
105
- children: (tokens: ThemeTokens) => ReactNode;
106
- } & Partial<CustomThemeButtonProps> & {
107
- state: InteractionState;
108
- iconIsOnlyChild?: boolean | undefined;
109
- mode?: ThemeModes_2 | undefined;
110
- }>;
111
- Provider: ComponentType< {
112
- children?: ReactNode;
113
- value?: ThemeProp<ThemeTokens, ThemeProps> | undefined;
114
- }>;
115
- useTheme: (props: ThemeProps) => ThemeTokens;
116
- };
117
-
118
- // @public (undocumented)
119
- export type ThemeProps = Partial<CustomThemeButtonProps> & {
120
- state: InteractionState;
121
- iconIsOnlyChild?: boolean;
122
- mode?: ThemeModes;
123
- };
124
-
125
- // @public (undocumented)
126
- export type ThemeTokens = {
127
- buttonStyles: CSSObject;
128
- spinnerStyles: CSSObject;
129
- };
130
-
131
- // (No @packageDocumentation comment for this package)
132
-
133
- ```