@atlaskit/flag 14.6.1 → 14.6.4
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 +19 -0
- package/__perf__/{withFlagGroup.tsx → with-flag-group.tsx} +2 -1
- package/dist/cjs/auto-dismiss-flag.js +12 -2
- package/dist/cjs/flag-actions.js +3 -2
- package/dist/cjs/flag-group.js +13 -3
- package/dist/cjs/flag-provider.js +5 -0
- package/dist/cjs/flag.js +11 -1
- package/dist/cjs/internal/description.js +2 -1
- package/dist/cjs/internal/expander.js +2 -1
- package/dist/cjs/internal/title.js +2 -1
- package/dist/cjs/types.js +3 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/auto-dismiss-flag.js +11 -2
- package/dist/es2019/flag-actions.js +3 -2
- package/dist/es2019/flag-group.js +13 -3
- package/dist/es2019/flag-provider.js +5 -0
- package/dist/es2019/flag.js +11 -1
- package/dist/es2019/internal/description.js +2 -1
- package/dist/es2019/internal/expander.js +2 -1
- package/dist/es2019/internal/title.js +2 -1
- package/dist/es2019/types.js +2 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/auto-dismiss-flag.js +11 -2
- package/dist/esm/flag-actions.js +3 -2
- package/dist/esm/flag-group.js +13 -3
- package/dist/esm/flag-provider.js +5 -0
- package/dist/esm/flag.js +11 -1
- package/dist/esm/internal/description.js +2 -1
- package/dist/esm/internal/expander.js +2 -1
- package/dist/esm/internal/title.js +2 -1
- package/dist/esm/types.js +2 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/auto-dismiss-flag.d.ts +8 -0
- package/dist/types/flag-actions.d.ts +2 -2
- package/dist/types/flag-group.d.ts +22 -5
- package/dist/types/flag-provider.d.ts +9 -2
- package/dist/types/flag.d.ts +10 -0
- package/dist/types/types.d.ts +41 -19
- package/package.json +9 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/flag
|
|
2
2
|
|
|
3
|
+
## 14.6.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade Typescript from `4.2.4` to `4.3.5`.
|
|
8
|
+
|
|
9
|
+
## 14.6.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`8202e37941b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8202e37941b) - Internal code change turning on new linting rules.
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
16
|
+
## 14.6.2
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- [`982f05dc6b9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/982f05dc6b9) - [ux] Remove left indentation on bold flag's actions section
|
|
21
|
+
|
|
3
22
|
## 14.6.1
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
+
import noop from '@atlaskit/ds-lib/noop';
|
|
3
4
|
import SuccessIcon from '@atlaskit/icon/glyph/check-circle';
|
|
4
5
|
import { G400 } from '@atlaskit/theme/colors';
|
|
5
6
|
import { token } from '@atlaskit/tokens';
|
|
@@ -20,7 +21,7 @@ export default () => (
|
|
|
20
21
|
key="success"
|
|
21
22
|
title="Connected"
|
|
22
23
|
description="All wires now hooked up."
|
|
23
|
-
actions={[{ content: 'Alrighty then', onClick:
|
|
24
|
+
actions={[{ content: 'Alrighty then', onClick: noop }]}
|
|
24
25
|
/>
|
|
25
26
|
</FlagGroup>
|
|
26
27
|
);
|
|
@@ -26,8 +26,17 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
26
26
|
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; }
|
|
27
27
|
|
|
28
28
|
var packageName = "@atlaskit/flag";
|
|
29
|
-
var packageVersion = "14.6.
|
|
29
|
+
var packageVersion = "14.6.4";
|
|
30
30
|
var AUTO_DISMISS_SECONDS = 8;
|
|
31
|
+
/**
|
|
32
|
+
* __Auto dismiss flag__
|
|
33
|
+
*
|
|
34
|
+
* An auto dismiss flag is dismissed automatically after eight seconds.
|
|
35
|
+
*
|
|
36
|
+
* - [Examples](https://atlassian.design/components/flag/auto-dismiss-flag/examples)
|
|
37
|
+
* - [Code](https://atlassian.design/components/flag/auto-dismiss-flag/code)
|
|
38
|
+
*/
|
|
39
|
+
|
|
31
40
|
exports.AUTO_DISMISS_SECONDS = AUTO_DISMISS_SECONDS;
|
|
32
41
|
|
|
33
42
|
var AutoDismissFlag = function AutoDismissFlag(props) {
|
|
@@ -77,7 +86,8 @@ var AutoDismissFlag = function AutoDismissFlag(props) {
|
|
|
77
86
|
startAutoDismissTimer();
|
|
78
87
|
return stopAutoDismissTimer;
|
|
79
88
|
}, [startAutoDismissTimer, stopAutoDismissTimer]);
|
|
80
|
-
return /*#__PURE__*/_react.default.createElement(_flag.default
|
|
89
|
+
return /*#__PURE__*/_react.default.createElement(_flag.default // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
90
|
+
, (0, _extends2.default)({}, props, {
|
|
81
91
|
onMouseOver: stopAutoDismissTimer,
|
|
82
92
|
onFocus: stopAutoDismissTimer,
|
|
83
93
|
onMouseOut: startAutoDismissTimer,
|
package/dist/cjs/flag-actions.js
CHANGED
|
@@ -60,7 +60,7 @@ var appeanceNormalButtonStyles = (0, _core.css)({
|
|
|
60
60
|
});
|
|
61
61
|
var isBoldButtonStyles = (0, _core.css)({
|
|
62
62
|
'&&, a&&': {
|
|
63
|
-
|
|
63
|
+
marginRight: gridSize
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
|
|
@@ -102,7 +102,8 @@ var FlagActions = function FlagActions(props) {
|
|
|
102
102
|
css: [buttonStyles, isBold && isBoldButtonStyles, appearance === 'normal' && appeanceNormalButtonStyles]
|
|
103
103
|
}, action.content)];
|
|
104
104
|
}));
|
|
105
|
-
};
|
|
105
|
+
}; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
106
|
+
|
|
106
107
|
|
|
107
108
|
var _default = FlagActions;
|
|
108
109
|
exports.default = _default;
|
package/dist/cjs/flag-group.js
CHANGED
|
@@ -35,10 +35,12 @@ exports.flagAnimationTime = flagAnimationTime;
|
|
|
35
35
|
var flagBottom = gridSize * 6;
|
|
36
36
|
var flagLeft = gridSize * 10;
|
|
37
37
|
var defaultFlagGroupContext = {
|
|
38
|
-
onDismissed:
|
|
38
|
+
onDismissed: _noop.default,
|
|
39
39
|
isDismissAllowed: false
|
|
40
|
-
};
|
|
41
|
-
|
|
40
|
+
}; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
41
|
+
|
|
42
|
+
var FlagGroupContext = /*#__PURE__*/(0, _react.createContext)(defaultFlagGroupContext); // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
43
|
+
|
|
42
44
|
exports.FlagGroupContext = FlagGroupContext;
|
|
43
45
|
|
|
44
46
|
function useFlagGroup() {
|
|
@@ -92,6 +94,14 @@ var flagGroupContainerStyles = (0, _core.css)({
|
|
|
92
94
|
left: 0
|
|
93
95
|
}
|
|
94
96
|
});
|
|
97
|
+
/**
|
|
98
|
+
* __Flag group__
|
|
99
|
+
*
|
|
100
|
+
* A flag group is used to group a set of related flags, with entry and exit animations.
|
|
101
|
+
*
|
|
102
|
+
* - [Examples](https://atlassian.design/components/flag/flag-group/examples)
|
|
103
|
+
* - [Code](https://atlassian.design/components/flag/flag-group/code)
|
|
104
|
+
*/
|
|
95
105
|
|
|
96
106
|
var FlagGroup = function FlagGroup(props) {
|
|
97
107
|
var id = props.id,
|
|
@@ -40,6 +40,11 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
40
40
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
41
41
|
|
|
42
42
|
var FlagContext = /*#__PURE__*/_react.default.createContext(null);
|
|
43
|
+
/**
|
|
44
|
+
* useFlags is used to access the `showFlags` function which can be used to programatically display flags.
|
|
45
|
+
* - [Examples](https://atlassian.design/components/flag/flags-provider/examples#using-showflags)
|
|
46
|
+
*/
|
|
47
|
+
|
|
43
48
|
|
|
44
49
|
function useFlags() {
|
|
45
50
|
var api = (0, _react.useContext)(FlagContext);
|
package/dist/cjs/flag.js
CHANGED
|
@@ -44,7 +44,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
44
44
|
var analyticsAttributes = {
|
|
45
45
|
componentName: 'flag',
|
|
46
46
|
packageName: "@atlaskit/flag",
|
|
47
|
-
packageVersion: "14.6.
|
|
47
|
+
packageVersion: "14.6.4"
|
|
48
48
|
};
|
|
49
49
|
var gridSize = (0, _constants.gridSize)();
|
|
50
50
|
var doubleGridSize = gridSize * 2;
|
|
@@ -70,6 +70,16 @@ var flagContainerStyles = (0, _core.css)({
|
|
|
70
70
|
borderRadius: (0, _constants.borderRadius)(),
|
|
71
71
|
transition: 'background-color 200ms'
|
|
72
72
|
});
|
|
73
|
+
/**
|
|
74
|
+
* __Flag__
|
|
75
|
+
*
|
|
76
|
+
* A flag is used for confirmations, alerts, and acknowledgments that require minimal user interaction,
|
|
77
|
+
* often displayed using a flag group.
|
|
78
|
+
*
|
|
79
|
+
* - [Examples](https://atlassian.design/components/flag/examples)
|
|
80
|
+
* - [Code](https://atlassian.design/components/flag/code)
|
|
81
|
+
* - [Usage](https://atlassian.design/components/flag/usage)
|
|
82
|
+
*/
|
|
73
83
|
|
|
74
84
|
var Flag = function Flag(props) {
|
|
75
85
|
var _props$actions = props.actions,
|
|
@@ -27,7 +27,8 @@ var Description = function Description(_ref) {
|
|
|
27
27
|
css: [descriptionStyles],
|
|
28
28
|
"data-testid": testId
|
|
29
29
|
}, children);
|
|
30
|
-
};
|
|
30
|
+
}; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
31
|
+
|
|
31
32
|
|
|
32
33
|
var _default = Description;
|
|
33
34
|
exports.default = _default;
|
|
@@ -44,7 +44,8 @@ var Expander = function Expander(_ref) {
|
|
|
44
44
|
}, isExpanded && (0, _core.jsx)(_motion.FadeIn, null, function (props) {
|
|
45
45
|
return (0, _core.jsx)("div", props, children);
|
|
46
46
|
})));
|
|
47
|
-
};
|
|
47
|
+
}; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
48
|
+
|
|
48
49
|
|
|
49
50
|
var _default = Expander;
|
|
50
51
|
exports.default = _default;
|
package/dist/cjs/types.js
CHANGED
|
@@ -4,7 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.AppearanceArray = void 0;
|
|
7
|
+
|
|
8
|
+
/* eslint-disable @repo/internal/react/consistent-types-definitions */
|
|
7
9
|
// exported for testing - keep in sync from `type AppearanceTypes`
|
|
10
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
8
11
|
var AppearanceArray = ['error', 'info', 'normal', 'success', 'warning']; // CreateFlagsArg makes id optional so define this prop separately
|
|
9
12
|
|
|
10
13
|
exports.AppearanceArray = AppearanceArray;
|
package/dist/cjs/version.json
CHANGED
|
@@ -5,8 +5,16 @@ import noop from '@atlaskit/ds-lib/noop';
|
|
|
5
5
|
import Flag from './flag';
|
|
6
6
|
import { useFlagGroup } from './flag-group';
|
|
7
7
|
const packageName = "@atlaskit/flag";
|
|
8
|
-
const packageVersion = "14.6.
|
|
8
|
+
const packageVersion = "14.6.4";
|
|
9
9
|
export const AUTO_DISMISS_SECONDS = 8;
|
|
10
|
+
/**
|
|
11
|
+
* __Auto dismiss flag__
|
|
12
|
+
*
|
|
13
|
+
* An auto dismiss flag is dismissed automatically after eight seconds.
|
|
14
|
+
*
|
|
15
|
+
* - [Examples](https://atlassian.design/components/flag/auto-dismiss-flag/examples)
|
|
16
|
+
* - [Code](https://atlassian.design/components/flag/auto-dismiss-flag/code)
|
|
17
|
+
*/
|
|
10
18
|
|
|
11
19
|
const AutoDismissFlag = props => {
|
|
12
20
|
const {
|
|
@@ -55,7 +63,8 @@ const AutoDismissFlag = props => {
|
|
|
55
63
|
startAutoDismissTimer();
|
|
56
64
|
return stopAutoDismissTimer;
|
|
57
65
|
}, [startAutoDismissTimer, stopAutoDismissTimer]);
|
|
58
|
-
return /*#__PURE__*/React.createElement(Flag
|
|
66
|
+
return /*#__PURE__*/React.createElement(Flag // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
67
|
+
, _extends({}, props, {
|
|
59
68
|
onMouseOver: stopAutoDismissTimer,
|
|
60
69
|
onFocus: stopAutoDismissTimer,
|
|
61
70
|
onMouseOut: startAutoDismissTimer,
|
|
@@ -46,7 +46,7 @@ const appeanceNormalButtonStyles = css({
|
|
|
46
46
|
});
|
|
47
47
|
const isBoldButtonStyles = css({
|
|
48
48
|
'&&, a&&': {
|
|
49
|
-
|
|
49
|
+
marginRight: gridSize
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
|
|
@@ -86,6 +86,7 @@ const FlagActions = props => {
|
|
|
86
86
|
},
|
|
87
87
|
css: [buttonStyles, isBold && isBoldButtonStyles, appearance === 'normal' && appeanceNormalButtonStyles]
|
|
88
88
|
}, action.content)]));
|
|
89
|
-
};
|
|
89
|
+
}; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
90
|
+
|
|
90
91
|
|
|
91
92
|
export default FlagActions;
|
|
@@ -14,10 +14,12 @@ export const flagAnimationTime = 400;
|
|
|
14
14
|
const flagBottom = gridSize * 6;
|
|
15
15
|
const flagLeft = gridSize * 10;
|
|
16
16
|
const defaultFlagGroupContext = {
|
|
17
|
-
onDismissed:
|
|
17
|
+
onDismissed: noop,
|
|
18
18
|
isDismissAllowed: false
|
|
19
|
-
};
|
|
20
|
-
|
|
19
|
+
}; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
20
|
+
|
|
21
|
+
export const FlagGroupContext = /*#__PURE__*/createContext(defaultFlagGroupContext); // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
22
|
+
|
|
21
23
|
export function useFlagGroup() {
|
|
22
24
|
return useContext(FlagGroupContext);
|
|
23
25
|
} // transition: none is set on first-of-type to prevent a bug in Firefox
|
|
@@ -68,6 +70,14 @@ const flagGroupContainerStyles = css({
|
|
|
68
70
|
left: 0
|
|
69
71
|
}
|
|
70
72
|
});
|
|
73
|
+
/**
|
|
74
|
+
* __Flag group__
|
|
75
|
+
*
|
|
76
|
+
* A flag group is used to group a set of related flags, with entry and exit animations.
|
|
77
|
+
*
|
|
78
|
+
* - [Examples](https://atlassian.design/components/flag/flag-group/examples)
|
|
79
|
+
* - [Code](https://atlassian.design/components/flag/flag-group/code)
|
|
80
|
+
*/
|
|
71
81
|
|
|
72
82
|
const FlagGroup = props => {
|
|
73
83
|
const {
|
|
@@ -4,6 +4,11 @@ import AutoDismissFlag from './auto-dismiss-flag';
|
|
|
4
4
|
import Flag from './flag';
|
|
5
5
|
import FlagGroup from './flag-group';
|
|
6
6
|
const FlagContext = /*#__PURE__*/React.createContext(null);
|
|
7
|
+
/**
|
|
8
|
+
* useFlags is used to access the `showFlags` function which can be used to programatically display flags.
|
|
9
|
+
* - [Examples](https://atlassian.design/components/flag/flags-provider/examples#using-showflags)
|
|
10
|
+
*/
|
|
11
|
+
|
|
7
12
|
export function useFlags() {
|
|
8
13
|
const api = useContext(FlagContext);
|
|
9
14
|
|
package/dist/es2019/flag.js
CHANGED
|
@@ -16,7 +16,7 @@ import { Title, Description, Expander, DismissButton } from './internal';
|
|
|
16
16
|
const analyticsAttributes = {
|
|
17
17
|
componentName: 'flag',
|
|
18
18
|
packageName: "@atlaskit/flag",
|
|
19
|
-
packageVersion: "14.6.
|
|
19
|
+
packageVersion: "14.6.4"
|
|
20
20
|
};
|
|
21
21
|
const gridSize = getGridSize();
|
|
22
22
|
const doubleGridSize = gridSize * 2;
|
|
@@ -42,6 +42,16 @@ const flagContainerStyles = css({
|
|
|
42
42
|
borderRadius: borderRadius(),
|
|
43
43
|
transition: 'background-color 200ms'
|
|
44
44
|
});
|
|
45
|
+
/**
|
|
46
|
+
* __Flag__
|
|
47
|
+
*
|
|
48
|
+
* A flag is used for confirmations, alerts, and acknowledgments that require minimal user interaction,
|
|
49
|
+
* often displayed using a flag group.
|
|
50
|
+
*
|
|
51
|
+
* - [Examples](https://atlassian.design/components/flag/examples)
|
|
52
|
+
* - [Code](https://atlassian.design/components/flag/code)
|
|
53
|
+
* - [Usage](https://atlassian.design/components/flag/usage)
|
|
54
|
+
*/
|
|
45
55
|
|
|
46
56
|
const Flag = props => {
|
|
47
57
|
const {
|
package/dist/es2019/types.js
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @repo/internal/react/consistent-types-definitions */
|
|
1
2
|
// exported for testing - keep in sync from `type AppearanceTypes`
|
|
3
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
2
4
|
export const AppearanceArray = ['error', 'info', 'normal', 'success', 'warning']; // CreateFlagsArg makes id optional so define this prop separately
|
package/dist/es2019/version.json
CHANGED
|
@@ -5,8 +5,16 @@ import noop from '@atlaskit/ds-lib/noop';
|
|
|
5
5
|
import Flag from './flag';
|
|
6
6
|
import { useFlagGroup } from './flag-group';
|
|
7
7
|
var packageName = "@atlaskit/flag";
|
|
8
|
-
var packageVersion = "14.6.
|
|
8
|
+
var packageVersion = "14.6.4";
|
|
9
9
|
export var AUTO_DISMISS_SECONDS = 8;
|
|
10
|
+
/**
|
|
11
|
+
* __Auto dismiss flag__
|
|
12
|
+
*
|
|
13
|
+
* An auto dismiss flag is dismissed automatically after eight seconds.
|
|
14
|
+
*
|
|
15
|
+
* - [Examples](https://atlassian.design/components/flag/auto-dismiss-flag/examples)
|
|
16
|
+
* - [Code](https://atlassian.design/components/flag/auto-dismiss-flag/code)
|
|
17
|
+
*/
|
|
10
18
|
|
|
11
19
|
var AutoDismissFlag = function AutoDismissFlag(props) {
|
|
12
20
|
var id = props.id,
|
|
@@ -55,7 +63,8 @@ var AutoDismissFlag = function AutoDismissFlag(props) {
|
|
|
55
63
|
startAutoDismissTimer();
|
|
56
64
|
return stopAutoDismissTimer;
|
|
57
65
|
}, [startAutoDismissTimer, stopAutoDismissTimer]);
|
|
58
|
-
return /*#__PURE__*/React.createElement(Flag
|
|
66
|
+
return /*#__PURE__*/React.createElement(Flag // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
67
|
+
, _extends({}, props, {
|
|
59
68
|
onMouseOver: stopAutoDismissTimer,
|
|
60
69
|
onFocus: stopAutoDismissTimer,
|
|
61
70
|
onMouseOut: startAutoDismissTimer,
|
package/dist/esm/flag-actions.js
CHANGED
|
@@ -46,7 +46,7 @@ var appeanceNormalButtonStyles = css({
|
|
|
46
46
|
});
|
|
47
47
|
var isBoldButtonStyles = css({
|
|
48
48
|
'&&, a&&': {
|
|
49
|
-
|
|
49
|
+
marginRight: gridSize
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
|
|
@@ -88,6 +88,7 @@ var FlagActions = function FlagActions(props) {
|
|
|
88
88
|
css: [buttonStyles, isBold && isBoldButtonStyles, appearance === 'normal' && appeanceNormalButtonStyles]
|
|
89
89
|
}, action.content)];
|
|
90
90
|
}));
|
|
91
|
-
};
|
|
91
|
+
}; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
92
|
+
|
|
92
93
|
|
|
93
94
|
export default FlagActions;
|
package/dist/esm/flag-group.js
CHANGED
|
@@ -15,10 +15,12 @@ export var flagAnimationTime = 400;
|
|
|
15
15
|
var flagBottom = gridSize * 6;
|
|
16
16
|
var flagLeft = gridSize * 10;
|
|
17
17
|
var defaultFlagGroupContext = {
|
|
18
|
-
onDismissed:
|
|
18
|
+
onDismissed: noop,
|
|
19
19
|
isDismissAllowed: false
|
|
20
|
-
};
|
|
21
|
-
|
|
20
|
+
}; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
21
|
+
|
|
22
|
+
export var FlagGroupContext = /*#__PURE__*/createContext(defaultFlagGroupContext); // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
23
|
+
|
|
22
24
|
export function useFlagGroup() {
|
|
23
25
|
return useContext(FlagGroupContext);
|
|
24
26
|
} // transition: none is set on first-of-type to prevent a bug in Firefox
|
|
@@ -69,6 +71,14 @@ var flagGroupContainerStyles = css({
|
|
|
69
71
|
left: 0
|
|
70
72
|
}
|
|
71
73
|
});
|
|
74
|
+
/**
|
|
75
|
+
* __Flag group__
|
|
76
|
+
*
|
|
77
|
+
* A flag group is used to group a set of related flags, with entry and exit animations.
|
|
78
|
+
*
|
|
79
|
+
* - [Examples](https://atlassian.design/components/flag/flag-group/examples)
|
|
80
|
+
* - [Code](https://atlassian.design/components/flag/flag-group/code)
|
|
81
|
+
*/
|
|
72
82
|
|
|
73
83
|
var FlagGroup = function FlagGroup(props) {
|
|
74
84
|
var id = props.id,
|
|
@@ -14,6 +14,11 @@ import AutoDismissFlag from './auto-dismiss-flag';
|
|
|
14
14
|
import Flag from './flag';
|
|
15
15
|
import FlagGroup from './flag-group';
|
|
16
16
|
var FlagContext = /*#__PURE__*/React.createContext(null);
|
|
17
|
+
/**
|
|
18
|
+
* useFlags is used to access the `showFlags` function which can be used to programatically display flags.
|
|
19
|
+
* - [Examples](https://atlassian.design/components/flag/flags-provider/examples#using-showflags)
|
|
20
|
+
*/
|
|
21
|
+
|
|
17
22
|
export function useFlags() {
|
|
18
23
|
var api = useContext(FlagContext);
|
|
19
24
|
|
package/dist/esm/flag.js
CHANGED
|
@@ -22,7 +22,7 @@ import { Title, Description, Expander, DismissButton } from './internal';
|
|
|
22
22
|
var analyticsAttributes = {
|
|
23
23
|
componentName: 'flag',
|
|
24
24
|
packageName: "@atlaskit/flag",
|
|
25
|
-
packageVersion: "14.6.
|
|
25
|
+
packageVersion: "14.6.4"
|
|
26
26
|
};
|
|
27
27
|
var gridSize = getGridSize();
|
|
28
28
|
var doubleGridSize = gridSize * 2;
|
|
@@ -48,6 +48,16 @@ var flagContainerStyles = css({
|
|
|
48
48
|
borderRadius: borderRadius(),
|
|
49
49
|
transition: 'background-color 200ms'
|
|
50
50
|
});
|
|
51
|
+
/**
|
|
52
|
+
* __Flag__
|
|
53
|
+
*
|
|
54
|
+
* A flag is used for confirmations, alerts, and acknowledgments that require minimal user interaction,
|
|
55
|
+
* often displayed using a flag group.
|
|
56
|
+
*
|
|
57
|
+
* - [Examples](https://atlassian.design/components/flag/examples)
|
|
58
|
+
* - [Code](https://atlassian.design/components/flag/code)
|
|
59
|
+
* - [Usage](https://atlassian.design/components/flag/usage)
|
|
60
|
+
*/
|
|
51
61
|
|
|
52
62
|
var Flag = function Flag(props) {
|
|
53
63
|
var _props$actions = props.actions,
|
package/dist/esm/types.js
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @repo/internal/react/consistent-types-definitions */
|
|
1
2
|
// exported for testing - keep in sync from `type AppearanceTypes`
|
|
3
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
2
4
|
export var AppearanceArray = ['error', 'info', 'normal', 'success', 'warning']; // CreateFlagsArg makes id optional so define this prop separately
|
package/dist/esm/version.json
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { AutoDismissFlagProps } from './types';
|
|
3
3
|
export declare const AUTO_DISMISS_SECONDS = 8;
|
|
4
|
+
/**
|
|
5
|
+
* __Auto dismiss flag__
|
|
6
|
+
*
|
|
7
|
+
* An auto dismiss flag is dismissed automatically after eight seconds.
|
|
8
|
+
*
|
|
9
|
+
* - [Examples](https://atlassian.design/components/flag/auto-dismiss-flag/examples)
|
|
10
|
+
* - [Code](https://atlassian.design/components/flag/auto-dismiss-flag/code)
|
|
11
|
+
*/
|
|
4
12
|
declare const AutoDismissFlag: (props: AutoDismissFlagProps) => JSX.Element;
|
|
5
13
|
export default AutoDismissFlag;
|
|
@@ -3,12 +3,12 @@ import type { ComponentType } from 'react';
|
|
|
3
3
|
import type { CustomThemeButtonProps } from '@atlaskit/button/types';
|
|
4
4
|
import type { ThemeModes } from '@atlaskit/theme/types';
|
|
5
5
|
import type { ActionsType, AppearanceTypes } from './types';
|
|
6
|
-
declare type
|
|
6
|
+
declare type FlagActionsProps = {
|
|
7
7
|
appearance: AppearanceTypes;
|
|
8
8
|
actions: ActionsType;
|
|
9
9
|
linkComponent?: ComponentType<CustomThemeButtonProps>;
|
|
10
10
|
mode: ThemeModes;
|
|
11
11
|
testId?: string;
|
|
12
12
|
};
|
|
13
|
-
declare const FlagActions: (props:
|
|
13
|
+
declare const FlagActions: (props: FlagActionsProps) => JSX.Element | null;
|
|
14
14
|
export default FlagActions;
|
|
@@ -2,15 +2,24 @@
|
|
|
2
2
|
import { ReactElement } from 'react';
|
|
3
3
|
import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
4
4
|
declare type FlagGroupProps = {
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* ID attribute used for DOM selection.
|
|
7
|
+
*/
|
|
6
8
|
id?: string;
|
|
7
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Describes the specific role of this FlagGroup for users viewing the page with a screen reader (defaults to `Flag notifications`).
|
|
11
|
+
*/
|
|
8
12
|
label?: string;
|
|
9
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Describes the specific tag on which the screen reader text will be rendered (defaults to `h2`).
|
|
15
|
+
*/
|
|
10
16
|
labelTag?: React.ElementType;
|
|
11
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Flag elements to be displayed.
|
|
19
|
+
*/
|
|
12
20
|
children?: Array<ReactElement> | ReactElement | null | boolean;
|
|
13
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Handler which will be called when a Flag's dismiss button is clicked.
|
|
14
23
|
* Receives the id of the dismissed Flag as a parameter.
|
|
15
24
|
*/
|
|
16
25
|
onDismissed?: (id: number | string, analyticsEvent: UIAnalyticsEvent) => void;
|
|
@@ -23,5 +32,13 @@ declare type FlagGroupAPI = {
|
|
|
23
32
|
};
|
|
24
33
|
export declare const FlagGroupContext: import("react").Context<FlagGroupAPI>;
|
|
25
34
|
export declare function useFlagGroup(): FlagGroupAPI;
|
|
35
|
+
/**
|
|
36
|
+
* __Flag group__
|
|
37
|
+
*
|
|
38
|
+
* A flag group is used to group a set of related flags, with entry and exit animations.
|
|
39
|
+
*
|
|
40
|
+
* - [Examples](https://atlassian.design/components/flag/flag-group/examples)
|
|
41
|
+
* - [Code](https://atlassian.design/components/flag/flag-group/code)
|
|
42
|
+
*/
|
|
26
43
|
declare const FlagGroup: (props: FlagGroupProps) => JSX.Element;
|
|
27
44
|
export default FlagGroup;
|
|
@@ -3,12 +3,15 @@ import { FlagPropsWithoutId } from './types';
|
|
|
3
3
|
declare type FlagId = string | number;
|
|
4
4
|
export declare type Combine<First, Second> = Omit<First, keyof Second> & Second;
|
|
5
5
|
export interface CreateFlagArgs extends FlagPropsWithoutId {
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* A unique identifier used for rendering and onDismissed callbacks.
|
|
7
8
|
* This will be autogenerated if you don’t supply one.
|
|
8
9
|
* If you don’t want the same flag showing multiple times, provide a unique id.
|
|
9
10
|
*/
|
|
10
11
|
id?: FlagId;
|
|
11
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Marks whether the flag should render as an AutoDismissFlag
|
|
14
|
+
*/
|
|
12
15
|
isAutoDismiss?: boolean;
|
|
13
16
|
}
|
|
14
17
|
export declare type FlagArgs = Combine<CreateFlagArgs, {
|
|
@@ -18,6 +21,10 @@ export declare type DismissFn = () => void;
|
|
|
18
21
|
export declare type FlagAPI = {
|
|
19
22
|
showFlag: (args: CreateFlagArgs) => DismissFn;
|
|
20
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* useFlags is used to access the `showFlags` function which can be used to programatically display flags.
|
|
26
|
+
* - [Examples](https://atlassian.design/components/flag/flags-provider/examples#using-showflags)
|
|
27
|
+
*/
|
|
21
28
|
export declare function useFlags(): FlagAPI;
|
|
22
29
|
export declare function FlagsProvider({ children }: {
|
|
23
30
|
children: React.ReactNode;
|
package/dist/types/flag.d.ts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { FlagProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* __Flag__
|
|
5
|
+
*
|
|
6
|
+
* A flag is used for confirmations, alerts, and acknowledgments that require minimal user interaction,
|
|
7
|
+
* often displayed using a flag group.
|
|
8
|
+
*
|
|
9
|
+
* - [Examples](https://atlassian.design/components/flag/examples)
|
|
10
|
+
* - [Code](https://atlassian.design/components/flag/code)
|
|
11
|
+
* - [Usage](https://atlassian.design/components/flag/usage)
|
|
12
|
+
*/
|
|
3
13
|
declare const Flag: (props: FlagProps) => JSX.Element;
|
|
4
14
|
export default Flag;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -8,49 +8,61 @@ export declare type ActionType = {
|
|
|
8
8
|
target?: string;
|
|
9
9
|
testId?: string;
|
|
10
10
|
};
|
|
11
|
-
export declare type AppearanceTypes = 'error' | 'info' | 'normal' | 'success' | 'warning';
|
|
12
11
|
export declare type ActionsType = Array<ActionType>;
|
|
12
|
+
export declare type AppearanceTypes = 'error' | 'info' | 'normal' | 'success' | 'warning';
|
|
13
13
|
export declare const AppearanceArray: AppearanceTypes[];
|
|
14
14
|
declare type FlagPropsId = {
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* A unique identifier used for rendering and onDismissed callbacks.
|
|
17
|
+
*/
|
|
16
18
|
id: number | string;
|
|
17
19
|
};
|
|
18
20
|
declare type AutoDismissFlagPropsWithoutId = {
|
|
19
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Array of clickable actions to be shown at the bottom of the flag. For flags where appearance
|
|
20
23
|
* is 'normal', actions will be shown as links. For all other appearance values, actions will
|
|
21
24
|
* shown as buttons.
|
|
22
25
|
* If href is passed the action will be shown as a link with the passed href prop.
|
|
23
26
|
*/
|
|
24
27
|
actions?: ActionsType;
|
|
25
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Makes the flag appearance bold. Setting this to anything other than 'normal' hides the
|
|
26
30
|
* dismiss button.
|
|
27
31
|
*/
|
|
28
32
|
appearance?: AppearanceTypes;
|
|
29
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* The secondary content shown below the flag title
|
|
35
|
+
*/
|
|
30
36
|
description?: ReactNode;
|
|
31
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* The icon displayed in the top-left of the flag. Should be an instance of `@atlaskit/icon`.
|
|
32
39
|
* Your icon will receive the appropriate default color, which you can override by wrapping the
|
|
33
40
|
* icon in a containing element with CSS `color` set to your preferred icon color.
|
|
34
41
|
*/
|
|
35
42
|
icon: ReactNode;
|
|
36
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* The bold text shown at the top of the flag.
|
|
45
|
+
*/
|
|
37
46
|
title: ReactNode;
|
|
38
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Handler which will be called when a Flag's dismiss button is clicked.
|
|
39
49
|
* Receives the id of the dismissed Flag as a parameter.
|
|
40
50
|
*/
|
|
41
51
|
onDismissed?: (id: number | string, analyticsEvent: UIAnalyticsEvent) => void;
|
|
42
|
-
/**
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
52
|
+
/**
|
|
53
|
+
* A link component that is passed down to the `@atlaskit/button` used by actions,
|
|
54
|
+
* to allow custom routers to be used. See the
|
|
55
|
+
* [button with router](https://atlaskit.atlassian.com/packages/design-system/button/example/ButtonWithRouter)
|
|
56
|
+
* example of what this component should look like.
|
|
57
|
+
*/
|
|
46
58
|
linkComponent?: ComponentType<CustomThemeButtonProps>;
|
|
47
59
|
/**
|
|
48
60
|
* A `testId` prop is provided for specified elements,
|
|
49
61
|
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
50
62
|
* serving as a hook for automated tests.
|
|
51
|
-
|
|
63
|
+
*
|
|
52
64
|
* Will set these elements when defined:
|
|
53
|
-
|
|
65
|
+
*
|
|
54
66
|
* - Flag root element - `{testId}`
|
|
55
67
|
* - Close button visible on default flags - `{testId}-dismiss`
|
|
56
68
|
* - Toggle button visible on bold flags - `{testId}-toggle`
|
|
@@ -59,19 +71,29 @@ declare type AutoDismissFlagPropsWithoutId = {
|
|
|
59
71
|
* - Flag actions - `{testId}-actions`
|
|
60
72
|
*/
|
|
61
73
|
testId?: string;
|
|
62
|
-
/**
|
|
74
|
+
/**
|
|
75
|
+
* Additional information to be included in the `context` of analytics events that come from flag
|
|
76
|
+
*/
|
|
63
77
|
analyticsContext?: Record<string, any>;
|
|
64
78
|
};
|
|
65
79
|
export interface AutoDismissFlagProps extends AutoDismissFlagPropsWithoutId, FlagPropsId {
|
|
66
80
|
}
|
|
67
81
|
export interface FlagPropsWithoutId extends AutoDismissFlagPropsWithoutId, WithAnalyticsEventsProps {
|
|
68
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* Standard onBlur event, applied to Flag by AutoDismissFlag
|
|
84
|
+
*/
|
|
69
85
|
onBlur?: (e: React.FocusEvent<HTMLElement>, analyticsEvent: UIAnalyticsEvent) => void;
|
|
70
|
-
/**
|
|
86
|
+
/**
|
|
87
|
+
* Standard onFocus event, applied to Flag by AutoDismissFlag
|
|
88
|
+
*/
|
|
71
89
|
onFocus?: (e: React.FocusEvent<HTMLElement>, analyticsEvent: UIAnalyticsEvent) => void;
|
|
72
|
-
/**
|
|
90
|
+
/**
|
|
91
|
+
* Standard onMouseOut event, applied to Flag by AutoDismissFlag
|
|
92
|
+
*/
|
|
73
93
|
onMouseOut?: MouseEventHandler;
|
|
74
|
-
/**
|
|
94
|
+
/**
|
|
95
|
+
* Standard onMouseOver event, applied to Flag by AutoDismissFlag
|
|
96
|
+
*/
|
|
75
97
|
onMouseOver?: MouseEventHandler;
|
|
76
98
|
}
|
|
77
99
|
export interface FlagProps extends FlagPropsWithoutId, FlagPropsId {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/flag",
|
|
3
|
-
"version": "14.6.
|
|
3
|
+
"version": "14.6.4",
|
|
4
4
|
"description": "A flag is used for confirmations, alerts, and acknowledgments that require minimal user interaction, often displayed using a flag group.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"module:es2019": "dist/es2019/index.js",
|
|
14
14
|
"types": "dist/types/index.d.ts",
|
|
15
15
|
"sideEffects": false,
|
|
16
|
-
"atlaskit:src": "src/index.
|
|
16
|
+
"atlaskit:src": "src/index.tsx",
|
|
17
17
|
"atlassian": {
|
|
18
18
|
"team": "Design System Team",
|
|
19
19
|
"releaseModel": "scheduled",
|
|
@@ -23,20 +23,20 @@
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"af:exports": {
|
|
26
|
-
".": "./src/index.
|
|
26
|
+
".": "./src/index.tsx",
|
|
27
27
|
"./auto-dismiss-flag": "./src/auto-dismiss-flag.tsx",
|
|
28
|
-
"./constants": "./src/constants.
|
|
28
|
+
"./constants": "./src/constants.tsx",
|
|
29
29
|
"./flag-actions": "./src/flag-actions.tsx",
|
|
30
30
|
"./flag-group": "./src/flag-group.tsx",
|
|
31
31
|
"./flag-provider": "./src/flag-provider.tsx",
|
|
32
32
|
"./flag": "./src/flag.tsx",
|
|
33
|
-
"./theme": "./src/theme.
|
|
34
|
-
"./types": "./src/types.
|
|
33
|
+
"./theme": "./src/theme.tsx",
|
|
34
|
+
"./types": "./src/types.tsx"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@atlaskit/analytics-next": "^8.0.0",
|
|
38
38
|
"@atlaskit/button": "^16.3.0",
|
|
39
|
-
"@atlaskit/ds-lib": "^2.
|
|
39
|
+
"@atlaskit/ds-lib": "^2.1.0",
|
|
40
40
|
"@atlaskit/focus-ring": "^1.0.0",
|
|
41
41
|
"@atlaskit/icon": "^21.10.0",
|
|
42
42
|
"@atlaskit/motion": "^1.2.0",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"jest-emotion": "^10.0.32",
|
|
65
65
|
"react-dom": "^16.8.0",
|
|
66
66
|
"storybook-addon-performance": "^0.16.0",
|
|
67
|
-
"typescript": "4.
|
|
67
|
+
"typescript": "4.3.5"
|
|
68
68
|
},
|
|
69
69
|
"keywords": [
|
|
70
70
|
"atlaskit",
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
"techstack": {
|
|
75
75
|
"@repo/internal": {
|
|
76
76
|
"dom-events": "use-bind-event-listener",
|
|
77
|
+
"design-system": "v1",
|
|
77
78
|
"ui-components": [
|
|
78
79
|
"lite-mode"
|
|
79
80
|
],
|