@atlaskit/flag 14.4.2 → 14.5.3
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 +39 -0
- package/__perf__/withFlagGroup.tsx +1 -1
- package/dist/cjs/auto-dismiss-flag.js +4 -4
- package/dist/cjs/flag-actions.js +50 -6
- package/dist/cjs/flag-group.js +57 -19
- package/dist/cjs/flag-provider.js +6 -4
- package/dist/cjs/flag.js +85 -108
- package/dist/cjs/index.js +12 -12
- package/dist/cjs/internal/description.js +32 -0
- package/dist/cjs/internal/dismiss-button.js +83 -0
- package/dist/cjs/{expander.js → internal/expander.js} +15 -7
- package/dist/cjs/internal/index.js +39 -0
- package/dist/cjs/internal/title.js +32 -0
- package/dist/cjs/theme.js +62 -62
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/auto-dismiss-flag.js +2 -3
- package/dist/es2019/flag-actions.js +50 -32
- package/dist/es2019/flag-group.js +48 -65
- package/dist/es2019/flag.js +77 -164
- package/dist/es2019/internal/description.js +22 -0
- package/dist/es2019/internal/dismiss-button.js +63 -0
- package/dist/es2019/{expander.js → internal/expander.js} +14 -10
- package/dist/es2019/internal/index.js +4 -0
- package/dist/es2019/internal/title.js +22 -0
- package/dist/es2019/theme.js +61 -61
- package/dist/es2019/version.json +1 -1
- package/dist/esm/auto-dismiss-flag.js +2 -3
- package/dist/esm/flag-actions.js +49 -6
- package/dist/esm/flag-group.js +52 -16
- package/dist/esm/flag-provider.js +4 -3
- package/dist/esm/flag.js +81 -103
- package/dist/esm/internal/description.js +23 -0
- package/dist/esm/internal/dismiss-button.js +63 -0
- package/dist/esm/{expander.js → internal/expander.js} +14 -5
- package/dist/esm/internal/index.js +4 -0
- package/dist/esm/internal/title.js +23 -0
- package/dist/esm/theme.js +61 -61
- package/dist/esm/version.json +1 -1
- package/dist/types/auto-dismiss-flag.d.ts +1 -0
- package/dist/types/flag-actions.d.ts +4 -4
- package/dist/types/flag-group.d.ts +2 -2
- package/dist/types/flag.d.ts +2 -1
- package/dist/types/internal/description.d.ts +7 -0
- package/dist/types/internal/dismiss-button.d.ts +11 -0
- package/dist/types/internal/expander.d.ts +8 -0
- package/dist/types/internal/index.d.ts +4 -0
- package/dist/types/internal/title.d.ts +6 -0
- package/dist/types/theme.d.ts +1 -1
- package/package.json +10 -8
- package/dist/types/expander.d.ts +0 -9
- package/expander/package.json +0 -7
package/dist/cjs/index.js
CHANGED
|
@@ -5,12 +5,6 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
Object.defineProperty(exports, "default", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function get() {
|
|
11
|
-
return _flag.default;
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
8
|
Object.defineProperty(exports, "AutoDismissFlag", {
|
|
15
9
|
enumerable: true,
|
|
16
10
|
get: function get() {
|
|
@@ -23,22 +17,28 @@ Object.defineProperty(exports, "FlagGroup", {
|
|
|
23
17
|
return _flagGroup.default;
|
|
24
18
|
}
|
|
25
19
|
});
|
|
26
|
-
Object.defineProperty(exports, "
|
|
20
|
+
Object.defineProperty(exports, "FlagsProvider", {
|
|
27
21
|
enumerable: true,
|
|
28
22
|
get: function get() {
|
|
29
|
-
return _flagProvider.
|
|
23
|
+
return _flagProvider.FlagsProvider;
|
|
30
24
|
}
|
|
31
25
|
});
|
|
32
|
-
Object.defineProperty(exports, "
|
|
26
|
+
Object.defineProperty(exports, "default", {
|
|
33
27
|
enumerable: true,
|
|
34
28
|
get: function get() {
|
|
35
|
-
return
|
|
29
|
+
return _flag.default;
|
|
36
30
|
}
|
|
37
31
|
});
|
|
38
|
-
Object.defineProperty(exports, "
|
|
32
|
+
Object.defineProperty(exports, "useFlags", {
|
|
39
33
|
enumerable: true,
|
|
40
34
|
get: function get() {
|
|
41
|
-
return _flagProvider.
|
|
35
|
+
return _flagProvider.useFlags;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
Object.defineProperty(exports, "withFlagsProvider", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function get() {
|
|
41
|
+
return _flagProvider.withFlagsProvider;
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _core = require("@emotion/core");
|
|
9
|
+
|
|
10
|
+
/** @jsx jsx */
|
|
11
|
+
var descriptionStyles = (0, _core.css)({
|
|
12
|
+
/* height is defined as 5 lines maximum by design */
|
|
13
|
+
maxHeight: 100,
|
|
14
|
+
overflow: 'auto',
|
|
15
|
+
wordWrap: 'break-word'
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
var Description = function Description(_ref) {
|
|
19
|
+
var color = _ref.color,
|
|
20
|
+
testId = _ref.testId,
|
|
21
|
+
children = _ref.children;
|
|
22
|
+
return (0, _core.jsx)("div", {
|
|
23
|
+
style: {
|
|
24
|
+
color: color
|
|
25
|
+
},
|
|
26
|
+
css: descriptionStyles,
|
|
27
|
+
"data-testid": testId
|
|
28
|
+
}, children);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
var _default = Description;
|
|
32
|
+
exports.default = _default;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
|
|
12
|
+
var _core = require("@emotion/core");
|
|
13
|
+
|
|
14
|
+
var _focusRing = _interopRequireDefault(require("@atlaskit/focus-ring"));
|
|
15
|
+
|
|
16
|
+
var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-down"));
|
|
17
|
+
|
|
18
|
+
var _chevronUp = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-up"));
|
|
19
|
+
|
|
20
|
+
var _cross = _interopRequireDefault(require("@atlaskit/icon/glyph/cross"));
|
|
21
|
+
|
|
22
|
+
var _constants = require("@atlaskit/theme/constants");
|
|
23
|
+
|
|
24
|
+
var _components = require("@atlaskit/theme/components");
|
|
25
|
+
|
|
26
|
+
var _theme = require("../theme");
|
|
27
|
+
|
|
28
|
+
/** @jsx jsx */
|
|
29
|
+
var gridSize = (0, _constants.gridSize)();
|
|
30
|
+
var borderRadius = (0, _constants.borderRadius)();
|
|
31
|
+
var dismissButtonStyles = (0, _core.css)({
|
|
32
|
+
marginLeft: gridSize,
|
|
33
|
+
padding: 0,
|
|
34
|
+
flex: '0 0 auto',
|
|
35
|
+
appearance: 'none',
|
|
36
|
+
background: 'none',
|
|
37
|
+
border: 'none',
|
|
38
|
+
borderRadius: borderRadius,
|
|
39
|
+
cursor: 'pointer',
|
|
40
|
+
lineHeight: '1',
|
|
41
|
+
whiteSpace: 'nowrap'
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
var DismissButton = function DismissButton(_ref) {
|
|
45
|
+
var appearance = _ref.appearance,
|
|
46
|
+
onClick = _ref.onClick,
|
|
47
|
+
isBold = _ref.isBold,
|
|
48
|
+
isExpanded = _ref.isExpanded,
|
|
49
|
+
testId = _ref.testId;
|
|
50
|
+
|
|
51
|
+
var _useGlobalTheme = (0, _components.useGlobalTheme)(),
|
|
52
|
+
mode = _useGlobalTheme.mode;
|
|
53
|
+
|
|
54
|
+
var ButtonIcon = _cross.default;
|
|
55
|
+
var buttonLabel = 'Dismiss';
|
|
56
|
+
var size = 'small';
|
|
57
|
+
var buttonTestId = testId && "".concat(testId, "-dismiss");
|
|
58
|
+
|
|
59
|
+
if (isBold) {
|
|
60
|
+
ButtonIcon = isExpanded ? _chevronUp.default : _chevronDown.default;
|
|
61
|
+
buttonLabel = isExpanded ? 'Collapse' : 'Expand';
|
|
62
|
+
size = 'large';
|
|
63
|
+
buttonTestId = testId && "".concat(testId, "-toggle");
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return (0, _core.jsx)(_focusRing.default, null, (0, _core.jsx)("button", {
|
|
67
|
+
style: {
|
|
68
|
+
color: (0, _theme.getFlagTextColor)(appearance, mode)
|
|
69
|
+
},
|
|
70
|
+
css: dismissButtonStyles,
|
|
71
|
+
onClick: onClick,
|
|
72
|
+
"data-testid": buttonTestId,
|
|
73
|
+
type: "button",
|
|
74
|
+
"aria-expanded": isBold ? isExpanded : undefined
|
|
75
|
+
}, (0, _core.jsx)(ButtonIcon, {
|
|
76
|
+
label: buttonLabel,
|
|
77
|
+
size: size
|
|
78
|
+
})));
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
var _default = /*#__PURE__*/(0, _react.memo)(DismissButton);
|
|
82
|
+
|
|
83
|
+
exports.default = _default;
|
|
@@ -1,23 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.default = void 0;
|
|
9
7
|
|
|
10
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
|
-
|
|
12
8
|
var _core = require("@emotion/core");
|
|
13
9
|
|
|
14
10
|
var _motion = require("@atlaskit/motion");
|
|
15
11
|
|
|
16
12
|
var _constants = require("@atlaskit/theme/constants");
|
|
17
13
|
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
/** @jsx jsx */
|
|
20
15
|
var paddingLeft = (0, _constants.gridSize)() * 5;
|
|
16
|
+
var expanderStyles = (0, _core.css)({
|
|
17
|
+
display: 'flex',
|
|
18
|
+
minWidth: 0,
|
|
19
|
+
maxHeight: 0,
|
|
20
|
+
padding: "0 0 0 ".concat(paddingLeft, "px"),
|
|
21
|
+
justifyContent: 'center',
|
|
22
|
+
flex: '1 1 100%',
|
|
23
|
+
flexDirection: 'column',
|
|
24
|
+
transition: "max-height 0.3s"
|
|
25
|
+
});
|
|
26
|
+
var expandedStyles = (0, _core.css)({
|
|
27
|
+
maxHeight: 150
|
|
28
|
+
});
|
|
21
29
|
|
|
22
30
|
var Expander = function Expander(_ref) {
|
|
23
31
|
var children = _ref.children,
|
|
@@ -28,7 +36,7 @@ var Expander = function Expander(_ref) {
|
|
|
28
36
|
// the the reveal because we don't know the height of the content.
|
|
29
37
|
return (0, _core.jsx)("div", {
|
|
30
38
|
"aria-hidden": !isExpanded,
|
|
31
|
-
css:
|
|
39
|
+
css: [expanderStyles, isExpanded && expandedStyles],
|
|
32
40
|
"data-testid": testId && "".concat(testId, "-expander")
|
|
33
41
|
}, (0, _core.jsx)(_motion.ExitingPersistence, {
|
|
34
42
|
appear: true
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports, "Description", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return _description.default;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(exports, "DismissButton", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function get() {
|
|
17
|
+
return _dismissButton.default;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports, "Expander", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function get() {
|
|
23
|
+
return _expander.default;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(exports, "Title", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function get() {
|
|
29
|
+
return _title.default;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
var _title = _interopRequireDefault(require("./title"));
|
|
34
|
+
|
|
35
|
+
var _description = _interopRequireDefault(require("./description"));
|
|
36
|
+
|
|
37
|
+
var _expander = _interopRequireDefault(require("./expander"));
|
|
38
|
+
|
|
39
|
+
var _dismissButton = _interopRequireDefault(require("./dismiss-button"));
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _core = require("@emotion/core");
|
|
9
|
+
|
|
10
|
+
/** @jsx jsx */
|
|
11
|
+
var titleStyles = (0, _core.css)({
|
|
12
|
+
padding: "0 0 0 16px",
|
|
13
|
+
flex: 1,
|
|
14
|
+
fontWeight: 600,
|
|
15
|
+
overflow: 'hidden',
|
|
16
|
+
textOverflow: 'ellipsis',
|
|
17
|
+
whiteSpace: 'nowrap'
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
var Title = function Title(_ref) {
|
|
21
|
+
var color = _ref.color,
|
|
22
|
+
children = _ref.children;
|
|
23
|
+
return (0, _core.jsx)("span", {
|
|
24
|
+
style: {
|
|
25
|
+
color: color
|
|
26
|
+
},
|
|
27
|
+
css: titleStyles
|
|
28
|
+
}, children);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
var _default = Title;
|
|
32
|
+
exports.default = _default;
|
package/dist/cjs/theme.js
CHANGED
|
@@ -3,30 +3,30 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.getFlagTextColor = exports.getFlagIconColor = exports.getFlagFocusRingColor = exports.getFlagBackgroundColor = exports.getActionColor = exports.getActionBackground = exports.flagShadowColor = exports.flagBorderColor = void 0;
|
|
7
7
|
|
|
8
8
|
var _colors = require("@atlaskit/theme/colors");
|
|
9
9
|
|
|
10
10
|
var flagBackgroundColor = {
|
|
11
11
|
error: {
|
|
12
|
-
light: "var(--ds-
|
|
13
|
-
dark: "var(--ds-
|
|
12
|
+
light: "var(--ds-surface-overlay, ".concat(_colors.R400, ")"),
|
|
13
|
+
dark: "var(--ds-surface-overlay, ".concat(_colors.R300, ")")
|
|
14
14
|
},
|
|
15
15
|
info: {
|
|
16
|
-
light: "var(--ds-
|
|
17
|
-
dark: "var(--ds-
|
|
16
|
+
light: "var(--ds-surface-overlay, ".concat(_colors.N500, ")"),
|
|
17
|
+
dark: "var(--ds-surface-overlay, ".concat(_colors.N500, ")")
|
|
18
18
|
},
|
|
19
19
|
normal: {
|
|
20
|
-
light: "var(--ds-
|
|
21
|
-
dark: "var(--ds-
|
|
20
|
+
light: "var(--ds-surface-overlay, ".concat(_colors.N0, ")"),
|
|
21
|
+
dark: "var(--ds-surface-overlay, ".concat(_colors.DN50, ")")
|
|
22
22
|
},
|
|
23
23
|
success: {
|
|
24
|
-
light: "var(--ds-
|
|
25
|
-
dark: "var(--ds-
|
|
24
|
+
light: "var(--ds-surface-overlay, ".concat(_colors.G400, ")"),
|
|
25
|
+
dark: "var(--ds-surface-overlay, ".concat(_colors.G300, ")")
|
|
26
26
|
},
|
|
27
27
|
warning: {
|
|
28
|
-
light: "var(--ds-
|
|
29
|
-
dark: "var(--ds-
|
|
28
|
+
light: "var(--ds-surface-overlay, ".concat(_colors.Y200, ")"),
|
|
29
|
+
dark: "var(--ds-surface-overlay, ".concat(_colors.Y300, ")")
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
|
|
@@ -35,50 +35,50 @@ var getFlagBackgroundColor = function getFlagBackgroundColor(appearance, mode) {
|
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
exports.getFlagBackgroundColor = getFlagBackgroundColor;
|
|
38
|
-
var flagBorderColor = "var(--ds-
|
|
38
|
+
var flagBorderColor = "var(--ds-surface-overlay, ".concat(_colors.N60A, ")");
|
|
39
39
|
exports.flagBorderColor = flagBorderColor;
|
|
40
40
|
var flagIconColor = {
|
|
41
41
|
error: {
|
|
42
|
-
light: "var(--ds-
|
|
43
|
-
dark: "var(--ds-
|
|
42
|
+
light: "var(--ds-icon-danger, ".concat(_colors.N0, ")"),
|
|
43
|
+
dark: "var(--ds-icon-danger, ".concat(_colors.DN40, ")")
|
|
44
44
|
},
|
|
45
45
|
info: {
|
|
46
|
-
light: "var(--ds-
|
|
47
|
-
dark: "var(--ds-
|
|
46
|
+
light: "var(--ds-icon-discovery, ".concat(_colors.N0, ")"),
|
|
47
|
+
dark: "var(--ds-icon-discovery, ".concat(_colors.DN600, ")")
|
|
48
48
|
},
|
|
49
49
|
normal: {
|
|
50
|
-
light: "var(--ds-
|
|
51
|
-
dark: "var(--ds-
|
|
50
|
+
light: "var(--ds-icon-brand, ".concat(_colors.N500, ")"),
|
|
51
|
+
dark: "var(--ds-icon-brand, ".concat(_colors.DN600, ")")
|
|
52
52
|
},
|
|
53
53
|
success: {
|
|
54
|
-
light: "var(--ds-
|
|
55
|
-
dark: "var(--ds-
|
|
54
|
+
light: "var(--ds-icon-success, ".concat(_colors.N0, ")"),
|
|
55
|
+
dark: "var(--ds-icon-success, ".concat(_colors.DN40, ")")
|
|
56
56
|
},
|
|
57
57
|
warning: {
|
|
58
|
-
light: "var(--ds-
|
|
59
|
-
dark: "var(--ds-
|
|
58
|
+
light: "var(--ds-icon-warning, ".concat(_colors.N700, ")"),
|
|
59
|
+
dark: "var(--ds-icon-warning, ".concat(_colors.DN40, ")")
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
62
|
var flagTextColor = {
|
|
63
63
|
error: {
|
|
64
|
-
light: "var(--ds-text
|
|
65
|
-
dark: "var(--ds-text
|
|
64
|
+
light: "var(--ds-text, ".concat(_colors.N0, ")"),
|
|
65
|
+
dark: "var(--ds-text, ".concat(_colors.DN40, ")")
|
|
66
66
|
},
|
|
67
67
|
info: {
|
|
68
|
-
light: "var(--ds-text
|
|
69
|
-
dark: "var(--ds-text
|
|
68
|
+
light: "var(--ds-text, ".concat(_colors.N0, ")"),
|
|
69
|
+
dark: "var(--ds-text, ".concat(_colors.DN600, ")")
|
|
70
70
|
},
|
|
71
71
|
normal: {
|
|
72
|
-
light: "var(--ds-text
|
|
73
|
-
dark: "var(--ds-text
|
|
72
|
+
light: "var(--ds-text, ".concat(_colors.N500, ")"),
|
|
73
|
+
dark: "var(--ds-text, ".concat(_colors.DN600, ")")
|
|
74
74
|
},
|
|
75
75
|
success: {
|
|
76
|
-
light: "var(--ds-text
|
|
77
|
-
dark: "var(--ds-text
|
|
76
|
+
light: "var(--ds-text, ".concat(_colors.N0, ")"),
|
|
77
|
+
dark: "var(--ds-text, ".concat(_colors.DN40, ")")
|
|
78
78
|
},
|
|
79
79
|
warning: {
|
|
80
|
-
light: "var(--ds-text
|
|
81
|
-
dark: "var(--ds-text
|
|
80
|
+
light: "var(--ds-text, ".concat(_colors.N700, ")"),
|
|
81
|
+
dark: "var(--ds-text, ".concat(_colors.DN40, ")")
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
84
|
|
|
@@ -99,24 +99,24 @@ var flagShadowColor = _colors.N50A;
|
|
|
99
99
|
exports.flagShadowColor = flagShadowColor;
|
|
100
100
|
var flagFocusRingColor = {
|
|
101
101
|
error: {
|
|
102
|
-
light: "var(--ds-border-
|
|
103
|
-
dark: "var(--ds-border-
|
|
102
|
+
light: "var(--ds-border-focused, ".concat(_colors.N40, ")"),
|
|
103
|
+
dark: "var(--ds-border-focused, ".concat(_colors.N40, ")")
|
|
104
104
|
},
|
|
105
105
|
info: {
|
|
106
|
-
light: "var(--ds-border-
|
|
107
|
-
dark: "var(--ds-border-
|
|
106
|
+
light: "var(--ds-border-focused, ".concat(_colors.N40, ")"),
|
|
107
|
+
dark: "var(--ds-border-focused, ".concat(_colors.N40, ")")
|
|
108
108
|
},
|
|
109
109
|
normal: {
|
|
110
|
-
light: "var(--ds-border-
|
|
111
|
-
dark: "var(--ds-border-
|
|
110
|
+
light: "var(--ds-border-focused, ".concat(_colors.B100, ")"),
|
|
111
|
+
dark: "var(--ds-border-focused, ".concat(_colors.B100, ")")
|
|
112
112
|
},
|
|
113
113
|
success: {
|
|
114
|
-
light: "var(--ds-border-
|
|
115
|
-
dark: "var(--ds-border-
|
|
114
|
+
light: "var(--ds-border-focused, ".concat(_colors.N40, ")"),
|
|
115
|
+
dark: "var(--ds-border-focused, ".concat(_colors.N40, ")")
|
|
116
116
|
},
|
|
117
117
|
warning: {
|
|
118
|
-
light: "var(--ds-border-
|
|
119
|
-
dark: "var(--ds-border-
|
|
118
|
+
light: "var(--ds-border-focused, ".concat(_colors.N200, ")"),
|
|
119
|
+
dark: "var(--ds-border-focused, ".concat(_colors.N200, ")")
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
122
|
|
|
@@ -128,46 +128,46 @@ exports.getFlagFocusRingColor = getFlagFocusRingColor;
|
|
|
128
128
|
var lightButtonBackground = 'rgba(255, 255, 255, 0.08)';
|
|
129
129
|
var actionBackground = {
|
|
130
130
|
success: {
|
|
131
|
-
light: "var(--ds-background-
|
|
132
|
-
dark: "var(--ds-background-
|
|
131
|
+
light: "var(--ds-background-neutral, ".concat(lightButtonBackground, ")"),
|
|
132
|
+
dark: "var(--ds-background-neutral, ".concat(_colors.N30A, ")")
|
|
133
133
|
},
|
|
134
134
|
info: {
|
|
135
|
-
light: "var(--ds-background-
|
|
136
|
-
dark: "var(--ds-background-
|
|
135
|
+
light: "var(--ds-background-neutral, ".concat(lightButtonBackground, ")"),
|
|
136
|
+
dark: "var(--ds-background-neutral, ".concat(lightButtonBackground, ")")
|
|
137
137
|
},
|
|
138
138
|
error: {
|
|
139
|
-
light: "var(--ds-background-
|
|
140
|
-
dark: "var(--ds-background-
|
|
139
|
+
light: "var(--ds-background-neutral, ".concat(lightButtonBackground, ")"),
|
|
140
|
+
dark: "var(--ds-background-neutral, ".concat(_colors.N30A, ")")
|
|
141
141
|
},
|
|
142
142
|
warning: {
|
|
143
|
-
light: "var(--ds-background-
|
|
144
|
-
dark: "var(--ds-background-
|
|
143
|
+
light: "var(--ds-background-neutral, ".concat(_colors.N30A, ")"),
|
|
144
|
+
dark: "var(--ds-background-neutral, ".concat(_colors.N30A, ")")
|
|
145
145
|
},
|
|
146
146
|
normal: {
|
|
147
|
-
light: "var(--ds-background-
|
|
148
|
-
dark: "var(--ds-background-
|
|
147
|
+
light: "var(--ds-background-neutral, none)",
|
|
148
|
+
dark: "var(--ds-background-neutral, none)"
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
151
|
var actionColor = {
|
|
152
152
|
success: {
|
|
153
|
-
light: "var(--ds-text-
|
|
154
|
-
dark: "var(--ds-text-
|
|
153
|
+
light: "var(--ds-text-subtle, ".concat(_colors.N0, ")"),
|
|
154
|
+
dark: "var(--ds-text-subtle, ".concat(_colors.DN40, ")")
|
|
155
155
|
},
|
|
156
156
|
info: {
|
|
157
|
-
light: "var(--ds-text-
|
|
158
|
-
dark: "var(--ds-text-
|
|
157
|
+
light: "var(--ds-text-subtle, ".concat(_colors.N0, ")"),
|
|
158
|
+
dark: "var(--ds-text-subtle, ".concat(_colors.DN600, ")")
|
|
159
159
|
},
|
|
160
160
|
error: {
|
|
161
|
-
light: "var(--ds-text-
|
|
162
|
-
dark: "var(--ds-text-
|
|
161
|
+
light: "var(--ds-text-subtle, ".concat(_colors.N0, ")"),
|
|
162
|
+
dark: "var(--ds-text-subtle, ".concat(_colors.DN600, ")")
|
|
163
163
|
},
|
|
164
164
|
warning: {
|
|
165
|
-
light: "var(--ds-text-
|
|
166
|
-
dark: "var(--ds-text-
|
|
165
|
+
light: "var(--ds-text-subtle, ".concat(_colors.N700, ")"),
|
|
166
|
+
dark: "var(--ds-text-subtle, ".concat(_colors.DN40, ")")
|
|
167
167
|
},
|
|
168
168
|
normal: {
|
|
169
|
-
light: "var(--ds-text-
|
|
170
|
-
dark: "var(--ds-text-
|
|
169
|
+
light: "var(--ds-text-subtle, ".concat(_colors.B400, ")"),
|
|
170
|
+
dark: "var(--ds-text-subtle, ".concat(_colors.B100, ")")
|
|
171
171
|
}
|
|
172
172
|
};
|
|
173
173
|
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useCallback, useEffect, useRef } from 'react';
|
|
3
3
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
|
|
4
|
+
import noop from '@atlaskit/ds-lib/noop';
|
|
4
5
|
import Flag from './flag';
|
|
5
6
|
import { useFlagGroup } from './flag-group';
|
|
6
7
|
const packageName = "@atlaskit/flag";
|
|
7
|
-
const packageVersion = "14.
|
|
8
|
+
const packageVersion = "14.5.3";
|
|
8
9
|
export const AUTO_DISMISS_SECONDS = 8;
|
|
9
10
|
|
|
10
|
-
function noop() {}
|
|
11
|
-
|
|
12
11
|
const AutoDismissFlag = props => {
|
|
13
12
|
const {
|
|
14
13
|
id,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable @repo/internal/styles/no-nested-styles */
|
|
2
|
+
|
|
1
3
|
/** @jsx jsx */
|
|
2
4
|
import { css, jsx } from '@emotion/core';
|
|
3
5
|
import Button from '@atlaskit/button/custom-theme-button';
|
|
@@ -7,6 +9,46 @@ import { getActionBackground, getActionColor, getFlagFocusRingColor } from './th
|
|
|
7
9
|
const gridSize = getGridSize();
|
|
8
10
|
const separatorWidth = gridSize * 2;
|
|
9
11
|
const defaultAppearanceTranslate = gridSize / 4;
|
|
12
|
+
const separatorStyles = css({
|
|
13
|
+
display: 'inline-block',
|
|
14
|
+
width: separatorWidth,
|
|
15
|
+
textAlign: 'center'
|
|
16
|
+
});
|
|
17
|
+
const actionContainerStyles = css({
|
|
18
|
+
display: 'flex',
|
|
19
|
+
paddingTop: gridSize,
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
flexWrap: 'wrap',
|
|
22
|
+
transform: `translateX(-${defaultAppearanceTranslate}px)`
|
|
23
|
+
});
|
|
24
|
+
const boldActionContainerStyles = css({
|
|
25
|
+
transform: 0
|
|
26
|
+
});
|
|
27
|
+
const buttonStyles = css({
|
|
28
|
+
'&&, a&&': {
|
|
29
|
+
marginLeft: 0,
|
|
30
|
+
padding: `0 ${gridSize}px !important`,
|
|
31
|
+
background: `var(--bg-color)`,
|
|
32
|
+
color: `var(--color) !important`,
|
|
33
|
+
fontWeight: 500
|
|
34
|
+
},
|
|
35
|
+
'&&:focus, a&&:focus': {
|
|
36
|
+
boxShadow: `0 0 0 2px var(--focus-color)`
|
|
37
|
+
},
|
|
38
|
+
'&&:hover, &&:active, a&&:hover, a&&:active': {
|
|
39
|
+
textDecoration: 'underline'
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
const appeanceNormalButtonStyles = css({
|
|
43
|
+
'&&, a&&': {
|
|
44
|
+
padding: '0 !important'
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
const isBoldButtonStyles = css({
|
|
48
|
+
'&&, a&&': {
|
|
49
|
+
marginLeft: gridSize
|
|
50
|
+
}
|
|
51
|
+
});
|
|
10
52
|
|
|
11
53
|
const FlagActions = props => {
|
|
12
54
|
const {
|
|
@@ -23,20 +65,10 @@ const FlagActions = props => {
|
|
|
23
65
|
|
|
24
66
|
const isBold = appearance !== DEFAULT_APPEARANCE;
|
|
25
67
|
return jsx("div", {
|
|
26
|
-
css:
|
|
27
|
-
display: flex;
|
|
28
|
-
flex-wrap: wrap;
|
|
29
|
-
padding-top: ${gridSize}px;
|
|
30
|
-
transform: ${appearance === DEFAULT_APPEARANCE ? `translateX(-${defaultAppearanceTranslate}px)` : 0};
|
|
31
|
-
align-items: center;
|
|
32
|
-
`,
|
|
68
|
+
css: [actionContainerStyles, isBold && boldActionContainerStyles],
|
|
33
69
|
"data-testid": testId && `${testId}-actions`
|
|
34
70
|
}, actions.map((action, index) => [index && !isBold ? jsx("div", {
|
|
35
|
-
css:
|
|
36
|
-
text-align: center;
|
|
37
|
-
display: inline-block;
|
|
38
|
-
width: ${separatorWidth}px;
|
|
39
|
-
`,
|
|
71
|
+
css: separatorStyles,
|
|
40
72
|
key: index + 0.5
|
|
41
73
|
}, "\xB7") : '', jsx(Button, {
|
|
42
74
|
onClick: action.onClick,
|
|
@@ -47,26 +79,12 @@ const FlagActions = props => {
|
|
|
47
79
|
spacing: "compact",
|
|
48
80
|
testId: action.testId,
|
|
49
81
|
key: index,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
background: ${getActionBackground(appearance, mode)};
|
|
57
|
-
color: ${getActionColor(appearance, mode)} !important;
|
|
58
|
-
}
|
|
59
|
-
&&:focus,
|
|
60
|
-
a&&:focus {
|
|
61
|
-
box-shadow: 0 0 0 2px ${getFlagFocusRingColor(appearance, mode)};
|
|
62
|
-
}
|
|
63
|
-
&&:hover,
|
|
64
|
-
&&:active,
|
|
65
|
-
a&&:hover,
|
|
66
|
-
a&&:active {
|
|
67
|
-
text-decoration: underline;
|
|
68
|
-
}
|
|
69
|
-
`
|
|
82
|
+
style: {
|
|
83
|
+
'--color': getActionColor(appearance, mode),
|
|
84
|
+
'--bg-color': getActionBackground(appearance, mode),
|
|
85
|
+
'--focus-color': getFlagFocusRingColor(appearance, mode)
|
|
86
|
+
},
|
|
87
|
+
css: [buttonStyles, isBold && isBoldButtonStyles, appearance === 'normal' && appeanceNormalButtonStyles]
|
|
70
88
|
}, action.content)]));
|
|
71
89
|
};
|
|
72
90
|
|