@atlassian/aui 9.3.2 → 9.3.6

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.
@@ -9,7 +9,7 @@ export * from './aui.batch.components';
9
9
  import './aui.component.form-notification';
10
10
  import './aui.component.form-validation';
11
11
  import { Header } from './aui.component.async-header';
12
- import { DatePicker } from './aui.component.form.date-select';
12
+ import { DatePicker, CalendarWidget } from './aui.component.form.date-select';
13
13
  import { RestfulTable } from './aui.component.restful-table';
14
14
  import { sidebar } from './aui.component.sidebar';
15
15
  import { whenIType } from './behaviours/aui.behaviour.keyboard-shortcuts';
@@ -18,6 +18,7 @@ export {
18
18
  I18n,
19
19
  Header,
20
20
  DatePicker,
21
+ CalendarWidget,
21
22
  RestfulTable,
22
23
  sidebar,
23
24
  whenIType,
@@ -1,4 +1,4 @@
1
1
  import './styles/aui.pattern.forms';
2
2
  import './aui.component.inline-dialog2'; // so that the inline dialog styles get placed before date picker.
3
3
  import '@atlassian/aui/src/less/aui-date-picker.less';
4
- export { default as DatePicker } from '@atlassian/aui/src/js/aui/date-picker';
4
+ export { default as DatePicker, CalendarWidget } from '@atlassian/aui/src/js/aui/date-picker';
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.2",
4
+ "version": "9.3.6",
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.12.0"
45
+ "underscore": "1.13.1"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@atlassian/adg-server-iconfont": "3.1.0",
@@ -21,13 +21,13 @@ const makePopup = ({horizontalAlignment, datePickerUUID}) => {
21
21
  return popup;
22
22
  };
23
23
 
24
- const makeConfig = ({dateFormat, $field, onSelect, hide, onChangeMonthYear}) => ({
25
- 'dateFormat': dateFormat,
26
- 'defaultDate': $field.val(),
27
- 'maxDate': $field.attr('max'),
28
- 'minDate': $field.attr('min'),
29
- 'nextText': '>',
30
- 'onSelect': function (dateText) {
24
+ const makeConfig = ({ minDate, maxDate, dateFormat, $field, onSelect, hide, onChangeMonthYear}) => ({
25
+ dateFormat,
26
+ defaultDate: $field.val(),
27
+ maxDate: maxDate || $field.attr('max'),
28
+ minDate: minDate || $field.attr('min'),
29
+ nextText: '>',
30
+ onSelect: function (dateText) {
31
31
  $field.val(dateText);
32
32
  $field.trigger('change');
33
33
  hide();
@@ -35,7 +35,7 @@ const makeConfig = ({dateFormat, $field, onSelect, hide, onChangeMonthYear}) =>
35
35
  onSelect && onSelect.call(this, dateText);
36
36
  },
37
37
  onChangeMonthYear,
38
- 'prevText': '<'
38
+ prevText: '<'
39
39
  });
40
40
 
41
41
  const initCalendar = ({config, popupContents, getCalendarNode, hint}) => {
@@ -287,6 +287,8 @@ const initPolyfill = function (datePicker) {
287
287
  }
288
288
  const baseConfig = makeConfig({
289
289
  dateFormat: options.dateFormat,
290
+ minDate: options.minDate,
291
+ maxDate: options.maxDate,
290
292
  $field,
291
293
  onSelect: options.onSelect,
292
294
  hide: datePicker.hide,
@@ -337,6 +339,11 @@ const initPolyfill = function (datePicker) {
337
339
  // shows that changing the `type` of input does not erase its value.
338
340
  // see https://codepen.io/chrisdarroch/pen/YzwgjyJ
339
341
  $field.prop('type', 'text');
342
+ // Set default value on initialization to handle all date formats.
343
+ // It is possible, because of changing type to text on the line above.
344
+ $field.val($field.attr('value'));
345
+ // Trigger change to update calendar popup value.
346
+ $field.trigger('propertychange');
340
347
 
341
348
  // demonstrate the polyfill is initialised
342
349
  $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
+ }
@@ -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);
@@ -31,6 +31,7 @@ const defaultOptions = {
31
31
  gravity: 'n',
32
32
  html: false,
33
33
  live: false,
34
+ enabled: true,
34
35
  suppress: () => false
35
36
  }
36
37
 
@@ -41,6 +42,7 @@ class Tooltip {
41
42
  this.triggerElement = triggerElement;
42
43
  this.$triggerElement = $(this.triggerElement);
43
44
  this.options = { ...defaultOptions, ...options };
45
+ this.enabled = this.options.enabled
44
46
  this.moveTitleToTooltip()
45
47
  }
46
48
 
@@ -102,12 +104,13 @@ class Tooltip {
102
104
  return $sharedTip;
103
105
  }
104
106
 
105
-
106
107
  show() {
108
+ if (this.enabled === false) {
109
+ return;
110
+ }
111
+ this.hide();
107
112
  const triggerElement = this.triggerElement;
108
113
 
109
- const $tip = this.getFloatingTip();
110
-
111
114
  const placement = GRAVITY_MAP[this.options.gravity];
112
115
 
113
116
  clearTimeout(this.popperTimeout);
@@ -119,8 +122,7 @@ class Tooltip {
119
122
  }
120
123
 
121
124
  this.popperTimeout = setTimeout(() => {
122
- const tipNode = $tip.get(0);
123
- // tipNode.setAttribute('data-show', '');
125
+ const tipNode = this.getFloatingTip().get(0);
124
126
  tipNode.classList.remove('assistive');
125
127
 
126
128
  this.popperInstance = createPopper(triggerElement, tipNode, {
@@ -141,7 +143,6 @@ class Tooltip {
141
143
 
142
144
  hide() {
143
145
  const tipNode = this.getFloatingTip().get(0);
144
- // tipNode.removeAttribute('data-show');
145
146
  tipNode.classList.add('assistive');
146
147
 
147
148
  clearTimeout(this.popperTimeout);
@@ -152,6 +153,15 @@ class Tooltip {
152
153
  }
153
154
  $(window).off(`scroll.${pluginKey}`);
154
155
  }
156
+
157
+ enable() {
158
+ this.enabled = true;
159
+ }
160
+
161
+ disable() {
162
+ this.hide();
163
+ this.enabled = false;
164
+ }
155
165
  }
156
166
 
157
167
  const tooltipsByDomNode = new WeakMap();
@@ -163,7 +173,9 @@ const getTooltipInstance = (domNode, options) => {
163
173
  let tooltip = tooltipsByDomNode.get(domNode);
164
174
  if (tooltip === undefined) {
165
175
  tooltip = new Tooltip(domNode, options);
166
- tooltipsByDomNode.set(domNode, tooltip);
176
+ if (typeof domNode === 'object') {
177
+ tooltipsByDomNode.set(domNode, tooltip);
178
+ }
167
179
  }
168
180
  return tooltip;
169
181
  }
@@ -116,10 +116,18 @@ Use CSS flexbox or grid to vertically align it.
116
116
  See https://css-tricks.com/centering-css-complete-guide/ for techniques.`
117
117
  });
118
118
 
119
- //8.4.0
119
+ // 8.4.0
120
120
 
121
121
  css('.aui-button-light', {
122
122
  sinceVersion: '8.4.0',
123
123
  removeInVersion: '10.0.0',
124
124
  extraInfo: 'ADGS allows only for normal and subtle buttons.'
125
125
  });
126
+
127
+ // 9.3.5
128
+
129
+ css('.aui-dropdown2-tailed', {
130
+ sinceVersion: '9.3.5',
131
+ removeInVersion: '10.0.0',
132
+ extraInfo: 'ADGS does not include tails on layered components'
133
+ })
@@ -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
@@ -164,7 +164,7 @@ aui-header,
164
164
 
165
165
  // Override the icon styles so that every icon in the header is a uniform size...
166
166
  // ...but only in the right-hand side of the header.
167
- .aui-header-secondary .aui-icon {
167
+ .aui-header-secondary > .aui-nav > li > a > .aui-icon {
168
168
  --aui-icon-size: 24px;
169
169
  }
170
170
 
@@ -233,14 +233,16 @@
233
233
  .aui-select2-container.select2-container .select2-choice:after {
234
234
  #aui.icon-pseudoelement();
235
235
  content: @aui-glyph-chevron-down;
236
- left: 100%; /* "left" + "margin-left" required because of webkit not working properly with "right" */
237
236
  height: 0;
238
237
  margin-left: -18px;
239
238
  margin-top: -2px;
240
239
  opacity: 1;
241
240
  position: absolute;
242
- top: 7px;
241
+ top: calc(50% - 10px);
243
242
  width: 0;
243
+ font-size: 16px;
244
+ line-height: 24px;
245
+ right: 22px;
244
246
  }
245
247
 
246
248
  /* Set the default text color to inherit.
@@ -271,9 +273,12 @@
271
273
  .aui-select2-container.select2-container-multi .select2-choices {
272
274
  #aui-forms.aui-select2-input-field-style(normal);
273
275
  #aui.icon(@aui-glyph-chevron-down, {
274
- font-size: inherit;
276
+ font-size: 16.5px;
275
277
  left: inherit;
276
- right: 0;
278
+ color: var(--aui-button-default-text-color);
279
+ right: 3px;
280
+ top: 50%;
281
+ line-height: 16px;
277
282
  });
278
283
 
279
284
  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
  }