@atlassian/aui 9.3.21 → 9.3.23

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.
Files changed (272) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +7 -9
  3. package/dist/aui/aui-css-deprecations.js +1 -1
  4. package/dist/aui/aui-css-deprecations.js.map +1 -1
  5. package/dist/aui/aui-prototyping-browserfocus.css +1 -353
  6. package/dist/aui/aui-prototyping-darkmode.css +1 -262
  7. package/dist/aui/aui-prototyping.css +10 -10
  8. package/dist/aui/aui-prototyping.js +7 -7
  9. package/dist/aui/aui-prototyping.js.map +1 -1
  10. package/dist/aui/aui-prototyping.nodeps.css +10 -10
  11. package/dist/aui/aui-prototyping.nodeps.js +9 -9
  12. package/dist/aui/aui-prototyping.nodeps.js.map +1 -1
  13. package/entry/aui.batch.components.js +21 -21
  14. package/entry/aui.batch.page.js +3 -3
  15. package/entry/aui.batch.patterns.js +20 -20
  16. package/entry/aui.batch.prototyping.js +3 -11
  17. package/entry/aui.component.nav.js +1 -1
  18. package/entry/aui.component.progressbar.js +4 -1
  19. package/entry/aui.side-effects.js +2 -2
  20. package/entry/behaviours/aui.behaviour.format.js +1 -1
  21. package/entry/behaviours/aui.behaviour.i18n.js +1 -1
  22. package/entry/behaviours/aui.behaviour.keyboard-shortcuts.js +1 -1
  23. package/entry/behaviours/aui.behaviour.progressive-data-set.js +1 -1
  24. package/entry/behaviours/aui.behaviour.version.js +1 -1
  25. package/entry/deprecated/aui.component.inline-dialog1.js +1 -1
  26. package/package.json +3 -7
  27. package/src/js/aui/alphanum.js +1 -1
  28. package/src/js/aui/banner.js +2 -2
  29. package/src/js/aui/blanket.js +7 -11
  30. package/src/js/aui/button.js +5 -5
  31. package/src/js/aui/checkbox-multiselect.js +79 -76
  32. package/src/js/aui/clone.js +1 -1
  33. package/src/js/aui/close-button.js +2 -6
  34. package/src/js/aui/contain-dropdown.js +5 -5
  35. package/src/js/aui/contains.js +1 -1
  36. package/src/js/aui/cookie.js +12 -16
  37. package/src/js/aui/date-picker.js +84 -69
  38. package/src/js/aui/debounce.js +5 -8
  39. package/src/js/aui/dialog.js +206 -172
  40. package/src/js/aui/dialog2.js +9 -8
  41. package/src/js/aui/dropdown2.js +211 -181
  42. package/src/js/aui/escape-html.js +2 -2
  43. package/src/js/aui/escape.js +1 -1
  44. package/src/js/aui/event.js +4 -8
  45. package/src/js/aui/expander.js +9 -7
  46. package/src/js/aui/flag.js +15 -17
  47. package/src/js/aui/focus-manager.js +19 -18
  48. package/src/js/aui/form-notification.js +14 -13
  49. package/src/js/aui/form-validation/basic-validators.js +39 -30
  50. package/src/js/aui/form-validation/validator-register.js +9 -5
  51. package/src/js/aui/form-validation.js +17 -14
  52. package/src/js/aui/format.js +9 -6
  53. package/src/js/aui/forms/create-forms-component-body.js +6 -9
  54. package/src/js/aui/forms/custom-checkbox.js +2 -6
  55. package/src/js/aui/forms/custom-radio.js +2 -6
  56. package/src/js/aui/forms.js +4 -8
  57. package/src/js/aui/header-async.js +1 -1
  58. package/src/js/aui/header.js +2 -2
  59. package/src/js/aui/i18n.js +2 -5
  60. package/src/js/aui/index-of.js +1 -1
  61. package/src/js/aui/inline-dialog.js +171 -117
  62. package/src/js/aui/inline-dialog2.js +60 -50
  63. package/src/js/aui/internal/add-id.js +1 -1
  64. package/src/js/aui/internal/alignment.js +57 -49
  65. package/src/js/aui/internal/amdify.js +0 -1
  66. package/src/js/aui/internal/animation.js +2 -5
  67. package/src/js/aui/internal/attributes.js +2 -3
  68. package/src/js/aui/internal/browser.js +5 -6
  69. package/src/js/aui/internal/constants.js +1 -3
  70. package/src/js/aui/internal/deduplicateIDs.js +8 -7
  71. package/src/js/aui/internal/deprecation/deprecated-adg2-icons.js +132 -132
  72. package/src/js/aui/internal/deprecation.js +53 -31
  73. package/src/js/aui/internal/detect-children-change.js +3 -2
  74. package/src/js/aui/internal/elements.js +2 -5
  75. package/src/js/aui/internal/enforcer.js +11 -13
  76. package/src/js/aui/internal/globalize.js +3 -3
  77. package/src/js/aui/internal/has-touch.js +1 -2
  78. package/src/js/aui/internal/header/create-header.js +54 -28
  79. package/src/js/aui/internal/i18n/aui.js +8 -5
  80. package/src/js/aui/internal/i18n/aui_af.js +31 -31
  81. package/src/js/aui/internal/i18n/aui_ar.js +31 -31
  82. package/src/js/aui/internal/i18n/aui_ar_DZ.js +31 -31
  83. package/src/js/aui/internal/i18n/aui_az.js +31 -31
  84. package/src/js/aui/internal/i18n/aui_bg.js +31 -31
  85. package/src/js/aui/internal/i18n/aui_bs.js +31 -31
  86. package/src/js/aui/internal/i18n/aui_ca.js +31 -31
  87. package/src/js/aui/internal/i18n/aui_cs.js +31 -31
  88. package/src/js/aui/internal/i18n/aui_da.js +31 -31
  89. package/src/js/aui/internal/i18n/aui_de.js +31 -31
  90. package/src/js/aui/internal/i18n/aui_el.js +31 -31
  91. package/src/js/aui/internal/i18n/aui_en_AU.js +31 -31
  92. package/src/js/aui/internal/i18n/aui_en_GB.js +31 -31
  93. package/src/js/aui/internal/i18n/aui_en_NZ.js +31 -31
  94. package/src/js/aui/internal/i18n/aui_eo.js +31 -31
  95. package/src/js/aui/internal/i18n/aui_es.js +31 -31
  96. package/src/js/aui/internal/i18n/aui_et.js +31 -31
  97. package/src/js/aui/internal/i18n/aui_eu.js +31 -31
  98. package/src/js/aui/internal/i18n/aui_fa.js +31 -31
  99. package/src/js/aui/internal/i18n/aui_fi.js +31 -31
  100. package/src/js/aui/internal/i18n/aui_fo.js +31 -31
  101. package/src/js/aui/internal/i18n/aui_fr.js +31 -31
  102. package/src/js/aui/internal/i18n/aui_fr_CH.js +31 -31
  103. package/src/js/aui/internal/i18n/aui_gl.js +31 -31
  104. package/src/js/aui/internal/i18n/aui_he.js +31 -31
  105. package/src/js/aui/internal/i18n/aui_hr.js +31 -31
  106. package/src/js/aui/internal/i18n/aui_hu.js +31 -31
  107. package/src/js/aui/internal/i18n/aui_hy.js +31 -31
  108. package/src/js/aui/internal/i18n/aui_id.js +31 -31
  109. package/src/js/aui/internal/i18n/aui_is.js +31 -31
  110. package/src/js/aui/internal/i18n/aui_it.js +31 -31
  111. package/src/js/aui/internal/i18n/aui_ja.js +31 -31
  112. package/src/js/aui/internal/i18n/aui_ko.js +31 -31
  113. package/src/js/aui/internal/i18n/aui_kz.js +31 -31
  114. package/src/js/aui/internal/i18n/aui_lt.js +31 -31
  115. package/src/js/aui/internal/i18n/aui_lv.js +31 -31
  116. package/src/js/aui/internal/i18n/aui_ml.js +31 -31
  117. package/src/js/aui/internal/i18n/aui_ms.js +31 -31
  118. package/src/js/aui/internal/i18n/aui_nl.js +31 -31
  119. package/src/js/aui/internal/i18n/aui_no.js +31 -31
  120. package/src/js/aui/internal/i18n/aui_pl.js +31 -31
  121. package/src/js/aui/internal/i18n/aui_pt.js +31 -31
  122. package/src/js/aui/internal/i18n/aui_pt_BR.js +31 -31
  123. package/src/js/aui/internal/i18n/aui_rm.js +31 -31
  124. package/src/js/aui/internal/i18n/aui_ro.js +31 -31
  125. package/src/js/aui/internal/i18n/aui_ru.js +31 -31
  126. package/src/js/aui/internal/i18n/aui_sk.js +31 -31
  127. package/src/js/aui/internal/i18n/aui_sl.js +31 -31
  128. package/src/js/aui/internal/i18n/aui_sq.js +31 -31
  129. package/src/js/aui/internal/i18n/aui_sr.js +31 -31
  130. package/src/js/aui/internal/i18n/aui_sr_SR.js +31 -31
  131. package/src/js/aui/internal/i18n/aui_sv.js +31 -31
  132. package/src/js/aui/internal/i18n/aui_ta.js +31 -31
  133. package/src/js/aui/internal/i18n/aui_th.js +31 -31
  134. package/src/js/aui/internal/i18n/aui_tj.js +31 -31
  135. package/src/js/aui/internal/i18n/aui_tr.js +31 -31
  136. package/src/js/aui/internal/i18n/aui_uk.js +31 -31
  137. package/src/js/aui/internal/i18n/aui_vi.js +31 -31
  138. package/src/js/aui/internal/i18n/aui_zh_CN.js +31 -31
  139. package/src/js/aui/internal/i18n/aui_zh_HK.js +31 -31
  140. package/src/js/aui/internal/i18n/aui_zh_TW.js +31 -31
  141. package/src/js/aui/internal/log.js +2 -6
  142. package/src/js/aui/internal/mediaQuery.js +2 -3
  143. package/src/js/aui/internal/select/option.js +3 -3
  144. package/src/js/aui/internal/select/suggestion-model.js +1 -1
  145. package/src/js/aui/internal/select/suggestions-model.js +4 -5
  146. package/src/js/aui/internal/select/suggestions-view.js +17 -12
  147. package/src/js/aui/internal/state.js +2 -3
  148. package/src/js/aui/is-clipped.js +2 -2
  149. package/src/js/aui/key-code.js +1 -1
  150. package/src/js/aui/label.js +6 -6
  151. package/src/js/aui/layer.js +100 -98
  152. package/src/js/aui/messages.js +51 -38
  153. package/src/js/aui/navigation.js +7 -9
  154. package/src/js/aui/on-text-resize.js +7 -5
  155. package/src/js/aui/params.js +11 -8
  156. package/src/js/aui/polyfills/custom-event.js +7 -7
  157. package/src/js/aui/polyfills/placeholder.js +4 -4
  158. package/src/js/aui/populate-parameters.js +4 -4
  159. package/src/js/aui/progress-indicator.js +35 -27
  160. package/src/js/aui/progressive-data-set.js +13 -8
  161. package/src/js/aui/query-input.js +1 -1
  162. package/src/js/aui/restful-table/class-names.js +1 -1
  163. package/src/js/aui/restful-table/data-keys.js +1 -1
  164. package/src/js/aui/restful-table/edit-row.js +63 -63
  165. package/src/js/aui/restful-table/entry-model.js +6 -13
  166. package/src/js/aui/restful-table/event-handlers.js +4 -8
  167. package/src/js/aui/restful-table/event-names.js +1 -1
  168. package/src/js/aui/restful-table/row.js +41 -23
  169. package/src/js/aui/restful-table.js +101 -72
  170. package/src/js/aui/result-set.js +5 -5
  171. package/src/js/aui/results-list.js +3 -3
  172. package/src/js/aui/select.js +65 -49
  173. package/src/js/aui/select2.js +14 -6
  174. package/src/js/aui/sidebar.js +81 -51
  175. package/src/js/aui/spin.js +61 -49
  176. package/src/js/aui/spinner.js +11 -12
  177. package/src/js/aui/tables-sortable.js +21 -10
  178. package/src/js/aui/tabs.js +108 -77
  179. package/src/js/aui/to-init.js +1 -1
  180. package/src/js/aui/toggle.js +55 -43
  181. package/src/js/aui/tooltip.js +32 -31
  182. package/src/js/aui/trigger.js +20 -18
  183. package/src/js/aui/truncating-progressive-data-set.js +1 -1
  184. package/src/js/aui/unbind-text-resize.js +1 -1
  185. package/src/js/aui/unique-id.js +1 -1
  186. package/src/js/aui/when-i-type.js +66 -39
  187. package/src/js/aui-css-deprecations.js +50 -50
  188. package/src/js/jquery/jquery.hotkeys.js +124 -49
  189. package/src/js/jquery/jquery.moveto.js +18 -12
  190. package/src/less/adg-fancy-file-input.less +2 -3
  191. package/src/less/adg-header-quicksearch.less +4 -1
  192. package/src/less/adg-iconfont.less +242 -242
  193. package/src/less/adgs-icons.less +262 -262
  194. package/src/less/aui-appheader.less +10 -6
  195. package/src/less/aui-buttons.less +6 -5
  196. package/src/less/aui-date-picker.less +9 -6
  197. package/src/less/aui-experimental-expander.less +8 -8
  198. package/src/less/aui-experimental-labels.less +4 -3
  199. package/src/less/aui-experimental-progress-indicator.less +10 -4
  200. package/src/less/aui-experimental-progress-tracker.less +9 -6
  201. package/src/less/aui-experimental-restfultable.less +11 -3
  202. package/src/less/aui-experimental-tables-sortable.less +5 -3
  203. package/src/less/aui-experimental-tooltip.less +1 -1
  204. package/src/less/aui-link.less +0 -1
  205. package/src/less/aui-lozenge.less +6 -3
  206. package/src/less/aui-navigation.less +13 -13
  207. package/src/less/aui-page-layout.less +3 -4
  208. package/src/less/aui-page-typography.less +8 -3
  209. package/src/less/aui-reset.less +22 -6
  210. package/src/less/aui-select2.less +11 -8
  211. package/src/less/aui-sidebar-badges.less +1 -2
  212. package/src/less/aui-sidebar-config.less +7 -2
  213. package/src/less/aui-sidebar-grouping.less +16 -6
  214. package/src/less/aui-sidebar-navigation.less +7 -5
  215. package/src/less/aui-sidebar-skeleton.less +4 -3
  216. package/src/less/aui-skip-link.less +2 -1
  217. package/src/less/aui-spinner.less +2 -2
  218. package/src/less/aui-toggle.less +2 -2
  219. package/src/less/aui-toolbar2.less +1 -1
  220. package/src/less/checkbox-multiselect.less +13 -13
  221. package/src/less/dialog.less +3 -3
  222. package/src/less/dialog2.less +12 -11
  223. package/src/less/dropdown2-temp.css +4 -4
  224. package/src/less/dropdown2.less +3 -3
  225. package/src/less/form-notification.less +10 -6
  226. package/src/less/forms-current.less +6 -5
  227. package/src/less/forms-legacy.less +4 -2
  228. package/src/less/forms-radios-and-checkboxes.less +9 -11
  229. package/src/less/forms.less +2 -4
  230. package/src/less/iconfont-mixin.less +7 -4
  231. package/src/less/imports/aui-theme/adg/adg-colors.less +40 -40
  232. package/src/less/imports/aui-theme/adg/adg-neutral-dark.less +20 -20
  233. package/src/less/imports/aui-theme/adg/adg-neutral-light.less +20 -20
  234. package/src/less/imports/aui-theme/components/buttons.less +5 -1
  235. package/src/less/imports/aui-theme/components/dropdown.less +3 -1
  236. package/src/less/imports/aui-theme/components/form-notification.less +2 -1
  237. package/src/less/imports/aui-theme/components/forms.less +16 -1
  238. package/src/less/imports/aui-theme/components/inline-dialog2.less +1 -1
  239. package/src/less/imports/aui-theme/components/navigation.less +3 -3
  240. package/src/less/imports/aui-theme/components/progress-tracker.less +6 -2
  241. package/src/less/imports/aui-theme/components/tables.less +3 -2
  242. package/src/less/imports/aui-theme/components/toggle.less +8 -3
  243. package/src/less/imports/aui-theme/core/colors.less +12 -4
  244. package/src/less/imports/aui-theme/core/icons.less +22 -22
  245. package/src/less/imports/aui-theme/core/text.less +6 -3
  246. package/src/less/imports/mixins/dropdown2-trigger-chevron-icon.less +0 -1
  247. package/src/less/imports/mixins/focus.less +12 -4
  248. package/src/less/imports/mixins/media-queries.less +2 -2
  249. package/src/less/imports/mixins/shadows.less +3 -1
  250. package/src/less/imports/mixins/tab-indicator.less +2 -2
  251. package/src/less/imports/mixins.less +11 -4
  252. package/src/less/inline-dialog.less +21 -19
  253. package/src/less/layer.less +0 -2
  254. package/src/less/messages.less +2 -1
  255. package/src/less/single-select.less +14 -9
  256. package/src/less/tables.less +3 -2
  257. package/src/less/tabs.less +4 -3
  258. package/entry/token-themes-generated/npm/aui-prototyping-design-tokens-base-themes.css +0 -797
  259. package/entry/token-themes-generated/npm/aui-prototyping-design-tokens-base-themes.js +0 -26
  260. package/entry/token-themes-generated/npm/aui-prototyping-design-tokens-theme-import-map.js +0 -51
  261. package/entry/token-themes-generated/npm/themes/dark-future.js +0 -7
  262. package/entry/token-themes-generated/npm/themes/dark-new-input-border.js +0 -7
  263. package/entry/token-themes-generated/npm/themes/dark.js +0 -395
  264. package/entry/token-themes-generated/npm/themes/legacy-dark.js +0 -395
  265. package/entry/token-themes-generated/npm/themes/legacy-light.js +0 -395
  266. package/entry/token-themes-generated/npm/themes/light-future.js +0 -7
  267. package/entry/token-themes-generated/npm/themes/light-new-input-border.js +0 -7
  268. package/entry/token-themes-generated/npm/themes/light.js +0 -395
  269. package/entry/token-themes-generated/npm/themes/shape.js +0 -15
  270. package/entry/token-themes-generated/npm/themes/spacing.js +0 -27
  271. package/entry/token-themes-generated/npm/themes/typography-adg3.js +0 -50
  272. package/entry/token-themes-generated/npm/themes/typography-minor3.js +0 -41
@@ -15,14 +15,14 @@ const AUI_TOOLTIP_TIMEOUT = 300;
15
15
  * @type {{n: string, ne: string, e: string, se: string, s: string, sw: string, w: string, nw: string}}
16
16
  */
17
17
  const GRAVITY_MAP = {
18
- 'n': 'bottom',
19
- 'ne': 'bottom-end',
20
- 'e': 'left',
21
- 'se': 'top-end',
22
- 's': 'top',
23
- 'sw': 'top-start',
24
- 'w': 'right',
25
- 'nw': 'bottom-start',
18
+ n: 'bottom',
19
+ ne: 'bottom-end',
20
+ e: 'left',
21
+ se: 'top-end',
22
+ s: 'top',
23
+ sw: 'top-start',
24
+ w: 'right',
25
+ nw: 'bottom-start',
26
26
  };
27
27
 
28
28
  // This key is used to differentiate events related to this particular plugin.
@@ -36,29 +36,29 @@ const defaultOptions = {
36
36
  suppress: () => false,
37
37
  aria: true,
38
38
  sanitize: true,
39
- maxWidth: 200
40
- }
39
+ maxWidth: 200,
40
+ };
41
41
 
42
42
  let $sharedTip;
43
43
 
44
44
  const getTipNode = () => {
45
45
  return $sharedTip && $sharedTip.get(0);
46
- }
46
+ };
47
47
 
48
48
  const toggleTooltipVisibility = (shouldBeHidden = false) => {
49
49
  const tipNode = getTipNode();
50
50
  if (tipNode) {
51
- tipNode.classList.toggle('assistive', shouldBeHidden)
51
+ tipNode.classList.toggle('assistive', shouldBeHidden);
52
52
  }
53
- }
53
+ };
54
54
 
55
55
  class Tooltip {
56
56
  constructor(triggerElement, options) {
57
57
  this.triggerElement = triggerElement;
58
58
  this.$triggerElement = $(this.triggerElement);
59
59
  this.options = { ...defaultOptions, ...options };
60
- this.enabled = this.options.enabled
61
- this.moveTitleToTooltip()
60
+ this.enabled = this.options.enabled;
61
+ this.moveTitleToTooltip();
62
62
  }
63
63
 
64
64
  destroy() {
@@ -99,8 +99,9 @@ class Tooltip {
99
99
  buildTip(title) {
100
100
  const options = this.options;
101
101
  if ($sharedTip === undefined) {
102
- $sharedTip =
103
- $(`<div id="${AUI_TOOLTIP_ID}" class="${AUI_TOOLTIP_CLASS_NAME} assistive" role="tooltip"><p class="aui-tooltip-content"></p></div>`)
102
+ $sharedTip = $(
103
+ `<div id="${AUI_TOOLTIP_ID}" class="${AUI_TOOLTIP_CLASS_NAME} assistive" role="tooltip"><p class="aui-tooltip-content"></p></div>`
104
+ );
104
105
 
105
106
  $(document.body).append($sharedTip);
106
107
  }
@@ -117,7 +118,7 @@ class Tooltip {
117
118
  }
118
119
 
119
120
  if (options.maxWidth) {
120
- tooltipContentElement.css("max-width", options.maxWidth + "px");
121
+ tooltipContentElement.css('max-width', options.maxWidth + 'px');
121
122
  }
122
123
 
123
124
  return $sharedTip;
@@ -126,14 +127,15 @@ class Tooltip {
126
127
  getTipTitle() {
127
128
  const options = this.options;
128
129
 
129
- let title = typeof options.title === 'function' ?
130
- options.title :
131
- typeof options.title === 'string' ?
132
- () => options.title :
133
- () => this.originalTitle || '';
130
+ let title =
131
+ typeof options.title === 'function'
132
+ ? options.title
133
+ : typeof options.title === 'string'
134
+ ? () => options.title
135
+ : () => this.originalTitle || '';
134
136
 
135
137
  let actualTitle = title.call(this.triggerElement);
136
- return (!actualTitle || !actualTitle.trim().length) ? undefined : actualTitle;
138
+ return !actualTitle || !actualTitle.trim().length ? undefined : actualTitle;
137
139
  }
138
140
 
139
141
  show() {
@@ -171,7 +173,6 @@ class Tooltip {
171
173
 
172
174
  $(window).on(`scroll.${pluginKey}`, () => this.hide());
173
175
  }, AUI_TOOLTIP_TIMEOUT);
174
-
175
176
  }
176
177
 
177
178
  hide() {
@@ -217,9 +218,9 @@ const getTooltipInstance = (domNode, options) => {
217
218
  }
218
219
  }
219
220
  return tooltip;
220
- }
221
+ };
221
222
 
222
- const namespacify = events => events.map(event => `${event}.${pluginKey}`).join(' ');
223
+ const namespacify = (events) => events.map((event) => `${event}.${pluginKey}`).join(' ');
223
224
 
224
225
  const activationEvents = namespacify(['mouseenter', 'focus']);
225
226
  const deactivationEvents = namespacify(['click', 'mouseleave', 'blur']);
@@ -240,7 +241,7 @@ $.fn.tooltip = function (arg) {
240
241
  const commandName = arg;
241
242
 
242
243
  if (typeof tooltip[commandName] !== 'function') {
243
- throw new Error(`Method ${commandName} does not exist on tooltip.`)
244
+ throw new Error(`Method ${commandName} does not exist on tooltip.`);
244
245
  }
245
246
 
246
247
  tooltip[commandName]();
@@ -248,17 +249,17 @@ $.fn.tooltip = function (arg) {
248
249
  return $collection;
249
250
  }
250
251
 
251
- const options = arg || {}
252
+ const options = arg || {};
252
253
 
253
254
  const show = function () {
254
255
  const tooltip = getTooltipInstance(this, options);
255
256
  tooltip.show();
256
- }
257
+ };
257
258
 
258
259
  const hide = function () {
259
260
  const tooltip = getTooltipInstance(this, options);
260
261
  tooltip.hide();
261
- }
262
+ };
262
263
 
263
264
  const selector = options.live;
264
265
  if (selector !== undefined) {
@@ -3,22 +3,22 @@ import keyCode from './key-code';
3
3
  import amdify from './internal/amdify';
4
4
  import skate from './internal/skate';
5
5
  import state from './internal/state';
6
- import { warn } from './internal/log'
6
+ import { warn } from './internal/log';
7
7
 
8
- export function getTrigger (element) {
8
+ export function getTrigger(element) {
9
9
  return state(element).get('last-trigger') || findControllers(element)[0];
10
10
  }
11
11
 
12
- export function setTrigger (element, trigger) {
12
+ export function setTrigger(element, trigger) {
13
13
  var validTrigger = trigger && trigger.nodeType && trigger.nodeType === 1;
14
14
  return state(element).set('last-trigger', validTrigger ? trigger : false);
15
15
  }
16
16
 
17
- export function hasTrigger (element) {
17
+ export function hasTrigger(element) {
18
18
  return !!getTrigger(element);
19
19
  }
20
20
 
21
- export function doIfTrigger (element, callback) {
21
+ export function doIfTrigger(element, callback) {
22
22
  var trigger = getTrigger(element);
23
23
 
24
24
  if (trigger) {
@@ -26,7 +26,7 @@ export function doIfTrigger (element, callback) {
26
26
  }
27
27
  }
28
28
 
29
- export function forEachTrigger (element, callback) {
29
+ export function forEachTrigger(element, callback) {
30
30
  return Array.prototype.forEach.call(findControllers(element), callback);
31
31
  }
32
32
 
@@ -41,7 +41,7 @@ function findControllers(element) {
41
41
 
42
42
  let controllers = [];
43
43
  let someFramesAreCrossOrigin = false;
44
- for (let i = 0 ; i < frames.length; i++) {
44
+ for (let i = 0; i < frames.length; i++) {
45
45
  try {
46
46
  let nodeList = frames[i].document.querySelectorAll(selector);
47
47
  controllers = controllers.concat(Array.prototype.slice.apply(nodeList));
@@ -51,15 +51,17 @@ function findControllers(element) {
51
51
  }
52
52
  }
53
53
  const currentDocumentControllers = document.querySelectorAll(selector);
54
- const allControllers = Array.prototype.slice.apply(currentDocumentControllers).concat(controllers);
54
+ const allControllers = Array.prototype.slice
55
+ .apply(currentDocumentControllers)
56
+ .concat(controllers);
55
57
  if (allControllers.length === 0 && someFramesAreCrossOrigin === true) {
56
58
  warn(
57
59
  [
58
60
  `No triggers found for element (${element.id}) in iframes from the same origin.`,
59
61
  'However some iframes in this document are cross-origin.',
60
- 'The trigger-element relations crossing the origin boundary are not supported.'
62
+ 'The trigger-element relations crossing the origin boundary are not supported.',
61
63
  ].join(' ')
62
- )
64
+ );
63
65
  }
64
66
  return allControllers;
65
67
  }
@@ -68,7 +70,7 @@ function findControlled(trigger) {
68
70
  return document.getElementById(trigger.getAttribute('aria-controls'));
69
71
  }
70
72
 
71
- function isEnabled (element) {
73
+ function isEnabled(element) {
72
74
  return element.getAttribute('aria-disabled') !== 'true';
73
75
  }
74
76
 
@@ -94,7 +96,7 @@ function msg(e, type) {
94
96
  target,
95
97
  currentTarget,
96
98
  relatedTarget,
97
- preventDefault: () => e.preventDefault()
99
+ preventDefault: () => e.preventDefault(),
98
100
  };
99
101
  }
100
102
 
@@ -133,16 +135,16 @@ const events = {
133
135
  triggerMessage(trigger, e);
134
136
  },
135
137
  blur(trigger, e) {
136
- if (focusingToControlledElement(trigger, e)){
138
+ if (focusingToControlledElement(trigger, e)) {
137
139
  return;
138
140
  }
139
141
  triggerMessage(trigger, e);
140
- }
142
+ },
141
143
  };
142
144
 
143
- Object.keys(events).forEach(function(name) {
145
+ Object.keys(events).forEach(function (name) {
144
146
  const handler = events[name];
145
- $(document).on(`${name}.aui-trigger`, '[data-aui-trigger]', function(e) {
147
+ $(document).on(`${name}.aui-trigger`, '[data-aui-trigger]', function (e) {
146
148
  handler(e.currentTarget, msg(e, name));
147
149
  });
148
150
  });
@@ -158,8 +160,8 @@ skate('data-aui-trigger', {
158
160
  },
159
161
  isEnabled: function () {
160
162
  return isEnabled(this);
161
- }
162
- }
163
+ },
164
+ },
163
165
  });
164
166
 
165
167
  amdify('aui/trigger');
@@ -54,7 +54,7 @@ var TruncatingProgressiveDataSet = ProgressiveDataSet.extend({
54
54
  }
55
55
 
56
56
  return null;
57
- }
57
+ },
58
58
  });
59
59
 
60
60
  globalize('TruncatingProgressiveDataSet', TruncatingProgressiveDataSet);
@@ -1,7 +1,7 @@
1
1
  import globalize from './internal/globalize';
2
2
  import onTextResize from './on-text-resize';
3
3
 
4
- function unbindTextResize (f) {
4
+ function unbindTextResize(f) {
5
5
  for (var i = 0, ii = onTextResize['on-text-resize'].length; i < ii; i++) {
6
6
  if (onTextResize['on-text-resize'][i] === f) {
7
7
  return onTextResize['on-text-resize'].splice(i, 1);
@@ -13,7 +13,7 @@ var uniqueIDcounter = 0;
13
13
  *
14
14
  * @returns {String}
15
15
  */
16
- function generateUniqueId (prefix) {
16
+ function generateUniqueId(prefix) {
17
17
  uniqueID = uniqueIDcounter++ + '';
18
18
  uniqueIDstring = prefix ? prefix + uniqueID : 'aui-uid-' + uniqueID;
19
19
 
@@ -12,7 +12,8 @@ const EMPTY_SELECTOR = false;
12
12
 
13
13
  var isMac = navigator.platform.indexOf('Mac') !== -1;
14
14
  var isSafari = navigator.userAgent.indexOf('Safari') !== -1;
15
- var multiCharRegex = /^(backspace|tab|r(ight|eturn)|s(hift|pace|croll)|c(trl|apslock)|alt|pa(use|ge(up|down))|e(sc|nd)|home|left|up|d(el|own)|insert|f\d\d?|numlock|meta)/i;
15
+ var multiCharRegex =
16
+ /^(backspace|tab|r(ight|eturn)|s(hift|pace|croll)|c(trl|apslock)|alt|pa(use|ge(up|down))|e(sc|nd)|home|left|up|d(el|own)|insert|f\d\d?|numlock|meta)/i;
16
17
 
17
18
  /**
18
19
  * Trigger native click event.
@@ -26,12 +27,27 @@ const triggerClickEvent = ($el) => {
26
27
  const bubbles = true;
27
28
  const cancelable = true;
28
29
  const event = document.createEvent('MouseEvent');
29
- event.initMouseEvent('click', bubbles, cancelable, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
30
+ event.initMouseEvent(
31
+ 'click',
32
+ bubbles,
33
+ cancelable,
34
+ window,
35
+ 0,
36
+ 0,
37
+ 0,
38
+ 0,
39
+ 0,
40
+ false,
41
+ false,
42
+ false,
43
+ false,
44
+ 0,
45
+ null
46
+ );
30
47
  element.dispatchEvent(event);
31
48
  }
32
49
  };
33
50
 
34
-
35
51
  /**
36
52
  * Keyboard commands with syntactic sugar.
37
53
  *
@@ -43,7 +59,7 @@ const triggerClickEvent = ($el) => {
43
59
  *
44
60
  * @param keys - Key combinations, modifier keys are "+" deliminated. e.g "ctrl+b"
45
61
  */
46
- function whenIType (keys) {
62
+ function whenIType(keys) {
47
63
  var boundKeyCombos = [];
48
64
  var executor = $.Callbacks();
49
65
 
@@ -81,9 +97,8 @@ function whenIType (keys) {
81
97
  // bind a single key combo to this handler
82
98
  // A string like "abc 123" means (a then b then c) OR (1 then 2 then 3). abc is one key combo, 123 is another.
83
99
  function bindKeyCombo(keyCombo) {
84
- var keysArr = keyCombo instanceof Array ?
85
- keyCombo :
86
- keyComboArrayFromString(keyCombo.toString());
100
+ var keysArr =
101
+ keyCombo instanceof Array ? keyCombo : keyComboArrayFromString(keyCombo.toString());
87
102
  var eventType = hasUnprintables(keysArr) ? 'keydown' : 'keypress';
88
103
 
89
104
  boundKeyCombos.push(keysArr);
@@ -106,12 +121,10 @@ function whenIType (keys) {
106
121
  if (modifierMatch) {
107
122
  currModifiers += modifierMatch[0];
108
123
  keyString = keyString.substring(modifierMatch[0].length);
109
-
110
124
  } else if (multiCharMatch) {
111
125
  keysArr.push(currModifiers + multiCharMatch[0]);
112
126
  keyString = keyString.substring(multiCharMatch[0].length);
113
127
  currModifiers = '';
114
-
115
128
  } else {
116
129
  keysArr.push(currModifiers + keyString[0]);
117
130
  keyString = keyString.substring(1);
@@ -127,22 +140,35 @@ function whenIType (keys) {
127
140
  var title = elem.attr('title') || '';
128
141
  var keyCombos = boundKeyCombos.slice();
129
142
  var existingCombos = elem.data('boundKeyCombos') || [];
130
- var kbShortcutAppended = elem.data('kbShortcutAppended') || ''
131
- var kbShortcutAppendedScreenReader = elem.data('kbShortcutAppendedScreenReader') || ''
143
+ var kbShortcutAppended = elem.data('kbShortcutAppended') || '';
144
+ var kbShortcutAppendedScreenReader = elem.data('kbShortcutAppendedScreenReader') || '';
132
145
  var ariaLabel = elem.attr('aria-label');
133
146
  var isFirstShortcut = !kbShortcutAppended;
134
147
  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);
148
+ var originalTitle = isFirstShortcut
149
+ ? title
150
+ : title.substring(0, title.length - kbShortcutAppended.length);
151
+ var originalAriaLabel = isFirstShortcutScreenReader
152
+ ? title
153
+ : ariaLabel.substring(0, ariaLabel.length - kbShortcutAppendedScreenReader.length);
137
154
 
138
155
  while (keyCombos.length) {
139
156
  var keyCombo = keyCombos.shift();
140
- var comboAlreadyExists = existingCombos.some(function(existingCombo) {
157
+ var comboAlreadyExists = existingCombos.some(function (existingCombo) {
141
158
  return isEqual(keyCombo, existingCombo);
142
159
  });
143
160
  if (!comboAlreadyExists) {
144
- kbShortcutAppended = appendKeyComboInstructions(keyCombo.slice(), kbShortcutAppended, isFirstShortcut);
145
- kbShortcutAppendedScreenReader = appendKeyComboInstructions(keyCombo.slice(), kbShortcutAppendedScreenReader, isFirstShortcutScreenReader, { workaroundJaws: true });
161
+ kbShortcutAppended = appendKeyComboInstructions(
162
+ keyCombo.slice(),
163
+ kbShortcutAppended,
164
+ isFirstShortcut
165
+ );
166
+ kbShortcutAppendedScreenReader = appendKeyComboInstructions(
167
+ keyCombo.slice(),
168
+ kbShortcutAppendedScreenReader,
169
+ isFirstShortcutScreenReader,
170
+ { workaroundJaws: true }
171
+ );
146
172
  isFirstShortcut = false;
147
173
  isFirstShortcutScreenReader = false;
148
174
  }
@@ -150,15 +176,15 @@ function whenIType (keys) {
150
176
 
151
177
  if (isMac) {
152
178
  kbShortcutAppended = kbShortcutAppended
153
- .replace(/Meta/ig, '\u2318') //Apple cmd key
154
- .replace(/Shift/ig, '\u21E7'); //Apple Shift symbol
179
+ .replace(/Meta/gi, '\u2318') //Apple cmd key
180
+ .replace(/Shift/gi, '\u21E7'); //Apple Shift symbol
155
181
  kbShortcutAppendedScreenReader = kbShortcutAppendedScreenReader
156
- .replace(/Meta/ig, '\u2318') //Apple cmd key
157
- .replace(/Shift/ig, '\u21E7'); //Apple Shift symbol
182
+ .replace(/Meta/gi, '\u2318') //Apple cmd key
183
+ .replace(/Shift/gi, '\u21E7'); //Apple Shift symbol
158
184
  }
159
185
 
160
186
  elem.attr('title', originalTitle + kbShortcutAppended);
161
- elem.attr('aria-label', originalAriaLabel + kbShortcutAppendedScreenReader)
187
+ elem.attr('aria-label', originalAriaLabel + kbShortcutAppendedScreenReader);
162
188
  elem.data('kbShortcutAppended', kbShortcutAppended);
163
189
  elem.data('kbShortcutAppendedScreenReader', kbShortcutAppendedScreenReader);
164
190
  elem.data('boundKeyCombos', existingCombos.concat(boundKeyCombos));
@@ -190,7 +216,10 @@ function whenIType (keys) {
190
216
  }
191
217
 
192
218
  if (isFirst) {
193
- title += ' ' + openParenthesis + I18n.getText('aui.keyboard.shortcut.type.x', keyCombo.shift());
219
+ title +=
220
+ ' ' +
221
+ openParenthesis +
222
+ I18n.getText('aui.keyboard.shortcut.type.x', keyCombo.shift());
194
223
  } else {
195
224
  title = title.replace(/\)$/, '');
196
225
  title += ' ' + I18n.getText('aui.keyboard.shortcut.or.x', keyCombo.shift());
@@ -212,7 +241,7 @@ function whenIType (keys) {
212
241
  addShortcutsToTitle: addShortcutsToTitle,
213
242
  removeShortcutsFromTitle: removeShortcutsFromTitle,
214
243
  keypressHandler: keypressHandler,
215
- defaultPreventionHandler: defaultPreventionHandler
244
+ defaultPreventionHandler: defaultPreventionHandler,
216
245
  });
217
246
  }
218
247
 
@@ -234,10 +263,9 @@ whenIType.makeShortcut = function (options) {
234
263
  var escToCancel = options.hasOwnProperty('escToCancel') ? options.escToCancel : true;
235
264
 
236
265
  executor.add(function () {
237
-
238
266
  const $items = $(selector);
239
267
  let $focusedElem = $items.filter('.' + focusedClass);
240
- const moveToOptions = $focusedElem.length === 0 ? undefined : {transition: true};
268
+ const moveToOptions = $focusedElem.length === 0 ? undefined : { transition: true };
241
269
 
242
270
  if (escToCancel) {
243
271
  $(document).one('keydown', function (e) {
@@ -268,7 +296,6 @@ whenIType.makeShortcut = function (options) {
268
296
  }
269
297
 
270
298
  return {
271
-
272
299
  /**
273
300
  * Scrolls to and adds <em>focused</em> class to the next item in the jQuery collection
274
301
  *
@@ -282,7 +309,6 @@ whenIType.makeShortcut = function (options) {
282
309
 
283
310
  if (wrapAround && $focusedElem.length === 0) {
284
311
  return $items.eq(0);
285
-
286
312
  } else {
287
313
  index = $.inArray($focusedElem.get(0), $items);
288
314
  if (index < $items.length - 1) {
@@ -307,7 +333,6 @@ whenIType.makeShortcut = function (options) {
307
333
  var index;
308
334
  if (wrapAround && $focusedElem.length === 0) {
309
335
  return $items.filter(':last');
310
-
311
336
  } else {
312
337
  index = $.inArray($focusedElem.get(0), $items);
313
338
  if (index > 0) {
@@ -366,7 +391,7 @@ whenIType.makeShortcut = function (options) {
366
391
 
367
392
  executor.add(function () {
368
393
  var elem = $(selector)[0];
369
- if (elem && {'a': true, 'link': true}[ elem.nodeName.toLowerCase() ]) {
394
+ if (elem && { a: true, link: true }[elem.nodeName.toLowerCase()]) {
370
395
  window.location.href = elem.href;
371
396
  }
372
397
  });
@@ -473,7 +498,7 @@ whenIType.makeShortcut = function (options) {
473
498
  removeShortcutsFromTitle(selectorsWithTitlesModified[i]);
474
499
  }
475
500
  selectorsWithTitlesModified = [];
476
- }
501
+ },
477
502
  };
478
503
  };
479
504
 
@@ -517,7 +542,7 @@ whenIType.fromJSON = function (json, switchCtrlToMetaOnMac) {
517
542
  var shortcuts = [];
518
543
 
519
544
  if (json) {
520
- $.each(json, function (i,item) {
545
+ $.each(json, function (i, item) {
521
546
  const operation = item.op;
522
547
  const param = item.param;
523
548
  let params;
@@ -525,25 +550,28 @@ whenIType.fromJSON = function (json, switchCtrlToMetaOnMac) {
525
550
  if (operation === 'execute' || operation === 'evaluate') {
526
551
  // need to turn function string into function object
527
552
  params = [new Function(param)];
528
-
529
553
  } else if (/^\[[^\]\[]*,[^\]\[]*\]$/.test(param)) {
530
554
  // pass in an array to send multiple params
531
555
  try {
532
556
  params = JSON.parse(param);
533
557
  } catch (e) {
534
- logger.error('When using a parameter array, array must be in strict JSON format: ' + param);
558
+ logger.error(
559
+ 'When using a parameter array, array must be in strict JSON format: ' +
560
+ param
561
+ );
535
562
  }
536
563
 
537
564
  if (!$.isArray(params)) {
538
- logger.error('Badly formatted shortcut parameter. String or JSON Array of parameters required: ' + param);
565
+ logger.error(
566
+ 'Badly formatted shortcut parameter. String or JSON Array of parameters required: ' +
567
+ param
568
+ );
539
569
  }
540
-
541
570
  } else {
542
571
  params = [param];
543
572
  }
544
573
 
545
574
  $.each(item.keys, function () {
546
-
547
575
  var shortcutList = this;
548
576
  if (switchCtrlToMetaOnMac && isMac) {
549
577
  shortcutList = $.map(shortcutList, function (shortcutString) {
@@ -555,7 +583,6 @@ whenIType.fromJSON = function (json, switchCtrlToMetaOnMac) {
555
583
  newShortcut[operation].apply(newShortcut, params);
556
584
  shortcuts.push(newShortcut);
557
585
  });
558
-
559
586
  });
560
587
  }
561
588
 
@@ -577,8 +604,8 @@ $(document).on('iframeAppended', function (e, iframe) {
577
604
  $.event.trigger(
578
605
  e,
579
606
  arguments, // Preserve original event data.
580
- document, // Bubble this event from the iframe's document to its parent document.
581
- true // Use the capturing phase to preserve original event.target.
607
+ document, // Bubble this event from the iframe's document to its parent document.
608
+ true // Use the capturing phase to preserve original event.target.
582
609
  );
583
610
  }
584
611
  });