@atlassian/aui 9.1.1 → 9.1.5-c484fdf49

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.1.1",
4
+ "version": "9.1.5-c484fdf49",
5
5
  "author": "Atlassian Pty Ltd.",
6
6
  "homepage": "https://aui.atlassian.com",
7
7
  "license": "Apache-2.0",
@@ -15,6 +15,7 @@ import skate from './internal/skate';
15
15
  import {ifGone} from './internal/elements';
16
16
  import {doIfTrigger, setTrigger} from './trigger';
17
17
  import generateUniqueId from './unique-id';
18
+ import escapeHtml from './escape-html';
18
19
 
19
20
  function isHidden(el) {
20
21
  return el.hasAttribute('hidden') || el.classList.contains('hidden');
@@ -62,7 +63,7 @@ function makeAsyncDropdownContents (json) {
62
63
  var itemHtml = `
63
64
  <${tagName} ${makeAttribute('for')} ${makeAttribute('href')} ${makeBooleanAttribute('interactive')}
64
65
  ${makeBooleanAttribute('checked')} ${makeBooleanAttribute('disabled')} ${makeBooleanAttribute('hidden')}>
65
- ${itemData.content}
66
+ ${escapeHtml(itemData.content)}
66
67
  </${tagName}>`;
67
68
 
68
69
  return itemHtml;
@@ -55,9 +55,7 @@ var EXPANDER_EVENTS = {
55
55
  properties.$content.attr('aria-expanded', 'true');
56
56
  properties.$trigger.attr('aria-expanded', 'true');
57
57
 
58
- if (properties.$content.outerHeight() > 0) {
59
- properties.$content.removeAttr('hidden');
60
- }
58
+ properties.$content.get(0).removeAttribute('hidden');
61
59
 
62
60
  //handle replace text
63
61
  replaceText(properties);
@@ -92,7 +90,7 @@ var EXPANDER_EVENTS = {
92
90
 
93
91
  //handle the height option
94
92
  if (properties.$content.outerHeight() === 0) {
95
- properties.$content[0].setAttribute('hidden', '');
93
+ properties.$content.get(0).setAttribute('hidden', '');
96
94
  }
97
95
 
98
96
  properties.$trigger.trigger('aui-expander-collapsed');
@@ -1,10 +1,15 @@
1
1
  import createHeader from './internal/header/create-header';
2
2
  import skate from './internal/skate';
3
3
 
4
- const Header = skate('aui-header', {
5
- type: skate.type.CLASSNAME,
4
+ const Header = skate('aui-header-end', {
5
+ type: skate.type.ELEMENT,
6
6
  created: function (element) {
7
- createHeader(element);
7
+ const auiHeader = element.parentElement;
8
+ if (auiHeader && auiHeader.classList.contains('aui-header')) {
9
+ createHeader(auiHeader);
10
+ } else {
11
+ console.log('Could not async. initialise aui-header');
12
+ }
8
13
  }
9
14
  });
10
15
 
@@ -6,6 +6,8 @@ export default {
6
6
  'aui.header.home.link': 'Go to home page',
7
7
  'aui.dropdown.async.error': 'Error loading dropdown',
8
8
  'aui.dropdown.async.loading': 'Loading dropdown',
9
+ 'aui.words.expand': 'Expand',
10
+ 'aui.words.collapse': 'Collapse',
9
11
  'aui.words.add': 'Add',
10
12
  'aui.words.update': 'Update',
11
13
  'aui.words.delete': 'Delete',
@@ -16,7 +16,7 @@ export default skate('aui-option', {
16
16
  serialize: function () {
17
17
  var json = {};
18
18
  if (this.hasAttribute('img-src')) {
19
- json['img-src'] = escapeHtml(this.getAttribute('img-src'));
19
+ json['img-src'] = encodeURI(this.getAttribute('img-src'));
20
20
  }
21
21
  json.value = this.value;
22
22
  json.label = escapeHtml(this.textContent);
@@ -64,7 +64,7 @@ SuggestionsView.prototype = {
64
64
  suggestions.forEach(function (sugg) {
65
65
  var label = sugg.getLabel();
66
66
  var imageSrc = sugg.get('img-src');
67
- var image = imageSrc ? `<img src="${imageSrc}"/>` : '';
67
+ var image = imageSrc ? `<img src="${encodeURI(imageSrc)}"/>` : '';
68
68
  var newValueText = sugg.get('new-value') ? (` (<em>${I18n.getText('aui.select.new.value')}</em>)`) : '';
69
69
  html += `<li role="option" class="aui-select-suggestion" id="${generateListItemID(listId, i)}">${image}${label}${newValueText}</li>`;
70
70
  i++;
@@ -52,11 +52,25 @@ function Navigation (selector) {
52
52
  });
53
53
 
54
54
  // Toggle expand on click
55
- this.$el.find('> li[aria-expanded] > .aui-nav-subtree-toggle').on('click', function () {
55
+ var $togglers = this.$el.find('> li[aria-expanded] > .aui-nav-subtree-toggle');
56
+ $togglers.on('click', function () {
56
57
  var nav = navigationWidget($(this).siblings('.aui-nav'));
57
58
  nav.toggle();
58
59
  });
59
60
 
61
+ // Make sure subtree togglers have proper a11y label
62
+ $togglers.each(function () {
63
+ var $parent = $(this).parent('li[aria-expanded]');
64
+ var $icon = $(this).find('.aui-icon');
65
+ var isListItemExpanded = $parent.attr('aria-expanded') === 'true';
66
+
67
+ $icon.text(
68
+ isListItemExpanded ?
69
+ I18n.getText('aui.words.collapse') :
70
+ I18n.getText('aui.words.expand')
71
+ );
72
+ })
73
+
60
74
  return this;
61
75
  }
62
76
 
@@ -72,7 +86,8 @@ Navigation.prototype.expand = function () {
72
86
  this.$treeParent.attr('aria-expanded', 'true');
73
87
  this.$subtreeToggleIcon
74
88
  .removeClass('aui-iconfont-collapsed')
75
- .addClass('aui-iconfont-expanded');
89
+ .addClass('aui-iconfont-expanded')
90
+ .text(I18n.getText('aui.words.collapse'));
76
91
  this.hideMoreItems();
77
92
  return this;
78
93
  };
@@ -81,7 +96,8 @@ Navigation.prototype.collapse = function () {
81
96
  this.$treeParent.attr('aria-expanded', 'false');
82
97
  this.$subtreeToggleIcon
83
98
  .removeClass('aui-iconfont-expanded')
84
- .addClass('aui-iconfont-collapsed');
99
+ .addClass('aui-iconfont-collapsed')
100
+ .text(I18n.getText('aui.words.expand'));
85
101
  return this;
86
102
  };
87
103
 
@@ -79,7 +79,7 @@ function setInitialVisualState (element) {
79
79
 
80
80
  function setElementImage (element, imageSource) {
81
81
  $(element._input).addClass('aui-select-has-inline-image');
82
- element._input.setAttribute('style', 'background-image: url(' + imageSource + ')');
82
+ element._input.setAttribute('style', 'background-image: url(' + encodeURI(imageSource) + ')');
83
83
  }
84
84
 
85
85
  function suggest (element, autoHighlight, query) {
@@ -103,54 +103,44 @@ aui-header,
103
103
  color: var(--aui-appheader-text-color);
104
104
  height: var(--aui-appheader-height, initial);
105
105
 
106
- .aui-header-logo {
107
- font-size: @aui-font-size-xxlarge;
108
- }
109
-
110
106
  // Override the icon styles so that every icon in the header is a uniform size.
111
107
  .aui-icon {
112
108
  --aui-icon-size: 24px;
113
109
  }
114
110
 
115
- .aui-header-primary,
116
- .aui-header-secondary {
117
- > .aui-nav {
118
- > li > a {
119
- --aui-item-text: var(--aui-appheader-text-color);
120
- --aui-item-focus-bg: var(--aui-appheader-item-focus-bg-color);
121
- --aui-item-focus-text: var(--aui-appheader-item-focus-text-color);
122
- --aui-item-active-bg: var(--aui-appheader-item-active-bg-color);
123
- --aui-item-active-text: var(--aui-appheader-item-active-text-color);
124
- }
125
-
126
- > li > a:not(.aui-button) {
127
- #aui-nav.item-style(normal);
128
- display: flex;
129
- align-items: center;
130
- border-radius: var(--aui-appheader-item-border-radius);
131
- box-sizing: border-box;
132
- height: var(--aui-appheader-item-height, auto);
133
- padding: var(--aui-appheader-item-padding-y, 5px) var(--aui-appheader-item-padding-x, 10px);
134
-
135
- &:hover,
136
- &:focus {
137
- #aui-nav.item-style(hover);
138
- }
139
-
140
- #aui.focus(#aui.with-focus-ring(@inset: true));
141
-
142
- &:active,
143
- &.active {
144
- #aui-nav.item-style(active);
145
- }
146
-
147
- &.selected {
148
- #aui-nav.item-style(selected);
149
- }
150
- }
111
+ // Target the links in the app header.
112
+ // We need to use the direct child combinator to avoid applying styles to
113
+ // dropdowns or other layers nested in the header.
114
+ // We also avoid styling buttons, which might be placed inside nav lists for some reason.
115
+ .aui-header-primary > .aui-nav > li > a:not(.aui-button),
116
+ .aui-header-secondary > .aui-nav > li > a:not(.aui-button),
117
+ .aui-header-logo > a {
118
+ & {
119
+ display: flex;
120
+ align-items: center;
121
+ border-radius: var(--aui-appheader-item-border-radius);
122
+ box-sizing: border-box;
123
+ height: var(--aui-appheader-item-height, auto);
124
+ padding: var(--aui-appheader-item-padding-y, 5px) var(--aui-appheader-item-padding-x, 10px);
125
+ background-color: var(--aui-appheader-item-bg-color, transparent);
126
+ color: var(--aui-appheader-text-color, var(--aui-body-text));
127
+ text-decoration: none;
151
128
  }
152
- }
153
129
 
130
+ &:hover,
131
+ &:focus {
132
+ background-color: var(--aui-appheader-item-focus-bg-color);
133
+ color: var(--aui-appheader-item-focus-text-color, inherit);
134
+ }
135
+
136
+ #aui.focus(#aui.with-focus-ring(@inset: true));
137
+
138
+ &:active,
139
+ &.active {
140
+ background-color: var(--aui-appheader-item-active-bg-color);
141
+ color: var(--aui-appheader-item-active-text-color);
142
+ }
143
+ }
154
144
 
155
145
  // Special-case padding to separate non-nav items from nav items.
156
146
  .aui-header-primary > .aui-nav > li > .aui-button,
@@ -161,5 +151,13 @@ aui-header,
161
151
  .aui-header-secondary > .aui-nav > li > .aui-quicksearch {
162
152
  margin-right: @section-gap / 2;
163
153
  }
154
+
155
+ .aui-header-logo {
156
+ font-size: @aui-font-size-xxlarge;
157
+ }
158
+
159
+ .aui-header-logo .aui-header-logo-text {
160
+ font-size: @aui-font-size-medium;
161
+ }
164
162
  }
165
163
  }
@@ -17,6 +17,11 @@
17
17
  outline: none;
18
18
  border-width: @outline-width;
19
19
  border-color: @color;
20
+
21
+ &:focus-visible {
22
+ // Undoing the implementation in .with-focus-ring() mixin
23
+ box-shadow: unset;
24
+ }
20
25
  }
21
26
 
22
27
  // Add a focus style to the element