@atlassian/aui 9.9.6 → 9.9.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/LICENSE +1 -1
- package/README.md +7 -9
- package/dist/aui/aui-css-deprecations.js.map +1 -1
- package/dist/aui/aui-prototyping-browserfocus.css +2 -651
- package/dist/aui/aui-prototyping-browserfocus.css.map +1 -0
- package/dist/aui/aui-prototyping-darkmode.css +2 -285
- package/dist/aui/aui-prototyping-darkmode.css.map +1 -0
- package/dist/aui/aui-prototyping-design-tokens-api-full.js +1 -1
- package/dist/aui/aui-prototyping-design-tokens-api-full.js.map +1 -1
- package/dist/aui/aui-prototyping-design-tokens-api.js +1 -1
- package/dist/aui/aui-prototyping-design-tokens-api.js.map +1 -1
- package/dist/aui/aui-prototyping-design-tokens-base-themes-css.css +2 -2
- package/dist/aui/aui-prototyping-design-tokens-base-themes-css.css.map +1 -1
- package/dist/aui/aui-prototyping-design-tokens-base-themes-css.js +1 -1
- package/dist/aui/aui-prototyping-design-tokens-base-themes.js +1 -1
- package/dist/aui/aui-prototyping-design-tokens-compatibility.css +2 -115
- package/dist/aui/aui-prototyping-design-tokens-compatibility.css.map +1 -0
- package/dist/aui/aui-prototyping.css +10 -10
- package/dist/aui/aui-prototyping.css.map +1 -1
- package/dist/aui/aui-prototyping.js +4 -4
- package/dist/aui/aui-prototyping.js.map +1 -1
- package/dist/aui/aui-prototyping.nodeps.css +10 -10
- package/dist/aui/aui-prototyping.nodeps.css.map +1 -1
- package/dist/aui/aui-prototyping.nodeps.js +4 -4
- package/dist/aui/aui-prototyping.nodeps.js.map +1 -1
- package/dist/aui/fonts/adgs-icons.eot +0 -0
- package/dist/aui/fonts/adgs-icons.ttf +0 -0
- package/dist/aui/fonts/adgs-icons.woff +0 -0
- package/entry/aui.batch.components.js +23 -23
- package/entry/aui.batch.page.js +3 -3
- package/entry/aui.batch.patterns.js +20 -20
- package/entry/aui.batch.prototyping.js +3 -11
- package/entry/aui.component.nav.js +1 -1
- package/entry/aui.component.progressbar.js +4 -1
- package/entry/aui.side-effects.js +2 -2
- package/entry/behaviours/aui.behaviour.format.js +1 -1
- package/entry/behaviours/aui.behaviour.i18n.js +1 -1
- package/entry/behaviours/aui.behaviour.keyboard-shortcuts.js +1 -1
- package/entry/behaviours/aui.behaviour.progressive-data-set.js +1 -1
- package/entry/behaviours/aui.behaviour.version.js +1 -1
- package/entry/deprecated/aui.component.inline-dialog1.js +1 -1
- package/entry/styles/aui-design-tokens-compatibility.less +114 -115
- package/package.json +3 -7
- package/src/js/aui/alphanum.js +1 -1
- package/src/js/aui/avatar-badged.js +4 -5
- package/src/js/aui/avatar-group.js +58 -28
- package/src/js/aui/avatar.js +16 -14
- package/src/js/aui/banner.js +5 -4
- package/src/js/aui/blanket.js +11 -14
- package/src/js/aui/button.js +5 -5
- package/src/js/aui/checkbox-multiselect.js +79 -76
- package/src/js/aui/clone.js +1 -1
- package/src/js/aui/close-button.js +2 -6
- package/src/js/aui/contain-dropdown.js +5 -5
- package/src/js/aui/contains.js +1 -1
- package/src/js/aui/cookie.js +12 -16
- package/src/js/aui/date-picker.js +84 -69
- package/src/js/aui/debounce.js +5 -8
- package/src/js/aui/design-tokens/design-tokens-full.js +4 -13
- package/src/js/aui/design-tokens/design-tokens-init.js +3 -5
- package/src/js/aui/design-tokens/design-tokens-testing-theme.js +12 -18
- package/src/js/aui/design-tokens/design-tokens.js +2 -4
- package/src/js/aui/dialog.js +206 -172
- package/src/js/aui/dialog2.js +36 -25
- package/src/js/aui/dropdown2.js +221 -189
- package/src/js/aui/escape-html.js +2 -2
- package/src/js/aui/escape.js +1 -1
- package/src/js/aui/event.js +4 -8
- package/src/js/aui/expander.js +15 -13
- package/src/js/aui/flag.js +14 -16
- package/src/js/aui/focus-manager.js +19 -18
- package/src/js/aui/form-notification.js +15 -14
- package/src/js/aui/form-validation/basic-validators.js +39 -30
- package/src/js/aui/form-validation/validator-register.js +9 -5
- package/src/js/aui/form-validation.js +12 -13
- package/src/js/aui/format.js +9 -6
- package/src/js/aui/forms/create-forms-component-body.js +6 -9
- package/src/js/aui/forms/custom-checkbox.js +2 -6
- package/src/js/aui/forms/custom-radio.js +2 -6
- package/src/js/aui/forms.js +4 -8
- package/src/js/aui/header-async.js +1 -1
- package/src/js/aui/header.js +2 -2
- package/src/js/aui/i18n.js +2 -5
- package/src/js/aui/index-of.js +1 -1
- package/src/js/aui/inline-dialog.js +171 -117
- package/src/js/aui/inline-dialog2.js +40 -33
- package/src/js/aui/internal/add-id.js +1 -1
- package/src/js/aui/internal/alignment.js +57 -49
- package/src/js/aui/internal/amdify.js +0 -1
- package/src/js/aui/internal/animation.js +2 -5
- package/src/js/aui/internal/attributes.js +2 -3
- package/src/js/aui/internal/browser.js +5 -6
- package/src/js/aui/internal/constants.js +1 -3
- package/src/js/aui/internal/deduplicateIDs.js +8 -7
- package/src/js/aui/internal/deprecation/deprecated-adg2-icons.js +132 -132
- package/src/js/aui/internal/deprecation.js +53 -31
- package/src/js/aui/internal/detect-children-change.js +3 -2
- package/src/js/aui/internal/elements.js +2 -5
- package/src/js/aui/internal/enforcer.js +11 -13
- package/src/js/aui/internal/globalize.js +3 -3
- package/src/js/aui/internal/has-touch.js +1 -2
- package/src/js/aui/internal/header/create-header.js +54 -30
- package/src/js/aui/internal/i18n/aui.js +10 -6
- package/src/js/aui/internal/i18n/aui_af.js +31 -31
- package/src/js/aui/internal/i18n/aui_ar.js +31 -31
- package/src/js/aui/internal/i18n/aui_ar_DZ.js +31 -31
- package/src/js/aui/internal/i18n/aui_az.js +31 -31
- package/src/js/aui/internal/i18n/aui_bg.js +31 -31
- package/src/js/aui/internal/i18n/aui_bs.js +31 -31
- package/src/js/aui/internal/i18n/aui_ca.js +31 -31
- package/src/js/aui/internal/i18n/aui_cs.js +31 -31
- package/src/js/aui/internal/i18n/aui_da.js +31 -31
- package/src/js/aui/internal/i18n/aui_de.js +31 -31
- package/src/js/aui/internal/i18n/aui_el.js +31 -31
- package/src/js/aui/internal/i18n/aui_en_AU.js +31 -31
- package/src/js/aui/internal/i18n/aui_en_GB.js +31 -31
- package/src/js/aui/internal/i18n/aui_en_NZ.js +31 -31
- package/src/js/aui/internal/i18n/aui_eo.js +31 -31
- package/src/js/aui/internal/i18n/aui_es.js +31 -31
- package/src/js/aui/internal/i18n/aui_et.js +31 -31
- package/src/js/aui/internal/i18n/aui_eu.js +31 -31
- package/src/js/aui/internal/i18n/aui_fa.js +31 -31
- package/src/js/aui/internal/i18n/aui_fi.js +31 -31
- package/src/js/aui/internal/i18n/aui_fo.js +31 -31
- package/src/js/aui/internal/i18n/aui_fr.js +31 -31
- package/src/js/aui/internal/i18n/aui_fr_CH.js +31 -31
- package/src/js/aui/internal/i18n/aui_gl.js +31 -31
- package/src/js/aui/internal/i18n/aui_he.js +31 -31
- package/src/js/aui/internal/i18n/aui_hr.js +31 -31
- package/src/js/aui/internal/i18n/aui_hu.js +31 -31
- package/src/js/aui/internal/i18n/aui_hy.js +31 -31
- package/src/js/aui/internal/i18n/aui_id.js +31 -31
- package/src/js/aui/internal/i18n/aui_is.js +31 -31
- package/src/js/aui/internal/i18n/aui_it.js +31 -31
- package/src/js/aui/internal/i18n/aui_ja.js +31 -31
- package/src/js/aui/internal/i18n/aui_ko.js +31 -31
- package/src/js/aui/internal/i18n/aui_kz.js +31 -31
- package/src/js/aui/internal/i18n/aui_lt.js +31 -31
- package/src/js/aui/internal/i18n/aui_lv.js +31 -31
- package/src/js/aui/internal/i18n/aui_ml.js +31 -31
- package/src/js/aui/internal/i18n/aui_ms.js +31 -31
- package/src/js/aui/internal/i18n/aui_nl.js +31 -31
- package/src/js/aui/internal/i18n/aui_no.js +31 -31
- package/src/js/aui/internal/i18n/aui_pl.js +31 -31
- package/src/js/aui/internal/i18n/aui_pt.js +31 -31
- package/src/js/aui/internal/i18n/aui_pt_BR.js +31 -31
- package/src/js/aui/internal/i18n/aui_rm.js +31 -31
- package/src/js/aui/internal/i18n/aui_ro.js +31 -31
- package/src/js/aui/internal/i18n/aui_ru.js +31 -31
- package/src/js/aui/internal/i18n/aui_sk.js +31 -31
- package/src/js/aui/internal/i18n/aui_sl.js +31 -31
- package/src/js/aui/internal/i18n/aui_sq.js +31 -31
- package/src/js/aui/internal/i18n/aui_sr.js +31 -31
- package/src/js/aui/internal/i18n/aui_sr_SR.js +31 -31
- package/src/js/aui/internal/i18n/aui_sv.js +31 -31
- package/src/js/aui/internal/i18n/aui_ta.js +31 -31
- package/src/js/aui/internal/i18n/aui_th.js +31 -31
- package/src/js/aui/internal/i18n/aui_tj.js +31 -31
- package/src/js/aui/internal/i18n/aui_tr.js +31 -31
- package/src/js/aui/internal/i18n/aui_uk.js +31 -31
- package/src/js/aui/internal/i18n/aui_vi.js +31 -31
- package/src/js/aui/internal/i18n/aui_zh_CN.js +31 -31
- package/src/js/aui/internal/i18n/aui_zh_HK.js +31 -31
- package/src/js/aui/internal/i18n/aui_zh_TW.js +31 -31
- package/src/js/aui/internal/log.js +2 -6
- package/src/js/aui/internal/mediaQuery.js +2 -3
- package/src/js/aui/internal/select/option.js +3 -3
- package/src/js/aui/internal/select/suggestion-model.js +1 -1
- package/src/js/aui/internal/select/suggestions-model.js +4 -5
- package/src/js/aui/internal/select/suggestions-view.js +17 -12
- package/src/js/aui/internal/state.js +2 -3
- package/src/js/aui/is-clipped.js +2 -2
- package/src/js/aui/key-code.js +1 -1
- package/src/js/aui/label.js +6 -6
- package/src/js/aui/layer.js +101 -89
- package/src/js/aui/messages.js +57 -41
- package/src/js/aui/navigation.js +7 -9
- package/src/js/aui/on-text-resize.js +7 -5
- package/src/js/aui/params.js +11 -8
- package/src/js/aui/polyfills/custom-event.js +7 -7
- package/src/js/aui/polyfills/placeholder.js +4 -4
- package/src/js/aui/populate-parameters.js +4 -4
- package/src/js/aui/progress-indicator.js +35 -27
- package/src/js/aui/progressive-data-set.js +13 -8
- package/src/js/aui/query-input.js +1 -1
- package/src/js/aui/restful-table/class-names.js +1 -1
- package/src/js/aui/restful-table/data-keys.js +1 -1
- package/src/js/aui/restful-table/edit-row.js +63 -63
- package/src/js/aui/restful-table/entry-model.js +6 -13
- package/src/js/aui/restful-table/event-handlers.js +4 -8
- package/src/js/aui/restful-table/event-names.js +1 -1
- package/src/js/aui/restful-table/row.js +41 -23
- package/src/js/aui/restful-table.js +101 -72
- package/src/js/aui/result-set.js +5 -5
- package/src/js/aui/results-list.js +3 -3
- package/src/js/aui/select.js +72 -51
- package/src/js/aui/select2.js +16 -8
- package/src/js/aui/sidebar.js +81 -51
- package/src/js/aui/spin.js +61 -49
- package/src/js/aui/spinner.js +11 -12
- package/src/js/aui/tables-sortable.js +21 -10
- package/src/js/aui/tabs.js +108 -77
- package/src/js/aui/to-init.js +1 -1
- package/src/js/aui/toggle.js +55 -43
- package/src/js/aui/tooltip.js +35 -34
- package/src/js/aui/trigger.js +20 -18
- package/src/js/aui/truncating-progressive-data-set.js +1 -1
- package/src/js/aui/unbind-text-resize.js +1 -1
- package/src/js/aui/unique-id.js +1 -1
- package/src/js/aui/when-i-type.js +66 -39
- package/src/js/aui-css-deprecations.js +52 -51
- package/src/js/jquery/jquery.hotkeys.js +124 -49
- package/src/js/jquery/jquery.moveto.js +18 -12
- package/src/less/adg-fancy-file-input.less +2 -3
- package/src/less/adg-header-quicksearch.less +4 -1
- package/src/less/adg-iconfont.less +242 -242
- package/src/less/adgs-icons.less +262 -262
- package/src/less/aui-appheader.less +11 -7
- package/src/less/aui-avatars.less +1 -1
- package/src/less/aui-banner.less +2 -1
- package/src/less/aui-buttons.less +6 -5
- package/src/less/aui-dark-mode.less +1 -1
- package/src/less/aui-date-picker.less +9 -6
- package/src/less/aui-experimental-expander.less +3 -3
- package/src/less/aui-experimental-labels.less +1 -1
- package/src/less/aui-experimental-progress-indicator.less +10 -4
- package/src/less/aui-experimental-progress-tracker.less +9 -6
- package/src/less/aui-experimental-restfultable.less +11 -3
- package/src/less/aui-experimental-tables-sortable.less +5 -3
- package/src/less/aui-experimental-tooltip.less +1 -1
- package/src/less/aui-link.less +0 -1
- package/src/less/aui-lozenge.less +6 -3
- package/src/less/aui-navigation.less +13 -13
- package/src/less/aui-page-layout.less +3 -4
- package/src/less/aui-page-typography.less +8 -3
- package/src/less/aui-reset.less +22 -6
- package/src/less/aui-select2.less +11 -8
- package/src/less/aui-sidebar-badges.less +1 -2
- package/src/less/aui-sidebar-config.less +7 -2
- package/src/less/aui-sidebar-grouping.less +16 -6
- package/src/less/aui-sidebar-navigation.less +7 -5
- package/src/less/aui-sidebar-skeleton.less +12 -7
- package/src/less/aui-skip-link.less +2 -1
- package/src/less/aui-spinner.less +2 -2
- package/src/less/aui-toggle.less +2 -2
- package/src/less/aui-toolbar2.less +1 -1
- package/src/less/checkbox-multiselect.less +13 -13
- package/src/less/dialog.less +3 -3
- package/src/less/dialog2.less +11 -10
- package/src/less/dropdown2-temp.css +4 -4
- package/src/less/dropdown2.less +4 -4
- package/src/less/flag.less +2 -2
- package/src/less/form-notification.less +10 -6
- package/src/less/forms-current.less +6 -5
- package/src/less/forms-legacy.less +4 -2
- package/src/less/forms-radios-and-checkboxes.less +18 -16
- package/src/less/forms.less +2 -4
- package/src/less/iconfont-mixin.less +7 -4
- package/src/less/imports/aui-theme/adg/adg-colors.less +40 -40
- package/src/less/imports/aui-theme/adg/adg-neutral-dark.less +20 -20
- package/src/less/imports/aui-theme/adg/adg-neutral-light.less +20 -20
- package/src/less/imports/aui-theme/components/buttons.less +5 -1
- package/src/less/imports/aui-theme/components/dropdown.less +3 -1
- package/src/less/imports/aui-theme/components/flag.less +1 -1
- package/src/less/imports/aui-theme/components/form-notification.less +2 -1
- package/src/less/imports/aui-theme/components/forms.less +20 -3
- package/src/less/imports/aui-theme/components/inline-dialog2.less +1 -1
- package/src/less/imports/aui-theme/components/navigation.less +3 -3
- package/src/less/imports/aui-theme/components/progress-tracker.less +6 -2
- package/src/less/imports/aui-theme/components/tables.less +3 -2
- package/src/less/imports/aui-theme/components/toggle.less +8 -3
- package/src/less/imports/aui-theme/core/icons.less +22 -22
- package/src/less/imports/aui-theme/core/spaces.less +1 -1
- package/src/less/imports/aui-theme/core/text.less +6 -3
- package/src/less/imports/aui-theme/theme.less +1 -3
- package/src/less/imports/mixins/dropdown2-trigger-chevron-icon.less +0 -1
- package/src/less/imports/mixins/focus.less +12 -4
- package/src/less/imports/mixins/media-queries.less +2 -2
- package/src/less/imports/mixins/shadows.less +3 -1
- package/src/less/imports/mixins/tab-indicator.less +2 -2
- package/src/less/imports/mixins.less +11 -4
- package/src/less/inline-dialog.less +21 -19
- package/src/less/layer.less +0 -2
- package/src/less/messages.less +2 -1
- package/src/less/single-select.less +15 -10
- package/src/less/tables.less +3 -2
- package/src/less/tabs.less +4 -3
package/src/js/aui/tooltip.js
CHANGED
|
@@ -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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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,21 +36,21 @@ 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) {
|
|
@@ -84,7 +84,6 @@ class Tooltip {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
observeTriggerRemoval() {
|
|
87
|
-
|
|
88
87
|
const observedElements = [];
|
|
89
88
|
|
|
90
89
|
if (this.options.$delegationRoot && this.options.$delegationRoot.get(0)) {
|
|
@@ -96,7 +95,7 @@ class Tooltip {
|
|
|
96
95
|
}
|
|
97
96
|
|
|
98
97
|
this.triggerObservers = observedElements
|
|
99
|
-
.map(element => {
|
|
98
|
+
.map((element) => {
|
|
100
99
|
const parent = element.parentElement;
|
|
101
100
|
if (parent) {
|
|
102
101
|
const observer = new MutationObserver(() => {
|
|
@@ -107,12 +106,12 @@ class Tooltip {
|
|
|
107
106
|
});
|
|
108
107
|
observer.observe(parent, {
|
|
109
108
|
childList: true,
|
|
110
|
-
subtree: false // We take trigger parent, so we only care about direct children
|
|
109
|
+
subtree: false, // We take trigger parent, so we only care about direct children
|
|
111
110
|
});
|
|
112
111
|
return observer;
|
|
113
112
|
}
|
|
114
113
|
})
|
|
115
|
-
.filter(observer => !!observer);
|
|
114
|
+
.filter((observer) => !!observer);
|
|
116
115
|
}
|
|
117
116
|
|
|
118
117
|
unbindHandlers() {
|
|
@@ -127,7 +126,7 @@ class Tooltip {
|
|
|
127
126
|
}
|
|
128
127
|
|
|
129
128
|
if (this.triggerObservers.length > 0) {
|
|
130
|
-
this.triggerObservers.forEach(observer => observer.disconnect());
|
|
129
|
+
this.triggerObservers.forEach((observer) => observer.disconnect());
|
|
131
130
|
}
|
|
132
131
|
|
|
133
132
|
// We only need to unbind event handlers from this particular element
|
|
@@ -135,8 +134,10 @@ class Tooltip {
|
|
|
135
134
|
}
|
|
136
135
|
|
|
137
136
|
initContainer() {
|
|
138
|
-
if ($sharedTip === undefined || $sharedTip.get(0) && !$sharedTip.get(0).isConnected) {
|
|
139
|
-
$sharedTip = $(
|
|
137
|
+
if ($sharedTip === undefined || ($sharedTip.get(0) && !$sharedTip.get(0).isConnected)) {
|
|
138
|
+
$sharedTip = $(
|
|
139
|
+
`<div id="${AUI_TOOLTIP_ID}" class="${AUI_TOOLTIP_CLASS_NAME} assistive" role="tooltip"><p class="aui-tooltip-content"></p></div>`
|
|
140
|
+
);
|
|
140
141
|
$(document.body).append($sharedTip);
|
|
141
142
|
}
|
|
142
143
|
}
|
|
@@ -164,14 +165,15 @@ class Tooltip {
|
|
|
164
165
|
getTipTitle() {
|
|
165
166
|
const options = this.options;
|
|
166
167
|
|
|
167
|
-
let title =
|
|
168
|
-
options.title
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
168
|
+
let title =
|
|
169
|
+
typeof options.title === 'function'
|
|
170
|
+
? options.title
|
|
171
|
+
: typeof options.title === 'string'
|
|
172
|
+
? () => options.title
|
|
173
|
+
: () => this.originalTitle || '';
|
|
172
174
|
|
|
173
175
|
let actualTitle = title.call(this.triggerElement);
|
|
174
|
-
return
|
|
176
|
+
return !actualTitle || !actualTitle.trim().length ? undefined : actualTitle;
|
|
175
177
|
}
|
|
176
178
|
|
|
177
179
|
show() {
|
|
@@ -257,9 +259,9 @@ const getTooltipInstance = (domNode, options) => {
|
|
|
257
259
|
}
|
|
258
260
|
}
|
|
259
261
|
return tooltip;
|
|
260
|
-
}
|
|
262
|
+
};
|
|
261
263
|
|
|
262
|
-
const namespacify = events => events.map(event => `${event}.${pluginKey}`).join(' ');
|
|
264
|
+
const namespacify = (events) => events.map((event) => `${event}.${pluginKey}`).join(' ');
|
|
263
265
|
|
|
264
266
|
const activationEvents = namespacify(['mouseenter', 'focus']);
|
|
265
267
|
const deactivationEvents = namespacify(['click', 'mouseleave', 'blur']);
|
|
@@ -282,7 +284,7 @@ $.fn.tooltip = function (arg) {
|
|
|
282
284
|
const commandName = arg;
|
|
283
285
|
|
|
284
286
|
if (typeof tooltip[commandName] !== 'function') {
|
|
285
|
-
throw new Error(`Method ${commandName} does not exist on tooltip.`)
|
|
287
|
+
throw new Error(`Method ${commandName} does not exist on tooltip.`);
|
|
286
288
|
}
|
|
287
289
|
|
|
288
290
|
tooltip[commandName]();
|
|
@@ -308,7 +310,7 @@ $.fn.tooltip = function (arg) {
|
|
|
308
310
|
clearAllTimers();
|
|
309
311
|
hide();
|
|
310
312
|
});
|
|
311
|
-
}
|
|
313
|
+
};
|
|
312
314
|
|
|
313
315
|
const show = function () {
|
|
314
316
|
// Stop all events that were triggered by different tooltip
|
|
@@ -320,8 +322,7 @@ $.fn.tooltip = function (arg) {
|
|
|
320
322
|
tooltip.show();
|
|
321
323
|
$sharedTip && updateTooltipEvents();
|
|
322
324
|
}, AUI_TOOLTIP_TIMEOUT);
|
|
323
|
-
|
|
324
|
-
}
|
|
325
|
+
};
|
|
325
326
|
|
|
326
327
|
const hide = function () {
|
|
327
328
|
// Stop all events that were triggered by different tooltip
|
|
@@ -331,13 +332,13 @@ $.fn.tooltip = function (arg) {
|
|
|
331
332
|
hideTimeoutId = setTimeout(() => {
|
|
332
333
|
tooltip.hide();
|
|
333
334
|
}, AUI_TOOLTIP_TIMEOUT);
|
|
334
|
-
}
|
|
335
|
+
};
|
|
335
336
|
|
|
336
337
|
const hideOnEsc = function (e) {
|
|
337
338
|
if (e.code === 'Escape') {
|
|
338
339
|
hide();
|
|
339
340
|
}
|
|
340
|
-
}
|
|
341
|
+
};
|
|
341
342
|
|
|
342
343
|
const selector = options.live;
|
|
343
344
|
if (selector !== undefined) {
|
package/src/js/aui/trigger.js
CHANGED
|
@@ -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
|
|
8
|
+
export function getTrigger(element) {
|
|
9
9
|
return state(element).get('last-trigger') || findControllers(element)[0];
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export function setTrigger
|
|
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
|
|
17
|
+
export function hasTrigger(element) {
|
|
18
18
|
return !!getTrigger(element);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
export function doIfTrigger
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import globalize from './internal/globalize';
|
|
2
2
|
import onTextResize from './on-text-resize';
|
|
3
3
|
|
|
4
|
-
function unbindTextResize
|
|
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);
|
package/src/js/aui/unique-id.js
CHANGED
|
@@ -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 =
|
|
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(
|
|
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
|
|
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 =
|
|
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
|
|
136
|
-
|
|
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(
|
|
145
|
-
|
|
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/
|
|
154
|
-
.replace(/Shift/
|
|
179
|
+
.replace(/Meta/gi, '\u2318') //Apple cmd key
|
|
180
|
+
.replace(/Shift/gi, '\u21E7'); //Apple Shift symbol
|
|
155
181
|
kbShortcutAppendedScreenReader = kbShortcutAppendedScreenReader
|
|
156
|
-
.replace(/Meta/
|
|
157
|
-
.replace(/Shift/
|
|
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 +=
|
|
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 && {
|
|
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(
|
|
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(
|
|
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,
|
|
581
|
-
true
|
|
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
|
});
|