@atlaskit/button 17.20.0 → 17.22.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/new-button/containers/split-button/split-button.js +23 -6
- package/dist/cjs/new-button/variants/default/use-default-button.js +13 -14
- package/dist/cjs/new-button/variants/icon/use-icon-button.js +5 -5
- package/dist/cjs/new-button/variants/shared/icon-renderer.js +38 -0
- package/dist/cjs/new-button/variants/shared/use-button-base.js +79 -18
- package/dist/cjs/old-button/shared/button-base.js +1 -1
- package/dist/es2019/new-button/containers/split-button/split-button.js +22 -5
- package/dist/es2019/new-button/variants/default/use-default-button.js +13 -14
- package/dist/es2019/new-button/variants/icon/use-icon-button.js +5 -5
- package/dist/es2019/new-button/variants/shared/icon-renderer.js +32 -0
- package/dist/es2019/new-button/variants/shared/use-button-base.js +79 -18
- package/dist/es2019/old-button/shared/button-base.js +1 -1
- package/dist/esm/new-button/containers/split-button/split-button.js +23 -6
- package/dist/esm/new-button/variants/default/use-default-button.js +13 -14
- package/dist/esm/new-button/variants/icon/use-icon-button.js +5 -5
- package/dist/esm/new-button/variants/shared/icon-renderer.js +31 -0
- package/dist/esm/new-button/variants/shared/use-button-base.js +79 -18
- package/dist/esm/old-button/shared/button-base.js +1 -1
- package/dist/types/new-button/containers/split-button/split-button.d.ts +2 -1
- package/dist/types/new-button/variants/default/use-default-button.d.ts +1 -1
- package/dist/types/new-button/variants/icon/use-icon-button.d.ts +1 -1
- package/dist/types/new-button/variants/shared/icon-renderer.d.ts +14 -0
- package/dist/types/new-button/variants/shared/use-button-base.d.ts +1 -1
- package/dist/types-ts4.5/new-button/containers/split-button/split-button.d.ts +2 -1
- package/dist/types-ts4.5/new-button/variants/default/use-default-button.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/icon/use-icon-button.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/shared/icon-renderer.d.ts +14 -0
- package/dist/types-ts4.5/new-button/variants/shared/use-button-base.d.ts +1 -1
- package/package.json +9 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/button
|
|
2
2
|
|
|
3
|
+
## 17.22.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`5081c9ca53507`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5081c9ca53507) -
|
|
8
|
+
Correctly handle render props for icons in order to prevent unintentional renders.
|
|
9
|
+
|
|
10
|
+
## 17.21.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- [#112202](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/112202)
|
|
15
|
+
[`60baf23d5f27d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/60baf23d5f27d) -
|
|
16
|
+
Testing a new visual appearance behind a feature flag. If successful it'll be released at a later
|
|
17
|
+
date.
|
|
18
|
+
|
|
3
19
|
## 17.20.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.SplitButtonWithSlots = exports.SplitButtonContainer = exports.SplitButton = exports.Divider = void 0;
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
9
|
var _constants = require("@atlaskit/theme/constants");
|
|
9
10
|
var _splitButtonContext = require("./split-button-context");
|
|
10
11
|
var _utils = require("./utils");
|
|
@@ -23,7 +24,7 @@ var heights = {
|
|
|
23
24
|
};
|
|
24
25
|
var baseDividerStyles = (0, _react.css)({
|
|
25
26
|
display: 'inline-flex',
|
|
26
|
-
width:
|
|
27
|
+
width: "var(--ds-border-width, 1px)",
|
|
27
28
|
position: 'relative',
|
|
28
29
|
zIndex: 2
|
|
29
30
|
});
|
|
@@ -56,6 +57,9 @@ var dividerAppearance = {
|
|
|
56
57
|
}),
|
|
57
58
|
navigation: navigationDividerStyles
|
|
58
59
|
};
|
|
60
|
+
var dividerRefreshedOffsetStyles = (0, _react.css)({
|
|
61
|
+
marginInline: "calc(0px - ".concat("var(--ds-border-width, 1px)", ")")
|
|
62
|
+
});
|
|
59
63
|
var dividerHeight = {
|
|
60
64
|
default: defaultDividerStyles,
|
|
61
65
|
compact: compactDividerStyles
|
|
@@ -71,7 +75,7 @@ var Divider = exports.Divider = function Divider(_ref) {
|
|
|
71
75
|
return (
|
|
72
76
|
// I find it funny to provide a div for Divider
|
|
73
77
|
(0, _react.jsx)("div", {
|
|
74
|
-
css: [baseDividerStyles, dividerHeight[spacing], dividerAppearance[appearance], isDisabled ? dividerDisabledStyles : undefined]
|
|
78
|
+
css: [baseDividerStyles, dividerHeight[spacing], dividerAppearance[appearance], isDisabled ? dividerDisabledStyles : undefined, (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.component-visual-refresh_t8zbo') && dividerRefreshedOffsetStyles]
|
|
75
79
|
})
|
|
76
80
|
);
|
|
77
81
|
};
|
|
@@ -95,13 +99,22 @@ var secondaryButtonStyles = (0, _react.css)({
|
|
|
95
99
|
borderStartStartRadius: 0
|
|
96
100
|
}
|
|
97
101
|
});
|
|
102
|
+
var defaultAppearanceContainerStyles = (0, _react.css)({
|
|
103
|
+
borderRadius: "var(--ds-border-radius, 3px)",
|
|
104
|
+
outlineColor: "var(--ds-border, #091E4224)",
|
|
105
|
+
outlineOffset: "calc(0px - ".concat("var(--ds-border-width, 1px)", ")"),
|
|
106
|
+
outlineStyle: 'solid',
|
|
107
|
+
outlineWidth: "var(--ds-border-width, 1px)"
|
|
108
|
+
});
|
|
109
|
+
|
|
98
110
|
/**
|
|
99
111
|
* TODO: Add JSdoc
|
|
100
112
|
*/
|
|
101
113
|
var SplitButtonContainer = exports.SplitButtonContainer = function SplitButtonContainer(_ref2) {
|
|
102
|
-
var
|
|
114
|
+
var appearance = _ref2.appearance,
|
|
115
|
+
children = _ref2.children;
|
|
103
116
|
return (0, _react.jsx)("div", {
|
|
104
|
-
css: splitButtonStyles
|
|
117
|
+
css: [(0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.component-visual-refresh_t8zbo') && appearance === 'default' && defaultAppearanceContainerStyles, splitButtonStyles]
|
|
105
118
|
}, children);
|
|
106
119
|
};
|
|
107
120
|
|
|
@@ -125,7 +138,9 @@ var SplitButton = exports.SplitButton = function SplitButton(_ref3) {
|
|
|
125
138
|
var _getActions = (0, _utils.getActions)(children),
|
|
126
139
|
PrimaryAction = _getActions.PrimaryAction,
|
|
127
140
|
SecondaryAction = _getActions.SecondaryAction;
|
|
128
|
-
return (0, _react.jsx)(SplitButtonContainer,
|
|
141
|
+
return (0, _react.jsx)(SplitButtonContainer, {
|
|
142
|
+
appearance: appearance
|
|
143
|
+
}, (0, _react.jsx)(_splitButtonContext.SplitButtonContext.Provider, {
|
|
129
144
|
value: {
|
|
130
145
|
appearance: appearance,
|
|
131
146
|
spacing: spacing,
|
|
@@ -153,7 +168,9 @@ var SplitButtonWithSlots = exports.SplitButtonWithSlots = function SplitButtonWi
|
|
|
153
168
|
spacing = _ref4$spacing === void 0 ? 'default' : _ref4$spacing,
|
|
154
169
|
_ref4$isDisabled = _ref4.isDisabled,
|
|
155
170
|
isDisabled = _ref4$isDisabled === void 0 ? false : _ref4$isDisabled;
|
|
156
|
-
return (0, _react.jsx)(SplitButtonContainer,
|
|
171
|
+
return (0, _react.jsx)(SplitButtonContainer, {
|
|
172
|
+
appearance: appearance
|
|
173
|
+
}, (0, _react.jsx)(_splitButtonContext.SplitButtonContext.Provider, {
|
|
157
174
|
value: {
|
|
158
175
|
appearance: appearance,
|
|
159
176
|
spacing: spacing,
|
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _content = _interopRequireDefault(require("../shared/content"));
|
|
11
|
+
var _iconRenderer = _interopRequireDefault(require("../shared/icon-renderer"));
|
|
11
12
|
var _loadingOverlay = _interopRequireDefault(require("../shared/loading-overlay"));
|
|
12
13
|
var _useButtonBase = _interopRequireDefault(require("../shared/use-button-base"));
|
|
13
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
@@ -29,8 +30,8 @@ var useDefaultButton = function useDefaultButton(_ref) {
|
|
|
29
30
|
autoFocus = _ref.autoFocus,
|
|
30
31
|
buttonType = _ref.buttonType,
|
|
31
32
|
children = _ref.children,
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
iconAfter = _ref.iconAfter,
|
|
34
|
+
iconBefore = _ref.iconBefore,
|
|
34
35
|
interactionName = _ref.interactionName,
|
|
35
36
|
isDisabled = _ref.isDisabled,
|
|
36
37
|
_ref$isLoading = _ref.isLoading,
|
|
@@ -61,24 +62,22 @@ var useDefaultButton = function useDefaultButton(_ref) {
|
|
|
61
62
|
ariaLabel: ariaLabel,
|
|
62
63
|
ariaLabelledBy: ariaLabelledBy,
|
|
63
64
|
buttonType: buttonType,
|
|
64
|
-
children: /*#__PURE__*/_react.default.createElement(_react.Fragment, null,
|
|
65
|
+
children: /*#__PURE__*/_react.default.createElement(_react.Fragment, null, iconBefore && /*#__PURE__*/_react.default.createElement(_content.default, {
|
|
65
66
|
type: "icon",
|
|
66
67
|
position: "before",
|
|
67
68
|
hasOverlay: hasOverlay
|
|
68
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
69
|
-
|
|
70
|
-
size: UNSAFE_iconBefore_size
|
|
71
|
-
color: 'currentColor'
|
|
69
|
+
}, /*#__PURE__*/_react.default.createElement(_iconRenderer.default, {
|
|
70
|
+
icon: iconBefore,
|
|
71
|
+
size: UNSAFE_iconBefore_size
|
|
72
72
|
})), children && /*#__PURE__*/_react.default.createElement(_content.default, {
|
|
73
73
|
hasOverlay: hasOverlay
|
|
74
|
-
}, children),
|
|
74
|
+
}, children), iconAfter && /*#__PURE__*/_react.default.createElement(_content.default, {
|
|
75
75
|
type: "icon",
|
|
76
76
|
position: "after",
|
|
77
77
|
hasOverlay: hasOverlay
|
|
78
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
79
|
-
|
|
80
|
-
size: UNSAFE_iconAfter_size
|
|
81
|
-
color: 'currentColor'
|
|
78
|
+
}, /*#__PURE__*/_react.default.createElement(_iconRenderer.default, {
|
|
79
|
+
icon: iconAfter,
|
|
80
|
+
size: UNSAFE_iconAfter_size
|
|
82
81
|
}))),
|
|
83
82
|
interactionName: interactionName,
|
|
84
83
|
isDisabled: isDisabled,
|
|
@@ -104,8 +103,8 @@ var useDefaultButton = function useDefaultButton(_ref) {
|
|
|
104
103
|
ref: ref,
|
|
105
104
|
shouldFitContainer: shouldFitContainer,
|
|
106
105
|
spacing: spacing,
|
|
107
|
-
hasIconBefore: Boolean(
|
|
108
|
-
hasIconAfter: Boolean(
|
|
106
|
+
hasIconBefore: Boolean(iconBefore),
|
|
107
|
+
hasIconAfter: Boolean(iconAfter)
|
|
109
108
|
});
|
|
110
109
|
return baseProps;
|
|
111
110
|
};
|
|
@@ -8,6 +8,7 @@ exports.default = void 0;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
|
|
10
10
|
var _content = _interopRequireDefault(require("../shared/content"));
|
|
11
|
+
var _iconRenderer = _interopRequireDefault(require("../shared/icon-renderer"));
|
|
11
12
|
var _loadingOverlay = _interopRequireDefault(require("../shared/loading-overlay"));
|
|
12
13
|
var _useButtonBase = _interopRequireDefault(require("../shared/use-button-base"));
|
|
13
14
|
/**
|
|
@@ -26,7 +27,7 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
26
27
|
ariaLabelledBy = _ref.ariaLabelledBy,
|
|
27
28
|
autoFocus = _ref.autoFocus,
|
|
28
29
|
buttonType = _ref.buttonType,
|
|
29
|
-
|
|
30
|
+
icon = _ref.icon,
|
|
30
31
|
interactionName = _ref.interactionName,
|
|
31
32
|
isDisabled = _ref.isDisabled,
|
|
32
33
|
isLoading = _ref.isLoading,
|
|
@@ -61,10 +62,9 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
61
62
|
children: /*#__PURE__*/_react.default.createElement(_content.default, {
|
|
62
63
|
type: "icon",
|
|
63
64
|
hasOverlay: hasOverlay
|
|
64
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
65
|
-
|
|
66
|
-
size: UNSAFE_size
|
|
67
|
-
color: 'currentColor'
|
|
65
|
+
}, /*#__PURE__*/_react.default.createElement(_iconRenderer.default, {
|
|
66
|
+
icon: icon,
|
|
67
|
+
size: UNSAFE_size
|
|
68
68
|
}), /*#__PURE__*/_react.default.createElement(_visuallyHidden.default, null, label)),
|
|
69
69
|
interactionName: interactionName,
|
|
70
70
|
isDisabled: isDisabled,
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
|
+
function isIconRenderProp(func) {
|
|
11
|
+
return !func.displayName &&
|
|
12
|
+
// most function components and class components have a displayName, negate them
|
|
13
|
+
!func.render &&
|
|
14
|
+
// forwardRef doesn't require a display name, however it does include a render function, negate them
|
|
15
|
+
typeof func === 'function' // at the very least we need to be a function
|
|
16
|
+
;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* __Icon renderer__
|
|
21
|
+
*
|
|
22
|
+
* Used to support render props with icons.
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
var IconRenderer = function IconRenderer(_ref) {
|
|
26
|
+
var Icon = _ref.icon,
|
|
27
|
+
size = _ref.size;
|
|
28
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.button-render-prop-fix_lyo55') && isIconRenderProp(Icon) ? Icon({
|
|
29
|
+
label: '',
|
|
30
|
+
size: size,
|
|
31
|
+
color: 'currentColor'
|
|
32
|
+
}) : /*#__PURE__*/_react.default.createElement(Icon, {
|
|
33
|
+
label: "",
|
|
34
|
+
size: size,
|
|
35
|
+
color: 'currentColor'
|
|
36
|
+
}));
|
|
37
|
+
};
|
|
38
|
+
var _default = exports.default = IconRenderer;
|
|
@@ -33,27 +33,25 @@ var buttonStyles = (0, _primitives.xcss)({
|
|
|
33
33
|
alignItems: 'baseline',
|
|
34
34
|
justifyContent: 'center',
|
|
35
35
|
columnGap: 'space.050',
|
|
36
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
37
|
-
background: "var(--ds-background-neutral, ".concat(colors.N20A, ")"),
|
|
38
36
|
borderRadius: 'border.radius.100',
|
|
39
37
|
borderWidth: 'border.width.0',
|
|
40
|
-
// @ts-expect-error
|
|
41
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
42
|
-
color: "var(--ds-text, ".concat(colors.N500, ")"),
|
|
43
38
|
flexShrink: 0,
|
|
44
39
|
height: "".concat(32 / fontSize, "em"),
|
|
45
40
|
paddingInlineEnd: 'space.150',
|
|
46
41
|
paddingInlineStart: 'space.150',
|
|
47
42
|
textAlign: 'center',
|
|
48
|
-
transition: 'background 0.1s ease-out
|
|
43
|
+
transition: 'background 0.1s ease-out',
|
|
49
44
|
verticalAlign: 'middle',
|
|
50
|
-
'
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
'::after': {
|
|
46
|
+
borderRadius: 'inherit',
|
|
47
|
+
inset: 'space.0',
|
|
48
|
+
borderStyle: 'solid',
|
|
49
|
+
borderWidth: "var(--ds-border-width, 1px)",
|
|
50
|
+
pointerEvents: 'none',
|
|
51
|
+
position: 'absolute'
|
|
54
52
|
}
|
|
55
53
|
});
|
|
56
|
-
var
|
|
54
|
+
var hardCodedButtonStyles = (0, _primitives.xcss)({
|
|
57
55
|
fontFamily: 'inherit',
|
|
58
56
|
fontSize: 'inherit',
|
|
59
57
|
fontStyle: 'normal',
|
|
@@ -71,16 +69,46 @@ var defaultInteractiveStyles = (0, _primitives.xcss)({
|
|
|
71
69
|
background: "var(--ds-background-neutral-hovered, #091e4214)",
|
|
72
70
|
// @ts-expect-error
|
|
73
71
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
74
|
-
color: "var(--ds-text, ".concat(colors.N500, ")")
|
|
75
|
-
transitionDuration: '0s, 0.15s'
|
|
72
|
+
color: "var(--ds-text, ".concat(colors.N500, ")")
|
|
76
73
|
},
|
|
77
74
|
':active': {
|
|
78
75
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
79
76
|
background: "var(--ds-background-neutral-pressed, ".concat(colors.B75, ")"),
|
|
80
77
|
// @ts-expect-error
|
|
81
78
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
82
|
-
color: "var(--ds-text, ".concat(colors.B400, ")")
|
|
83
|
-
|
|
79
|
+
color: "var(--ds-text, ".concat(colors.B400, ")")
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
var defaultInteractiveRefreshedStyles = (0, _primitives.xcss)({
|
|
83
|
+
':hover': {
|
|
84
|
+
background: "var(--ds-background-neutral-subtle-hovered, #091E420F)",
|
|
85
|
+
color: 'color.text.subtle'
|
|
86
|
+
},
|
|
87
|
+
':active': {
|
|
88
|
+
background: "var(--ds-background-neutral-subtle-pressed, #091E4224)",
|
|
89
|
+
color: 'color.text.subtle'
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
var defaultStyles = (0, _primitives.xcss)({
|
|
93
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
94
|
+
background: "var(--ds-background-neutral, ".concat(colors.N20A, ")"),
|
|
95
|
+
// @ts-expect-error — using tokens for explicit fallback usage.
|
|
96
|
+
color: "var(--ds-text, ".concat(colors.N500, ")"),
|
|
97
|
+
':visited': {
|
|
98
|
+
// @ts-expect-error
|
|
99
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
100
|
+
color: "var(--ds-text, ".concat(colors.N500, ")")
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
var defaultRefreshedStyles = (0, _primitives.xcss)({
|
|
104
|
+
background: "var(--ds-background-neutral-subtle, #00000000)",
|
|
105
|
+
color: 'color.text.subtle',
|
|
106
|
+
'::after': {
|
|
107
|
+
content: '""',
|
|
108
|
+
borderColor: 'color.border'
|
|
109
|
+
},
|
|
110
|
+
':visited': {
|
|
111
|
+
color: 'color.text.subtle'
|
|
84
112
|
}
|
|
85
113
|
});
|
|
86
114
|
var primaryStyles = (0, _primitives.xcss)({
|
|
@@ -168,6 +196,13 @@ var subtleStyles = (0, _primitives.xcss)({
|
|
|
168
196
|
color: "var(--ds-text, #42526E)"
|
|
169
197
|
}
|
|
170
198
|
});
|
|
199
|
+
var subtleRefreshedStyles = (0, _primitives.xcss)({
|
|
200
|
+
background: "var(--ds-background-neutral-subtle, transparent)",
|
|
201
|
+
color: 'color.text.subtle',
|
|
202
|
+
':visited': {
|
|
203
|
+
color: 'color.text.subtle'
|
|
204
|
+
}
|
|
205
|
+
});
|
|
171
206
|
var subtleInteractiveStyles = (0, _primitives.xcss)({
|
|
172
207
|
':hover': {
|
|
173
208
|
background: "var(--ds-background-neutral-subtle-hovered, #091e4214)",
|
|
@@ -180,6 +215,16 @@ var subtleInteractiveStyles = (0, _primitives.xcss)({
|
|
|
180
215
|
color: "var(--ds-text, #42526E)"
|
|
181
216
|
}
|
|
182
217
|
});
|
|
218
|
+
var subtleInteractiveRefreshedStyles = (0, _primitives.xcss)({
|
|
219
|
+
':hover': {
|
|
220
|
+
background: "var(--ds-background-neutral-subtle-hovered, #091e4214)",
|
|
221
|
+
color: 'color.text.subtle'
|
|
222
|
+
},
|
|
223
|
+
':active': {
|
|
224
|
+
background: "var(--ds-background-neutral-subtle-pressed, #B3D4FF)",
|
|
225
|
+
color: 'color.text.subtle'
|
|
226
|
+
}
|
|
227
|
+
});
|
|
183
228
|
var linkStyles = (0, _primitives.xcss)({
|
|
184
229
|
// @ts-expect-error
|
|
185
230
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
@@ -265,6 +310,9 @@ var disabledStyles = (0, _primitives.xcss)({
|
|
|
265
310
|
background: "var(--ds-background-disabled, ".concat(colors.N20A, ")"),
|
|
266
311
|
// @ts-expect-error
|
|
267
312
|
color: "var(--ds-text-disabled, #091E424F)"
|
|
313
|
+
},
|
|
314
|
+
'::after': {
|
|
315
|
+
content: 'none'
|
|
268
316
|
}
|
|
269
317
|
});
|
|
270
318
|
var selectedStyles = (0, _primitives.xcss)({
|
|
@@ -279,6 +327,17 @@ var selectedStyles = (0, _primitives.xcss)({
|
|
|
279
327
|
color: "var(--ds-text-selected, ".concat(colors.N20, ")")
|
|
280
328
|
}
|
|
281
329
|
});
|
|
330
|
+
var selectedRefreshedStyles = (0, _primitives.xcss)({
|
|
331
|
+
background: "var(--ds-background-selected, #E9F2FF)",
|
|
332
|
+
color: 'color.text.selected',
|
|
333
|
+
'::after': {
|
|
334
|
+
content: '""',
|
|
335
|
+
borderColor: 'color.border.selected'
|
|
336
|
+
},
|
|
337
|
+
':visited': {
|
|
338
|
+
color: 'color.text.selected'
|
|
339
|
+
}
|
|
340
|
+
});
|
|
282
341
|
var selectedInteractiveStyles = (0, _primitives.xcss)({
|
|
283
342
|
':hover': {
|
|
284
343
|
// @ts-expect-error
|
|
@@ -458,7 +517,7 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
458
517
|
_ref$isLoading = _ref.isLoading,
|
|
459
518
|
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
460
519
|
_ref$isSelected = _ref.isSelected,
|
|
461
|
-
|
|
520
|
+
propIsSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
|
|
462
521
|
_ref$isIconButton = _ref.isIconButton,
|
|
463
522
|
isIconButton = _ref$isIconButton === void 0 ? false : _ref$isIconButton,
|
|
464
523
|
_ref$isCircle = _ref.isCircle,
|
|
@@ -495,16 +554,18 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
495
554
|
});
|
|
496
555
|
var isSplitButton = Boolean(splitButtonContext);
|
|
497
556
|
var isNavigationSplitButton = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isNavigationSplitButton) || false;
|
|
498
|
-
var
|
|
557
|
+
var isDefaultAppearanceSplitButton = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.appearance) === 'default';
|
|
558
|
+
var appearance = (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.component-visual-refresh_t8zbo') && isDefaultAppearanceSplitButton ? 'subtle' : (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.appearance) || propAppearance;
|
|
499
559
|
var spacing = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.spacing) || propSpacing;
|
|
500
560
|
var isDisabled = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isDisabled) || propIsDisabled;
|
|
501
561
|
var hasOverlay = Boolean(overlay);
|
|
502
562
|
var isInteractive = !isDisabled && !isLoading && !hasOverlay;
|
|
503
563
|
var isEffectivelyDisabled = isDisabled || Boolean(overlay);
|
|
564
|
+
var isSelected = propIsSelected && !isDisabled;
|
|
504
565
|
(0, _useAutoFocus.default)(localRef, autoFocus);
|
|
505
566
|
return _objectSpread({
|
|
506
567
|
ref: (0, _mergeRefs.default)([localRef, ref]),
|
|
507
|
-
xcss: [(0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.button-tokenised-typography-styles') ? tokenizedButtonStyles :
|
|
568
|
+
xcss: [(0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.button-tokenised-typography-styles') ? tokenizedButtonStyles : hardCodedButtonStyles, buttonStyles, appearance === 'default' && ((0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.component-visual-refresh_t8zbo') ? defaultRefreshedStyles : defaultStyles), appearance === 'default' && isInteractive && ((0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.component-visual-refresh_t8zbo') ? defaultInteractiveRefreshedStyles : defaultInteractiveStyles), appearance === 'primary' && primaryStyles, appearance === 'primary' && isInteractive && primaryInteractiveStyles, appearance === 'warning' && warningStyles, appearance === 'warning' && isInteractive && warningInteractiveStyles, appearance === 'danger' && dangerStyles, appearance === 'danger' && isInteractive && dangerInteractiveStyles, appearance === 'discovery' && discoveryStyles, appearance === 'discovery' && isInteractive && discoveryInteractiveStyles, appearance === 'subtle' && ((0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.component-visual-refresh_t8zbo') ? subtleRefreshedStyles : subtleStyles), appearance === 'subtle' && isInteractive && ((0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.component-visual-refresh_t8zbo') ? subtleInteractiveRefreshedStyles : subtleInteractiveStyles), appearance === 'link' && linkStyles, appearance === 'subtle-link' && subtleLinkStyles, !isSelected && (appearance === 'link' || appearance === 'subtle-link') ? linkDecorationStyles : linkDecorationUnsetStyles, isSelected && ((0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.component-visual-refresh_t8zbo') ? selectedRefreshedStyles : selectedStyles), isSelected && isInteractive && selectedInteractiveStyles,
|
|
508
569
|
// TODO: remove me once we kill color fallbacks
|
|
509
570
|
isSelected && appearance === 'danger' && selectedDangerStyles,
|
|
510
571
|
// TODO: remove me once we kill color fallbacks
|
|
@@ -133,7 +133,7 @@ var _default = exports.default = /*#__PURE__*/_react.default.forwardRef(function
|
|
|
133
133
|
action: 'clicked',
|
|
134
134
|
componentName: 'button',
|
|
135
135
|
packageName: "@atlaskit/button",
|
|
136
|
-
packageVersion: "17.
|
|
136
|
+
packageVersion: "17.22.0",
|
|
137
137
|
analyticsData: analyticsContext
|
|
138
138
|
});
|
|
139
139
|
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
7
|
import { css, jsx } from '@emotion/react';
|
|
8
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
import { fontSize as getFontSize } from '@atlaskit/theme/constants';
|
|
9
10
|
const fontSize = getFontSize();
|
|
10
11
|
const heights = {
|
|
@@ -16,7 +17,7 @@ import { SplitButtonContext } from './split-button-context';
|
|
|
16
17
|
import { getActions } from './utils';
|
|
17
18
|
const baseDividerStyles = css({
|
|
18
19
|
display: 'inline-flex',
|
|
19
|
-
width:
|
|
20
|
+
width: "var(--ds-border-width, 1px)",
|
|
20
21
|
position: 'relative',
|
|
21
22
|
zIndex: 2
|
|
22
23
|
});
|
|
@@ -49,6 +50,9 @@ const dividerAppearance = {
|
|
|
49
50
|
}),
|
|
50
51
|
navigation: navigationDividerStyles
|
|
51
52
|
};
|
|
53
|
+
const dividerRefreshedOffsetStyles = css({
|
|
54
|
+
marginInline: `calc(0px - ${"var(--ds-border-width, 1px)"})`
|
|
55
|
+
});
|
|
52
56
|
const dividerHeight = {
|
|
53
57
|
default: defaultDividerStyles,
|
|
54
58
|
compact: compactDividerStyles
|
|
@@ -64,7 +68,7 @@ export const Divider = ({
|
|
|
64
68
|
return (
|
|
65
69
|
// I find it funny to provide a div for Divider
|
|
66
70
|
jsx("div", {
|
|
67
|
-
css: [baseDividerStyles, dividerHeight[spacing], dividerAppearance[appearance], isDisabled ? dividerDisabledStyles : undefined]
|
|
71
|
+
css: [baseDividerStyles, dividerHeight[spacing], dividerAppearance[appearance], isDisabled ? dividerDisabledStyles : undefined, getBooleanFF('platform.design-system-team.component-visual-refresh_t8zbo') && dividerRefreshedOffsetStyles]
|
|
68
72
|
})
|
|
69
73
|
);
|
|
70
74
|
};
|
|
@@ -88,14 +92,23 @@ const secondaryButtonStyles = css({
|
|
|
88
92
|
borderStartStartRadius: 0
|
|
89
93
|
}
|
|
90
94
|
});
|
|
95
|
+
const defaultAppearanceContainerStyles = css({
|
|
96
|
+
borderRadius: "var(--ds-border-radius, 3px)",
|
|
97
|
+
outlineColor: "var(--ds-border, #091E4224)",
|
|
98
|
+
outlineOffset: `calc(0px - ${"var(--ds-border-width, 1px)"})`,
|
|
99
|
+
outlineStyle: 'solid',
|
|
100
|
+
outlineWidth: "var(--ds-border-width, 1px)"
|
|
101
|
+
});
|
|
102
|
+
|
|
91
103
|
/**
|
|
92
104
|
* TODO: Add JSdoc
|
|
93
105
|
*/
|
|
94
106
|
export const SplitButtonContainer = ({
|
|
107
|
+
appearance,
|
|
95
108
|
children
|
|
96
109
|
}) => {
|
|
97
110
|
return jsx("div", {
|
|
98
|
-
css: splitButtonStyles
|
|
111
|
+
css: [getBooleanFF('platform.design-system-team.component-visual-refresh_t8zbo') && appearance === 'default' && defaultAppearanceContainerStyles, splitButtonStyles]
|
|
99
112
|
}, children);
|
|
100
113
|
};
|
|
101
114
|
|
|
@@ -118,7 +131,9 @@ export const SplitButton = ({
|
|
|
118
131
|
PrimaryAction,
|
|
119
132
|
SecondaryAction
|
|
120
133
|
} = getActions(children);
|
|
121
|
-
return jsx(SplitButtonContainer,
|
|
134
|
+
return jsx(SplitButtonContainer, {
|
|
135
|
+
appearance: appearance
|
|
136
|
+
}, jsx(SplitButtonContext.Provider, {
|
|
122
137
|
value: {
|
|
123
138
|
appearance,
|
|
124
139
|
spacing,
|
|
@@ -144,7 +159,9 @@ export const SplitButtonWithSlots = ({
|
|
|
144
159
|
spacing = 'default',
|
|
145
160
|
isDisabled = false
|
|
146
161
|
}) => {
|
|
147
|
-
return jsx(SplitButtonContainer,
|
|
162
|
+
return jsx(SplitButtonContainer, {
|
|
163
|
+
appearance: appearance
|
|
164
|
+
}, jsx(SplitButtonContext.Provider, {
|
|
148
165
|
value: {
|
|
149
166
|
appearance,
|
|
150
167
|
spacing,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { Fragment } from 'react';
|
|
2
2
|
import Content from '../shared/content';
|
|
3
|
+
import IconRenderer from '../shared/icon-renderer';
|
|
3
4
|
import renderLoadingOverlay from '../shared/loading-overlay';
|
|
4
5
|
import useButtonBase from '../shared/use-button-base';
|
|
5
6
|
/**
|
|
@@ -19,8 +20,8 @@ const useDefaultButton = ({
|
|
|
19
20
|
autoFocus,
|
|
20
21
|
buttonType,
|
|
21
22
|
children,
|
|
22
|
-
iconAfter
|
|
23
|
-
iconBefore
|
|
23
|
+
iconAfter,
|
|
24
|
+
iconBefore,
|
|
24
25
|
interactionName,
|
|
25
26
|
isDisabled,
|
|
26
27
|
isLoading = false,
|
|
@@ -51,24 +52,22 @@ const useDefaultButton = ({
|
|
|
51
52
|
ariaLabel,
|
|
52
53
|
ariaLabelledBy,
|
|
53
54
|
buttonType,
|
|
54
|
-
children: /*#__PURE__*/React.createElement(Fragment, null,
|
|
55
|
+
children: /*#__PURE__*/React.createElement(Fragment, null, iconBefore && /*#__PURE__*/React.createElement(Content, {
|
|
55
56
|
type: "icon",
|
|
56
57
|
position: "before",
|
|
57
58
|
hasOverlay: hasOverlay
|
|
58
|
-
}, /*#__PURE__*/React.createElement(
|
|
59
|
-
|
|
60
|
-
size: UNSAFE_iconBefore_size
|
|
61
|
-
color: 'currentColor'
|
|
59
|
+
}, /*#__PURE__*/React.createElement(IconRenderer, {
|
|
60
|
+
icon: iconBefore,
|
|
61
|
+
size: UNSAFE_iconBefore_size
|
|
62
62
|
})), children && /*#__PURE__*/React.createElement(Content, {
|
|
63
63
|
hasOverlay: hasOverlay
|
|
64
|
-
}, children),
|
|
64
|
+
}, children), iconAfter && /*#__PURE__*/React.createElement(Content, {
|
|
65
65
|
type: "icon",
|
|
66
66
|
position: "after",
|
|
67
67
|
hasOverlay: hasOverlay
|
|
68
|
-
}, /*#__PURE__*/React.createElement(
|
|
69
|
-
|
|
70
|
-
size: UNSAFE_iconAfter_size
|
|
71
|
-
color: 'currentColor'
|
|
68
|
+
}, /*#__PURE__*/React.createElement(IconRenderer, {
|
|
69
|
+
icon: iconAfter,
|
|
70
|
+
size: UNSAFE_iconAfter_size
|
|
72
71
|
}))),
|
|
73
72
|
interactionName,
|
|
74
73
|
isDisabled,
|
|
@@ -94,8 +93,8 @@ const useDefaultButton = ({
|
|
|
94
93
|
ref,
|
|
95
94
|
shouldFitContainer,
|
|
96
95
|
spacing,
|
|
97
|
-
hasIconBefore: Boolean(
|
|
98
|
-
hasIconAfter: Boolean(
|
|
96
|
+
hasIconBefore: Boolean(iconBefore),
|
|
97
|
+
hasIconAfter: Boolean(iconAfter)
|
|
99
98
|
});
|
|
100
99
|
return baseProps;
|
|
101
100
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
3
3
|
import Content from '../shared/content';
|
|
4
|
+
import IconRenderer from '../shared/icon-renderer';
|
|
4
5
|
import renderLoadingOverlay from '../shared/loading-overlay';
|
|
5
6
|
import useButtonBase from '../shared/use-button-base';
|
|
6
7
|
/**
|
|
@@ -19,7 +20,7 @@ const useIconButton = ({
|
|
|
19
20
|
ariaLabelledBy,
|
|
20
21
|
autoFocus,
|
|
21
22
|
buttonType,
|
|
22
|
-
icon
|
|
23
|
+
icon,
|
|
23
24
|
interactionName,
|
|
24
25
|
isDisabled,
|
|
25
26
|
isLoading,
|
|
@@ -55,10 +56,9 @@ const useIconButton = ({
|
|
|
55
56
|
children: /*#__PURE__*/React.createElement(Content, {
|
|
56
57
|
type: "icon",
|
|
57
58
|
hasOverlay: hasOverlay
|
|
58
|
-
}, /*#__PURE__*/React.createElement(
|
|
59
|
-
|
|
60
|
-
size: UNSAFE_size
|
|
61
|
-
color: 'currentColor'
|
|
59
|
+
}, /*#__PURE__*/React.createElement(IconRenderer, {
|
|
60
|
+
icon: icon,
|
|
61
|
+
size: UNSAFE_size
|
|
62
62
|
}), /*#__PURE__*/React.createElement(VisuallyHidden, null, label)),
|
|
63
63
|
interactionName,
|
|
64
64
|
isDisabled,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
function isIconRenderProp(func) {
|
|
4
|
+
return !func.displayName &&
|
|
5
|
+
// most function components and class components have a displayName, negate them
|
|
6
|
+
!func.render &&
|
|
7
|
+
// forwardRef doesn't require a display name, however it does include a render function, negate them
|
|
8
|
+
typeof func === 'function' // at the very least we need to be a function
|
|
9
|
+
;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* __Icon renderer__
|
|
14
|
+
*
|
|
15
|
+
* Used to support render props with icons.
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
const IconRenderer = ({
|
|
19
|
+
icon: Icon,
|
|
20
|
+
size
|
|
21
|
+
}) => {
|
|
22
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, getBooleanFF('platform.design-system-team.button-render-prop-fix_lyo55') && isIconRenderProp(Icon) ? Icon({
|
|
23
|
+
label: '',
|
|
24
|
+
size: size,
|
|
25
|
+
color: 'currentColor'
|
|
26
|
+
}) : /*#__PURE__*/React.createElement(Icon, {
|
|
27
|
+
label: "",
|
|
28
|
+
size: size,
|
|
29
|
+
color: 'currentColor'
|
|
30
|
+
}));
|
|
31
|
+
};
|
|
32
|
+
export default IconRenderer;
|