@vonage/vivid 4.22.0 → 4.24.0
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/custom-elements.json +1658 -370
- package/lib/accordion-item/accordion-item.d.ts +11 -5
- package/lib/action-group/action-group.d.ts +8 -6
- package/lib/alert/alert.d.ts +21 -9
- package/lib/audio-player/audio-player.d.ts +11 -5
- package/lib/badge/badge.d.ts +11 -5
- package/lib/banner/banner.d.ts +26 -12
- package/lib/breadcrumb/breadcrumb.d.ts +333 -1
- package/lib/breadcrumb/breadcrumb.template.d.ts +2 -3
- package/lib/breadcrumb-item/breadcrumb-item.d.ts +8 -6
- package/lib/button/button.d.ts +11 -5
- package/lib/calendar-event/calendar-event.d.ts +333 -1
- package/lib/checkbox/checkbox.d.ts +8 -6
- package/lib/combobox/combobox.d.ts +11 -5
- package/lib/date-picker/date-picker.d.ts +74 -50
- package/lib/date-range-picker/date-range-picker.d.ts +38 -26
- package/lib/date-time-picker/date-time-picker.d.ts +76 -52
- package/lib/dial-pad/dial-pad.d.ts +11 -5
- package/lib/dialog/dialog.d.ts +16 -8
- package/lib/divider/divider.d.ts +8 -6
- package/lib/fab/fab.d.ts +11 -5
- package/lib/file-picker/file-picker.d.ts +337 -1
- package/lib/file-picker/locale.d.ts +1 -0
- package/lib/header/header.d.ts +333 -1
- package/lib/menu/menu.d.ts +16 -8
- package/lib/menu-item/menu-item.d.ts +338 -2
- package/lib/nav/nav.d.ts +333 -1
- package/lib/nav-disclosure/nav-disclosure.d.ts +16 -8
- package/lib/nav-item/nav-item.d.ts +11 -5
- package/lib/note/note.d.ts +11 -5
- package/lib/number-field/number-field.d.ts +26 -12
- package/lib/option/option.d.ts +339 -3
- package/lib/progress/progress.d.ts +8 -6
- package/lib/progress-ring/progress-ring.d.ts +8 -6
- package/lib/radio-group/radio-group.d.ts +333 -1
- package/lib/range-slider/range-slider.d.ts +11 -5
- package/lib/rich-text-editor/facades/prose-mirror-vivid.schema.d.ts +1 -1
- package/lib/rich-text-editor/facades/vivid-prose-mirror.facade.d.ts +7 -1
- package/lib/rich-text-editor/locale.d.ts +9 -0
- package/lib/rich-text-editor/menubar/consts.d.ts +18 -0
- package/lib/rich-text-editor/menubar/menubar.d.ts +337 -1
- package/lib/rich-text-editor/rich-text-editor.d.ts +10 -0
- package/lib/searchable-select/locale.d.ts +1 -0
- package/lib/searchable-select/option-tag.d.ts +11 -5
- package/lib/searchable-select/searchable-select.d.ts +350 -7
- package/lib/select/select.d.ts +339 -3
- package/lib/selectable-box/selectable-box.d.ts +8 -6
- package/lib/slider/slider.d.ts +16 -8
- package/lib/split-button/split-button.d.ts +26 -12
- package/lib/switch/switch.d.ts +8 -6
- package/lib/tab/tab.d.ts +349 -7
- package/lib/tab-panel/tab-panel.d.ts +333 -1
- package/lib/tabs/tabs.d.ts +5 -21
- package/lib/tag/tag.d.ts +338 -2
- package/lib/tag-group/tag-group.d.ts +8 -6
- package/lib/text-anchor/text-anchor.d.ts +16 -8
- package/lib/text-area/text-area.d.ts +8 -6
- package/lib/text-field/text-field.d.ts +16 -8
- package/lib/time-picker/time-picker.d.ts +38 -26
- package/lib/toggletip/toggletip.d.ts +9 -3
- package/lib/tooltip/tooltip.d.ts +9 -3
- package/lib/tree-item/tree-item.d.ts +338 -2
- package/lib/tree-view/tree-view.d.ts +333 -1
- package/lib/video-player/video-player.d.ts +11 -5
- package/locales/de-DE.cjs +15 -1
- package/locales/de-DE.js +15 -1
- package/locales/en-GB.cjs +15 -1
- package/locales/en-GB.js +15 -1
- package/locales/en-US.cjs +15 -1
- package/locales/en-US.js +15 -1
- package/locales/ja-JP.cjs +15 -1
- package/locales/ja-JP.js +15 -1
- package/locales/zh-CN.cjs +15 -1
- package/locales/zh-CN.js +15 -1
- package/package.json +1 -1
- package/shared/affix.js +1 -1
- package/shared/aria/aria-change-subscription.d.ts +6 -0
- package/shared/aria/aria-mixin.d.ts +338 -0
- package/shared/aria/delegate-aria-behavior.d.ts +31 -0
- package/shared/aria/delegates-aria.d.ts +14 -9
- package/shared/aria/host-semantics-behavior.d.ts +22 -0
- package/shared/aria/host-semantics.d.ts +337 -0
- package/shared/attribute-binding-behaviour.cjs +41 -0
- package/shared/attribute-binding-behaviour.js +39 -0
- package/shared/button.cjs +6 -3
- package/shared/button.js +6 -3
- package/shared/calendar-event.cjs +2 -1
- package/shared/calendar-event.js +2 -1
- package/shared/definition.js +1 -1
- package/shared/definition10.cjs +8 -2
- package/shared/definition10.js +9 -3
- package/shared/definition11.cjs +4 -28
- package/shared/definition11.js +5 -29
- package/shared/definition12.cjs +5 -2
- package/shared/definition12.js +6 -3
- package/shared/definition13.js +1 -1
- package/shared/definition14.js +1 -1
- package/shared/definition15.cjs +8 -7
- package/shared/definition15.js +10 -9
- package/shared/definition16.js +1 -1
- package/shared/definition17.cjs +4 -1
- package/shared/definition17.js +5 -2
- package/shared/definition18.js +1 -1
- package/shared/definition19.js +1 -1
- package/shared/definition2.js +1 -1
- package/shared/definition20.js +1 -1
- package/shared/definition21.js +1 -1
- package/shared/definition22.cjs +11 -4
- package/shared/definition22.js +13 -6
- package/shared/definition23.cjs +4 -2
- package/shared/definition23.js +6 -4
- package/shared/definition24.js +1 -1
- package/shared/definition25.cjs +2 -14
- package/shared/definition25.js +3 -15
- package/shared/definition26.cjs +19 -3
- package/shared/definition26.js +20 -4
- package/shared/definition27.cjs +3 -2
- package/shared/definition27.js +4 -3
- package/shared/definition28.js +1 -1
- package/shared/definition29.js +1 -1
- package/shared/definition3.cjs +3 -2
- package/shared/definition3.js +5 -4
- package/shared/definition30.cjs +33 -34
- package/shared/definition30.js +35 -36
- package/shared/definition31.cjs +6 -4
- package/shared/definition31.js +8 -6
- package/shared/definition32.js +1 -1
- package/shared/definition33.cjs +7 -2
- package/shared/definition33.js +8 -3
- package/shared/definition34.js +1 -1
- package/shared/definition35.cjs +2 -13
- package/shared/definition35.js +4 -15
- package/shared/definition36.cjs +8 -5
- package/shared/definition36.js +9 -6
- package/shared/definition37.js +1 -1
- package/shared/definition38.cjs +7 -8
- package/shared/definition38.js +9 -10
- package/shared/definition39.cjs +7 -8
- package/shared/definition39.js +9 -10
- package/shared/definition4.js +1 -1
- package/shared/definition40.cjs +8 -5
- package/shared/definition40.js +9 -6
- package/shared/definition41.js +1 -1
- package/shared/definition42.js +1 -1
- package/shared/definition43.cjs +558 -134
- package/shared/definition43.js +550 -126
- package/shared/definition44.cjs +83 -10
- package/shared/definition44.js +84 -11
- package/shared/definition45.cjs +20 -8
- package/shared/definition45.js +21 -9
- package/shared/definition46.cjs +18 -6
- package/shared/definition46.js +20 -8
- package/shared/definition47.js +1 -1
- package/shared/definition48.js +1 -1
- package/shared/definition49.cjs +10 -3
- package/shared/definition49.js +12 -5
- package/shared/definition5.cjs +7 -2
- package/shared/definition5.js +8 -3
- package/shared/definition50.cjs +8 -7
- package/shared/definition50.js +10 -9
- package/shared/definition51.cjs +3 -2
- package/shared/definition51.js +4 -3
- package/shared/definition52.cjs +8 -4
- package/shared/definition52.js +9 -5
- package/shared/definition53.cjs +219 -297
- package/shared/definition53.js +221 -299
- package/shared/definition54.cjs +4 -3
- package/shared/definition54.js +6 -5
- package/shared/definition55.cjs +7 -4
- package/shared/definition55.js +8 -5
- package/shared/definition56.cjs +68 -14
- package/shared/definition56.js +69 -15
- package/shared/definition57.cjs +163 -112
- package/shared/definition57.js +165 -114
- package/shared/definition58.js +1 -1
- package/shared/definition59.js +1 -1
- package/shared/definition6.js +1 -1
- package/shared/definition60.js +1 -1
- package/shared/definition61.cjs +8 -5
- package/shared/definition61.js +9 -6
- package/shared/definition62.cjs +5 -2
- package/shared/definition62.js +6 -3
- package/shared/definition63.js +1 -1
- package/shared/definition64.js +1 -1
- package/shared/definition65.js +1 -1
- package/shared/definition7.js +1 -1
- package/shared/definition8.cjs +4 -2
- package/shared/definition8.js +6 -4
- package/shared/definition9.js +1 -1
- package/shared/delegates-aria.cjs +106 -56
- package/shared/delegates-aria.js +107 -58
- package/shared/foundation/button/button.d.ts +8 -6
- package/shared/foundation/vivid-element/vivid-element.d.ts +339 -1
- package/shared/host-semantics.cjs +65 -0
- package/shared/host-semantics.js +62 -0
- package/shared/localization/Locale.d.ts +2 -0
- package/shared/option.cjs +4 -1
- package/shared/option.js +4 -1
- package/shared/patterns/affix.d.ts +22 -10
- package/shared/patterns/anchored.d.ts +18 -6
- package/shared/patterns/localized.d.ts +11 -5
- package/shared/patterns/trapped-focus.d.ts +11 -5
- package/shared/picker-field/mixins/calendar-picker.d.ts +19 -13
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +19 -13
- package/shared/picker-field/mixins/inline-time-picker/inline-time-picker.d.ts +11 -5
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +38 -26
- package/shared/picker-field/mixins/single-date-picker.d.ts +55 -37
- package/shared/picker-field/mixins/single-value-picker.d.ts +17 -11
- package/shared/picker-field/mixins/time-selection-picker.d.ts +38 -26
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +38 -26
- package/shared/picker-field/picker-field.d.ts +21 -9
- package/shared/picker-field.template.js +1 -1
- package/shared/repeat.js +1 -1
- package/shared/slider.template.cjs +10 -9
- package/shared/slider.template.js +10 -9
- package/shared/templating/attribute-binding-behaviour.d.ts +15 -0
- package/shared/templating/render-in-light-dom.d.ts +22 -0
- package/shared/text-anchor.template.cjs +2 -13
- package/shared/text-anchor.template.js +2 -13
- package/shared/time-selection-picker.template.js +1 -1
- package/shared/vivid-element.cjs +96 -2
- package/shared/vivid-element.js +93 -3
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/text-anchor/index.js +1 -1
- package/vivid.api.json +188 -17
- package/shared/Reflector.cjs +0 -71
- package/shared/Reflector.js +0 -69
|
@@ -1,69 +1,119 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const attributeBindingBehaviour = require('./attribute-binding-behaviour.cjs');
|
|
3
4
|
const vividElement = require('./vivid-element.cjs');
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"ariaColSpan",
|
|
15
|
-
"ariaCurrent",
|
|
16
|
-
"ariaDescription",
|
|
17
|
-
"ariaDisabled",
|
|
18
|
-
"ariaExpanded",
|
|
19
|
-
"ariaHasPopup",
|
|
20
|
-
"ariaHidden",
|
|
21
|
-
"ariaInvalid",
|
|
22
|
-
"ariaKeyShortcuts",
|
|
23
|
-
"ariaLabel",
|
|
24
|
-
"ariaLevel",
|
|
25
|
-
"ariaLive",
|
|
26
|
-
"ariaModal",
|
|
27
|
-
"ariaMultiLine",
|
|
28
|
-
"ariaMultiSelectable",
|
|
29
|
-
"ariaOrientation",
|
|
30
|
-
"ariaPlaceholder",
|
|
31
|
-
"ariaPosInSet",
|
|
32
|
-
"ariaPressed",
|
|
33
|
-
"ariaReadOnly",
|
|
34
|
-
"ariaRequired",
|
|
35
|
-
"ariaRoleDescription",
|
|
36
|
-
"ariaRowCount",
|
|
37
|
-
"ariaRowIndex",
|
|
38
|
-
"ariaRowIndexText",
|
|
39
|
-
"ariaRowSpan",
|
|
40
|
-
"ariaSelected",
|
|
41
|
-
"ariaSetSize",
|
|
42
|
-
"ariaSort",
|
|
43
|
-
"ariaValueMax",
|
|
44
|
-
"ariaValueMin",
|
|
45
|
-
"ariaValueNow",
|
|
46
|
-
"ariaValueText",
|
|
47
|
-
"ariaRelevant"
|
|
48
|
-
// Non-standard
|
|
49
|
-
];
|
|
50
|
-
const ariaAttributeName = (ariaPropertyName) => ariaPropertyName.replace("aria", "aria-").toLowerCase();
|
|
51
|
-
const DelegatesAria = (Base) => {
|
|
52
|
-
class DelegatesAriaElement extends Base {
|
|
53
|
-
constructor(...rest) {
|
|
54
|
-
super(...rest);
|
|
55
|
-
for (const ariaProperty of ariaMixinProperties) {
|
|
56
|
-
this[ariaProperty] = null;
|
|
6
|
+
class DelegateAriaBehavior {
|
|
7
|
+
constructor(target, params) {
|
|
8
|
+
this.target = target;
|
|
9
|
+
this.source = null;
|
|
10
|
+
this.bindingBehaviours = [];
|
|
11
|
+
this.onSourceAriaPropertyChanged = (source, property) => {
|
|
12
|
+
this.mitigateAccessibilityIssues(source);
|
|
13
|
+
if (!this.forwardedProperties.has(property)) {
|
|
14
|
+
return;
|
|
57
15
|
}
|
|
16
|
+
this.forwardPropertyToTarget(this.target, property, source[property]);
|
|
17
|
+
};
|
|
18
|
+
this.boundProperties = params.boundProperties;
|
|
19
|
+
this.forwardedProperties = params.forwardedProperties;
|
|
20
|
+
this.isMitigationDisabled = params.disableAccessibilityMitigation;
|
|
21
|
+
}
|
|
22
|
+
bind(source) {
|
|
23
|
+
this.source = source;
|
|
24
|
+
this.bindPropertiesToTarget(source, this.boundProperties, this.target);
|
|
25
|
+
this.startForwardingPropertiesToTarget(
|
|
26
|
+
source,
|
|
27
|
+
this.forwardedProperties,
|
|
28
|
+
this.target
|
|
29
|
+
);
|
|
30
|
+
this.mitigateAccessibilityIssues(source);
|
|
31
|
+
}
|
|
32
|
+
unbind() {
|
|
33
|
+
if (this.source === null) {
|
|
34
|
+
return;
|
|
58
35
|
}
|
|
36
|
+
this.releasePropertyBindings(this.source);
|
|
37
|
+
this.stopForwardingPropertiesToTarget(this.source);
|
|
38
|
+
this.source = null;
|
|
59
39
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
40
|
+
bindPropertiesToTarget(source, boundProperties, target) {
|
|
41
|
+
for (const [property, binding] of Object.entries(boundProperties)) {
|
|
42
|
+
const bindingFn = binding instanceof Function ? binding : () => binding;
|
|
43
|
+
this.bindingBehaviours.push(
|
|
44
|
+
new attributeBindingBehaviour.AttributeBindingBehavior(
|
|
45
|
+
target,
|
|
46
|
+
bindingFn,
|
|
47
|
+
vividElement.Observable.isVolatileBinding(bindingFn),
|
|
48
|
+
vividElement.ariaAttributeName(property)
|
|
49
|
+
)
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
source.$fastController.addBehaviors(this.bindingBehaviours);
|
|
53
|
+
}
|
|
54
|
+
releasePropertyBindings(source) {
|
|
55
|
+
source.$fastController.removeBehaviors(this.bindingBehaviours);
|
|
56
|
+
this.bindingBehaviours = [];
|
|
57
|
+
}
|
|
58
|
+
startForwardingPropertiesToTarget(source, delegatedProperties, target) {
|
|
59
|
+
for (const key of delegatedProperties) {
|
|
60
|
+
this.forwardPropertyToTarget(target, key, source[key]);
|
|
61
|
+
}
|
|
62
|
+
vividElement.subscribeToAriaPropertyChanges(source, this.onSourceAriaPropertyChanged);
|
|
63
|
+
}
|
|
64
|
+
stopForwardingPropertiesToTarget(source) {
|
|
65
|
+
vividElement.unsubscribeFromAriaPropertyChanges(
|
|
66
|
+
source,
|
|
67
|
+
this.onSourceAriaPropertyChanged
|
|
64
68
|
);
|
|
65
69
|
}
|
|
70
|
+
forwardPropertyToTarget(target, property, value) {
|
|
71
|
+
vividElement.DOM.setAttribute(target, vividElement.ariaAttributeName(property), value);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Sets role to presentation unless there are properties present that prohibit it.
|
|
75
|
+
* Using role="presentation" will cause non-global states or properties to be ignored.
|
|
76
|
+
* See: https://www.w3.org/TR/wai-aria-1.3/#conflict_resolution_presentation_none
|
|
77
|
+
*/
|
|
78
|
+
mitigateAccessibilityIssues(source) {
|
|
79
|
+
if (this.isMitigationDisabled) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const hasProhibitedProperties = Boolean(
|
|
83
|
+
source.ariaLabel || source.ariaBrailleLabel || source.ariaChecked
|
|
84
|
+
);
|
|
85
|
+
if (hasProhibitedProperties) {
|
|
86
|
+
source.removeAttribute("role");
|
|
87
|
+
} else {
|
|
88
|
+
source.setAttribute("role", "presentation");
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function delegateAria(boundProperties = {}, options = {}) {
|
|
94
|
+
const forwardedProperties = new Set(
|
|
95
|
+
(options.onlySpecified ? [] : vividElement.ariaMixinProperties).filter((p) => p !== "role").filter((p) => !(p in boundProperties))
|
|
96
|
+
);
|
|
97
|
+
const disableAccessibilityMitigation = boundProperties.role instanceof Function;
|
|
98
|
+
return new vividElement.AttachedBehaviorHTMLDirective(
|
|
99
|
+
"vvd-delegate-aria",
|
|
100
|
+
DelegateAriaBehavior,
|
|
101
|
+
{
|
|
102
|
+
boundProperties,
|
|
103
|
+
forwardedProperties,
|
|
104
|
+
disableAccessibilityMitigation
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
const DelegatesAria = (Base) => {
|
|
109
|
+
class DelegatesAriaElement extends Base {
|
|
110
|
+
constructor() {
|
|
111
|
+
super(...arguments);
|
|
112
|
+
this._vividAriaBehaviour = "delegate";
|
|
113
|
+
}
|
|
114
|
+
}
|
|
66
115
|
return DelegatesAriaElement;
|
|
67
116
|
};
|
|
68
117
|
|
|
69
118
|
exports.DelegatesAria = DelegatesAria;
|
|
119
|
+
exports.delegateAria = delegateAria;
|
package/shared/delegates-aria.js
CHANGED
|
@@ -1,67 +1,116 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as AttributeBindingBehavior } from './attribute-binding-behaviour.js';
|
|
2
|
+
import { O as Observable, d as ariaAttributeName, s as subscribeToAriaPropertyChanges, u as unsubscribeFromAriaPropertyChanges, D as DOM, f as ariaMixinProperties, A as AttachedBehaviorHTMLDirective } from './vivid-element.js';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"ariaColSpan",
|
|
13
|
-
"ariaCurrent",
|
|
14
|
-
"ariaDescription",
|
|
15
|
-
"ariaDisabled",
|
|
16
|
-
"ariaExpanded",
|
|
17
|
-
"ariaHasPopup",
|
|
18
|
-
"ariaHidden",
|
|
19
|
-
"ariaInvalid",
|
|
20
|
-
"ariaKeyShortcuts",
|
|
21
|
-
"ariaLabel",
|
|
22
|
-
"ariaLevel",
|
|
23
|
-
"ariaLive",
|
|
24
|
-
"ariaModal",
|
|
25
|
-
"ariaMultiLine",
|
|
26
|
-
"ariaMultiSelectable",
|
|
27
|
-
"ariaOrientation",
|
|
28
|
-
"ariaPlaceholder",
|
|
29
|
-
"ariaPosInSet",
|
|
30
|
-
"ariaPressed",
|
|
31
|
-
"ariaReadOnly",
|
|
32
|
-
"ariaRequired",
|
|
33
|
-
"ariaRoleDescription",
|
|
34
|
-
"ariaRowCount",
|
|
35
|
-
"ariaRowIndex",
|
|
36
|
-
"ariaRowIndexText",
|
|
37
|
-
"ariaRowSpan",
|
|
38
|
-
"ariaSelected",
|
|
39
|
-
"ariaSetSize",
|
|
40
|
-
"ariaSort",
|
|
41
|
-
"ariaValueMax",
|
|
42
|
-
"ariaValueMin",
|
|
43
|
-
"ariaValueNow",
|
|
44
|
-
"ariaValueText",
|
|
45
|
-
"ariaRelevant"
|
|
46
|
-
// Non-standard
|
|
47
|
-
];
|
|
48
|
-
const ariaAttributeName = (ariaPropertyName) => ariaPropertyName.replace("aria", "aria-").toLowerCase();
|
|
49
|
-
const DelegatesAria = (Base) => {
|
|
50
|
-
class DelegatesAriaElement extends Base {
|
|
51
|
-
constructor(...rest) {
|
|
52
|
-
super(...rest);
|
|
53
|
-
for (const ariaProperty of ariaMixinProperties) {
|
|
54
|
-
this[ariaProperty] = null;
|
|
4
|
+
class DelegateAriaBehavior {
|
|
5
|
+
constructor(target, params) {
|
|
6
|
+
this.target = target;
|
|
7
|
+
this.source = null;
|
|
8
|
+
this.bindingBehaviours = [];
|
|
9
|
+
this.onSourceAriaPropertyChanged = (source, property) => {
|
|
10
|
+
this.mitigateAccessibilityIssues(source);
|
|
11
|
+
if (!this.forwardedProperties.has(property)) {
|
|
12
|
+
return;
|
|
55
13
|
}
|
|
14
|
+
this.forwardPropertyToTarget(this.target, property, source[property]);
|
|
15
|
+
};
|
|
16
|
+
this.boundProperties = params.boundProperties;
|
|
17
|
+
this.forwardedProperties = params.forwardedProperties;
|
|
18
|
+
this.isMitigationDisabled = params.disableAccessibilityMitigation;
|
|
19
|
+
}
|
|
20
|
+
bind(source) {
|
|
21
|
+
this.source = source;
|
|
22
|
+
this.bindPropertiesToTarget(source, this.boundProperties, this.target);
|
|
23
|
+
this.startForwardingPropertiesToTarget(
|
|
24
|
+
source,
|
|
25
|
+
this.forwardedProperties,
|
|
26
|
+
this.target
|
|
27
|
+
);
|
|
28
|
+
this.mitigateAccessibilityIssues(source);
|
|
29
|
+
}
|
|
30
|
+
unbind() {
|
|
31
|
+
if (this.source === null) {
|
|
32
|
+
return;
|
|
56
33
|
}
|
|
34
|
+
this.releasePropertyBindings(this.source);
|
|
35
|
+
this.stopForwardingPropertiesToTarget(this.source);
|
|
36
|
+
this.source = null;
|
|
57
37
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
38
|
+
bindPropertiesToTarget(source, boundProperties, target) {
|
|
39
|
+
for (const [property, binding] of Object.entries(boundProperties)) {
|
|
40
|
+
const bindingFn = binding instanceof Function ? binding : () => binding;
|
|
41
|
+
this.bindingBehaviours.push(
|
|
42
|
+
new AttributeBindingBehavior(
|
|
43
|
+
target,
|
|
44
|
+
bindingFn,
|
|
45
|
+
Observable.isVolatileBinding(bindingFn),
|
|
46
|
+
ariaAttributeName(property)
|
|
47
|
+
)
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
source.$fastController.addBehaviors(this.bindingBehaviours);
|
|
51
|
+
}
|
|
52
|
+
releasePropertyBindings(source) {
|
|
53
|
+
source.$fastController.removeBehaviors(this.bindingBehaviours);
|
|
54
|
+
this.bindingBehaviours = [];
|
|
55
|
+
}
|
|
56
|
+
startForwardingPropertiesToTarget(source, delegatedProperties, target) {
|
|
57
|
+
for (const key of delegatedProperties) {
|
|
58
|
+
this.forwardPropertyToTarget(target, key, source[key]);
|
|
59
|
+
}
|
|
60
|
+
subscribeToAriaPropertyChanges(source, this.onSourceAriaPropertyChanged);
|
|
61
|
+
}
|
|
62
|
+
stopForwardingPropertiesToTarget(source) {
|
|
63
|
+
unsubscribeFromAriaPropertyChanges(
|
|
64
|
+
source,
|
|
65
|
+
this.onSourceAriaPropertyChanged
|
|
62
66
|
);
|
|
63
67
|
}
|
|
68
|
+
forwardPropertyToTarget(target, property, value) {
|
|
69
|
+
DOM.setAttribute(target, ariaAttributeName(property), value);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Sets role to presentation unless there are properties present that prohibit it.
|
|
73
|
+
* Using role="presentation" will cause non-global states or properties to be ignored.
|
|
74
|
+
* See: https://www.w3.org/TR/wai-aria-1.3/#conflict_resolution_presentation_none
|
|
75
|
+
*/
|
|
76
|
+
mitigateAccessibilityIssues(source) {
|
|
77
|
+
if (this.isMitigationDisabled) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const hasProhibitedProperties = Boolean(
|
|
81
|
+
source.ariaLabel || source.ariaBrailleLabel || source.ariaChecked
|
|
82
|
+
);
|
|
83
|
+
if (hasProhibitedProperties) {
|
|
84
|
+
source.removeAttribute("role");
|
|
85
|
+
} else {
|
|
86
|
+
source.setAttribute("role", "presentation");
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function delegateAria(boundProperties = {}, options = {}) {
|
|
92
|
+
const forwardedProperties = new Set(
|
|
93
|
+
(options.onlySpecified ? [] : ariaMixinProperties).filter((p) => p !== "role").filter((p) => !(p in boundProperties))
|
|
94
|
+
);
|
|
95
|
+
const disableAccessibilityMitigation = boundProperties.role instanceof Function;
|
|
96
|
+
return new AttachedBehaviorHTMLDirective(
|
|
97
|
+
"vvd-delegate-aria",
|
|
98
|
+
DelegateAriaBehavior,
|
|
99
|
+
{
|
|
100
|
+
boundProperties,
|
|
101
|
+
forwardedProperties,
|
|
102
|
+
disableAccessibilityMitigation
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
const DelegatesAria = (Base) => {
|
|
107
|
+
class DelegatesAriaElement extends Base {
|
|
108
|
+
constructor() {
|
|
109
|
+
super(...arguments);
|
|
110
|
+
this._vividAriaBehaviour = "delegate";
|
|
111
|
+
}
|
|
112
|
+
}
|
|
64
113
|
return DelegatesAriaElement;
|
|
65
114
|
};
|
|
66
115
|
|
|
67
|
-
export { DelegatesAria as D };
|
|
116
|
+
export { DelegatesAria as D, delegateAria as d };
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { FormAssociatedButton } from './button.form-associated';
|
|
2
2
|
declare const VividFoundationButton_base: {
|
|
3
|
-
new (...
|
|
3
|
+
new (...args: any[]): {
|
|
4
|
+
_vividAriaBehaviour: "delegate";
|
|
5
|
+
specialHandling: boolean;
|
|
6
|
+
readonly $fastController: import("@microsoft/fast-element").Controller;
|
|
7
|
+
$emit(type: string, detail?: any, options?: Omit<CustomEventInit<any>, "detail"> | undefined): boolean | void;
|
|
8
|
+
connectedCallback(): void;
|
|
9
|
+
disconnectedCallback(): void;
|
|
10
|
+
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
4
11
|
accessKey: string;
|
|
5
12
|
readonly accessKeyLabel: string;
|
|
6
13
|
autocapitalize: string;
|
|
@@ -317,11 +324,6 @@ declare const VividFoundationButton_base: {
|
|
|
317
324
|
tabIndex: number;
|
|
318
325
|
blur(): void;
|
|
319
326
|
focus(options?: FocusOptions | undefined): void;
|
|
320
|
-
readonly $fastController: import("@microsoft/fast-element").Controller;
|
|
321
|
-
$emit(type: string, detail?: any, options?: Omit<CustomEventInit<any>, "detail"> | undefined): boolean | void;
|
|
322
|
-
connectedCallback(): void;
|
|
323
|
-
disconnectedCallback(): void;
|
|
324
|
-
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
325
327
|
ariaColIndexText: string | null;
|
|
326
328
|
ariaDescription: string | null;
|
|
327
329
|
ariaRowIndexText: string | null;
|