@vonage/vivid 4.4.0 → 4.6.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 +7181 -6876
- package/elevation/index.cjs +1 -1
- package/elevation/index.js +1 -1
- package/index.cjs +80 -74
- package/index.js +23 -22
- package/lib/components.d.ts +1 -0
- package/lib/fab/fab.d.ts +1 -1
- package/lib/icon/icon.d.ts +1 -1
- package/lib/menu/menu.d.ts +2 -1
- package/lib/number-field/number-field.d.ts +3 -1
- package/lib/searchable-select/definition.d.ts +4 -0
- package/lib/searchable-select/locale.d.ts +6 -0
- package/lib/searchable-select/option-tag.d.ts +14 -0
- package/lib/searchable-select/option-tag.template.d.ts +4 -0
- package/lib/searchable-select/searchable-select.d.ts +29 -0
- package/lib/searchable-select/searchable-select.form-associated.d.ts +10 -0
- package/lib/searchable-select/searchable-select.template.d.ts +4 -0
- package/lib/select/select.d.ts +4 -1
- package/lib/tab/locale.d.ts +3 -0
- package/lib/tab/tab.d.ts +5 -1
- package/lib/tabs/tabs.d.ts +2 -0
- package/lib/tag/definition.d.ts +1 -0
- package/lib/text-field/text-field.d.ts +3 -1
- package/lib/video-player/video-player.d.ts +0 -1
- package/listbox/index.cjs +1 -1
- package/listbox/index.js +1 -1
- package/locales/de-DE.cjs +12 -0
- package/locales/de-DE.js +12 -0
- package/locales/en-GB.cjs +12 -0
- package/locales/en-GB.js +12 -0
- package/locales/en-US.cjs +12 -0
- package/locales/en-US.js +12 -0
- package/locales/ja-JP.cjs +12 -0
- package/locales/ja-JP.js +12 -0
- package/locales/zh-CN.cjs +12 -0
- package/locales/zh-CN.js +12 -0
- package/package.json +6 -1
- package/popup/index.cjs +1 -1
- package/popup/index.js +1 -1
- package/searchable-select/index.cjs +5 -0
- package/searchable-select/index.js +3 -0
- package/select/index.cjs +1 -1
- package/select/index.js +1 -1
- package/selectable-box/index.cjs +1 -1
- package/selectable-box/index.js +1 -1
- package/shared/anchored.js +1 -1
- package/shared/calendar-event.js +1 -1
- package/shared/definition.cjs +2 -2
- package/shared/definition.js +2 -2
- package/shared/definition11.cjs +1 -1
- package/shared/definition11.js +1 -1
- package/shared/definition12.cjs +1 -1
- package/shared/definition12.js +1 -1
- package/shared/definition13.js +1 -1
- package/shared/definition14.cjs +1 -1
- package/shared/definition14.js +1 -1
- package/shared/definition15.cjs +7 -8
- package/shared/definition15.js +2 -3
- package/shared/definition16.cjs +11 -7
- package/shared/definition16.js +10 -6
- package/shared/definition17.cjs +2 -2
- package/shared/definition17.js +2 -2
- package/shared/definition18.cjs +5 -6
- package/shared/definition18.js +3 -4
- package/shared/definition19.cjs +5 -6
- package/shared/definition19.js +3 -4
- package/shared/definition20.cjs +16 -38
- package/shared/definition20.js +17 -39
- package/shared/definition21.cjs +7 -6
- package/shared/definition21.js +8 -7
- package/shared/definition23.cjs +1 -1
- package/shared/definition23.js +2 -2
- package/shared/definition24.cjs +2 -2
- package/shared/definition24.js +2 -2
- package/shared/definition25.cjs +6 -7
- package/shared/definition25.js +2 -3
- package/shared/definition26.cjs +1 -1
- package/shared/definition26.js +2 -2
- package/shared/definition27.cjs +1 -1
- package/shared/definition27.js +1 -1
- package/shared/definition28.js +1 -1
- package/shared/definition29.cjs +8 -4
- package/shared/definition29.js +8 -4
- package/shared/definition3.cjs +1 -1
- package/shared/definition3.js +2 -2
- package/shared/definition30.cjs +4 -2
- package/shared/definition30.js +4 -2
- package/shared/definition31.cjs +1 -1
- package/shared/definition31.js +2 -2
- package/shared/definition32.cjs +1 -1
- package/shared/definition32.js +1 -1
- package/shared/definition34.cjs +2 -3
- package/shared/definition34.js +2 -3
- package/shared/definition35.cjs +21 -16
- package/shared/definition35.js +16 -11
- package/shared/definition36.cjs +50 -207
- package/shared/definition36.js +51 -207
- package/shared/definition37.js +1 -1
- package/shared/definition38.cjs +1 -1
- package/shared/definition38.js +1 -1
- package/shared/definition4.cjs +6 -4
- package/shared/definition4.js +7 -5
- package/shared/definition41.cjs +1 -1
- package/shared/definition41.js +1 -1
- package/shared/definition42.cjs +6 -7
- package/shared/definition42.js +6 -7
- package/shared/definition43.cjs +998 -643
- package/shared/definition43.js +992 -638
- package/shared/definition44.cjs +723 -112
- package/shared/definition44.js +722 -111
- package/shared/definition45.cjs +121 -79
- package/shared/definition45.js +120 -78
- package/shared/definition46.cjs +81 -616
- package/shared/definition46.js +80 -614
- package/shared/definition47.cjs +609 -116
- package/shared/definition47.js +607 -115
- package/shared/definition48.cjs +116 -134
- package/shared/definition48.js +115 -133
- package/shared/definition49.cjs +149 -19
- package/shared/definition49.js +148 -18
- package/shared/definition5.cjs +5 -6
- package/shared/definition5.js +5 -6
- package/shared/definition50.cjs +21 -82
- package/shared/definition50.js +20 -81
- package/shared/definition51.cjs +78 -494
- package/shared/definition51.js +77 -493
- package/shared/definition52.cjs +568 -28
- package/shared/definition52.js +567 -27
- package/shared/definition53.cjs +28 -123
- package/shared/definition53.js +27 -123
- package/shared/definition54.cjs +115 -296
- package/shared/definition54.js +114 -295
- package/shared/definition55.cjs +258 -318
- package/shared/definition55.js +252 -312
- package/shared/definition56.cjs +303 -784
- package/shared/definition56.js +298 -779
- package/shared/definition57.cjs +802 -95
- package/shared/definition57.js +801 -94
- package/shared/definition58.cjs +95 -60
- package/shared/definition58.js +94 -59
- package/shared/definition59.cjs +117 -75
- package/shared/definition59.js +116 -74
- package/shared/definition6.cjs +1 -1
- package/shared/definition6.js +1 -1
- package/shared/definition60.cjs +70 -285
- package/shared/definition60.js +71 -286
- package/shared/definition61.cjs +296 -325
- package/shared/definition61.js +295 -324
- package/shared/definition62.cjs +66160 -27
- package/shared/definition62.js +66159 -26
- package/shared/definition63.cjs +24 -1952
- package/shared/definition63.js +23 -1950
- package/shared/definition64.cjs +1976 -0
- package/shared/definition64.js +1971 -0
- package/shared/definition7.cjs +1 -1
- package/shared/definition7.js +1 -1
- package/shared/definition8.cjs +2 -3
- package/shared/definition8.js +3 -4
- package/shared/definition9.cjs +1 -1
- package/shared/definition9.js +1 -1
- package/shared/dialog/index.d.ts +1 -0
- package/shared/form-elements.cjs +236 -0
- package/shared/form-elements.js +229 -0
- package/shared/icon.js +1 -1
- package/shared/index2.cjs +6 -256
- package/shared/index2.js +6 -249
- package/shared/listbox-option.cjs +204 -0
- package/shared/listbox-option.js +201 -0
- package/shared/listbox.cjs +3 -3
- package/shared/listbox.js +1 -1
- package/shared/localization/Locale.d.ts +4 -0
- package/shared/localized.cjs +26 -2
- package/shared/localized.js +25 -2
- package/shared/playbackRates.cjs +13 -0
- package/shared/playbackRates.js +11 -0
- package/shared/presentationDate.cjs +11 -11
- package/shared/presentationDate.js +11 -11
- package/shared/scrollIntoView.cjs +51 -0
- package/shared/scrollIntoView.js +49 -0
- package/shared/slider.template.cjs +1 -1
- package/shared/slider.template.js +1 -1
- package/shared/text-anchor.cjs +1 -1
- package/shared/text-anchor.js +1 -1
- package/shared/text-field.cjs +1 -1
- package/shared/text-field.js +1 -1
- package/shared/utils/playbackRates.d.ts +1 -0
- package/shared/utils/scrollIntoView.d.ts +1 -0
- package/side-drawer/index.cjs +1 -1
- package/side-drawer/index.js +1 -1
- package/slider/index.cjs +1 -1
- package/slider/index.js +1 -1
- package/split-button/index.cjs +1 -1
- package/split-button/index.js +1 -1
- 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.cjs +1 -1
- package/switch/index.js +1 -1
- package/tab/index.cjs +1 -1
- package/tab/index.js +1 -1
- package/tab-panel/index.cjs +1 -1
- package/tab-panel/index.js +1 -1
- package/tabs/index.cjs +1 -1
- package/tabs/index.js +1 -1
- package/tag/index.cjs +1 -1
- package/tag/index.js +1 -1
- package/tag-group/index.cjs +1 -1
- package/tag-group/index.js +1 -1
- package/text-area/index.cjs +1 -1
- package/text-area/index.js +1 -1
- package/text-field/index.cjs +1 -1
- package/text-field/index.js +1 -1
- package/time-picker/index.cjs +1 -1
- package/time-picker/index.js +1 -1
- package/toggletip/index.cjs +1 -1
- package/toggletip/index.js +1 -1
- package/tooltip/index.cjs +1 -1
- package/tooltip/index.js +1 -1
- package/tree-item/index.cjs +1 -1
- package/tree-item/index.js +1 -1
- package/tree-view/index.cjs +1 -1
- package/tree-view/index.js +1 -1
- package/video-player/index.cjs +1 -1
- package/video-player/index.js +1 -1
- package/vivid.api.json +312 -8
- package/appearance-ui/index.cjs +0 -102
- package/appearance-ui/index.js +0 -100
- package/lib/appearance-ui/appearance-ui.d.ts +0 -12
- package/lib/appearance-ui/appearance-ui.template.d.ts +0 -4
- package/lib/appearance-ui/definition.d.ts +0 -3
- package/shared/video-player.cjs +0 -65860
- package/shared/video-player.js +0 -65857
package/shared/definition45.cjs
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const index = require('./index.cjs');
|
|
4
|
-
const
|
|
4
|
+
const definition = require('./definition15.cjs');
|
|
5
|
+
const definition$1 = require('./definition41.cjs');
|
|
6
|
+
const enums = require('./enums.cjs');
|
|
7
|
+
const radio$1 = require('./radio.cjs');
|
|
5
8
|
const classNames = require('./class-names.cjs');
|
|
9
|
+
const when = require('./when.cjs');
|
|
10
|
+
|
|
11
|
+
const styles = ":host{display:flex}.base.connotation-cta{--_connotation-color-firm-all: var(--vvd-selectable-box-cta-firm-all, var(--vvd-color-cta-600));--_connotation-color-pale: var(--vvd-selectable-box-cta-pale, var(--vvd-color-cta-300));--_connotation-color-fierce: var(--vvd-selectable-box-cta-fierce, var(--vvd-color-cta-700));--_connotation-color-faint: var(--vvd-selectable-box-cta-faint, var(--vvd-color-cta-50));--_connotation-color-soft: var(--vvd-selectable-box-cta-soft, var(--vvd-color-cta-100))}.base:not(.connotation-cta){--_connotation-color-firm-all: var(--vvd-selectable-box-accent-firm-all, var(--vvd-color-neutral-600));--_connotation-color-pale: var(--vvd-selectable-box-accent-pale, var(--vvd-color-neutral-300));--_connotation-color-fierce: var(--vvd-selectable-box-accent-fierce, var(--vvd-color-neutral-700));--_connotation-color-faint: var(--vvd-selectable-box-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-selectable-box-accent-soft, var(--vvd-color-neutral-100))}.base{--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--_connotation-color-pale)}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--_connotation-color-firm-all)}.base:where(.selected):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: var(--_connotation-color-pale)}.base:where(.selected):where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: var(--_connotation-color-firm-all)}.base{position:relative;padding:var(--selectable-box-spacing, 16px);border:1px solid var(--_appearance-color-outline);border-radius:8px;background-color:var(--_appearance-color-fill);inline-size:100%;padding-block-start:calc(var(--selectable-box-spacing, 16px) + 36px);text-align:start}.base:focus-visible{--focus-stroke-gap-color: transparent;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))}.base.tight{overflow:hidden;min-height:calc(var(--selectable-box-spacing, 16px) * 2 + 22px);padding:0}.base.clickable{cursor:pointer}.control{position:absolute;inset-block-start:var(--selectable-box-spacing, 16px);inset-inline-end:var(--selectable-box-spacing, 16px)}";
|
|
6
12
|
|
|
7
13
|
var __defProp = Object.defineProperty;
|
|
8
14
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -13,97 +19,133 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
13
19
|
if (result) __defProp(target, key, result);
|
|
14
20
|
return result;
|
|
15
21
|
};
|
|
16
|
-
class
|
|
22
|
+
class SelectableBox extends index.FoundationElement {
|
|
17
23
|
constructor() {
|
|
18
24
|
super(...arguments);
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
22
|
-
this.
|
|
25
|
+
this.ariaLabel = null;
|
|
26
|
+
this.checked = false;
|
|
27
|
+
this.clickable = false;
|
|
28
|
+
this.clickableBox = false;
|
|
29
|
+
this.tight = false;
|
|
23
30
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
/**
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
_handleCheckedChange() {
|
|
35
|
+
if (this.controlType === "radio" && this.checked) return;
|
|
36
|
+
this.checked = !this.checked;
|
|
37
|
+
if (this.clickableBox || this.clickable) this.$emit("change");
|
|
31
38
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
/**
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
_handleKeydown(event) {
|
|
43
|
+
if ((event.code === "Space" || event.code === "Enter") && (this.clickableBox || this.clickable))
|
|
44
|
+
return this._handleCheckedChange();
|
|
45
|
+
return true;
|
|
37
46
|
}
|
|
38
47
|
}
|
|
39
48
|
__decorateClass([
|
|
40
|
-
index.attr({
|
|
41
|
-
|
|
42
|
-
})
|
|
43
|
-
], SideDrawer.prototype, "alternate");
|
|
49
|
+
index.attr({ attribute: "aria-label" })
|
|
50
|
+
], SelectableBox.prototype, "ariaLabel");
|
|
44
51
|
__decorateClass([
|
|
45
|
-
index.attr({
|
|
46
|
-
|
|
47
|
-
})
|
|
48
|
-
], SideDrawer.prototype, "modal");
|
|
52
|
+
index.attr({ mode: "boolean" })
|
|
53
|
+
], SelectableBox.prototype, "checked");
|
|
49
54
|
__decorateClass([
|
|
50
|
-
index.attr({
|
|
51
|
-
|
|
52
|
-
})
|
|
53
|
-
], SideDrawer.prototype, "open");
|
|
55
|
+
index.attr({ mode: "boolean" })
|
|
56
|
+
], SelectableBox.prototype, "clickable");
|
|
54
57
|
__decorateClass([
|
|
55
|
-
index.attr({
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
index.attr({ attribute: "clickable-box", mode: "boolean" })
|
|
59
|
+
], SelectableBox.prototype, "clickableBox");
|
|
60
|
+
__decorateClass([
|
|
61
|
+
index.attr
|
|
62
|
+
], SelectableBox.prototype, "connotation");
|
|
63
|
+
__decorateClass([
|
|
64
|
+
index.attr({ attribute: "control-type" })
|
|
65
|
+
], SelectableBox.prototype, "controlType");
|
|
66
|
+
__decorateClass([
|
|
67
|
+
index.attr({ mode: "boolean" })
|
|
68
|
+
], SelectableBox.prototype, "tight");
|
|
61
69
|
|
|
62
|
-
const getClasses = ({
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
70
|
+
const getClasses = ({
|
|
71
|
+
connotation,
|
|
72
|
+
tight,
|
|
73
|
+
checked,
|
|
74
|
+
clickableBox,
|
|
75
|
+
clickable
|
|
76
|
+
}) => classNames.classNames(
|
|
77
|
+
"base",
|
|
78
|
+
[`connotation-${connotation}`, Boolean(connotation)],
|
|
79
|
+
["tight", tight],
|
|
80
|
+
["selected", checked],
|
|
81
|
+
["clickable", clickableBox || clickable],
|
|
82
|
+
["readonly", !clickableBox && !clickable]
|
|
67
83
|
);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
)
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
84
|
+
function handleControlChange(x) {
|
|
85
|
+
if (!x.clickableBox) x._handleCheckedChange();
|
|
86
|
+
}
|
|
87
|
+
function checkbox(context) {
|
|
88
|
+
const checkboxTag = context.tagFor(definition.Checkbox);
|
|
89
|
+
return index.html`${when.when(
|
|
90
|
+
(x) => x.controlType !== "radio",
|
|
91
|
+
index.html`
|
|
92
|
+
<${checkboxTag}
|
|
93
|
+
aria-label="${(x) => !x.clickableBox && !x.clickable && x.ariaLabel ? x.ariaLabel : null}"
|
|
94
|
+
@change="${(x) => handleControlChange(x)}"
|
|
95
|
+
class="control checkbox"
|
|
96
|
+
connotation="${(x) => x.connotation === "cta" ? enums.Connotation.CTA : enums.Connotation.Accent}"
|
|
97
|
+
:checked="${(x) => x.checked}"
|
|
98
|
+
inert="${(x) => x.clickableBox || x.clickable ? true : null}"
|
|
99
|
+
></${checkboxTag}>`
|
|
100
|
+
)} `;
|
|
101
|
+
}
|
|
102
|
+
function radio(context) {
|
|
103
|
+
const radioTag = context.tagFor(radio$1.Radio);
|
|
104
|
+
return index.html`${when.when(
|
|
105
|
+
(x) => x.controlType === "radio",
|
|
106
|
+
index.html`
|
|
107
|
+
<${radioTag}
|
|
108
|
+
aria-label="${(x) => !x.clickableBox && !x.clickable && x.ariaLabel ? x.ariaLabel : null}"
|
|
109
|
+
@change="${(x) => handleControlChange(x)}"
|
|
110
|
+
class="control radio"
|
|
111
|
+
connotation="${(x) => x.connotation === "cta" ? enums.Connotation.CTA : enums.Connotation.Accent}"
|
|
112
|
+
:checked="${(x) => x.checked}"
|
|
113
|
+
inert="${(x) => x.clickableBox || x.clickable ? true : null}"
|
|
114
|
+
></${radioTag}>`
|
|
115
|
+
)} `;
|
|
116
|
+
}
|
|
117
|
+
const SelectableBoxTemplate = (context) => {
|
|
118
|
+
return index.html`<template role="presentation">
|
|
119
|
+
<div
|
|
120
|
+
class="${getClasses}"
|
|
121
|
+
tabindex="${(x) => x.clickableBox || x.clickable ? "0" : null}"
|
|
122
|
+
role="${(x) => x.clickableBox || x.clickable ? "button" : null}"
|
|
123
|
+
aria-pressed="${(x) => x.clickableBox || x.clickable ? x.checked ? "true" : "false" : null}"
|
|
124
|
+
aria-label="${(x) => x.clickableBox || x.clickable ? x.ariaLabel : null}"
|
|
125
|
+
@keydown="${(x, c) => x._handleKeydown(c.event)}"
|
|
126
|
+
@click="${(x) => x.clickableBox || x.clickable ? x._handleCheckedChange() : null}"
|
|
127
|
+
>
|
|
128
|
+
${checkbox(context)} ${radio(context)}
|
|
129
|
+
<slot></slot>
|
|
130
|
+
</div>
|
|
131
|
+
</template>`;
|
|
97
132
|
};
|
|
98
133
|
|
|
99
|
-
const
|
|
100
|
-
baseName: "
|
|
101
|
-
template:
|
|
102
|
-
styles
|
|
134
|
+
const selectableBoxDefinition = SelectableBox.compose({
|
|
135
|
+
baseName: "selectable-box",
|
|
136
|
+
template: SelectableBoxTemplate,
|
|
137
|
+
styles,
|
|
138
|
+
shadowOptions: {
|
|
139
|
+
delegatesFocus: true
|
|
140
|
+
}
|
|
103
141
|
});
|
|
104
|
-
const
|
|
105
|
-
|
|
142
|
+
const selectableBoxRegistries = [
|
|
143
|
+
selectableBoxDefinition(),
|
|
144
|
+
...definition.checkboxRegistries,
|
|
145
|
+
...definition$1.radioRegistries
|
|
146
|
+
];
|
|
147
|
+
const registerSelectableBox = index.registerFactory(selectableBoxRegistries);
|
|
106
148
|
|
|
107
|
-
exports.
|
|
108
|
-
exports.
|
|
109
|
-
exports.
|
|
149
|
+
exports.registerSelectableBox = registerSelectableBox;
|
|
150
|
+
exports.selectableBoxDefinition = selectableBoxDefinition;
|
|
151
|
+
exports.selectableBoxRegistries = selectableBoxRegistries;
|
package/shared/definition45.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { F as FoundationElement, a as attr, h as html, r as registerFactory } from './index.js';
|
|
2
|
+
import { C as Checkbox, a as checkboxRegistries } from './definition15.js';
|
|
3
|
+
import { a as radioRegistries } from './definition41.js';
|
|
4
|
+
import { C as Connotation } from './enums.js';
|
|
5
|
+
import { R as Radio } from './radio.js';
|
|
3
6
|
import { c as classNames } from './class-names.js';
|
|
7
|
+
import { w as when } from './when.js';
|
|
8
|
+
|
|
9
|
+
const styles = ":host{display:flex}.base.connotation-cta{--_connotation-color-firm-all: var(--vvd-selectable-box-cta-firm-all, var(--vvd-color-cta-600));--_connotation-color-pale: var(--vvd-selectable-box-cta-pale, var(--vvd-color-cta-300));--_connotation-color-fierce: var(--vvd-selectable-box-cta-fierce, var(--vvd-color-cta-700));--_connotation-color-faint: var(--vvd-selectable-box-cta-faint, var(--vvd-color-cta-50));--_connotation-color-soft: var(--vvd-selectable-box-cta-soft, var(--vvd-color-cta-100))}.base:not(.connotation-cta){--_connotation-color-firm-all: var(--vvd-selectable-box-accent-firm-all, var(--vvd-color-neutral-600));--_connotation-color-pale: var(--vvd-selectable-box-accent-pale, var(--vvd-color-neutral-300));--_connotation-color-fierce: var(--vvd-selectable-box-accent-fierce, var(--vvd-color-neutral-700));--_connotation-color-faint: var(--vvd-selectable-box-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-selectable-box-accent-soft, var(--vvd-color-neutral-100))}.base{--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--_connotation-color-pale)}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--_connotation-color-firm-all)}.base:where(.selected):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: var(--_connotation-color-pale)}.base:where(.selected):where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: var(--_connotation-color-firm-all)}.base{position:relative;padding:var(--selectable-box-spacing, 16px);border:1px solid var(--_appearance-color-outline);border-radius:8px;background-color:var(--_appearance-color-fill);inline-size:100%;padding-block-start:calc(var(--selectable-box-spacing, 16px) + 36px);text-align:start}.base:focus-visible{--focus-stroke-gap-color: transparent;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))}.base.tight{overflow:hidden;min-height:calc(var(--selectable-box-spacing, 16px) * 2 + 22px);padding:0}.base.clickable{cursor:pointer}.control{position:absolute;inset-block-start:var(--selectable-box-spacing, 16px);inset-inline-end:var(--selectable-box-spacing, 16px)}";
|
|
4
10
|
|
|
5
11
|
var __defProp = Object.defineProperty;
|
|
6
12
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -11,95 +17,131 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
11
17
|
if (result) __defProp(target, key, result);
|
|
12
18
|
return result;
|
|
13
19
|
};
|
|
14
|
-
class
|
|
20
|
+
class SelectableBox extends FoundationElement {
|
|
15
21
|
constructor() {
|
|
16
22
|
super(...arguments);
|
|
17
|
-
this.
|
|
18
|
-
this.
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
23
|
+
this.ariaLabel = null;
|
|
24
|
+
this.checked = false;
|
|
25
|
+
this.clickable = false;
|
|
26
|
+
this.clickableBox = false;
|
|
27
|
+
this.tight = false;
|
|
21
28
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
/**
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
_handleCheckedChange() {
|
|
33
|
+
if (this.controlType === "radio" && this.checked) return;
|
|
34
|
+
this.checked = !this.checked;
|
|
35
|
+
if (this.clickableBox || this.clickable) this.$emit("change");
|
|
29
36
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
/**
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
_handleKeydown(event) {
|
|
41
|
+
if ((event.code === "Space" || event.code === "Enter") && (this.clickableBox || this.clickable))
|
|
42
|
+
return this._handleCheckedChange();
|
|
43
|
+
return true;
|
|
35
44
|
}
|
|
36
45
|
}
|
|
37
46
|
__decorateClass([
|
|
38
|
-
attr({
|
|
39
|
-
|
|
40
|
-
})
|
|
41
|
-
], SideDrawer.prototype, "alternate");
|
|
47
|
+
attr({ attribute: "aria-label" })
|
|
48
|
+
], SelectableBox.prototype, "ariaLabel");
|
|
42
49
|
__decorateClass([
|
|
43
|
-
attr({
|
|
44
|
-
|
|
45
|
-
})
|
|
46
|
-
], SideDrawer.prototype, "modal");
|
|
50
|
+
attr({ mode: "boolean" })
|
|
51
|
+
], SelectableBox.prototype, "checked");
|
|
47
52
|
__decorateClass([
|
|
48
|
-
attr({
|
|
49
|
-
|
|
50
|
-
})
|
|
51
|
-
], SideDrawer.prototype, "open");
|
|
53
|
+
attr({ mode: "boolean" })
|
|
54
|
+
], SelectableBox.prototype, "clickable");
|
|
52
55
|
__decorateClass([
|
|
53
|
-
attr({
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
attr({ attribute: "clickable-box", mode: "boolean" })
|
|
57
|
+
], SelectableBox.prototype, "clickableBox");
|
|
58
|
+
__decorateClass([
|
|
59
|
+
attr
|
|
60
|
+
], SelectableBox.prototype, "connotation");
|
|
61
|
+
__decorateClass([
|
|
62
|
+
attr({ attribute: "control-type" })
|
|
63
|
+
], SelectableBox.prototype, "controlType");
|
|
64
|
+
__decorateClass([
|
|
65
|
+
attr({ mode: "boolean" })
|
|
66
|
+
], SelectableBox.prototype, "tight");
|
|
59
67
|
|
|
60
|
-
const getClasses = ({
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
68
|
+
const getClasses = ({
|
|
69
|
+
connotation,
|
|
70
|
+
tight,
|
|
71
|
+
checked,
|
|
72
|
+
clickableBox,
|
|
73
|
+
clickable
|
|
74
|
+
}) => classNames(
|
|
75
|
+
"base",
|
|
76
|
+
[`connotation-${connotation}`, Boolean(connotation)],
|
|
77
|
+
["tight", tight],
|
|
78
|
+
["selected", checked],
|
|
79
|
+
["clickable", clickableBox || clickable],
|
|
80
|
+
["readonly", !clickableBox && !clickable]
|
|
65
81
|
);
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
82
|
+
function handleControlChange(x) {
|
|
83
|
+
if (!x.clickableBox) x._handleCheckedChange();
|
|
84
|
+
}
|
|
85
|
+
function checkbox(context) {
|
|
86
|
+
const checkboxTag = context.tagFor(Checkbox);
|
|
87
|
+
return html`${when(
|
|
88
|
+
(x) => x.controlType !== "radio",
|
|
89
|
+
html`
|
|
90
|
+
<${checkboxTag}
|
|
91
|
+
aria-label="${(x) => !x.clickableBox && !x.clickable && x.ariaLabel ? x.ariaLabel : null}"
|
|
92
|
+
@change="${(x) => handleControlChange(x)}"
|
|
93
|
+
class="control checkbox"
|
|
94
|
+
connotation="${(x) => x.connotation === "cta" ? Connotation.CTA : Connotation.Accent}"
|
|
95
|
+
:checked="${(x) => x.checked}"
|
|
96
|
+
inert="${(x) => x.clickableBox || x.clickable ? true : null}"
|
|
97
|
+
></${checkboxTag}>`
|
|
98
|
+
)} `;
|
|
99
|
+
}
|
|
100
|
+
function radio(context) {
|
|
101
|
+
const radioTag = context.tagFor(Radio);
|
|
102
|
+
return html`${when(
|
|
103
|
+
(x) => x.controlType === "radio",
|
|
104
|
+
html`
|
|
105
|
+
<${radioTag}
|
|
106
|
+
aria-label="${(x) => !x.clickableBox && !x.clickable && x.ariaLabel ? x.ariaLabel : null}"
|
|
107
|
+
@change="${(x) => handleControlChange(x)}"
|
|
108
|
+
class="control radio"
|
|
109
|
+
connotation="${(x) => x.connotation === "cta" ? Connotation.CTA : Connotation.Accent}"
|
|
110
|
+
:checked="${(x) => x.checked}"
|
|
111
|
+
inert="${(x) => x.clickableBox || x.clickable ? true : null}"
|
|
112
|
+
></${radioTag}>`
|
|
113
|
+
)} `;
|
|
114
|
+
}
|
|
115
|
+
const SelectableBoxTemplate = (context) => {
|
|
116
|
+
return html`<template role="presentation">
|
|
117
|
+
<div
|
|
118
|
+
class="${getClasses}"
|
|
119
|
+
tabindex="${(x) => x.clickableBox || x.clickable ? "0" : null}"
|
|
120
|
+
role="${(x) => x.clickableBox || x.clickable ? "button" : null}"
|
|
121
|
+
aria-pressed="${(x) => x.clickableBox || x.clickable ? x.checked ? "true" : "false" : null}"
|
|
122
|
+
aria-label="${(x) => x.clickableBox || x.clickable ? x.ariaLabel : null}"
|
|
123
|
+
@keydown="${(x, c) => x._handleKeydown(c.event)}"
|
|
124
|
+
@click="${(x) => x.clickableBox || x.clickable ? x._handleCheckedChange() : null}"
|
|
125
|
+
>
|
|
126
|
+
${checkbox(context)} ${radio(context)}
|
|
127
|
+
<slot></slot>
|
|
128
|
+
</div>
|
|
129
|
+
</template>`;
|
|
95
130
|
};
|
|
96
131
|
|
|
97
|
-
const
|
|
98
|
-
baseName: "
|
|
99
|
-
template:
|
|
100
|
-
styles
|
|
132
|
+
const selectableBoxDefinition = SelectableBox.compose({
|
|
133
|
+
baseName: "selectable-box",
|
|
134
|
+
template: SelectableBoxTemplate,
|
|
135
|
+
styles,
|
|
136
|
+
shadowOptions: {
|
|
137
|
+
delegatesFocus: true
|
|
138
|
+
}
|
|
101
139
|
});
|
|
102
|
-
const
|
|
103
|
-
|
|
140
|
+
const selectableBoxRegistries = [
|
|
141
|
+
selectableBoxDefinition(),
|
|
142
|
+
...checkboxRegistries,
|
|
143
|
+
...radioRegistries
|
|
144
|
+
];
|
|
145
|
+
const registerSelectableBox = registerFactory(selectableBoxRegistries);
|
|
104
146
|
|
|
105
|
-
export {
|
|
147
|
+
export { selectableBoxRegistries as a, registerSelectableBox as r, selectableBoxDefinition as s };
|