@atlassian/aui 9.11.5 → 9.11.7

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.11.5",
4
+ "version": "9.11.7",
5
5
  "author": "Atlassian Pty Ltd.",
6
6
  "homepage": "https://aui.atlassian.com",
7
7
  "license": "Apache-2.0",
@@ -39,31 +39,24 @@
39
39
  "@popperjs/core": "2.11.8",
40
40
  "backbone": "1.6.0",
41
41
  "css.escape": "1.5.1",
42
- "dompurify": "2.5.0",
42
+ "dompurify": "2.5.7",
43
43
  "fancy-file-input": "2.0.4",
44
44
  "jquery-ui": "1.13.2",
45
45
  "skatejs": "0.13.17",
46
46
  "skatejs-template-html": "0.0.0",
47
47
  "trim-extra-html-whitespace": "1.3.0",
48
- "underscore": "1.13.6",
49
- "tablesorter": "file:./src/js-vendor/tablesorter",
50
- "jquery-aop": "file:src/js-vendor/jquery-aop",
51
- "jquery-form": "file:src/js-vendor/jquery-form",
52
- "select2": "file:src/js-vendor/select2",
53
- "jquery.hotkeys": "file:src/js-vendor/jquery.hotkeys",
54
- "react": "18.3.1"
48
+ "underscore": "1.13.6"
55
49
  },
56
50
  "devDependencies": {
57
51
  "@atlassian/aui-webpack-config": "3.0.1",
58
52
  "@babel/core": "7.18.13",
59
53
  "@babel/preset-env": "7.18.10",
60
- "cross-env": "7.0.3",
61
- "eslint": "7.32.0",
62
54
  "glob": "7.2.3",
63
55
  "ignore-emit-webpack-plugin": "2.0.6",
64
56
  "jquery": "3.5.1",
65
57
  "jquery-migrate": "3.4.1",
66
- "less": "3.13.1"
58
+ "less": "4.2.0",
59
+ "react": "18.3.1"
67
60
  },
68
61
  "scripts": {
69
62
  "prepublishOnly": "yarn clean && cross-env NODE_ENV=production yarn build && node scripts/prepublishOnly.js",
@@ -9,6 +9,7 @@ import escapeHtml from './escape-html';
9
9
  import { CLOSE_BUTTON } from './close-button';
10
10
  import { FOCUSABLE_QUERY } from './internal/a11y/focusable-query';
11
11
  import getFocusManager from './focus-manager';
12
+ import { I18n } from './i18n';
12
13
 
13
14
  const AUTO_CLOSE_TIME = 8000;
14
15
  const ID_FLAG_CONTAINER = 'aui-flag-container';
@@ -39,17 +40,12 @@ function flag (flagOptions) {
39
40
 
40
41
  handleFlagContainer();
41
42
  insertFlag($flag);
43
+
42
44
  setTimeout(function () {
43
45
  if ($flag.attr('aui-focus-trap') === 'true') {
44
46
  getFocusManager.global.enter($flag);
45
47
  }
46
- }, 0);
47
-
48
- setTimeout(function () {
49
- $flag.attr({
50
- 'aria-hidden': false
51
- });
52
- }, 100)
48
+ }, 0)
53
49
 
54
50
  return $flag.get(0);
55
51
  }
@@ -62,10 +58,28 @@ function extendFlagElement ($flag) {
62
58
  };
63
59
  }
64
60
 
65
- function renderFlagElement ({ body, title, close, type, ariaLive }) {
61
+ function getDefaultAriaLabelForFlagType(type) {
62
+ switch (type) {
63
+ case 'success':
64
+ return I18n.getText('aui.flag.default-aria-label.success');
65
+ case 'warning':
66
+ return I18n.getText('aui.flag.default-aria-label.warning');
67
+ case 'error':
68
+ return I18n.getText('aui.flag.default-aria-label.error');
69
+ default:
70
+ return I18n.getText('aui.flag.default-aria-label.info');
71
+ }
72
+ }
73
+
74
+ function renderFlagElement ({ body, title, close, type, ariaLive, ariaLabel, ariaDescription }) {
66
75
  const titleHtml = title ? `<p class="title"><strong>${escapeHtml(title)}</strong></p>` : '';
67
76
  const html = `<div class="aui-message">${titleHtml}</div>`;
68
- const ariaLabel = title ? escapeHtml(title) : '';
77
+ if (!ariaLabel) {
78
+ ariaLabel = getDefaultAriaLabelForFlagType(type);
79
+ }
80
+ if (!ariaDescription) {
81
+ ariaDescription = '';
82
+ }
69
83
 
70
84
  const $message = $(html)
71
85
  .append($.parseHTML(body || ''))
@@ -74,7 +88,16 @@ function renderFlagElement ({ body, title, close, type, ariaLive }) {
74
88
  const isFocusable = $message.find(FOCUSABLE_QUERY).length > 0;
75
89
  const ariaRole = isFocusable ? 'alertdialog' : 'alert';
76
90
 
77
- return $(`<div aui-focus-trap="${isFocusable}" class="aui-flag" aria-label="${ariaLabel}" aria-hidden="true" aria-live="${escapeHtml(ariaLive)}" role="${ariaRole}"></div>`).append($message);
91
+ return $('<div class="aui-flag"></div>')
92
+ .attr({
93
+ 'aui-focus-trap': `${isFocusable}`,
94
+ 'aria-label': escapeHtml(ariaLabel),
95
+ 'aria-hidden': 'false',
96
+ 'aria-live': escapeHtml(ariaLive),
97
+ 'role': ariaRole,
98
+ ...(!!ariaDescription ? {'aria-description': escapeHtml(ariaDescription)} : {}),
99
+ })
100
+ .append($message);
78
101
  }
79
102
 
80
103
  function makeCloseable ($flag) {
@@ -104,13 +127,16 @@ function makeAutoClosable ($flag, duration) {
104
127
  function closeFlag ($flagToClose) {
105
128
  const flag = $flagToClose.get(0);
106
129
 
130
+ if ($flagToClose.attr('aui-focus-trap')) {
131
+ getFocusManager.global.exit($flagToClose);
132
+ }
133
+
107
134
  flag.removeAttribute('open');
108
135
  flag.setAttribute('inert', '');
109
136
  flag.setAttribute('aria-hidden', true);
137
+ flag.style.display = 'none';
110
138
  flag.dispatchEvent(new CustomEvent('aui-flag-close', { bubbles: true }));
111
- if ($flagToClose.attr('aui-focus-trap')) {
112
- getFocusManager.global.exit($flagToClose);
113
- }
139
+
114
140
 
115
141
  return flag;
116
142
  }
@@ -78,5 +78,9 @@ export default {
78
78
  'ajs.datepicker.localisations.month-names.november': 'November',
79
79
  'ajs.datepicker.localisations.month-names.december': 'December',
80
80
  'ajs.datepicker.localisations.show-month-after-year': false,
81
- 'ajs.datepicker.localisations.year-suffix': ''
81
+ 'ajs.datepicker.localisations.year-suffix': '',
82
+ 'aui.flag.default-aria-label.info': 'New information message',
83
+ 'aui.flag.default-aria-label.success': 'New confirmation message',
84
+ 'aui.flag.default-aria-label.warning': 'New warning message',
85
+ 'aui.flag.default-aria-label.error': 'New error message',
82
86
  }
@@ -34,7 +34,7 @@ aui-header,
34
34
  @section-gap: 20px;
35
35
 
36
36
  box-sizing: border-box;
37
- padding: 7px @aui-grid 10px @aui-grid;
37
+ padding: 7px @aui-grid 8px @aui-grid;
38
38
  position: relative;
39
39
 
40
40
  .aui-header-before {