@atlassian/aui 9.2.1 → 9.2.5

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.1",
4
+ "version": "9.2.5",
5
5
  "author": "Atlassian Pty Ltd.",
6
6
  "homepage": "https://aui.atlassian.com",
7
7
  "license": "Apache-2.0",
@@ -38,11 +38,11 @@
38
38
  "backbone": "1.4.0",
39
39
  "css.escape": "1.5.0",
40
40
  "fancy-file-input": "2.0.4",
41
- "jquery-ui": "1.12.1",
41
+ "jquery-ui": "1.13.0",
42
42
  "skatejs": "0.13.17",
43
43
  "skatejs-template-html": "0.0.0",
44
44
  "trim-extra-html-whitespace": "1.3.0",
45
- "underscore": "1.10.2"
45
+ "underscore": "1.13.1"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@atlassian/adg-server-iconfont": "3.1.0",
@@ -337,6 +337,11 @@ const initPolyfill = function (datePicker) {
337
337
  // shows that changing the `type` of input does not erase its value.
338
338
  // see https://codepen.io/chrisdarroch/pen/YzwgjyJ
339
339
  $field.prop('type', 'text');
340
+ // Set default value on initialization to handle all date formats.
341
+ // It is possible, because of changing type to text on the line above.
342
+ $field.val($field.attr('value'));
343
+ // Trigger change to update calendar popup value.
344
+ $field.trigger('propertychange');
340
345
 
341
346
  // demonstrate the polyfill is initialised
342
347
  $field.attr('data-aui-dp-uuid', datePickerUUID);
@@ -1,5 +1,5 @@
1
1
  import format from './format';
2
- import globalize from './internal/globalize';
2
+ import { putOnI18nIfAbsent } from './internal/globalize';
3
3
  import keys from './internal/i18n/aui';
4
4
 
5
5
  /**
@@ -7,7 +7,7 @@ import keys from './internal/i18n/aui';
7
7
  * the key is returned - this could occur in plugin mode if the I18n transform is not performed;
8
8
  * or in flatpack mode if the i18n JS file is not loaded.
9
9
  */
10
- export var I18n = {
10
+ const I18n = {
11
11
  keys: keys,
12
12
  getText: function (key, ...params) {
13
13
  if (Object.prototype.hasOwnProperty.call(this.keys, key)) {
@@ -18,10 +18,19 @@ export var I18n = {
18
18
  }
19
19
  };
20
20
 
21
+ export {
22
+ I18n,
23
+ format
24
+ }
25
+
21
26
  /**
22
27
  * Deprecated - do not use AJS.I18n.getText from global scope within AUI code. Use import { I18n } from '../i18n'
23
28
  * Also keep in mind that WRM is looking for patterns like "I18n.getText" so do not create
24
29
  * aliases for I18n or export it from here using 'default'. Webpack transforms it then to
25
30
  * 'd.default.getText' and it won't match.
26
31
  **/
27
- globalize('I18n', I18n);
32
+ // eslint-disable-next-line guard-for-in
33
+ for (const property in I18n) {
34
+ // AUI-5431 Add to global namespace, but do not override what is set by the WRM
35
+ putOnI18nIfAbsent(property, I18n[property]);
36
+ }
@@ -6,7 +6,7 @@ import globalize from './internal/globalize';
6
6
  import keyCode from './key-code';
7
7
  import cssEscape from 'css.escape';
8
8
 
9
- /* eslint quotmark:off, eqeqeq:off, strict:off, complexity:off */
9
+ /* eslint quotes:off, eqeqeq:off, strict:off, complexity:off */
10
10
 
11
11
  /**
12
12
  * Creates a new inline dialog.
@@ -1,9 +1,39 @@
1
1
  const NAMESPACE = 'AJS';
2
+ const I18N_OBJECT_NAME = 'I18n';
2
3
 
3
- export default function globalize (name, value) {
4
+ function initNamespace() {
4
5
  if (typeof window[NAMESPACE] !== 'object') {
5
6
  window[NAMESPACE] = {};
6
7
  }
8
+ }
9
+
10
+ /**
11
+ * Makes given value available globally under window[name] attribute.
12
+ * Keep in mind that this is needed for p2-plugin where chunks of AUI
13
+ * can be loaded separately.
14
+ *
15
+ * In order for global namespace to work in `aui.prototyping.js` and
16
+ * `aui.prototyping.nodeps.js` the proper exports need to be added to:
17
+ * `packages/core/entry/aui.batch.prototyping.js`
18
+ *
19
+ * @param {string} name Name of the attribute
20
+ * @param {any} value Value to expose globally
21
+ * @returns exposed value
22
+ */
23
+ export default function globalize (name, value) {
24
+ initNamespace();
7
25
 
8
26
  return window[NAMESPACE][name] = value;
9
27
  }
28
+
29
+ export function putOnI18nIfAbsent (name, value) {
30
+ initNamespace();
31
+
32
+ if (typeof window[NAMESPACE][I18N_OBJECT_NAME] !== 'object') {
33
+ window[NAMESPACE][I18N_OBJECT_NAME] = {};
34
+ }
35
+
36
+ if (typeof window[NAMESPACE][I18N_OBJECT_NAME][name] === 'undefined') {
37
+ window[NAMESPACE][I18N_OBJECT_NAME][name] = value;
38
+ }
39
+ }
@@ -214,7 +214,7 @@ function calculateResponsiveTabs(tabsContainer, index) {
214
214
  }
215
215
 
216
216
  if (!$tabsContainer.hasClass('aui-tabs-disabled')) {
217
- $dropdown.on('click', 'a', handleTabClick);
217
+ $dropdown.on('click.aui-tabs', 'a', handleTabClick);
218
218
  }
219
219
 
220
220
  /* Workaround for bug in Edge where the dom is just not being re-rendered properly
@@ -371,7 +371,7 @@ function getResponsiveTabs () {
371
371
  function initWindow () {
372
372
  const handler = debounce(responsiveResizeHandler, 200);
373
373
  handler(getResponsiveTabs());
374
- $(window).on('resize', () => handler(getResponsiveTabs()));
374
+ $(window).on('resize.aui-tabs', () => handler(getResponsiveTabs()));
375
375
  }
376
376
 
377
377
  function initTab (tab) {
@@ -392,7 +392,7 @@ function initTab (tab) {
392
392
  });
393
393
 
394
394
  // Set up click event for tabs
395
- $tabMenu.on('click', 'a', handleTabClick);
395
+ $tabMenu.on('click.aui-tabs', 'a', handleTabClick);
396
396
  $tab.data('aui-tab-events-bound', true);
397
397
 
398
398
  initPanes(tab);
@@ -136,6 +136,9 @@ $.fn.ajaxSubmit = function(options) {
136
136
  var oldSuccess = options.success || function(){};
137
137
  callbacks.push(function(data) {
138
138
  var fn = options.replaceTarget ? 'replaceWith' : 'html';
139
+ // Validate `data` through `HTML encoding` when passed `data` is passed
140
+ // to `html()`, as suggested in https://github.com/jquery-form/form/issues/464
141
+ fn == 'html' ? data = $.parseHTML($("<div>").text(data).html()) : '';
139
142
  $(options.target)[fn](data).each(oldSuccess, arguments);
140
143
  });
141
144
  }
@@ -428,7 +431,10 @@ $.fn.ajaxSubmit = function(options) {
428
431
  return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null;
429
432
  };
430
433
  var parseJSON = $.parseJSON || function(s) {
431
- return window['eval']('(' + s + ')');
434
+ // Arise an error resolvable including jquery instead of
435
+ // making a new function using unsanitized inputs
436
+ window.console.error('jquery.parseJSON is undefined');
437
+ return null;
432
438
  };
433
439
 
434
440
  var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4
@@ -234,14 +234,16 @@
234
234
  .aui-select2-container.select2-container .select2-choice:after {
235
235
  #aui.icon-pseudoelement();
236
236
  content: @aui-glyph-chevron-down;
237
- left: 100%; /* "left" + "margin-left" required because of webkit not working properly with "right" */
238
237
  height: 0;
239
238
  margin-left: -18px;
240
239
  margin-top: -2px;
241
240
  opacity: 1;
242
241
  position: absolute;
243
- top: 7px;
242
+ top: calc(50% - 10px);
244
243
  width: 0;
244
+ font-size: 16px;
245
+ line-height: 24px;
246
+ right: 22px;
245
247
  }
246
248
 
247
249
  /* Set the default text color to inherit.
@@ -272,9 +274,12 @@
272
274
  .aui-select2-container.select2-container-multi .select2-choices {
273
275
  #aui-forms.aui-select2-input-field-style(normal);
274
276
  #aui.icon(@aui-glyph-chevron-down, {
275
- font-size: inherit;
277
+ font-size: 16.5px;
276
278
  left: inherit;
277
- right: 0;
279
+ color: var(--aui-button-default-text-color);
280
+ right: 3px;
281
+ top: 50%;
282
+ line-height: 16px;
278
283
  });
279
284
 
280
285
  min-height: 0;
@@ -243,13 +243,14 @@ form.aui:not(.aui-legacy-forms) {
243
243
  }
244
244
 
245
245
  // both are @ak-color-N600
246
- @chevron-dark: url('data:image/svg+xml,%3Csvg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath fill="%23A5ADBA" d="m6.744 8.744a1.053 1.053 0 0 0 0 1.49l4.547 4.557a1 1 0 0 0 1.416 0l4.55-4.558a1.051 1.051 0 1 0-1.488-1.488l-3.77 3.776-3.768-3.776a1.051 1.051 0 0 0-1.487 0z"/%3E%3C/svg%3E%0A');
247
- @chevron-light: url('data:image/svg+xml,%3Csvg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath fill="%23344563" d="m6.744 8.744a1.053 1.053 0 0 0 0 1.49l4.547 4.557a1 1 0 0 0 1.416 0l4.55-4.558a1.051 1.051 0 1 0-1.488-1.488l-3.77 3.776-3.768-3.776a1.051 1.051 0 0 0-1.487 0z"/%3E%3C/svg%3E%0A');
246
+ @chevron-dark: url('data:image/svg+xml,%3Csvg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath fill="%23A5ADBA" d="M8.292 10.293a1.009 1.009 0 000 1.419l2.939 2.965c.218.215.5.322.779.322s.556-.107.769-.322l2.93-2.955a1.01 1.01 0 000-1.419.987.987 0 00-1.406 0l-2.298 2.317-2.307-2.327a.99.99 0 00-1.406 0z"/%3E%3C/svg%3E%0A');
247
+ @chevron-light: url('data:image/svg+xml,%3Csvg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath fill="%23344563" d="M8.292 10.293a1.009 1.009 0 000 1.419l2.939 2.965c.218.215.5.322.779.322s.556-.107.769-.322l2.93-2.955a1.01 1.01 0 000-1.419.987.987 0 00-1.406 0l-2.298 2.317-2.307-2.327a.99.99 0 00-1.406 0z"/%3E%3C/svg%3E%0A');
248
248
 
249
249
  select[disabled]:not([size]),
250
250
  .select:not([size]) {
251
251
  background-repeat: no-repeat;
252
- background-position: 100% 50%;
252
+ background-position: calc(100% + 1.5px) 50%;
253
+ background-size: 25px;
253
254
  }
254
255
 
255
256
  select.select[disabled]:not([size]) {
@@ -259,7 +260,7 @@ form.aui:not(.aui-legacy-forms) {
259
260
  }
260
261
 
261
262
  select.select:not([size]) {
262
- padding-right: 22px;
263
+ padding-right: 20px;
263
264
  background-image: @chevron-light;
264
265
  }
265
266
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  #aui {
4
4
  .aui-dropdown2-trigger-chevron-icon(@glyphsize: @aui-icon-size-small; @canvassize: @aui-icon-size-small-canvas) {
5
- @canvas-padding: ((@canvassize - @glyphsize) / 2);
5
+
6
6
  #aui.icon-pseudoelement(@aui-icon-font-family);
7
7
  content: @aui-glyph-chevron-down;
8
8
  font-size: @glyphsize;
@@ -10,7 +10,7 @@
10
10
  line-height: 1;
11
11
  margin-top: -(@glyphsize / 2);
12
12
  position: absolute;
13
- right: @canvas-padding;
13
+ right: 3.5px;
14
14
  top: 50%;
15
15
  text-indent: 0; // Reset indentation set by split button
16
16
  width: @glyphsize;
@@ -136,8 +136,6 @@ aui-select {
136
136
 
137
137
  &:not([aria-busy])::before {
138
138
  #aui.aui-dropdown2-trigger-chevron-icon();
139
-
140
- right: ((@select-trigger-width - @aui-icon-size-small - (@aui-button-border-width *2)) / 2);
141
139
  }
142
140
  }
143
141
  }