@atlaskit/button 16.11.0 → 16.13.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.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/entry-points/unsafe.js +14 -0
- package/dist/cjs/new-button/containers/split-button/split-button.js +4 -0
- package/dist/cjs/new-button/variants/default/button.js +1 -1
- package/dist/cjs/new-button/variants/default/link.js +49 -42
- package/dist/cjs/new-button/variants/icon/button.js +2 -0
- package/dist/cjs/new-button/variants/icon/link.js +49 -42
- package/dist/cjs/new-button/variants/shared/use-button-base.js +1 -1
- package/dist/cjs/old-button/shared/button-base.js +1 -1
- package/dist/cjs/utils/variants.js +73 -8
- package/dist/es2019/entry-points/unsafe.js +2 -0
- package/dist/es2019/new-button/containers/split-button/split-button.js +4 -0
- package/dist/es2019/new-button/variants/default/button.js +1 -2
- package/dist/es2019/new-button/variants/default/link.js +47 -44
- package/dist/es2019/new-button/variants/icon/button.js +2 -1
- package/dist/es2019/new-button/variants/icon/link.js +47 -44
- package/dist/es2019/new-button/variants/shared/use-button-base.js +1 -1
- package/dist/es2019/old-button/shared/button-base.js +1 -1
- package/dist/es2019/utils/variants.js +69 -6
- package/dist/esm/entry-points/unsafe.js +2 -0
- package/dist/esm/new-button/containers/split-button/split-button.js +4 -0
- package/dist/esm/new-button/variants/default/button.js +1 -1
- package/dist/esm/new-button/variants/default/link.js +46 -42
- package/dist/esm/new-button/variants/icon/button.js +2 -0
- package/dist/esm/new-button/variants/icon/link.js +46 -42
- package/dist/esm/new-button/variants/shared/use-button-base.js +1 -1
- package/dist/esm/old-button/shared/button-base.js +1 -1
- package/dist/esm/utils/variants.js +75 -6
- package/dist/types/entry-points/unsafe.d.ts +2 -0
- package/dist/types/new-button/containers/split-button/split-button.d.ts +4 -0
- package/dist/types/new-button/variants/default/button.d.ts +4 -6
- package/dist/types/new-button/variants/default/link.d.ts +12 -7
- package/dist/types/new-button/variants/icon/button.d.ts +5 -5
- package/dist/types/new-button/variants/icon/link.d.ts +13 -8
- package/dist/types/new-button/variants/types.d.ts +11 -1
- package/dist/types/utils/variants.d.ts +25 -3
- package/dist/types-ts4.5/entry-points/unsafe.d.ts +2 -0
- package/dist/types-ts4.5/new-button/containers/split-button/split-button.d.ts +4 -0
- package/dist/types-ts4.5/new-button/variants/default/button.d.ts +4 -6
- package/dist/types-ts4.5/new-button/variants/default/link.d.ts +12 -7
- package/dist/types-ts4.5/new-button/variants/icon/button.d.ts +5 -5
- package/dist/types-ts4.5/new-button/variants/icon/link.d.ts +13 -8
- package/dist/types-ts4.5/new-button/variants/types.d.ts +11 -1
- package/dist/types-ts4.5/utils/variants.d.ts +25 -3
- package/package.json +35 -3
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type
|
|
1
|
+
import React, { type Ref } from 'react';
|
|
2
|
+
import { type CommonLinkVariantProps } from '../types';
|
|
3
3
|
import { type CommonDefaultButtonProps } from './types';
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
export type LinkButtonProps = CommonDefaultButtonProps & CombinedButtonProps<Element, AdditionalHTMLElementProps>;
|
|
4
|
+
export type LinkButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonDefaultButtonProps & CommonLinkVariantProps<RouterLinkConfig>;
|
|
5
|
+
declare const LinkButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, autoFocus, appearance, spacing, isDisabled, isSelected, iconBefore, iconAfter, children, shouldFitContainer, interactionName, overlay, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, testId, href, ...rest }: LinkButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
7
6
|
/**
|
|
8
7
|
* __Link Button__
|
|
9
8
|
*
|
|
10
|
-
*
|
|
9
|
+
* @private __UNSAFE__ LinkButton is not yet safe for production use.
|
|
10
|
+
*
|
|
11
|
+
* Renders a link in the style of a button.
|
|
11
12
|
*
|
|
12
13
|
* - [Examples](https://atlassian.design/components/button/examples)
|
|
13
14
|
* - [Code](https://atlassian.design/components/button/code)
|
|
14
15
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
15
16
|
*/
|
|
16
|
-
declare const LinkButton:
|
|
17
|
+
declare const LinkButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonDefaultButtonProps & {
|
|
18
|
+
href: string | RouterLinkConfig;
|
|
19
|
+
} & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & {
|
|
20
|
+
ref?: React.Ref<HTMLAnchorElement> | undefined;
|
|
21
|
+
}) => ReturnType<typeof LinkButtonBase>;
|
|
17
22
|
export default LinkButton;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type
|
|
2
|
+
import { type CommonButtonVariantProps } from '../types';
|
|
3
3
|
import { type CommonIconButtonProps } from './types';
|
|
4
|
-
type
|
|
5
|
-
type AdditionalHTMLElementProps = AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<Element>>;
|
|
6
|
-
export type IconButtonProps = CommonIconButtonProps & CombinedButtonProps<Element, AdditionalHTMLElementProps>;
|
|
4
|
+
export type IconButtonProps = CommonIconButtonProps & CommonButtonVariantProps;
|
|
7
5
|
/**
|
|
8
6
|
* __Icon Button__
|
|
9
7
|
*
|
|
8
|
+
* @private __UNSAFE__ IconButton is not yet safe for production use.
|
|
9
|
+
*
|
|
10
10
|
* TODO: Description
|
|
11
11
|
*
|
|
12
12
|
* - [Examples](https://atlassian.design/components/button/examples)
|
|
13
13
|
* - [Code](https://atlassian.design/components/button/code)
|
|
14
14
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
15
15
|
*/
|
|
16
|
-
declare const IconButton: React.MemoExoticComponent<React.ForwardRefExoticComponent<CommonIconButtonProps & Omit<
|
|
16
|
+
declare const IconButton: React.MemoExoticComponent<React.ForwardRefExoticComponent<CommonIconButtonProps & Omit<import("../types").AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<HTMLButtonElement>>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>>;
|
|
17
17
|
export default IconButton;
|
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type
|
|
1
|
+
import React, { type Ref } from 'react';
|
|
2
|
+
import { type CommonLinkVariantProps } from '../types';
|
|
3
3
|
import { type CommonIconButtonProps } from './types';
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
export type LinkIconButtonProps = CommonIconButtonProps & CombinedButtonProps<Element, AdditionalHTMLElementProps>;
|
|
4
|
+
export type LinkIconButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonIconButtonProps & CommonLinkVariantProps<RouterLinkConfig>;
|
|
5
|
+
declare const LinkIconButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, autoFocus, appearance, spacing, isDisabled, isSelected, icon, children, interactionName, overlay, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, testId, href, ...rest }: LinkIconButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
7
6
|
/**
|
|
8
|
-
* __Link Button__
|
|
7
|
+
* __Link Icon Button__
|
|
9
8
|
*
|
|
10
|
-
*
|
|
9
|
+
* @private __UNSAFE__ LinkIconButton is not yet safe for production use.
|
|
10
|
+
*
|
|
11
|
+
* Renders a link in the style of an icon button.
|
|
11
12
|
*
|
|
12
13
|
* - [Examples](https://atlassian.design/components/button/examples)
|
|
13
14
|
* - [Code](https://atlassian.design/components/button/code)
|
|
14
15
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
15
16
|
*/
|
|
16
|
-
declare const LinkIconButton:
|
|
17
|
+
declare const LinkIconButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonIconButtonProps & {
|
|
18
|
+
href: string | RouterLinkConfig;
|
|
19
|
+
} & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & {
|
|
20
|
+
ref?: React.Ref<HTMLAnchorElement> | undefined;
|
|
21
|
+
}) => ReturnType<typeof LinkIconButtonBase>;
|
|
17
22
|
export default LinkIconButton;
|
|
@@ -63,7 +63,17 @@ export type AdditionalHTMLElementPropsExtender<Props extends SupportedElementAtt
|
|
|
63
63
|
'data-testid'?: never;
|
|
64
64
|
}>;
|
|
65
65
|
/**
|
|
66
|
-
* Combines common
|
|
66
|
+
* Combines common button props with additional HTML attributes.
|
|
67
67
|
*/
|
|
68
68
|
export type CombinedButtonProps<TagName extends HTMLElement, HTMLAttributes extends SupportedElementAttributes> = Combine<HTMLAttributes, CommonButtonProps<TagName>>;
|
|
69
|
+
/**
|
|
70
|
+
* Common props for Button `<button>` variants
|
|
71
|
+
*/
|
|
72
|
+
export type CommonButtonVariantProps = CombinedButtonProps<HTMLButtonElement, AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<HTMLButtonElement>>>;
|
|
73
|
+
/**
|
|
74
|
+
* Common props for Link `<a>` Button variants
|
|
75
|
+
*/
|
|
76
|
+
export type CommonLinkVariantProps<RouterLinkConfig extends Record<string, any> = never> = {
|
|
77
|
+
href: string | RouterLinkConfig;
|
|
78
|
+
} & CombinedButtonProps<HTMLAnchorElement, AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>>>;
|
|
69
79
|
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Button from '../new-button/variants/default/button';
|
|
3
|
+
import { LinkButtonProps } from '../new-button/variants/default/link';
|
|
4
|
+
import { LinkIconButtonProps } from '../new-button/variants/icon/link';
|
|
3
5
|
export type Variant = {
|
|
4
6
|
name: string;
|
|
5
7
|
Component: typeof Button | typeof LinkButtonRender;
|
|
@@ -8,8 +10,28 @@ export type Variant = {
|
|
|
8
10
|
*/
|
|
9
11
|
elementType: typeof HTMLButtonElement | typeof HTMLAnchorElement;
|
|
10
12
|
};
|
|
11
|
-
declare const LinkButtonRender: React.ForwardRefExoticComponent<
|
|
12
|
-
|
|
13
|
-
}
|
|
13
|
+
declare const LinkButtonRender: React.ForwardRefExoticComponent<Omit<LinkButtonProps<never>, "href"> & {
|
|
14
|
+
href?: string | undefined;
|
|
15
|
+
} & React.RefAttributes<HTMLAnchorElement>>;
|
|
14
16
|
export declare const variants: Variant[];
|
|
15
17
|
export default variants;
|
|
18
|
+
export declare const linkButtonVariants: ({
|
|
19
|
+
name: string;
|
|
20
|
+
Component: React.ForwardRefExoticComponent<Omit<LinkButtonProps<never>, "href"> & {
|
|
21
|
+
href?: string | undefined;
|
|
22
|
+
} & React.RefAttributes<HTMLAnchorElement>>;
|
|
23
|
+
elementType: {
|
|
24
|
+
new (): HTMLAnchorElement;
|
|
25
|
+
prototype: HTMLAnchorElement;
|
|
26
|
+
};
|
|
27
|
+
} | {
|
|
28
|
+
name: string;
|
|
29
|
+
Component: React.ForwardRefExoticComponent<Omit<LinkIconButtonProps<never>, "href" | "icon"> & {
|
|
30
|
+
href?: string | undefined;
|
|
31
|
+
icon?: React.ReactChild | undefined;
|
|
32
|
+
} & React.RefAttributes<HTMLAnchorElement>>;
|
|
33
|
+
elementType: {
|
|
34
|
+
new (): HTMLAnchorElement;
|
|
35
|
+
prototype: HTMLAnchorElement;
|
|
36
|
+
};
|
|
37
|
+
})[];
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { default as UNSAFE_BUTTON } from '../new-button/variants/default/button';
|
|
2
|
+
export { default as UNSAFE_LINK_BUTTON } from '../new-button/variants/default/link';
|
|
2
3
|
export { default as UNSAFE_ICON_BUTTON } from '../new-button/variants/icon/button';
|
|
4
|
+
export { default as UNSAFE_LINK_ICON_BUTTON } from '../new-button/variants/icon/link';
|
|
3
5
|
export { SplitButton as UNSAFE_SPLIT_BUTTON, SplitButtonContainer as UNSAFE_SPLIT_BUTTON_CONTAINER, Divider as UNSAFE_DIVIDER, getActions as UNSAFE_GET_ACTIONS, } from '../new-button/containers/split-button';
|
|
4
6
|
export { SplitButtonContext as UNSAFE_SPLIT_BUTTON_CONTEXT } from '../new-button/containers/split-button/split-button-context';
|
|
@@ -29,6 +29,10 @@ type SplitButtonProps = {
|
|
|
29
29
|
isDisabled?: boolean;
|
|
30
30
|
};
|
|
31
31
|
/**
|
|
32
|
+
* __Split Button__
|
|
33
|
+
*
|
|
34
|
+
* @private __UNSAFE__ SplitButton is not yet safe for production use.
|
|
35
|
+
*
|
|
32
36
|
* TODO: Add description when adding docs
|
|
33
37
|
*/
|
|
34
38
|
export declare const SplitButton: ({ children, appearance, spacing, isDisabled, }: SplitButtonProps) => jsx.JSX.Element;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type
|
|
2
|
+
import { type CommonButtonVariantProps } from '../types';
|
|
3
3
|
import { type CommonDefaultButtonProps } from './types';
|
|
4
|
-
type
|
|
5
|
-
type AdditionalHTMLElementProps = AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<Element>>;
|
|
6
|
-
export type ButtonProps = CommonDefaultButtonProps & CombinedButtonProps<Element, AdditionalHTMLElementProps>;
|
|
4
|
+
export type ButtonProps = CommonDefaultButtonProps & CommonButtonVariantProps;
|
|
7
5
|
/**
|
|
8
6
|
* __Button__
|
|
9
7
|
*
|
|
10
|
-
* @
|
|
8
|
+
* @private __UNSAFE__ Button is not yet safe for production use.
|
|
11
9
|
*
|
|
12
10
|
* A button triggers an event or action.
|
|
13
11
|
*
|
|
@@ -15,5 +13,5 @@ export type ButtonProps = CommonDefaultButtonProps & CombinedButtonProps<Element
|
|
|
15
13
|
* - [Code](https://atlassian.design/components/button/code)
|
|
16
14
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
17
15
|
*/
|
|
18
|
-
declare const Button: React.MemoExoticComponent<React.ForwardRefExoticComponent<CommonDefaultButtonProps & Omit<
|
|
16
|
+
declare const Button: React.MemoExoticComponent<React.ForwardRefExoticComponent<CommonDefaultButtonProps & Omit<import("../types").AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<HTMLButtonElement>>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>>;
|
|
19
17
|
export default Button;
|
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type
|
|
1
|
+
import React, { type Ref } from 'react';
|
|
2
|
+
import { type CommonLinkVariantProps } from '../types';
|
|
3
3
|
import { type CommonDefaultButtonProps } from './types';
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
export type LinkButtonProps = CommonDefaultButtonProps & CombinedButtonProps<Element, AdditionalHTMLElementProps>;
|
|
4
|
+
export type LinkButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonDefaultButtonProps & CommonLinkVariantProps<RouterLinkConfig>;
|
|
5
|
+
declare const LinkButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, autoFocus, appearance, spacing, isDisabled, isSelected, iconBefore, iconAfter, children, shouldFitContainer, interactionName, overlay, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, testId, href, ...rest }: LinkButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
7
6
|
/**
|
|
8
7
|
* __Link Button__
|
|
9
8
|
*
|
|
10
|
-
*
|
|
9
|
+
* @private __UNSAFE__ LinkButton is not yet safe for production use.
|
|
10
|
+
*
|
|
11
|
+
* Renders a link in the style of a button.
|
|
11
12
|
*
|
|
12
13
|
* - [Examples](https://atlassian.design/components/button/examples)
|
|
13
14
|
* - [Code](https://atlassian.design/components/button/code)
|
|
14
15
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
15
16
|
*/
|
|
16
|
-
declare const LinkButton:
|
|
17
|
+
declare const LinkButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonDefaultButtonProps & {
|
|
18
|
+
href: string | RouterLinkConfig;
|
|
19
|
+
} & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & {
|
|
20
|
+
ref?: React.Ref<HTMLAnchorElement> | undefined;
|
|
21
|
+
}) => ReturnType<typeof LinkButtonBase>;
|
|
17
22
|
export default LinkButton;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type
|
|
2
|
+
import { type CommonButtonVariantProps } from '../types';
|
|
3
3
|
import { type CommonIconButtonProps } from './types';
|
|
4
|
-
type
|
|
5
|
-
type AdditionalHTMLElementProps = AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<Element>>;
|
|
6
|
-
export type IconButtonProps = CommonIconButtonProps & CombinedButtonProps<Element, AdditionalHTMLElementProps>;
|
|
4
|
+
export type IconButtonProps = CommonIconButtonProps & CommonButtonVariantProps;
|
|
7
5
|
/**
|
|
8
6
|
* __Icon Button__
|
|
9
7
|
*
|
|
8
|
+
* @private __UNSAFE__ IconButton is not yet safe for production use.
|
|
9
|
+
*
|
|
10
10
|
* TODO: Description
|
|
11
11
|
*
|
|
12
12
|
* - [Examples](https://atlassian.design/components/button/examples)
|
|
13
13
|
* - [Code](https://atlassian.design/components/button/code)
|
|
14
14
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
15
15
|
*/
|
|
16
|
-
declare const IconButton: React.MemoExoticComponent<React.ForwardRefExoticComponent<CommonIconButtonProps & Omit<
|
|
16
|
+
declare const IconButton: React.MemoExoticComponent<React.ForwardRefExoticComponent<CommonIconButtonProps & Omit<import("../types").AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<HTMLButtonElement>>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>>;
|
|
17
17
|
export default IconButton;
|
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type
|
|
1
|
+
import React, { type Ref } from 'react';
|
|
2
|
+
import { type CommonLinkVariantProps } from '../types';
|
|
3
3
|
import { type CommonIconButtonProps } from './types';
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
export type LinkIconButtonProps = CommonIconButtonProps & CombinedButtonProps<Element, AdditionalHTMLElementProps>;
|
|
4
|
+
export type LinkIconButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonIconButtonProps & CommonLinkVariantProps<RouterLinkConfig>;
|
|
5
|
+
declare const LinkIconButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, autoFocus, appearance, spacing, isDisabled, isSelected, icon, children, interactionName, overlay, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, testId, href, ...rest }: LinkIconButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
7
6
|
/**
|
|
8
|
-
* __Link Button__
|
|
7
|
+
* __Link Icon Button__
|
|
9
8
|
*
|
|
10
|
-
*
|
|
9
|
+
* @private __UNSAFE__ LinkIconButton is not yet safe for production use.
|
|
10
|
+
*
|
|
11
|
+
* Renders a link in the style of an icon button.
|
|
11
12
|
*
|
|
12
13
|
* - [Examples](https://atlassian.design/components/button/examples)
|
|
13
14
|
* - [Code](https://atlassian.design/components/button/code)
|
|
14
15
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
15
16
|
*/
|
|
16
|
-
declare const LinkIconButton:
|
|
17
|
+
declare const LinkIconButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonIconButtonProps & {
|
|
18
|
+
href: string | RouterLinkConfig;
|
|
19
|
+
} & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & {
|
|
20
|
+
ref?: React.Ref<HTMLAnchorElement> | undefined;
|
|
21
|
+
}) => ReturnType<typeof LinkIconButtonBase>;
|
|
17
22
|
export default LinkIconButton;
|
|
@@ -63,7 +63,17 @@ export type AdditionalHTMLElementPropsExtender<Props extends SupportedElementAtt
|
|
|
63
63
|
'data-testid'?: never;
|
|
64
64
|
}>;
|
|
65
65
|
/**
|
|
66
|
-
* Combines common
|
|
66
|
+
* Combines common button props with additional HTML attributes.
|
|
67
67
|
*/
|
|
68
68
|
export type CombinedButtonProps<TagName extends HTMLElement, HTMLAttributes extends SupportedElementAttributes> = Combine<HTMLAttributes, CommonButtonProps<TagName>>;
|
|
69
|
+
/**
|
|
70
|
+
* Common props for Button `<button>` variants
|
|
71
|
+
*/
|
|
72
|
+
export type CommonButtonVariantProps = CombinedButtonProps<HTMLButtonElement, AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<HTMLButtonElement>>>;
|
|
73
|
+
/**
|
|
74
|
+
* Common props for Link `<a>` Button variants
|
|
75
|
+
*/
|
|
76
|
+
export type CommonLinkVariantProps<RouterLinkConfig extends Record<string, any> = never> = {
|
|
77
|
+
href: string | RouterLinkConfig;
|
|
78
|
+
} & CombinedButtonProps<HTMLAnchorElement, AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>>>;
|
|
69
79
|
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Button from '../new-button/variants/default/button';
|
|
3
|
+
import { LinkButtonProps } from '../new-button/variants/default/link';
|
|
4
|
+
import { LinkIconButtonProps } from '../new-button/variants/icon/link';
|
|
3
5
|
export type Variant = {
|
|
4
6
|
name: string;
|
|
5
7
|
Component: typeof Button | typeof LinkButtonRender;
|
|
@@ -8,8 +10,28 @@ export type Variant = {
|
|
|
8
10
|
*/
|
|
9
11
|
elementType: typeof HTMLButtonElement | typeof HTMLAnchorElement;
|
|
10
12
|
};
|
|
11
|
-
declare const LinkButtonRender: React.ForwardRefExoticComponent<
|
|
12
|
-
|
|
13
|
-
}
|
|
13
|
+
declare const LinkButtonRender: React.ForwardRefExoticComponent<Omit<LinkButtonProps<never>, "href"> & {
|
|
14
|
+
href?: string | undefined;
|
|
15
|
+
} & React.RefAttributes<HTMLAnchorElement>>;
|
|
14
16
|
export declare const variants: Variant[];
|
|
15
17
|
export default variants;
|
|
18
|
+
export declare const linkButtonVariants: ({
|
|
19
|
+
name: string;
|
|
20
|
+
Component: React.ForwardRefExoticComponent<Omit<LinkButtonProps<never>, "href"> & {
|
|
21
|
+
href?: string | undefined;
|
|
22
|
+
} & React.RefAttributes<HTMLAnchorElement>>;
|
|
23
|
+
elementType: {
|
|
24
|
+
new (): HTMLAnchorElement;
|
|
25
|
+
prototype: HTMLAnchorElement;
|
|
26
|
+
};
|
|
27
|
+
} | {
|
|
28
|
+
name: string;
|
|
29
|
+
Component: React.ForwardRefExoticComponent<Omit<LinkIconButtonProps<never>, "href" | "icon"> & {
|
|
30
|
+
href?: string | undefined;
|
|
31
|
+
icon?: React.ReactChild | undefined;
|
|
32
|
+
} & React.RefAttributes<HTMLAnchorElement>>;
|
|
33
|
+
elementType: {
|
|
34
|
+
new (): HTMLAnchorElement;
|
|
35
|
+
prototype: HTMLAnchorElement;
|
|
36
|
+
};
|
|
37
|
+
})[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/button",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.13.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/"
|
|
@@ -27,7 +27,38 @@
|
|
|
27
27
|
"releaseModel": "continuous",
|
|
28
28
|
"website": {
|
|
29
29
|
"name": "Button",
|
|
30
|
-
"category": "Components"
|
|
30
|
+
"category": "Components",
|
|
31
|
+
"subPages": [
|
|
32
|
+
{
|
|
33
|
+
"title": "Button (new)",
|
|
34
|
+
"id": "button-new",
|
|
35
|
+
"status": {
|
|
36
|
+
"type": "draft"
|
|
37
|
+
},
|
|
38
|
+
"sortKey": 1
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"title": "Icon button",
|
|
42
|
+
"id": "icon-button",
|
|
43
|
+
"status": {
|
|
44
|
+
"type": "draft"
|
|
45
|
+
},
|
|
46
|
+
"sortKey": 2
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"title": "Button group",
|
|
50
|
+
"id": "button-group",
|
|
51
|
+
"sortKey": 3
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"title": "Split button",
|
|
55
|
+
"id": "split-button",
|
|
56
|
+
"status": {
|
|
57
|
+
"type": "draft"
|
|
58
|
+
},
|
|
59
|
+
"sortKey": 4
|
|
60
|
+
}
|
|
61
|
+
]
|
|
31
62
|
}
|
|
32
63
|
},
|
|
33
64
|
"af:exports": {
|
|
@@ -50,7 +81,7 @@
|
|
|
50
81
|
"@atlaskit/focus-ring": "^1.3.0",
|
|
51
82
|
"@atlaskit/interaction-context": "^2.1.0",
|
|
52
83
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
53
|
-
"@atlaskit/primitives": "^1.
|
|
84
|
+
"@atlaskit/primitives": "^1.9.0",
|
|
54
85
|
"@atlaskit/spinner": "^15.6.0",
|
|
55
86
|
"@atlaskit/theme": "^12.6.0",
|
|
56
87
|
"@atlaskit/tokens": "^1.28.0",
|
|
@@ -65,6 +96,7 @@
|
|
|
65
96
|
"@af/accessibility-testing": "*",
|
|
66
97
|
"@af/integration-testing": "*",
|
|
67
98
|
"@af/visual-regression": "*",
|
|
99
|
+
"@atlaskit/app-provider": "^0.4.0",
|
|
68
100
|
"@atlaskit/icon": "^21.12.0",
|
|
69
101
|
"@atlaskit/ssr": "*",
|
|
70
102
|
"@atlaskit/visual-regression": "*",
|