@atlaskit/flag 14.7.3 → 15.0.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 +20 -0
- package/dist/cjs/auto-dismiss-flag.js +1 -1
- package/dist/cjs/flag-actions.js +18 -37
- package/dist/cjs/flag-group.js +15 -9
- package/dist/cjs/flag.js +63 -73
- package/dist/cjs/internal/dismiss-button.js +25 -38
- package/dist/cjs/internal/expander.js +25 -26
- package/dist/cjs/internal/index.js +0 -16
- package/dist/cjs/theme.js +50 -169
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/auto-dismiss-flag.js +1 -1
- package/dist/es2019/flag-actions.js +18 -38
- package/dist/es2019/flag-group.js +14 -8
- package/dist/es2019/flag.js +63 -72
- package/dist/es2019/internal/dismiss-button.js +26 -36
- package/dist/es2019/internal/expander.js +20 -23
- package/dist/es2019/internal/index.js +0 -2
- package/dist/es2019/theme.js +47 -141
- package/dist/es2019/version.json +1 -1
- package/dist/esm/auto-dismiss-flag.js +1 -1
- package/dist/esm/flag-actions.js +18 -38
- package/dist/esm/flag-group.js +14 -8
- package/dist/esm/flag.js +63 -73
- package/dist/esm/internal/dismiss-button.js +26 -37
- package/dist/esm/internal/expander.js +21 -24
- package/dist/esm/internal/index.js +0 -2
- package/dist/esm/theme.js +49 -155
- package/dist/esm/version.json +1 -1
- package/dist/types/flag-actions.d.ts +2 -5
- package/dist/types/flag.d.ts +3 -2
- package/dist/types/internal/expander.d.ts +2 -3
- package/dist/types/internal/index.d.ts +0 -2
- package/dist/types/theme.d.ts +14 -9
- package/package.json +6 -4
- package/report.api.md +16 -8
- package/dist/cjs/internal/description.js +0 -34
- package/dist/cjs/internal/title.js +0 -30
- package/dist/es2019/internal/description.js +0 -24
- package/dist/es2019/internal/title.js +0 -20
- package/dist/esm/internal/description.js +0 -25
- package/dist/esm/internal/title.js +0 -21
- package/dist/types/internal/description.d.ts +0 -8
- package/dist/types/internal/title.d.ts +0 -6
|
@@ -1,22 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { UNSAFE_Box as Box, UNSAFE_Stack as Stack } from '@atlaskit/ds-explorations';
|
|
3
4
|
import { ExitingPersistence, FadeIn } from '@atlaskit/motion';
|
|
4
|
-
import { gridSize as getGridSize } from '@atlaskit/theme/constants';
|
|
5
|
-
const gridSize = getGridSize();
|
|
6
|
-
const paddingLeft = gridSize * 5;
|
|
7
|
-
const expanderStyles = css({
|
|
8
|
-
display: 'flex',
|
|
9
|
-
minWidth: 0,
|
|
10
|
-
maxHeight: 0,
|
|
11
|
-
padding: `0 0 0 ${paddingLeft}px`,
|
|
12
|
-
justifyContent: 'center',
|
|
13
|
-
flex: '1 1 100%',
|
|
14
|
-
flexDirection: 'column',
|
|
15
|
-
transition: `max-height 0.3s`
|
|
16
|
-
});
|
|
17
|
-
const expandedStyles = css({
|
|
18
|
-
maxHeight: 150
|
|
19
|
-
});
|
|
20
5
|
|
|
21
6
|
const Expander = ({
|
|
22
7
|
children,
|
|
@@ -26,13 +11,25 @@ const Expander = ({
|
|
|
26
11
|
// Need to always render the ExpanderInternal otherwise the
|
|
27
12
|
// reveal transition doesn't happen. We can't use CSS animation for
|
|
28
13
|
// the the reveal because we don't know the height of the content.
|
|
29
|
-
return
|
|
14
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
15
|
+
UNSAFE_style: {
|
|
16
|
+
minWidth: 0,
|
|
17
|
+
maxHeight: isExpanded ? 150 : 0,
|
|
18
|
+
flex: '1 1 100%',
|
|
19
|
+
transition: `max-height 0.3s`
|
|
20
|
+
},
|
|
30
21
|
"aria-hidden": !isExpanded,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}, jsx(ExitingPersistence, {
|
|
22
|
+
testId: testId && `${testId}-expander`
|
|
23
|
+
}, /*#__PURE__*/React.createElement(ExitingPersistence, {
|
|
34
24
|
appear: true
|
|
35
|
-
}, isExpanded &&
|
|
25
|
+
}, isExpanded && /*#__PURE__*/React.createElement(FadeIn, null, props => /*#__PURE__*/React.createElement(Box, _extends({
|
|
26
|
+
display: "block",
|
|
27
|
+
UNSAFE_style: {
|
|
28
|
+
width: '100%'
|
|
29
|
+
}
|
|
30
|
+
}, props), /*#__PURE__*/React.createElement(Stack, {
|
|
31
|
+
gap: "scale.100"
|
|
32
|
+
}, children)))));
|
|
36
33
|
}; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
37
34
|
|
|
38
35
|
|
package/dist/es2019/theme.js
CHANGED
|
@@ -1,149 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
light: `var(--ds-background-success-bold, ${G400})`,
|
|
17
|
-
dark: `var(--ds-background-success-bold, ${G300})`
|
|
18
|
-
},
|
|
19
|
-
warning: {
|
|
20
|
-
light: `var(--ds-background-warning-bold, ${Y200})`,
|
|
21
|
-
dark: `var(--ds-background-warning-bold, ${Y300})`
|
|
22
|
-
}
|
|
1
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
2
|
+
import { B100, B400, N0, N200, N30A, N40, N500, N700 } from '@atlaskit/theme/colors';
|
|
3
|
+
export const flagBackgroundColor = {
|
|
4
|
+
error: 'danger.bold',
|
|
5
|
+
info: 'neutral.bold',
|
|
6
|
+
normal: 'elevation.surface.overlay',
|
|
7
|
+
success: 'success.bold',
|
|
8
|
+
warning: 'warning.bold'
|
|
9
|
+
};
|
|
10
|
+
export const flagIconColor = {
|
|
11
|
+
error: `var(--ds-icon-inverse, ${N0})`,
|
|
12
|
+
info: `var(--ds-icon-inverse, ${N0})`,
|
|
13
|
+
normal: `var(--ds-icon-subtle, ${N500})`,
|
|
14
|
+
success: `var(--ds-icon-inverse, ${N0})`,
|
|
15
|
+
warning: `var(--ds-icon-warning-inverse, ${N700})`
|
|
23
16
|
};
|
|
24
|
-
export const getFlagBackgroundColor = (appearance, mode) => flagBackgroundColor[appearance][mode]; // token set in flag.tsx instead
|
|
25
|
-
|
|
26
17
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
27
18
|
|
|
28
|
-
export const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
light: `var(--ds-icon-inverse, ${N0})`,
|
|
35
|
-
dark: `var(--ds-icon-inverse, ${DN40})`
|
|
36
|
-
},
|
|
37
|
-
info: {
|
|
38
|
-
light: `var(--ds-icon-inverse, ${N0})`,
|
|
39
|
-
dark: `var(--ds-icon-inverse, ${DN600})`
|
|
40
|
-
},
|
|
41
|
-
normal: {
|
|
42
|
-
light: `var(--ds-icon-subtle, ${N500})`,
|
|
43
|
-
dark: `var(--ds-icon-subtle, ${DN600})`
|
|
44
|
-
},
|
|
45
|
-
success: {
|
|
46
|
-
light: `var(--ds-icon-inverse, ${N0})`,
|
|
47
|
-
dark: `var(--ds-icon-inverse, ${DN40})`
|
|
48
|
-
},
|
|
49
|
-
warning: {
|
|
50
|
-
light: `var(--ds-icon-warning-inverse, ${N700})`,
|
|
51
|
-
dark: `var(--ds-icon-warning-inverse, ${DN40})`
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
const flagTextColor = {
|
|
55
|
-
error: {
|
|
56
|
-
light: `var(--ds-text-inverse, ${N0})`,
|
|
57
|
-
dark: `var(--ds-text-inverse, ${DN40})`
|
|
58
|
-
},
|
|
59
|
-
info: {
|
|
60
|
-
light: `var(--ds-text-inverse, ${N0})`,
|
|
61
|
-
dark: `var(--ds-text-inverse, ${DN600})`
|
|
62
|
-
},
|
|
63
|
-
normal: {
|
|
64
|
-
light: `var(--ds-text-subtle, ${N500})`,
|
|
65
|
-
dark: `var(--ds-text-subtle, ${DN600})`
|
|
66
|
-
},
|
|
67
|
-
success: {
|
|
68
|
-
light: `var(--ds-text-inverse, ${N0})`,
|
|
69
|
-
dark: `var(--ds-text-inverse, ${DN40})`
|
|
70
|
-
},
|
|
71
|
-
warning: {
|
|
72
|
-
light: `var(--ds-text-warning-inverse, ${N700})`,
|
|
73
|
-
dark: `var(--ds-text-warning-inverse, ${DN40})`
|
|
74
|
-
}
|
|
19
|
+
export const flagTextColor = {
|
|
20
|
+
error: 'inverse',
|
|
21
|
+
info: 'inverse',
|
|
22
|
+
normal: 'subtle',
|
|
23
|
+
success: 'inverse',
|
|
24
|
+
warning: 'warning.inverse'
|
|
75
25
|
};
|
|
76
|
-
export const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
},
|
|
83
|
-
info: {
|
|
84
|
-
light: `var(--ds-border-focused, ${N40})`,
|
|
85
|
-
dark: `var(--ds-border-focused, ${N40})`
|
|
86
|
-
},
|
|
87
|
-
normal: {
|
|
88
|
-
light: `var(--ds-border-focused, ${B100})`,
|
|
89
|
-
dark: `var(--ds-border-focused, ${B100})`
|
|
90
|
-
},
|
|
91
|
-
success: {
|
|
92
|
-
light: `var(--ds-border-focused, ${N40})`,
|
|
93
|
-
dark: `var(--ds-border-focused, ${N40})`
|
|
94
|
-
},
|
|
95
|
-
warning: {
|
|
96
|
-
light: `var(--ds-border-focused, ${N200})`,
|
|
97
|
-
dark: `var(--ds-border-focused, ${N200})`
|
|
98
|
-
}
|
|
26
|
+
export const flagTextColorToken = {
|
|
27
|
+
error: `var(--ds-text-inverse, ${N0})`,
|
|
28
|
+
info: `var(--ds-text-inverse, ${N0})`,
|
|
29
|
+
normal: `var(--ds-text-subtle, ${N500})`,
|
|
30
|
+
success: `var(--ds-text-inverse, ${N0})`,
|
|
31
|
+
warning: `var(--ds-text-warning-inverse, ${N700})`
|
|
99
32
|
};
|
|
100
|
-
export const
|
|
101
|
-
|
|
33
|
+
export const flagFocusRingColor = {
|
|
34
|
+
error: `var(--ds-border-focused, ${N40})`,
|
|
35
|
+
info: `var(--ds-border-focused, ${N40})`,
|
|
36
|
+
normal: `var(--ds-border-focused, ${B100})`,
|
|
37
|
+
success: `var(--ds-border-focused, ${N40})`,
|
|
38
|
+
warning: `var(--ds-border-focused, ${N200})`
|
|
39
|
+
}; // TODO: DSP-2519 Interaction tokens should be used for hovered and pressed states
|
|
102
40
|
// https://product-fabric.atlassian.net/browse/DSP-2519
|
|
103
41
|
|
|
104
|
-
const
|
|
105
|
-
success: {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
light: `var(--ds-background-neutral, ${lightButtonBackground})`,
|
|
111
|
-
dark: `var(--ds-background-neutral, ${lightButtonBackground})`
|
|
112
|
-
},
|
|
113
|
-
error: {
|
|
114
|
-
light: `var(--ds-background-neutral, ${lightButtonBackground})`,
|
|
115
|
-
dark: `var(--ds-background-neutral, ${N30A})`
|
|
116
|
-
},
|
|
117
|
-
warning: {
|
|
118
|
-
light: `var(--ds-background-neutral, ${N30A})`,
|
|
119
|
-
dark: `var(--ds-background-neutral, ${N30A})`
|
|
120
|
-
},
|
|
121
|
-
normal: {
|
|
122
|
-
light: 'none',
|
|
123
|
-
dark: 'none'
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
const actionColor = {
|
|
127
|
-
success: {
|
|
128
|
-
light: `var(--ds-text-inverse, ${N0})`,
|
|
129
|
-
dark: `var(--ds-text-inverse, ${DN40})`
|
|
130
|
-
},
|
|
131
|
-
info: {
|
|
132
|
-
light: `var(--ds-text-inverse, ${N0})`,
|
|
133
|
-
dark: `var(--ds-text-inverse, ${DN600})`
|
|
134
|
-
},
|
|
135
|
-
error: {
|
|
136
|
-
light: `var(--ds-text-inverse, ${N0})`,
|
|
137
|
-
dark: `var(--ds-text-inverse, ${DN600})`
|
|
138
|
-
},
|
|
139
|
-
warning: {
|
|
140
|
-
light: `var(--ds-text-warning-inverse, ${N700})`,
|
|
141
|
-
dark: `var(--ds-text-warning-inverse, ${DN40})`
|
|
142
|
-
},
|
|
143
|
-
normal: {
|
|
144
|
-
light: `var(--ds-link, ${B400})`,
|
|
145
|
-
dark: `var(--ds-link, ${B100})`
|
|
146
|
-
}
|
|
42
|
+
export const actionBackgroundColor = {
|
|
43
|
+
success: `var(--ds-background-neutral, ${N30A})`,
|
|
44
|
+
info: `var(--ds-background-neutral, ${N30A})`,
|
|
45
|
+
error: `var(--ds-background-neutral, ${N30A})`,
|
|
46
|
+
warning: `var(--ds-background-neutral, ${N30A})`,
|
|
47
|
+
normal: 'none'
|
|
147
48
|
};
|
|
148
|
-
export const
|
|
149
|
-
|
|
49
|
+
export const actionTextColor = {
|
|
50
|
+
success: `var(--ds-text-inverse, ${N0})`,
|
|
51
|
+
info: `var(--ds-text-inverse, ${N0})`,
|
|
52
|
+
error: `var(--ds-text-inverse, ${N0})`,
|
|
53
|
+
warning: `var(--ds-text-warning-inverse, ${N700})`,
|
|
54
|
+
normal: `var(--ds-link, ${B400})`
|
|
55
|
+
};
|
package/dist/es2019/version.json
CHANGED
|
@@ -5,7 +5,7 @@ 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 = "
|
|
8
|
+
var packageVersion = "15.0.0";
|
|
9
9
|
export var AUTO_DISMISS_SECONDS = 8;
|
|
10
10
|
/**
|
|
11
11
|
* __Auto dismiss flag__
|
package/dist/esm/flag-actions.js
CHANGED
|
@@ -3,30 +3,13 @@
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
5
|
import Button from '@atlaskit/button/custom-theme-button';
|
|
6
|
+
import { UNSAFE_Inline as Inline } from '@atlaskit/ds-explorations';
|
|
6
7
|
import { gridSize as getGridSize } from '@atlaskit/theme/constants';
|
|
7
8
|
import { DEFAULT_APPEARANCE } from './constants';
|
|
8
|
-
import {
|
|
9
|
+
import { flagFocusRingColor, actionBackgroundColor, actionTextColor } from './theme';
|
|
9
10
|
var gridSize = getGridSize();
|
|
10
|
-
var separatorWidth = gridSize * 2;
|
|
11
|
-
var defaultAppearanceTranslate = gridSize / 4;
|
|
12
|
-
var separatorStyles = css({
|
|
13
|
-
display: 'inline-block',
|
|
14
|
-
width: separatorWidth,
|
|
15
|
-
textAlign: 'center'
|
|
16
|
-
});
|
|
17
|
-
var actionContainerStyles = css({
|
|
18
|
-
display: 'flex',
|
|
19
|
-
paddingTop: gridSize,
|
|
20
|
-
alignItems: 'center',
|
|
21
|
-
flexWrap: 'wrap',
|
|
22
|
-
transform: "translateX(-".concat(defaultAppearanceTranslate, "px)")
|
|
23
|
-
});
|
|
24
|
-
var boldActionContainerStyles = css({
|
|
25
|
-
transform: 0
|
|
26
|
-
});
|
|
27
11
|
var buttonStyles = css({
|
|
28
12
|
'&&, a&&': {
|
|
29
|
-
marginLeft: 0,
|
|
30
13
|
padding: "0 ".concat(gridSize, "px !important"),
|
|
31
14
|
background: "var(--bg-color)",
|
|
32
15
|
color: "var(--color) !important",
|
|
@@ -39,16 +22,11 @@ var buttonStyles = css({
|
|
|
39
22
|
textDecoration: 'underline'
|
|
40
23
|
}
|
|
41
24
|
});
|
|
42
|
-
var
|
|
25
|
+
var appearanceNormalButtonStyles = css({
|
|
43
26
|
'&&, a&&': {
|
|
44
27
|
padding: '0 !important'
|
|
45
28
|
}
|
|
46
29
|
});
|
|
47
|
-
var isBoldButtonStyles = css({
|
|
48
|
-
'&&, a&&': {
|
|
49
|
-
marginRight: gridSize
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
30
|
|
|
53
31
|
var FlagActions = function FlagActions(props) {
|
|
54
32
|
var _props$appearance = props.appearance,
|
|
@@ -56,7 +34,6 @@ var FlagActions = function FlagActions(props) {
|
|
|
56
34
|
_props$actions = props.actions,
|
|
57
35
|
actions = _props$actions === void 0 ? [] : _props$actions,
|
|
58
36
|
linkComponent = props.linkComponent,
|
|
59
|
-
mode = props.mode,
|
|
60
37
|
testId = props.testId;
|
|
61
38
|
|
|
62
39
|
if (!actions.length) {
|
|
@@ -64,14 +41,17 @@ var FlagActions = function FlagActions(props) {
|
|
|
64
41
|
}
|
|
65
42
|
|
|
66
43
|
var isBold = appearance !== DEFAULT_APPEARANCE;
|
|
67
|
-
return jsx(
|
|
68
|
-
|
|
69
|
-
|
|
44
|
+
return jsx(Inline, {
|
|
45
|
+
gap: "scale.100",
|
|
46
|
+
flexWrap: "wrap",
|
|
47
|
+
alignItems: "center",
|
|
48
|
+
divider: isBold ? null : '·',
|
|
49
|
+
UNSAFE_style: isBold ? undefined : {
|
|
50
|
+
transform: "translateX(-2px)"
|
|
51
|
+
},
|
|
52
|
+
testId: testId && "".concat(testId, "-actions")
|
|
70
53
|
}, actions.map(function (action, index) {
|
|
71
|
-
return
|
|
72
|
-
css: separatorStyles,
|
|
73
|
-
key: index + 0.5
|
|
74
|
-
}, "\xB7") : '', jsx(Button, {
|
|
54
|
+
return jsx(Button, {
|
|
75
55
|
onClick: action.onClick,
|
|
76
56
|
href: action.href,
|
|
77
57
|
target: action.target,
|
|
@@ -81,12 +61,12 @@ var FlagActions = function FlagActions(props) {
|
|
|
81
61
|
testId: action.testId,
|
|
82
62
|
key: index,
|
|
83
63
|
style: {
|
|
84
|
-
'--color':
|
|
85
|
-
'--bg-color':
|
|
86
|
-
'--focus-color':
|
|
64
|
+
'--color': actionTextColor[appearance],
|
|
65
|
+
'--bg-color': actionBackgroundColor[appearance],
|
|
66
|
+
'--focus-color': flagFocusRingColor[appearance]
|
|
87
67
|
},
|
|
88
|
-
css: [buttonStyles,
|
|
89
|
-
}, action.content)
|
|
68
|
+
css: [buttonStyles, appearance === 'normal' && appearanceNormalButtonStyles]
|
|
69
|
+
}, action.content);
|
|
90
70
|
}));
|
|
91
71
|
}; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
92
72
|
|
package/dist/esm/flag-group.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
import _typeof from "@babel/runtime/helpers/typeof";
|
|
3
2
|
|
|
4
3
|
/** @jsx jsx */
|
|
5
4
|
import { Children, createContext, useContext, useMemo } from 'react';
|
|
6
5
|
import { css, jsx } from '@emotion/react';
|
|
6
|
+
import { UNSAFE_Box as Box } from '@atlaskit/ds-explorations';
|
|
7
7
|
import { easeIn, ExitingPersistence, SlideIn } from '@atlaskit/motion';
|
|
8
8
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
9
9
|
import noop from '@atlaskit/ds-lib/noop';
|
|
@@ -28,7 +28,6 @@ export function useFlagGroup() {
|
|
|
28
28
|
|
|
29
29
|
var baseStyles = css({
|
|
30
30
|
width: flagWidth,
|
|
31
|
-
position: 'absolute',
|
|
32
31
|
bottom: 0,
|
|
33
32
|
transition: "transform ".concat(flagAnimationTime, "ms ease-in-out"),
|
|
34
33
|
'@media (max-width: 560px)': {
|
|
@@ -62,7 +61,6 @@ var dismissAllowedStyles = css({
|
|
|
62
61
|
}
|
|
63
62
|
});
|
|
64
63
|
var flagGroupContainerStyles = css({
|
|
65
|
-
position: 'fixed',
|
|
66
64
|
zIndex: layers.flag(),
|
|
67
65
|
bottom: flagBottom,
|
|
68
66
|
left: flagLeft,
|
|
@@ -107,10 +105,16 @@ var FlagGroup = function FlagGroup(props) {
|
|
|
107
105
|
animationTimingFunction: function animationTimingFunction() {
|
|
108
106
|
return easeIn;
|
|
109
107
|
}
|
|
110
|
-
}, function (
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
108
|
+
}, function (_ref) {
|
|
109
|
+
var className = _ref.className,
|
|
110
|
+
ref = _ref.ref;
|
|
111
|
+
return jsx(Box, {
|
|
112
|
+
display: "block",
|
|
113
|
+
position: "absolute",
|
|
114
|
+
css: [baseStyles, isDismissAllowed && dismissAllowedStyles],
|
|
115
|
+
className: className,
|
|
116
|
+
ref: ref
|
|
117
|
+
}, jsx(FlagGroupContext.Provider, {
|
|
114
118
|
value: // Only the first flag should be able to be dismissed.
|
|
115
119
|
isDismissAllowed ? dismissFlagContext : defaultFlagGroupContext
|
|
116
120
|
}, flag));
|
|
@@ -120,7 +124,9 @@ var FlagGroup = function FlagGroup(props) {
|
|
|
120
124
|
|
|
121
125
|
return jsx(Portal, {
|
|
122
126
|
zIndex: layers.flag()
|
|
123
|
-
}, jsx(
|
|
127
|
+
}, jsx(Box, {
|
|
128
|
+
display: "block",
|
|
129
|
+
position: "fixed",
|
|
124
130
|
id: id,
|
|
125
131
|
css: flagGroupContainerStyles
|
|
126
132
|
}, hasFlags ? jsx(VisuallyHidden, null, jsx(LabelTag, null, label)) : null, jsx(ExitingPersistence, {
|
package/dist/esm/flag.js
CHANGED
|
@@ -8,50 +8,21 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
8
8
|
|
|
9
9
|
/** @jsx jsx */
|
|
10
10
|
import { useCallback, useEffect, useState } from 'react';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { borderRadius, //gridSize as getGridSize,
|
|
14
|
-
layers } from '@atlaskit/theme/constants';
|
|
11
|
+
import { jsx } from '@emotion/react';
|
|
12
|
+
import { UNSAFE_Box as Box, UNSAFE_Inline as Inline, UNSAFE_Stack as Stack, UNSAFE_Text as Text } from '@atlaskit/ds-explorations';
|
|
15
13
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
|
|
16
14
|
import noop from '@atlaskit/ds-lib/noop';
|
|
17
15
|
import FocusRing from '@atlaskit/focus-ring';
|
|
18
16
|
import { DEFAULT_APPEARANCE } from './constants';
|
|
19
|
-
import {
|
|
17
|
+
import { flagTextColor, flagBackgroundColor, flagIconColor } from './theme';
|
|
20
18
|
import Actions from './flag-actions';
|
|
21
19
|
import { useFlagGroup } from './flag-group';
|
|
22
|
-
import {
|
|
20
|
+
import { Expander, DismissButton } from './internal';
|
|
23
21
|
var analyticsAttributes = {
|
|
24
22
|
componentName: 'flag',
|
|
25
23
|
packageName: "@atlaskit/flag",
|
|
26
|
-
packageVersion: "
|
|
27
|
-
};
|
|
28
|
-
// const gridSize = getGridSize();
|
|
29
|
-
// const doubleGridSize = gridSize * 2;
|
|
30
|
-
|
|
31
|
-
var titleGroupStyles = css({
|
|
32
|
-
display: 'flex',
|
|
33
|
-
alignItems: 'start'
|
|
34
|
-
});
|
|
35
|
-
var iconTitleStyles = css({
|
|
36
|
-
display: 'flex',
|
|
37
|
-
// TODO Delete this comment after verifying spacing token -> previous value ``${gridSize / 2}px``
|
|
38
|
-
paddingTop: "var(--ds-scale-050, 4px)",
|
|
39
|
-
alignItems: 'start',
|
|
40
|
-
flex: 1
|
|
41
|
-
});
|
|
42
|
-
var flagHeaderStyles = css({
|
|
43
|
-
boxSizing: 'border-box',
|
|
44
|
-
width: '100%',
|
|
45
|
-
// TODO Delete this comment after verifying spacing token -> previous value `doubleGridSize`
|
|
46
|
-
padding: "var(--ds-scale-200, 16px)",
|
|
47
|
-
borderRadius: borderRadius()
|
|
48
|
-
});
|
|
49
|
-
var flagContainerStyles = css({
|
|
50
|
-
width: '100%',
|
|
51
|
-
zIndex: layers.flag(),
|
|
52
|
-
borderRadius: borderRadius(),
|
|
53
|
-
transition: 'background-color 200ms'
|
|
54
|
-
});
|
|
24
|
+
packageVersion: "15.0.0"
|
|
25
|
+
};
|
|
55
26
|
/**
|
|
56
27
|
* __Flag__
|
|
57
28
|
*
|
|
@@ -136,42 +107,55 @@ var Flag = function Flag(props) {
|
|
|
136
107
|
onMouseOut: onMouseOut,
|
|
137
108
|
onBlur: onBlurAnalytics
|
|
138
109
|
};
|
|
139
|
-
var
|
|
140
|
-
|
|
141
|
-
if (!isBold) {
|
|
142
|
-
boxShadowValue = "0 0 1px ".concat(flagBorderColor, ", ").concat(boxShadowValue);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
var boxShadow = "var(--ds-shadow-overlay, ".concat(boxShadowValue, ")");
|
|
146
|
-
|
|
147
|
-
var _useGlobalTheme = useGlobalTheme(),
|
|
148
|
-
mode = _useGlobalTheme.mode;
|
|
149
|
-
|
|
150
|
-
var textColor = getFlagTextColor(appearance, mode);
|
|
151
|
-
var iconColor = getFlagIconColor(appearance, mode);
|
|
110
|
+
var textColor = flagTextColor[appearance];
|
|
111
|
+
var iconColor = flagIconColor[appearance];
|
|
152
112
|
var isDismissable = isBold || isDismissAllowed;
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
113
|
+
var shouldRenderGap = !isBold && (description || actions.length) || isExpanded;
|
|
114
|
+
return jsx(FocusRing, null, jsx(Box, _extends({
|
|
115
|
+
display: "block",
|
|
116
|
+
backgroundColor: flagBackgroundColor[appearance],
|
|
117
|
+
shadow: "overlay",
|
|
118
|
+
padding: "scale.200",
|
|
119
|
+
borderRadius: "normal",
|
|
120
|
+
overflow: "hidden",
|
|
121
|
+
layer: "flag",
|
|
122
|
+
UNSAFE_style: {
|
|
123
|
+
width: '100%',
|
|
124
|
+
transition: 'background-color 200ms'
|
|
158
125
|
},
|
|
159
|
-
css: flagContainerStyles,
|
|
160
126
|
role: "alert",
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
127
|
+
tabIndex: 0,
|
|
128
|
+
testId: testId
|
|
129
|
+
}, autoDismissProps), jsx(Inline, {
|
|
130
|
+
gap: "scale.200"
|
|
131
|
+
}, jsx(Box, {
|
|
132
|
+
alignItems: "start",
|
|
133
|
+
UNSAFE_style: {
|
|
134
|
+
color: iconColor,
|
|
135
|
+
flexShrink: 0
|
|
136
|
+
}
|
|
137
|
+
}, icon), jsx(Stack, {
|
|
138
|
+
gap: shouldRenderGap ? 'scale.100' : 'scale.0' // Gap exists even when not expanded due to Expander internals always being in the DOM
|
|
164
139
|
,
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
140
|
+
UNSAFE_style: {
|
|
141
|
+
flexGrow: 1,
|
|
142
|
+
transition: "gap 0.3s"
|
|
143
|
+
}
|
|
144
|
+
}, jsx(Inline, {
|
|
145
|
+
gap: "scale.100",
|
|
146
|
+
justifyContent: "spaceBetween"
|
|
147
|
+
}, jsx(Box, {
|
|
148
|
+
display: "block",
|
|
149
|
+
UNSAFE_style: {
|
|
150
|
+
paddingTop: 2
|
|
151
|
+
}
|
|
152
|
+
}, jsx(Text, {
|
|
153
|
+
color: textColor,
|
|
154
|
+
fontWeight: "600",
|
|
155
|
+
UNSAFE_style: {
|
|
156
|
+
overflowWrap: 'anywhere' // For cases where a single word is longer than the container (e.g. filenames)
|
|
157
|
+
|
|
158
|
+
}
|
|
175
159
|
}, title)), isDismissable ? !(isBold && !description && !actions.length) && jsx(DismissButton, {
|
|
176
160
|
testId: testId,
|
|
177
161
|
appearance: appearance,
|
|
@@ -181,17 +165,23 @@ var Flag = function Flag(props) {
|
|
|
181
165
|
}) : null), jsx(Expander, {
|
|
182
166
|
isExpanded: !isBold || isExpanded,
|
|
183
167
|
testId: testId
|
|
184
|
-
}, description && jsx(
|
|
185
|
-
|
|
168
|
+
}, description && jsx(Text, {
|
|
169
|
+
as: "div",
|
|
186
170
|
color: textColor,
|
|
187
|
-
|
|
171
|
+
UNSAFE_style: {
|
|
172
|
+
maxHeight: 100,
|
|
173
|
+
// height is defined as 5 lines maximum by design
|
|
174
|
+
overflow: 'auto',
|
|
175
|
+
overflowWrap: 'anywhere' // For cases where a single word is longer than the container (e.g. filenames)
|
|
176
|
+
|
|
177
|
+
},
|
|
178
|
+
testId: testId && "".concat(testId, "-description")
|
|
188
179
|
}, description), jsx(Actions, {
|
|
189
180
|
actions: actions,
|
|
190
181
|
appearance: appearance,
|
|
191
182
|
linkComponent: linkComponent,
|
|
192
|
-
testId: testId
|
|
193
|
-
|
|
194
|
-
})))));
|
|
183
|
+
testId: testId
|
|
184
|
+
}))))));
|
|
195
185
|
};
|
|
196
186
|
|
|
197
187
|
export default Flag;
|