@atlassian/aui 9.3.7 → 9.4.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.
@@ -1 +1 @@
1
- export {default as i18n} from '@atlassian/aui/src/js/aui/i18n';
1
+ export {I18n as i18n} from '@atlassian/aui/src/js/aui/i18n';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@atlassian/aui",
3
3
  "description": "Atlassian User Interface library",
4
- "version": "9.3.7",
4
+ "version": "9.4.3",
5
5
  "author": "Atlassian Pty Ltd.",
6
6
  "homepage": "https://aui.atlassian.com",
7
7
  "license": "Apache-2.0",
@@ -46,25 +46,21 @@
46
46
  },
47
47
  "devDependencies": {
48
48
  "@atlassian/adg-server-iconfont": "3.1.0",
49
- "@atlassian/aui-webpack-config": "2.0.0",
50
- "@babel/core": "7.13.15",
51
- "@babel/preset-env": "7.13.15",
52
- "bundlesize": "^1.0.0-beta.2",
49
+ "@atlassian/aui-webpack-config": "3.0.1",
50
+ "@babel/core": "7.14.0",
51
+ "@babel/preset-env": "7.14.1",
52
+ "bundlesize": "1.0.0-beta.2",
53
53
  "cross-env": "7.0.3",
54
- "eslint": "7.24.0",
55
- "glob": "7.1.2",
56
- "ignore-emit-webpack-plugin": "^2.0.2",
54
+ "eslint": "7.26.0",
55
+ "glob": "7.1.6",
56
+ "ignore-emit-webpack-plugin": "2.0.6",
57
57
  "jquery": "3.5.1",
58
58
  "jquery-migrate": "3.3.2",
59
- "less": "3.11.1",
60
- "webpack-cli": "3.3.12"
59
+ "less": "3.13.1"
61
60
  },
62
61
  "scripts": {
63
62
  "prepublishOnly": "yarn clean && cross-env NODE_ENV=production yarn build",
64
63
  "clean": "rm -rf ./dist",
65
- "dist/build:core": "webpack --config webpack/dist.aui-lib.webpack.config.js",
66
- "dist/build:exts": "webpack --config webpack/dist.aui-extensions.webpack.config.js",
67
- "dist/build:legacy": "yarn dist/build:core && yarn dist/build:exts",
68
64
  "dist/build:prototyping": "webpack --config webpack/dist.prototyping.webpack.config.js",
69
65
  "build": "yarn dist/build:prototyping",
70
66
  "watch": "yarn dist/build:prototyping --watch",
@@ -13,6 +13,7 @@ const LAYER_EVENT_PREFIX = 'aui-layer-';
13
13
  const AUI_EVENT_PREFIX = 'aui-';
14
14
  const ATTR_MODAL = 'modal';
15
15
  const ATTR_DOM_CONTAINER = 'dom-container';
16
+ const ZINDEX_AUI_LAYER_MIN = 3000;
16
17
 
17
18
  var $doc = $(document);
18
19
 
@@ -182,10 +183,6 @@ Layer.prototype = {
182
183
  return this;
183
184
  }
184
185
 
185
- if (!triggerEvent(this.$el, 'beforeHide', 'hide')) {
186
- return this;
187
- }
188
-
189
186
  // AUI-3708
190
187
  const thisLayer = this;
191
188
  oneTransitionEnd(this.$el.get(0), 'opacity', function () {
@@ -194,7 +191,7 @@ Layer.prototype = {
194
191
  }
195
192
  });
196
193
 
197
- LayerManager.global.popUntil(this.$el);
194
+ LayerManager.global.popUntil(this.$el, true);
198
195
 
199
196
  return this;
200
197
  },
@@ -259,13 +256,16 @@ Layer.prototype = {
259
256
  },
260
257
 
261
258
  _hideLayer: function (triggerBeforeEvents) {
259
+ if (triggerBeforeEvents) {
260
+ if (!triggerEvent(this.$el, 'beforeHide', 'hide')) {
261
+ return false;
262
+ }
263
+ }
264
+
262
265
  if (this.isPersistent() || this.isBlanketed()) {
263
266
  FocusManager.global.exit(this.$el);
264
267
  }
265
268
 
266
- if (triggerBeforeEvents) {
267
- triggerEvent(this.$el, 'beforeHide', 'hide');
268
- }
269
269
  // don't remove via jquery; that would cause this method to get re-called once or twice more :\
270
270
  this.el.removeAttribute('open');
271
271
  this.$el.removeData('_aui-layer-shown');
@@ -273,6 +273,7 @@ Layer.prototype = {
273
273
  this.$el.data('_aui-layer-cached-z-index', '');
274
274
  this.$el.trigger(EVENT_PREFIX + 'hide');
275
275
  this.$el.trigger(GLOBAL_EVENT_PREFIX + 'hide', [this.$el]);
276
+ return true;
276
277
  },
277
278
 
278
279
  _showLayer: function (zIndex) {
@@ -368,7 +369,7 @@ function nextZIndex (layerArr) {
368
369
  _nextZIndex = 0;
369
370
  }
370
371
 
371
- return Math.max(3000, _nextZIndex);
372
+ return Math.max(ZINDEX_AUI_LAYER_MIN, _nextZIndex);
372
373
  }
373
374
 
374
375
  function updateBlanket (stack, oldBlanketIndex) {
@@ -383,20 +384,24 @@ function updateBlanket (stack, oldBlanketIndex) {
383
384
  }
384
385
  }
385
386
 
386
- function popLayers (stack, stopIndex, forceClosePersistent) {
387
+ function popLayers (stack, stopIndex, forceClosePersistent, triggerBeforeEvents = true) {
387
388
  if (stopIndex < 0) {
388
- return;
389
+ return [false, null];
389
390
  }
390
391
 
392
+ var $layer;
391
393
  for (var a = stack.length - 1; a >= stopIndex; a--) {
392
- var $layer = stack[a];
394
+ $layer = stack[a];
393
395
  var layer = createLayer($layer);
394
396
 
395
397
  if (forceClosePersistent || !layer.isPersistent()) {
396
- layer._hideLayer(true);
398
+ if (!layer._hideLayer(triggerBeforeEvents)) {
399
+ return [false, $layer];
400
+ }
397
401
  stack.splice(a, 1);
398
402
  }
399
403
  }
404
+ return [true, $layer];
400
405
  }
401
406
 
402
407
  function getParentLayer (layer) {
@@ -561,14 +566,24 @@ LayerManager.prototype = {
561
566
  },
562
567
 
563
568
  /**
564
- * Removes all non-modal layers above & including the given element. If the given element is not an active layer, this method
565
- * is a no-op. The given element will be removed regardless of whether or not it is modal.
566
- *
567
- * @param {HTMLElement | String | jQuery} element layer to pop.
568
- *
569
- * @returns {jQuery} The last layer that was popped, or null if no layer matching the given $el was found.
570
- */
571
- popUntil: function (element) {
569
+ * Gets the top layer, if it exists.
570
+ *
571
+ * @returns The layer on top of the stack, if it exists, otherwise null.
572
+ */
573
+ getTopLayer: function () {
574
+ return this._stack[this._stack.length - 1] || null;
575
+ },
576
+
577
+ /**
578
+ * Removes all non-modal layers above & including the given element. If the given element is not an active layer, this method
579
+ * is a no-op. The given element will be removed regardless of whether or not it is modal.
580
+ *
581
+ * @param {HTMLElement | String | jQuery} element layer to pop.
582
+ * @param {boolean} [triggerBeforeEvents=false]
583
+ *
584
+ * @returns {jQuery} The last layer that was popped, or null if no layer matching the given $el was found.
585
+ */
586
+ popUntil: function (element, triggerBeforeEvents = false) {
572
587
  var $el = (element instanceof $) ? element : $(element);
573
588
  var index = layerIndex(this._stack, $el);
574
589
 
@@ -576,41 +591,31 @@ LayerManager.prototype = {
576
591
  return null;
577
592
  }
578
593
 
579
- var oldTopBlanketedIndex = topBlanketedIndex(this._stack);
594
+ const oldTopBlanketedIndex = topBlanketedIndex(this._stack);
580
595
 
581
596
  // Removes all layers above the current one.
582
- popLayers(this._stack, index + 1, createLayer($el).isBlanketed());
597
+ const layer = createLayer($el);
598
+ const [success, $lastPopped] = popLayers(this._stack, index + 1, layer.isBlanketed(), triggerBeforeEvents)
599
+ if (!success) {
600
+ return $lastPopped;
601
+ }
583
602
 
584
603
  // Removes the current layer.
604
+ if (!layer._hideLayer(triggerBeforeEvents)) {
605
+ return $lastPopped;
606
+ }
585
607
  this._stack.splice(index, 1);
586
- createLayer($el)._hideLayer();
587
-
588
608
  updateBlanket(this._stack, oldTopBlanketedIndex);
589
609
 
590
610
  return $el;
591
611
  },
592
612
 
593
- /**
594
- * Gets the top layer, if it exists.
595
- *
596
- * @returns The layer on top of the stack, if it exists, otherwise null.
597
- */
598
- getTopLayer: function () {
599
- if (!this._stack.length) {
600
- return null;
601
- }
602
-
603
- var $topLayer = this._stack[this._stack.length - 1];
604
-
605
- return $topLayer;
606
- },
607
-
608
613
  /**
609
614
  * Pops the top layer, if it exists and it is non modal and non persistent.
610
615
  *
611
616
  * @returns The layer that was popped, if it was popped.
612
617
  */
613
- popTopIfNonPersistent: function () {
618
+ popTopIfNonPersistent: function (triggerBeforeEvents = false) {
614
619
  var $topLayer = this.getTopLayer();
615
620
  var layer = createLayer($topLayer);
616
621
 
@@ -618,7 +623,7 @@ LayerManager.prototype = {
618
623
  return null;
619
624
  }
620
625
 
621
- return this.popUntil($topLayer);
626
+ return this.popUntil($topLayer, triggerBeforeEvents);
622
627
  },
623
628
 
624
629
  /**
@@ -627,7 +632,7 @@ LayerManager.prototype = {
627
632
  *
628
633
  * @returns The blanketed layer that was popped, if it exists, otherwise null.
629
634
  */
630
- popUntilTopBlanketed: function () {
635
+ popUntilTopBlanketed: function (triggerBeforeEvents = false) {
631
636
  var i = topBlanketedIndex(this._stack);
632
637
 
633
638
  if (i < 0) {
@@ -642,7 +647,7 @@ LayerManager.prototype = {
642
647
  var $next = this.getNextHigherNonPeristentAndNonBlanketedLayer($topBlanketedLayer);
643
648
  if ($next) {
644
649
  var stopIndex = layerIndex(this._stack, $next);
645
- popLayers(this._stack, stopIndex, true);
650
+ popLayers(this._stack, stopIndex, true, triggerBeforeEvents);
646
651
  return $next;
647
652
  }
648
653
  return null;
@@ -657,7 +662,7 @@ LayerManager.prototype = {
657
662
  * Pops all layers above and including the top persistent layer. If layers exist but none are persistent, this method
658
663
  * does nothing.
659
664
  */
660
- popUntilTopPersistent: function () {
665
+ popUntilTopPersistent: function (triggerBeforeEvents = false) {
661
666
  var $toPop = LayerManager.global.getTopLayer();
662
667
  if (!$toPop) {
663
668
  return;
@@ -677,7 +682,7 @@ LayerManager.prototype = {
677
682
 
678
683
  if ($toPop && !toPop.isPersistent()) {
679
684
  stopIndex = layerIndex(this._stack, $toPop);
680
- popLayers(this._stack, stopIndex, true);
685
+ popLayers(this._stack, stopIndex, true, triggerBeforeEvents);
681
686
  updateBlanket(this._stack, oldTopBlanketedIndex);
682
687
  } else {
683
688
  // Here we have a blanketed persistent layer
@@ -686,7 +691,7 @@ LayerManager.prototype = {
686
691
  }
687
692
  } else {
688
693
  stopIndex = layerIndex(this._stack, $toPop);
689
- popLayers(this._stack, stopIndex, true);
694
+ popLayers(this._stack, stopIndex, true, triggerBeforeEvents);
690
695
  updateBlanket(this._stack, oldTopBlanketedIndex);
691
696
  }
692
697
  }
@@ -698,7 +703,7 @@ LayerManager.prototype = {
698
703
  function initCloseLayerOnEscPress() {
699
704
  $doc.on('keydown', function (e) {
700
705
  if (e.keyCode === keyCode.ESCAPE) {
701
- LayerManager.global.popUntilTopPersistent();
706
+ LayerManager.global.popUntilTopPersistent(true);
702
707
  e.preventDefault();
703
708
  }
704
709
  });
@@ -706,7 +711,7 @@ function initCloseLayerOnEscPress() {
706
711
 
707
712
  function initCloseLayerOnBlanketClick() {
708
713
  $doc.on('click', '.aui-blanket', function (e) {
709
- if (LayerManager.global.popUntilTopBlanketed()) {
714
+ if (LayerManager.global.popUntilTopBlanketed(true)) {
710
715
  e.preventDefault();
711
716
  }
712
717
  });
@@ -9,7 +9,7 @@ var uniqueIDcounter = 0;
9
9
  * returning. Note uniqueID, uniqueIDstring, uniqueIDcounter = 0; set at top of
10
10
  * file.
11
11
  *
12
- * @param {String} prefix String to prepend to ID instead of default AUI prefix.
12
+ * @param {String} [prefix] String to prepend to ID instead of default AUI prefix.
13
13
  *
14
14
  * @returns {String}
15
15
  */
@@ -36,7 +36,6 @@ aui-header,
36
36
  box-sizing: border-box;
37
37
  padding: 0 @aui-grid;
38
38
  position: relative;
39
- z-index: @aui-z-header;
40
39
 
41
40
  .aui-header-before {
42
41
  flex-grow: 0;
@@ -4,7 +4,7 @@
4
4
  background-color: var(--aui-tooltip-bg-color);
5
5
  padding: 2px 6px;
6
6
  pointer-events: none;
7
- z-index: 9999;
7
+ z-index: @aui-z-tooltip;
8
8
  border-radius: @aui-border-radius-small;
9
9
  font-size: @aui-font-size-small;
10
10
  line-height: unit(20 / @aui-font-size-small);
@@ -108,7 +108,9 @@ cite {
108
108
  font-style: italic;
109
109
  }
110
110
  cite:before {
111
- content: "\2014 \2009";
111
+ display: inline-block;
112
+ content: "\2014";
113
+ padding-right: 0.5em;
112
114
  }
113
115
  blockquote {
114
116
  border-left: 2px solid @aui-border-color;
@@ -28,8 +28,19 @@
28
28
  @aui-select2-chosen-border-radius: @aui-border-radius-smallish;
29
29
  @aui-select2-chosen-close-button-length: 17px;
30
30
 
31
+ .select2-drop-mask {
32
+ z-index: @aui-z-select2 - 2;
33
+ }
34
+
31
35
  .aui-select2-drop {
32
36
  --aui-item-border-radius: 0;
37
+ margin-top: @aui-dropdown-trigger-offset;
38
+ margin-bottom: 0;
39
+ z-index: @aui-z-select2 - 1; // override select2 z-indices to fit in AUI's ranges. sits above blanket but below suggestions.
40
+ }
41
+
42
+ .aui-select2 .select2-search {
43
+ z-index: @aui-z-select2;
33
44
  }
34
45
 
35
46
  .aui-select2-drop .select2-result-selectable .select2-match,
@@ -48,12 +59,6 @@
48
59
  padding: @aui-select2-search-input-padding+@aui-dropdown2-padding;
49
60
  }
50
61
 
51
- .aui-select2-drop {
52
- margin-top: @aui-dropdown-trigger-offset;
53
- margin-bottom: 0;
54
- z-index: 9999; // re-instated style from core select2 style
55
- }
56
-
57
62
  .aui-select2-drop .select2-results ul.select2-result-sub > li .select2-result-label,
58
63
  .aui-select2-drop .select2-results .select2-result-label,
59
64
  .aui-select2-drop .select2-results .select2-searching,
@@ -27,7 +27,6 @@
27
27
  #aui.box-sizing();
28
28
  min-width: @aui-sidebar-collapsed-width;
29
29
  position: absolute;
30
- z-index: @aui-z-sidebar;
31
30
 
32
31
  // when the sidebar sits over the content
33
32
  &.aui-sidebar-fly-out {
@@ -56,11 +55,12 @@
56
55
  position: absolute;
57
56
  top: 0;
58
57
  bottom: auto;
58
+ // explicit z-index needed in order to appear over the top of page layout's #content and #footer on the sidebar's RHS.
59
+ // they use padding-left to "make space" for sidebar, meaning their background-color bleeds over the top of sidebar.
60
+ z-index: 1;
59
61
 
60
62
  &.aui-is-docked {
61
63
  position: fixed;
62
- top: 0;
63
- bottom: auto;
64
64
  }
65
65
  }
66
66
 
@@ -295,6 +295,8 @@
295
295
  #content .aui-sidebar + main,
296
296
  #content + #footer {
297
297
  .aui-page-sidebar & {
298
+ // needs to be padding, not margin, so that horizontal scrollbars are not drawn.
299
+ // future iterations of page layout should use grid or flexbox and carve out explicit space for sidebar.
298
300
  padding-left: var(--aui-sidebar-width);
299
301
  }
300
302
 
@@ -6,7 +6,7 @@
6
6
  position: fixed;
7
7
  top: @gutter + 55px; // height of header plus some fudge.
8
8
  right: @gutter;
9
- z-index: 4000;
9
+ z-index: @aui-z-flag-container;
10
10
  }
11
11
 
12
12
  .aui-flag {
@@ -6,7 +6,6 @@
6
6
 
7
7
  form.aui {
8
8
  margin: 20px 0 0 0;
9
- position: relative;
10
9
  }
11
10
 
12
11
  form.aui:first-child {
@@ -1,4 +1,13 @@
1
- @aui-z-base: 2;
2
- @aui-z-sidebar: @aui-z-base + 1;
3
- @aui-z-header: @aui-z-sidebar + 1;
4
- @aui-z-skip: @aui-z-header + 1;
1
+ // See layer.js and ZINDEX_AUI_LAYER_MIN, too.
2
+ // All modern components' z-index values should be managed by the layer manager.
3
+ @aui-z-layer-min: 3000;
4
+ @aui-z-dropdown: @aui-z-layer-min;
5
+ @aui-z-inline-dialog: @aui-z-layer-min;
6
+ @aui-z-modal-dialog: @aui-z-layer-min;
7
+
8
+ // Additional manually-configured indexes, because sometimes we need things to be above or below the base.
9
+ @aui-z-blanket: @aui-z-layer-min - 500; // so it appears below modals
10
+ @aui-z-skip: @aui-z-layer-min + 1000; // so they appear above modals
11
+ @aui-z-flag-container: @aui-z-layer-min + 1000; // so they appear above modals
12
+ @aui-z-select2: @aui-z-layer-min + 3; // so it can paint an "overlay" behind its suggestion dropdown
13
+ @aui-z-tooltip: @aui-z-layer-min + 2000; // so they appear over the top of pretty much everything
@@ -12,7 +12,6 @@ aui-inline-dialog {
12
12
 
13
13
  display: block;
14
14
  position: absolute;
15
- z-index: 100;
16
15
 
17
16
  // Handle FOUC
18
17
  &:not([resolved]) {
@@ -159,7 +158,6 @@ aui-inline-dialog {
159
158
  .aui-inline-dialog {
160
159
  display: none;
161
160
  position: absolute;
162
- z-index: 100;
163
161
 
164
162
  .aui-inline-dialog-contents,
165
163
  .contents {
@@ -23,7 +23,7 @@
23
23
  position: fixed;
24
24
  top: 0;
25
25
  width: 100%;
26
- z-index: 2500;
26
+ z-index: @aui-z-blanket;
27
27
 
28
28
  &:not([hidden]) {
29
29
  #aui.transition.fadeIn(@aui-blanket-fade-time, @aui-blanket-fade-delay);
@@ -51,11 +51,6 @@ aui-message, .aui-message {
51
51
  }
52
52
  }
53
53
 
54
- .aui-popup .aui-message.closeable,
55
- .aui-dialog .aui-message.closeable {
56
- z-index: 4000;
57
- }
58
-
59
54
  .aui-message-error {
60
55
  --aui-message-icolor: var(--aui-message-error-icon-color);
61
56
  --aui-message-ig: @aui-glyph-exclamation-circle;