@atlassian/aui 9.3.10 → 9.3.12

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.3.10",
4
+ "version": "9.3.12",
5
5
  "author": "Atlassian Pty Ltd.",
6
6
  "homepage": "https://aui.atlassian.com",
7
7
  "license": "Apache-2.0",
@@ -884,6 +884,10 @@ var stringAttributeHandlerGenerator = function(attrName) {
884
884
  };
885
885
  };
886
886
 
887
+ const convertCssClassesToArray = function (spaceDelimitedClasses = '') {
888
+ return spaceDelimitedClasses.split(' ').map(str => str.trim()).filter(x => x);
889
+ }
890
+
887
891
  const ItemLinkEl = skate('aui-item-link', {
888
892
  template: template(
889
893
  '<a role="menuitem" tabindex="-1"><content></content></a>'
@@ -909,7 +913,16 @@ const ItemLinkEl = skate('aui-item-link', {
909
913
  anchor.removeAttribute('aria-controls');
910
914
  $(anchor).removeClass('aui-dropdown2-sub-trigger');
911
915
  }
912
- }
916
+ },
917
+ 'extra-classes': function (element, change) {
918
+ const anchor = element.children[0];
919
+ if (change.oldValue) {
920
+ anchor.classList.remove(...convertCssClassesToArray(change.oldValue));
921
+ }
922
+ if (change.newValue) {
923
+ anchor.classList.add(...convertCssClassesToArray(change.newValue));
924
+ }
925
+ },
913
926
  },
914
927
  });
915
928
 
@@ -213,6 +213,10 @@ Header.prototype = {
213
213
  $navItemDropdown.addClass('aui-dropdown2-sub-menu');
214
214
  $navItemDropdown.appendTo('body');
215
215
  }
216
+ if ($navItemTrigger.get(0).hasAttribute('data-aui-extra-classes')) { // an opt-in behaviour
217
+ const extraClasses = Array.from($navItemTrigger.get(0).classList).filter(cls => !cls.startsWith('aui-'));
218
+ moreDropdownItemEl.setAttribute('extra-classes', extraClasses.join(' '));
219
+ }
216
220
  skate.init(moreDropdownItemEl);
217
221
  template.wrap(moreDropdownItemEl).textContent = $navItemTrigger.text();
218
222