@commercetools-frontend/application-components 22.40.0 → 22.41.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.
@@ -20,9 +20,10 @@ var utils = require('@commercetools-uikit/utils');
20
20
  var react = require('@emotion/react');
21
21
  var designSystem = require('@commercetools-uikit/design-system');
22
22
  var jsxRuntime = require('@emotion/react/jsx-runtime');
23
- var react$1 = require('react');
23
+ var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
24
24
  var _styled = require('@emotion/styled/base');
25
- var Modal = require('react-modal');
25
+ var react$1 = require('react');
26
+ var reactDialog = require('@radix-ui/react-dialog');
26
27
  var constants = require('@commercetools-frontend/constants');
27
28
  var Card = require('@commercetools-uikit/card');
28
29
  var icons = require('@commercetools-uikit/icons');
@@ -34,7 +35,6 @@ var SecondaryButton = require('@commercetools-uikit/secondary-button');
34
35
  var _startsWithInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/starts-with');
35
36
  var omitBy = require('lodash/omitBy');
36
37
  var _Promise = require('@babel/runtime-corejs3/core-js-stable/promise');
37
- var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
38
38
  var _setTimeout = require('@babel/runtime-corejs3/core-js-stable/set-timeout');
39
39
  var FlatButton = require('@commercetools-uikit/flat-button');
40
40
  var IconButton = require('@commercetools-uikit/icon-button');
@@ -63,7 +63,6 @@ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$def
63
63
  var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
64
64
  var Text__default = /*#__PURE__*/_interopDefault(Text);
65
65
  var _styled__default = /*#__PURE__*/_interopDefault(_styled);
66
- var Modal__default = /*#__PURE__*/_interopDefault(Modal);
67
66
  var Card__default = /*#__PURE__*/_interopDefault(Card);
68
67
  var SecondaryIconButton__default = /*#__PURE__*/_interopDefault(SecondaryIconButton);
69
68
  var Spacings__default = /*#__PURE__*/_interopDefault(Spacings);
@@ -84,7 +83,7 @@ var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstancePro
84
83
  var useResizeObserver__default = /*#__PURE__*/_interopDefault(useResizeObserver);
85
84
 
86
85
  // NOTE: This string will be replaced on build time with the package version.
87
- var version = "22.40.0";
86
+ var version = "22.41.0";
88
87
 
89
88
  // We keep these tokens as they are related to page layout components which should have
90
89
  // a slightly different layout (margins/paddings) when used within a Custom View panel.
@@ -106,15 +105,15 @@ const designTokens = designSystem.transformTokensToCssVarsReferences(themesOverr
106
105
  });
107
106
 
108
107
  const getBottomBorderStyles = background => /*#__PURE__*/react.css(":after{content:'';position:absolute;bottom:0;left:0;right:0;height:2px;border-radius:", designSystem.designTokens.borderRadius2, ";background-color:", background, ";transition:background-color ", designSystem.designTokens.transitionEaseinout150Ms, ";}" + ("" ), "" );
109
- var _ref$8 = {
108
+ var _ref$7 = {
110
109
  name: "1u0tiat",
111
110
  styles: "&[aria-disabled='true']{cursor:not-allowed;opacity:0.5;&:active{pointer-events:none;}}"
112
111
  } ;
113
- const getLinkStyles = (isActive, isDisabled) => [/*#__PURE__*/react.css("font-size:", designSystem.designTokens.fontSize30, ";padding:", designSystem.designTokens.spacingS, " ", designSystem.designTokens.spacingM, ";position:relative;text-align:center;display:inline-block;color:inherit;text-decoration:inherit;&:first-of-type{padding-left:", designSystem.designTokens.spacing30, ";}", getBottomBorderStyles('transparent'), ";" + ("" ), "" ), isActive && /*#__PURE__*/react.css(getBottomBorderStyles(designSystem.designTokens.colorPrimary), " & h3{color:", designTokens.fontColorForTabLabelWhenActive, "!important;}" + ("" ), "" ), isDisabled && _ref$8, !isActive && !isDisabled && /*#__PURE__*/react.css(":hover,:focus,:active{& h3{color:", designTokens.fontColorForTabLabelWhenActive, "!important;}}" + ("" ), "" )];
112
+ const getLinkStyles = (isActive, isDisabled) => [/*#__PURE__*/react.css("font-size:", designSystem.designTokens.fontSize30, ";padding:", designSystem.designTokens.spacingS, " ", designSystem.designTokens.spacingM, ";position:relative;text-align:center;display:inline-block;color:inherit;text-decoration:inherit;&:first-of-type{padding-left:", designSystem.designTokens.spacing30, ";}", getBottomBorderStyles('transparent'), ";" + ("" ), "" ), isActive && /*#__PURE__*/react.css(getBottomBorderStyles(designSystem.designTokens.colorPrimary), " & h3{color:", designTokens.fontColorForTabLabelWhenActive, "!important;}" + ("" ), "" ), isDisabled && _ref$7, !isActive && !isDisabled && /*#__PURE__*/react.css(":hover,:focus,:active{& h3{color:", designTokens.fontColorForTabLabelWhenActive, "!important;}}" + ("" ), "" )];
114
113
 
115
114
  const _excluded$k = ["isDisabled", "exactPathMatch"];
116
- function ownKeys$7(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
117
- function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$7(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$7(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
115
+ function ownKeys$5(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
116
+ function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$5(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$5(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
118
117
  const pathWithoutSearch = path => typeof path === 'string' ? path.split('?')[0] : path.pathname;
119
118
  const warnIfMissingContent = props => {
120
119
  Boolean(props.intlMessage) || Boolean(props.label);
@@ -149,11 +148,11 @@ const TabHeader = _ref2 => {
149
148
  if (props.intlMessage) {
150
149
  label = intl.formatMessage(props.intlMessage);
151
150
  }
152
- warnIfMissingContent(_objectSpread$7({
151
+ warnIfMissingContent(_objectSpread$5({
153
152
  exactPathMatch,
154
153
  isDisabled
155
154
  }, props));
156
- return jsxRuntime.jsx(reactRouterDom.Link, _objectSpread$7(_objectSpread$7({
155
+ return jsxRuntime.jsx(reactRouterDom.Link, _objectSpread$5(_objectSpread$5({
157
156
  role: "tab",
158
157
  "aria-selected": isActive,
159
158
  to: props.to,
@@ -199,32 +198,42 @@ const getModalContentStyles = props => {
199
198
 
200
199
  // To ensure that the mouse click on the overlay surface goes "through"
201
200
  // and triggers the modal to close, we need to turn off the pointer events.
202
- const baseStyles = /*#__PURE__*/react.css("display:grid;height:100%;width:100%;outline:none;pointer-events:none;", gridStyle, ";" + ("" ), "" );
201
+ const baseStyles = /*#__PURE__*/react.css("display:grid;height:100%;width:100%;outline:none;position:relative;pointer-events:none;z-index:", typeof props.zIndex === 'number' ?
202
+ // Use `!important` to overwrite the default value assigned by the Stacking Layer System.
203
+ // We're assigning value 1 unit higher than the overlay to ensure the content is on top.
204
+ // It's safe to do that since the modal is topmost in the stacking layer.
205
+ `${props.zIndex + 1} !important` : 'auto', ";", gridStyle, ";" + ("" ), "" );
203
206
  return baseStyles;
204
207
  };
205
- const getOverlayStyles$1 = props => /*#__PURE__*/react.css("display:flex;position:absolute;z-index:", typeof props.zIndex === 'number' ?
206
- // Use `!important` to overwrite the default value assigned by the Stacking Layer System.
207
- `${props.zIndex} !important` : 'auto', ";top:0;width:100%;height:100%;background-color:rgba(32, 62, 72, 0.5);opacity:1;" + ("" ), "" );
208
+ const ClickableDialogContent = /*#__PURE__*/_styled__default["default"](reactDialog.Content, {
209
+ target: "e1nocpaa2"
210
+ } )(props => getModalContentStyles(props), ";" + ("" ));
211
+ const DialogOverlay = /*#__PURE__*/_styled__default["default"]("div", {
212
+ target: "e1nocpaa1"
213
+ } )("display:flex;position:absolute;z-index:", _ref => {
214
+ let zIndex = _ref.zIndex;
215
+ return (
216
+ // Use `!important` to overwrite the default value assigned by the Stacking Layer System.
217
+ typeof zIndex === 'number' ? `${zIndex} !important` : 'auto'
218
+ );
219
+ }, ";top:0;width:100%;height:100%;background-color:rgba(32, 62, 72, 0.5);opacity:1;" + ("" ));
220
+ const DialogContent$1 = /*#__PURE__*/_styled__default["default"]("div", {
221
+ target: "e1nocpaa0"
222
+ } )({
223
+ name: "vyh6ik",
224
+ styles: "position:absolute;width:100%;height:100%;top:0"
225
+ } );
208
226
 
209
227
  const _excluded$j = ["size", "getParentSelector"];
210
- function ownKeys$6(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
211
- function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$6(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$6(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
212
228
  const getDefaultParentSelector$1 = () => document.querySelector(`#${constants.PORTALS_CONTAINER_ID}`);
213
- const getOverlayElement$1 = (props, contentElement) =>
214
- // Assign the `data-role` to the overlay container, which is used as
215
- // the CSS selector in the `<PortalsContainer>`.
216
- jsxRuntime.jsx("div", _objectSpread$6(_objectSpread$6({}, props), {}, {
217
- "data-role": "dialog-overlay",
218
- children: contentElement
219
- }));
220
229
  const GridArea = /*#__PURE__*/_styled__default["default"]("div", {
221
230
  target: "elx55gk0"
222
231
  } )("grid-area:", props => props.name, ";" + ("" ));
223
- var _ref$7 = {
232
+ var _ref$6 = {
224
233
  name: "1daj17f",
225
234
  styles: "display:flex;flex-direction:column;align-items:stretch;height:100%;min-height:0"
226
235
  } ;
227
- var _ref2$3 = {
236
+ var _ref2$2 = {
228
237
  name: "1187q51",
229
238
  styles: "display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;overflow:hidden"
230
239
  } ;
@@ -235,48 +244,59 @@ const DialogContainer = _ref3 => {
235
244
  getParentSelector = _ref3$getParentSelect === void 0 ? getDefaultParentSelector$1 : _ref3$getParentSelect,
236
245
  props = _objectWithoutProperties(_ref3, _excluded$j);
237
246
  utils.useWarning(typeof props.title === 'string' || typeof props.title !== 'string' && Boolean(props['aria-label']), 'app-kit/DialogHeader: "aria-label" prop is required when the "title" prop is not a string.');
238
- return jsxRuntime.jsx(react.ClassNames, {
239
- children: _ref4 => {
240
- let makeClassName = _ref4.css;
241
- return jsxRuntime.jsxs(Modal__default["default"], {
242
- isOpen: props.isOpen,
243
- onRequestClose: props.onClose,
244
- shouldCloseOnOverlayClick: Boolean(props.onClose),
245
- shouldCloseOnEsc: Boolean(props.onClose),
246
- overlayElement: getOverlayElement$1,
247
- overlayClassName: makeClassName(getOverlayStyles$1(_objectSpread$6({
248
- size
249
- }, props))),
250
- className: makeClassName(getModalContentStyles(_objectSpread$6({
251
- size
252
- }, props))),
253
- contentLabel: typeof props.title === 'string' ? props.title : props['aria-label'],
254
- parentSelector: getParentSelector,
255
- ariaHideApp: false,
256
- children: [jsxRuntime.jsx(GridArea, {
257
- name: "top"
258
- }), jsxRuntime.jsx(GridArea, {
259
- name: "left"
260
- }), jsxRuntime.jsx(GridArea, {
261
- name: "right"
262
- }), jsxRuntime.jsx(GridArea, {
263
- name: "bottom"
264
- }), jsxRuntime.jsx(GridArea, {
265
- name: "main",
266
- css: _ref2$3,
267
- children: jsxRuntime.jsx(Card__default["default"]
268
- // 1. For the min-height: https://stackoverflow.com/questions/28636832/firefox-overflow-y-not-working-with-nested-flexbox/28639686#28639686
269
- // 2. For the actual "> div" container with the content, we need to use normal pointer events so that clicking on it does not close the dialog.
270
- , {
271
- css: /*#__PURE__*/react.css("min-height:0;padding:", designSystem.designTokens.spacing20, " ", designSystem.designTokens.spacing30, ";>div{display:flex;flex-direction:column;height:100%;pointer-events:auto;min-height:0;}" + ("" ), "" ),
272
- children: jsxRuntime.jsx("div", {
273
- css: _ref$7,
274
- children: props.children
275
- })
276
- })
277
- })]
278
- });
247
+ const _useState = react$1.useState(null),
248
+ _useState2 = _slicedToArray(_useState, 2),
249
+ portalContainer = _useState2[0],
250
+ setPortalContainer = _useState2[1];
251
+ react$1.useEffect(() => {
252
+ const container = getParentSelector();
253
+ if (container) {
254
+ setPortalContainer(container);
279
255
  }
256
+ }, []);
257
+ const dialogAccessibleLabel = typeof props.title === 'string' ? props.title : props['aria-label'];
258
+ return jsxRuntime.jsx(reactDialog.Root, {
259
+ open: props.isOpen,
260
+ modal: false,
261
+ children: jsxRuntime.jsx(reactDialog.Portal, {
262
+ container: portalContainer,
263
+ children: jsxRuntime.jsx(DialogOverlay, {
264
+ "data-role": "dialog-overlay",
265
+ zIndex: props.zIndex,
266
+ children: jsxRuntime.jsx(DialogContent$1, {
267
+ children: jsxRuntime.jsxs(ClickableDialogContent, {
268
+ size: size,
269
+ onEscapeKeyDown: props.onClose,
270
+ onPointerDownOutside: props.onClose,
271
+ "aria-describedby": undefined,
272
+ "aria-labelledby": "",
273
+ "aria-label": dialogAccessibleLabel,
274
+ children: [jsxRuntime.jsx(GridArea, {
275
+ name: "top"
276
+ }), jsxRuntime.jsx(GridArea, {
277
+ name: "left"
278
+ }), jsxRuntime.jsx(GridArea, {
279
+ name: "right"
280
+ }), jsxRuntime.jsx(GridArea, {
281
+ name: "bottom"
282
+ }), jsxRuntime.jsx(GridArea, {
283
+ name: "main",
284
+ css: _ref2$2,
285
+ children: jsxRuntime.jsx(Card__default["default"]
286
+ // 1. For the min-height: https://stackoverflow.com/questions/28636832/firefox-overflow-y-not-working-with-nested-flexbox/28639686#28639686
287
+ // 2. For the actual "> div" container with the content, we need to use normal pointer events so that clicking on it does not close the dialog.
288
+ , {
289
+ css: /*#__PURE__*/react.css("min-height:0;padding:", designSystem.designTokens.spacing20, " ", designSystem.designTokens.spacing30, ";>div{display:flex;flex-direction:column;height:100%;pointer-events:auto;min-height:0;}" + ("" ), "" ),
290
+ children: jsxRuntime.jsx("div", {
291
+ css: _ref$6,
292
+ children: props.children
293
+ })
294
+ })
295
+ })]
296
+ })
297
+ })
298
+ })
299
+ })
280
300
  });
281
301
  };
282
302
  DialogContainer.propTypes = {};
@@ -294,16 +314,19 @@ const TextTitle = props => jsxRuntime.jsx(Text__default["default"].Headline, {
294
314
  children: props.title
295
315
  });
296
316
  TextTitle.propTypes = {};
317
+ const HiddenEmptyDialogTitle$1 = () => jsxRuntime.jsx("div", {
318
+ "aria-hidden": true,
319
+ style: {
320
+ display: 'none'
321
+ },
322
+ children: jsxRuntime.jsx(reactDialog.Title, {})
323
+ });
297
324
  const Title$1 = props => {
298
- if (typeof props.title === 'string') {
299
- return jsxRuntime.jsx(TextTitle, {
325
+ return jsxRuntime.jsxs(jsxRuntime.Fragment, {
326
+ children: [typeof props.title === 'string' ? jsxRuntime.jsx(TextTitle, {
300
327
  title: props.title
301
- });
302
- } else {
303
- return jsxRuntime.jsx(jsxRuntime.Fragment, {
304
- children: props.title
305
- });
306
- }
328
+ }) : props.title, jsxRuntime.jsx(HiddenEmptyDialogTitle$1, {})]
329
+ });
307
330
  };
308
331
  const DialogHeader = props => jsxRuntime.jsx("div", {
309
332
  css: /*#__PURE__*/react.css("flex:0 1 auto;display:flex;flex-direction:column;margin-bottom:", designSystem.designTokens.spacing30, ";" + ("" ), "" ),
@@ -351,8 +374,8 @@ function filterDataAttributes(obj) {
351
374
  }
352
375
 
353
376
  const _excluded$i = ["isPrimaryButtonDisabled", "dataAttributesPrimaryButton", "dataAttributesSecondaryButton"];
354
- function ownKeys$5(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
355
- function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$5(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$5(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
377
+ function ownKeys$4(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
378
+ function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$4(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$4(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
356
379
  const getFormattedLabel = (label, intl) => typeof label === 'string' ? label : intl.formatMessage(label);
357
380
  const DialogFooter = _ref => {
358
381
  let _ref$isPrimaryButtonD = _ref.isPrimaryButtonDisabled,
@@ -374,11 +397,11 @@ const DialogFooter = _ref => {
374
397
  scale: "m",
375
398
  alignItems: "center",
376
399
  justifyContent: "flex-end",
377
- children: [jsxRuntime.jsx(SecondaryButton__default["default"], _objectSpread$5({
400
+ children: [jsxRuntime.jsx(SecondaryButton__default["default"], _objectSpread$4({
378
401
  label: getFormattedLabel(props.labelSecondary, intl),
379
402
  onClick: props.onCancel,
380
403
  iconLeft: props.iconLeftSecondaryButton
381
- }, filterDataAttributes(dataAttributesSecondaryButton))), jsxRuntime.jsx(PrimaryButton__default["default"], _objectSpread$5({
404
+ }, filterDataAttributes(dataAttributesSecondaryButton))), jsxRuntime.jsx(PrimaryButton__default["default"], _objectSpread$4({
382
405
  label: getFormattedLabel(props.labelPrimary, intl),
383
406
  onClick: props.onConfirm,
384
407
  isDisabled: isPrimaryButtonDisabled
@@ -474,7 +497,7 @@ FormDialog.TextTitle = TextTitle;
474
497
 
475
498
  const CustomViewSelector = /*#__PURE__*/react$1.lazy(() => {
476
499
  if (typeof window !== 'undefined' && typeof window.app !== 'undefined') {
477
- return Promise.resolve().then(function () { return require('./custom-views-selector-36368b71.cjs.prod.js' /* webpackChunkName: "custom-views-selector" */); });
500
+ return Promise.resolve().then(function () { return require('./custom-views-selector-4a4c5740.cjs.prod.js' /* webpackChunkName: "custom-views-selector" */); });
478
501
  }
479
502
  return _Promise__default["default"].resolve({
480
503
  default: () => null
@@ -533,7 +556,7 @@ const Subtitle = _ref2 => {
533
556
  });
534
557
  };
535
558
  Subtitle.propTypes = {};
536
- var _ref$6 = {
559
+ var _ref$5 = {
537
560
  name: "d3v9zr",
538
561
  styles: "overflow:hidden"
539
562
  } ;
@@ -544,7 +567,7 @@ const PageHeaderTitle = _ref3 => {
544
567
  truncate = _ref3$truncate === void 0 ? false : _ref3$truncate,
545
568
  props = _objectWithoutProperties(_ref3, _excluded2$1);
546
569
  return jsxRuntime.jsxs("div", {
547
- css: _ref$6,
570
+ css: _ref$5,
548
571
  children: [jsxRuntime.jsx(Title, {
549
572
  title: props.title,
550
573
  titleSize: titleSize,
@@ -604,12 +627,12 @@ const messages$4 = reactIntl.defineMessages({
604
627
 
605
628
  const _excluded$e = ["color", "previousPathLabel", "hidePathLabel"];
606
629
  // Component to have a larger clickable surface
607
- var _ref2$2 = {
630
+ var _ref2$1 = {
608
631
  name: "1rxhroq",
609
632
  styles: "display:flex;align-items:center;justify-content:center;&::after{content:'';position:absolute;height:35px;width:48px;top:0;right:0;}"
610
633
  } ;
611
634
  const LargeIconWrapper = props => jsxRuntime.jsx("span", {
612
- css: _ref2$2,
635
+ css: _ref2$1,
613
636
  children: /*#__PURE__*/react$1.cloneElement(props.children, {
614
637
  size: props.size
615
638
  })
@@ -619,7 +642,7 @@ const LargeIconWrapper = props => jsxRuntime.jsx("span", {
619
642
  // However, we need to explicitly define this otherwise the prop-types babel plugin
620
643
  // does not recognize the object shape.
621
644
  LargeIconWrapper.propTypes = {};
622
- var _ref$5 = {
645
+ var _ref$4 = {
623
646
  name: "uvw8rn",
624
647
  styles: "display:flex;overflow:hidden;button:first-of-type svg{height:12px!important;width:12px!important;}"
625
648
  } ;
@@ -634,7 +657,7 @@ const ModalPageTopBar = _ref3 => {
634
657
  return jsxRuntime.jsxs("div", {
635
658
  css: /*#__PURE__*/react.css("position:relative;display:flex;align-items:center;justify-content:space-between;padding:", designSystem.designTokens.spacing40, " ", designSystem.designTokens.spacing55, " 0;background-color:", designSystem.designTokens.colorSurface, ";border-bottom:1px solid ", designSystem.designTokens.colorSurface, ";& *+*{margin-left:", designSystem.designTokens.spacingS, ";}p{font-size:12px!important;}" + ("" ), "" ),
636
659
  children: [jsxRuntime.jsxs("div", {
637
- css: _ref$5,
660
+ css: _ref$4,
638
661
  children: [!hidePathLabel && jsxRuntime.jsx(FlatButton__default["default"], {
639
662
  tone: "primary",
640
663
  label: typeof previousPathLabel === 'string' ? previousPathLabel : intl.formatMessage(previousPathLabel),
@@ -685,41 +708,89 @@ const stylesBySize = {
685
708
  transitionTime: 300
686
709
  }
687
710
  };
688
- const getContainerStyles = props => /*#__PURE__*/react.css("position:absolute;top:0;right:0;height:100%;width:", props.size !== 'scale' ?
689
- // In case we're using a specific size, we want it to be used until there's no space left.
690
- // In such scenario, we want the modal to be as wide as possible, but using the shared indentation width size.
691
- `min(${stylesBySize[props.size].width}, calc(100% - ${constants.PORTALS_CONTAINER_INDENTATION_SIZE})) !important` : stylesBySize.scale.width, ";display:flex;flex-direction:column;background-color:", designSystem.customProperties.colorSurface, ";box-shadow:0px 0px 40px 0px rgba(0, 0, 0, 0.1);outline:0;transform:translate3d(\n ", props.size !== 'scale' ? stylesBySize[props.size].width : '30px', ",\n 0,\n 0\n );transition:transform ", stylesBySize[props.size].transitionTime, "ms ease;" + ("" ), "" );
692
- const getOverlayStyles = props => /*#__PURE__*/react.css("position:absolute;z-index:", typeof props.zIndex === 'number' ?
693
- // Use `!important` to overwrite the default value assigned by the Stacking Layer System.
694
- `${props.zIndex} !important` : 'auto', ";top:0;left:0;width:100%;height:100%;background-color:hsla(195, 35%, 20%, 0.05);opacity:0;transition:transform ", stylesBySize[props.size].transitionTime, "ms ease;" + ("" ), "" );
695
- var _ref3 = {
696
- name: "1ffv7m4",
697
- styles: "transform:translate3d(0, 0, 0)!important"
698
- } ;
699
- const getAfterOpenContainerAnimation = () => _ref3;
700
- var _ref2$1 = {
701
- name: "1d9ftqx",
702
- styles: "opacity:1!important"
703
- } ;
704
- const getAfterOpenOverlayAnimation = () => _ref2$1;
705
- const getBeforeCloseContainerAnimation = props => /*#__PURE__*/react.css("transform:translate3d(\n ", props.size !== 'scale' ? stylesBySize[props.size].width : '30px', ",\n ,\n 0,\n 0\n )!important;" + ("" ), "" );
706
- var _ref$4 = {
707
- name: "728dx5",
708
- styles: "opacity:0!important"
709
- } ;
710
- const getBeforeCloseOverlayAnimation = () => _ref$4;
711
+ const overlayShow = react.keyframes`
712
+ 0% {
713
+ opacity: 0;
714
+ }
715
+ 100% {
716
+ opacity: 1;
717
+ }
718
+ `;
719
+
720
+ // we can't use Overlay from Radix-ui because it doesn't appear in DOM when Dialog.Root is rendered with `modal={false}`
721
+ const ModalOverlay = /*#__PURE__*/_styled__default["default"]("div", {
722
+ target: "e1jbmsa1"
723
+ } )("position:absolute;top:0;left:0;width:100%;height:100%;background-color:hsla(195, 35%, 20%, 0.05);z-index:", _ref => {
724
+ let zIndex = _ref.zIndex;
725
+ return (
726
+ // Use `!important` to overwrite the default value assigned by the Stacking Layer System.
727
+ typeof zIndex === 'number' ? `${zIndex} !important` : 'inherit'
728
+ );
729
+ }, ";opacity:0;", _ref2 => {
730
+ let size = _ref2.size;
731
+ const transitionDuration = stylesBySize[size].transitionTime;
732
+ return /*#__PURE__*/react.css("animation:", overlayShow, " ", transitionDuration, "ms ease-out forwards;" + ("" ), "" );
733
+ }, ";" + ("" ));
734
+ const getContentShowAnimation = size => react.keyframes({
735
+ '0%': {
736
+ opacity: 0,
737
+ transform: `translate3d(${size !== 'scale' ? stylesBySize[size].width : '30px'}, 0, 0)`
738
+ },
739
+ '100%': {
740
+ opacity: 1,
741
+ transform: `translate3d(0, 0, 0)`
742
+ }
743
+ });
744
+ const getContentHideAnimation = size => react.keyframes({
745
+ '0%': {
746
+ opacity: 1,
747
+ transform: `translate3d(0, 0, 0)`
748
+ },
749
+ '100%': {
750
+ opacity: 0,
751
+ transform: `translate3d(${size !== 'scale' ? stylesBySize[size].width : '30px'}, 0, 0)`
752
+ }
753
+ });
754
+ const ModalContent = /*#__PURE__*/_styled__default["default"](reactDialog.Content, {
755
+ shouldForwardProp: prop => prop !== 'size',
756
+ target: "e1jbmsa0"
757
+ } )("position:absolute;top:0;right:0;height:100%;width:", _ref3 => {
758
+ let size = _ref3.size;
759
+ return size !== 'scale' ?
760
+ // In case we're using a specific size, we want it to be used until there's no space left.
761
+ // In such scenario, we want the modal to be as wide as possible, but using the shared indentation width size.
762
+ `min(${stylesBySize[size].width}, calc(100% - ${constants.PORTALS_CONTAINER_INDENTATION_SIZE})) !important` : stylesBySize.scale.width;
763
+ }, ";display:flex;flex-direction:column;background-color:", designSystem.designTokens.colorSurface, ";box-shadow:0px 0px 40px 0px rgba(0, 0, 0, 0.1);outline:0;z-index:inherit;&[data-state='open']{animation:", _ref4 => {
764
+ let size = _ref4.size;
765
+ return getContentShowAnimation(size);
766
+ }, " 300ms ease forwards;}&[data-state='closed']{animation:", _ref5 => {
767
+ let size = _ref5.size;
768
+ return getContentHideAnimation(size);
769
+ }, " 300ms ease forwards;}" + ("" ));
711
770
 
712
771
  const _excluded$d = ["size", "getParentSelector", "shouldDelayOnClose"];
713
- function ownKeys$4(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
714
- function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$4(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$4(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
772
+ const HiddenEmptyDialogTitle = () => jsxRuntime.jsx("div", {
773
+ "aria-hidden": true,
774
+ style: {
775
+ display: 'none'
776
+ },
777
+ children: jsxRuntime.jsx(reactDialog.Title, {})
778
+ });
779
+
780
+ // When running tests, we don't render the AppShell. Instead we mock the
781
+ // application context to make the data available to the application under
782
+ // test. However, this also means that the AppShell tree is not rendered,
783
+ // which contains among other things the <div id="portals-container" />
784
+ // element, used to render the modal content.
785
+ // Apparently though, when the <Modal> component unmounts between tests, it
786
+ // tries to remove the child elements within the parent selector
787
+ // ("portals-container") which may have been cleaned up by another test,
788
+ // resulting in the <Modal> to throw an NotFoundError.
789
+ // To solve this, we can simply use "document.body" as the parent selector
790
+ // instead of a specific element that will be cleaned up, resulting in
791
+ // console errors (even though the test passes). We only need to to this in
792
+ // test environment.
715
793
  const getDefaultParentSelector = () => document.querySelector(`#${constants.PORTALS_CONTAINER_ID}`);
716
- const getOverlayElement = (props, contentElement) =>
717
- // Assign the `data-role` to the overlay container, which is used as
718
- // the CSS selector in the `<PortalsContainer>`.
719
- jsxRuntime.jsx("div", _objectSpread$4(_objectSpread$4({}, props), {}, {
720
- "data-role": "modal-overlay",
721
- children: contentElement
722
- }));
723
794
 
724
795
  // NOTE: the `MessageDescriptor` type is exposed by `react-intl`.
725
796
  // However, we need to explicitly define this otherwise the prop-types babel plugin
@@ -737,7 +808,8 @@ const ModalPage = _ref => {
737
808
  _useState2 = _slicedToArray(_useState, 2),
738
809
  forceClose = _useState2[0],
739
810
  setForceClose = _useState2[1];
740
- const closingTimer = react$1.useRef();
811
+ const closingTimer = react$1.useRef(undefined);
812
+ const TRANSITION_DURATION = stylesBySize[size].transitionTime;
741
813
  react$1.useEffect(() => {
742
814
  if (props.isOpen === true) setForceClose(false);
743
815
  return () => {
@@ -747,7 +819,6 @@ const ModalPage = _ref => {
747
819
  };
748
820
  }, [props.isOpen]);
749
821
  const onClose = props.onClose;
750
- const TRANSITION_DURATION = stylesBySize[size].transitionTime;
751
822
  const handleClose = react$1.useCallback(event => {
752
823
  if (shouldDelayOnClose) {
753
824
  // In this case we want the closing animation to be shown
@@ -761,52 +832,53 @@ const ModalPage = _ref => {
761
832
  }
762
833
  onClose && onClose(event);
763
834
  }, [onClose, shouldDelayOnClose, TRANSITION_DURATION]);
764
- return jsxRuntime.jsx(react.ClassNames, {
765
- children: _ref2 => {
766
- let makeClassName = _ref2.css;
767
- return jsxRuntime.jsxs(Modal__default["default"], {
768
- isOpen: forceClose === true ? false : props.isOpen,
769
- onRequestClose: handleClose,
770
- shouldCloseOnOverlayClick: Boolean(props.onClose),
771
- shouldCloseOnEsc: Boolean(props.onClose),
772
- overlayElement: getOverlayElement,
773
- overlayClassName: {
774
- base: makeClassName(getOverlayStyles(_objectSpread$4({
775
- size
776
- }, props))),
777
- afterOpen: makeClassName(getAfterOpenOverlayAnimation()),
778
- beforeClose: makeClassName(getBeforeCloseOverlayAnimation())
779
- },
780
- className: {
781
- base: makeClassName(getContainerStyles(_objectSpread$4({
782
- size
783
- }, props))),
784
- afterOpen: typeof props.afterOpenStyles === 'string' ? props.afterOpenStyles : makeClassName(props.afterOpenStyles ?? getAfterOpenContainerAnimation()),
785
- beforeClose: makeClassName(getBeforeCloseContainerAnimation(_objectSpread$4({
786
- size
787
- }, props)))
788
- },
789
- contentLabel: props.title,
790
- parentSelector: getParentSelector,
791
- ariaHideApp: false
792
- // Adjust this value if the (beforeClose) animation duration is changed
793
- ,
794
- closeTimeoutMS: TRANSITION_DURATION,
795
- style: {
796
- // stylelint-disable-next-line selector-type-no-unknown
797
- overlay: {
798
- zIndex: props.zIndex
799
- }
800
- },
801
- children: [!props.hideTopBar && jsxRuntime.jsx(ModalPageTopBar, {
802
- color: props.topBarColor,
803
- onClose: handleClose,
804
- currentPathLabel: props.currentPathLabel,
805
- previousPathLabel: props.previousPathLabel,
806
- hidePathLabel: props.hidePathLabel
807
- }), props.children]
808
- });
835
+ const _useState3 = react$1.useState(null),
836
+ _useState4 = _slicedToArray(_useState3, 2),
837
+ portalContainer = _useState4[0],
838
+ setPortalContainer = _useState4[1];
839
+ react$1.useEffect(() => {
840
+ const container = getParentSelector();
841
+ if (container) {
842
+ setPortalContainer(container);
809
843
  }
844
+ }, []);
845
+ return jsxRuntime.jsx(reactDialog.Root, {
846
+ open: props.isOpen && !forceClose,
847
+ onOpenChange: handleClose,
848
+ modal: false // `true` would apply aria-hidden to all other elements when the modal is open
849
+ ,
850
+ children: jsxRuntime.jsx(reactDialog.Portal, {
851
+ container: portalContainer,
852
+ children: jsxRuntime.jsxs("div", {
853
+ // Assign the `data-role` to the overlay container, which is used as
854
+ // the CSS selector in the `<PortalsContainer>`.
855
+ "data-role": "modal-overlay",
856
+ children: [jsxRuntime.jsx(ModalOverlay, {
857
+ size: size,
858
+ "data-role": "modal-overlay-clickable",
859
+ onClick: handleClose
860
+ }), jsxRuntime.jsxs(ModalContent, {
861
+ size: size,
862
+ "aria-describedby": undefined,
863
+ onInteractOutside: e => {
864
+ // Prevent only the modal from closing, handle all other events
865
+ const overlay = document.querySelector('[data-role="modal-overlay-clickable"]');
866
+ if (!overlay?.contains(e.target)) {
867
+ e.preventDefault();
868
+ }
869
+ },
870
+ "aria-labelledby": "",
871
+ "aria-label": props.title,
872
+ children: [jsxRuntime.jsx(HiddenEmptyDialogTitle, {}), !props.hideTopBar && jsxRuntime.jsx(ModalPageTopBar, {
873
+ color: props.topBarColor,
874
+ onClose: handleClose,
875
+ currentPathLabel: props.currentPathLabel,
876
+ previousPathLabel: props.previousPathLabel,
877
+ hidePathLabel: props.hidePathLabel
878
+ }), props.children]
879
+ })]
880
+ })
881
+ })
810
882
  });
811
883
  };
812
884
  ModalPage.propTypes = {};
@@ -1951,11 +2023,8 @@ const PortalsContainer = /*#__PURE__*/react$1.forwardRef((props, ref) => {
1951
2023
  if (node instanceof HTMLElement) {
1952
2024
  const stackingLevel = index + 1;
1953
2025
  node.dataset.level = String(stackingLevel);
1954
- const overlayNode = node.firstChild;
1955
- if (overlayNode instanceof HTMLElement) {
1956
- if (overlayNode.dataset.role === 'modal-overlay') {
1957
- indentationLevel += 1;
1958
- }
2026
+ if (node.dataset.role === 'modal-overlay') {
2027
+ indentationLevel += 1;
1959
2028
  }
1960
2029
  nextStackingLevels.push({
1961
2030
  stackingLevel,
@@ -1968,11 +2037,10 @@ const PortalsContainer = /*#__PURE__*/react$1.forwardRef((props, ref) => {
1968
2037
  // Only subscribe to changes to the child nodes of the portals container.
1969
2038
  childList: true
1970
2039
  });
2040
+ const isModalOpen = stackingLayers.length > 0;
1971
2041
  return jsxRuntime.jsxs(jsxRuntime.Fragment, {
1972
- children: [jsxRuntime.jsx(react.Global
1973
- // Apply some global styles, based on the `.ReactModal__Body--open` class.
1974
- , {
1975
- styles: [/*#__PURE__*/react.css(".ReactModal__Body--open ", containerSelectorToPreventScrollingOnOpen, "{overflow:hidden;}.ReactModal__Body--open #", constants.PORTALS_CONTAINER_ID, "{position:fixed;height:calc(\n 100% - ", offsetTop, " -\n ", globalNotificationsElementDimensions.height, "px -\n ", pageNotificationsElementDimensions.height, "px\n );width:calc(100% - ", offsetLeft, ");top:calc(\n ", offsetTop, " +\n ", globalNotificationsElementDimensions.height, "px +\n ", pageNotificationsElementDimensions.height, "px\n );right:0;bottom:0;z-index:", zIndex, ";transition:", modalWidthTransition, ";}.ReactModal__Body--open.body__menu-open #", constants.PORTALS_CONTAINER_ID, "{width:calc(100% - ", offsetLeftOnExpandedMenu, ");transition:", modalWidthTransition, ";}" + ("" ), "" ),
2042
+ children: [jsxRuntime.jsx(react.Global, {
2043
+ styles: [isModalOpen && /*#__PURE__*/react.css(containerSelectorToPreventScrollingOnOpen, "{overflow:hidden!important;}#", constants.PORTALS_CONTAINER_ID, "{position:fixed;height:calc(\n 100% - ", offsetTop, " -\n ", globalNotificationsElementDimensions.height, "px -\n ", pageNotificationsElementDimensions.height, "px\n );width:calc(100% - ", offsetLeft, ");top:calc(\n ", offsetTop, " +\n ", globalNotificationsElementDimensions.height, "px +\n ", pageNotificationsElementDimensions.height, "px\n );right:0;bottom:0;z-index:", zIndex, ";transition:", modalWidthTransition, ";}.body__menu-open #", constants.PORTALS_CONTAINER_ID, "{width:calc(100% - ", offsetLeftOnExpandedMenu, ");transition:", modalWidthTransition, ";}" + ("" ), "" ),
1976
2044
  // Apply styles for stacking layers.
1977
2045
  ..._mapInstanceProperty__default["default"](stackingLayers).call(stackingLayers,
1978
2046
  /**
@@ -1980,7 +2048,7 @@ const PortalsContainer = /*#__PURE__*/react$1.forwardRef((props, ref) => {
1980
2048
  * Furthermore, the "modal overlay" containers (not "dialog") get assigned
1981
2049
  * the correct indentation level width.
1982
2050
  */
1983
- stackingLayer => /*#__PURE__*/react.css("#", constants.PORTALS_CONTAINER_ID, " .ReactModalPortal[data-level='", stackingLayer.stackingLevel, "'] [data-role$='overlay']{z-index:calc(\n ", baseModalZIndex, " + ", stackingLayer.stackingLevel, "\n );}#", constants.PORTALS_CONTAINER_ID, " .ReactModalPortal[data-level='", stackingLayer.stackingLevel, "'] [data-role='modal-overlay'] [role='dialog']{width:calc(\n 100% -\n (\n ", constants.PORTALS_CONTAINER_INDENTATION_SIZE, " *\n ", stackingLayer.indentationLevel, "\n )\n );}" + ("" ), "" )), "" ]
2051
+ stackingLayer => /*#__PURE__*/react.css("#", constants.PORTALS_CONTAINER_ID, " [data-level='", stackingLayer.stackingLevel, "'][data-role$='overlay']{z-index:calc(\n ", baseModalZIndex, " + ", stackingLayer.stackingLevel, "\n );}#", constants.PORTALS_CONTAINER_ID, " [data-level='", stackingLayer.stackingLevel, "'][data-role='modal-overlay'] [role='dialog']{width:calc(\n 100% -\n (\n ", constants.PORTALS_CONTAINER_INDENTATION_SIZE, " *\n ", stackingLayer.indentationLevel, "\n )\n );}" + ("" ), "" )), "" ]
1984
2052
  }), jsxRuntime.jsx("div", {
1985
2053
  id: constants.PORTALS_CONTAINER_ID,
1986
2054
  ref: portalsContainerRef