@vonage/vivid 5.21.0 → 5.22.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/accordion/index.cjs +1 -1
- package/accordion/index.js +2 -2
- package/alert/index.cjs +1 -1
- package/alert/index.js +1 -1
- package/audio-player/index.cjs +3 -5
- package/audio-player/index.js +30 -32
- package/avatar/index.cjs +1 -1
- package/avatar/index.js +1 -1
- package/banner/index.cjs +1 -1
- package/banner/index.js +1 -1
- package/bundled/affix.cjs +4 -4
- package/bundled/affix.js +4 -4
- package/bundled/base-color-picker.cjs +2 -2
- package/bundled/base-color-picker.js +2 -2
- package/bundled/button.cjs +1 -1
- package/bundled/button.js +1 -1
- package/bundled/definition10.cjs +1 -1
- package/bundled/definition10.js +1 -1
- package/bundled/definition13.cjs +1 -1
- package/bundled/definition13.js +1 -1
- package/bundled/definition15.cjs +1 -1
- package/bundled/definition15.js +2 -2
- package/bundled/definition16.cjs +2 -2
- package/bundled/definition16.js +2 -2
- package/bundled/definition17.cjs +1 -1
- package/bundled/definition17.js +1 -1
- package/bundled/definition18.cjs +2 -2
- package/bundled/definition18.js +14 -5
- package/bundled/definition19.cjs +1 -1
- package/bundled/definition19.js +1 -1
- package/bundled/definition20.cjs +1 -1
- package/bundled/definition20.js +1 -1
- package/bundled/definition21.cjs +1 -1
- package/bundled/definition21.js +2 -2
- package/bundled/definition24.cjs +1 -1
- package/bundled/definition24.js +1 -1
- package/bundled/definition3.cjs +1 -1
- package/bundled/definition3.js +3 -3
- package/bundled/definition4.cjs +1 -1
- package/bundled/definition4.js +1 -1
- package/bundled/definition5.cjs +1 -1
- package/bundled/definition5.js +1 -1
- package/bundled/definition6.cjs +1 -1
- package/bundled/definition6.js +1 -1
- package/bundled/definition8.cjs +1 -1
- package/bundled/definition8.js +12 -6
- package/bundled/definition9.cjs +1 -1
- package/bundled/definition9.js +1 -1
- package/bundled/form-associated.cjs +1 -1
- package/bundled/form-associated.js +2 -2
- package/bundled/listbox.cjs +1 -1
- package/bundled/listbox.js +5 -5
- package/bundled/numberConverter.cjs +1 -1
- package/bundled/numberConverter.js +1 -1
- package/bundled/slider.template.cjs +1 -1
- package/bundled/slider.template.js +1 -1
- package/bundled/vivid-element.cjs +1 -1
- package/bundled/vivid-element.js +1 -1
- package/bundled/with-contextual-help.cjs +1 -1
- package/bundled/with-contextual-help.js +1 -1
- package/calendar/index.cjs +1 -1
- package/calendar/index.js +3 -3
- package/color-picker/index.cjs +20 -20
- package/color-picker/index.js +22 -22
- package/combobox/index.cjs +1 -1
- package/combobox/index.js +6 -6
- package/country-group/index.cjs +1 -1
- package/country-group/index.js +1 -1
- package/custom-elements.json +2880 -2838
- package/data-grid/index.cjs +2 -2
- package/data-grid/index.js +12 -10
- package/dial-pad/index.cjs +1 -1
- package/dial-pad/index.js +2 -2
- package/dialog/index.cjs +1 -1
- package/dialog/index.js +1 -1
- package/header/index.cjs +1 -1
- package/header/index.js +1 -1
- package/lib/audio-player/audio-player.d.ts +0 -1
- package/lib/calendar/helpers/calendar.keyboard-interactions.d.ts +1 -1
- package/lib/checkbox/checkbox.d.ts +16 -16
- package/lib/color-picker/color-picker.d.ts +16 -16
- package/lib/combobox/combobox.d.ts +21 -21
- package/lib/date-picker/date-picker.d.ts +26 -26
- package/lib/date-range-picker/date-range-picker.d.ts +14 -14
- package/lib/date-time-picker/date-time-picker.d.ts +24 -24
- package/lib/dial-pad/dial-pad.d.ts +1 -1
- package/lib/file-picker/file-picker.d.ts +21 -21
- package/lib/menu/menu.d.ts +1 -1
- package/lib/number-field/number-field.d.ts +22 -22
- package/lib/popup/popup.d.ts +2 -1
- package/lib/radio/radio.d.ts +16 -16
- package/lib/range-slider/range-slider.d.ts +10 -10
- package/lib/rich-text-editor/popover.d.ts +1 -1
- package/lib/rich-text-editor/rte/exports.d.ts +1 -0
- package/lib/rich-text-editor/rte/feature.d.ts +5 -5
- package/lib/rich-text-editor/rte/features/drop-handler.d.ts +1 -2
- package/lib/rich-text-editor/rte/features/internal/core.d.ts +8 -0
- package/lib/rich-text-editor/rte/features/keyboard-shortcuts.d.ts +1 -1
- package/lib/rich-text-editor/rte/features/text-color-picker.d.ts +1 -1
- package/lib/rich-text-editor/rte/instance.d.ts +1 -0
- package/lib/rich-text-editor/rte/public-interface.d.ts +3 -0
- package/lib/rich-text-editor/rte/utils/ui.d.ts +1 -1
- package/lib/searchable-select/searchable-select.d.ts +21 -21
- package/lib/select/select.d.ts +22 -22
- package/lib/simple-color-picker/simple-color-picker.d.ts +5 -5
- package/lib/slider/slider.d.ts +5 -5
- package/lib/switch/switch.d.ts +5 -5
- package/lib/table/table-body.template.d.ts +1 -2
- package/lib/table/table-cell.template.d.ts +1 -2
- package/lib/table/table-head.template.d.ts +1 -2
- package/lib/table/table-row.template.d.ts +1 -2
- package/lib/table/table.template.d.ts +1 -2
- package/lib/text-area/text-area.d.ts +21 -21
- package/lib/text-field/text-field.d.ts +22 -22
- package/lib/time-picker/time-picker.d.ts +12 -12
- package/nav-disclosure/index.cjs +1 -1
- package/nav-disclosure/index.js +1 -1
- package/nav-item/index.cjs +1 -1
- package/nav-item/index.js +1 -1
- package/package.json +8 -6
- package/pagination/index.cjs +1 -1
- package/pagination/index.js +9 -2
- package/popover/index.cjs +1 -1
- package/popover/index.js +1 -1
- package/progress/index.cjs +1 -1
- package/progress/index.js +1 -1
- package/radio-group/index.cjs +1 -1
- package/radio-group/index.js +21 -19
- package/range-slider/index.cjs +1 -1
- package/range-slider/index.js +1 -1
- package/rich-text-editor/index.cjs +4 -3
- package/rich-text-editor/index.js +55 -27
- package/selectable-box/index.cjs +1 -1
- package/selectable-box/index.js +6 -1
- package/shared/color-picker/base-color-picker.d.ts +5 -5
- package/shared/feedback/mixins.d.ts +1 -1
- package/shared/foundation/button/button.d.ts +5 -5
- package/shared/foundation/form-associated/form-associated.d.ts +10 -10
- package/shared/foundation/listbox/listbox.d.ts +1 -1
- package/shared/patterns/form-elements/form-element.d.ts +5 -5
- package/shared/patterns/form-elements/with-contextual-help.d.ts +5 -5
- package/shared/patterns/form-elements/with-error-text.d.ts +6 -6
- package/shared/picker-field/mixins/calendar-picker.d.ts +6 -6
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +6 -6
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +8 -8
- package/shared/picker-field/mixins/single-date-picker.d.ts +6 -6
- package/shared/picker-field/mixins/single-value-picker.d.ts +6 -6
- package/shared/picker-field/mixins/time-selection-picker.d.ts +6 -6
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +12 -12
- package/shared/picker-field/picker-field.d.ts +21 -21
- package/shared/utils/slottable-request.d.ts +1 -1
- package/switch/index.cjs +1 -1
- package/switch/index.js +1 -1
- package/table/index.cjs +5 -5
- package/table/index.js +5 -5
- package/tabs/index.cjs +1 -1
- package/tabs/index.js +2 -2
- package/tag/index.cjs +1 -1
- package/tag/index.js +1 -1
- package/tree-view/index.cjs +1 -1
- package/tree-view/index.js +0 -2
- package/unbundled/affix.cjs +4 -4
- package/unbundled/affix.js +4 -4
- package/unbundled/base-color-picker.cjs +3 -3
- package/unbundled/base-color-picker.js +3 -3
- package/unbundled/button.cjs +5 -5
- package/unbundled/button.js +5 -5
- package/unbundled/definition10.cjs +15 -4
- package/unbundled/definition10.js +15 -4
- package/unbundled/definition11.cjs +3 -3
- package/unbundled/definition11.js +3 -3
- package/unbundled/definition12.cjs +1 -1
- package/unbundled/definition12.js +1 -1
- package/unbundled/definition13.cjs +2 -2
- package/unbundled/definition13.js +2 -2
- package/unbundled/definition14.cjs +73 -76
- package/unbundled/definition14.js +73 -76
- package/unbundled/definition15.cjs +1 -1
- package/unbundled/definition15.js +1 -1
- package/unbundled/definition17.cjs +1 -1
- package/unbundled/definition17.js +1 -1
- package/unbundled/definition19.cjs +2 -1
- package/unbundled/definition19.js +2 -1
- package/unbundled/definition2.cjs +1 -1
- package/unbundled/definition2.js +1 -1
- package/unbundled/definition21.cjs +3 -3
- package/unbundled/definition21.js +3 -3
- package/unbundled/definition23.cjs +2 -2
- package/unbundled/definition23.js +2 -2
- package/unbundled/definition24.cjs +1 -1
- package/unbundled/definition24.js +1 -1
- package/unbundled/definition27.cjs +1 -1
- package/unbundled/definition27.js +1 -1
- package/unbundled/definition28.cjs +23 -23
- package/unbundled/definition28.js +23 -23
- package/unbundled/definition29.cjs +1 -1
- package/unbundled/definition29.js +1 -1
- package/unbundled/definition3.cjs +2 -2
- package/unbundled/definition3.js +2 -2
- package/unbundled/definition30.cjs +7 -7
- package/unbundled/definition30.js +7 -7
- package/unbundled/definition32.cjs +1 -1
- package/unbundled/definition32.js +1 -1
- package/unbundled/definition34.cjs +9 -8
- package/unbundled/definition34.js +9 -8
- package/unbundled/definition35.cjs +1 -1
- package/unbundled/definition35.js +1 -1
- package/unbundled/definition39.cjs +2 -2
- package/unbundled/definition39.js +2 -2
- package/unbundled/definition40.cjs +1 -1
- package/unbundled/definition40.js +1 -1
- package/unbundled/definition44.cjs +1 -1
- package/unbundled/definition44.js +1 -1
- package/unbundled/definition48.cjs +1 -1
- package/unbundled/definition48.js +1 -1
- package/unbundled/definition49.cjs +1 -1
- package/unbundled/definition49.js +1 -1
- package/unbundled/definition5.cjs +1 -1
- package/unbundled/definition5.js +1 -1
- package/unbundled/definition53.cjs +10 -3
- package/unbundled/definition53.js +10 -3
- package/unbundled/definition55.cjs +1 -1
- package/unbundled/definition55.js +1 -1
- package/unbundled/definition56.cjs +1 -1
- package/unbundled/definition56.js +1 -1
- package/unbundled/definition57.cjs +4 -5
- package/unbundled/definition57.js +4 -5
- package/unbundled/definition58.cjs +20 -19
- package/unbundled/definition58.js +20 -19
- package/unbundled/definition59.cjs +1 -1
- package/unbundled/definition59.js +1 -1
- package/unbundled/definition60.cjs +47 -9
- package/unbundled/definition60.js +47 -9
- package/unbundled/definition61.cjs +12 -6
- package/unbundled/definition61.js +12 -6
- package/unbundled/definition64.cjs +4 -1
- package/unbundled/definition64.js +4 -1
- package/unbundled/definition65.cjs +2 -1
- package/unbundled/definition65.js +2 -1
- package/unbundled/definition69.cjs +3 -2
- package/unbundled/definition69.js +3 -2
- package/unbundled/definition7.cjs +1 -1
- package/unbundled/definition7.js +1 -1
- package/unbundled/definition71.cjs +1 -1
- package/unbundled/definition71.js +1 -1
- package/unbundled/definition72.cjs +5 -5
- package/unbundled/definition72.js +5 -5
- package/unbundled/definition73.cjs +2 -2
- package/unbundled/definition73.js +2 -2
- package/unbundled/definition75.cjs +1 -1
- package/unbundled/definition75.js +1 -1
- package/unbundled/definition78.cjs +1 -1
- package/unbundled/definition78.js +1 -1
- package/unbundled/definition79.cjs +0 -2
- package/unbundled/definition79.js +0 -2
- package/unbundled/definition80.cjs +1 -1
- package/unbundled/definition80.js +1 -1
- package/unbundled/definition9.cjs +1 -1
- package/unbundled/definition9.js +1 -1
- package/unbundled/form-associated.cjs +2 -2
- package/unbundled/form-associated.js +2 -2
- package/unbundled/listbox.cjs +7 -7
- package/unbundled/listbox.js +7 -7
- package/unbundled/numberConverter.cjs +1 -1
- package/unbundled/numberConverter.js +1 -1
- package/unbundled/slider.template.cjs +1 -1
- package/unbundled/slider.template.js +1 -1
- package/unbundled/slottable-request.cjs +5 -5
- package/unbundled/slottable-request.js +5 -5
- package/unbundled/vivid-element.cjs +1 -1
- package/unbundled/vivid-element.js +1 -1
- package/unbundled/with-contextual-help.cjs +4 -1
- package/unbundled/with-contextual-help.js +4 -1
- package/video-player/index.cjs +1 -1
- package/video-player/index.js +1 -1
- package/vivid.api.json +60 -18
|
@@ -21,7 +21,7 @@ function formatTime(time) {
|
|
|
21
21
|
if (!time || Number.isNaN(time)) return "0:00";
|
|
22
22
|
const min = Math.floor(time / 60);
|
|
23
23
|
const sec = Math.floor(time % 60);
|
|
24
|
-
return min
|
|
24
|
+
return `${min}:${sec < 10 ? `0${sec}` : sec}`;
|
|
25
25
|
}
|
|
26
26
|
var PAUSE = true;
|
|
27
27
|
var PLAY = false;
|
|
@@ -43,6 +43,75 @@ var validSkipByConverter = {
|
|
|
43
43
|
* @event {CustomEvent<undefined>} pause - Fires when the audio playback is paused.
|
|
44
44
|
*/
|
|
45
45
|
var AudioPlayer = class extends Localized(VividElement) {
|
|
46
|
+
constructor(..._args) {
|
|
47
|
+
super(..._args);
|
|
48
|
+
this.playButtonAriaLabel = null;
|
|
49
|
+
this.pauseButtonAriaLabel = null;
|
|
50
|
+
this.sliderAriaLabel = null;
|
|
51
|
+
this.skipForwardButtonAriaLabel = null;
|
|
52
|
+
this.skipBackwardButtonAriaLabel = null;
|
|
53
|
+
this.disabled = false;
|
|
54
|
+
this.notime = false;
|
|
55
|
+
this.playbackRates = null;
|
|
56
|
+
this.#playerEl = new Audio();
|
|
57
|
+
this.#isProgrammaticSliderUpdate = false;
|
|
58
|
+
this.durationFallback = false;
|
|
59
|
+
this.#onPlay = () => {
|
|
60
|
+
if (!this.#sliderEl?.isDragging) this.$emit("play", void 0, { bubbles: false });
|
|
61
|
+
};
|
|
62
|
+
this.#onPause = () => {
|
|
63
|
+
if (!this.#sliderEl?.isDragging) this.$emit("pause", void 0, { bubbles: false });
|
|
64
|
+
};
|
|
65
|
+
this.#pausedChanged = (pausing) => {
|
|
66
|
+
if (pausing === this.paused) {
|
|
67
|
+
this.#setPausedState();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (!this.paused) this.#playerEl.pause();
|
|
71
|
+
else {
|
|
72
|
+
this.#updateProgress();
|
|
73
|
+
this.#playerEl.play();
|
|
74
|
+
}
|
|
75
|
+
this.#setPausedState();
|
|
76
|
+
};
|
|
77
|
+
this.#updateProgress = () => {
|
|
78
|
+
Observable.notify(this, "currentTime");
|
|
79
|
+
const duration = this.duration;
|
|
80
|
+
const currentTime = this.currentTime;
|
|
81
|
+
const isValid = Number.isFinite(duration) && duration > 0 && Number.isFinite(currentTime) && currentTime >= 0;
|
|
82
|
+
const percent = isValid ? currentTime / duration * 100 : 0;
|
|
83
|
+
/* v8 ignore else -- @preserve */
|
|
84
|
+
if (this.#sliderEl) {
|
|
85
|
+
this.#isProgrammaticSliderUpdate = true;
|
|
86
|
+
this.#sliderEl.value = percent.toString();
|
|
87
|
+
this.#isProgrammaticSliderUpdate = false;
|
|
88
|
+
}
|
|
89
|
+
if (isValid && percent === 100) this.pause();
|
|
90
|
+
};
|
|
91
|
+
this.#updateTotalTime = () => {
|
|
92
|
+
Observable.notify(this, "duration");
|
|
93
|
+
if (!Number.isFinite(this.#playerEl.duration) || this.#playerEl.duration <= 0) {
|
|
94
|
+
if (this.durationFallback) this.#fetchAndCacheAudioBuffer();
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
this.#updateCurrentTimeOnSliderChange = () => {
|
|
98
|
+
if (!this.paused && this.#sliderEl.isDragging) {
|
|
99
|
+
this.pause();
|
|
100
|
+
this.#dragInterval = window.setInterval(() => {
|
|
101
|
+
/* v8 ignore else -- @preserve */
|
|
102
|
+
if (!this.#sliderEl.isDragging || !this.isConnected) {
|
|
103
|
+
clearInterval(this.#dragInterval);
|
|
104
|
+
if (this.isConnected) this.play();
|
|
105
|
+
}
|
|
106
|
+
}, 0);
|
|
107
|
+
}
|
|
108
|
+
if (this.#isProgrammaticSliderUpdate) return;
|
|
109
|
+
this.currentTime = this.duration * Number(this.#sliderEl.value) / 100;
|
|
110
|
+
};
|
|
111
|
+
this.#setPausedState = () => {
|
|
112
|
+
Observable.notify(this, "paused");
|
|
113
|
+
};
|
|
114
|
+
}
|
|
46
115
|
/**
|
|
47
116
|
* @internal
|
|
48
117
|
*/
|
|
@@ -132,76 +201,6 @@ var AudioPlayer = class extends Localized(VividElement) {
|
|
|
132
201
|
}
|
|
133
202
|
#playerEl;
|
|
134
203
|
#isProgrammaticSliderUpdate;
|
|
135
|
-
constructor() {
|
|
136
|
-
super();
|
|
137
|
-
this.playButtonAriaLabel = null;
|
|
138
|
-
this.pauseButtonAriaLabel = null;
|
|
139
|
-
this.sliderAriaLabel = null;
|
|
140
|
-
this.skipForwardButtonAriaLabel = null;
|
|
141
|
-
this.skipBackwardButtonAriaLabel = null;
|
|
142
|
-
this.disabled = false;
|
|
143
|
-
this.notime = false;
|
|
144
|
-
this.playbackRates = null;
|
|
145
|
-
this.#playerEl = new Audio();
|
|
146
|
-
this.#isProgrammaticSliderUpdate = false;
|
|
147
|
-
this.durationFallback = false;
|
|
148
|
-
this.#onPlay = () => {
|
|
149
|
-
if (!this.#sliderEl?.isDragging) this.$emit("play", void 0, { bubbles: false });
|
|
150
|
-
};
|
|
151
|
-
this.#onPause = () => {
|
|
152
|
-
if (!this.#sliderEl?.isDragging) this.$emit("pause", void 0, { bubbles: false });
|
|
153
|
-
};
|
|
154
|
-
this.#pausedChanged = (pausing) => {
|
|
155
|
-
if (pausing === this.paused) {
|
|
156
|
-
this.#setPausedState();
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
if (!this.paused) this.#playerEl.pause();
|
|
160
|
-
else {
|
|
161
|
-
this.#updateProgress();
|
|
162
|
-
this.#playerEl.play();
|
|
163
|
-
}
|
|
164
|
-
this.#setPausedState();
|
|
165
|
-
};
|
|
166
|
-
this.#updateProgress = () => {
|
|
167
|
-
Observable.notify(this, "currentTime");
|
|
168
|
-
const duration = this.duration;
|
|
169
|
-
const currentTime = this.currentTime;
|
|
170
|
-
const isValid = Number.isFinite(duration) && duration > 0 && Number.isFinite(currentTime) && currentTime >= 0;
|
|
171
|
-
const percent = isValid ? currentTime / duration * 100 : 0;
|
|
172
|
-
/* v8 ignore else -- @preserve */
|
|
173
|
-
if (this.#sliderEl) {
|
|
174
|
-
this.#isProgrammaticSliderUpdate = true;
|
|
175
|
-
this.#sliderEl.value = percent.toString();
|
|
176
|
-
this.#isProgrammaticSliderUpdate = false;
|
|
177
|
-
}
|
|
178
|
-
if (isValid && percent === 100) this.pause();
|
|
179
|
-
};
|
|
180
|
-
this.#updateTotalTime = () => {
|
|
181
|
-
Observable.notify(this, "duration");
|
|
182
|
-
if (!Number.isFinite(this.#playerEl.duration) || this.#playerEl.duration <= 0) {
|
|
183
|
-
if (this.durationFallback) this.#fetchAndCacheAudioBuffer();
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
this.#updateCurrentTimeOnSliderChange = () => {
|
|
187
|
-
if (!this.paused && this.#sliderEl.isDragging) {
|
|
188
|
-
this.pause();
|
|
189
|
-
this.#dragInterval = window.setInterval(() => {
|
|
190
|
-
/* v8 ignore else -- @preserve */
|
|
191
|
-
if (!this.#sliderEl.isDragging || !this.isConnected) {
|
|
192
|
-
clearInterval(this.#dragInterval);
|
|
193
|
-
if (this.isConnected) this.play();
|
|
194
|
-
}
|
|
195
|
-
}, 0);
|
|
196
|
-
}
|
|
197
|
-
if (this.#isProgrammaticSliderUpdate) return;
|
|
198
|
-
/* v8 ignore else -- @preserve */
|
|
199
|
-
if (this.#playerEl) this.currentTime = this.duration * Number(this.#sliderEl.value) / 100;
|
|
200
|
-
};
|
|
201
|
-
this.#setPausedState = () => {
|
|
202
|
-
Observable.notify(this, "paused");
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
204
|
connectedCallback() {
|
|
206
205
|
super.connectedCallback();
|
|
207
206
|
this.#playerEl.addEventListener("timeupdate", this.#updateProgress);
|
|
@@ -274,7 +273,7 @@ __decorate([attr({
|
|
|
274
273
|
})], AudioPlayer.prototype, "durationFallback", void 0);
|
|
275
274
|
//#endregion
|
|
276
275
|
//#region src/lib/audio-player/audio-player.template.ts
|
|
277
|
-
var getClasses = ({ notime, disabled, duration, skipBy, playbackRates }) => classNames(["disabled",
|
|
276
|
+
var getClasses = ({ notime, disabled, duration, skipBy, playbackRates }) => classNames(["disabled", disabled || !duration], ["two-lines", !notime && (Boolean(Number(skipBy)) || Boolean(playbackRates))], ["playback", Boolean(playbackRates)]);
|
|
278
277
|
var isMenuItemChekced = (playbackRate, { parent }) => {
|
|
279
278
|
return playbackRate === parent.playbackRate;
|
|
280
279
|
};
|
|
@@ -329,12 +328,10 @@ function renderSlider(context) {
|
|
|
329
328
|
}
|
|
330
329
|
function renderTimestamp() {
|
|
331
330
|
return html` <div class="time-stamp">
|
|
332
|
-
<span class="current-time"
|
|
333
|
-
>${(x) => formatTime(x.currentTime || 0)}</span
|
|
334
|
-
>
|
|
331
|
+
<span class="current-time">${(x) => formatTime(x.currentTime || 0)}</span>
|
|
335
332
|
${when((x) => x.duration && x.duration !== Infinity, html`
|
|
336
333
|
<span>/</span>
|
|
337
|
-
<span class="total-time">${(x) => formatTime(x
|
|
334
|
+
<span class="total-time">${(x) => formatTime(x.duration)}</span>
|
|
338
335
|
`)}
|
|
339
336
|
</div>`;
|
|
340
337
|
}
|
|
@@ -41,7 +41,7 @@ var getClasses = ({ appearance, connotation, shape, size }) => (0, _microsoft_fa
|
|
|
41
41
|
*/
|
|
42
42
|
function renderIcon(iconTag) {
|
|
43
43
|
return _microsoft_fast_element.html`
|
|
44
|
-
<${iconTag} name="${(x) => x.icon ?
|
|
44
|
+
<${iconTag} name="${(x) => x.icon ? x.icon : "user-line"}"></${iconTag}>
|
|
45
45
|
`;
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
@@ -40,7 +40,7 @@ var getClasses = ({ appearance, connotation, shape, size }) => classNames("base"
|
|
|
40
40
|
*/
|
|
41
41
|
function renderIcon(iconTag) {
|
|
42
42
|
return html`
|
|
43
|
-
<${iconTag} name="${(x) => x.icon ?
|
|
43
|
+
<${iconTag} name="${(x) => x.icon ? x.icon : "user-line"}"></${iconTag}>
|
|
44
44
|
`;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
@@ -37,7 +37,7 @@ var Banner = class extends require_affix.AffixIcon(require_localized.Localized(r
|
|
|
37
37
|
this.removable = false;
|
|
38
38
|
this.#handleRemoveEnd = () => {
|
|
39
39
|
this.$emit("removed");
|
|
40
|
-
this.parentElement
|
|
40
|
+
this.parentElement?.removeChild(this);
|
|
41
41
|
};
|
|
42
42
|
this.#closeOnKeyDown = (e) => {
|
|
43
43
|
if (e.key !== "Escape" || !this.removable) return;
|
|
@@ -36,7 +36,7 @@ var Banner = class extends AffixIcon(Localized(DelegatesAria(VividElement))) {
|
|
|
36
36
|
this.removable = false;
|
|
37
37
|
this.#handleRemoveEnd = () => {
|
|
38
38
|
this.$emit("removed");
|
|
39
|
-
this.parentElement
|
|
39
|
+
this.parentElement?.removeChild(this);
|
|
40
40
|
};
|
|
41
41
|
this.#closeOnKeyDown = (e) => {
|
|
42
42
|
if (e.key !== "Escape" || !this.removable) return;
|
|
@@ -61,7 +61,8 @@ var Breadcrumb = class extends require_delegates_aria.DelegatesAria(require_vivi
|
|
|
61
61
|
*/
|
|
62
62
|
setAriaCurrent(item, isLastNode) {
|
|
63
63
|
const childNodeWithHref = this.findChildWithHref(item);
|
|
64
|
-
if (childNodeWithHref !== null) isLastNode
|
|
64
|
+
if (childNodeWithHref !== null) if (isLastNode) childNodeWithHref.setAttribute("aria-current", "page");
|
|
65
|
+
else childNodeWithHref.removeAttribute("aria-current");
|
|
65
66
|
}
|
|
66
67
|
};
|
|
67
68
|
require_decorate.__decorate([_microsoft_fast_element.observable], Breadcrumb.prototype, "slottedBreadcrumbItems", void 0);
|
|
@@ -60,7 +60,8 @@ var Breadcrumb = class extends DelegatesAria(VividElement) {
|
|
|
60
60
|
*/
|
|
61
61
|
setAriaCurrent(item, isLastNode) {
|
|
62
62
|
const childNodeWithHref = this.findChildWithHref(item);
|
|
63
|
-
if (childNodeWithHref !== null) isLastNode
|
|
63
|
+
if (childNodeWithHref !== null) if (isLastNode) childNodeWithHref.setAttribute("aria-current", "page");
|
|
64
|
+
else childNodeWithHref.removeAttribute("aria-current");
|
|
64
65
|
}
|
|
65
66
|
};
|
|
66
67
|
__decorate([observable], Breadcrumb.prototype, "slottedBreadcrumbItems", void 0);
|
|
@@ -93,7 +93,7 @@ var header = (context, hTagName) => {
|
|
|
93
93
|
`;
|
|
94
94
|
};
|
|
95
95
|
var AccordionItemTemplate = (context) => _microsoft_fast_element.html`
|
|
96
|
-
${(x) => header(context,
|
|
96
|
+
${(x) => header(context, `h${x.headinglevel}`)}
|
|
97
97
|
<div
|
|
98
98
|
id="${(x) => x.id}-panel"
|
|
99
99
|
aria-labelledby="${(x) => x.id}"
|
package/unbundled/definition2.js
CHANGED
|
@@ -92,7 +92,7 @@ var header = (context, hTagName) => {
|
|
|
92
92
|
`;
|
|
93
93
|
};
|
|
94
94
|
var AccordionItemTemplate = (context) => html`
|
|
95
|
-
${(x) => header(context,
|
|
95
|
+
${(x) => header(context, `h${x.headinglevel}`)}
|
|
96
96
|
<div
|
|
97
97
|
id="${(x) => x.id}-panel"
|
|
98
98
|
aria-labelledby="${(x) => x.id}"
|
|
@@ -44,7 +44,7 @@ function getDay(el) {
|
|
|
44
44
|
if (cellOrHeader) {
|
|
45
45
|
const { parentElement } = cellOrHeader;
|
|
46
46
|
/* v8 ignore else -- @preserve */
|
|
47
|
-
if (parentElement) return
|
|
47
|
+
if (parentElement) return Array.from(parentElement.children).indexOf(cellOrHeader);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
function getHour(e, el, hours) {
|
|
@@ -58,7 +58,7 @@ function getHour(e, el, hours) {
|
|
|
58
58
|
var getEventContext = function(e) {
|
|
59
59
|
if (!(e instanceof KeyboardEvent || e instanceof MouseEvent)) throw new Error("Invalid event. Event must be instance of KeyboardEvent or MouseEvent");
|
|
60
60
|
const [el] = e.composedPath();
|
|
61
|
-
if (!(el
|
|
61
|
+
if (!(el instanceof HTMLElement && this.shadowRoot.contains(el))) throw new Error("Invalid event. Event must contain a target object which is a direct descendant of calendar");
|
|
62
62
|
const day = getDay(el);
|
|
63
63
|
let hour;
|
|
64
64
|
if (e instanceof MouseEvent) hour = getHour(e, el, this._hours);
|
|
@@ -97,7 +97,7 @@ var Calendar = class extends require_vivid_element.VividElement {
|
|
|
97
97
|
this.stickyMode = require_enums.Sticky.All;
|
|
98
98
|
this._hours = 24;
|
|
99
99
|
this._days = 7;
|
|
100
|
-
this.hoursAsDatetime = Array.from({ length: this._hours - 1 }).fill(new Date((/* @__PURE__ */ new Date()).setHours(0, 0, 0))).map((d, i) => new Date(d.setHours(
|
|
100
|
+
this.hoursAsDatetime = Array.from({ length: this._hours - 1 }).fill(new Date((/* @__PURE__ */ new Date()).setHours(0, 0, 0))).map((d, i) => new Date(d.setHours(i + 1)));
|
|
101
101
|
this._generateDaysArr = (dateArr) => {
|
|
102
102
|
if (dateArr.length == this._days) return dateArr;
|
|
103
103
|
const lastDate = new Date(dateArr[dateArr.length - 1]);
|
|
@@ -43,7 +43,7 @@ function getDay(el) {
|
|
|
43
43
|
if (cellOrHeader) {
|
|
44
44
|
const { parentElement } = cellOrHeader;
|
|
45
45
|
/* v8 ignore else -- @preserve */
|
|
46
|
-
if (parentElement) return
|
|
46
|
+
if (parentElement) return Array.from(parentElement.children).indexOf(cellOrHeader);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
function getHour(e, el, hours) {
|
|
@@ -57,7 +57,7 @@ function getHour(e, el, hours) {
|
|
|
57
57
|
var getEventContext = function(e) {
|
|
58
58
|
if (!(e instanceof KeyboardEvent || e instanceof MouseEvent)) throw new Error("Invalid event. Event must be instance of KeyboardEvent or MouseEvent");
|
|
59
59
|
const [el] = e.composedPath();
|
|
60
|
-
if (!(el
|
|
60
|
+
if (!(el instanceof HTMLElement && this.shadowRoot.contains(el))) throw new Error("Invalid event. Event must contain a target object which is a direct descendant of calendar");
|
|
61
61
|
const day = getDay(el);
|
|
62
62
|
let hour;
|
|
63
63
|
if (e instanceof MouseEvent) hour = getHour(e, el, this._hours);
|
|
@@ -96,7 +96,7 @@ var Calendar = class extends VividElement {
|
|
|
96
96
|
this.stickyMode = Sticky.All;
|
|
97
97
|
this._hours = 24;
|
|
98
98
|
this._days = 7;
|
|
99
|
-
this.hoursAsDatetime = Array.from({ length: this._hours - 1 }).fill(new Date((/* @__PURE__ */ new Date()).setHours(0, 0, 0))).map((d, i) => new Date(d.setHours(
|
|
99
|
+
this.hoursAsDatetime = Array.from({ length: this._hours - 1 }).fill(new Date((/* @__PURE__ */ new Date()).setHours(0, 0, 0))).map((d, i) => new Date(d.setHours(i + 1)));
|
|
100
100
|
this._generateDaysArr = (dateArr) => {
|
|
101
101
|
if (dateArr.length == this._days) return dateArr;
|
|
102
102
|
const lastDate = new Date(dateArr[dateArr.length - 1]);
|
|
@@ -78,7 +78,7 @@ var Checkbox = class extends require_delegates_aria.DelegatesAria(require_mixins
|
|
|
78
78
|
*/
|
|
79
79
|
checkedChanged(prev, next) {
|
|
80
80
|
super.checkedChanged(prev, next);
|
|
81
|
-
this.ariaChecked = next
|
|
81
|
+
this.ariaChecked = next ? "true" : "false";
|
|
82
82
|
if (prev !== void 0) this.$emit("input");
|
|
83
83
|
}
|
|
84
84
|
};
|
|
@@ -96,7 +96,7 @@ require_decorate.__decorate([(0, _microsoft_fast_element.attr)({
|
|
|
96
96
|
require_decorate.__decorate([_microsoft_fast_element.observable], Checkbox.prototype, "slottedContent", void 0);
|
|
97
97
|
//#endregion
|
|
98
98
|
//#region src/lib/checkbox/checkbox.template.ts
|
|
99
|
-
var getClasses = ({ connotation, readOnly, checked, disabled, indeterminate, errorValidationMessage, successText, label, slottedContent }) => (0, _microsoft_fast_web_utilities.classNames)("base", [`connotation-${connotation}`, Boolean(connotation)], ["readonly",
|
|
99
|
+
var getClasses = ({ connotation, readOnly, checked, disabled, indeterminate, errorValidationMessage, successText, label, slottedContent }) => (0, _microsoft_fast_web_utilities.classNames)("base", [`connotation-${connotation}`, Boolean(connotation)], ["readonly", readOnly], ["checked", checked || indeterminate], ["disabled", disabled], ["error connotation-alert", Boolean(errorValidationMessage)], ["success connotation-success", !!successText], ["hide-label", !label && !slottedContent?.length]);
|
|
100
100
|
var CheckboxTemplate = (context) => {
|
|
101
101
|
const iconTag = context.tagFor(require_definition.Icon);
|
|
102
102
|
return _microsoft_fast_element.html`<template>
|
|
@@ -77,7 +77,7 @@ var Checkbox = class extends DelegatesAria(WithFeedback(WithErrorText(WithSucces
|
|
|
77
77
|
*/
|
|
78
78
|
checkedChanged(prev, next) {
|
|
79
79
|
super.checkedChanged(prev, next);
|
|
80
|
-
this.ariaChecked = next
|
|
80
|
+
this.ariaChecked = next ? "true" : "false";
|
|
81
81
|
if (prev !== void 0) this.$emit("input");
|
|
82
82
|
}
|
|
83
83
|
};
|
|
@@ -95,7 +95,7 @@ __decorate([attr({
|
|
|
95
95
|
__decorate([observable], Checkbox.prototype, "slottedContent", void 0);
|
|
96
96
|
//#endregion
|
|
97
97
|
//#region src/lib/checkbox/checkbox.template.ts
|
|
98
|
-
var getClasses = ({ connotation, readOnly, checked, disabled, indeterminate, errorValidationMessage, successText, label, slottedContent }) => classNames("base", [`connotation-${connotation}`, Boolean(connotation)], ["readonly",
|
|
98
|
+
var getClasses = ({ connotation, readOnly, checked, disabled, indeterminate, errorValidationMessage, successText, label, slottedContent }) => classNames("base", [`connotation-${connotation}`, Boolean(connotation)], ["readonly", readOnly], ["checked", checked || indeterminate], ["disabled", disabled], ["error connotation-alert", Boolean(errorValidationMessage)], ["success connotation-success", !!successText], ["hide-label", !label && !slottedContent?.length]);
|
|
99
99
|
var CheckboxTemplate = (context) => {
|
|
100
100
|
const iconTag = context.tagFor(Icon);
|
|
101
101
|
return html`<template>
|
|
@@ -70,7 +70,7 @@ var Toggletip = class extends require_localized.Localized(require_anchored.Ancho
|
|
|
70
70
|
#setupAnchor(a) {
|
|
71
71
|
a.addEventListener("click", this.#openIfClosed, true);
|
|
72
72
|
this.#originalAriaLabel = a.ariaLabel;
|
|
73
|
-
a.ariaLabel =
|
|
73
|
+
a.ariaLabel = this.locale.toggletip.anchorLabel(a.ariaLabel || "");
|
|
74
74
|
this.#updateAnchor(a);
|
|
75
75
|
}
|
|
76
76
|
#updateAnchor(a) {
|
|
@@ -69,7 +69,7 @@ var Toggletip = class extends Localized(Anchored(VividElement)) {
|
|
|
69
69
|
#setupAnchor(a) {
|
|
70
70
|
a.addEventListener("click", this.#openIfClosed, true);
|
|
71
71
|
this.#originalAriaLabel = a.ariaLabel;
|
|
72
|
-
a.ariaLabel =
|
|
72
|
+
a.ariaLabel = this.locale.toggletip.anchorLabel(a.ariaLabel || "");
|
|
73
73
|
this.#updateAnchor(a);
|
|
74
74
|
}
|
|
75
75
|
#updateAnchor(a) {
|
|
@@ -96,7 +96,7 @@ require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ mode: "fromView
|
|
|
96
96
|
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ mode: "boolean" })], Tooltip.prototype, "open", void 0);
|
|
97
97
|
//#endregion
|
|
98
98
|
//#region src/lib/tooltip/tooltip.template.ts
|
|
99
|
-
var getClasses = ({ open }) => (0, _microsoft_fast_web_utilities.classNames)("control", ["open",
|
|
99
|
+
var getClasses = ({ open }) => (0, _microsoft_fast_web_utilities.classNames)("control", ["open", open]);
|
|
100
100
|
var TooltipTemplate = (context) => {
|
|
101
101
|
const popupTag = context.tagFor(require_definition.Popup);
|
|
102
102
|
return _microsoft_fast_element.html`
|
|
@@ -95,7 +95,7 @@ __decorate([attr({ mode: "fromView" })], Tooltip.prototype, "placement", void 0)
|
|
|
95
95
|
__decorate([attr({ mode: "boolean" })], Tooltip.prototype, "open", void 0);
|
|
96
96
|
//#endregion
|
|
97
97
|
//#region src/lib/tooltip/tooltip.template.ts
|
|
98
|
-
var getClasses = ({ open }) => classNames("control", ["open",
|
|
98
|
+
var getClasses = ({ open }) => classNames("control", ["open", open]);
|
|
99
99
|
var TooltipTemplate = (context) => {
|
|
100
100
|
const popupTag = context.tagFor(Popup);
|
|
101
101
|
return html`
|
|
@@ -127,7 +127,7 @@ var ColorPicker = class extends require_with_contextual_help.WithContextualHelp(
|
|
|
127
127
|
const value = this.value;
|
|
128
128
|
if (typeof value !== "string" || !require_base_color_picker.isValidHexColor(value)) return;
|
|
129
129
|
const swatches = Array.isArray(this.savedColors) ? [...this.savedColors] : [];
|
|
130
|
-
const idx = swatches.findIndex((s) => s
|
|
130
|
+
const idx = swatches.findIndex((s) => s.value === value);
|
|
131
131
|
if (idx !== -1) swatches.splice(idx, 1);
|
|
132
132
|
swatches.unshift({ value });
|
|
133
133
|
this.savedColors = swatches.slice(0, this._maxSwatchesNormalized);
|
|
@@ -188,7 +188,7 @@ var ColorPicker = class extends require_with_contextual_help.WithContextualHelp(
|
|
|
188
188
|
*/
|
|
189
189
|
maxSwatchesChanged() {
|
|
190
190
|
const maxCount = this._maxSwatchesNormalized;
|
|
191
|
-
if (this.savedColors
|
|
191
|
+
if (this.savedColors.length > maxCount) {
|
|
192
192
|
this.savedColors = this.savedColors.slice(0, maxCount);
|
|
193
193
|
this._setSavedColors(this.savedColors);
|
|
194
194
|
}
|
|
@@ -197,7 +197,7 @@ var ColorPicker = class extends require_with_contextual_help.WithContextualHelp(
|
|
|
197
197
|
* @internal
|
|
198
198
|
*/
|
|
199
199
|
_onPickerColorChanged(e) {
|
|
200
|
-
if (typeof e.detail
|
|
200
|
+
if (typeof e.detail.value === "string") this.value = e.detail.value;
|
|
201
201
|
}
|
|
202
202
|
/**
|
|
203
203
|
* @internal
|
|
@@ -325,7 +325,7 @@ require_decorate.__decorate([_microsoft_fast_element.observable], ColorPicker.pr
|
|
|
325
325
|
function renderTextField(textFieldTag, iconTag) {
|
|
326
326
|
const getClasses = (_) => (0, _microsoft_fast_web_utilities.classNames)("control");
|
|
327
327
|
return _microsoft_fast_element.html`
|
|
328
|
-
<${textFieldTag}
|
|
328
|
+
<${textFieldTag}
|
|
329
329
|
id="text-field"
|
|
330
330
|
class="${getClasses}"
|
|
331
331
|
pattern="${ColorPicker.HEX_COLOR_PATTERN.source}"
|
|
@@ -349,15 +349,15 @@ function renderTextField(textFieldTag, iconTag) {
|
|
|
349
349
|
${require_delegates_aria.delegateAria()}
|
|
350
350
|
${(0, _microsoft_fast_element.ref)("_textFieldEl")}
|
|
351
351
|
>
|
|
352
|
-
<button
|
|
352
|
+
<button
|
|
353
353
|
aria-label="${(x) => x.locale.colorPicker.pickerButtonLabel}"
|
|
354
354
|
aria-expanded="${(x) => x.open}"
|
|
355
355
|
aria-haspopup="dialog"
|
|
356
|
-
class="button ${(x) => (0, _microsoft_fast_web_utilities.classNames)(x._applyContrastClass(x._buttonColor) ? "contrast" : "", x.disabled ? "disabled" : "")}"
|
|
357
|
-
style="--button-color: ${(x) => x._buttonColor};"
|
|
356
|
+
class="button ${(x) => (0, _microsoft_fast_web_utilities.classNames)(x._applyContrastClass(x._buttonColor) ? "contrast" : "", x.disabled ? "disabled" : "")}"
|
|
357
|
+
style="--button-color: ${(x) => x._buttonColor};"
|
|
358
358
|
?disabled="${(x) => x.disabled}"
|
|
359
359
|
@click="${(x) => x._onButtonClick()}"
|
|
360
|
-
slot="action-items"
|
|
360
|
+
slot="action-items"
|
|
361
361
|
${(0, _microsoft_fast_element.ref)("_buttonEl")}>
|
|
362
362
|
<${iconTag} name="edit-line"></${iconTag}>
|
|
363
363
|
</button>
|
|
@@ -380,8 +380,8 @@ function renderPopupHeader(buttonTag, iconTag) {
|
|
|
380
380
|
<h2 class="header-title" id="color-picker-title">
|
|
381
381
|
<slot name="popup-text">${(x) => x.locale.colorPicker.popupLabel}</slot>
|
|
382
382
|
</h2>
|
|
383
|
-
<${buttonTag} size="condensed"
|
|
384
|
-
aria-label="${(x) => x.locale.colorPicker.closeButtonLabel}"
|
|
383
|
+
<${buttonTag} size="condensed"
|
|
384
|
+
aria-label="${(x) => x.locale.colorPicker.closeButtonLabel}"
|
|
385
385
|
@click="${(x) => x._handleCloseRequest()}">
|
|
386
386
|
<${iconTag} slot="icon" name="close-line"></${iconTag}>
|
|
387
387
|
</${buttonTag}>
|
|
@@ -405,17 +405,17 @@ function renderPopupBody(buttonTag, iconTag, tooltipTag) {
|
|
|
405
405
|
@color-changed="${(x, c) => x._onPickerColorChanged(c.event)}"
|
|
406
406
|
${(0, _microsoft_fast_element.ref)("_vcHexInputEl")}
|
|
407
407
|
>
|
|
408
|
-
<input name="hex-code-input" aria-label="${(x) => x.locale.colorPicker.hexInputLabel}"
|
|
408
|
+
<input name="hex-code-input" aria-label="${(x) => x.locale.colorPicker.hexInputLabel}"
|
|
409
409
|
placeholder="${(x) => x.placeholder}"
|
|
410
|
-
@blur="${(
|
|
410
|
+
@blur="${(_, c) => c.event.stopImmediatePropagation()}"
|
|
411
411
|
part="input">
|
|
412
412
|
</${_microsoft_fast_element.html.partial(vcInputTag)}>
|
|
413
|
-
<${tooltipTag} placement="top"
|
|
414
|
-
text="${(x) => x.locale.colorPicker.copyButtonLabel}"
|
|
413
|
+
<${tooltipTag} placement="top"
|
|
414
|
+
text="${(x) => x.locale.colorPicker.copyButtonLabel}"
|
|
415
415
|
exportparts="vvd-theme-alternate">
|
|
416
|
-
<${buttonTag}
|
|
417
|
-
slot="anchor" size="normal"
|
|
418
|
-
aria-label="${(x) => x.locale.colorPicker.copyButtonLabel}"
|
|
416
|
+
<${buttonTag}
|
|
417
|
+
slot="anchor" size="normal"
|
|
418
|
+
aria-label="${(x) => x.locale.colorPicker.copyButtonLabel}"
|
|
419
419
|
@click="${(x) => x._copyValueToClipboard(x.value)}">
|
|
420
420
|
<${iconTag} slot="icon" name="${(x) => x.copyIconName}"></${iconTag}>
|
|
421
421
|
</${buttonTag}>
|
|
@@ -445,8 +445,8 @@ function renderPopupFooter(buttonTag, iconTag, tooltipTag) {
|
|
|
445
445
|
>
|
|
446
446
|
${(0, _microsoft_fast_element.repeat)((x) => x.allSwatches, (x) => x._renderColorSwatch(iconTag, tooltipTag), { positioning: true })}
|
|
447
447
|
${(0, _microsoft_fast_element.when)((x) => !x.disableSavedColors, _microsoft_fast_element.html`
|
|
448
|
-
<${tooltipTag} placement="top"
|
|
449
|
-
text="${(x) => x.locale.colorPicker.saveButtonLabel}"
|
|
448
|
+
<${tooltipTag} placement="top"
|
|
449
|
+
text="${(x) => x.locale.colorPicker.saveButtonLabel}"
|
|
450
450
|
exportparts="vvd-theme-alternate">
|
|
451
451
|
<${buttonTag}
|
|
452
452
|
slot="anchor"
|
|
@@ -491,11 +491,11 @@ var ColorPickerTemplate = (context) => {
|
|
|
491
491
|
:open="${(x) => x.open}"
|
|
492
492
|
:anchor="${(x) => x._buttonEl}"
|
|
493
493
|
placement="top"
|
|
494
|
-
offset="10"
|
|
494
|
+
offset="10"
|
|
495
495
|
${(0, _microsoft_fast_element.ref)("_popupEl")}>
|
|
496
|
-
<div class="dialog"
|
|
497
|
-
role="dialog"
|
|
498
|
-
aria-modal="true"
|
|
496
|
+
<div class="dialog"
|
|
497
|
+
role="dialog"
|
|
498
|
+
aria-modal="true"
|
|
499
499
|
aria-labelledby="color-picker-title">
|
|
500
500
|
${renderPopupHeader(buttonTag, iconTag)}
|
|
501
501
|
${renderPopupBody(buttonTag, iconTag, tooltipTag)}
|
|
@@ -126,7 +126,7 @@ var ColorPicker = class extends WithContextualHelp(WithFeedback(WithErrorText(Wi
|
|
|
126
126
|
const value = this.value;
|
|
127
127
|
if (typeof value !== "string" || !isValidHexColor(value)) return;
|
|
128
128
|
const swatches = Array.isArray(this.savedColors) ? [...this.savedColors] : [];
|
|
129
|
-
const idx = swatches.findIndex((s) => s
|
|
129
|
+
const idx = swatches.findIndex((s) => s.value === value);
|
|
130
130
|
if (idx !== -1) swatches.splice(idx, 1);
|
|
131
131
|
swatches.unshift({ value });
|
|
132
132
|
this.savedColors = swatches.slice(0, this._maxSwatchesNormalized);
|
|
@@ -187,7 +187,7 @@ var ColorPicker = class extends WithContextualHelp(WithFeedback(WithErrorText(Wi
|
|
|
187
187
|
*/
|
|
188
188
|
maxSwatchesChanged() {
|
|
189
189
|
const maxCount = this._maxSwatchesNormalized;
|
|
190
|
-
if (this.savedColors
|
|
190
|
+
if (this.savedColors.length > maxCount) {
|
|
191
191
|
this.savedColors = this.savedColors.slice(0, maxCount);
|
|
192
192
|
this._setSavedColors(this.savedColors);
|
|
193
193
|
}
|
|
@@ -196,7 +196,7 @@ var ColorPicker = class extends WithContextualHelp(WithFeedback(WithErrorText(Wi
|
|
|
196
196
|
* @internal
|
|
197
197
|
*/
|
|
198
198
|
_onPickerColorChanged(e) {
|
|
199
|
-
if (typeof e.detail
|
|
199
|
+
if (typeof e.detail.value === "string") this.value = e.detail.value;
|
|
200
200
|
}
|
|
201
201
|
/**
|
|
202
202
|
* @internal
|
|
@@ -324,7 +324,7 @@ __decorate([observable], ColorPicker.prototype, "_ariaLiveDescription", void 0);
|
|
|
324
324
|
function renderTextField(textFieldTag, iconTag) {
|
|
325
325
|
const getClasses = (_) => classNames("control");
|
|
326
326
|
return html`
|
|
327
|
-
<${textFieldTag}
|
|
327
|
+
<${textFieldTag}
|
|
328
328
|
id="text-field"
|
|
329
329
|
class="${getClasses}"
|
|
330
330
|
pattern="${ColorPicker.HEX_COLOR_PATTERN.source}"
|
|
@@ -348,15 +348,15 @@ function renderTextField(textFieldTag, iconTag) {
|
|
|
348
348
|
${delegateAria()}
|
|
349
349
|
${ref("_textFieldEl")}
|
|
350
350
|
>
|
|
351
|
-
<button
|
|
351
|
+
<button
|
|
352
352
|
aria-label="${(x) => x.locale.colorPicker.pickerButtonLabel}"
|
|
353
353
|
aria-expanded="${(x) => x.open}"
|
|
354
354
|
aria-haspopup="dialog"
|
|
355
|
-
class="button ${(x) => classNames(x._applyContrastClass(x._buttonColor) ? "contrast" : "", x.disabled ? "disabled" : "")}"
|
|
356
|
-
style="--button-color: ${(x) => x._buttonColor};"
|
|
355
|
+
class="button ${(x) => classNames(x._applyContrastClass(x._buttonColor) ? "contrast" : "", x.disabled ? "disabled" : "")}"
|
|
356
|
+
style="--button-color: ${(x) => x._buttonColor};"
|
|
357
357
|
?disabled="${(x) => x.disabled}"
|
|
358
358
|
@click="${(x) => x._onButtonClick()}"
|
|
359
|
-
slot="action-items"
|
|
359
|
+
slot="action-items"
|
|
360
360
|
${ref("_buttonEl")}>
|
|
361
361
|
<${iconTag} name="edit-line"></${iconTag}>
|
|
362
362
|
</button>
|
|
@@ -379,8 +379,8 @@ function renderPopupHeader(buttonTag, iconTag) {
|
|
|
379
379
|
<h2 class="header-title" id="color-picker-title">
|
|
380
380
|
<slot name="popup-text">${(x) => x.locale.colorPicker.popupLabel}</slot>
|
|
381
381
|
</h2>
|
|
382
|
-
<${buttonTag} size="condensed"
|
|
383
|
-
aria-label="${(x) => x.locale.colorPicker.closeButtonLabel}"
|
|
382
|
+
<${buttonTag} size="condensed"
|
|
383
|
+
aria-label="${(x) => x.locale.colorPicker.closeButtonLabel}"
|
|
384
384
|
@click="${(x) => x._handleCloseRequest()}">
|
|
385
385
|
<${iconTag} slot="icon" name="close-line"></${iconTag}>
|
|
386
386
|
</${buttonTag}>
|
|
@@ -404,17 +404,17 @@ function renderPopupBody(buttonTag, iconTag, tooltipTag) {
|
|
|
404
404
|
@color-changed="${(x, c) => x._onPickerColorChanged(c.event)}"
|
|
405
405
|
${ref("_vcHexInputEl")}
|
|
406
406
|
>
|
|
407
|
-
<input name="hex-code-input" aria-label="${(x) => x.locale.colorPicker.hexInputLabel}"
|
|
407
|
+
<input name="hex-code-input" aria-label="${(x) => x.locale.colorPicker.hexInputLabel}"
|
|
408
408
|
placeholder="${(x) => x.placeholder}"
|
|
409
|
-
@blur="${(
|
|
409
|
+
@blur="${(_, c) => c.event.stopImmediatePropagation()}"
|
|
410
410
|
part="input">
|
|
411
411
|
</${html.partial(vcInputTag)}>
|
|
412
|
-
<${tooltipTag} placement="top"
|
|
413
|
-
text="${(x) => x.locale.colorPicker.copyButtonLabel}"
|
|
412
|
+
<${tooltipTag} placement="top"
|
|
413
|
+
text="${(x) => x.locale.colorPicker.copyButtonLabel}"
|
|
414
414
|
exportparts="vvd-theme-alternate">
|
|
415
|
-
<${buttonTag}
|
|
416
|
-
slot="anchor" size="normal"
|
|
417
|
-
aria-label="${(x) => x.locale.colorPicker.copyButtonLabel}"
|
|
415
|
+
<${buttonTag}
|
|
416
|
+
slot="anchor" size="normal"
|
|
417
|
+
aria-label="${(x) => x.locale.colorPicker.copyButtonLabel}"
|
|
418
418
|
@click="${(x) => x._copyValueToClipboard(x.value)}">
|
|
419
419
|
<${iconTag} slot="icon" name="${(x) => x.copyIconName}"></${iconTag}>
|
|
420
420
|
</${buttonTag}>
|
|
@@ -444,8 +444,8 @@ function renderPopupFooter(buttonTag, iconTag, tooltipTag) {
|
|
|
444
444
|
>
|
|
445
445
|
${repeat((x) => x.allSwatches, (x) => x._renderColorSwatch(iconTag, tooltipTag), { positioning: true })}
|
|
446
446
|
${when((x) => !x.disableSavedColors, html`
|
|
447
|
-
<${tooltipTag} placement="top"
|
|
448
|
-
text="${(x) => x.locale.colorPicker.saveButtonLabel}"
|
|
447
|
+
<${tooltipTag} placement="top"
|
|
448
|
+
text="${(x) => x.locale.colorPicker.saveButtonLabel}"
|
|
449
449
|
exportparts="vvd-theme-alternate">
|
|
450
450
|
<${buttonTag}
|
|
451
451
|
slot="anchor"
|
|
@@ -490,11 +490,11 @@ var ColorPickerTemplate = (context) => {
|
|
|
490
490
|
:open="${(x) => x.open}"
|
|
491
491
|
:anchor="${(x) => x._buttonEl}"
|
|
492
492
|
placement="top"
|
|
493
|
-
offset="10"
|
|
493
|
+
offset="10"
|
|
494
494
|
${ref("_popupEl")}>
|
|
495
|
-
<div class="dialog"
|
|
496
|
-
role="dialog"
|
|
497
|
-
aria-modal="true"
|
|
495
|
+
<div class="dialog"
|
|
496
|
+
role="dialog"
|
|
497
|
+
aria-modal="true"
|
|
498
498
|
aria-labelledby="color-picker-title">
|
|
499
499
|
${renderPopupHeader(buttonTag, iconTag)}
|
|
500
500
|
${renderPopupBody(buttonTag, iconTag, tooltipTag)}
|
|
@@ -165,7 +165,7 @@ require_decorate.__decorate([_microsoft_fast_element.attr], ListboxOption.protot
|
|
|
165
165
|
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "tag-connotation" })], ListboxOption.prototype, "tagConnotation", void 0);
|
|
166
166
|
//#endregion
|
|
167
167
|
//#region src/lib/option/option.template.ts
|
|
168
|
-
var getClasses = (x) => (0, _microsoft_fast_web_utilities.classNames)("base", [`connotation-${x.connotation}`, Boolean(x.connotation)], ["disabled", x.disabled], ["selected",
|
|
168
|
+
var getClasses = (x) => (0, _microsoft_fast_web_utilities.classNames)("base", [`connotation-${x.connotation}`, Boolean(x.connotation)], ["disabled", x.disabled], ["selected", x.selected], ["hover", x._highlighted], ["active", Boolean(x.checked)], ["icon", Boolean(x.icon)], ["two-lines", Boolean(x.text?.length) && Boolean(x.textSecondary?.length)]);
|
|
169
169
|
function text() {
|
|
170
170
|
return _microsoft_fast_element.html`${(0, _microsoft_fast_element.when)((x) => x.text || x.textSecondary, _microsoft_fast_element.html`<span class="text">
|
|
171
171
|
${(0, _microsoft_fast_element.when)((x) => x.text, _microsoft_fast_element.html`<span class="text-primary">
|