@vonage/vivid 4.9.0 → 4.11.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 +2792 -83
- package/lib/badge/badge.d.ts +1 -1
- package/lib/breadcrumb-item/breadcrumb-item.d.ts +1 -1
- package/lib/button/button.d.ts +1 -1
- package/lib/checkbox/checkbox.d.ts +8 -2
- package/lib/checkbox/checkbox.form-associated.d.ts +10 -0
- package/lib/dialog/dialog.d.ts +4 -0
- package/lib/divider/divider.d.ts +11 -2
- package/lib/enums.d.ts +1 -0
- package/lib/fab/fab.d.ts +1 -1
- package/lib/file-picker/file-picker.d.ts +3 -0
- package/lib/icon/icon.d.ts +2 -1
- package/lib/slider/slider.d.ts +30 -6
- package/lib/slider/slider.form-associated.d.ts +10 -0
- package/lib/split-button/split-button.d.ts +1 -1
- package/lib/tabs/tabs.d.ts +1 -0
- package/lib/text-field/text-field.d.ts +1 -0
- package/package.json +1 -1
- package/shared/aria-global2.cjs +93 -0
- package/shared/aria-global2.js +91 -0
- package/shared/breadcrumb-item.cjs +2 -89
- package/shared/breadcrumb-item.js +1 -88
- package/shared/definition11.cjs +201 -5
- package/shared/definition11.js +199 -4
- package/shared/definition15.cjs +49 -90
- package/shared/definition15.js +50 -91
- package/shared/definition16.cjs +9 -7
- package/shared/definition16.js +9 -7
- package/shared/definition20.cjs +16 -11
- package/shared/definition20.js +16 -11
- package/shared/definition21.cjs +34 -4
- package/shared/definition21.js +34 -4
- package/shared/definition22.cjs +32 -51
- package/shared/definition22.js +33 -52
- package/shared/definition24.cjs +156 -2
- package/shared/definition24.js +157 -3
- package/shared/definition25.cjs +106 -56
- package/shared/definition25.js +106 -56
- package/shared/definition29.cjs +1 -1
- package/shared/definition29.js +1 -1
- package/shared/definition30.cjs +1 -1
- package/shared/definition30.js +1 -1
- package/shared/definition35.cjs +2 -2
- package/shared/definition35.js +2 -2
- package/shared/definition37.cjs +1 -1
- package/shared/definition37.js +1 -1
- package/shared/definition4.cjs +5 -6
- package/shared/definition4.js +1 -2
- package/shared/definition40.cjs +11 -4
- package/shared/definition40.js +8 -1
- package/shared/definition42.cjs +3 -22
- package/shared/definition42.js +2 -21
- package/shared/definition43.cjs +1 -2
- package/shared/definition43.js +1 -2
- package/shared/definition44.js +1 -1
- package/shared/definition47.cjs +369 -502
- package/shared/definition47.js +370 -503
- package/shared/definition5.cjs +5 -5
- package/shared/definition5.js +2 -2
- package/shared/definition51.cjs +1 -1
- package/shared/definition51.js +1 -1
- package/shared/definition52.cjs +63 -26
- package/shared/definition52.js +63 -26
- package/shared/definition56.cjs +45 -43
- package/shared/definition56.js +45 -43
- package/shared/definition57.cjs +1 -1
- package/shared/definition57.js +1 -1
- package/shared/definition64.cjs +242 -79
- package/shared/definition64.js +242 -79
- package/shared/definition7.cjs +1 -1
- package/shared/definition7.js +1 -1
- package/shared/definition8.cjs +1 -1
- package/shared/definition8.js +1 -1
- package/shared/enums.cjs +1 -0
- package/shared/enums.js +1 -0
- package/shared/form-associated.js +1 -1
- package/shared/{patterns → foundation/anchor}/anchor.d.ts +1 -1
- package/shared/foundation/button/button.d.ts +27 -0
- package/shared/foundation/button/button.template.d.ts +4 -0
- package/shared/foundation/button/index.d.ts +2 -0
- package/shared/foundation/patterns/index.d.ts +1 -0
- package/shared/icon.cjs +11 -5
- package/shared/icon.js +11 -5
- package/shared/index.cjs +22 -2
- package/shared/index.js +22 -2
- package/shared/key-codes2.js +1 -1
- package/shared/patterns/form-elements/form-elements.d.ts +6 -6
- package/shared/presentationDate.cjs +4328 -4042
- package/shared/presentationDate.js +4327 -4041
- package/shared/slider.template.cjs +23 -1
- package/shared/slider.template.js +21 -2
- 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 +35 -14
- package/styles/tokens/theme-light.css +35 -14
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/vivid.api.json +62 -5
- package/shared/aria2.cjs +0 -11
- package/shared/aria2.js +0 -9
- package/shared/button.cjs +0 -202
- package/shared/button.js +0 -200
- /package/shared/{patterns → foundation/patterns}/aria-global.d.ts +0 -0
package/shared/definition24.js
CHANGED
|
@@ -1,13 +1,167 @@
|
|
|
1
|
-
import { a as attr, h as html, r as registerFactory } from './index.js';
|
|
1
|
+
import { F as FoundationElement, a as attr, h as html, r as registerFactory } from './index.js';
|
|
2
2
|
import { a as iconRegistries } from './definition27.js';
|
|
3
3
|
import { b as AffixIconWithTrailing, a as affixIconTemplateFactory, I as IconWrapper } from './affix.js';
|
|
4
|
-
import {
|
|
4
|
+
import { F as FormAssociated } from './form-associated.js';
|
|
5
|
+
import { A as ARIAGlobalStatesAndProperties } from './aria-global2.js';
|
|
5
6
|
import { a as applyMixins } from './apply-mixins.js';
|
|
6
7
|
import { r as ref } from './ref.js';
|
|
7
8
|
import { c as classNames } from './class-names.js';
|
|
8
9
|
|
|
9
10
|
const styles = ".control.connotation-accent{--_connotation-color-primary: var(--vvd-fab-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-fab-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-fab-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-contrast: var(--vvd-fab-accent-contrast, var(--vvd-color-neutral-800));--_connotation-color-fierce: var(--vvd-fab-accent-fierce, var(--vvd-color-neutral-700));--_connotation-color-firm: var(--vvd-fab-accent-firm, var(--vvd-color-canvas-text))}.control.connotation-cta{--_connotation-color-primary: var(--vvd-fab-cta-primary, var(--vvd-color-cta-500));--_connotation-color-primary-text: var(--vvd-fab-cta-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-fab-cta-primary-increment, var(--vvd-color-cta-600));--_connotation-color-contrast: var(--vvd-fab-cta-contrast, var(--vvd-color-cta-800));--_connotation-color-fierce: var(--vvd-fab-cta-fierce, var(--vvd-color-cta-700));--_connotation-color-firm: var(--vvd-fab-cta-firm, var(--vvd-color-cta-600))}.control.connotation-announcement{--_connotation-color-primary: var(--vvd-fab-announcement-primary, var(--vvd-color-announcement-500));--_connotation-color-primary-text: var(--vvd-fab-announcement-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-fab-announcement-primary-increment, var(--vvd-color-announcement-600));--_connotation-color-contrast: var(--vvd-fab-announcement-contrast, var(--vvd-color-announcement-800));--_connotation-color-fierce: var(--vvd-fab-announcement-fierce, var(--vvd-color-announcement-700));--_connotation-color-firm: var(--vvd-fab-announcement-firm, var(--vvd-color-announcement-600))}.control{--_appearance-color-text: var(--_connotation-color-primary-text);--_appearance-color-fill: var(--_connotation-color-primary);--_appearance-color-outline: transparent}.control:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-primary-text);--_appearance-color-fill: var(--_connotation-color-primary-increment);--_appearance-color-outline: transparent}.control:where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-100);--_appearance-color-outline: transparent}.control:where(.active,:active):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-primary-text);--_appearance-color-fill: var(--_connotation-color-fierce);--_appearance-color-outline: transparent}.control{--_fab-inline-padding: 12px;display:inline-flex;box-sizing:border-box;align-items:center;border:0 none;border-radius:var(--_fab-border-radius);background:var(--_appearance-color-fill, var(--_elevation-fill));block-size:var(--_fab-block-size);color:var(--_appearance-color-text, var(--vvd-color-canvas-text));column-gap:var(--fab-icon-gap);filter:var(--_elevation-shadow);font:var(--vvd-typography-base-bold);padding-inline:var(--_fab-inline-padding);transition:background-color .15s linear,filter .15s linear;vertical-align:middle}.control:not(.connotation-accent,.connotation-cta){--focus-stroke-gap-color: transparent}.control:focus-visible{box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px))}@supports (user-select: none){.control{user-select:none}}.control.size-expanded{--_fab-border-radius: 40px;--_fab-block-size: calc(1px*(56 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) ;--_fab-inline-padding: 20px}.control.size-condensed{--_fab-border-radius: 20px;--_fab-block-size: calc(1px*(32 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) ;font:var(--vvd-typography-base-condensed-bold)}.control.size-condensed vwc-icon{font-size:calc(1px*(32 + 4*clamp(-1,var(--vvd-size-density, 0),2))/2)}.control:not(.size-expanded,.size-condensed){--_fab-border-radius: 24px;--_fab-block-size: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) }.control:not(.size-condensed){font:var(--vvd-typography-base-bold)}.control.icon-only{--_fab-inline-padding: 0;border-radius:50%;place-content:center}@supports (aspect-ratio: 1){.control.icon-only{aspect-ratio:1}}@supports not (aspect-ratio: 1){.control.icon-only{inline-size:var(--_fab-block-size)}}.control:not(.icon-only){--fab-icon-gap: 10px}.control:disabled{--_elevation-fill: var(--vvd-color-surface-nonedp);--_elevation-shadow: var(--vvd-shadow-surface-nonedp);cursor:not-allowed}.control:not(:disabled){--_elevation-fill: var(--vvd-color-surface-4dp);--_elevation-shadow: var(--vvd-shadow-surface-4dp);cursor:pointer}.control:not(:disabled):hover{--_elevation-fill: var(--vvd-color-surface-12dp);--_elevation-shadow: var(--vvd-shadow-surface-12dp)}.control:not(:disabled):active{--_elevation-fill: var(--vvd-color-surface-24dp);--_elevation-shadow: var(--vvd-shadow-surface-24dp)}slot[name=icon]{line-height:1}.icon-trailing slot[name=icon]{display:inline-block;order:1}.control.size-extended slot[name=icon]{font-size:calc(calc(1px*(56 + 4*clamp(-1,var(--vvd-size-density, 0),2))) / 2.3333)}.control:not(.size-extended) slot[name=icon]{font-size:calc(1px*(40 + 4*clamp(-1,var(--vvd-size-density, 0),2))/2)}";
|
|
10
11
|
|
|
12
|
+
class _FoundationButton extends FoundationElement {
|
|
13
|
+
}
|
|
14
|
+
class FormAssociatedButton extends FormAssociated(_FoundationButton) {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.proxy = document.createElement("input");
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
var __defProp$1 = Object.defineProperty;
|
|
22
|
+
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
23
|
+
var result = void 0 ;
|
|
24
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
25
|
+
if (decorator = decorators[i])
|
|
26
|
+
result = (decorator(target, key, result) ) || result;
|
|
27
|
+
if (result) __defProp$1(target, key, result);
|
|
28
|
+
return result;
|
|
29
|
+
};
|
|
30
|
+
class FoundationButton extends FormAssociatedButton {
|
|
31
|
+
constructor() {
|
|
32
|
+
super(...arguments);
|
|
33
|
+
/**
|
|
34
|
+
* Prevent events to propagate if disabled
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
this.handleClick = (e) => {
|
|
38
|
+
if (this.disabled) {
|
|
39
|
+
e.stopPropagation();
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Submits the parent form
|
|
44
|
+
*/
|
|
45
|
+
this.handleSubmission = () => {
|
|
46
|
+
if (!this.form) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
this.attachProxy();
|
|
50
|
+
this.form.requestSubmit(this.proxy);
|
|
51
|
+
this.detachProxy();
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Resets the parent form
|
|
55
|
+
*/
|
|
56
|
+
this.handleFormReset = () => {
|
|
57
|
+
this.form?.reset();
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
// @ts-expect-error Function is delcared but not used
|
|
61
|
+
formactionChanged() {
|
|
62
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
63
|
+
this.proxy.formAction = this.formaction;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// @ts-expect-error Function is delcared but not used
|
|
67
|
+
formenctypeChanged() {
|
|
68
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
69
|
+
this.proxy.formEnctype = this.formenctype;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// @ts-expect-error Function is delcared but not used
|
|
73
|
+
formmethodChanged() {
|
|
74
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
75
|
+
this.proxy.formMethod = this.formmethod;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// @ts-expect-error Function is delcared but not used
|
|
79
|
+
formnovalidateChanged() {
|
|
80
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
81
|
+
this.proxy.formNoValidate = this.formnovalidate;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// @ts-expect-error Function is delcared but not used
|
|
85
|
+
formtargetChanged() {
|
|
86
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
87
|
+
this.proxy.formTarget = this.formtarget;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// @ts-expect-error Function is delcared but not used
|
|
91
|
+
typeChanged(previous, next) {
|
|
92
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
93
|
+
this.proxy.type = this.type;
|
|
94
|
+
}
|
|
95
|
+
next === "submit" && this.addEventListener("click", this.handleSubmission);
|
|
96
|
+
previous === "submit" && this.removeEventListener("click", this.handleSubmission);
|
|
97
|
+
next === "reset" && this.addEventListener("click", this.handleFormReset);
|
|
98
|
+
previous === "reset" && this.removeEventListener("click", this.handleFormReset);
|
|
99
|
+
}
|
|
100
|
+
/** {@inheritDoc (FormAssociated:interface).validate} */
|
|
101
|
+
validate() {
|
|
102
|
+
super.validate(this.control);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* @internal
|
|
106
|
+
*/
|
|
107
|
+
connectedCallback() {
|
|
108
|
+
super.connectedCallback();
|
|
109
|
+
this.proxy.setAttribute("type", this.type);
|
|
110
|
+
const elements = Array.from(this.control.children);
|
|
111
|
+
if (elements) {
|
|
112
|
+
elements.forEach((span) => {
|
|
113
|
+
span.addEventListener("click", this.handleClick);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* @internal
|
|
119
|
+
*/
|
|
120
|
+
disconnectedCallback() {
|
|
121
|
+
super.disconnectedCallback();
|
|
122
|
+
const elements = Array.from(this.control.children);
|
|
123
|
+
if (elements) {
|
|
124
|
+
elements.forEach((span) => {
|
|
125
|
+
span.removeEventListener("click", this.handleClick);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
__decorateClass$1([
|
|
131
|
+
attr({ mode: "boolean" })
|
|
132
|
+
], FoundationButton.prototype, "autofocus");
|
|
133
|
+
__decorateClass$1([
|
|
134
|
+
attr({ attribute: "form" })
|
|
135
|
+
], FoundationButton.prototype, "formId");
|
|
136
|
+
__decorateClass$1([
|
|
137
|
+
attr
|
|
138
|
+
], FoundationButton.prototype, "formaction");
|
|
139
|
+
__decorateClass$1([
|
|
140
|
+
attr
|
|
141
|
+
], FoundationButton.prototype, "formenctype");
|
|
142
|
+
__decorateClass$1([
|
|
143
|
+
attr
|
|
144
|
+
], FoundationButton.prototype, "formmethod");
|
|
145
|
+
__decorateClass$1([
|
|
146
|
+
attr({ mode: "boolean" })
|
|
147
|
+
], FoundationButton.prototype, "formnovalidate");
|
|
148
|
+
__decorateClass$1([
|
|
149
|
+
attr
|
|
150
|
+
], FoundationButton.prototype, "formtarget");
|
|
151
|
+
__decorateClass$1([
|
|
152
|
+
attr
|
|
153
|
+
], FoundationButton.prototype, "type");
|
|
154
|
+
class DelegatesARIAButton {
|
|
155
|
+
}
|
|
156
|
+
__decorateClass$1([
|
|
157
|
+
attr({ attribute: "aria-expanded" })
|
|
158
|
+
], DelegatesARIAButton.prototype, "ariaExpanded");
|
|
159
|
+
__decorateClass$1([
|
|
160
|
+
attr({ attribute: "aria-pressed" })
|
|
161
|
+
], DelegatesARIAButton.prototype, "ariaPressed");
|
|
162
|
+
applyMixins(DelegatesARIAButton, ARIAGlobalStatesAndProperties);
|
|
163
|
+
applyMixins(FoundationButton, DelegatesARIAButton);
|
|
164
|
+
|
|
11
165
|
var __defProp = Object.defineProperty;
|
|
12
166
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
13
167
|
var result = void 0 ;
|
|
@@ -17,7 +171,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
17
171
|
if (result) __defProp(target, key, result);
|
|
18
172
|
return result;
|
|
19
173
|
};
|
|
20
|
-
class Fab extends
|
|
174
|
+
class Fab extends FoundationButton {
|
|
21
175
|
}
|
|
22
176
|
__decorateClass([
|
|
23
177
|
attr
|
package/shared/definition25.cjs
CHANGED
|
@@ -12,7 +12,7 @@ const when = require('./when.cjs');
|
|
|
12
12
|
const ref = require('./ref.cjs');
|
|
13
13
|
const classNames = require('./class-names.cjs');
|
|
14
14
|
|
|
15
|
-
const styles = ":host{display:block;max-inline-size:400px}.base{display:flex;flex-direction:column}.control{display:flex;box-sizing:border-box;flex-wrap:wrap;align-items:center;justify-content:center;padding:16px;border:1px dashed var(--vvd-color-neutral-400);border-radius:8px;background-color:var(--vvd-color-cta-50);color:var(--vvd-color-neutral-600);cursor:pointer;font:var(--vvd-typography-base);gap:8px;inline-size:100%;min-block-size:52px;outline:none}.control:not(.size-expanded){min-block-size:52px}.control.size-expanded{min-block-size:120px}.control:focus-visible{--focus-stroke-gap-color: transparent;--focus-inset: 1px;box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px))}.main{pointer-events:none}.dz-preview{display:grid;box-sizing:border-box;padding:8px;border-radius:8px;background-color:var(--file-picker-list-item-background-color, var(--vvd-color-canvas));grid-template-columns:1fr auto;grid-template-rows:auto auto;inline-size:100%}.dz-preview .dz-details{display:flex;min-width:0;flex-direction:column;max-inline-size:100%}.dz-preview .dz-details .dz-filename{overflow:hidden;color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base);text-overflow:ellipsis;white-space:nowrap}.dz-preview .dz-details .dz-size{color:var(--vvd-color-neutral-600);font:var(--vvd-typography-base-condensed)}.dz-preview .dz-error-message{color:var(--vvd-color-alert-500);font:var(--vvd-typography-base-condensed);margin-block-start:4px}.dz-preview:not(.dz-error) .dz-error-message{display:none}.dz-preview.dz-error{border:1px solid var(--vvd-color-alert-500)}.dz-preview.dz-error .dz-details .dz-size,.dz-preview.dz-error .dz-progress{display:none}.dz-preview .remove-btn{display:inline;align-self:center;grid-column:2/-1;grid-row:1/-1}.message{margin-block-start:4px;--_low-ink-color: var(--vvd-color-neutral-600)}.preview-list{display:flex;flex-direction:column;gap:12px;margin-block-start:12px;overflow-y:auto}.preview-list:empty{display:none}";
|
|
15
|
+
const styles = ":host{display:block;max-inline-size:400px}.base{display:flex;flex-direction:column}.control{display:flex;box-sizing:border-box;flex-wrap:wrap;align-items:center;justify-content:center;padding:16px;border:1px dashed var(--vvd-color-neutral-400);border-radius:8px;background-color:var(--vvd-color-cta-50);color:var(--vvd-color-neutral-600);cursor:pointer;font:var(--vvd-typography-base);gap:8px;inline-size:100%;min-block-size:52px;outline:none;transition:all .3s ease}.control:not(.size-expanded){min-block-size:52px}.control.size-expanded{min-block-size:120px}.control:focus-visible{--focus-stroke-gap-color: transparent;--focus-inset: 1px;box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px))}.control:hover{border-style:solid;background-color:var(--vvd-color-cta-100)}.main{pointer-events:none}.dz-preview{display:grid;box-sizing:border-box;padding:8px;border:1px solid var(--vvd-color-neutral-300);border-radius:8px;background-color:var(--file-picker-list-item-background-color, var(--vvd-color-canvas));grid-template-columns:1fr auto;grid-template-rows:auto auto;inline-size:100%}.dz-preview .dz-details{display:flex;min-width:0;flex-direction:column;max-inline-size:100%}.dz-preview .dz-details .dz-filename{overflow:hidden;color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base);text-overflow:ellipsis;white-space:nowrap}.dz-preview .dz-details .dz-size{color:var(--vvd-color-neutral-600);font:var(--vvd-typography-base-condensed)}.dz-preview .dz-error-message{color:var(--vvd-color-alert-500);font:var(--vvd-typography-base-condensed);margin-block-start:4px}.dz-preview:not(.dz-error) .dz-error-message{display:none}.dz-preview.dz-error{border:1px solid var(--vvd-color-alert-500)}.dz-preview.dz-error .dz-details .dz-size,.dz-preview.dz-error .dz-progress{display:none}.dz-preview .remove-btn{display:inline;align-self:center;grid-column:2/-1;grid-row:1/-1}.message{margin-block-start:4px;--_low-ink-color: var(--vvd-color-neutral-600)}.preview-list{display:flex;flex-direction:column;gap:12px;margin-block-start:12px;overflow-y:auto}.preview-list:empty{display:none}";
|
|
16
16
|
|
|
17
17
|
var objectExtend = extend;
|
|
18
18
|
|
|
@@ -2167,18 +2167,56 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
2167
2167
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
2168
2168
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
2169
2169
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
2170
|
-
var _dropzone, _FilePicker_instances, chooseFile_fn, updateHiddenFileInput_fn, handleFilesChanged_fn, updateFormValue_fn, setValueToAFakePathLikeNativeInput_fn, formatNumbersInMessage_fn;
|
|
2170
|
+
var _dropzone, _FilePicker_instances, syncSingleFileState_fn, _localizeErrorMessage, _localizeFileSizeNumberAndUnits, addRemoveButtonToFilesPreview_fn, setRemoveButtonConnotationOnError_fn, chooseFile_fn, updateHiddenFileInput_fn, keepOnlyNewestFile_fn, handleFilesChanged_fn, updateFormValue_fn, setValueToAFakePathLikeNativeInput_fn, formatNumbersInMessage_fn;
|
|
2171
2171
|
const isFormAssociatedTryingToSetFormValueToFakePath = (value) => typeof value === "string";
|
|
2172
|
+
const generateFilePreviewTemplate = (buttonTag, locale) => {
|
|
2173
|
+
return `<div class="dz-preview dz-file-preview">
|
|
2174
|
+
<div class="dz-details">
|
|
2175
|
+
<div class="dz-filename"><span data-dz-name></span></div>
|
|
2176
|
+
<div class="dz-size"><span data-dz-size></span></div>
|
|
2177
|
+
</div>
|
|
2178
|
+
<div class="dz-error-message"><span data-dz-errormessage></span></div>
|
|
2179
|
+
<${buttonTag} class="remove-btn" icon="delete-line" appearance="ghost" size="condensed" aria-label="${locale.filePicker.removeFileLabel}"></${buttonTag}>
|
|
2180
|
+
</div>`;
|
|
2181
|
+
};
|
|
2172
2182
|
let FilePicker = class extends FormAssociatedFilePicker {
|
|
2173
2183
|
constructor() {
|
|
2174
2184
|
super();
|
|
2175
2185
|
__privateAdd(this, _FilePicker_instances);
|
|
2176
2186
|
__privateAdd(this, _dropzone);
|
|
2187
|
+
this.singleFile = false;
|
|
2177
2188
|
this.maxFileSize = 256;
|
|
2189
|
+
/**
|
|
2190
|
+
* @internal
|
|
2191
|
+
*/
|
|
2192
|
+
this.valueChanged = (previous, next) => {
|
|
2193
|
+
super.valueChanged(previous, next);
|
|
2194
|
+
if (next === "" && this.files.length) {
|
|
2195
|
+
this.removeAllFiles();
|
|
2196
|
+
}
|
|
2197
|
+
};
|
|
2178
2198
|
/**
|
|
2179
2199
|
* Used internally to hold the tag that button is registered at.
|
|
2180
2200
|
*/
|
|
2181
2201
|
this.buttonTag = "vwc-button";
|
|
2202
|
+
__privateAdd(this, _localizeErrorMessage, (file, message) => {
|
|
2203
|
+
if (file.previewElement) {
|
|
2204
|
+
file.previewElement.classList.add("dz-error");
|
|
2205
|
+
if (typeof message !== "string" && message.error) {
|
|
2206
|
+
message = message.error;
|
|
2207
|
+
}
|
|
2208
|
+
for (const node of file.previewElement.querySelectorAll(
|
|
2209
|
+
"[data-dz-errormessage]"
|
|
2210
|
+
)) {
|
|
2211
|
+
node.textContent = __privateMethod(this, _FilePicker_instances, formatNumbersInMessage_fn).call(this, message);
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
});
|
|
2215
|
+
__privateAdd(this, _localizeFileSizeNumberAndUnits, () => {
|
|
2216
|
+
__privateGet(this, _dropzone).filesize = (size) => {
|
|
2217
|
+
return __privateMethod(this, _FilePicker_instances, formatNumbersInMessage_fn).call(this, $3ed269f2f0fb224b$export$2e2bcd8739ae039.prototype.filesize.call(__privateGet(this, _dropzone), size));
|
|
2218
|
+
};
|
|
2219
|
+
});
|
|
2182
2220
|
this.setFormValue = (value, state) => {
|
|
2183
2221
|
if (isFormAssociatedTryingToSetFormValueToFakePath(value)) {
|
|
2184
2222
|
return;
|
|
@@ -2195,6 +2233,9 @@ let FilePicker = class extends FormAssociatedFilePicker {
|
|
|
2195
2233
|
get files() {
|
|
2196
2234
|
return __privateGet(this, _dropzone)?.getAcceptedFiles() ?? [];
|
|
2197
2235
|
}
|
|
2236
|
+
singleFileChanged() {
|
|
2237
|
+
__privateMethod(this, _FilePicker_instances, syncSingleFileState_fn).call(this);
|
|
2238
|
+
}
|
|
2198
2239
|
maxFilesChanged(_oldValue, newValue) {
|
|
2199
2240
|
if (!__privateGet(this, _dropzone)) {
|
|
2200
2241
|
return;
|
|
@@ -2236,62 +2277,18 @@ let FilePicker = class extends FormAssociatedFilePicker {
|
|
|
2236
2277
|
addRemoveLinks: false,
|
|
2237
2278
|
previewsContainer: previewList,
|
|
2238
2279
|
createImageThumbnails: false,
|
|
2239
|
-
|
|
2240
|
-
previewTemplate: `<div class="dz-preview dz-file-preview">
|
|
2241
|
-
<div class="dz-details">
|
|
2242
|
-
<div class="dz-filename"><span data-dz-name></span></div>
|
|
2243
|
-
<div class="dz-size"><span data-dz-size></span></div>
|
|
2244
|
-
</div>
|
|
2245
|
-
<div class="dz-error-message"><span data-dz-errormessage></span></div>
|
|
2246
|
-
<${this.buttonTag} class="remove-btn" icon="delete-line" appearance="ghost" size="condensed" aria-label="${this.locale.filePicker.removeFileLabel}"></${this.buttonTag}>
|
|
2247
|
-
</div>`,
|
|
2280
|
+
previewTemplate: generateFilePreviewTemplate(this.buttonTag, this.locale),
|
|
2248
2281
|
dictInvalidFileType: this.locale.filePicker.invalidFileTypeError,
|
|
2249
2282
|
dictMaxFilesExceeded: this.locale.filePicker.maxFilesExceededError,
|
|
2250
2283
|
dictFileTooBig: this.locale.filePicker.fileTooBigError,
|
|
2251
|
-
|
|
2252
|
-
error: (file, message) => {
|
|
2253
|
-
if (file.previewElement) {
|
|
2254
|
-
file.previewElement.classList.add("dz-error");
|
|
2255
|
-
if (typeof message !== "string" && message.error) {
|
|
2256
|
-
message = message.error;
|
|
2257
|
-
}
|
|
2258
|
-
for (const node of file.previewElement.querySelectorAll(
|
|
2259
|
-
"[data-dz-errormessage]"
|
|
2260
|
-
)) {
|
|
2261
|
-
node.textContent = __privateMethod(this, _FilePicker_instances, formatNumbersInMessage_fn).call(this, message);
|
|
2262
|
-
}
|
|
2263
|
-
}
|
|
2264
|
-
}
|
|
2284
|
+
error: __privateGet(this, _localizeErrorMessage)
|
|
2265
2285
|
}));
|
|
2266
|
-
__privateGet(this,
|
|
2267
|
-
|
|
2268
|
-
};
|
|
2269
|
-
__privateGet(this, _dropzone).on("addedfiles", (files) => {
|
|
2270
|
-
for (const file of files) {
|
|
2271
|
-
if (file.previewElement) {
|
|
2272
|
-
const removeButton = file.previewElement.querySelector(
|
|
2273
|
-
".remove-btn"
|
|
2274
|
-
);
|
|
2275
|
-
removeButton.addEventListener("click", (e) => {
|
|
2276
|
-
e.preventDefault();
|
|
2277
|
-
e.stopPropagation();
|
|
2278
|
-
__privateGet(this, _dropzone).removeFile(file);
|
|
2279
|
-
});
|
|
2280
|
-
}
|
|
2281
|
-
}
|
|
2282
|
-
__privateMethod(this, _FilePicker_instances, handleFilesChanged_fn).call(this);
|
|
2283
|
-
});
|
|
2286
|
+
__privateGet(this, _localizeFileSizeNumberAndUnits).call(this);
|
|
2287
|
+
__privateMethod(this, _FilePicker_instances, addRemoveButtonToFilesPreview_fn).call(this);
|
|
2284
2288
|
__privateGet(this, _dropzone).on("removedfile", () => {
|
|
2285
2289
|
__privateMethod(this, _FilePicker_instances, handleFilesChanged_fn).call(this);
|
|
2286
2290
|
});
|
|
2287
|
-
|
|
2288
|
-
if (file.previewElement) {
|
|
2289
|
-
const removeButton = file.previewElement.querySelector(
|
|
2290
|
-
".remove-btn"
|
|
2291
|
-
);
|
|
2292
|
-
removeButton.connotation = enums.Connotation.Alert;
|
|
2293
|
-
}
|
|
2294
|
-
});
|
|
2291
|
+
__privateMethod(this, _FilePicker_instances, syncSingleFileState_fn).call(this);
|
|
2295
2292
|
}
|
|
2296
2293
|
disconnectedCallback() {
|
|
2297
2294
|
super.disconnectedCallback();
|
|
@@ -2320,24 +2317,74 @@ let FilePicker = class extends FormAssociatedFilePicker {
|
|
|
2320
2317
|
super.formResetCallback();
|
|
2321
2318
|
__privateGet(this, _dropzone).removeAllFiles();
|
|
2322
2319
|
}
|
|
2320
|
+
/**
|
|
2321
|
+
* Removes all files from the File Picker.
|
|
2322
|
+
*/
|
|
2323
|
+
removeAllFiles() {
|
|
2324
|
+
__privateGet(this, _dropzone)?.removeAllFiles();
|
|
2325
|
+
}
|
|
2323
2326
|
};
|
|
2324
2327
|
_dropzone = new WeakMap();
|
|
2325
2328
|
_FilePicker_instances = new WeakSet();
|
|
2329
|
+
syncSingleFileState_fn = function() {
|
|
2330
|
+
if (this.singleFile) {
|
|
2331
|
+
__privateGet(this, _dropzone)?.hiddenFileInput?.removeAttribute("multiple");
|
|
2332
|
+
} else {
|
|
2333
|
+
__privateGet(this, _dropzone)?.hiddenFileInput?.setAttribute("multiple", "multiple");
|
|
2334
|
+
}
|
|
2335
|
+
};
|
|
2336
|
+
_localizeErrorMessage = new WeakMap();
|
|
2337
|
+
_localizeFileSizeNumberAndUnits = new WeakMap();
|
|
2338
|
+
addRemoveButtonToFilesPreview_fn = function() {
|
|
2339
|
+
__privateGet(this, _dropzone).on("addedfiles", (files) => {
|
|
2340
|
+
for (const file of files) {
|
|
2341
|
+
if (file.previewElement) {
|
|
2342
|
+
const removeButton = file.previewElement.querySelector(
|
|
2343
|
+
".remove-btn"
|
|
2344
|
+
);
|
|
2345
|
+
removeButton.addEventListener("click", (e) => {
|
|
2346
|
+
e.preventDefault();
|
|
2347
|
+
e.stopPropagation();
|
|
2348
|
+
__privateGet(this, _dropzone).removeFile(file);
|
|
2349
|
+
});
|
|
2350
|
+
}
|
|
2351
|
+
}
|
|
2352
|
+
__privateMethod(this, _FilePicker_instances, handleFilesChanged_fn).call(this);
|
|
2353
|
+
});
|
|
2354
|
+
__privateMethod(this, _FilePicker_instances, setRemoveButtonConnotationOnError_fn).call(this);
|
|
2355
|
+
};
|
|
2356
|
+
setRemoveButtonConnotationOnError_fn = function() {
|
|
2357
|
+
__privateGet(this, _dropzone).on("error", (file) => {
|
|
2358
|
+
if (file.previewElement) {
|
|
2359
|
+
const removeButton = file.previewElement.querySelector(
|
|
2360
|
+
".remove-btn"
|
|
2361
|
+
);
|
|
2362
|
+
removeButton.connotation = enums.Connotation.Alert;
|
|
2363
|
+
}
|
|
2364
|
+
});
|
|
2365
|
+
};
|
|
2326
2366
|
chooseFile_fn = function() {
|
|
2327
2367
|
if (__privateGet(this, _dropzone).hiddenFileInput) {
|
|
2328
2368
|
__privateGet(this, _dropzone).hiddenFileInput.click();
|
|
2329
2369
|
}
|
|
2330
2370
|
};
|
|
2331
2371
|
updateHiddenFileInput_fn = function() {
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2372
|
+
__privateGet(this, _dropzone).hiddenFileInput.dispatchEvent(
|
|
2373
|
+
new Event("change", { bubbles: false })
|
|
2374
|
+
);
|
|
2375
|
+
};
|
|
2376
|
+
keepOnlyNewestFile_fn = function() {
|
|
2377
|
+
for (let i = 0; i < this.files.length - 1; i++) {
|
|
2378
|
+
__privateGet(this, _dropzone).removeFile(this.files[i]);
|
|
2336
2379
|
}
|
|
2337
2380
|
};
|
|
2338
2381
|
handleFilesChanged_fn = function() {
|
|
2382
|
+
if (this.singleFile && this.files.length >= 1) {
|
|
2383
|
+
__privateMethod(this, _FilePicker_instances, keepOnlyNewestFile_fn).call(this);
|
|
2384
|
+
}
|
|
2339
2385
|
this.$emit("change");
|
|
2340
2386
|
__privateMethod(this, _FilePicker_instances, updateFormValue_fn).call(this);
|
|
2387
|
+
requestAnimationFrame(() => __privateMethod(this, _FilePicker_instances, syncSingleFileState_fn).call(this));
|
|
2341
2388
|
};
|
|
2342
2389
|
updateFormValue_fn = function() {
|
|
2343
2390
|
const files = this.files;
|
|
@@ -2361,6 +2408,9 @@ formatNumbersInMessage_fn = function(message) {
|
|
|
2361
2408
|
}
|
|
2362
2409
|
return message;
|
|
2363
2410
|
};
|
|
2411
|
+
__decorateClass([
|
|
2412
|
+
index.attr({ attribute: "single-file", mode: "boolean" })
|
|
2413
|
+
], FilePicker.prototype, "singleFile", 2);
|
|
2364
2414
|
__decorateClass([
|
|
2365
2415
|
index.attr({ attribute: "max-files" })
|
|
2366
2416
|
], FilePicker.prototype, "maxFiles", 2);
|
|
@@ -2386,7 +2436,7 @@ const getClasses = ({ size }) => classNames.classNames("control", "dz-default",
|
|
|
2386
2436
|
const FilePickerTemplate = (context) => {
|
|
2387
2437
|
return index.html`
|
|
2388
2438
|
${(x) => {
|
|
2389
|
-
x.setButtonTag(context.tagFor(definition.Button));
|
|
2439
|
+
x.setButtonTag(context.tagFor(definition.Button$1));
|
|
2390
2440
|
}}
|
|
2391
2441
|
<div class="base" aria-label="${(x) => x.label}">
|
|
2392
2442
|
${when.when(
|