@atlassian/aui 9.3.14 → 9.3.16
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/dist/aui/aui-prototyping.css +3 -3
- package/dist/aui/aui-prototyping.js +13 -13
- package/dist/aui/aui-prototyping.js.map +1 -1
- package/dist/aui/aui-prototyping.nodeps.css +4 -4
- package/dist/aui/aui-prototyping.nodeps.js +12 -12
- package/dist/aui/aui-prototyping.nodeps.js.map +1 -1
- package/package.json +1 -1
- package/src/js/aui/forms/create-forms-component-body.js +37 -0
- package/src/js/aui/forms/custom-checkbox.js +6 -12
- package/src/js/aui/forms/custom-radio.js +6 -12
- package/src/js/aui/internal/detect-children-change.js +35 -0
- package/src/js/aui/sidebar.js +6 -0
- package/src/js/aui/tooltip.js +6 -1
- package/src/js/aui/when-i-type.js +33 -13
- package/src/less/aui-experimental-tooltip.less +1 -0
- package/src/less/forms-radios-and-checkboxes.less +19 -26
package/package.json
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import skate from "skatejs";
|
|
2
|
+
import {onChildrenChange} from "../internal/detect-children-change";
|
|
3
|
+
import jQuery from "jquery";
|
|
4
|
+
|
|
5
|
+
export function createFormsComponentBody(type) {
|
|
6
|
+
|
|
7
|
+
let unsub;
|
|
8
|
+
|
|
9
|
+
return {
|
|
10
|
+
type: skate.type.CLASSNAME,
|
|
11
|
+
attached: function(el) {
|
|
12
|
+
|
|
13
|
+
onChildrenChange(el,(unsubscribe) => {
|
|
14
|
+
|
|
15
|
+
// Store function that stops subscription
|
|
16
|
+
unsub = unsubscribe;
|
|
17
|
+
|
|
18
|
+
const innerCheckboxList = jQuery(`input[type=${type}]`, el);
|
|
19
|
+
|
|
20
|
+
innerCheckboxList.each(function (i, radio) {
|
|
21
|
+
jQuery('<span class="aui-form-glyph"></span>').insertAfter(radio);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const isInsertedAfterChange = innerCheckboxList.length > 0;
|
|
25
|
+
if (isInsertedAfterChange) {
|
|
26
|
+
unsub();
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
detached: function(el) {
|
|
31
|
+
jQuery('.aui-form-glyph', el).remove();
|
|
32
|
+
if (unsub) {
|
|
33
|
+
unsub();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import skate from 'skatejs';
|
|
2
|
-
import
|
|
2
|
+
import {createFormsComponentBody} from "./create-forms-component-body";
|
|
3
|
+
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Allows us to add a new DOM element for rendering ADG styled checkbox glyphs,
|
|
6
7
|
* so we can get our desired aesthetic without having to rely on a specific markup pattern.
|
|
7
8
|
*/
|
|
8
|
-
skate(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
jQuery('<span class="aui-form-glyph"></span>').insertAfter(checkbox);
|
|
13
|
-
});
|
|
14
|
-
},
|
|
15
|
-
detached: function(el) {
|
|
16
|
-
jQuery('.aui-form-glyph', el).remove();
|
|
17
|
-
}
|
|
18
|
-
});
|
|
9
|
+
skate(
|
|
10
|
+
'checkbox',
|
|
11
|
+
createFormsComponentBody('checkbox')
|
|
12
|
+
);
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import skate from 'skatejs';
|
|
2
|
-
import
|
|
2
|
+
import {createFormsComponentBody} from "./create-forms-component-body";
|
|
3
|
+
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Allows us to add a new DOM element for rendering ADG styled radio glyphs,
|
|
6
7
|
* so we can get our desired aesthetic without having to rely on a specific markup pattern.
|
|
7
8
|
*/
|
|
8
|
-
skate(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
jQuery('<span class="aui-form-glyph"></span>').insertAfter(radio);
|
|
13
|
-
});
|
|
14
|
-
},
|
|
15
|
-
detached: function(el) {
|
|
16
|
-
jQuery('.aui-form-glyph', el).remove();
|
|
17
|
-
}
|
|
18
|
-
});
|
|
9
|
+
skate(
|
|
10
|
+
'radio',
|
|
11
|
+
createFormsComponentBody('radio')
|
|
12
|
+
);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
function isChildrenChanged(mutationList) {
|
|
2
|
+
for (const mutation of mutationList) {
|
|
3
|
+
if (mutation.type === 'childList') {
|
|
4
|
+
return true;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/***
|
|
11
|
+
* Executes callback every time element children change. Called once initially.
|
|
12
|
+
*
|
|
13
|
+
* ***Make sure to use unsubscribe callback to free resources occupied for detection***
|
|
14
|
+
*
|
|
15
|
+
* @param element Element whose children should be monitored
|
|
16
|
+
* @param callback Function to be called when children change happened. Gets unsubscribe function as argument.
|
|
17
|
+
*/
|
|
18
|
+
export function onChildrenChange(element, callback) {
|
|
19
|
+
|
|
20
|
+
let isCompleteOnInit = false;
|
|
21
|
+
|
|
22
|
+
callback(() => { isCompleteOnInit = true });
|
|
23
|
+
|
|
24
|
+
if (isCompleteOnInit) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const observer = new MutationObserver((mutationList) => {
|
|
29
|
+
if (isChildrenChanged(mutationList)) {
|
|
30
|
+
callback(() => observer.disconnect());
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
observer.observe(element, { childList: true });
|
|
35
|
+
}
|
package/src/js/aui/sidebar.js
CHANGED
|
@@ -265,8 +265,14 @@ Sidebar.prototype.reflow = function reflow(
|
|
|
265
265
|
Sidebar.prototype.toggle = function () {
|
|
266
266
|
if (this.isCollapsed()) {
|
|
267
267
|
this.expand();
|
|
268
|
+
this.$el
|
|
269
|
+
.find('.aui-sidebar-toggle')
|
|
270
|
+
.attr('aria-label', I18n.getText('aui.sidebar.collapse.tooltip'));
|
|
268
271
|
} else {
|
|
269
272
|
this.collapse();
|
|
273
|
+
this.$el
|
|
274
|
+
.find('.aui-sidebar-toggle')
|
|
275
|
+
.attr('aria-label', I18n.getText('aui.sidebar.expand.tooltip'));
|
|
270
276
|
}
|
|
271
277
|
return this;
|
|
272
278
|
};
|
package/src/js/aui/tooltip.js
CHANGED
|
@@ -35,7 +35,8 @@ const defaultOptions = {
|
|
|
35
35
|
enabled: true,
|
|
36
36
|
suppress: () => false,
|
|
37
37
|
aria: true,
|
|
38
|
-
sanitize: true
|
|
38
|
+
sanitize: true,
|
|
39
|
+
maxWidth: 200
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
let $sharedTip;
|
|
@@ -115,6 +116,10 @@ class Tooltip {
|
|
|
115
116
|
tooltipContentElement.text(title);
|
|
116
117
|
}
|
|
117
118
|
|
|
119
|
+
if (options.maxWidth) {
|
|
120
|
+
tooltipContentElement.css("max-width", options.maxWidth + "px");
|
|
121
|
+
}
|
|
122
|
+
|
|
118
123
|
return $sharedTip;
|
|
119
124
|
}
|
|
120
125
|
|
|
@@ -127,9 +127,13 @@ function whenIType (keys) {
|
|
|
127
127
|
var title = elem.attr('title') || '';
|
|
128
128
|
var keyCombos = boundKeyCombos.slice();
|
|
129
129
|
var existingCombos = elem.data('boundKeyCombos') || [];
|
|
130
|
-
var
|
|
131
|
-
var
|
|
132
|
-
var
|
|
130
|
+
var kbShortcutAppended = elem.data('kbShortcutAppended') || ''
|
|
131
|
+
var kbShortcutAppendedScreenReader = elem.data('kbShortcutAppendedScreenReader') || ''
|
|
132
|
+
var ariaLabel = elem.attr('aria-label');
|
|
133
|
+
var isFirstShortcut = !kbShortcutAppended;
|
|
134
|
+
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);
|
|
133
137
|
|
|
134
138
|
while (keyCombos.length) {
|
|
135
139
|
var keyCombo = keyCombos.shift();
|
|
@@ -137,19 +141,26 @@ function whenIType (keys) {
|
|
|
137
141
|
return isEqual(keyCombo, existingCombo);
|
|
138
142
|
});
|
|
139
143
|
if (!comboAlreadyExists) {
|
|
140
|
-
|
|
141
|
-
|
|
144
|
+
kbShortcutAppended = appendKeyComboInstructions(keyCombo.slice(), kbShortcutAppended, isFirstShortcut);
|
|
145
|
+
kbShortcutAppendedScreenReader = appendKeyComboInstructions(keyCombo.slice(), kbShortcutAppendedScreenReader, isFirstShortcutScreenReader, { workaroundJaws: true });
|
|
146
|
+
isFirstShortcut = false;
|
|
147
|
+
isFirstShortcutScreenReader = false;
|
|
142
148
|
}
|
|
143
149
|
}
|
|
144
150
|
|
|
145
151
|
if (isMac) {
|
|
146
|
-
|
|
152
|
+
kbShortcutAppended = kbShortcutAppended
|
|
153
|
+
.replace(/Meta/ig, '\u2318') //Apple cmd key
|
|
154
|
+
.replace(/Shift/ig, '\u21E7'); //Apple Shift symbol
|
|
155
|
+
kbShortcutAppendedScreenReader = kbShortcutAppendedScreenReader
|
|
147
156
|
.replace(/Meta/ig, '\u2318') //Apple cmd key
|
|
148
157
|
.replace(/Shift/ig, '\u21E7'); //Apple Shift symbol
|
|
149
158
|
}
|
|
150
159
|
|
|
151
|
-
elem.attr('title', originalTitle +
|
|
152
|
-
elem.
|
|
160
|
+
elem.attr('title', originalTitle + kbShortcutAppended);
|
|
161
|
+
elem.attr('aria-label', originalAriaLabel + kbShortcutAppendedScreenReader)
|
|
162
|
+
elem.data('kbShortcutAppended', kbShortcutAppended);
|
|
163
|
+
elem.data('kbShortcutAppendedScreenReader', kbShortcutAppendedScreenReader);
|
|
153
164
|
elem.data('boundKeyCombos', existingCombos.concat(boundKeyCombos));
|
|
154
165
|
}
|
|
155
166
|
|
|
@@ -163,23 +174,32 @@ function whenIType (keys) {
|
|
|
163
174
|
|
|
164
175
|
var title = elem.attr('title');
|
|
165
176
|
elem.attr('title', title.replace(shortcuts, ''));
|
|
177
|
+
elem.attr('aria-label', title.replace(shortcuts, ''));
|
|
166
178
|
elem.removeData('kbShortcutAppended');
|
|
179
|
+
elem.removeData('kbShortcutAppendedScreenReader');
|
|
167
180
|
elem.removeData('boundKeyCombos');
|
|
168
181
|
}
|
|
169
182
|
|
|
170
|
-
|
|
171
|
-
|
|
183
|
+
function appendKeyComboInstructions(keyCombo, title, isFirst, options) {
|
|
184
|
+
var openParenthesis = '(';
|
|
185
|
+
var closeParenthesis = ')';
|
|
186
|
+
|
|
187
|
+
if (options && options.workaroundJaws) {
|
|
188
|
+
openParenthesis = '';
|
|
189
|
+
closeParenthesis = '';
|
|
190
|
+
}
|
|
191
|
+
|
|
172
192
|
if (isFirst) {
|
|
173
|
-
title += '
|
|
193
|
+
title += ' ' + openParenthesis + I18n.getText('aui.keyboard.shortcut.type.x', keyCombo.shift());
|
|
174
194
|
} else {
|
|
175
195
|
title = title.replace(/\)$/, '');
|
|
176
|
-
title += I18n.getText('aui.keyboard.shortcut.or.x', keyCombo.shift());
|
|
196
|
+
title += ' ' + I18n.getText('aui.keyboard.shortcut.or.x', keyCombo.shift());
|
|
177
197
|
}
|
|
178
198
|
|
|
179
199
|
keyCombo.forEach(function (key) {
|
|
180
200
|
title += ' ' + I18n.getText('aui.keyboard.shortcut.then.x', key);
|
|
181
201
|
});
|
|
182
|
-
title +=
|
|
202
|
+
title += closeParenthesis;
|
|
183
203
|
|
|
184
204
|
return title;
|
|
185
205
|
}
|
|
@@ -200,6 +200,21 @@ form.aui:not(.aui-legacy-forms) {
|
|
|
200
200
|
.aui-checkbox-disabled-style();
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
+
|
|
204
|
+
&:focus + .aui-form-glyph::after {
|
|
205
|
+
.aui-radio-focus-size();
|
|
206
|
+
.aui-radio-focus-position();
|
|
207
|
+
|
|
208
|
+
content: "";
|
|
209
|
+
|
|
210
|
+
border: @button-focus-border;
|
|
211
|
+
border-radius: @aui-form-button-size;
|
|
212
|
+
background-color: transparent;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
&:focus + .aui-form-glyph::before {
|
|
216
|
+
border-color: @button-focus-border-color;
|
|
217
|
+
}
|
|
203
218
|
}
|
|
204
219
|
}
|
|
205
220
|
|
|
@@ -255,6 +270,10 @@ form.aui:not(.aui-legacy-forms) {
|
|
|
255
270
|
.aui-checkbox-disabled-style();
|
|
256
271
|
}
|
|
257
272
|
}
|
|
273
|
+
|
|
274
|
+
&:focus + .aui-form-glyph::before {
|
|
275
|
+
border-color: @button-focus-border-color;
|
|
276
|
+
}
|
|
258
277
|
}
|
|
259
278
|
}
|
|
260
279
|
|
|
@@ -273,30 +292,4 @@ form.aui:not(.aui-legacy-forms) {
|
|
|
273
292
|
top: @radio-offset-top - 1px;
|
|
274
293
|
}
|
|
275
294
|
|
|
276
|
-
.radio {
|
|
277
|
-
input {
|
|
278
|
-
&:focus + .aui-form-glyph::after {
|
|
279
|
-
.aui-radio-focus-size();
|
|
280
|
-
.aui-radio-focus-position();
|
|
281
|
-
|
|
282
|
-
content: "";
|
|
283
|
-
|
|
284
|
-
border: @button-focus-border;
|
|
285
|
-
border-radius: @aui-form-button-size;
|
|
286
|
-
background-color: transparent;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
&:focus + .aui-form-glyph::before {
|
|
290
|
-
border-color: @button-focus-border-color;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
.checkbox {
|
|
296
|
-
input {
|
|
297
|
-
&:focus + .aui-form-glyph::before {
|
|
298
|
-
border-color: @button-focus-border-color;
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
295
|
}
|