@atlaskit/button 16.11.0 → 16.12.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 +10 -0
- package/dist/cjs/new-button/variants/default/link.js +47 -42
- package/dist/cjs/new-button/variants/icon/link.js +47 -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/new-button/variants/default/button.js +0 -1
- package/dist/es2019/new-button/variants/default/link.js +45 -44
- package/dist/es2019/new-button/variants/icon/button.js +0 -1
- package/dist/es2019/new-button/variants/icon/link.js +45 -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/new-button/variants/default/link.js +44 -42
- package/dist/esm/new-button/variants/icon/link.js +44 -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/new-button/variants/default/button.d.ts +3 -5
- package/dist/types/new-button/variants/default/link.d.ts +10 -7
- package/dist/types/new-button/variants/icon/button.d.ts +3 -5
- package/dist/types/new-button/variants/icon/link.d.ts +11 -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/new-button/variants/default/button.d.ts +3 -5
- package/dist/types-ts4.5/new-button/variants/default/link.d.ts +10 -7
- package/dist/types-ts4.5/new-button/variants/icon/button.d.ts +3 -5
- package/dist/types-ts4.5/new-button/variants/icon/link.d.ts +11 -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 +3 -2
|
@@ -1,9 +1,7 @@
|
|
|
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
|
*
|
|
@@ -13,5 +11,5 @@ export type IconButtonProps = CommonIconButtonProps & CombinedButtonProps<Elemen
|
|
|
13
11
|
* - [Code](https://atlassian.design/components/button/code)
|
|
14
12
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
15
13
|
*/
|
|
16
|
-
declare const IconButton: React.MemoExoticComponent<React.ForwardRefExoticComponent<CommonIconButtonProps & Omit<
|
|
14
|
+
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
15
|
export default IconButton;
|
|
@@ -1,17 +1,20 @@
|
|
|
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
|
+
* Renders a link in the style of an icon button.
|
|
11
10
|
*
|
|
12
11
|
* - [Examples](https://atlassian.design/components/button/examples)
|
|
13
12
|
* - [Code](https://atlassian.design/components/button/code)
|
|
14
13
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
15
14
|
*/
|
|
16
|
-
declare const LinkIconButton:
|
|
15
|
+
declare const LinkIconButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonIconButtonProps & {
|
|
16
|
+
href: string | RouterLinkConfig;
|
|
17
|
+
} & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & {
|
|
18
|
+
ref?: React.Ref<HTMLAnchorElement> | undefined;
|
|
19
|
+
}) => ReturnType<typeof LinkIconButtonBase>;
|
|
17
20
|
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.12.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/"
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@atlaskit/focus-ring": "^1.3.0",
|
|
51
51
|
"@atlaskit/interaction-context": "^2.1.0",
|
|
52
52
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
53
|
-
"@atlaskit/primitives": "^1.
|
|
53
|
+
"@atlaskit/primitives": "^1.8.0",
|
|
54
54
|
"@atlaskit/spinner": "^15.6.0",
|
|
55
55
|
"@atlaskit/theme": "^12.6.0",
|
|
56
56
|
"@atlaskit/tokens": "^1.28.0",
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
"@af/accessibility-testing": "*",
|
|
66
66
|
"@af/integration-testing": "*",
|
|
67
67
|
"@af/visual-regression": "*",
|
|
68
|
+
"@atlaskit/app-provider": "^0.4.0",
|
|
68
69
|
"@atlaskit/icon": "^21.12.0",
|
|
69
70
|
"@atlaskit/ssr": "*",
|
|
70
71
|
"@atlaskit/visual-regression": "*",
|