@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/definition21.cjs
CHANGED
|
@@ -31,10 +31,13 @@ class Dialog extends index.FoundationElement {
|
|
|
31
31
|
this.ariaLabel = null;
|
|
32
32
|
this.dismissButtonAriaLabel = null;
|
|
33
33
|
this.noLightDismiss = false;
|
|
34
|
+
this.noDismissOnEsc = false;
|
|
35
|
+
this.noDismissButton = false;
|
|
36
|
+
this.nonDismissible = false;
|
|
34
37
|
this.modal = false;
|
|
35
38
|
this._openedAsModal = false;
|
|
36
39
|
this.#handleScrimClick = (event) => {
|
|
37
|
-
if (event.target !== this.#dialog || this
|
|
40
|
+
if (event.target !== this.#dialog || !this.#isDismissibleVia("light-dismiss")) {
|
|
38
41
|
return;
|
|
39
42
|
}
|
|
40
43
|
const rect = this.#dialog.getBoundingClientRect();
|
|
@@ -100,6 +103,22 @@ class Dialog extends index.FoundationElement {
|
|
|
100
103
|
this.$emit("open", void 0, { bubbles: false });
|
|
101
104
|
}
|
|
102
105
|
}
|
|
106
|
+
get _showDismissButton() {
|
|
107
|
+
return this.#isDismissibleVia("dismiss-button");
|
|
108
|
+
}
|
|
109
|
+
#isDismissibleVia(method) {
|
|
110
|
+
if (this.nonDismissible) {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
switch (method) {
|
|
114
|
+
case "escape":
|
|
115
|
+
return !this.noDismissOnEsc;
|
|
116
|
+
case "dismiss-button":
|
|
117
|
+
return !this.noDismissButton;
|
|
118
|
+
case "light-dismiss":
|
|
119
|
+
return !this.noLightDismiss;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
103
122
|
#handleScrimClick;
|
|
104
123
|
#handleInternalFormSubmit;
|
|
105
124
|
/**
|
|
@@ -107,7 +126,9 @@ class Dialog extends index.FoundationElement {
|
|
|
107
126
|
*/
|
|
108
127
|
_onKeyDown(event) {
|
|
109
128
|
if (index$1.handleEscapeKeyAndStopPropogation(event) && this._openedAsModal) {
|
|
110
|
-
this
|
|
129
|
+
if (this.#isDismissibleVia("escape")) {
|
|
130
|
+
this._handleCloseRequest();
|
|
131
|
+
}
|
|
111
132
|
return false;
|
|
112
133
|
}
|
|
113
134
|
return true;
|
|
@@ -199,6 +220,15 @@ __decorateClass([
|
|
|
199
220
|
__decorateClass([
|
|
200
221
|
index.attr({ attribute: "no-light-dismiss", mode: "boolean" })
|
|
201
222
|
], Dialog.prototype, "noLightDismiss");
|
|
223
|
+
__decorateClass([
|
|
224
|
+
index.attr({ attribute: "no-dismiss-on-esc", mode: "boolean" })
|
|
225
|
+
], Dialog.prototype, "noDismissOnEsc");
|
|
226
|
+
__decorateClass([
|
|
227
|
+
index.attr({ attribute: "no-dismiss-button", mode: "boolean" })
|
|
228
|
+
], Dialog.prototype, "noDismissButton");
|
|
229
|
+
__decorateClass([
|
|
230
|
+
index.attr({ attribute: "non-dismissible", mode: "boolean" })
|
|
231
|
+
], Dialog.prototype, "nonDismissible");
|
|
202
232
|
__decorateClass([
|
|
203
233
|
index.attr({ mode: "boolean" })
|
|
204
234
|
], Dialog.prototype, "modal");
|
|
@@ -256,7 +286,7 @@ function renderDismissButton(buttonTag) {
|
|
|
256
286
|
const DialogTemplate = (context) => {
|
|
257
287
|
const elevationTag = context.tagFor(definition.Elevation);
|
|
258
288
|
const iconTag = context.tagFor(icon$1.Icon);
|
|
259
|
-
const buttonTag = context.tagFor(definition$1.Button);
|
|
289
|
+
const buttonTag = context.tagFor(definition$1.Button$1);
|
|
260
290
|
return index.html`
|
|
261
291
|
<${elevationTag} dp="8">
|
|
262
292
|
<dialog class="${getClasses}"
|
|
@@ -273,7 +303,7 @@ const DialogTemplate = (context) => {
|
|
|
273
303
|
</slot>
|
|
274
304
|
${when.when((x) => x.headline, headline())}
|
|
275
305
|
${when.when((x) => x.subtitle, subtitle())}
|
|
276
|
-
${renderDismissButton(buttonTag)}
|
|
306
|
+
${when.when((x) => x._showDismissButton, renderDismissButton(buttonTag))}
|
|
277
307
|
</div>
|
|
278
308
|
<div class="body ${(x) => x.fullWidthBody ? "full-width" : ""}" >
|
|
279
309
|
<slot name="body" ${slotted.slotted("bodySlottedContent")}></slot>
|
package/shared/definition21.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { F as FoundationElement, a as attr, o as observable, h as html, r as registerFactory } from './index.js';
|
|
2
2
|
import { a as iconRegistries } from './definition27.js';
|
|
3
|
-
import {
|
|
3
|
+
import { c as Button, a as buttonRegistries } from './definition11.js';
|
|
4
4
|
import { E as Elevation, e as elevationRegistries } from './definition63.js';
|
|
5
5
|
import { h as handleEscapeKeyAndStopPropogation } from './index2.js';
|
|
6
6
|
import { a as applyMixins } from './apply-mixins.js';
|
|
@@ -29,10 +29,13 @@ class Dialog extends FoundationElement {
|
|
|
29
29
|
this.ariaLabel = null;
|
|
30
30
|
this.dismissButtonAriaLabel = null;
|
|
31
31
|
this.noLightDismiss = false;
|
|
32
|
+
this.noDismissOnEsc = false;
|
|
33
|
+
this.noDismissButton = false;
|
|
34
|
+
this.nonDismissible = false;
|
|
32
35
|
this.modal = false;
|
|
33
36
|
this._openedAsModal = false;
|
|
34
37
|
this.#handleScrimClick = (event) => {
|
|
35
|
-
if (event.target !== this.#dialog || this
|
|
38
|
+
if (event.target !== this.#dialog || !this.#isDismissibleVia("light-dismiss")) {
|
|
36
39
|
return;
|
|
37
40
|
}
|
|
38
41
|
const rect = this.#dialog.getBoundingClientRect();
|
|
@@ -98,6 +101,22 @@ class Dialog extends FoundationElement {
|
|
|
98
101
|
this.$emit("open", void 0, { bubbles: false });
|
|
99
102
|
}
|
|
100
103
|
}
|
|
104
|
+
get _showDismissButton() {
|
|
105
|
+
return this.#isDismissibleVia("dismiss-button");
|
|
106
|
+
}
|
|
107
|
+
#isDismissibleVia(method) {
|
|
108
|
+
if (this.nonDismissible) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
switch (method) {
|
|
112
|
+
case "escape":
|
|
113
|
+
return !this.noDismissOnEsc;
|
|
114
|
+
case "dismiss-button":
|
|
115
|
+
return !this.noDismissButton;
|
|
116
|
+
case "light-dismiss":
|
|
117
|
+
return !this.noLightDismiss;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
101
120
|
#handleScrimClick;
|
|
102
121
|
#handleInternalFormSubmit;
|
|
103
122
|
/**
|
|
@@ -105,7 +124,9 @@ class Dialog extends FoundationElement {
|
|
|
105
124
|
*/
|
|
106
125
|
_onKeyDown(event) {
|
|
107
126
|
if (handleEscapeKeyAndStopPropogation(event) && this._openedAsModal) {
|
|
108
|
-
this
|
|
127
|
+
if (this.#isDismissibleVia("escape")) {
|
|
128
|
+
this._handleCloseRequest();
|
|
129
|
+
}
|
|
109
130
|
return false;
|
|
110
131
|
}
|
|
111
132
|
return true;
|
|
@@ -197,6 +218,15 @@ __decorateClass([
|
|
|
197
218
|
__decorateClass([
|
|
198
219
|
attr({ attribute: "no-light-dismiss", mode: "boolean" })
|
|
199
220
|
], Dialog.prototype, "noLightDismiss");
|
|
221
|
+
__decorateClass([
|
|
222
|
+
attr({ attribute: "no-dismiss-on-esc", mode: "boolean" })
|
|
223
|
+
], Dialog.prototype, "noDismissOnEsc");
|
|
224
|
+
__decorateClass([
|
|
225
|
+
attr({ attribute: "no-dismiss-button", mode: "boolean" })
|
|
226
|
+
], Dialog.prototype, "noDismissButton");
|
|
227
|
+
__decorateClass([
|
|
228
|
+
attr({ attribute: "non-dismissible", mode: "boolean" })
|
|
229
|
+
], Dialog.prototype, "nonDismissible");
|
|
200
230
|
__decorateClass([
|
|
201
231
|
attr({ mode: "boolean" })
|
|
202
232
|
], Dialog.prototype, "modal");
|
|
@@ -271,7 +301,7 @@ const DialogTemplate = (context) => {
|
|
|
271
301
|
</slot>
|
|
272
302
|
${when((x) => x.headline, headline())}
|
|
273
303
|
${when((x) => x.subtitle, subtitle())}
|
|
274
|
-
${renderDismissButton(buttonTag)}
|
|
304
|
+
${when((x) => x._showDismissButton, renderDismissButton(buttonTag))}
|
|
275
305
|
</div>
|
|
276
306
|
<div class="body ${(x) => x.fullWidthBody ? "full-width" : ""}" >
|
|
277
307
|
<slot name="body" ${slotted("bodySlottedContent")}></slot>
|
package/shared/definition22.cjs
CHANGED
|
@@ -1,62 +1,43 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const index = require('./index.cjs');
|
|
4
|
-
const aria = require('./
|
|
4
|
+
const aria = require('./aria.cjs');
|
|
5
5
|
const classNames = require('./class-names.cjs');
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* Divider roles
|
|
9
|
-
* @public
|
|
10
|
-
*/
|
|
11
|
-
const DividerRole = {
|
|
12
|
-
/**
|
|
13
|
-
* The divider semantically separates content
|
|
14
|
-
*/
|
|
15
|
-
separator: "separator",
|
|
16
|
-
/**
|
|
17
|
-
* The divider has no semantic value and is for visual presentation only.
|
|
18
|
-
*/
|
|
19
|
-
presentation: "presentation",
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* A Divider Custom HTML Element.
|
|
24
|
-
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#separator | ARIA separator } or {@link https://www.w3.org/TR/wai-aria-1.1/#presentation | ARIA presentation}.
|
|
25
|
-
*
|
|
26
|
-
* @public
|
|
27
|
-
*/
|
|
28
|
-
let Divider$1 = class Divider extends index.FoundationElement {
|
|
29
|
-
constructor() {
|
|
30
|
-
super(...arguments);
|
|
31
|
-
/**
|
|
32
|
-
* The role of the element.
|
|
33
|
-
*
|
|
34
|
-
* @public
|
|
35
|
-
* @remarks
|
|
36
|
-
* HTML Attribute: role
|
|
37
|
-
*/
|
|
38
|
-
this.role = DividerRole.separator;
|
|
39
|
-
/**
|
|
40
|
-
* The orientation of the divider.
|
|
41
|
-
*
|
|
42
|
-
* @public
|
|
43
|
-
* @remarks
|
|
44
|
-
* HTML Attribute: orientation
|
|
45
|
-
*/
|
|
46
|
-
this.orientation = aria.Orientation.horizontal;
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
index.__decorate([
|
|
50
|
-
index.attr
|
|
51
|
-
], Divider$1.prototype, "role", void 0);
|
|
52
|
-
index.__decorate([
|
|
53
|
-
index.attr
|
|
54
|
-
], Divider$1.prototype, "orientation", void 0);
|
|
55
|
-
|
|
56
7
|
const styles = ":host{display:block}.base{display:block;background-color:var(--vvd-color-neutral-200)}.base:not(.vertical){block-size:1px;inline-size:100%}.base.vertical{block-size:100%;inline-size:1px}";
|
|
57
8
|
|
|
58
|
-
|
|
9
|
+
var __defProp = Object.defineProperty;
|
|
10
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
11
|
+
var result = void 0 ;
|
|
12
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
13
|
+
if (decorator = decorators[i])
|
|
14
|
+
result = (decorator(target, key, result) ) || result;
|
|
15
|
+
if (result) __defProp(target, key, result);
|
|
16
|
+
return result;
|
|
17
|
+
};
|
|
18
|
+
const DividerRole = {
|
|
19
|
+
/**
|
|
20
|
+
* The divider semantically separates content
|
|
21
|
+
*/
|
|
22
|
+
separator: "separator",
|
|
23
|
+
/**
|
|
24
|
+
* The divider has no semantic value and is for visual presentation only.
|
|
25
|
+
*/
|
|
26
|
+
presentation: "presentation"
|
|
27
|
+
};
|
|
28
|
+
class Divider extends index.FoundationElement {
|
|
29
|
+
constructor() {
|
|
30
|
+
super(...arguments);
|
|
31
|
+
this.role = DividerRole.separator;
|
|
32
|
+
this.orientation = aria.Orientation.horizontal;
|
|
33
|
+
}
|
|
59
34
|
}
|
|
35
|
+
__decorateClass([
|
|
36
|
+
index.attr
|
|
37
|
+
], Divider.prototype, "role");
|
|
38
|
+
__decorateClass([
|
|
39
|
+
index.attr
|
|
40
|
+
], Divider.prototype, "orientation");
|
|
60
41
|
|
|
61
42
|
const getClasses = ({ orientation }) => classNames.classNames("base", [`${orientation}`, Boolean(orientation)]);
|
|
62
43
|
const DividerTemplate = () => index.html` <span
|
package/shared/definition22.js
CHANGED
|
@@ -1,60 +1,41 @@
|
|
|
1
|
-
import { F as FoundationElement,
|
|
2
|
-
import { O as Orientation } from './
|
|
1
|
+
import { F as FoundationElement, a as attr, h as html, r as registerFactory } from './index.js';
|
|
2
|
+
import { O as Orientation } from './aria.js';
|
|
3
3
|
import { c as classNames } from './class-names.js';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* Divider roles
|
|
7
|
-
* @public
|
|
8
|
-
*/
|
|
9
|
-
const DividerRole = {
|
|
10
|
-
/**
|
|
11
|
-
* The divider semantically separates content
|
|
12
|
-
*/
|
|
13
|
-
separator: "separator",
|
|
14
|
-
/**
|
|
15
|
-
* The divider has no semantic value and is for visual presentation only.
|
|
16
|
-
*/
|
|
17
|
-
presentation: "presentation",
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* A Divider Custom HTML Element.
|
|
22
|
-
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#separator | ARIA separator } or {@link https://www.w3.org/TR/wai-aria-1.1/#presentation | ARIA presentation}.
|
|
23
|
-
*
|
|
24
|
-
* @public
|
|
25
|
-
*/
|
|
26
|
-
let Divider$1 = class Divider extends FoundationElement {
|
|
27
|
-
constructor() {
|
|
28
|
-
super(...arguments);
|
|
29
|
-
/**
|
|
30
|
-
* The role of the element.
|
|
31
|
-
*
|
|
32
|
-
* @public
|
|
33
|
-
* @remarks
|
|
34
|
-
* HTML Attribute: role
|
|
35
|
-
*/
|
|
36
|
-
this.role = DividerRole.separator;
|
|
37
|
-
/**
|
|
38
|
-
* The orientation of the divider.
|
|
39
|
-
*
|
|
40
|
-
* @public
|
|
41
|
-
* @remarks
|
|
42
|
-
* HTML Attribute: orientation
|
|
43
|
-
*/
|
|
44
|
-
this.orientation = Orientation.horizontal;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
__decorate([
|
|
48
|
-
attr
|
|
49
|
-
], Divider$1.prototype, "role", void 0);
|
|
50
|
-
__decorate([
|
|
51
|
-
attr
|
|
52
|
-
], Divider$1.prototype, "orientation", void 0);
|
|
53
|
-
|
|
54
5
|
const styles = ":host{display:block}.base{display:block;background-color:var(--vvd-color-neutral-200)}.base:not(.vertical){block-size:1px;inline-size:100%}.base.vertical{block-size:100%;inline-size:1px}";
|
|
55
6
|
|
|
56
|
-
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
9
|
+
var result = void 0 ;
|
|
10
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
11
|
+
if (decorator = decorators[i])
|
|
12
|
+
result = (decorator(target, key, result) ) || result;
|
|
13
|
+
if (result) __defProp(target, key, result);
|
|
14
|
+
return result;
|
|
15
|
+
};
|
|
16
|
+
const DividerRole = {
|
|
17
|
+
/**
|
|
18
|
+
* The divider semantically separates content
|
|
19
|
+
*/
|
|
20
|
+
separator: "separator",
|
|
21
|
+
/**
|
|
22
|
+
* The divider has no semantic value and is for visual presentation only.
|
|
23
|
+
*/
|
|
24
|
+
presentation: "presentation"
|
|
25
|
+
};
|
|
26
|
+
class Divider extends FoundationElement {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments);
|
|
29
|
+
this.role = DividerRole.separator;
|
|
30
|
+
this.orientation = Orientation.horizontal;
|
|
31
|
+
}
|
|
57
32
|
}
|
|
33
|
+
__decorateClass([
|
|
34
|
+
attr
|
|
35
|
+
], Divider.prototype, "role");
|
|
36
|
+
__decorateClass([
|
|
37
|
+
attr
|
|
38
|
+
], Divider.prototype, "orientation");
|
|
58
39
|
|
|
59
40
|
const getClasses = ({ orientation }) => classNames("base", [`${orientation}`, Boolean(orientation)]);
|
|
60
41
|
const DividerTemplate = () => html` <span
|
package/shared/definition24.cjs
CHANGED
|
@@ -3,13 +3,167 @@
|
|
|
3
3
|
const index = require('./index.cjs');
|
|
4
4
|
const definition = require('./definition27.cjs');
|
|
5
5
|
const affix = require('./affix.cjs');
|
|
6
|
-
const
|
|
6
|
+
const formAssociated = require('./form-associated.cjs');
|
|
7
|
+
const ariaGlobal = require('./aria-global2.cjs');
|
|
7
8
|
const applyMixins = require('./apply-mixins.cjs');
|
|
8
9
|
const ref = require('./ref.cjs');
|
|
9
10
|
const classNames = require('./class-names.cjs');
|
|
10
11
|
|
|
11
12
|
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)}";
|
|
12
13
|
|
|
14
|
+
class _FoundationButton extends index.FoundationElement {
|
|
15
|
+
}
|
|
16
|
+
class FormAssociatedButton extends formAssociated.FormAssociated(_FoundationButton) {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.proxy = document.createElement("input");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
var __defProp$1 = Object.defineProperty;
|
|
24
|
+
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
25
|
+
var result = void 0 ;
|
|
26
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
27
|
+
if (decorator = decorators[i])
|
|
28
|
+
result = (decorator(target, key, result) ) || result;
|
|
29
|
+
if (result) __defProp$1(target, key, result);
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
32
|
+
class FoundationButton extends FormAssociatedButton {
|
|
33
|
+
constructor() {
|
|
34
|
+
super(...arguments);
|
|
35
|
+
/**
|
|
36
|
+
* Prevent events to propagate if disabled
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
this.handleClick = (e) => {
|
|
40
|
+
if (this.disabled) {
|
|
41
|
+
e.stopPropagation();
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Submits the parent form
|
|
46
|
+
*/
|
|
47
|
+
this.handleSubmission = () => {
|
|
48
|
+
if (!this.form) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
this.attachProxy();
|
|
52
|
+
this.form.requestSubmit(this.proxy);
|
|
53
|
+
this.detachProxy();
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Resets the parent form
|
|
57
|
+
*/
|
|
58
|
+
this.handleFormReset = () => {
|
|
59
|
+
this.form?.reset();
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
// @ts-expect-error Function is delcared but not used
|
|
63
|
+
formactionChanged() {
|
|
64
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
65
|
+
this.proxy.formAction = this.formaction;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// @ts-expect-error Function is delcared but not used
|
|
69
|
+
formenctypeChanged() {
|
|
70
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
71
|
+
this.proxy.formEnctype = this.formenctype;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// @ts-expect-error Function is delcared but not used
|
|
75
|
+
formmethodChanged() {
|
|
76
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
77
|
+
this.proxy.formMethod = this.formmethod;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// @ts-expect-error Function is delcared but not used
|
|
81
|
+
formnovalidateChanged() {
|
|
82
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
83
|
+
this.proxy.formNoValidate = this.formnovalidate;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
// @ts-expect-error Function is delcared but not used
|
|
87
|
+
formtargetChanged() {
|
|
88
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
89
|
+
this.proxy.formTarget = this.formtarget;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// @ts-expect-error Function is delcared but not used
|
|
93
|
+
typeChanged(previous, next) {
|
|
94
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
95
|
+
this.proxy.type = this.type;
|
|
96
|
+
}
|
|
97
|
+
next === "submit" && this.addEventListener("click", this.handleSubmission);
|
|
98
|
+
previous === "submit" && this.removeEventListener("click", this.handleSubmission);
|
|
99
|
+
next === "reset" && this.addEventListener("click", this.handleFormReset);
|
|
100
|
+
previous === "reset" && this.removeEventListener("click", this.handleFormReset);
|
|
101
|
+
}
|
|
102
|
+
/** {@inheritDoc (FormAssociated:interface).validate} */
|
|
103
|
+
validate() {
|
|
104
|
+
super.validate(this.control);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* @internal
|
|
108
|
+
*/
|
|
109
|
+
connectedCallback() {
|
|
110
|
+
super.connectedCallback();
|
|
111
|
+
this.proxy.setAttribute("type", this.type);
|
|
112
|
+
const elements = Array.from(this.control.children);
|
|
113
|
+
if (elements) {
|
|
114
|
+
elements.forEach((span) => {
|
|
115
|
+
span.addEventListener("click", this.handleClick);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* @internal
|
|
121
|
+
*/
|
|
122
|
+
disconnectedCallback() {
|
|
123
|
+
super.disconnectedCallback();
|
|
124
|
+
const elements = Array.from(this.control.children);
|
|
125
|
+
if (elements) {
|
|
126
|
+
elements.forEach((span) => {
|
|
127
|
+
span.removeEventListener("click", this.handleClick);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
__decorateClass$1([
|
|
133
|
+
index.attr({ mode: "boolean" })
|
|
134
|
+
], FoundationButton.prototype, "autofocus");
|
|
135
|
+
__decorateClass$1([
|
|
136
|
+
index.attr({ attribute: "form" })
|
|
137
|
+
], FoundationButton.prototype, "formId");
|
|
138
|
+
__decorateClass$1([
|
|
139
|
+
index.attr
|
|
140
|
+
], FoundationButton.prototype, "formaction");
|
|
141
|
+
__decorateClass$1([
|
|
142
|
+
index.attr
|
|
143
|
+
], FoundationButton.prototype, "formenctype");
|
|
144
|
+
__decorateClass$1([
|
|
145
|
+
index.attr
|
|
146
|
+
], FoundationButton.prototype, "formmethod");
|
|
147
|
+
__decorateClass$1([
|
|
148
|
+
index.attr({ mode: "boolean" })
|
|
149
|
+
], FoundationButton.prototype, "formnovalidate");
|
|
150
|
+
__decorateClass$1([
|
|
151
|
+
index.attr
|
|
152
|
+
], FoundationButton.prototype, "formtarget");
|
|
153
|
+
__decorateClass$1([
|
|
154
|
+
index.attr
|
|
155
|
+
], FoundationButton.prototype, "type");
|
|
156
|
+
class DelegatesARIAButton {
|
|
157
|
+
}
|
|
158
|
+
__decorateClass$1([
|
|
159
|
+
index.attr({ attribute: "aria-expanded" })
|
|
160
|
+
], DelegatesARIAButton.prototype, "ariaExpanded");
|
|
161
|
+
__decorateClass$1([
|
|
162
|
+
index.attr({ attribute: "aria-pressed" })
|
|
163
|
+
], DelegatesARIAButton.prototype, "ariaPressed");
|
|
164
|
+
applyMixins.applyMixins(DelegatesARIAButton, ariaGlobal.ARIAGlobalStatesAndProperties);
|
|
165
|
+
applyMixins.applyMixins(FoundationButton, DelegatesARIAButton);
|
|
166
|
+
|
|
13
167
|
var __defProp = Object.defineProperty;
|
|
14
168
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
15
169
|
var result = void 0 ;
|
|
@@ -19,7 +173,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
19
173
|
if (result) __defProp(target, key, result);
|
|
20
174
|
return result;
|
|
21
175
|
};
|
|
22
|
-
class Fab extends
|
|
176
|
+
class Fab extends FoundationButton {
|
|
23
177
|
}
|
|
24
178
|
__decorateClass([
|
|
25
179
|
index.attr
|