@atlaskit/button 16.10.2 → 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 +16 -0
- package/dist/cjs/entry-points/new.js +8 -1
- package/dist/cjs/entry-points/unsafe.js +40 -1
- package/dist/cjs/new-button/containers/split-button/index.js +50 -0
- package/dist/cjs/new-button/containers/split-button/split-button-context.js +37 -0
- package/dist/cjs/new-button/containers/split-button/split-button.js +137 -0
- package/dist/cjs/new-button/containers/split-button/types.js +5 -0
- package/dist/cjs/new-button/containers/split-button/utils.js +23 -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 +19 -6
- package/dist/cjs/new-button/variants/shared/xcss.js +52 -10
- package/dist/cjs/old-button/shared/button-base.js +1 -1
- package/dist/cjs/utils/variants.js +73 -8
- package/dist/es2019/entry-points/new.js +2 -1
- package/dist/es2019/entry-points/unsafe.js +4 -1
- package/dist/es2019/new-button/containers/split-button/index.js +3 -0
- package/dist/es2019/new-button/containers/split-button/split-button-context.js +31 -0
- package/dist/es2019/new-button/containers/split-button/split-button.js +129 -0
- package/dist/es2019/new-button/containers/split-button/types.js +1 -0
- package/dist/es2019/new-button/containers/split-button/utils.js +12 -0
- 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 +19 -6
- package/dist/es2019/new-button/variants/shared/xcss.js +54 -10
- package/dist/es2019/old-button/shared/button-base.js +1 -1
- package/dist/es2019/utils/variants.js +69 -6
- package/dist/esm/entry-points/new.js +2 -1
- package/dist/esm/entry-points/unsafe.js +4 -1
- package/dist/esm/new-button/containers/split-button/index.js +3 -0
- package/dist/esm/new-button/containers/split-button/split-button-context.js +31 -0
- package/dist/esm/new-button/containers/split-button/split-button.js +131 -0
- package/dist/esm/new-button/containers/split-button/types.js +1 -0
- package/dist/esm/new-button/containers/split-button/utils.js +16 -0
- 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 +19 -6
- package/dist/esm/new-button/variants/shared/xcss.js +51 -10
- package/dist/esm/old-button/shared/button-base.js +1 -1
- package/dist/esm/utils/variants.js +75 -6
- package/dist/types/entry-points/new.d.ts +1 -0
- package/dist/types/entry-points/unsafe.d.ts +3 -0
- package/dist/types/new-button/containers/split-button/index.d.ts +3 -0
- package/dist/types/new-button/containers/split-button/split-button-context.d.ts +47 -0
- package/dist/types/new-button/containers/split-button/split-button.d.ts +47 -0
- package/dist/types/new-button/containers/split-button/types.d.ts +4 -0
- package/dist/types/new-button/containers/split-button/utils.d.ts +5 -0
- 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/shared/use-button-base.d.ts +1 -1
- package/dist/types/new-button/variants/shared/xcss.d.ts +14 -1
- package/dist/types/new-button/variants/types.d.ts +11 -1
- package/dist/types/old-button/types.d.ts +2 -2
- package/dist/types/utils/variants.d.ts +25 -3
- package/dist/types-ts4.5/containers/button-group.d.ts +12 -0
- package/dist/types-ts4.5/entry-points/button-group.d.ts +1 -0
- package/dist/types-ts4.5/entry-points/custom-theme-button.d.ts +2 -0
- package/dist/types-ts4.5/entry-points/loading-button.d.ts +2 -0
- package/dist/types-ts4.5/entry-points/new.d.ts +6 -0
- package/dist/types-ts4.5/entry-points/standard-button.d.ts +7 -0
- package/dist/types-ts4.5/entry-points/types.d.ts +4 -0
- package/dist/types-ts4.5/entry-points/unsafe.d.ts +4 -0
- package/dist/types-ts4.5/index.d.ts +8 -0
- package/dist/types-ts4.5/new-button/containers/split-button/index.d.ts +3 -0
- package/dist/types-ts4.5/new-button/containers/split-button/split-button-context.d.ts +47 -0
- package/dist/types-ts4.5/new-button/containers/split-button/split-button.d.ts +47 -0
- package/dist/types-ts4.5/new-button/containers/split-button/types.d.ts +4 -0
- package/dist/types-ts4.5/new-button/containers/split-button/utils.d.ts +5 -0
- package/dist/types-ts4.5/new-button/variants/default/button.d.ts +17 -0
- package/dist/types-ts4.5/new-button/variants/default/link.d.ts +20 -0
- package/dist/types-ts4.5/new-button/variants/default/types.d.ts +15 -0
- package/dist/types-ts4.5/new-button/variants/default/use-default-button.d.ts +15 -0
- package/dist/types-ts4.5/new-button/variants/icon/button.d.ts +15 -0
- package/dist/types-ts4.5/new-button/variants/icon/link.d.ts +20 -0
- package/dist/types-ts4.5/new-button/variants/icon/types.d.ts +8 -0
- package/dist/types-ts4.5/new-button/variants/icon/use-icon-button.d.ts +15 -0
- package/dist/types-ts4.5/new-button/variants/shared/block-events.d.ts +2 -0
- package/dist/types-ts4.5/new-button/variants/shared/colors.d.ts +18 -0
- package/dist/types-ts4.5/new-button/variants/shared/content.d.ts +13 -0
- package/dist/types-ts4.5/new-button/variants/shared/use-button-base.d.ts +37 -0
- package/dist/types-ts4.5/new-button/variants/shared/xcss.d.ts +31 -0
- package/dist/types-ts4.5/new-button/variants/types.d.ts +79 -0
- package/dist/types-ts4.5/old-button/button.d.ts +15 -0
- package/dist/types-ts4.5/old-button/custom-theme-button/custom-theme-button-types.d.ts +22 -0
- package/dist/types-ts4.5/old-button/custom-theme-button/custom-theme-button.d.ts +10 -0
- package/dist/types-ts4.5/old-button/custom-theme-button/index.d.ts +2 -0
- package/dist/types-ts4.5/old-button/custom-theme-button/theme.d.ts +21 -0
- package/dist/types-ts4.5/old-button/loading-button.d.ts +15 -0
- package/dist/types-ts4.5/old-button/shared/block-events.d.ts +4 -0
- package/dist/types-ts4.5/old-button/shared/button-base.d.ts +10 -0
- package/dist/types-ts4.5/old-button/shared/colors.d.ts +23 -0
- package/dist/types-ts4.5/old-button/shared/css.d.ts +22 -0
- package/dist/types-ts4.5/old-button/shared/get-if-visually-hidden-children.d.ts +2 -0
- package/dist/types-ts4.5/old-button/shared/get-is-only-single-icon.d.ts +2 -0
- package/dist/types-ts4.5/old-button/shared/loading-spinner.d.ts +5 -0
- package/dist/types-ts4.5/old-button/types.d.ts +94 -0
- package/dist/types-ts4.5/utils/appearances.d.ts +3 -0
- package/dist/types-ts4.5/utils/spacing.d.ts +3 -0
- package/dist/types-ts4.5/utils/variants.d.ts +37 -0
- package/package.json +4 -3
- package/tmp/api-report-tmp.d.ts +133 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/button
|
|
2
2
|
|
|
3
|
+
## 16.12.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#42305](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42305) [`4c9d4a7be34`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4c9d4a7be34) - - Link button variants (still in Alpha) `<LinkButton>` and `<LinkIconButton>` now support router link components through use of an app provider
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 16.11.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- [#41859](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41859) [`7c662f243b9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7c662f243b9) - Expose more UNSAFE exports from UNSAFE entry point for internal work. PLEASE DO NO USE ANYTHING FROM "UNSAFE" ENTRY POINT WITH "UNSAFE" PREFIX.
|
|
18
|
+
|
|
3
19
|
## 16.10.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -22,6 +22,12 @@ Object.defineProperty(exports, "LinkIconButton", {
|
|
|
22
22
|
return _link2.default;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
|
+
Object.defineProperty(exports, "SplitButton", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function get() {
|
|
28
|
+
return _splitButton.SplitButton;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
25
31
|
Object.defineProperty(exports, "default", {
|
|
26
32
|
enumerable: true,
|
|
27
33
|
get: function get() {
|
|
@@ -31,4 +37,5 @@ Object.defineProperty(exports, "default", {
|
|
|
31
37
|
var _button = _interopRequireDefault(require("../new-button/variants/default/button"));
|
|
32
38
|
var _link = _interopRequireDefault(require("../new-button/variants/default/link"));
|
|
33
39
|
var _button2 = _interopRequireDefault(require("../new-button/variants/icon/button"));
|
|
34
|
-
var _link2 = _interopRequireDefault(require("../new-button/variants/icon/link"));
|
|
40
|
+
var _link2 = _interopRequireDefault(require("../new-button/variants/icon/link"));
|
|
41
|
+
var _splitButton = require("../new-button/containers/split-button");
|
|
@@ -10,4 +10,43 @@ Object.defineProperty(exports, "UNSAFE_BUTTON", {
|
|
|
10
10
|
return _button.default;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
|
|
13
|
+
Object.defineProperty(exports, "UNSAFE_DIVIDER", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function get() {
|
|
16
|
+
return _splitButton.Divider;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "UNSAFE_GET_ACTIONS", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function get() {
|
|
22
|
+
return _splitButton.getActions;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "UNSAFE_ICON_BUTTON", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function get() {
|
|
28
|
+
return _button2.default;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "UNSAFE_SPLIT_BUTTON", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function get() {
|
|
34
|
+
return _splitButton.SplitButton;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, "UNSAFE_SPLIT_BUTTON_CONTAINER", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function get() {
|
|
40
|
+
return _splitButton.SplitButtonContainer;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(exports, "UNSAFE_SPLIT_BUTTON_CONTEXT", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function get() {
|
|
46
|
+
return _splitButtonContext.SplitButtonContext;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
var _button = _interopRequireDefault(require("../new-button/variants/default/button"));
|
|
50
|
+
var _button2 = _interopRequireDefault(require("../new-button/variants/icon/button"));
|
|
51
|
+
var _splitButton = require("../new-button/containers/split-button");
|
|
52
|
+
var _splitButtonContext = require("../new-button/containers/split-button/split-button-context");
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "Divider", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _splitButton.Divider;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "SplitButton", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _splitButton.SplitButton;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "SplitButtonContainer", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _splitButton.SplitButtonContainer;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "SplitButtonContext", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _splitButtonContext.SplitButtonContext;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "SplitButtonWithSlots", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _splitButton.SplitButtonWithSlots;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "getActions", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function get() {
|
|
39
|
+
return _utils.getActions;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "useSplitButtonContext", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function get() {
|
|
45
|
+
return _splitButtonContext.useSplitButtonContext;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
var _splitButton = require("./split-button");
|
|
49
|
+
var _utils = require("./utils");
|
|
50
|
+
var _splitButtonContext = require("./split-button-context");
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useSplitButtonContext = exports.SplitButtonContext = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
/**
|
|
9
|
+
* TODO: Add jsdoc
|
|
10
|
+
*/
|
|
11
|
+
var SplitButtonContext = exports.SplitButtonContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
12
|
+
var useSplitButtonContext = exports.useSplitButtonContext = function useSplitButtonContext() {
|
|
13
|
+
var context = (0, _react.useContext)(SplitButtonContext);
|
|
14
|
+
if (!context) {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
if (context.appearance === 'navigation') {
|
|
18
|
+
var newContext = {
|
|
19
|
+
spacing: 'default',
|
|
20
|
+
appearance: 'subtle',
|
|
21
|
+
isDisabled: false,
|
|
22
|
+
isActiveOverSelected: false,
|
|
23
|
+
isNavigationSplitButton: true,
|
|
24
|
+
isHighlighted: context.isHighlighted
|
|
25
|
+
};
|
|
26
|
+
return newContext;
|
|
27
|
+
}
|
|
28
|
+
var splitButtonContext = {
|
|
29
|
+
spacing: context.spacing,
|
|
30
|
+
appearance: context.appearance,
|
|
31
|
+
isDisabled: context.isDisabled,
|
|
32
|
+
isActiveOverSelected: true,
|
|
33
|
+
isNavigationSplitButton: false,
|
|
34
|
+
isHighlighted: false
|
|
35
|
+
};
|
|
36
|
+
return splitButtonContext;
|
|
37
|
+
};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SplitButtonWithSlots = exports.SplitButtonContainer = exports.SplitButton = exports.Divider = void 0;
|
|
7
|
+
var _react = require("@emotion/react");
|
|
8
|
+
var _constants = require("@atlaskit/theme/constants");
|
|
9
|
+
var _splitButtonContext = require("./split-button-context");
|
|
10
|
+
var _utils = require("./utils");
|
|
11
|
+
/** @jsx jsx */
|
|
12
|
+
|
|
13
|
+
var fontSize = (0, _constants.fontSize)();
|
|
14
|
+
var defaultDividerHeight = 20 / fontSize + 'em';
|
|
15
|
+
var defaultDividerStyles = (0, _react.css)({
|
|
16
|
+
height: defaultDividerHeight,
|
|
17
|
+
margin: "var(--ds-space-075, 6px)".concat(" -0.5px")
|
|
18
|
+
});
|
|
19
|
+
var compactDividerHeight = 16 / fontSize + 'em';
|
|
20
|
+
var compactDividerStyles = (0, _react.css)({
|
|
21
|
+
height: compactDividerHeight,
|
|
22
|
+
margin: "var(--ds-space-050, 4px)".concat(" -0.5px")
|
|
23
|
+
});
|
|
24
|
+
var baseDividerStyles = (0, _react.css)({
|
|
25
|
+
display: 'inline-flex',
|
|
26
|
+
width: '1px',
|
|
27
|
+
position: 'relative',
|
|
28
|
+
zIndex: 2
|
|
29
|
+
});
|
|
30
|
+
var disabledStyles = (0, _react.css)({
|
|
31
|
+
backgroundColor: "var(--ds-border, #091E4224)",
|
|
32
|
+
cursor: 'not-allowed'
|
|
33
|
+
});
|
|
34
|
+
var navigationDividerStyles = (0, _react.css)({
|
|
35
|
+
height: compactDividerHeight,
|
|
36
|
+
margin: "var(--ds-space-100, 8px)".concat(" -0.5px"),
|
|
37
|
+
backgroundColor: "var(--ds-border, #0052cc)"
|
|
38
|
+
});
|
|
39
|
+
var dividerAppearance = {
|
|
40
|
+
default: (0, _react.css)({
|
|
41
|
+
backgroundColor: "var(--ds-text, #172B4D)"
|
|
42
|
+
}),
|
|
43
|
+
primary: (0, _react.css)({
|
|
44
|
+
backgroundColor: "var(--ds-text-inverse, #FFF)"
|
|
45
|
+
}),
|
|
46
|
+
danger: (0, _react.css)({
|
|
47
|
+
backgroundColor: "var(--ds-text-inverse, #FFF)"
|
|
48
|
+
}),
|
|
49
|
+
warning: (0, _react.css)({
|
|
50
|
+
backgroundColor: "var(--ds-text-warning-inverse, #172B4D)"
|
|
51
|
+
}),
|
|
52
|
+
navigation: navigationDividerStyles
|
|
53
|
+
};
|
|
54
|
+
var dividerHeight = {
|
|
55
|
+
default: defaultDividerStyles,
|
|
56
|
+
compact: compactDividerStyles
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* TODO: Add JSDoc
|
|
60
|
+
*/
|
|
61
|
+
var Divider = exports.Divider = function Divider(_ref) {
|
|
62
|
+
var appearance = _ref.appearance,
|
|
63
|
+
spacing = _ref.spacing,
|
|
64
|
+
_ref$isDisabled = _ref.isDisabled,
|
|
65
|
+
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled;
|
|
66
|
+
return (
|
|
67
|
+
// I find it funny to provide a div for Divider
|
|
68
|
+
(0, _react.jsx)("div", {
|
|
69
|
+
css: [baseDividerStyles, dividerAppearance[appearance], dividerHeight[spacing], isDisabled ? disabledStyles : undefined]
|
|
70
|
+
})
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
var splitButtonStyles = (0, _react.css)({
|
|
74
|
+
display: 'inline-flex',
|
|
75
|
+
position: 'relative',
|
|
76
|
+
whiteSpace: 'nowrap'
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* TODO: Add JSdoc
|
|
81
|
+
*/
|
|
82
|
+
var SplitButtonContainer = exports.SplitButtonContainer = function SplitButtonContainer(_ref2) {
|
|
83
|
+
var children = _ref2.children;
|
|
84
|
+
return (0, _react.jsx)("div", {
|
|
85
|
+
css: splitButtonStyles
|
|
86
|
+
}, children);
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* TODO: Add description when adding docs
|
|
90
|
+
*/
|
|
91
|
+
var SplitButton = exports.SplitButton = function SplitButton(_ref3) {
|
|
92
|
+
var children = _ref3.children,
|
|
93
|
+
_ref3$appearance = _ref3.appearance,
|
|
94
|
+
appearance = _ref3$appearance === void 0 ? 'default' : _ref3$appearance,
|
|
95
|
+
_ref3$spacing = _ref3.spacing,
|
|
96
|
+
spacing = _ref3$spacing === void 0 ? 'default' : _ref3$spacing,
|
|
97
|
+
_ref3$isDisabled = _ref3.isDisabled,
|
|
98
|
+
isDisabled = _ref3$isDisabled === void 0 ? false : _ref3$isDisabled;
|
|
99
|
+
var _getActions = (0, _utils.getActions)(children),
|
|
100
|
+
PrimaryAction = _getActions.PrimaryAction,
|
|
101
|
+
SecondaryAction = _getActions.SecondaryAction;
|
|
102
|
+
return (0, _react.jsx)(SplitButtonContainer, null, (0, _react.jsx)(_splitButtonContext.SplitButtonContext.Provider, {
|
|
103
|
+
value: {
|
|
104
|
+
appearance: appearance,
|
|
105
|
+
spacing: spacing,
|
|
106
|
+
isDisabled: isDisabled
|
|
107
|
+
}
|
|
108
|
+
}, PrimaryAction, (0, _react.jsx)(Divider, {
|
|
109
|
+
appearance: appearance,
|
|
110
|
+
spacing: spacing,
|
|
111
|
+
isDisabled: isDisabled
|
|
112
|
+
}), SecondaryAction));
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* TODO: Decide on API
|
|
116
|
+
*/
|
|
117
|
+
var SplitButtonWithSlots = exports.SplitButtonWithSlots = function SplitButtonWithSlots(_ref4) {
|
|
118
|
+
var primaryAction = _ref4.primaryAction,
|
|
119
|
+
secondaryAction = _ref4.secondaryAction,
|
|
120
|
+
_ref4$appearance = _ref4.appearance,
|
|
121
|
+
appearance = _ref4$appearance === void 0 ? 'default' : _ref4$appearance,
|
|
122
|
+
_ref4$spacing = _ref4.spacing,
|
|
123
|
+
spacing = _ref4$spacing === void 0 ? 'default' : _ref4$spacing,
|
|
124
|
+
_ref4$isDisabled = _ref4.isDisabled,
|
|
125
|
+
isDisabled = _ref4$isDisabled === void 0 ? false : _ref4$isDisabled;
|
|
126
|
+
return (0, _react.jsx)(SplitButtonContainer, null, (0, _react.jsx)(_splitButtonContext.SplitButtonContext.Provider, {
|
|
127
|
+
value: {
|
|
128
|
+
appearance: appearance,
|
|
129
|
+
spacing: spacing,
|
|
130
|
+
isDisabled: isDisabled
|
|
131
|
+
}
|
|
132
|
+
}, primaryAction, (0, _react.jsx)(Divider, {
|
|
133
|
+
appearance: appearance,
|
|
134
|
+
spacing: spacing,
|
|
135
|
+
isDisabled: isDisabled
|
|
136
|
+
}), secondaryAction));
|
|
137
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getActions = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var getActions = exports.getActions = function getActions(children) {
|
|
11
|
+
var _Children$toArray = _react.Children.toArray(children),
|
|
12
|
+
_Children$toArray2 = (0, _slicedToArray2.default)(_Children$toArray, 2),
|
|
13
|
+
PrimaryAction = _Children$toArray2[0],
|
|
14
|
+
SecondaryAction = _Children$toArray2[1];
|
|
15
|
+
if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development' && (!PrimaryAction || !SecondaryAction)) {
|
|
16
|
+
// TODO: i18n?
|
|
17
|
+
throw new SyntaxError('SplitButton requires two children to be provided');
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
PrimaryAction: PrimaryAction,
|
|
21
|
+
SecondaryAction: SecondaryAction
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = void 0;
|
|
8
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
-
var _react =
|
|
11
|
-
var
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _link = _interopRequireDefault(require("@atlaskit/primitives/link"));
|
|
12
13
|
var _useDefaultButton = _interopRequireDefault(require("./use-default-button"));
|
|
13
14
|
var _excluded = ["analyticsContext", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "iconBefore", "iconAfter", "children", "shouldFitContainer", "interactionName", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "testId", "href"];
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* A link button renders a link in the style of a button.
|
|
18
|
-
*
|
|
19
|
-
* - [Examples](https://atlassian.design/components/button/examples)
|
|
20
|
-
* - [Code](https://atlassian.design/components/button/code)
|
|
21
|
-
* - [Usage](https://atlassian.design/components/button/usage)
|
|
22
|
-
*/
|
|
23
|
-
var LinkButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwardRef(function LinkButton(_ref, ref) {
|
|
15
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
+
var LinkButtonBase = function LinkButtonBase(_ref, ref) {
|
|
24
18
|
var analyticsContext = _ref.analyticsContext,
|
|
25
19
|
autoFocus = _ref.autoFocus,
|
|
26
20
|
appearance = _ref.appearance,
|
|
@@ -72,34 +66,45 @@ var LinkButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
|
|
|
72
66
|
shouldFitContainer: shouldFitContainer,
|
|
73
67
|
spacing: spacing
|
|
74
68
|
});
|
|
75
|
-
return (
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
69
|
+
return /*#__PURE__*/_react.default.createElement(_link.default
|
|
70
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
71
|
+
, (0, _extends2.default)({}, rest, {
|
|
72
|
+
ref: baseProps.ref,
|
|
73
|
+
xcss: baseProps.xcss,
|
|
74
|
+
onClick: baseProps.onClick,
|
|
75
|
+
onMouseDownCapture: baseProps.onMouseDownCapture,
|
|
76
|
+
onMouseUpCapture: baseProps.onMouseUpCapture,
|
|
77
|
+
onKeyDownCapture: baseProps.onKeyDownCapture,
|
|
78
|
+
onKeyUpCapture: baseProps.onKeyUpCapture,
|
|
79
|
+
onTouchStartCapture: baseProps.onTouchStartCapture,
|
|
80
|
+
onTouchEndCapture: baseProps.onTouchEndCapture,
|
|
81
|
+
onPointerDownCapture: baseProps.onPointerDownCapture,
|
|
82
|
+
onPointerUpCapture: baseProps.onPointerUpCapture,
|
|
83
|
+
onClickCapture: baseProps.onClickCapture,
|
|
84
|
+
testId: testId
|
|
85
|
+
/**
|
|
86
|
+
* Disable link in an accessible way using `href`, `role`, and `aria-disabled`.
|
|
87
|
+
* @see https://a11y-guidelines.orange.com/en/articles/disable-elements/#disable-a-link
|
|
88
|
+
*/
|
|
89
|
+
// @ts-expect-error (`href` is required, we could make it optional but don't want to encourage this pattern elsewhere)
|
|
90
|
+
,
|
|
91
|
+
href: baseProps.isDisabled ? undefined : href,
|
|
92
|
+
role: baseProps.isDisabled ? 'link' : undefined,
|
|
93
|
+
"aria-disabled": baseProps.isDisabled === true ? true : undefined
|
|
94
|
+
}), baseProps.children);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// Workarounds to support generic types with forwardRef + memo
|
|
98
|
+
var WithRef = /*#__PURE__*/(0, _react.forwardRef)(LinkButtonBase);
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* __Link Button__
|
|
102
|
+
*
|
|
103
|
+
* Renders a link in the style of a button.
|
|
104
|
+
*
|
|
105
|
+
* - [Examples](https://atlassian.design/components/button/examples)
|
|
106
|
+
* - [Code](https://atlassian.design/components/button/code)
|
|
107
|
+
* - [Usage](https://atlassian.design/components/button/usage)
|
|
108
|
+
*/
|
|
109
|
+
var LinkButton = /*#__PURE__*/(0, _react.memo)(WithRef);
|
|
105
110
|
var _default = exports.default = LinkButton;
|
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = void 0;
|
|
8
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
-
var _react =
|
|
11
|
-
var
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _link = _interopRequireDefault(require("@atlaskit/primitives/link"));
|
|
12
13
|
var _useIconButton = _interopRequireDefault(require("./use-icon-button"));
|
|
13
14
|
var _excluded = ["analyticsContext", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "icon", "children", "interactionName", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "testId", "href"];
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* A link button renders a link in the style of a button.
|
|
18
|
-
*
|
|
19
|
-
* - [Examples](https://atlassian.design/components/button/examples)
|
|
20
|
-
* - [Code](https://atlassian.design/components/button/code)
|
|
21
|
-
* - [Usage](https://atlassian.design/components/button/usage)
|
|
22
|
-
*/
|
|
23
|
-
var LinkIconButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwardRef(function LinkIconButton(_ref, ref) {
|
|
15
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
+
var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
24
18
|
var analyticsContext = _ref.analyticsContext,
|
|
25
19
|
autoFocus = _ref.autoFocus,
|
|
26
20
|
appearance = _ref.appearance,
|
|
@@ -68,34 +62,45 @@ var LinkIconButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.defau
|
|
|
68
62
|
ref: ref,
|
|
69
63
|
spacing: spacing
|
|
70
64
|
});
|
|
71
|
-
return (
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
65
|
+
return /*#__PURE__*/_react.default.createElement(_link.default
|
|
66
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
67
|
+
, (0, _extends2.default)({}, rest, {
|
|
68
|
+
ref: baseProps.ref,
|
|
69
|
+
xcss: baseProps.xcss,
|
|
70
|
+
onClick: baseProps.onClick,
|
|
71
|
+
onMouseDownCapture: baseProps.onMouseDownCapture,
|
|
72
|
+
onMouseUpCapture: baseProps.onMouseUpCapture,
|
|
73
|
+
onKeyDownCapture: baseProps.onKeyDownCapture,
|
|
74
|
+
onKeyUpCapture: baseProps.onKeyUpCapture,
|
|
75
|
+
onTouchStartCapture: baseProps.onTouchStartCapture,
|
|
76
|
+
onTouchEndCapture: baseProps.onTouchEndCapture,
|
|
77
|
+
onPointerDownCapture: baseProps.onPointerDownCapture,
|
|
78
|
+
onPointerUpCapture: baseProps.onPointerUpCapture,
|
|
79
|
+
onClickCapture: baseProps.onClickCapture,
|
|
80
|
+
testId: testId
|
|
81
|
+
/**
|
|
82
|
+
* Disable link in an accessible way using `href`, `role`, and `aria-disabled`.
|
|
83
|
+
* @see https://a11y-guidelines.orange.com/en/articles/disable-elements/#disable-a-link
|
|
84
|
+
*/
|
|
85
|
+
// @ts-expect-error (`href` is required, we could make it optional but don't want to encourage this pattern elsewhere)
|
|
86
|
+
,
|
|
87
|
+
href: baseProps.isDisabled ? undefined : href,
|
|
88
|
+
role: baseProps.isDisabled ? 'link' : undefined,
|
|
89
|
+
"aria-disabled": baseProps.isDisabled === true ? true : undefined
|
|
90
|
+
}), baseProps.children);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// Workarounds to support generic types with forwardRef + memo
|
|
94
|
+
var WithRef = /*#__PURE__*/(0, _react.forwardRef)(LinkIconButtonBase);
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* __Link Icon Button__
|
|
98
|
+
*
|
|
99
|
+
* Renders a link in the style of an icon button.
|
|
100
|
+
*
|
|
101
|
+
* - [Examples](https://atlassian.design/components/button/examples)
|
|
102
|
+
* - [Code](https://atlassian.design/components/button/code)
|
|
103
|
+
* - [Usage](https://atlassian.design/components/button/usage)
|
|
104
|
+
*/
|
|
105
|
+
var LinkIconButton = /*#__PURE__*/(0, _react.memo)(WithRef);
|
|
101
106
|
var _default = exports.default = LinkIconButton;
|
|
@@ -13,6 +13,7 @@ var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
|
13
13
|
var _useAutoFocus = _interopRequireDefault(require("@atlaskit/ds-lib/use-auto-focus"));
|
|
14
14
|
var _interactionContext = _interopRequireDefault(require("@atlaskit/interaction-context"));
|
|
15
15
|
var _primitives = require("@atlaskit/primitives");
|
|
16
|
+
var _splitButtonContext = require("../../containers/split-button/split-button-context");
|
|
16
17
|
var _blockEvents = _interopRequireDefault(require("./block-events"));
|
|
17
18
|
var _xcss = require("./xcss");
|
|
18
19
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -48,13 +49,13 @@ var overlayStyles = (0, _primitives.xcss)({
|
|
|
48
49
|
var useButtonBase = function useButtonBase(_ref) {
|
|
49
50
|
var analyticsContext = _ref.analyticsContext,
|
|
50
51
|
_ref$appearance = _ref.appearance,
|
|
51
|
-
|
|
52
|
+
propAppearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
|
|
52
53
|
_ref$autoFocus = _ref.autoFocus,
|
|
53
54
|
autoFocus = _ref$autoFocus === void 0 ? false : _ref$autoFocus,
|
|
54
55
|
buttonType = _ref.buttonType,
|
|
55
56
|
interactionName = _ref.interactionName,
|
|
56
57
|
_ref$isDisabled = _ref.isDisabled,
|
|
57
|
-
|
|
58
|
+
propIsDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
58
59
|
_ref$isSelected = _ref.isSelected,
|
|
59
60
|
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
|
|
60
61
|
_ref$isIconButton = _ref.isIconButton,
|
|
@@ -80,8 +81,16 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
80
81
|
_ref$shouldFitContain = _ref.shouldFitContainer,
|
|
81
82
|
shouldFitContainer = _ref$shouldFitContain === void 0 ? false : _ref$shouldFitContain,
|
|
82
83
|
_ref$spacing = _ref.spacing,
|
|
83
|
-
|
|
84
|
+
propSpacing = _ref$spacing === void 0 ? 'default' : _ref$spacing;
|
|
84
85
|
var ourRef = (0, _react.useRef)();
|
|
86
|
+
var splitButtonContext = (0, _splitButtonContext.useSplitButtonContext)();
|
|
87
|
+
var isSplitButton = Boolean(splitButtonContext);
|
|
88
|
+
var isNavigationSplitButton = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isNavigationSplitButton) || false;
|
|
89
|
+
var appearance = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.appearance) || propAppearance;
|
|
90
|
+
var spacing = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.spacing) || propSpacing;
|
|
91
|
+
var isDisabled = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isDisabled) || propIsDisabled;
|
|
92
|
+
var isHighlighted = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isHighlighted) || false;
|
|
93
|
+
var isActiveOverSelected = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isActiveOverSelected) || false;
|
|
85
94
|
var setRef = (0, _react.useCallback)(function (node) {
|
|
86
95
|
ourRef.current = node;
|
|
87
96
|
if (ref === null) {
|
|
@@ -106,7 +115,7 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
106
115
|
action: 'clicked',
|
|
107
116
|
componentName: 'button',
|
|
108
117
|
packageName: "@atlaskit/button",
|
|
109
|
-
packageVersion: "16.
|
|
118
|
+
packageVersion: "16.12.0",
|
|
110
119
|
analyticsData: analyticsContext,
|
|
111
120
|
actionSubject: buttonType
|
|
112
121
|
});
|
|
@@ -116,14 +125,18 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
116
125
|
spacing: spacing,
|
|
117
126
|
isDisabled: isDisabled,
|
|
118
127
|
isSelected: isSelected,
|
|
128
|
+
isHighlighted: isHighlighted,
|
|
129
|
+
isActiveOverSelected: isActiveOverSelected,
|
|
119
130
|
shouldFitContainer: shouldFitContainer,
|
|
120
131
|
isIconButton: isIconButton,
|
|
121
132
|
hasOverlay: Boolean(overlay),
|
|
122
133
|
isLink: buttonType === 'link',
|
|
123
134
|
hasIconBefore: hasIconBefore,
|
|
124
|
-
hasIconAfter: hasIconAfter
|
|
135
|
+
hasIconAfter: hasIconAfter,
|
|
136
|
+
isSplit: isSplitButton,
|
|
137
|
+
isNavigationSplit: isNavigationSplitButton
|
|
125
138
|
});
|
|
126
|
-
}, [appearance, buttonType, spacing, isDisabled, isSelected, isIconButton, shouldFitContainer, overlay, hasIconBefore, hasIconAfter]);
|
|
139
|
+
}, [appearance, buttonType, spacing, isDisabled, isSelected, isHighlighted, isActiveOverSelected, isIconButton, shouldFitContainer, overlay, hasIconBefore, hasIconAfter, isSplitButton, isNavigationSplitButton]);
|
|
127
140
|
var isEffectivelyDisabled = isDisabled || Boolean(overlay);
|
|
128
141
|
return _objectSpread({
|
|
129
142
|
ref: setRef,
|