@atlassian/aui 9.2.9 → 9.2.11

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@atlassian/aui",
3
3
  "description": "Atlassian User Interface library",
4
- "version": "9.2.9",
4
+ "version": "9.2.11",
5
5
  "author": "Atlassian Pty Ltd.",
6
6
  "homepage": "https://aui.atlassian.com",
7
7
  "license": "Apache-2.0",
@@ -5,9 +5,6 @@ Version: 3.4.4 Timestamp: Thu Oct 24 13:23:11 PDT 2013
5
5
  margin: 0;
6
6
  position: relative;
7
7
  display: inline-block;
8
- /* inline-block for ie7 */
9
- zoom: 1;
10
- *display: inline;
11
8
  vertical-align: middle;
12
9
  }
13
10
 
@@ -35,8 +35,27 @@ function setDropdownTriggerActiveState(trigger, isActive) {
35
35
  * @param {Event} [e] - the event that triggered the dropdown being shown
36
36
  */
37
37
  function handleFocus(dropdown, e = {}) {
38
- const mouseEvent = e && e.type && (e.type.indexOf('mouse') > -1 || e.type.indexOf('hover') > -1);
39
- dropdown.isSubmenu && !mouseEvent ? dropdown.focusItem(0) : dropdown.focus();
38
+ if (e && e.type) {
39
+ const isMouseEvent = e.type.indexOf('mouse') > -1 || e.type.indexOf('hover') > -1;
40
+ const isKeyDownEvent = e.type.indexOf('key') > -1;
41
+ if (dropdown.isSubmenu) {
42
+ !isMouseEvent ? dropdown.focusItem(0) : dropdown.focus();
43
+ } else if (isKeyDownEvent){
44
+ const isUpArrow = e.keyCode === keyCode.UP;
45
+ // set focus to last item in the menu to navigate bottom -> up
46
+ if (isUpArrow) {
47
+ const visibleItems = getVisibleDropdownItems(dropdown);
48
+ if (visibleItems && visibleItems.length) {
49
+ dropdown.focusItem(visibleItems.length - 1);
50
+ }
51
+ } else {
52
+ // if enter/space/downArrow than focus goes to the first item
53
+ dropdown.focusItem(0);
54
+ }
55
+ } else {
56
+ dropdown.focus();
57
+ }
58
+ }
40
59
  }
41
60
 
42
61
  // LOADING STATES
@@ -0,0 +1,37 @@
1
+ import skate from "skatejs";
2
+ import {onChildrenChange} from "../internal/detect-children-change";
3
+ import jQuery from "jquery";
4
+
5
+ export function createFormsComponentBody(type) {
6
+
7
+ let unsub;
8
+
9
+ return {
10
+ type: skate.type.CLASSNAME,
11
+ attached: function(el) {
12
+
13
+ onChildrenChange(el,(unsubscribe) => {
14
+
15
+ // Store function that stops subscription
16
+ unsub = unsubscribe;
17
+
18
+ const innerCheckboxList = jQuery(`input[type=${type}]`, el);
19
+
20
+ innerCheckboxList.each(function (i, radio) {
21
+ jQuery('<span class="aui-form-glyph"></span>').insertAfter(radio);
22
+ });
23
+
24
+ const isInsertedAfterChange = innerCheckboxList.length > 0;
25
+ if (isInsertedAfterChange) {
26
+ unsub();
27
+ }
28
+ });
29
+ },
30
+ detached: function(el) {
31
+ jQuery('.aui-form-glyph', el).remove();
32
+ if (unsub) {
33
+ unsub();
34
+ }
35
+ }
36
+ }
37
+ }
@@ -1,18 +1,12 @@
1
1
  import skate from 'skatejs';
2
- import jQuery from 'jquery';
2
+ import {createFormsComponentBody} from "./create-forms-component-body";
3
+
3
4
 
4
5
  /**
5
6
  * Allows us to add a new DOM element for rendering ADG styled checkbox glyphs,
6
7
  * so we can get our desired aesthetic without having to rely on a specific markup pattern.
7
8
  */
8
- skate('checkbox', {
9
- type: skate.type.CLASSNAME,
10
- attached: function(el) {
11
- jQuery('input[type=checkbox]', el).each(function(i, checkbox) {
12
- jQuery('<span class="aui-form-glyph"></span>').insertAfter(checkbox);
13
- });
14
- },
15
- detached: function(el) {
16
- jQuery('.aui-form-glyph', el).remove();
17
- }
18
- });
9
+ skate(
10
+ 'checkbox',
11
+ createFormsComponentBody('checkbox')
12
+ );
@@ -1,18 +1,12 @@
1
1
  import skate from 'skatejs';
2
- import jQuery from 'jquery';
2
+ import {createFormsComponentBody} from "./create-forms-component-body";
3
+
3
4
 
4
5
  /**
5
6
  * Allows us to add a new DOM element for rendering ADG styled radio glyphs,
6
7
  * so we can get our desired aesthetic without having to rely on a specific markup pattern.
7
8
  */
8
- skate('radio', {
9
- type: skate.type.CLASSNAME,
10
- attached: function(el) {
11
- jQuery('input[type=radio]', el).each(function(i, radio) {
12
- jQuery('<span class="aui-form-glyph"></span>').insertAfter(radio);
13
- });
14
- },
15
- detached: function(el) {
16
- jQuery('.aui-form-glyph', el).remove();
17
- }
18
- });
9
+ skate(
10
+ 'radio',
11
+ createFormsComponentBody('radio')
12
+ );
@@ -0,0 +1,35 @@
1
+ function isChildrenChanged(mutationList) {
2
+ for (const mutation of mutationList) {
3
+ if (mutation.type === 'childList') {
4
+ return true;
5
+ }
6
+ }
7
+ return false;
8
+ }
9
+
10
+ /***
11
+ * Executes callback every time element children change. Called once initially.
12
+ *
13
+ * ***Make sure to use unsubscribe callback to free resources occupied for detection***
14
+ *
15
+ * @param element Element whose children should be monitored
16
+ * @param callback Function to be called when children change happened. Gets unsubscribe function as argument.
17
+ */
18
+ export function onChildrenChange(element, callback) {
19
+
20
+ let isCompleteOnInit = false;
21
+
22
+ callback(() => { isCompleteOnInit = true });
23
+
24
+ if (isCompleteOnInit) {
25
+ return;
26
+ }
27
+
28
+ const observer = new MutationObserver((mutationList) => {
29
+ if (isChildrenChanged(mutationList)) {
30
+ callback(() => observer.disconnect());
31
+ }
32
+ });
33
+
34
+ observer.observe(element, { childList: true });
35
+ }
@@ -1,7 +1,7 @@
1
1
  import Backbone from 'backbone';
2
2
 
3
3
  export default Backbone.Model.extend({
4
- idAttribute: 'label',
4
+ idAttribute: 'value',
5
5
  getLabel: function () {
6
6
  return this.get('label') || this.get('value');
7
7
  }
@@ -15,7 +15,7 @@ function enableAlignment (view) {
15
15
  if (view.anchor && !view._auiAlignment) {
16
16
  view._auiAlignment = new Alignment(view.el, view.anchor, {
17
17
  flipContainer: 'scrollParent',
18
- positionFixed: true,
18
+ positionFixed: false,
19
19
  preventOverflow: false,
20
20
  flip: false
21
21
  });
@@ -277,8 +277,14 @@ Sidebar.prototype.toggle = function () {
277
277
  if (this.isCollapsed()) {
278
278
  this.expand();
279
279
  this._removeAllTooltips();
280
+ this.$el
281
+ .find('.aui-sidebar-toggle')
282
+ .attr('aria-label', I18n.getText('aui.sidebar.collapse.tooltip'));
280
283
  } else {
281
284
  this.collapse();
285
+ this.$el
286
+ .find('.aui-sidebar-toggle')
287
+ .attr('aria-label', I18n.getText('aui.sidebar.expand.tooltip'));
282
288
  }
283
289
  return this;
284
290
  };
@@ -543,8 +549,8 @@ var tipsyOpts = {
543
549
  }
544
550
  };
545
551
 
546
- function showTipsy($trigger) {
547
- $trigger.tooltip(tipsyOpts).tooltip('show');
552
+ function showTipsy($trigger, opts) {
553
+ $trigger.tooltip({ ...tipsyOpts, ...opts }).tooltip('show');
548
554
  var $tip = $trigger.data('tipsy') && $trigger.data('tipsy').$tip;
549
555
  if ($tip) { // if .aui-sidebar-group does not have a title to display
550
556
  // Remove "opacity" inline style from Tipsy to allow the our own styles and transitions to be applied
@@ -684,7 +690,7 @@ function initializeHandlers(sidebar) {
684
690
  } else {
685
691
  $trigger.data('tooltip', I18n.getText('aui.sidebar.collapse.tooltip'));
686
692
  }
687
- showTipsy($trigger);
693
+ showTipsy($trigger, { aria: false });
688
694
  });
689
695
 
690
696
  sidebar.$el.on('click blur mouseleave', sidebar.toggleSelector, function () {
@@ -127,9 +127,13 @@ function whenIType (keys) {
127
127
  var title = elem.attr('title') || '';
128
128
  var keyCombos = boundKeyCombos.slice();
129
129
  var existingCombos = elem.data('boundKeyCombos') || [];
130
- var shortcutInstructions = elem.data('kbShortcutAppended') || '';
131
- var isFirst = !shortcutInstructions;
132
- var originalTitle = isFirst ? title : title.substring(0, title.length - shortcutInstructions.length);
130
+ var kbShortcutAppended = elem.data('kbShortcutAppended') || ''
131
+ var kbShortcutAppendedScreenReader = elem.data('kbShortcutAppendedScreenReader') || ''
132
+ var ariaLabel = elem.attr('aria-label');
133
+ var isFirstShortcut = !kbShortcutAppended;
134
+ var isFirstShortcutScreenReader = !kbShortcutAppendedScreenReader;
135
+ var originalTitle = isFirstShortcut ? title : title.substring(0, title.length - kbShortcutAppended.length);
136
+ var originalAriaLabel = isFirstShortcutScreenReader ? title : ariaLabel.substring(0, ariaLabel.length - kbShortcutAppendedScreenReader.length);
133
137
 
134
138
  while (keyCombos.length) {
135
139
  var keyCombo = keyCombos.shift();
@@ -137,19 +141,26 @@ function whenIType (keys) {
137
141
  return isEqual(keyCombo, existingCombo);
138
142
  });
139
143
  if (!comboAlreadyExists) {
140
- shortcutInstructions = appendKeyComboInstructions(keyCombo.slice(), shortcutInstructions, isFirst);
141
- isFirst = false;
144
+ kbShortcutAppended = appendKeyComboInstructions(keyCombo.slice(), kbShortcutAppended, isFirstShortcut);
145
+ kbShortcutAppendedScreenReader = appendKeyComboInstructions(keyCombo.slice(), kbShortcutAppendedScreenReader, isFirstShortcutScreenReader, { workaroundJaws: true });
146
+ isFirstShortcut = false;
147
+ isFirstShortcutScreenReader = false;
142
148
  }
143
149
  }
144
150
 
145
151
  if (isMac) {
146
- shortcutInstructions = shortcutInstructions
152
+ kbShortcutAppended = kbShortcutAppended
153
+ .replace(/Meta/ig, '\u2318') //Apple cmd key
154
+ .replace(/Shift/ig, '\u21E7'); //Apple Shift symbol
155
+ kbShortcutAppendedScreenReader = kbShortcutAppendedScreenReader
147
156
  .replace(/Meta/ig, '\u2318') //Apple cmd key
148
157
  .replace(/Shift/ig, '\u21E7'); //Apple Shift symbol
149
158
  }
150
159
 
151
- elem.attr('title', originalTitle + shortcutInstructions);
152
- elem.data('kbShortcutAppended', shortcutInstructions);
160
+ elem.attr('title', originalTitle + kbShortcutAppended);
161
+ elem.attr('aria-label', originalAriaLabel + kbShortcutAppendedScreenReader)
162
+ elem.data('kbShortcutAppended', kbShortcutAppended);
163
+ elem.data('kbShortcutAppendedScreenReader', kbShortcutAppendedScreenReader);
153
164
  elem.data('boundKeyCombos', existingCombos.concat(boundKeyCombos));
154
165
  }
155
166
 
@@ -163,23 +174,32 @@ function whenIType (keys) {
163
174
 
164
175
  var title = elem.attr('title');
165
176
  elem.attr('title', title.replace(shortcuts, ''));
177
+ elem.attr('aria-label', title.replace(shortcuts, ''));
166
178
  elem.removeData('kbShortcutAppended');
179
+ elem.removeData('kbShortcutAppendedScreenReader');
167
180
  elem.removeData('boundKeyCombos');
168
181
  }
169
182
 
170
- //
171
- function appendKeyComboInstructions(keyCombo, title, isFirst) {
183
+ function appendKeyComboInstructions(keyCombo, title, isFirst, options) {
184
+ var openParenthesis = '(';
185
+ var closeParenthesis = ')';
186
+
187
+ if (options && options.workaroundJaws) {
188
+ openParenthesis = '';
189
+ closeParenthesis = '';
190
+ }
191
+
172
192
  if (isFirst) {
173
- title += ' (' + I18n.getText('aui.keyboard.shortcut.type.x', keyCombo.shift());
193
+ title += ' ' + openParenthesis + I18n.getText('aui.keyboard.shortcut.type.x', keyCombo.shift());
174
194
  } else {
175
195
  title = title.replace(/\)$/, '');
176
- title += I18n.getText('aui.keyboard.shortcut.or.x', keyCombo.shift());
196
+ title += ' ' + I18n.getText('aui.keyboard.shortcut.or.x', keyCombo.shift());
177
197
  }
178
198
 
179
199
  keyCombo.forEach(function (key) {
180
200
  title += ' ' + I18n.getText('aui.keyboard.shortcut.then.x', key);
181
201
  });
182
- title += ')';
202
+ title += closeParenthesis;
183
203
 
184
204
  return title;
185
205
  }
@@ -10,7 +10,7 @@
10
10
  @bg-color: var(--aui-appheader-quicksearch-bg-color);
11
11
  @border-color: var(--aui-appheader-quicksearch-border-color);
12
12
  @text-color: var(--aui-appheader-quicksearch-text-color);
13
- @placeholder-color: var(--aui-form-placeholder-text-color);
13
+ @placeholder-color: var(--aui-appheader-quicksearch-placeholder-text-color);
14
14
  @focus-bg-color: var(--aui-appheader-quicksearch-focus-bg-color);
15
15
  @focus-text-color: var(--aui-appheader-quicksearch-focus-text-color);
16
16
  @width: 170px;
@@ -199,6 +199,21 @@ form.aui:not(.aui-legacy-forms) {
199
199
  .aui-checkbox-disabled-style();
200
200
  }
201
201
  }
202
+
203
+ &:focus + .aui-form-glyph::after {
204
+ .aui-radio-focus-size();
205
+ .aui-radio-focus-position();
206
+
207
+ content: "";
208
+
209
+ border: @button-focus-border;
210
+ border-radius: @aui-form-button-size;
211
+ background-color: transparent;
212
+ }
213
+
214
+ &:focus + .aui-form-glyph::before {
215
+ border-color: @button-focus-border-color;
216
+ }
202
217
  }
203
218
  }
204
219
 
@@ -254,6 +269,10 @@ form.aui:not(.aui-legacy-forms) {
254
269
  .aui-checkbox-disabled-style();
255
270
  }
256
271
  }
272
+
273
+ &:focus + .aui-form-glyph::before {
274
+ border-color: @button-focus-border-color;
275
+ }
257
276
  }
258
277
  }
259
278
 
@@ -272,30 +291,4 @@ form.aui:not(.aui-legacy-forms) {
272
291
  top: @radio-offset-top - 1px;
273
292
  }
274
293
 
275
- .radio {
276
- input {
277
- &:focus + .aui-form-glyph::after {
278
- .aui-radio-focus-size();
279
- .aui-radio-focus-position();
280
-
281
- content: "";
282
-
283
- border: @button-focus-border;
284
- border-radius: @aui-form-button-size;
285
- background-color: transparent;
286
- }
287
-
288
- &:focus + .aui-form-glyph::before {
289
- border-color: @button-focus-border-color;
290
- }
291
- }
292
- }
293
-
294
- .checkbox {
295
- input {
296
- &:focus + .aui-form-glyph::before {
297
- border-color: @button-focus-border-color;
298
- }
299
- }
300
- }
301
294
  }
@@ -1,7 +1,7 @@
1
1
  @ak-color-N0: #FFFFFF;
2
2
  @ak-color-N10: #FAFBFC;
3
3
  @ak-color-N20: #F4F5F7;
4
- @ak-color-N30: #EBECF0;
4
+ @ak-color-N30: #EBECF1;
5
5
  @ak-color-N40: #DFE1E6;
6
6
  @ak-color-N50: #C1C7D0;
7
7
  @ak-color-N60: #B3BAC5;
@@ -144,7 +144,7 @@
144
144
  --aui-label-close-hover-text-color: @ak-color-N800;
145
145
 
146
146
  // Forms
147
- --aui-form-placeholder-text-color: @ak-color-N100;
147
+ --aui-form-placeholder-text-color: @ak-color-N300;
148
148
  --aui-form-placeholder-disabled-text-color: @ak-color-N70;
149
149
  --aui-form-label-text-color: @ak-color-N200;
150
150
  --aui-form-error-text-color: @ak-color-R400;
@@ -218,6 +218,7 @@
218
218
  --aui-appheader-quicksearch-bg-color: @ak-color-N90A;
219
219
  --aui-appheader-quicksearch-border-color: transparent;
220
220
  --aui-appheader-quicksearch-text-color: @ak-color-B50;
221
+ --aui-appheader-quicksearch-placeholder-text-color: @ak-color-N80;
221
222
  --aui-appheader-quicksearch-focus-bg-color: var(--aui-appheader-quicksearch-bg-color);
222
223
  --aui-appheader-quicksearch-focus-text-color: @ak-color-B50;
223
224
 
@@ -535,6 +536,7 @@
535
536
  --aui-appheader-quicksearch-bg-color: @ak-color-N90A;
536
537
  --aui-appheader-quicksearch-border-color: transparent;
537
538
  --aui-appheader-quicksearch-text-color: @ak-color-B50;
539
+ --aui-appheader-quicksearch-placeholder-text-color: @ak-color-N400;
538
540
  --aui-appheader-quicksearch-focus-bg-color: var(--aui-appheader-quicksearch-bg-color);
539
541
  --aui-appheader-quicksearch-focus-text-color: @ak-color-B50;
540
542