@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.
- package/CHANGELOG.md +66 -60
- package/dist/cjs/containers/button-group.js +1 -0
- package/dist/cjs/new-button/variants/default/button.js +1 -2
- package/dist/cjs/new-button/variants/default/link.js +1 -2
- package/dist/cjs/new-button/variants/default/use-default-button.js +11 -16
- package/dist/cjs/new-button/variants/icon/button.js +1 -2
- package/dist/cjs/new-button/variants/icon/link.js +1 -2
- package/dist/cjs/new-button/variants/icon/use-icon-button.js +6 -10
- package/dist/cjs/new-button/variants/shared/colors.js +1 -2
- package/dist/cjs/new-button/variants/shared/content.js +51 -0
- package/dist/cjs/new-button/variants/shared/use-button-base.js +14 -4
- package/dist/cjs/new-button/variants/shared/xcss.js +1 -43
- package/dist/cjs/old-button/button.js +1 -2
- package/dist/cjs/old-button/custom-theme-button/custom-theme-button.js +1 -2
- package/dist/cjs/old-button/custom-theme-button/theme.js +1 -2
- package/dist/cjs/old-button/loading-button.js +1 -2
- package/dist/cjs/old-button/shared/button-base.js +9 -9
- package/dist/cjs/old-button/shared/colors.js +1 -2
- package/dist/cjs/old-button/shared/css.js +2 -3
- package/dist/cjs/old-button/shared/get-if-visually-hidden-children.js +2 -3
- package/dist/cjs/utils/appearances.js +1 -2
- package/dist/cjs/utils/spacing.js +1 -2
- package/dist/cjs/utils/variants.js +2 -4
- package/dist/es2019/containers/button-group.js +1 -0
- package/dist/es2019/new-button/variants/default/use-default-button.js +10 -14
- package/dist/es2019/new-button/variants/icon/use-icon-button.js +5 -8
- package/dist/es2019/new-button/variants/shared/content.js +43 -0
- package/dist/es2019/new-button/variants/shared/use-button-base.js +14 -3
- package/dist/es2019/new-button/variants/shared/xcss.js +1 -38
- package/dist/es2019/old-button/shared/button-base.js +7 -6
- package/dist/esm/containers/button-group.js +1 -0
- package/dist/esm/new-button/variants/default/use-default-button.js +10 -14
- package/dist/esm/new-button/variants/icon/use-icon-button.js +5 -8
- package/dist/esm/new-button/variants/shared/content.js +44 -0
- package/dist/esm/new-button/variants/shared/use-button-base.js +14 -3
- package/dist/esm/new-button/variants/shared/xcss.js +1 -37
- package/dist/esm/old-button/shared/button-base.js +7 -6
- package/dist/types/new-button/variants/shared/content.d.ts +13 -0
- package/dist/types/new-button/variants/shared/xcss.d.ts +0 -6
- package/package.json +6 -6
- package/dist/types-ts4.5/containers/button-group.d.ts +0 -12
- package/dist/types-ts4.5/entry-points/button-group.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/custom-theme-button.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/loading-button.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/new.d.ts +0 -5
- package/dist/types-ts4.5/entry-points/standard-button.d.ts +0 -7
- package/dist/types-ts4.5/entry-points/types.d.ts +0 -4
- package/dist/types-ts4.5/entry-points/unsafe.d.ts +0 -1
- package/dist/types-ts4.5/index.d.ts +0 -8
- package/dist/types-ts4.5/new-button/variants/default/button.d.ts +0 -19
- package/dist/types-ts4.5/new-button/variants/default/link.d.ts +0 -17
- package/dist/types-ts4.5/new-button/variants/default/types.d.ts +0 -15
- package/dist/types-ts4.5/new-button/variants/default/use-default-button.d.ts +0 -15
- package/dist/types-ts4.5/new-button/variants/icon/button.d.ts +0 -17
- package/dist/types-ts4.5/new-button/variants/icon/link.d.ts +0 -17
- package/dist/types-ts4.5/new-button/variants/icon/types.d.ts +0 -8
- package/dist/types-ts4.5/new-button/variants/icon/use-icon-button.d.ts +0 -15
- package/dist/types-ts4.5/new-button/variants/shared/block-events.d.ts +0 -2
- package/dist/types-ts4.5/new-button/variants/shared/colors.d.ts +0 -18
- package/dist/types-ts4.5/new-button/variants/shared/use-button-base.d.ts +0 -37
- package/dist/types-ts4.5/new-button/variants/shared/xcss.d.ts +0 -24
- package/dist/types-ts4.5/new-button/variants/types.d.ts +0 -69
- package/dist/types-ts4.5/old-button/button.d.ts +0 -15
- package/dist/types-ts4.5/old-button/custom-theme-button/custom-theme-button-types.d.ts +0 -22
- package/dist/types-ts4.5/old-button/custom-theme-button/custom-theme-button.d.ts +0 -10
- package/dist/types-ts4.5/old-button/custom-theme-button/index.d.ts +0 -2
- package/dist/types-ts4.5/old-button/custom-theme-button/theme.d.ts +0 -21
- package/dist/types-ts4.5/old-button/loading-button.d.ts +0 -15
- package/dist/types-ts4.5/old-button/shared/block-events.d.ts +0 -4
- package/dist/types-ts4.5/old-button/shared/button-base.d.ts +0 -10
- package/dist/types-ts4.5/old-button/shared/colors.d.ts +0 -23
- package/dist/types-ts4.5/old-button/shared/css.d.ts +0 -22
- package/dist/types-ts4.5/old-button/shared/get-if-visually-hidden-children.d.ts +0 -2
- package/dist/types-ts4.5/old-button/shared/get-is-only-single-icon.d.ts +0 -2
- package/dist/types-ts4.5/old-button/shared/loading-spinner.d.ts +0 -5
- package/dist/types-ts4.5/old-button/types.d.ts +0 -94
- package/dist/types-ts4.5/utils/appearances.d.ts +0 -3
- package/dist/types-ts4.5/utils/spacing.d.ts +0 -3
- package/dist/types-ts4.5/utils/variants.d.ts +0 -15
- package/tmp/api-report-tmp.d.ts +0 -133
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
4
|
+
var textStyles = xcss({
|
|
5
|
+
// content can grow and shrink
|
|
6
|
+
flexGrow: 1,
|
|
7
|
+
flexShrink: 1,
|
|
8
|
+
// ellipsis for overflow text
|
|
9
|
+
overflow: 'hidden',
|
|
10
|
+
textOverflow: 'ellipsis',
|
|
11
|
+
whiteSpace: 'nowrap'
|
|
12
|
+
});
|
|
13
|
+
var iconStyles = xcss({
|
|
14
|
+
display: 'flex',
|
|
15
|
+
// icon size cannot grow and shrink
|
|
16
|
+
flexGrow: 0,
|
|
17
|
+
flexShrink: 0,
|
|
18
|
+
alignSelf: 'center',
|
|
19
|
+
fontSize: 0,
|
|
20
|
+
lineHeight: 0,
|
|
21
|
+
userSelect: 'none'
|
|
22
|
+
});
|
|
23
|
+
var commonStyles = xcss({
|
|
24
|
+
transition: 'opacity 0.3s'
|
|
25
|
+
});
|
|
26
|
+
var fadeStyles = xcss({
|
|
27
|
+
opacity: 0
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* __Content__
|
|
31
|
+
*
|
|
32
|
+
* Used for slots within a Button, including icons and text content.
|
|
33
|
+
*/
|
|
34
|
+
var Content = function Content(_ref) {
|
|
35
|
+
var children = _ref.children,
|
|
36
|
+
_ref$type = _ref.type,
|
|
37
|
+
type = _ref$type === void 0 ? 'text' : _ref$type,
|
|
38
|
+
hasOverlay = _ref.hasOverlay;
|
|
39
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
40
|
+
as: "span",
|
|
41
|
+
xcss: [commonStyles].concat(_toConsumableArray(type === 'text' ? [textStyles] : [iconStyles]), _toConsumableArray(hasOverlay ? [fadeStyles] : []))
|
|
42
|
+
}, children);
|
|
43
|
+
};
|
|
44
|
+
export default Content;
|
|
@@ -7,12 +7,23 @@ import noop from '@atlaskit/ds-lib/noop';
|
|
|
7
7
|
import useAutoFocus from '@atlaskit/ds-lib/use-auto-focus';
|
|
8
8
|
// eslint-disable-next-line no-duplicate-imports
|
|
9
9
|
import InteractionContext from '@atlaskit/interaction-context';
|
|
10
|
-
import { Box } from '@atlaskit/primitives';
|
|
10
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
11
11
|
import blockEvents from './block-events';
|
|
12
|
-
import { getXCSS
|
|
12
|
+
import { getXCSS } from './xcss';
|
|
13
13
|
|
|
14
14
|
// Include modified onClick with analytics
|
|
15
15
|
|
|
16
|
+
var overlayStyles = xcss({
|
|
17
|
+
position: 'absolute',
|
|
18
|
+
insetInlineStart: 'space.0',
|
|
19
|
+
insetBlockStart: 'space.0',
|
|
20
|
+
insetInlineEnd: 'space.0',
|
|
21
|
+
insetBlockEnd: 'space.0',
|
|
22
|
+
display: 'flex',
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
justifyContent: 'center'
|
|
25
|
+
});
|
|
26
|
+
|
|
16
27
|
/**
|
|
17
28
|
* __Use button base__
|
|
18
29
|
*
|
|
@@ -87,7 +98,7 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
87
98
|
action: 'clicked',
|
|
88
99
|
componentName: 'button',
|
|
89
100
|
packageName: "@atlaskit/button",
|
|
90
|
-
packageVersion: "16.10.
|
|
101
|
+
packageVersion: "16.10.2",
|
|
91
102
|
analyticsData: analyticsContext,
|
|
92
103
|
actionSubject: buttonType
|
|
93
104
|
});
|
|
@@ -139,40 +139,4 @@ export function getXCSS(_ref3) {
|
|
|
139
139
|
transitionDuration: '0s, 0s'
|
|
140
140
|
})
|
|
141
141
|
}));
|
|
142
|
-
}
|
|
143
|
-
export var iconStyles = xcss({
|
|
144
|
-
display: 'flex',
|
|
145
|
-
// icon size cannot grow and shrink
|
|
146
|
-
flexGrow: 0,
|
|
147
|
-
flexShrink: 0,
|
|
148
|
-
alignSelf: 'center',
|
|
149
|
-
fontSize: 0,
|
|
150
|
-
lineHeight: 0,
|
|
151
|
-
userSelect: 'none'
|
|
152
|
-
});
|
|
153
|
-
export var contentStyles = xcss({
|
|
154
|
-
// content can grow and shrink
|
|
155
|
-
flexGrow: 1,
|
|
156
|
-
flexShrink: 1,
|
|
157
|
-
// ellipsis for overflow text
|
|
158
|
-
overflow: 'hidden',
|
|
159
|
-
textOverflow: 'ellipsis',
|
|
160
|
-
whiteSpace: 'nowrap'
|
|
161
|
-
});
|
|
162
|
-
export function getFadingStyles(_ref4) {
|
|
163
|
-
var hasOverlay = _ref4.hasOverlay;
|
|
164
|
-
return xcss({
|
|
165
|
-
opacity: hasOverlay ? 0 : 1,
|
|
166
|
-
transition: 'opacity 0.3s'
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
export var overlayStyles = xcss({
|
|
170
|
-
position: 'absolute',
|
|
171
|
-
left: 'space.0',
|
|
172
|
-
top: 'space.0',
|
|
173
|
-
right: 'space.0',
|
|
174
|
-
bottom: 'space.0',
|
|
175
|
-
display: 'flex',
|
|
176
|
-
alignItems: 'center',
|
|
177
|
-
justifyContent: 'center'
|
|
178
|
-
});
|
|
142
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["analyticsContext", "appearance", "autoFocus", "buttonCss", "children", "className", "href", "component", "iconAfter", "iconBefore", "interactionName", "isDisabled", "isSelected", "onBlur", "onClick", "onFocus", "onMouseDown", "overlay", "shouldFitContainer", "spacing", "tabIndex", "type", "testId"];
|
|
4
|
+
/* eslint-disable @atlaskit/design-system/consistent-css-prop-usage */
|
|
4
5
|
/** @jsx jsx */
|
|
5
6
|
import React, { useCallback, useContext, useEffect, useRef } from 'react';
|
|
6
7
|
import { css, jsx } from '@emotion/react';
|
|
@@ -108,7 +109,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
108
109
|
action: 'clicked',
|
|
109
110
|
componentName: 'button',
|
|
110
111
|
packageName: "@atlaskit/button",
|
|
111
|
-
packageVersion: "16.10.
|
|
112
|
+
packageVersion: "16.10.2",
|
|
112
113
|
analyticsData: analyticsContext
|
|
113
114
|
});
|
|
114
115
|
|
|
@@ -128,7 +129,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
128
129
|
|
|
129
130
|
// we are 'disabling' input with a button when there is an overlay
|
|
130
131
|
var hasOverlay = Boolean(overlay);
|
|
131
|
-
var
|
|
132
|
+
var fadeStyles = css(getFadingCss({
|
|
132
133
|
hasOverlay: hasOverlay
|
|
133
134
|
}));
|
|
134
135
|
var isInteractive = !isDisabled && !hasOverlay;
|
|
@@ -169,17 +170,17 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
169
170
|
}, blockEvents({
|
|
170
171
|
isInteractive: isInteractive
|
|
171
172
|
})), iconBefore ? jsx("span", {
|
|
172
|
-
css: [
|
|
173
|
+
css: [fadeStyles, getIconStyle({
|
|
173
174
|
spacing: spacing
|
|
174
175
|
}), getSpacingFix(children, iconBeforeSpacingFixStyle)]
|
|
175
176
|
}, iconBefore) : null, !getBooleanFF('platform.design-system-team.icon-button-spacing-fix_o1zc5') && children ? jsx("span", {
|
|
176
|
-
css: [
|
|
177
|
+
css: [fadeStyles, getContentStyle({
|
|
177
178
|
spacing: spacing
|
|
178
179
|
})]
|
|
179
|
-
}, children) : null, getBooleanFF('platform.design-system-team.icon-button-spacing-fix_o1zc5') && getChildren(children, [
|
|
180
|
+
}, children) : null, getBooleanFF('platform.design-system-team.icon-button-spacing-fix_o1zc5') && getChildren(children, [fadeStyles, getContentStyle({
|
|
180
181
|
spacing: spacing
|
|
181
182
|
})]), iconAfter ? jsx("span", {
|
|
182
|
-
css: [
|
|
183
|
+
css: [fadeStyles, getIconStyle({
|
|
183
184
|
spacing: spacing
|
|
184
185
|
}), getSpacingFix(children, iconAfterSpacingFixStyle)]
|
|
185
186
|
}, iconAfter) : null, overlay ? jsx("span", {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type ContentProps = {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
type?: 'text' | 'icon';
|
|
5
|
+
hasOverlay: boolean;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* __Content__
|
|
9
|
+
*
|
|
10
|
+
* Used for slots within a Button, including icons and text content.
|
|
11
|
+
*/
|
|
12
|
+
declare const Content: ({ children, type, hasOverlay }: ContentProps) => JSX.Element;
|
|
13
|
+
export default Content;
|
|
@@ -16,9 +16,3 @@ export type GetXCSSArgs = {
|
|
|
16
16
|
isLink: boolean;
|
|
17
17
|
};
|
|
18
18
|
export declare function getXCSS({ appearance, spacing, isDisabled, isSelected, isIconButton, shouldFitContainer, isLink, hasOverlay, hasIconBefore, hasIconAfter, }: GetXCSSArgs): ReturnType<typeof xcss>;
|
|
19
|
-
export declare const iconStyles: ReturnType<typeof xcss>;
|
|
20
|
-
export declare const contentStyles: ReturnType<typeof xcss>;
|
|
21
|
-
export declare function getFadingStyles({ hasOverlay, }: {
|
|
22
|
-
hasOverlay: boolean;
|
|
23
|
-
}): ReturnType<typeof xcss>;
|
|
24
|
-
export declare const overlayStyles: ReturnType<typeof xcss>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/button",
|
|
3
|
-
"version": "16.10.
|
|
3
|
+
"version": "16.10.2",
|
|
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,10 +50,10 @@
|
|
|
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.
|
|
54
|
-
"@atlaskit/spinner": "^15.
|
|
53
|
+
"@atlaskit/primitives": "^1.6.0",
|
|
54
|
+
"@atlaskit/spinner": "^15.6.0",
|
|
55
55
|
"@atlaskit/theme": "^12.6.0",
|
|
56
|
-
"@atlaskit/tokens": "^1.
|
|
56
|
+
"@atlaskit/tokens": "^1.25.0",
|
|
57
57
|
"@atlaskit/visually-hidden": "^1.2.4",
|
|
58
58
|
"@babel/runtime": "^7.0.0",
|
|
59
59
|
"@emotion/react": "^11.7.1"
|
|
@@ -65,7 +65,6 @@
|
|
|
65
65
|
"@af/accessibility-testing": "*",
|
|
66
66
|
"@af/integration-testing": "*",
|
|
67
67
|
"@af/visual-regression": "*",
|
|
68
|
-
"@atlaskit/ds-lib": "^2.2.0",
|
|
69
68
|
"@atlaskit/icon": "^21.12.0",
|
|
70
69
|
"@atlaskit/ssr": "*",
|
|
71
70
|
"@atlaskit/visual-regression": "*",
|
|
@@ -102,7 +101,8 @@
|
|
|
102
101
|
],
|
|
103
102
|
"deprecation": "no-deprecated-imports",
|
|
104
103
|
"styling": [
|
|
105
|
-
"emotion"
|
|
104
|
+
"emotion",
|
|
105
|
+
"static"
|
|
106
106
|
]
|
|
107
107
|
}
|
|
108
108
|
},
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { jsx } from '@emotion/react';
|
|
4
|
-
import { Appearance } from '../old-button/types';
|
|
5
|
-
export type ButtonGroupProps = {
|
|
6
|
-
/**
|
|
7
|
-
* The appearance to apply to all buttons.
|
|
8
|
-
*/
|
|
9
|
-
appearance?: Appearance;
|
|
10
|
-
children?: React.ReactNode;
|
|
11
|
-
};
|
|
12
|
-
export default function ButtonGroup({ appearance, children, }: ButtonGroupProps): jsx.JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from '../containers/button-group';
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { default, type ButtonProps, } from '../new-button/variants/default/button';
|
|
2
|
-
export { default as LinkButton, type LinkButtonProps, } from '../new-button/variants/default/link';
|
|
3
|
-
export { default as IconButton, type IconButtonProps, } from '../new-button/variants/icon/button';
|
|
4
|
-
export { default as LinkIconButton, type LinkIconButtonProps, } from '../new-button/variants/icon/link';
|
|
5
|
-
export type { Appearance, Spacing } from '../new-button/variants/types';
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export type { Appearance, Spacing, BaseOwnProps, BaseProps, } from '../old-button/types';
|
|
2
|
-
export type { ButtonProps } from './standard-button';
|
|
3
|
-
export type { LoadingButtonProps, LoadingButtonOwnProps, } from './loading-button';
|
|
4
|
-
export type { ThemeTokens, ThemeProps, InteractionState, CustomThemeButtonProps, CustomThemeButtonOwnProps, } from './custom-theme-button';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as UNSAFE_BUTTON } from '../new-button/variants/default/button';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export type { Appearance, Spacing, BaseOwnProps, BaseProps, } from './entry-points/types';
|
|
2
|
-
export { default, } from './entry-points/standard-button';
|
|
3
|
-
export type { ButtonProps } from './entry-points/standard-button';
|
|
4
|
-
export { default as LoadingButton } from './entry-points/loading-button';
|
|
5
|
-
export type { LoadingButtonProps, LoadingButtonOwnProps, } from './entry-points/loading-button';
|
|
6
|
-
export { default as CustomThemeButton, Theme, } from './entry-points/custom-theme-button';
|
|
7
|
-
export type { ThemeTokens, ThemeProps, InteractionState, CustomThemeButtonProps, CustomThemeButtonOwnProps, } from './entry-points/custom-theme-button';
|
|
8
|
-
export { default as ButtonGroup } from './entry-points/button-group';
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type AdditionalHTMLElementPropsExtender, type CombinedButtonProps } from '../types';
|
|
3
|
-
import { type CommonDefaultButtonProps } from './types';
|
|
4
|
-
type Element = HTMLButtonElement;
|
|
5
|
-
type AdditionalHTMLElementProps = AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<Element>>;
|
|
6
|
-
export type ButtonProps = CommonDefaultButtonProps & CombinedButtonProps<Element, AdditionalHTMLElementProps>;
|
|
7
|
-
/**
|
|
8
|
-
* __Button__
|
|
9
|
-
*
|
|
10
|
-
* @warning __UNSAFE__ Button is not yet safe for production use.
|
|
11
|
-
*
|
|
12
|
-
* A button triggers an event or action.
|
|
13
|
-
*
|
|
14
|
-
* - [Examples](https://atlassian.design/components/button/examples)
|
|
15
|
-
* - [Code](https://atlassian.design/components/button/code)
|
|
16
|
-
* - [Usage](https://atlassian.design/components/button/usage)
|
|
17
|
-
*/
|
|
18
|
-
declare const Button: React.MemoExoticComponent<React.ForwardRefExoticComponent<CommonDefaultButtonProps & Omit<AdditionalHTMLElementProps, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>>;
|
|
19
|
-
export default Button;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type AdditionalHTMLElementPropsExtender, type CombinedButtonProps } from '../types';
|
|
3
|
-
import { type CommonDefaultButtonProps } from './types';
|
|
4
|
-
type Element = HTMLAnchorElement;
|
|
5
|
-
type AdditionalHTMLElementProps = AdditionalHTMLElementPropsExtender<React.AnchorHTMLAttributes<Element>>;
|
|
6
|
-
export type LinkButtonProps = CommonDefaultButtonProps & CombinedButtonProps<Element, AdditionalHTMLElementProps>;
|
|
7
|
-
/**
|
|
8
|
-
* __Link Button__
|
|
9
|
-
*
|
|
10
|
-
* A link button renders a link in the style of a button.
|
|
11
|
-
*
|
|
12
|
-
* - [Examples](https://atlassian.design/components/button/examples)
|
|
13
|
-
* - [Code](https://atlassian.design/components/button/code)
|
|
14
|
-
* - [Usage](https://atlassian.design/components/button/usage)
|
|
15
|
-
*/
|
|
16
|
-
declare const LinkButton: React.MemoExoticComponent<React.ForwardRefExoticComponent<CommonDefaultButtonProps & Omit<AdditionalHTMLElementProps, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & React.RefAttributes<HTMLAnchorElement>>>;
|
|
17
|
-
export default LinkButton;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export type CommonDefaultButtonProps = {
|
|
3
|
-
/**
|
|
4
|
-
* Places an icon within the button, after the button's text
|
|
5
|
-
*/
|
|
6
|
-
iconAfter?: React.ReactChild;
|
|
7
|
-
/**
|
|
8
|
-
* Places an icon within the button, before the button's text
|
|
9
|
-
*/
|
|
10
|
-
iconBefore?: React.ReactChild;
|
|
11
|
-
/**
|
|
12
|
-
* Option to fit button width to its parent width
|
|
13
|
-
*/
|
|
14
|
-
shouldFitContainer?: boolean;
|
|
15
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type UseButtonBaseArgs, type UseButtonBaseReturn } from '../shared/use-button-base';
|
|
2
|
-
import { type CommonDefaultButtonProps } from './types';
|
|
3
|
-
type UseDefaultButtonArgs<TagName extends HTMLElement> = UseButtonBaseArgs<TagName> & CommonDefaultButtonProps;
|
|
4
|
-
type UseButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagName>;
|
|
5
|
-
/**
|
|
6
|
-
* __Use default button base__
|
|
7
|
-
*
|
|
8
|
-
* A React hook that accepts a set of default Button props,
|
|
9
|
-
* and processes them to return consistent base props for usage
|
|
10
|
-
* across Button and LinkButton variants.
|
|
11
|
-
*
|
|
12
|
-
* @private
|
|
13
|
-
*/
|
|
14
|
-
declare const useDefaultButton: <TagName extends HTMLElement>({ analyticsContext, appearance, autoFocus, buttonType, iconBefore, iconAfter, interactionName, isDisabled, isSelected, children, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing, }: UseDefaultButtonArgs<TagName>) => UseButtonReturn<TagName>;
|
|
15
|
-
export default useDefaultButton;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type AdditionalHTMLElementPropsExtender, type CombinedButtonProps } from '../types';
|
|
3
|
-
import { type CommonIconButtonProps } from './types';
|
|
4
|
-
type Element = HTMLButtonElement;
|
|
5
|
-
type AdditionalHTMLElementProps = AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<Element>>;
|
|
6
|
-
export type IconButtonProps = CommonIconButtonProps & CombinedButtonProps<Element, AdditionalHTMLElementProps>;
|
|
7
|
-
/**
|
|
8
|
-
* __Icon Button__
|
|
9
|
-
*
|
|
10
|
-
* TODO: Description
|
|
11
|
-
*
|
|
12
|
-
* - [Examples](https://atlassian.design/components/button/examples)
|
|
13
|
-
* - [Code](https://atlassian.design/components/button/code)
|
|
14
|
-
* - [Usage](https://atlassian.design/components/button/usage)
|
|
15
|
-
*/
|
|
16
|
-
declare const IconButton: React.MemoExoticComponent<React.ForwardRefExoticComponent<CommonIconButtonProps & Omit<AdditionalHTMLElementProps, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>>;
|
|
17
|
-
export default IconButton;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type AdditionalHTMLElementPropsExtender, type CombinedButtonProps } from '../types';
|
|
3
|
-
import { type CommonIconButtonProps } from './types';
|
|
4
|
-
type Element = HTMLAnchorElement;
|
|
5
|
-
type AdditionalHTMLElementProps = AdditionalHTMLElementPropsExtender<React.AnchorHTMLAttributes<Element>>;
|
|
6
|
-
export type LinkIconButtonProps = CommonIconButtonProps & CombinedButtonProps<Element, AdditionalHTMLElementProps>;
|
|
7
|
-
/**
|
|
8
|
-
* __Link Button__
|
|
9
|
-
*
|
|
10
|
-
* A link button renders a link in the style of a button.
|
|
11
|
-
*
|
|
12
|
-
* - [Examples](https://atlassian.design/components/button/examples)
|
|
13
|
-
* - [Code](https://atlassian.design/components/button/code)
|
|
14
|
-
* - [Usage](https://atlassian.design/components/button/usage)
|
|
15
|
-
*/
|
|
16
|
-
declare const LinkIconButton: React.MemoExoticComponent<React.ForwardRefExoticComponent<CommonIconButtonProps & Omit<AdditionalHTMLElementProps, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & React.RefAttributes<HTMLAnchorElement>>>;
|
|
17
|
-
export default LinkIconButton;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export type CommonIconButtonProps = {
|
|
3
|
-
/**
|
|
4
|
-
* TODO: Consider locking-down icon props by converting from slot props to component props
|
|
5
|
-
* Places an icon within the button, after the button's text
|
|
6
|
-
*/
|
|
7
|
-
icon: React.ReactChild;
|
|
8
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type UseButtonBaseArgs, type UseButtonBaseReturn } from '../shared/use-button-base';
|
|
2
|
-
import { type CommonIconButtonProps } from './types';
|
|
3
|
-
type UseIconButtonArgs<TagName extends HTMLElement> = UseButtonBaseArgs<TagName> & CommonIconButtonProps;
|
|
4
|
-
type UseIconButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagName>;
|
|
5
|
-
/**
|
|
6
|
-
* __Use icon button__
|
|
7
|
-
*
|
|
8
|
-
* A React hook that accepts a set of icon Button props,
|
|
9
|
-
* and processes them to return consistent base props for usage
|
|
10
|
-
* across IconButton and LinkIconButton variants.
|
|
11
|
-
*
|
|
12
|
-
* @private
|
|
13
|
-
*/
|
|
14
|
-
declare const useIconButton: <TagName extends HTMLElement>({ analyticsContext, appearance, autoFocus, buttonType, icon, interactionName, isDisabled, isSelected, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing, }: UseIconButtonArgs<TagName>) => UseIconButtonReturn<TagName>;
|
|
15
|
-
export default useIconButton;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { type BackgroundColor, type TextColor } from '@atlaskit/primitives';
|
|
2
|
-
import { type Appearance } from '../types';
|
|
3
|
-
export type ColorGroup<T extends BackgroundColor | TextColor> = {
|
|
4
|
-
default: T;
|
|
5
|
-
hover?: T;
|
|
6
|
-
active?: T;
|
|
7
|
-
disabled?: T;
|
|
8
|
-
selected?: T;
|
|
9
|
-
};
|
|
10
|
-
export type ColorPreset<T extends BackgroundColor | TextColor> = {
|
|
11
|
-
[key in Appearance]: ColorGroup<T>;
|
|
12
|
-
};
|
|
13
|
-
type Values = {
|
|
14
|
-
background: ColorPreset<BackgroundColor>;
|
|
15
|
-
color: ColorPreset<TextColor>;
|
|
16
|
-
};
|
|
17
|
-
declare const values: Values;
|
|
18
|
-
export default values;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { xcss } from '@atlaskit/primitives';
|
|
3
|
-
import { type CommonButtonProps } from '../types';
|
|
4
|
-
export type ControlledEvents<TagName extends HTMLElement> = Pick<React.DOMAttributes<TagName>, 'onMouseDownCapture' | 'onMouseUpCapture' | 'onKeyDownCapture' | 'onKeyUpCapture' | 'onTouchStartCapture' | 'onTouchEndCapture' | 'onPointerDownCapture' | 'onPointerUpCapture' | 'onClickCapture' | 'onClick'>;
|
|
5
|
-
export type ControlledEventsPassed<TagName extends HTMLElement> = Omit<ControlledEvents<TagName>, 'onClick'> & Pick<CommonButtonProps<TagName>, 'onClick'>;
|
|
6
|
-
export type UseButtonBaseArgs<TagName extends HTMLElement> = {
|
|
7
|
-
ref: React.Ref<TagName>;
|
|
8
|
-
/**
|
|
9
|
-
* The type of button. Used to pass action subject context to analytics.
|
|
10
|
-
*/
|
|
11
|
-
buttonType: 'button' | 'link';
|
|
12
|
-
isIconButton?: boolean;
|
|
13
|
-
hasIconBefore?: boolean;
|
|
14
|
-
hasIconAfter?: boolean;
|
|
15
|
-
shouldFitContainer?: boolean;
|
|
16
|
-
} & Pick<CommonButtonProps<TagName>, 'analyticsContext' | 'appearance' | 'autoFocus' | 'children' | 'interactionName' | 'isDisabled' | 'isSelected' | 'overlay' | 'spacing'> & ControlledEventsPassed<TagName>;
|
|
17
|
-
export type UseButtonBaseReturn<TagName extends HTMLElement> = {
|
|
18
|
-
xcss: ReturnType<typeof xcss>;
|
|
19
|
-
ref(node: TagName | null): void;
|
|
20
|
-
children: React.ReactNode;
|
|
21
|
-
isDisabled: boolean;
|
|
22
|
-
} & ControlledEvents<TagName>;
|
|
23
|
-
/**
|
|
24
|
-
* __Use button base__
|
|
25
|
-
*
|
|
26
|
-
* A React hook that accepts a set of common Button props,
|
|
27
|
-
* and processes them to return consistent base props for usage
|
|
28
|
-
* across various Button components.
|
|
29
|
-
*
|
|
30
|
-
* It also:
|
|
31
|
-
* - Implements auto focus when enabled.
|
|
32
|
-
* - Appends the `onClick` event with UFO analytics tracking.
|
|
33
|
-
*
|
|
34
|
-
* @private
|
|
35
|
-
*/
|
|
36
|
-
declare const useButtonBase: <TagName extends HTMLElement>({ analyticsContext, appearance, autoFocus, buttonType, interactionName, isDisabled, isSelected, isIconButton, hasIconBefore, hasIconAfter, children, onClick: providedOnClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
|
|
37
|
-
export default useButtonBase;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { xcss } from '@atlaskit/primitives';
|
|
2
|
-
import { type Appearance, type Spacing } from '../types';
|
|
3
|
-
export type GetXCSSArgs = {
|
|
4
|
-
appearance: Appearance;
|
|
5
|
-
spacing: Spacing;
|
|
6
|
-
isDisabled: boolean;
|
|
7
|
-
isSelected: boolean;
|
|
8
|
-
shouldFitContainer: boolean;
|
|
9
|
-
hasOverlay: boolean;
|
|
10
|
-
isIconButton: boolean;
|
|
11
|
-
hasIconBefore: boolean;
|
|
12
|
-
hasIconAfter: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* If the button is a LinkButton
|
|
15
|
-
*/
|
|
16
|
-
isLink: boolean;
|
|
17
|
-
};
|
|
18
|
-
export declare function getXCSS({ appearance, spacing, isDisabled, isSelected, isIconButton, shouldFitContainer, isLink, hasOverlay, hasIconBefore, hasIconAfter, }: GetXCSSArgs): ReturnType<typeof xcss>;
|
|
19
|
-
export declare const iconStyles: ReturnType<typeof xcss>;
|
|
20
|
-
export declare const contentStyles: ReturnType<typeof xcss>;
|
|
21
|
-
export declare function getFadingStyles({ hasOverlay, }: {
|
|
22
|
-
hasOverlay: boolean;
|
|
23
|
-
}): ReturnType<typeof xcss>;
|
|
24
|
-
export declare const overlayStyles: ReturnType<typeof xcss>;
|
|
@@ -1,69 +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 CommonButtonProps<TagName extends HTMLElement> = {
|
|
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
|
-
* Used to 'overlay' something over a button. This is commonly used to display a loading spinner
|
|
17
|
-
*/
|
|
18
|
-
overlay?: React.ReactNode;
|
|
19
|
-
/**
|
|
20
|
-
* Set if the button is disabled
|
|
21
|
-
*/
|
|
22
|
-
isDisabled?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Change the style to indicate the button is selected
|
|
25
|
-
*/
|
|
26
|
-
isSelected?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Handler to be called on blur
|
|
29
|
-
*/
|
|
30
|
-
onBlur?: React.FocusEventHandler<TagName>;
|
|
31
|
-
/**
|
|
32
|
-
* 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
|
|
33
|
-
*/
|
|
34
|
-
onClick?: (e: React.MouseEvent<TagName>, analyticsEvent: UIAnalyticsEvent) => void;
|
|
35
|
-
/**
|
|
36
|
-
* Handler to be called on focus
|
|
37
|
-
*/
|
|
38
|
-
onFocus?: React.FocusEventHandler<TagName>;
|
|
39
|
-
/**
|
|
40
|
-
* Set the amount of padding in the button
|
|
41
|
-
*/
|
|
42
|
-
spacing?: Spacing;
|
|
43
|
-
/**
|
|
44
|
-
* Text content to be rendered in the button
|
|
45
|
-
*/
|
|
46
|
-
children: React.ReactNode;
|
|
47
|
-
/**
|
|
48
|
-
* 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
|
|
49
|
-
*/
|
|
50
|
-
testId?: string;
|
|
51
|
-
/**
|
|
52
|
-
* An optional name used to identify this component to press listeners. E.g. interaction tracing
|
|
53
|
-
* @see https://hello.atlassian.net/wiki/spaces/UFO/pages/2010358949/UFO+Integration+into+Design+System+components
|
|
54
|
-
*/
|
|
55
|
-
interactionName?: string;
|
|
56
|
-
/**
|
|
57
|
-
* Additional information to be included in the `context` of analytics events that come from button
|
|
58
|
-
*/
|
|
59
|
-
analyticsContext?: Record<string, any>;
|
|
60
|
-
};
|
|
61
|
-
type SupportedElementAttributes = React.ButtonHTMLAttributes<HTMLButtonElement> | React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
62
|
-
export type AdditionalHTMLElementPropsExtender<Props extends SupportedElementAttributes> = Combine<Omit<Props, 'className' | 'style' | 'role' | 'disabled'>, {
|
|
63
|
-
'data-testid'?: never;
|
|
64
|
-
}>;
|
|
65
|
-
/**
|
|
66
|
-
* Combines common buttom props with additional HTML attributes.
|
|
67
|
-
*/
|
|
68
|
-
export type CombinedButtonProps<TagName extends HTMLElement, HTMLAttributes extends SupportedElementAttributes> = Combine<HTMLAttributes, CommonButtonProps<TagName>>;
|
|
69
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { BaseProps } from './types';
|
|
3
|
-
export interface ButtonProps extends BaseProps {
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* __Button__
|
|
7
|
-
*
|
|
8
|
-
* A button triggers an event or action. They let users know what will happen next.
|
|
9
|
-
*
|
|
10
|
-
* - [Examples](https://atlassian.design/components/button/examples)
|
|
11
|
-
* - [Code](https://atlassian.design/components/button/code)
|
|
12
|
-
* - [Usage](https://atlassian.design/components/button/usage)
|
|
13
|
-
*/
|
|
14
|
-
declare const Button: React.MemoExoticComponent<React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLElement>>>;
|
|
15
|
-
export default Button;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { CSSObject } from '@emotion/react';
|
|
2
|
-
import { ThemeModes } from '@atlaskit/theme/types';
|
|
3
|
-
import { BaseProps } from '../types';
|
|
4
|
-
export type ThemeTokens = {
|
|
5
|
-
buttonStyles: CSSObject;
|
|
6
|
-
spinnerStyles: CSSObject;
|
|
7
|
-
};
|
|
8
|
-
export type InteractionState = 'disabled' | 'focusSelected' | 'selected' | 'active' | 'hover' | 'focus' | 'default';
|
|
9
|
-
export type CustomThemeButtonOwnProps = {
|
|
10
|
-
isLoading?: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Slow + discouraged custom theme API
|
|
13
|
-
* See custom theme guide for usage details
|
|
14
|
-
*/
|
|
15
|
-
theme?: (current: (props: ThemeProps) => ThemeTokens, props: ThemeProps) => ThemeTokens;
|
|
16
|
-
};
|
|
17
|
-
export type CustomThemeButtonProps = Omit<BaseProps, 'overlay'> & CustomThemeButtonOwnProps;
|
|
18
|
-
export type ThemeProps = Partial<CustomThemeButtonProps> & {
|
|
19
|
-
state: InteractionState;
|
|
20
|
-
iconIsOnlyChild?: boolean;
|
|
21
|
-
mode?: ThemeModes;
|
|
22
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* __Custom theme button__
|
|
4
|
-
*
|
|
5
|
-
* A custom theme button. Avoid using this component. It exists for those already using custom theming, which is hard to use and has performance issues.
|
|
6
|
-
*
|
|
7
|
-
* - [Examples](https://atlassian.design/components/button/examples#custom-theme-button)
|
|
8
|
-
*/
|
|
9
|
-
declare const CustomThemeButton: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<import("../types").BaseProps, "overlay"> & import("./custom-theme-button-types").CustomThemeButtonOwnProps & React.RefAttributes<HTMLElement>>>;
|
|
10
|
-
export default CustomThemeButton;
|