@atlaskit/flag 15.2.27 → 15.3.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/flag
2
2
 
3
+ ## 15.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#85860](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/85860) [`6c6d44b0293f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6c6d44b0293f) - Add shouldRenderToParent prop on flag group to render directly in the parent so the flags can be acessed in aria-modal components
8
+
3
9
  ## 15.2.27
4
10
 
5
11
  ### Patch Changes
@@ -15,7 +15,7 @@ var _flagGroup = require("./flag-group");
15
15
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
16
16
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
17
17
  var packageName = "@atlaskit/flag";
18
- var packageVersion = "15.2.27";
18
+ var packageVersion = "15.3.0";
19
19
  var AUTO_DISMISS_SECONDS = exports.AUTO_DISMISS_SECONDS = 8;
20
20
 
21
21
  /**
@@ -39,7 +39,7 @@ function useFlagGroup() {
39
39
  var baseStyles = (0, _react2.css)({
40
40
  width: flagWidth,
41
41
  position: 'absolute',
42
- bottom: 0,
42
+ insetBlockEnd: 0,
43
43
  transition: "transform ".concat(flagAnimationTime, "ms ease-in-out"),
44
44
  // TODO: Use new breakpoints
45
45
  // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
@@ -77,13 +77,13 @@ var dismissAllowedStyles = (0, _react2.css)({
77
77
  var flagGroupContainerStyles = (0, _react2.css)({
78
78
  position: 'fixed',
79
79
  zIndex: 'flag',
80
- bottom: "var(--ds-space-600, 48px)",
81
- left: "var(--ds-space-1000, 80px)",
80
+ insetBlockEnd: "var(--ds-space-600, 48px)",
81
+ insetInlineStart: "var(--ds-space-1000, 80px)",
82
82
  // TODO: Use new breakpoints
83
83
  // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
84
84
  '@media (max-width: 560px)': {
85
- bottom: 0,
86
- left: 0
85
+ insetBlockEnd: 0,
86
+ insetInlineStart: 0
87
87
  }
88
88
  });
89
89
 
@@ -101,6 +101,8 @@ var FlagGroup = function FlagGroup(props) {
101
101
  label = _props$label === void 0 ? 'Flag notifications' : _props$label,
102
102
  _props$labelTag = props.labelTag,
103
103
  LabelTag = _props$labelTag === void 0 ? 'h2' : _props$labelTag,
104
+ _props$shouldRenderTo = props.shouldRenderToParent,
105
+ shouldRenderToParent = _props$shouldRenderTo === void 0 ? false : _props$shouldRenderTo,
104
106
  children = props.children,
105
107
  _props$onDismissed = props.onDismissed,
106
108
  onDismissed = _props$onDismissed === void 0 ? _noop.default : _props$onDismissed;
@@ -136,13 +138,14 @@ var FlagGroup = function FlagGroup(props) {
136
138
  });
137
139
  }) : false;
138
140
  };
139
- return (0, _react2.jsx)(_portal.default, {
140
- zIndex: _constants.layers.flag()
141
- }, (0, _react2.jsx)("div", {
141
+ var flags = (0, _react2.jsx)("div", {
142
142
  id: id,
143
143
  css: flagGroupContainerStyles
144
144
  }, hasFlags ? (0, _react2.jsx)(_visuallyHidden.default, null, (0, _react2.jsx)(LabelTag, null, label)) : null, (0, _react2.jsx)(_motion.ExitingPersistence, {
145
145
  appear: false
146
- }, renderChildren())));
146
+ }, renderChildren()));
147
+ return shouldRenderToParent ? flags : (0, _react2.jsx)(_portal.default, {
148
+ zIndex: _constants.layers.flag()
149
+ }, flags);
147
150
  };
148
151
  var _default = exports.default = FlagGroup;
package/dist/cjs/flag.js CHANGED
@@ -42,7 +42,7 @@ var flagWrapperStyles = (0, _react2.css)({
42
42
  var analyticsAttributes = {
43
43
  componentName: 'flag',
44
44
  packageName: "@atlaskit/flag",
45
- packageVersion: "15.2.27"
45
+ packageVersion: "15.3.0"
46
46
  };
47
47
  var transitionStyles = (0, _react2.css)({
48
48
  flexGrow: 1,
@@ -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
  const packageName = "@atlaskit/flag";
8
- const packageVersion = "15.2.27";
8
+ const packageVersion = "15.3.0";
9
9
  export const AUTO_DISMISS_SECONDS = 8;
10
10
 
11
11
  /**
@@ -29,7 +29,7 @@ export function useFlagGroup() {
29
29
  const baseStyles = css({
30
30
  width: flagWidth,
31
31
  position: 'absolute',
32
- bottom: 0,
32
+ insetBlockEnd: 0,
33
33
  transition: `transform ${flagAnimationTime}ms ease-in-out`,
34
34
  // TODO: Use new breakpoints
35
35
  // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
@@ -67,13 +67,13 @@ const dismissAllowedStyles = css({
67
67
  const flagGroupContainerStyles = css({
68
68
  position: 'fixed',
69
69
  zIndex: 'flag',
70
- bottom: "var(--ds-space-600, 48px)",
71
- left: "var(--ds-space-1000, 80px)",
70
+ insetBlockEnd: "var(--ds-space-600, 48px)",
71
+ insetInlineStart: "var(--ds-space-1000, 80px)",
72
72
  // TODO: Use new breakpoints
73
73
  // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
74
74
  '@media (max-width: 560px)': {
75
- bottom: 0,
76
- left: 0
75
+ insetBlockEnd: 0,
76
+ insetInlineStart: 0
77
77
  }
78
78
  });
79
79
 
@@ -90,6 +90,7 @@ const FlagGroup = props => {
90
90
  id,
91
91
  label = 'Flag notifications',
92
92
  labelTag: LabelTag = 'h2',
93
+ shouldRenderToParent = false,
93
94
  children,
94
95
  onDismissed = noop
95
96
  } = props;
@@ -120,13 +121,14 @@ const FlagGroup = props => {
120
121
  }, flag)));
121
122
  }) : false;
122
123
  };
123
- return jsx(Portal, {
124
- zIndex: layers.flag()
125
- }, jsx("div", {
124
+ const flags = jsx("div", {
126
125
  id: id,
127
126
  css: flagGroupContainerStyles
128
127
  }, hasFlags ? jsx(VisuallyHidden, null, jsx(LabelTag, null, label)) : null, jsx(ExitingPersistence, {
129
128
  appear: false
130
- }, renderChildren())));
129
+ }, renderChildren()));
130
+ return shouldRenderToParent ? flags : jsx(Portal, {
131
+ zIndex: layers.flag()
132
+ }, flags);
131
133
  };
132
134
  export default FlagGroup;
@@ -32,7 +32,7 @@ const flagWrapperStyles = css({
32
32
  const analyticsAttributes = {
33
33
  componentName: 'flag',
34
34
  packageName: "@atlaskit/flag",
35
- packageVersion: "15.2.27"
35
+ packageVersion: "15.3.0"
36
36
  };
37
37
  const transitionStyles = css({
38
38
  flexGrow: 1,
@@ -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 = "15.2.27";
8
+ var packageVersion = "15.3.0";
9
9
  export var AUTO_DISMISS_SECONDS = 8;
10
10
 
11
11
  /**
@@ -30,7 +30,7 @@ export function useFlagGroup() {
30
30
  var baseStyles = css({
31
31
  width: flagWidth,
32
32
  position: 'absolute',
33
- bottom: 0,
33
+ insetBlockEnd: 0,
34
34
  transition: "transform ".concat(flagAnimationTime, "ms ease-in-out"),
35
35
  // TODO: Use new breakpoints
36
36
  // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
@@ -68,13 +68,13 @@ var dismissAllowedStyles = css({
68
68
  var flagGroupContainerStyles = css({
69
69
  position: 'fixed',
70
70
  zIndex: 'flag',
71
- bottom: "var(--ds-space-600, 48px)",
72
- left: "var(--ds-space-1000, 80px)",
71
+ insetBlockEnd: "var(--ds-space-600, 48px)",
72
+ insetInlineStart: "var(--ds-space-1000, 80px)",
73
73
  // TODO: Use new breakpoints
74
74
  // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
75
75
  '@media (max-width: 560px)': {
76
- bottom: 0,
77
- left: 0
76
+ insetBlockEnd: 0,
77
+ insetInlineStart: 0
78
78
  }
79
79
  });
80
80
 
@@ -92,6 +92,8 @@ var FlagGroup = function FlagGroup(props) {
92
92
  label = _props$label === void 0 ? 'Flag notifications' : _props$label,
93
93
  _props$labelTag = props.labelTag,
94
94
  LabelTag = _props$labelTag === void 0 ? 'h2' : _props$labelTag,
95
+ _props$shouldRenderTo = props.shouldRenderToParent,
96
+ shouldRenderToParent = _props$shouldRenderTo === void 0 ? false : _props$shouldRenderTo,
95
97
  children = props.children,
96
98
  _props$onDismissed = props.onDismissed,
97
99
  onDismissed = _props$onDismissed === void 0 ? noop : _props$onDismissed;
@@ -127,13 +129,14 @@ var FlagGroup = function FlagGroup(props) {
127
129
  });
128
130
  }) : false;
129
131
  };
130
- return jsx(Portal, {
131
- zIndex: layers.flag()
132
- }, jsx("div", {
132
+ var flags = jsx("div", {
133
133
  id: id,
134
134
  css: flagGroupContainerStyles
135
135
  }, hasFlags ? jsx(VisuallyHidden, null, jsx(LabelTag, null, label)) : null, jsx(ExitingPersistence, {
136
136
  appear: false
137
- }, renderChildren())));
137
+ }, renderChildren()));
138
+ return shouldRenderToParent ? flags : jsx(Portal, {
139
+ zIndex: layers.flag()
140
+ }, flags);
138
141
  };
139
142
  export default FlagGroup;
package/dist/esm/flag.js CHANGED
@@ -36,7 +36,7 @@ var flagWrapperStyles = css({
36
36
  var analyticsAttributes = {
37
37
  componentName: 'flag',
38
38
  packageName: "@atlaskit/flag",
39
- packageVersion: "15.2.27"
39
+ packageVersion: "15.3.0"
40
40
  };
41
41
  var transitionStyles = css({
42
42
  flexGrow: 1,
@@ -23,6 +23,12 @@ type FlagGroupProps = {
23
23
  * Receives the id of the dismissed Flag as a parameter.
24
24
  */
25
25
  onDismissed?: (id: number | string, analyticsEvent: UIAnalyticsEvent) => void;
26
+ /**
27
+ * The root element where the flag group should be rendered.
28
+ * `true` - rendering in the DOM node closest to the trigger. `false` - rendering in React.Portal.
29
+ * Defaults to `false`.
30
+ */
31
+ shouldRenderToParent?: boolean;
26
32
  };
27
33
  export declare const flagWidth: number;
28
34
  export declare const flagAnimationTime = 400;
@@ -23,6 +23,12 @@ type FlagGroupProps = {
23
23
  * Receives the id of the dismissed Flag as a parameter.
24
24
  */
25
25
  onDismissed?: (id: number | string, analyticsEvent: UIAnalyticsEvent) => void;
26
+ /**
27
+ * The root element where the flag group should be rendered.
28
+ * `true` - rendering in the DOM node closest to the trigger. `false` - rendering in React.Portal.
29
+ * Defaults to `false`.
30
+ */
31
+ shouldRenderToParent?: boolean;
26
32
  };
27
33
  export declare const flagWidth: number;
28
34
  export declare const flagAnimationTime = 400;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/flag",
3
- "version": "15.2.27",
3
+ "version": "15.3.0",
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/"
@@ -46,7 +46,7 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@atlaskit/analytics-next": "^9.2.0",
49
- "@atlaskit/button": "^17.7.0",
49
+ "@atlaskit/button": "^17.8.0",
50
50
  "@atlaskit/ds-explorations": "^3.3.0",
51
51
  "@atlaskit/ds-lib": "^2.2.0",
52
52
  "@atlaskit/focus-ring": "^1.3.0",
@@ -54,7 +54,7 @@
54
54
  "@atlaskit/motion": "^1.5.0",
55
55
  "@atlaskit/portal": "^4.4.0",
56
56
  "@atlaskit/primitives": "^5.1.0",
57
- "@atlaskit/theme": "^12.6.0",
57
+ "@atlaskit/theme": "^12.7.0",
58
58
  "@atlaskit/tokens": "^1.42.0",
59
59
  "@atlaskit/visually-hidden": "^1.2.0",
60
60
  "@babel/runtime": "^7.0.0",