@vonage/vivid 3.39.0 → 3.41.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.js +2 -2
- package/accordion-item/index.js +2 -2
- package/alert/index.js +7 -5
- package/audio-player/index.js +33 -0
- package/avatar/index.js +2 -2
- package/badge/index.js +2 -2
- package/banner/index.js +9 -5
- package/breadcrumb/index.js +1 -1
- package/breadcrumb-item/index.js +3 -3
- package/button/index.js +5 -4
- package/calendar/index.js +1 -1
- package/calendar-event/index.js +1 -1
- package/card/index.js +4 -3
- package/checkbox/index.js +3 -3
- package/combobox/index.js +9 -7
- package/custom-elements.json +809 -5
- package/data-grid/index.js +3 -2
- package/date-picker/index.js +11 -9
- package/date-range-picker/index.js +11 -9
- package/dialog/index.js +10 -6
- package/divider/index.js +1 -1
- package/elevation/index.js +1 -1
- package/empty-state/index.js +2 -2
- package/fab/index.js +3 -3
- package/file-picker/index.js +6 -5
- package/focus/index.js +1 -1
- package/header/index.js +2 -2
- package/icon/index.js +1 -1
- package/index.js +60 -55
- package/layout/index.js +1 -1
- package/lib/alert/alert.d.ts +3 -1
- package/lib/alert/locale.d.ts +3 -0
- package/lib/audio-player/audio-player.d.ts +17 -0
- package/lib/audio-player/audio-player.template.d.ts +4 -0
- package/lib/audio-player/definition.d.ts +4 -0
- package/lib/audio-player/locale.d.ts +5 -0
- package/lib/banner/banner.d.ts +3 -1
- package/lib/banner/locale.d.ts +3 -0
- package/lib/card/card.d.ts +3 -0
- package/lib/card/card.template.d.ts +1 -1
- package/lib/card/definition.d.ts +1 -0
- package/lib/checkbox/checkbox.d.ts +2 -0
- package/lib/components.d.ts +2 -0
- package/lib/dialog/dialog.d.ts +4 -0
- package/lib/dialog/locale.d.ts +3 -0
- package/lib/enums.d.ts +2 -1
- package/lib/menu/menu.d.ts +1 -0
- package/lib/number-field/locale.d.ts +4 -0
- package/lib/number-field/number-field.d.ts +4 -2
- package/lib/progress/progress.d.ts +1 -0
- package/lib/progress-ring/progress-ring.d.ts +1 -0
- package/lib/radio/radio.d.ts +1 -0
- package/lib/selectable-box/definition.d.ts +3 -0
- package/lib/selectable-box/selectable-box.d.ts +12 -0
- package/lib/selectable-box/selectable-box.template.d.ts +4 -0
- package/lib/slider/definition.d.ts +1 -0
- package/lib/slider/slider.d.ts +5 -0
- package/lib/split-button/locale.d.ts +3 -0
- package/lib/split-button/split-button.d.ts +3 -1
- package/lib/text-area/text-area.d.ts +3 -0
- package/lib/text-field/text-field.d.ts +5 -2
- package/listbox/index.js +5 -4
- package/locales/en-GB.js +21 -0
- package/locales/en-US.js +21 -0
- package/locales/ja-JP.js +21 -0
- package/locales/zh-CN.js +21 -0
- package/menu/index.js +9 -8
- package/menu-item/index.js +3 -3
- package/nav/index.js +1 -1
- package/nav-disclosure/index.js +3 -3
- package/nav-item/index.js +3 -3
- package/note/index.js +2 -2
- package/number-field/index.js +8 -6
- package/option/index.js +3 -3
- package/package.json +1 -1
- package/pagination/index.js +6 -5
- package/popup/index.js +7 -6
- package/progress/index.js +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/index.js +2 -2
- package/radio-group/index.js +2 -2
- package/select/index.js +10 -8
- package/selectable-box/index.js +23 -0
- package/shared/Reflector.js +65 -0
- package/shared/date-picker/calendar/segment.d.ts +21 -0
- package/shared/date-picker/date-picker-base.d.ts +1 -0
- package/shared/definition.js +3 -3
- package/shared/definition10.js +89 -227
- package/shared/definition11.js +151 -29
- package/shared/definition12.js +37 -766
- package/shared/definition13.js +747 -106
- package/shared/definition14.js +122 -192
- package/shared/definition15.js +156 -664
- package/shared/definition16.js +576 -1123
- package/shared/definition17.js +1278 -143
- package/shared/definition18.js +64 -298
- package/shared/definition19.js +358 -211
- package/shared/definition2.js +2 -2
- package/shared/definition20.js +259 -67
- package/shared/definition21.js +66 -58
- package/shared/definition22.js +43 -84
- package/shared/definition23.js +76 -2352
- package/shared/definition24.js +2362 -45
- package/shared/definition25.js +63 -27
- package/shared/definition26.js +24 -51
- package/shared/definition27.js +36 -813
- package/shared/definition28.js +837 -49
- package/shared/definition29.js +52 -89
- package/shared/definition3.js +1 -1
- package/shared/definition30.js +88 -24
- package/shared/definition31.js +25 -12
- package/shared/definition32.js +12 -52
- package/shared/definition33.js +28 -487
- package/shared/definition34.js +442 -197
- package/shared/definition35.js +260 -185
- package/shared/definition36.js +188 -69
- package/shared/definition37.js +72 -52
- package/shared/definition38.js +65 -421
- package/shared/definition39.js +435 -35
- package/shared/definition4.js +44 -16
- package/shared/definition40.js +32 -680
- package/shared/definition41.js +661 -77
- package/shared/definition42.js +103 -555
- package/shared/definition43.js +76 -103
- package/shared/definition44.js +522 -87
- package/shared/definition45.js +133 -22
- package/shared/definition46.js +131 -58
- package/shared/definition47.js +16 -501
- package/shared/definition48.js +69 -23
- package/shared/definition49.js +477 -108
- package/shared/definition5.js +160 -44
- package/shared/definition50.js +25 -271
- package/shared/definition51.js +103 -122
- package/shared/definition52.js +277 -122
- package/shared/definition53.js +274 -103
- package/shared/definition54.js +126 -71
- package/shared/definition55.js +128 -294
- package/shared/definition56.js +91 -13
- package/shared/definition57.js +298 -39
- package/shared/definition58.js +11 -175
- package/shared/definition59.js +47 -0
- package/shared/definition6.js +43 -33
- package/shared/definition60.js +181 -0
- package/shared/definition7.js +39 -105
- package/shared/definition8.js +122 -38
- package/shared/definition9.js +56 -89
- package/shared/enums.js +72 -0
- package/shared/icon.js +2 -2
- package/shared/index2.js +28 -1
- package/shared/key-codes.js +1 -1
- package/shared/key-codes2.js +9 -0
- package/shared/listbox.js +3 -8
- package/shared/localization/Locale.d.ts +12 -0
- package/shared/patterns/form-elements/form-elements.d.ts +6 -6
- package/shared/presentationDate.js +196 -143
- package/shared/radio.js +7 -0
- package/shared/text-field.js +1 -1
- package/shared/utils/Reflector.d.ts +8 -0
- package/shared/utils/randomId.d.ts +1 -0
- package/side-drawer/index.js +1 -1
- package/slider/index.js +3 -3
- package/split-button/index.js +6 -3
- package/style.css +889 -722
- 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/switch/index.js +3 -3
- package/tab/index.js +3 -3
- package/tab-panel/index.js +1 -1
- package/tabs/index.js +5 -5
- package/tag/index.js +3 -3
- package/tag-group/index.js +1 -1
- package/text-area/index.js +4 -3
- package/text-field/index.js +4 -3
- package/toggletip/index.js +8 -7
- package/tooltip/index.js +8 -7
- package/tree-item/index.js +3 -3
- package/tree-view/index.js +1 -1
- package/vivid.api.json +392 -0
package/shared/definition5.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import { F as FoundationElement,
|
|
2
|
-
import { a as
|
|
3
|
-
import {
|
|
1
|
+
import { a as attr, F as FoundationElement, o as observable, h as html, r as registerFactory } from './index.js';
|
|
2
|
+
import { B as Button, a as buttonRegistries } from './definition11.js';
|
|
3
|
+
import { S as Slider, a as sliderRegistries } from './definition44.js';
|
|
4
|
+
import { f as focusRegistries } from './definition58.js';
|
|
5
|
+
import './affix.js';
|
|
6
|
+
import './index2.js';
|
|
7
|
+
import { L as Localized } from './localized.js';
|
|
8
|
+
import { a as applyMixins } from './apply-mixins.js';
|
|
4
9
|
import { w as when } from './when.js';
|
|
10
|
+
import { r as ref } from './ref.js';
|
|
5
11
|
import { c as classNames } from './class-names.js';
|
|
6
12
|
|
|
7
|
-
const styles = "/**\n * Do not edit directly\n * Generated on
|
|
13
|
+
const styles = "/**\n * Do not edit directly\n * Generated on Wed, 22 Nov 2023 16:09:43 GMT\n */\n.base {\n display: inline-flex;\n align-items: center;\n padding: 8px;\n color: var(--vvd-color-canvas-text);\n user-select: none;\n}\n.base .slider {\n min-inline-size: var(--audio-player-min-inline-size, 200px);\n}\n.base .controls {\n display: flex;\n align-items: center;\n gap: 16px;\n}\n.base .time-stamp {\n display: inline-flex;\n}\n.base .time-stamp .current-time,\n.base .time-stamp .total-time {\n margin-inline: 6px;\n min-inline-size: 32px;\n}";
|
|
8
14
|
|
|
9
15
|
var __defProp = Object.defineProperty;
|
|
10
16
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -17,63 +23,173 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
17
23
|
__defProp(target, key, result);
|
|
18
24
|
return result;
|
|
19
25
|
};
|
|
20
|
-
class
|
|
26
|
+
class AudioPlayer extends FoundationElement {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments);
|
|
29
|
+
this.playButtonAriaLabel = null;
|
|
30
|
+
this.pauseButtonAriaLabel = null;
|
|
31
|
+
this.sliderAriaLabel = null;
|
|
32
|
+
this.disabled = false;
|
|
33
|
+
this.notime = false;
|
|
34
|
+
this.paused = true;
|
|
35
|
+
/**
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
this._rewind = () => {
|
|
39
|
+
this.paused = true;
|
|
40
|
+
if (this._playerEl) {
|
|
41
|
+
this._playerEl.pause();
|
|
42
|
+
this._playerEl.currentTime = this._playerEl.duration * (Number(this._sliderEl.value) / 100);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
connectedCallback() {
|
|
47
|
+
super.connectedCallback();
|
|
48
|
+
this.addEventListener("keydown", this._rewind);
|
|
49
|
+
this.addEventListener("mousedown", this._rewind);
|
|
50
|
+
this.addEventListener("keyup", this._rewind);
|
|
51
|
+
document.addEventListener("mouseup", this._rewind);
|
|
52
|
+
}
|
|
53
|
+
disconnectedCallback() {
|
|
54
|
+
super.disconnectedCallback();
|
|
55
|
+
this.removeEventListener("keydown", this._rewind);
|
|
56
|
+
this.removeEventListener("mousedown", this._rewind);
|
|
57
|
+
this.removeEventListener("keyup", this._rewind);
|
|
58
|
+
document.removeEventListener("mouseup", this._rewind);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
_togglePlay() {
|
|
64
|
+
if (this.paused) {
|
|
65
|
+
this._updateProgress();
|
|
66
|
+
this._playerEl.play();
|
|
67
|
+
} else {
|
|
68
|
+
this._playerEl.pause();
|
|
69
|
+
}
|
|
70
|
+
this.paused = !this.paused;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
|
+
_updateProgress() {
|
|
76
|
+
let currentTime;
|
|
77
|
+
const current = this._playerEl.currentTime;
|
|
78
|
+
const percent = current / this._playerEl.duration * 100;
|
|
79
|
+
if (this._sliderEl) {
|
|
80
|
+
this._sliderEl.value = percent.toString();
|
|
81
|
+
this._sliderEl.ariaValuetext = this._formatTime(current);
|
|
82
|
+
}
|
|
83
|
+
if (percent === 100) {
|
|
84
|
+
this.paused = true;
|
|
85
|
+
}
|
|
86
|
+
if (this._timeStampEl) {
|
|
87
|
+
currentTime = this._timeStampEl.querySelector(".current-time");
|
|
88
|
+
if (currentTime)
|
|
89
|
+
currentTime.textContent = this._formatTime(current);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* @internal
|
|
94
|
+
*/
|
|
95
|
+
_updateTotalTime() {
|
|
96
|
+
let totalTime;
|
|
97
|
+
if (this._playerEl)
|
|
98
|
+
this.duration = this._playerEl.duration;
|
|
99
|
+
if (this._timeStampEl) {
|
|
100
|
+
totalTime = this._timeStampEl.querySelector(".total-time");
|
|
101
|
+
if (totalTime)
|
|
102
|
+
totalTime.textContent = this._formatTime(this._playerEl.duration);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* @internal
|
|
107
|
+
*/
|
|
108
|
+
_formatTime(time) {
|
|
109
|
+
const min = Math.floor(time / 60);
|
|
110
|
+
const sec = Math.floor(time % 60);
|
|
111
|
+
return min + ":" + (sec < 10 ? "0" + sec : sec);
|
|
112
|
+
}
|
|
21
113
|
}
|
|
22
114
|
__decorateClass([
|
|
23
|
-
attr
|
|
24
|
-
],
|
|
115
|
+
attr({ attribute: "play-button-aria-label" })
|
|
116
|
+
], AudioPlayer.prototype, "playButtonAriaLabel", 2);
|
|
25
117
|
__decorateClass([
|
|
26
|
-
attr
|
|
27
|
-
],
|
|
118
|
+
attr({ attribute: "pause-button-aria-label" })
|
|
119
|
+
], AudioPlayer.prototype, "pauseButtonAriaLabel", 2);
|
|
28
120
|
__decorateClass([
|
|
29
|
-
attr
|
|
30
|
-
],
|
|
121
|
+
attr({ attribute: "slider-aria-label" })
|
|
122
|
+
], AudioPlayer.prototype, "sliderAriaLabel", 2);
|
|
31
123
|
__decorateClass([
|
|
32
124
|
attr
|
|
33
|
-
],
|
|
125
|
+
], AudioPlayer.prototype, "connotation", 2);
|
|
34
126
|
__decorateClass([
|
|
35
127
|
attr
|
|
36
|
-
],
|
|
128
|
+
], AudioPlayer.prototype, "src", 2);
|
|
37
129
|
__decorateClass([
|
|
38
|
-
attr
|
|
39
|
-
],
|
|
130
|
+
attr({ mode: "boolean" })
|
|
131
|
+
], AudioPlayer.prototype, "disabled", 2);
|
|
132
|
+
__decorateClass([
|
|
133
|
+
attr({ mode: "boolean" })
|
|
134
|
+
], AudioPlayer.prototype, "notime", 2);
|
|
135
|
+
__decorateClass([
|
|
136
|
+
observable
|
|
137
|
+
], AudioPlayer.prototype, "paused", 2);
|
|
138
|
+
__decorateClass([
|
|
139
|
+
observable
|
|
140
|
+
], AudioPlayer.prototype, "duration", 2);
|
|
141
|
+
applyMixins(AudioPlayer, Localized);
|
|
40
142
|
|
|
41
|
-
const getClasses = ({
|
|
42
|
-
"
|
|
43
|
-
[`connotation-${connotation}`, Boolean(connotation)],
|
|
44
|
-
[`appearance-${appearance}`, Boolean(appearance)],
|
|
45
|
-
[`shape-${shape}`, Boolean(shape)],
|
|
46
|
-
[`size-${size}`, Boolean(size)]
|
|
143
|
+
const getClasses = ({ disabled, duration }) => classNames(
|
|
144
|
+
["disabled", Boolean(disabled) || !Boolean(duration)]
|
|
47
145
|
);
|
|
48
|
-
function
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
146
|
+
function renderButton(context) {
|
|
147
|
+
const buttonTag = context.tagFor(Button);
|
|
148
|
+
return html`<${buttonTag} class="pause" @click="${(x) => x._togglePlay()}"
|
|
149
|
+
icon="${(x) => x.paused ? "play-solid" : "pause-solid"}"
|
|
150
|
+
aria-label="${(x) => x.paused ? x.playButtonAriaLabel || x.locale.audioPlayer.playButtonLabel : x.pauseButtonAriaLabel || x.locale.audioPlayer.playButtonLabel}"
|
|
151
|
+
size='condensed'
|
|
152
|
+
connotation="${(x) => x.connotation}"
|
|
153
|
+
?disabled="${(x) => x.disabled || !x.duration}"
|
|
154
|
+
></${buttonTag}>`;
|
|
155
|
+
}
|
|
156
|
+
function renderSlider(context) {
|
|
157
|
+
const sliderTag = context.tagFor(Slider);
|
|
158
|
+
return html`<${sliderTag}
|
|
159
|
+
${ref("_sliderEl")} class="slider"
|
|
160
|
+
aria-label="${(x) => x.sliderAriaLabel || x.locale.audioPlayer.sliderLabel}"
|
|
161
|
+
value="0" max="100"
|
|
162
|
+
connotation="${(x) => x.connotation}"
|
|
163
|
+
?disabled="${(x) => x.disabled || !x.duration}">
|
|
164
|
+
</${sliderTag}>`;
|
|
54
165
|
}
|
|
55
|
-
function
|
|
166
|
+
function renderTimestamp() {
|
|
56
167
|
return html`
|
|
57
|
-
|
|
58
|
-
|
|
168
|
+
<div class="time-stamp" ${ref("_timeStampEl")}>
|
|
169
|
+
<span class="current-time">0:00</span>
|
|
170
|
+
<span>/</span>
|
|
171
|
+
<span class="total-time">0:00</span>
|
|
172
|
+
</div>`;
|
|
59
173
|
}
|
|
60
|
-
const
|
|
61
|
-
const iconTag = context.tagFor(Icon);
|
|
174
|
+
const AudioPlayerTemplate = (context) => {
|
|
62
175
|
return html`
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
</
|
|
176
|
+
<div class="base ${getClasses}">
|
|
177
|
+
<div class="controls">
|
|
178
|
+
${renderButton(context)}
|
|
179
|
+
${when((x) => !x.notime, renderTimestamp())}
|
|
180
|
+
${renderSlider(context)}
|
|
181
|
+
</div>
|
|
182
|
+
<audio ${ref("_playerEl")} src="${(x) => x.src}"
|
|
183
|
+
@timeupdate="${(x) => x._updateProgress()}" @loadedmetadata="${(x) => x._updateTotalTime()}"></audio>
|
|
184
|
+
</div>`;
|
|
69
185
|
};
|
|
70
186
|
|
|
71
|
-
const
|
|
72
|
-
baseName: "
|
|
73
|
-
template:
|
|
187
|
+
const audioPlayerDefinition = AudioPlayer.compose({
|
|
188
|
+
baseName: "audio-player",
|
|
189
|
+
template: AudioPlayerTemplate,
|
|
74
190
|
styles
|
|
75
191
|
});
|
|
76
|
-
const
|
|
77
|
-
const
|
|
192
|
+
const audioPlayerRegistries = [audioPlayerDefinition(), ...buttonRegistries, ...sliderRegistries, ...focusRegistries];
|
|
193
|
+
const registerAudioPlayer = registerFactory(audioPlayerRegistries);
|
|
78
194
|
|
|
79
|
-
export {
|
|
195
|
+
export { audioPlayerDefinition as a, audioPlayerRegistries as b, registerAudioPlayer as r };
|
package/shared/definition50.js
CHANGED
|
@@ -1,193 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as iconRegistries } from './definition25.js';
|
|
3
|
-
import { f as focusRegistries } from './definition56.js';
|
|
4
|
-
import './affix.js';
|
|
5
|
-
import { e as errorText, f as formElements, F as FormElementSuccessText, a as FormElementHelperText, b as FormElementCharCount, g as getFeedbackTemplate } from './index2.js';
|
|
6
|
-
import { D as DelegatesARIATextbox } from './text-field2.js';
|
|
7
|
-
import { a as applyMixins } from './apply-mixins.js';
|
|
8
|
-
import { F as FormAssociated } from './form-associated.js';
|
|
9
|
-
import { w as when } from './when.js';
|
|
10
|
-
import { r as ref } from './ref.js';
|
|
1
|
+
import { a as attr, F as FoundationElement, h as html, r as registerFactory } from './index.js';
|
|
11
2
|
import { c as classNames } from './class-names.js';
|
|
12
3
|
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* A form-associated base class for the {@link @microsoft/fast-foundation#(TextArea:class)} component.
|
|
17
|
-
*
|
|
18
|
-
* @internal
|
|
19
|
-
*/
|
|
20
|
-
class FormAssociatedTextArea extends FormAssociated(_TextArea) {
|
|
21
|
-
constructor() {
|
|
22
|
-
super(...arguments);
|
|
23
|
-
this.proxy = document.createElement("textarea");
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Resize mode for a TextArea
|
|
29
|
-
* @public
|
|
30
|
-
*/
|
|
31
|
-
const TextAreaResize = {
|
|
32
|
-
/**
|
|
33
|
-
* No resize.
|
|
34
|
-
*/
|
|
35
|
-
none: "none",
|
|
36
|
-
/**
|
|
37
|
-
* Resize vertically and horizontally.
|
|
38
|
-
*/
|
|
39
|
-
both: "both",
|
|
40
|
-
/**
|
|
41
|
-
* Resize horizontally.
|
|
42
|
-
*/
|
|
43
|
-
horizontal: "horizontal",
|
|
44
|
-
/**
|
|
45
|
-
* Resize vertically.
|
|
46
|
-
*/
|
|
47
|
-
vertical: "vertical",
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* A Text Area Custom HTML Element.
|
|
52
|
-
* Based largely on the {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea | <textarea> element }.
|
|
53
|
-
*
|
|
54
|
-
* @slot - The default slot for the label
|
|
55
|
-
* @csspart label - The label
|
|
56
|
-
* @csspart root - The element wrapping the control
|
|
57
|
-
* @csspart control - The textarea element
|
|
58
|
-
* @fires change - Emits a custom 'change' event when the textarea emits a change event
|
|
59
|
-
*
|
|
60
|
-
* @public
|
|
61
|
-
*/
|
|
62
|
-
let TextArea$1 = class TextArea extends FormAssociatedTextArea {
|
|
63
|
-
constructor() {
|
|
64
|
-
super(...arguments);
|
|
65
|
-
/**
|
|
66
|
-
* The resize mode of the element.
|
|
67
|
-
* @public
|
|
68
|
-
* @remarks
|
|
69
|
-
* HTML Attribute: resize
|
|
70
|
-
*/
|
|
71
|
-
this.resize = TextAreaResize.none;
|
|
72
|
-
/**
|
|
73
|
-
* Sizes the element horizontally by a number of character columns.
|
|
74
|
-
*
|
|
75
|
-
* @public
|
|
76
|
-
* @remarks
|
|
77
|
-
* HTML Attribute: cols
|
|
78
|
-
*/
|
|
79
|
-
this.cols = 20;
|
|
80
|
-
/**
|
|
81
|
-
* @internal
|
|
82
|
-
*/
|
|
83
|
-
this.handleTextInput = () => {
|
|
84
|
-
this.value = this.control.value;
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
readOnlyChanged() {
|
|
88
|
-
if (this.proxy instanceof HTMLTextAreaElement) {
|
|
89
|
-
this.proxy.readOnly = this.readOnly;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
autofocusChanged() {
|
|
93
|
-
if (this.proxy instanceof HTMLTextAreaElement) {
|
|
94
|
-
this.proxy.autofocus = this.autofocus;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
listChanged() {
|
|
98
|
-
if (this.proxy instanceof HTMLTextAreaElement) {
|
|
99
|
-
this.proxy.setAttribute("list", this.list);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
maxlengthChanged() {
|
|
103
|
-
if (this.proxy instanceof HTMLTextAreaElement) {
|
|
104
|
-
this.proxy.maxLength = this.maxlength;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
minlengthChanged() {
|
|
108
|
-
if (this.proxy instanceof HTMLTextAreaElement) {
|
|
109
|
-
this.proxy.minLength = this.minlength;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
spellcheckChanged() {
|
|
113
|
-
if (this.proxy instanceof HTMLTextAreaElement) {
|
|
114
|
-
this.proxy.spellcheck = this.spellcheck;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Selects all the text in the text area
|
|
119
|
-
*
|
|
120
|
-
* @public
|
|
121
|
-
*/
|
|
122
|
-
select() {
|
|
123
|
-
this.control.select();
|
|
124
|
-
/**
|
|
125
|
-
* The select event does not permeate the shadow DOM boundary.
|
|
126
|
-
* This fn effectively proxies the select event,
|
|
127
|
-
* emitting a `select` event whenever the internal
|
|
128
|
-
* control emits a `select` event
|
|
129
|
-
*/
|
|
130
|
-
this.$emit("select");
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Change event handler for inner control.
|
|
134
|
-
* @remarks
|
|
135
|
-
* "Change" events are not `composable` so they will not
|
|
136
|
-
* permeate the shadow DOM boundary. This fn effectively proxies
|
|
137
|
-
* the change event, emitting a `change` event whenever the internal
|
|
138
|
-
* control emits a `change` event
|
|
139
|
-
* @internal
|
|
140
|
-
*/
|
|
141
|
-
handleChange() {
|
|
142
|
-
this.$emit("change");
|
|
143
|
-
}
|
|
144
|
-
/** {@inheritDoc (FormAssociated:interface).validate} */
|
|
145
|
-
validate() {
|
|
146
|
-
super.validate(this.control);
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
__decorate([
|
|
150
|
-
attr({ mode: "boolean" })
|
|
151
|
-
], TextArea$1.prototype, "readOnly", void 0);
|
|
152
|
-
__decorate([
|
|
153
|
-
attr
|
|
154
|
-
], TextArea$1.prototype, "resize", void 0);
|
|
155
|
-
__decorate([
|
|
156
|
-
attr({ mode: "boolean" })
|
|
157
|
-
], TextArea$1.prototype, "autofocus", void 0);
|
|
158
|
-
__decorate([
|
|
159
|
-
attr({ attribute: "form" })
|
|
160
|
-
], TextArea$1.prototype, "formId", void 0);
|
|
161
|
-
__decorate([
|
|
162
|
-
attr
|
|
163
|
-
], TextArea$1.prototype, "list", void 0);
|
|
164
|
-
__decorate([
|
|
165
|
-
attr({ converter: nullableNumberConverter })
|
|
166
|
-
], TextArea$1.prototype, "maxlength", void 0);
|
|
167
|
-
__decorate([
|
|
168
|
-
attr({ converter: nullableNumberConverter })
|
|
169
|
-
], TextArea$1.prototype, "minlength", void 0);
|
|
170
|
-
__decorate([
|
|
171
|
-
attr
|
|
172
|
-
], TextArea$1.prototype, "name", void 0);
|
|
173
|
-
__decorate([
|
|
174
|
-
attr
|
|
175
|
-
], TextArea$1.prototype, "placeholder", void 0);
|
|
176
|
-
__decorate([
|
|
177
|
-
attr({ converter: nullableNumberConverter, mode: "fromView" })
|
|
178
|
-
], TextArea$1.prototype, "cols", void 0);
|
|
179
|
-
__decorate([
|
|
180
|
-
attr({ converter: nullableNumberConverter, mode: "fromView" })
|
|
181
|
-
], TextArea$1.prototype, "rows", void 0);
|
|
182
|
-
__decorate([
|
|
183
|
-
attr({ mode: "boolean" })
|
|
184
|
-
], TextArea$1.prototype, "spellcheck", void 0);
|
|
185
|
-
__decorate([
|
|
186
|
-
observable
|
|
187
|
-
], TextArea$1.prototype, "defaultSlottedNodes", void 0);
|
|
188
|
-
applyMixins(TextArea$1, DelegatesARIATextbox);
|
|
189
|
-
|
|
190
|
-
const styles = "/**\n * Do not edit directly\n * Generated on Tue, 17 Oct 2023 15:27:52 GMT\n */\n:host {\n display: inline-block;\n}\n\n.base {\n display: inline-grid;\n grid-template-columns: 1fr max-content;\n inline-size: 100%;\n row-gap: 4px;\n}\n.base {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--_connotation-color-backdrop);\n --_appearance-color-outline: var(--_connotation-color-intermediate);\n}\n.base.appearance-ghost {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)) {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--_connotation-color-backdrop);\n --_appearance-color-outline: var(--_connotation-color-firm);\n}\n.base:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)).appearance-ghost {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-faint);\n --_appearance-color-outline: transparent;\n}\n.base:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-300);\n --_appearance-color-fill: var(--vvd-color-neutral-100);\n --_appearance-color-outline: var(--vvd-color-neutral-300);\n}\n.base:where(:disabled, .disabled).appearance-ghost {\n --_appearance-color-text: var(--vvd-color-neutral-300);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base:where(.readonly):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: var(--vvd-color-neutral-400);\n}\n.base:where(.readonly):where(:not(:disabled, .disabled)).appearance-ghost {\n --_appearance-color-text: var(--vvd-color-neutral-600);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base.connotation-success {\n /* @cssprop [--vvd-text-area-success-primary=var(--vvd-color-success-500)] */\n --_connotation-color-primary: var(--vvd-text-area-success-primary, var(--vvd-color-success-500));\n /* @cssprop [--vvd-text-area-success-backdrop=var(--vvd-color-success-50)] */\n --_connotation-color-backdrop: var(--vvd-text-area-success-backdrop, var(--vvd-color-success-50));\n /* @cssprop [--vvd-text-area-success-intermediate=var(--vvd-color-success-500)] */\n --_connotation-color-intermediate: var(--vvd-text-area-success-intermediate, var(--vvd-color-success-500));\n /* @cssprop [--vvd-text-area-success-firm=var(--vvd-color-success-600)] */\n --_connotation-color-firm: var(--vvd-text-area-success-firm, var(--vvd-color-success-600));\n /* @cssprop [--vvd-text-area-success-faint=var(--vvd-color-success-50)] */\n --_connotation-color-faint: var(--vvd-text-area-success-faint, var(--vvd-color-success-50));\n /* @cssprop [--vvd-text-area-success-soft=var(--vvd-color-success-100)] */\n --_connotation-color-soft: var(--vvd-text-area-success-soft, var(--vvd-color-success-100));\n}\n.base.connotation-alert {\n /* @cssprop [--vvd-text-area-alert-primary=var(--vvd-color-alert-500)] */\n --_connotation-color-primary: var(--vvd-text-area-alert-primary, var(--vvd-color-alert-500));\n /* @cssprop [--vvd-text-area-alert-backdrop=var(--vvd-color-alert-50)] */\n --_connotation-color-backdrop: var(--vvd-text-area-alert-backdrop, var(--vvd-color-alert-50));\n /* @cssprop [--vvd-text-area-alert-intermediate=var(--vvd-color-alert-500)] */\n --_connotation-color-intermediate: var(--vvd-text-area-alert-intermediate, var(--vvd-color-alert-500));\n /* @cssprop [--vvd-text-area-alert-firm=var(--vvd-color-alert-600)] */\n --_connotation-color-firm: var(--vvd-text-area-alert-firm, var(--vvd-color-alert-600));\n /* @cssprop [--vvd-text-area-alert-faint=var(--vvd-color-alert-50)] */\n --_connotation-color-faint: var(--vvd-text-area-alert-faint, var(--vvd-color-alert-50));\n /* @cssprop [--vvd-text-area-alert-soft=var(--vvd-color-alert-100)] */\n --_connotation-color-soft: var(--vvd-text-area-alert-soft, var(--vvd-color-alert-100));\n}\n.base:not(.connotation-success, .connotation-alert) {\n /* @cssprop [--vvd-text-area-accent-primary=var(--vvd-color-canvas-text)] */\n --_connotation-color-primary: var(--vvd-text-area-accent-primary, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-text-area-accent-backdrop=var(--vvd-color-canvas)] */\n --_connotation-color-backdrop: var(--vvd-text-area-accent-backdrop, var(--vvd-color-canvas));\n /* @cssprop [--vvd-text-area-accent-intermediate=var(--vvd-color-neutral-500)] */\n --_connotation-color-intermediate: var(--vvd-text-area-accent-intermediate, var(--vvd-color-neutral-500));\n /* @cssprop [--vvd-text-area-accent-firm=var(--vvd-color-canvas-text)] */\n --_connotation-color-firm: var(--vvd-text-area-accent-firm, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-text-area-accent-faint=var(--vvd-color-neutral-50)] */\n --_connotation-color-faint: var(--vvd-text-area-accent-faint, var(--vvd-color-neutral-50));\n /* @cssprop [--vvd-text-area-accent-soft=var(--vvd-color-neutral-100)] */\n --_connotation-color-soft: var(--vvd-text-area-accent-soft, var(--vvd-color-neutral-100));\n}\n@supports (user-select: none) {\n .base {\n user-select: none;\n }\n}\n.base:not(.disabled) {\n --_low-ink-color: var(--vvd-color-neutral-600);\n}\n.base.disabled {\n --_low-ink-color: var(--_appearance-color-text);\n cursor: not-allowed;\n}\n\n.label {\n color: var(--vvd-color-canvas-text);\n contain: inline-size;\n font: var(--vvd-typography-base);\n grid-column: 1/2;\n grid-row: 1;\n line-height: 20px;\n}\n\n.char-count {\n color: var(--_low-ink-color);\n font: var(--vvd-typography-base);\n grid-column: 2/-1;\n}\n\n.control {\n padding: 8px 16px;\n border: 0 none;\n appearance: none; /* for box-shadow visibility on IOS */\n background-color: var(--_appearance-color-fill);\n border-radius: 6px;\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n color: var(--_appearance-color-text);\n font: var(--vvd-typography-base);\n grid-column: 1/-1;\n min-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)));\n resize: none;\n transition: box-shadow 0.2s, background-color 0.2s, color 0.2s;\n}\n.control:disabled {\n opacity: 1; /* 2. correct opacity on iOS */\n pointer-events: none;\n -webkit-text-fill-color: var(--_appearance-color-text); /* 1. sets text fill to current `color` for safari */\n}\n.control::placeholder, .control:disabled::placeholder {\n opacity: 1; /* 2. correct opacity on iOS */\n pointer-events: none;\n -webkit-text-fill-color: var(--_low-ink-color); /* 1. sets text fill to current `color` for safari */\n}\n.control:focus {\n outline: 2px solid var(--focus-stroke-color, currentColor);\n outline-offset: -2px;\n}\n:host([resize=both]) .control {\n resize: both;\n}\n:host([resize=horizontal]) .control {\n resize: horizontal;\n}\n:host([resize=vertical]) .control {\n resize: vertical;\n}";
|
|
4
|
+
const styles = ".base {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n}";
|
|
191
5
|
|
|
192
6
|
var __defProp = Object.defineProperty;
|
|
193
7
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -200,95 +14,35 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
200
14
|
__defProp(target, key, result);
|
|
201
15
|
return result;
|
|
202
16
|
};
|
|
203
|
-
|
|
204
|
-
|
|
17
|
+
class TagGroup extends FoundationElement {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.ariaLabel = null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
205
23
|
__decorateClass([
|
|
206
|
-
attr
|
|
207
|
-
],
|
|
208
|
-
TextArea = __decorateClass([
|
|
209
|
-
errorText,
|
|
210
|
-
formElements
|
|
211
|
-
], TextArea);
|
|
212
|
-
applyMixins(TextArea, FormElementCharCount, FormElementHelperText, FormElementSuccessText);
|
|
24
|
+
attr({ attribute: "aria-label" })
|
|
25
|
+
], TagGroup.prototype, "ariaLabel", 2);
|
|
213
26
|
|
|
214
|
-
const getClasses = (
|
|
215
|
-
"base"
|
|
216
|
-
["readonly", readOnly],
|
|
217
|
-
["placeholder", Boolean(placeholder)],
|
|
218
|
-
["disabled", disabled],
|
|
219
|
-
["error connotation-alert", Boolean(errorValidationMessage)],
|
|
220
|
-
["has-value", Boolean(value)],
|
|
221
|
-
["success connotation-success", !!successText]
|
|
27
|
+
const getClasses = (_) => classNames(
|
|
28
|
+
"base"
|
|
222
29
|
);
|
|
223
|
-
|
|
224
|
-
return html`
|
|
225
|
-
<label for="control" class="label">
|
|
226
|
-
${(x) => x.label}
|
|
227
|
-
</label>`;
|
|
228
|
-
}
|
|
229
|
-
function renderCharCount() {
|
|
30
|
+
const TagGroupTemplate = () => {
|
|
230
31
|
return html`
|
|
231
|
-
<
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
const TextAreaTemplate = (context) => {
|
|
235
|
-
return html`
|
|
236
|
-
<div class="${getClasses}">
|
|
237
|
-
${when((x) => x.charCount && x.maxlength, renderCharCount())}
|
|
238
|
-
${when((x) => x.label, renderLabel())}
|
|
239
|
-
<textarea class="control" id="control"
|
|
240
|
-
?autofocus="${(x) => x.autofocus}"
|
|
241
|
-
placeholder="${(x) => x.placeholder ? x.placeholder : null}"
|
|
242
|
-
name="${(x) => x.name ? x.name : null}"
|
|
243
|
-
maxlength="${(x) => x.maxlength ? x.maxlength : null}"
|
|
244
|
-
rows="${(x) => x.rows ? x.rows : null}"
|
|
245
|
-
cols="${(x) => x.cols ? x.cols : null}"
|
|
246
|
-
wrap="${(x) => x.wrap ? x.wrap : null}"
|
|
247
|
-
?readonly="${(x) => x.readOnly}"
|
|
248
|
-
?disabled="${(x) => x.disabled}"
|
|
249
|
-
?required="${(x) => x.required}"
|
|
250
|
-
?spellcheck="${(x) => x.spellcheck}"
|
|
251
|
-
:value="${(x) => x.value}"
|
|
252
|
-
aria-atomic="${(x) => x.ariaAtomic}"
|
|
253
|
-
aria-busy="${(x) => x.ariaBusy}"
|
|
254
|
-
aria-controls="${(x) => x.ariaControls}"
|
|
255
|
-
aria-current="${(x) => x.ariaCurrent}"
|
|
256
|
-
aria-describedby="${(x) => x.ariaDescribedby}"
|
|
257
|
-
aria-details="${(x) => x.ariaDetails}"
|
|
258
|
-
aria-disabled="${(x) => x.ariaDisabled}"
|
|
259
|
-
aria-errormessage="${(x) => x.ariaErrormessage}"
|
|
260
|
-
aria-flowto="${(x) => x.ariaFlowto}"
|
|
261
|
-
aria-haspopup="${(x) => x.ariaHaspopup}"
|
|
262
|
-
aria-hidden="${(x) => x.ariaHidden}"
|
|
263
|
-
aria-invalid="${(x) => x.ariaInvalid}"
|
|
264
|
-
aria-keyshortcuts="${(x) => x.ariaKeyshortcuts}"
|
|
265
|
-
aria-label="${(x) => x.ariaLabel}"
|
|
266
|
-
aria-labelledby="${(x) => x.ariaLabelledby}"
|
|
267
|
-
aria-live="${(x) => x.ariaLive}"
|
|
268
|
-
aria-owns="${(x) => x.ariaOwns}"
|
|
269
|
-
aria-relevant="${(x) => x.ariaRelevant}"
|
|
270
|
-
aria-roledescription="${(x) => x.ariaRoledescription}"
|
|
271
|
-
@input="${(x) => x.handleTextInput()}"
|
|
272
|
-
@change="${(x) => x.handleChange()}"
|
|
273
|
-
${ref("control")}
|
|
274
|
-
>
|
|
275
|
-
</textarea>
|
|
276
|
-
${when((x) => !x.successText && !x.errorValidationMessage && x.helperText?.length, getFeedbackTemplate("helper", context))}
|
|
277
|
-
${when((x) => !x.successText && x.errorValidationMessage, getFeedbackTemplate("error", context))}
|
|
278
|
-
${when((x) => x.successText, getFeedbackTemplate("success", context))}
|
|
279
|
-
</div>
|
|
32
|
+
<div class="${getClasses}" role="listbox" aria-orientation="horizontal" aria-label="${(x) => x.ariaLabel}">
|
|
33
|
+
<slot></slot>
|
|
34
|
+
</div>
|
|
280
35
|
`;
|
|
281
36
|
};
|
|
282
37
|
|
|
283
|
-
const
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
delegatesFocus: true
|
|
38
|
+
const tagGroupDefinition = TagGroup.compose(
|
|
39
|
+
{
|
|
40
|
+
baseName: "tag-group",
|
|
41
|
+
template: TagGroupTemplate,
|
|
42
|
+
styles
|
|
289
43
|
}
|
|
290
|
-
|
|
291
|
-
const
|
|
292
|
-
const
|
|
44
|
+
);
|
|
45
|
+
const tagGroupRegistries = [tagGroupDefinition()];
|
|
46
|
+
const registerTagGroup = registerFactory(tagGroupRegistries);
|
|
293
47
|
|
|
294
|
-
export {
|
|
48
|
+
export { tagGroupRegistries as a, registerTagGroup as r, tagGroupDefinition as t };
|