@vonage/vivid 3.39.0 → 3.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accordion/index.js +1 -1
- package/accordion-item/index.js +1 -1
- package/alert/index.js +3 -2
- package/banner/index.js +2 -1
- package/breadcrumb-item/index.js +1 -1
- package/button/index.js +2 -1
- package/card/index.js +1 -1
- package/checkbox/index.js +1 -1
- package/combobox/index.js +5 -3
- package/custom-elements.json +512 -0
- package/data-grid/index.js +1 -0
- package/date-picker/index.js +6 -4
- package/date-range-picker/index.js +5 -3
- package/dialog/index.js +6 -2
- package/elevation/index.js +1 -1
- package/fab/index.js +1 -1
- package/file-picker/index.js +2 -1
- package/focus/index.js +1 -1
- package/header/index.js +1 -1
- package/index.js +23 -19
- package/lib/checkbox/checkbox.d.ts +1 -0
- package/lib/components.d.ts +1 -0
- package/lib/dialog/dialog.d.ts +4 -0
- package/lib/dialog/locale.d.ts +3 -0
- package/lib/menu/menu.d.ts +1 -0
- package/lib/number-field/locale.d.ts +4 -0
- package/lib/number-field/number-field.d.ts +4 -2
- package/lib/progress/progress.d.ts +1 -0
- package/lib/progress-ring/progress-ring.d.ts +1 -0
- package/lib/radio/radio.d.ts +1 -0
- package/lib/selectable-box/definition.d.ts +3 -0
- package/lib/selectable-box/selectable-box.d.ts +13 -0
- package/lib/selectable-box/selectable-box.template.d.ts +4 -0
- package/lib/slider/definition.d.ts +1 -0
- package/lib/slider/slider.d.ts +5 -0
- package/lib/text-area/text-area.d.ts +3 -0
- package/lib/text-field/text-field.d.ts +5 -2
- package/listbox/index.js +3 -2
- package/locales/en-GB.js +7 -0
- package/locales/en-US.js +7 -0
- package/locales/ja-JP.js +7 -0
- package/locales/zh-CN.js +7 -0
- package/menu/index.js +4 -3
- package/menu-item/index.js +1 -1
- package/nav-disclosure/index.js +1 -1
- package/nav-item/index.js +1 -1
- package/number-field/index.js +3 -1
- package/option/index.js +1 -1
- package/package.json +1 -1
- package/pagination/index.js +2 -1
- package/popup/index.js +4 -3
- package/radio/index.js +1 -1
- package/select/index.js +5 -3
- package/selectable-box/index.js +23 -0
- package/shared/Reflector.js +65 -0
- package/shared/date-picker/calendar/segment.d.ts +21 -0
- package/shared/date-picker/date-picker-base.d.ts +1 -0
- package/shared/definition.js +2 -2
- package/shared/definition10.js +4 -73
- package/shared/definition11.js +1 -1
- package/shared/definition12.js +1 -1
- package/shared/definition13.js +2 -2
- package/shared/definition14.js +12 -5
- package/shared/definition15.js +3 -3
- package/shared/definition16.js +22 -8
- package/shared/definition17.js +5 -5
- package/shared/definition18.js +15 -8
- package/shared/definition19.js +18 -10
- package/shared/definition2.js +2 -2
- package/shared/definition20.js +1 -1
- package/shared/definition21.js +1 -1
- package/shared/definition22.js +2 -2
- package/shared/definition23.js +4 -3
- package/shared/definition24.js +2 -2
- package/shared/definition27.js +13 -4
- package/shared/definition28.js +2 -2
- package/shared/definition29.js +2 -2
- package/shared/definition3.js +1 -1
- package/shared/definition30.js +2 -2
- package/shared/definition32.js +1 -1
- package/shared/definition33.js +19 -4
- package/shared/definition34.js +2 -2
- package/shared/definition35.js +3 -2
- package/shared/definition36.js +11 -3
- package/shared/definition37.js +13 -9
- package/shared/definition38.js +2 -2
- package/shared/definition39.js +5 -4
- package/shared/definition4.js +4 -3
- package/shared/definition40.js +4 -4
- package/shared/definition41.js +111 -76
- package/shared/definition42.js +77 -557
- package/shared/definition43.js +568 -102
- package/shared/definition44.js +104 -135
- package/shared/definition45.js +153 -17
- package/shared/definition46.js +16 -79
- package/shared/definition47.js +53 -475
- package/shared/definition48.js +493 -25
- package/shared/definition49.js +22 -121
- package/shared/definition5.js +1 -1
- package/shared/definition50.js +114 -261
- package/shared/definition51.js +258 -119
- package/shared/definition52.js +258 -109
- package/shared/definition53.js +84 -74
- package/shared/definition54.js +114 -69
- package/shared/definition55.js +81 -292
- package/shared/definition56.js +302 -13
- package/shared/definition57.js +11 -41
- package/shared/definition58.js +20 -154
- package/shared/definition59.js +181 -0
- package/shared/definition6.js +1 -1
- package/shared/definition7.js +3 -2
- package/shared/definition8.js +2 -2
- package/shared/enums.js +71 -0
- package/shared/icon.js +1 -1
- package/shared/index2.js +28 -1
- package/shared/key-codes.js +1 -1
- package/shared/key-codes2.js +9 -0
- package/shared/listbox.js +2 -7
- package/shared/localization/Locale.d.ts +4 -0
- package/shared/presentationDate.js +194 -141
- package/shared/radio.js +7 -0
- package/shared/text-field.js +1 -1
- package/shared/utils/Reflector.d.ts +8 -0
- package/shared/utils/randomId.d.ts +1 -0
- package/side-drawer/index.js +1 -1
- package/slider/index.js +2 -2
- package/split-button/index.js +2 -2
- package/style.css +686 -559
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/switch/index.js +2 -2
- package/tab/index.js +2 -2
- package/tab-panel/index.js +1 -1
- package/tabs/index.js +4 -4
- package/tag/index.js +2 -2
- package/tag-group/index.js +1 -1
- package/text-area/index.js +3 -2
- package/text-field/index.js +3 -2
- package/toggletip/index.js +5 -4
- package/tooltip/index.js +5 -4
- package/tree-item/index.js +2 -2
- package/tree-view/index.js +1 -1
- package/vivid.api.json +141 -0
package/shared/definition41.js
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { a as attr, F as FoundationElement, h as html, r as registerFactory } from './index.js';
|
|
2
|
-
import {
|
|
2
|
+
import { C as Checkbox, a as checkboxRegistries } from './definition14.js';
|
|
3
|
+
import { f as focusRegistries } from './definition57.js';
|
|
4
|
+
import { a as radioRegistries } from './definition39.js';
|
|
5
|
+
import { f as focusTemplateFactory } from './focus2.js';
|
|
6
|
+
import { C as Connotation } from './enums.js';
|
|
7
|
+
import { R as Radio } from './radio.js';
|
|
3
8
|
import { c as classNames } from './class-names.js';
|
|
9
|
+
import { w as when } from './when.js';
|
|
10
|
+
|
|
11
|
+
const styles = "/**\n * Do not edit directly\n * Generated on Wed, 01 Nov 2023 12:16:28 GMT\n */\n@supports selector(:focus-visible) {\n .base:focus-visible {\n outline: none;\n }\n}\n:host {\n display: flex;\n}\n\n.base {\n position: relative;\n padding: var(--selectable-box-spacing, 16px);\n border: 1px solid var(--_appearance-color-outline);\n background-color: var(--_appearance-color-fill);\n border-radius: 6px;\n inline-size: 100%;\n padding-block-start: calc(var(--selectable-box-spacing, 16px) + 36px);\n text-align: start;\n}\n.base.connotation-cta {\n /* @cssprop [--vvd-selectable-box-cta-firm=var(--vvd-color-cta-600)] */\n --_connotation-color-firm: var(--vvd-selectable-box-cta-firm, var(--vvd-color-cta-600));\n /* @cssprop [--vvd-selectable-box-cta-pale=var(--vvd-color-cta-300)] */\n --_connotation-color-pale: var(--vvd-selectable-box-cta-pale, var(--vvd-color-cta-300));\n /* @cssprop [--vvd-selectable-box-cta-soft=var(--vvd-color-cta-100)] */\n --_connotation-color-soft: var(--vvd-selectable-box-cta-soft, var(--vvd-color-cta-100));\n}\n.base:not(.connotation-cta) {\n /* @cssprop [--vvd-selectable-box-accent-firm=var(--vvd-color-canvas-text)] */\n --_connotation-color-firm: var(--vvd-selectable-box-accent-firm, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-selectable-box-accent-pale=var(--vvd-color-neutral-300)] */\n --_connotation-color-pale: var(--vvd-selectable-box-accent-pale, var(--vvd-color-neutral-300));\n /* @cssprop [--vvd-selectable-box-accent-soft=var(--vvd-color-neutral-100)] */\n --_connotation-color-soft: var(--vvd-selectable-box-accent-soft, var(--vvd-color-neutral-100));\n}\n.base {\n --_appearance-color-text: var(--_connotation-color-firm);\n --_appearance-color-fill: var(--vvd-color-canvas);\n --_appearance-color-outline: var(--_connotation-color-pale);\n}\n.base:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)) {\n --_appearance-color-text: var(--_connotation-color-firm);\n --_appearance-color-fill: var(--vvd-color-canvas);\n --_appearance-color-outline: var(--_connotation-color-firm);\n}\n.base:where(:checked, .checked):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--_connotation-color-firm);\n --_appearance-color-fill: var(--_connotation-color-soft);\n --_appearance-color-outline: var(--_connotation-color-pale);\n}\n.base:where(:checked, .checked):where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)) {\n --_appearance-color-text: var(--_connotation-color-firm);\n --_appearance-color-fill: var(--_connotation-color-soft);\n --_appearance-color-outline: var(--_connotation-color-firm);\n}\n.base.tight {\n overflow: hidden;\n min-height: calc(var(--selectable-box-spacing, 16px) * 2 + 22px);\n padding: 0;\n}\n.base.clickable {\n cursor: pointer;\n}\n\n.focus-indicator {\n --focus-stroke-gap-color: transparent;\n --focus-inset: -1px;\n pointer-events: none;\n}\n.base:not(:focus-visible) > .focus-indicator {\n display: none;\n}\n\n.control {\n position: absolute;\n inset-block-start: var(--selectable-box-spacing, 16px);\n inset-inline-end: var(--selectable-box-spacing, 16px);\n}";
|
|
4
12
|
|
|
5
13
|
var __defProp = Object.defineProperty;
|
|
6
14
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -13,97 +21,124 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
13
21
|
__defProp(target, key, result);
|
|
14
22
|
return result;
|
|
15
23
|
};
|
|
16
|
-
class
|
|
24
|
+
class SelectableBox extends FoundationElement {
|
|
17
25
|
constructor() {
|
|
18
26
|
super(...arguments);
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
22
|
-
this.
|
|
27
|
+
this.checked = false;
|
|
28
|
+
this.clickable = false;
|
|
29
|
+
this.controlAriaLabel = null;
|
|
30
|
+
this.controlAriaLabelledby = null;
|
|
31
|
+
this.tight = false;
|
|
23
32
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
/**
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
_handleCheckedChange() {
|
|
37
|
+
if (this.controlType === "radio" && this.checked)
|
|
38
|
+
return;
|
|
39
|
+
this.checked = !this.checked;
|
|
40
|
+
this.$emit("change");
|
|
31
41
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
42
|
+
/**
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
_handleKeydown(event) {
|
|
46
|
+
if (event.code === "Space" || event.code === "Enter" && this.clickable)
|
|
47
|
+
this._handleCheckedChange();
|
|
48
|
+
return true;
|
|
37
49
|
}
|
|
38
50
|
}
|
|
39
51
|
__decorateClass([
|
|
40
|
-
attr({
|
|
41
|
-
|
|
42
|
-
})
|
|
43
|
-
], SideDrawer.prototype, "alternate", 2);
|
|
52
|
+
attr({ mode: "boolean" })
|
|
53
|
+
], SelectableBox.prototype, "checked", 2);
|
|
44
54
|
__decorateClass([
|
|
45
|
-
attr({
|
|
46
|
-
|
|
47
|
-
})
|
|
48
|
-
], SideDrawer.prototype, "modal", 2);
|
|
55
|
+
attr({ mode: "boolean" })
|
|
56
|
+
], SelectableBox.prototype, "clickable", 2);
|
|
49
57
|
__decorateClass([
|
|
50
|
-
attr
|
|
51
|
-
|
|
52
|
-
})
|
|
53
|
-
], SideDrawer.prototype, "open", 2);
|
|
58
|
+
attr
|
|
59
|
+
], SelectableBox.prototype, "connotation", 2);
|
|
54
60
|
__decorateClass([
|
|
55
|
-
attr({
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
attr({ attribute: "control-aria-label" })
|
|
62
|
+
], SelectableBox.prototype, "controlAriaLabel", 2);
|
|
63
|
+
__decorateClass([
|
|
64
|
+
attr({ attribute: "control-aria-labelledby" })
|
|
65
|
+
], SelectableBox.prototype, "controlAriaLabelledby", 2);
|
|
66
|
+
__decorateClass([
|
|
67
|
+
attr({ attribute: "control-type" })
|
|
68
|
+
], SelectableBox.prototype, "controlType", 2);
|
|
69
|
+
__decorateClass([
|
|
70
|
+
attr({ mode: "boolean" })
|
|
71
|
+
], SelectableBox.prototype, "tight", 2);
|
|
61
72
|
|
|
62
|
-
const getClasses = ({
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"
|
|
68
|
-
["
|
|
69
|
-
["open", open],
|
|
70
|
-
["trailing", trailing]
|
|
73
|
+
const getClasses = ({ connotation, tight, checked, clickable }) => classNames(
|
|
74
|
+
"base",
|
|
75
|
+
[`connotation-${connotation}`, Boolean(connotation)],
|
|
76
|
+
["tight", tight],
|
|
77
|
+
["checked", checked],
|
|
78
|
+
["clickable", clickable],
|
|
79
|
+
["readonly", !clickable]
|
|
71
80
|
);
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
function handleControlChange(x) {
|
|
82
|
+
if (!x.clickable)
|
|
83
|
+
x._handleCheckedChange();
|
|
84
|
+
}
|
|
85
|
+
function checkbox(context) {
|
|
86
|
+
const checkboxTag = context.tagFor(Checkbox);
|
|
87
|
+
return html`${when((x) => x.controlType !== "radio", html`
|
|
88
|
+
<${checkboxTag}
|
|
89
|
+
aria-label="${(x) => !x.clickable && x.controlAriaLabel ? x.controlAriaLabel : null}"
|
|
90
|
+
aria-labelledby="${(x) => !x.clickable && x.controlAriaLabelledby ? x.controlAriaLabelledby : null}"
|
|
91
|
+
tabindex="${(x) => x.clickable ? "-1" : "0"}"
|
|
92
|
+
aria-hidden="${(x) => x.clickable}"
|
|
93
|
+
@change="${(x) => handleControlChange(x)}"
|
|
94
|
+
class="control checkbox"
|
|
95
|
+
connotation="${(x) => x.connotation === "cta" ? Connotation.CTA : Connotation.Accent}"
|
|
96
|
+
:checked="${(x) => x.checked}"
|
|
97
|
+
></${checkboxTag}>`)}
|
|
98
|
+
`;
|
|
99
|
+
}
|
|
100
|
+
function radio(context) {
|
|
101
|
+
const radioTag = context.tagFor(Radio);
|
|
102
|
+
return html`${when((x) => x.controlType === "radio", html`
|
|
103
|
+
<${radioTag}
|
|
104
|
+
aria-label="${(x) => !x.clickable && x.controlAriaLabel ? x.controlAriaLabel : null}"
|
|
105
|
+
aria-labelledby="${(x) => !x.clickable && x.controlAriaLabelledby ? x.controlAriaLabelledby : ""}"
|
|
106
|
+
tabindex="${(x) => x.clickable ? "-1" : "0"}"
|
|
107
|
+
aria-hidden="${(x) => x.clickable}"
|
|
108
|
+
@change="${(x) => handleControlChange(x)}"
|
|
109
|
+
class="control radio"
|
|
110
|
+
connotation="${(x) => x.connotation === "cta" ? Connotation.CTA : Connotation.Accent}"
|
|
111
|
+
:checked="${(x) => x.checked}"
|
|
112
|
+
></${radioTag}>`)}
|
|
113
|
+
`;
|
|
114
|
+
}
|
|
115
|
+
const SelectableBoxTemplate = (context) => {
|
|
116
|
+
const focusTemplate = focusTemplateFactory(context);
|
|
117
|
+
return html`
|
|
118
|
+
<div
|
|
119
|
+
class="${getClasses}"
|
|
120
|
+
tabindex="${(x) => x.clickable ? "0" : null}"
|
|
121
|
+
role="${(x) => x.clickable ? "button" : null}"
|
|
122
|
+
aria-pressed="${(x) => x.clickable && x.checked ? x.checked : null}"
|
|
123
|
+
aria-label="${(x) => x.clickable ? x.controlAriaLabel : null}"
|
|
124
|
+
aria-labelledby="${(x) => x.clickable ? x.controlAriaLabelledby : null}"
|
|
125
|
+
@keydown="${(x, c) => x._handleKeydown(c.event)}"
|
|
126
|
+
@click="${(x) => x.clickable ? x._handleCheckedChange() : null}"
|
|
127
|
+
>
|
|
128
|
+
${(x) => x.clickable ? focusTemplate : ""}
|
|
129
|
+
${checkbox(context)}
|
|
130
|
+
${radio(context)}
|
|
131
|
+
<slot></slot>
|
|
86
132
|
</div>
|
|
87
|
-
|
|
88
|
-
${when(
|
|
89
|
-
(x) => x.modal,
|
|
90
|
-
html`<div class="${getScrimClasses}" @click="${(x) => x.open = false}"></div>`
|
|
91
|
-
)}
|
|
92
133
|
`;
|
|
93
|
-
const handleKeydown = (x, { key }) => {
|
|
94
|
-
if (key === "Escape") {
|
|
95
|
-
x.open = false;
|
|
96
|
-
} else {
|
|
97
|
-
return true;
|
|
98
|
-
}
|
|
99
134
|
};
|
|
100
135
|
|
|
101
|
-
const
|
|
102
|
-
baseName: "
|
|
103
|
-
template:
|
|
136
|
+
const selectableBoxDefinition = SelectableBox.compose({
|
|
137
|
+
baseName: "selectable-box",
|
|
138
|
+
template: SelectableBoxTemplate,
|
|
104
139
|
styles
|
|
105
140
|
});
|
|
106
|
-
const
|
|
107
|
-
const
|
|
141
|
+
const selectableBoxRegistries = [selectableBoxDefinition(), ...checkboxRegistries, ...focusRegistries, ...radioRegistries];
|
|
142
|
+
const registerSelectableBox = registerFactory(selectableBoxRegistries);
|
|
108
143
|
|
|
109
|
-
export {
|
|
144
|
+
export { selectableBoxRegistries as a, registerSelectableBox as r, selectableBoxDefinition as s };
|