@vonage/vivid 4.16.2 → 4.17.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 +3426 -506
- package/elevation/index.cjs +1 -1
- package/elevation/index.js +1 -1
- package/index.cjs +147 -39
- package/index.js +64 -59
- package/lib/accordion/definition.d.ts +2 -0
- package/lib/accordion-item/definition.d.ts +2 -0
- package/lib/action-group/definition.d.ts +2 -0
- package/lib/alert/definition.d.ts +2 -0
- package/lib/audio-player/definition.d.ts +2 -0
- package/lib/avatar/definition.d.ts +2 -0
- package/lib/badge/definition.d.ts +2 -0
- package/lib/banner/definition.d.ts +2 -0
- package/lib/breadcrumb/definition.d.ts +2 -0
- package/lib/breadcrumb-item/definition.d.ts +2 -0
- package/lib/button/definition.d.ts +2 -0
- package/lib/calendar/calendar.d.ts +2 -0
- package/lib/calendar/definition.d.ts +2 -0
- package/lib/calendar-event/definition.d.ts +2 -0
- package/lib/card/definition.d.ts +2 -0
- package/lib/checkbox/definition.d.ts +2 -0
- package/lib/combobox/definition.d.ts +2 -0
- package/lib/components.d.ts +1 -0
- package/lib/data-grid/definition.d.ts +4 -0
- package/lib/date-picker/definition.d.ts +2 -0
- package/lib/date-range-picker/definition.d.ts +2 -0
- package/lib/dial-pad/definition.d.ts +2 -0
- package/lib/dialog/definition.d.ts +2 -0
- package/lib/divider/definition.d.ts +2 -0
- package/lib/empty-state/definition.d.ts +2 -0
- package/lib/enums.d.ts +6 -0
- package/lib/fab/definition.d.ts +2 -0
- package/lib/file-picker/definition.d.ts +2 -0
- package/lib/header/definition.d.ts +2 -0
- package/lib/icon/definition.d.ts +2 -0
- package/lib/layout/definition.d.ts +2 -0
- package/lib/menu/definition.d.ts +2 -0
- package/lib/menu/menu.d.ts +454 -4
- package/lib/menu-item/definition.d.ts +2 -0
- package/lib/nav/definition.d.ts +2 -0
- package/lib/nav-disclosure/definition.d.ts +2 -0
- package/lib/nav-item/definition.d.ts +2 -0
- package/lib/note/definition.d.ts +2 -0
- package/lib/number-field/definition.d.ts +2 -0
- package/lib/option/definition.d.ts +2 -0
- package/lib/pagination/definition.d.ts +2 -0
- package/lib/popup/definition.d.ts +0 -1
- package/lib/popup/popup.d.ts +25 -0
- package/lib/progress/definition.d.ts +2 -0
- package/lib/progress-ring/definition.d.ts +2 -0
- package/lib/radio/definition.d.ts +2 -0
- package/lib/radio-group/definition.d.ts +2 -0
- package/lib/range-slider/definition.d.ts +2 -0
- package/lib/rich-text-editor/definition.d.ts +2 -0
- package/lib/rich-text-editor/facades/prose-mirror-vivid.schema.d.ts +2 -0
- package/lib/rich-text-editor/facades/vivid-prose-mirror.facade.d.ts +7 -0
- package/lib/rich-text-editor/rich-text-editor.d.ts +13 -0
- package/lib/rich-text-editor/rich-text-editor.template.d.ts +4 -0
- package/lib/searchable-select/definition.d.ts +2 -0
- package/lib/select/definition.d.ts +2 -0
- package/lib/selectable-box/definition.d.ts +2 -0
- package/lib/side-drawer/definition.d.ts +2 -0
- package/lib/slider/definition.d.ts +2 -0
- package/lib/split-button/definition.d.ts +2 -0
- package/lib/switch/definition.d.ts +2 -0
- package/lib/tab/definition.d.ts +2 -0
- package/lib/tab-panel/definition.d.ts +2 -0
- package/lib/tabs/definition.d.ts +2 -0
- package/lib/tag/definition.d.ts +2 -0
- package/lib/tag-group/definition.d.ts +2 -0
- package/lib/text-area/definition.d.ts +2 -0
- package/lib/text-field/definition.d.ts +2 -0
- package/lib/time-picker/definition.d.ts +2 -0
- package/lib/time-picker/inline-time-picker/columns.d.ts +13 -0
- package/lib/time-picker/inline-time-picker/definition.d.ts +1 -0
- package/lib/time-picker/inline-time-picker/inline-time-picker.d.ts +15 -0
- package/lib/time-picker/inline-time-picker/inline-time-picker.template.d.ts +5 -0
- package/lib/time-picker/time-picker.template.d.ts +1 -2
- package/lib/toggletip/definition.d.ts +2 -0
- package/lib/toggletip/toggletip.d.ts +454 -4
- package/lib/tooltip/definition.d.ts +2 -0
- package/lib/tooltip/tooltip.d.ts +454 -4
- package/lib/tree-item/definition.d.ts +2 -0
- package/lib/tree-view/definition.d.ts +2 -0
- package/lib/video-player/definition.d.ts +2 -0
- package/menu/index.js +1 -1
- package/package.json +7 -2
- package/popup/index.cjs +1 -1
- package/popup/index.js +1 -1
- package/rich-text-editor/index.cjs +5 -0
- package/rich-text-editor/index.js +3 -0
- package/searchable-select/index.cjs +1 -1
- package/searchable-select/index.js +1 -1
- 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/affix.cjs +1 -3
- package/shared/affix.js +2 -4
- package/shared/anchored.cjs +12 -9
- package/shared/anchored.js +13 -10
- package/shared/definition.js +1 -1
- package/shared/definition10.cjs +1 -0
- package/shared/definition10.js +2 -2
- package/shared/definition11.cjs +1 -1
- package/shared/definition11.js +2 -2
- package/shared/definition12.cjs +1 -1
- package/shared/definition12.js +2 -2
- package/shared/definition13.cjs +15 -2
- package/shared/definition13.js +16 -4
- package/shared/definition14.cjs +3 -2
- package/shared/definition14.js +4 -4
- package/shared/definition15.cjs +1 -1
- package/shared/definition15.js +2 -2
- package/shared/definition16.cjs +18 -18
- package/shared/definition16.js +6 -6
- package/shared/definition17.cjs +3 -0
- package/shared/definition17.js +2 -2
- package/shared/definition18.cjs +7 -7
- package/shared/definition18.js +4 -4
- package/shared/definition19.cjs +15 -15
- package/shared/definition19.js +4 -4
- package/shared/definition2.cjs +1 -0
- package/shared/definition2.js +2 -2
- package/shared/definition20.cjs +5 -4
- package/shared/definition20.js +6 -6
- package/shared/definition21.cjs +3 -2
- package/shared/definition21.js +4 -4
- package/shared/definition22.js +1 -1
- package/shared/definition23.cjs +2 -1
- package/shared/definition23.js +3 -3
- package/shared/definition24.cjs +2 -1
- package/shared/definition24.js +3 -3
- package/shared/definition25.cjs +14 -14
- package/shared/definition25.js +3 -3
- package/shared/definition26.cjs +2 -1
- package/shared/definition26.js +3 -3
- package/shared/definition27.cjs +1 -1
- package/shared/definition27.js +2 -2
- package/shared/definition28.cjs +1 -0
- package/shared/definition28.js +2 -2
- package/shared/definition29.cjs +53 -61
- package/shared/definition29.js +54 -63
- package/shared/definition3.cjs +1 -0
- package/shared/definition3.js +2 -2
- package/shared/definition30.cjs +1 -0
- package/shared/definition30.js +2 -2
- package/shared/definition31.cjs +1 -0
- package/shared/definition31.js +2 -2
- package/shared/definition32.cjs +1 -0
- package/shared/definition32.js +2 -2
- package/shared/definition33.cjs +2 -1
- package/shared/definition33.js +3 -3
- package/shared/definition34.cjs +25 -25
- package/shared/definition34.js +5 -5
- package/shared/definition35.cjs +1 -1
- package/shared/definition35.js +2 -2
- package/shared/definition36.cjs +2 -1
- package/shared/definition36.js +3 -3
- package/shared/definition37.cjs +1 -1
- package/shared/definition37.js +2 -2
- package/shared/definition38.cjs +2 -1
- package/shared/definition38.js +3 -3
- package/shared/definition39.cjs +1 -0
- package/shared/definition39.js +2 -2
- package/shared/definition4.cjs +3 -2
- package/shared/definition4.js +4 -4
- package/shared/definition40.cjs +1 -1
- package/shared/definition40.js +2 -2
- package/shared/definition41.cjs +30 -30
- package/shared/definition41.js +5 -5
- package/shared/definition42.cjs +12538 -1052
- package/shared/definition42.js +12538 -1053
- package/shared/definition43.cjs +927 -701
- package/shared/definition43.js +929 -702
- package/shared/definition44.cjs +874 -104
- package/shared/definition44.js +874 -104
- package/shared/definition45.cjs +114 -90
- package/shared/definition45.js +113 -90
- package/shared/definition46.cjs +88 -464
- package/shared/definition46.js +87 -463
- package/shared/definition47.cjs +463 -109
- package/shared/definition47.js +462 -109
- package/shared/definition48.cjs +108 -106
- package/shared/definition48.js +107 -106
- package/shared/definition49.cjs +139 -13
- package/shared/definition49.js +138 -13
- package/shared/definition5.cjs +3 -2
- package/shared/definition5.js +5 -5
- package/shared/definition50.cjs +16 -114
- package/shared/definition50.js +15 -114
- package/shared/definition51.cjs +79 -485
- package/shared/definition51.js +78 -485
- package/shared/definition52.cjs +503 -23
- package/shared/definition52.js +502 -23
- package/shared/definition53.cjs +25 -123
- package/shared/definition53.js +24 -123
- package/shared/definition54.cjs +96 -254
- package/shared/definition54.js +96 -255
- package/shared/definition55.cjs +261 -59
- package/shared/definition55.js +262 -60
- package/shared/definition56.cjs +72 -861
- package/shared/definition56.js +72 -861
- package/shared/definition57.cjs +880 -107
- package/shared/definition57.js +880 -107
- package/shared/definition58.cjs +104 -88
- package/shared/definition58.js +104 -89
- package/shared/definition59.cjs +80 -165
- package/shared/definition59.js +79 -163
- package/shared/definition6.cjs +2 -1
- package/shared/definition6.js +3 -3
- package/shared/definition60.cjs +142 -228
- package/shared/definition60.js +141 -229
- package/shared/definition61.cjs +233 -70146
- package/shared/definition61.js +232 -70146
- package/shared/definition62.cjs +69381 -28
- package/shared/definition62.js +69380 -27
- package/shared/definition63.cjs +28 -2163
- package/shared/definition63.js +27 -2161
- package/shared/definition64.cjs +2195 -0
- package/shared/definition64.js +2190 -0
- package/shared/definition7.cjs +2 -1
- package/shared/definition7.js +3 -3
- package/shared/definition8.cjs +2 -1
- package/shared/definition8.js +3 -3
- package/shared/definition9.cjs +1 -1
- package/shared/definition9.js +2 -2
- package/shared/enums.cjs +8 -0
- package/shared/enums.js +8 -1
- package/shared/form-associated.js +1 -1
- package/shared/form-elements.cjs +7 -7
- package/shared/form-elements.js +8 -8
- package/shared/foundation/vivid-element/vivid-element.d.ts +1 -0
- package/shared/patterns/anchored.d.ts +891 -10
- package/shared/patterns/trapped-focus.d.ts +2 -0
- package/shared/presentationDate.cjs +5 -7
- package/shared/presentationDate.js +5 -7
- package/shared/slider.template.cjs +4 -4
- package/shared/slider.template.js +4 -4
- package/shared/text-anchor.template.cjs +2 -2
- package/shared/text-anchor.template.js +2 -2
- package/shared/text-field.cjs +555 -2
- package/shared/text-field.js +554 -2
- package/shared/text-field2.cjs +2 -572
- package/shared/text-field2.js +2 -571
- package/shared/trapped-focus.cjs +7 -1
- package/shared/trapped-focus.js +7 -1
- package/shared/utils/mixins.d.ts +3 -0
- package/shared/vivid-element.cjs +3 -0
- package/shared/vivid-element.js +4 -1
- 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-anchor/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 +22795 -1
package/shared/definition45.cjs
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const definition = require('./definition15.cjs');
|
|
4
|
+
const definition$1 = require('./definition40.cjs');
|
|
3
5
|
const vividElement = require('./vivid-element.cjs');
|
|
4
|
-
const
|
|
5
|
-
const when = require('./when.cjs');
|
|
6
|
+
const enums = require('./enums.cjs');
|
|
6
7
|
const classNames = require('./class-names.cjs');
|
|
8
|
+
const when = require('./when.cjs');
|
|
9
|
+
|
|
10
|
+
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)}";
|
|
7
11
|
|
|
8
12
|
var __defProp = Object.defineProperty;
|
|
9
13
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -14,114 +18,134 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
14
18
|
if (result) __defProp(target, key, result);
|
|
15
19
|
return result;
|
|
16
20
|
};
|
|
17
|
-
class
|
|
21
|
+
class SelectableBox extends vividElement.VividElement {
|
|
18
22
|
constructor() {
|
|
19
23
|
super(...arguments);
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
24
|
-
|
|
25
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
26
|
-
super.attributeChangedCallback(name, oldValue, newValue);
|
|
27
|
-
switch (name) {
|
|
28
|
-
case "open": {
|
|
29
|
-
this.open ? this.#open() : this.#close();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
#close() {
|
|
34
|
-
this.$emit("close", void 0, { bubbles: false });
|
|
35
|
-
}
|
|
36
|
-
#open() {
|
|
37
|
-
this.$emit("open", void 0, { bubbles: false });
|
|
24
|
+
this.ariaLabel = null;
|
|
25
|
+
this.checked = false;
|
|
26
|
+
this.clickable = false;
|
|
27
|
+
this.clickableBox = false;
|
|
28
|
+
this.tight = false;
|
|
38
29
|
}
|
|
39
30
|
/**
|
|
40
31
|
* @internal
|
|
41
32
|
*/
|
|
42
|
-
|
|
43
|
-
if (
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
} else {
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
33
|
+
_handleCheckedChange() {
|
|
34
|
+
if (this.controlType === "radio" && this.checked) return;
|
|
35
|
+
this.checked = !this.checked;
|
|
36
|
+
if (this.clickableBox || this.clickable) this.$emit("change");
|
|
49
37
|
}
|
|
50
38
|
/**
|
|
51
39
|
* @internal
|
|
52
40
|
*/
|
|
53
|
-
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
})) {
|
|
58
|
-
this.open = false;
|
|
59
|
-
}
|
|
41
|
+
_handleKeydown(event) {
|
|
42
|
+
if ((event.code === "Space" || event.code === "Enter") && (this.clickableBox || this.clickable))
|
|
43
|
+
return this._handleCheckedChange();
|
|
44
|
+
return true;
|
|
60
45
|
}
|
|
61
46
|
}
|
|
62
47
|
__decorateClass([
|
|
63
|
-
vividElement.attr({
|
|
64
|
-
|
|
65
|
-
})
|
|
66
|
-
], SideDrawer.prototype, "alternate");
|
|
48
|
+
vividElement.attr({ attribute: "aria-label" })
|
|
49
|
+
], SelectableBox.prototype, "ariaLabel");
|
|
67
50
|
__decorateClass([
|
|
68
|
-
vividElement.attr({
|
|
69
|
-
|
|
70
|
-
})
|
|
71
|
-
], SideDrawer.prototype, "modal");
|
|
51
|
+
vividElement.attr({ mode: "boolean" })
|
|
52
|
+
], SelectableBox.prototype, "checked");
|
|
72
53
|
__decorateClass([
|
|
73
|
-
vividElement.attr({
|
|
74
|
-
|
|
75
|
-
})
|
|
76
|
-
], SideDrawer.prototype, "open");
|
|
54
|
+
vividElement.attr({ mode: "boolean" })
|
|
55
|
+
], SelectableBox.prototype, "clickable");
|
|
77
56
|
__decorateClass([
|
|
78
|
-
vividElement.attr({
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
57
|
+
vividElement.attr({ attribute: "clickable-box", mode: "boolean" })
|
|
58
|
+
], SelectableBox.prototype, "clickableBox");
|
|
59
|
+
__decorateClass([
|
|
60
|
+
vividElement.attr
|
|
61
|
+
], SelectableBox.prototype, "connotation");
|
|
62
|
+
__decorateClass([
|
|
63
|
+
vividElement.attr({ attribute: "control-type" })
|
|
64
|
+
], SelectableBox.prototype, "controlType");
|
|
65
|
+
__decorateClass([
|
|
66
|
+
vividElement.attr({ mode: "boolean" })
|
|
67
|
+
], SelectableBox.prototype, "tight");
|
|
84
68
|
|
|
85
|
-
const getClasses = ({
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
69
|
+
const getClasses = ({
|
|
70
|
+
connotation,
|
|
71
|
+
tight,
|
|
72
|
+
checked,
|
|
73
|
+
clickableBox,
|
|
74
|
+
clickable
|
|
75
|
+
}) => classNames.classNames(
|
|
76
|
+
"base",
|
|
77
|
+
[`connotation-${connotation}`, Boolean(connotation)],
|
|
78
|
+
["tight", tight],
|
|
79
|
+
["selected", checked],
|
|
80
|
+
["clickable", clickableBox || clickable],
|
|
81
|
+
["readonly", !clickableBox && !clickable]
|
|
90
82
|
);
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
)
|
|
113
|
-
|
|
83
|
+
function handleControlChange(x) {
|
|
84
|
+
if (!x.clickableBox) x._handleCheckedChange();
|
|
85
|
+
}
|
|
86
|
+
function checkbox(context) {
|
|
87
|
+
const checkboxTag = context.tagFor(definition.Checkbox);
|
|
88
|
+
return vividElement.html`${when.when(
|
|
89
|
+
(x) => x.controlType !== "radio",
|
|
90
|
+
vividElement.html`
|
|
91
|
+
<${checkboxTag}
|
|
92
|
+
aria-label="${(x) => !x.clickableBox && !x.clickable && x.ariaLabel ? x.ariaLabel : null}"
|
|
93
|
+
@change="${(x) => handleControlChange(x)}"
|
|
94
|
+
class="control checkbox"
|
|
95
|
+
connotation="${(x) => x.connotation === "cta" ? enums.Connotation.CTA : enums.Connotation.Accent}"
|
|
96
|
+
:checked="${(x) => x.checked}"
|
|
97
|
+
inert="${(x) => x.clickableBox || x.clickable ? true : null}"
|
|
98
|
+
></${checkboxTag}>`
|
|
99
|
+
)} `;
|
|
100
|
+
}
|
|
101
|
+
function radio(context) {
|
|
102
|
+
const radioTag = context.tagFor(definition$1.Radio);
|
|
103
|
+
return vividElement.html`${when.when(
|
|
104
|
+
(x) => x.controlType === "radio",
|
|
105
|
+
vividElement.html`
|
|
106
|
+
<${radioTag}
|
|
107
|
+
aria-label="${(x) => !x.clickableBox && !x.clickable && x.ariaLabel ? x.ariaLabel : null}"
|
|
108
|
+
@change="${(x) => handleControlChange(x)}"
|
|
109
|
+
class="control radio"
|
|
110
|
+
connotation="${(x) => x.connotation === "cta" ? enums.Connotation.CTA : enums.Connotation.Accent}"
|
|
111
|
+
:checked="${(x) => x.checked}"
|
|
112
|
+
inert="${(x) => x.clickableBox || x.clickable ? true : null}"
|
|
113
|
+
></${radioTag}>`
|
|
114
|
+
)} `;
|
|
115
|
+
}
|
|
116
|
+
const SelectableBoxTemplate = (context) => {
|
|
117
|
+
return vividElement.html`<template role="presentation">
|
|
118
|
+
<div
|
|
119
|
+
class="${getClasses}"
|
|
120
|
+
tabindex="${(x) => x.clickableBox || x.clickable ? "0" : null}"
|
|
121
|
+
role="${(x) => x.clickableBox || x.clickable ? "button" : null}"
|
|
122
|
+
aria-pressed="${(x) => x.clickableBox || x.clickable ? x.checked ? "true" : "false" : null}"
|
|
123
|
+
aria-label="${(x) => x.clickableBox || x.clickable ? x.ariaLabel : null}"
|
|
124
|
+
@keydown="${(x, c) => x._handleKeydown(c.event)}"
|
|
125
|
+
@click="${(x) => x.clickableBox || x.clickable ? x._handleCheckedChange() : null}"
|
|
126
|
+
>
|
|
127
|
+
${checkbox(context)} ${radio(context)}
|
|
128
|
+
<slot></slot>
|
|
129
|
+
</div>
|
|
130
|
+
</template>`;
|
|
131
|
+
};
|
|
114
132
|
|
|
115
|
-
const
|
|
116
|
-
"
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
[],
|
|
133
|
+
const selectableBoxDefinition = vividElement.defineVividComponent(
|
|
134
|
+
"selectable-box",
|
|
135
|
+
SelectableBox,
|
|
136
|
+
SelectableBoxTemplate,
|
|
137
|
+
[definition.checkboxDefinition, definition$1.radioDefinition],
|
|
120
138
|
{
|
|
121
|
-
styles
|
|
139
|
+
styles,
|
|
140
|
+
shadowOptions: {
|
|
141
|
+
delegatesFocus: true
|
|
142
|
+
}
|
|
122
143
|
}
|
|
123
144
|
);
|
|
124
|
-
const
|
|
145
|
+
const registerSelectableBox = vividElement.createRegisterFunction(
|
|
146
|
+
selectableBoxDefinition
|
|
147
|
+
);
|
|
125
148
|
|
|
126
|
-
exports.
|
|
127
|
-
exports.
|
|
149
|
+
exports.SelectableBox = SelectableBox;
|
|
150
|
+
exports.registerSelectableBox = registerSelectableBox;
|
|
151
|
+
exports.selectableBoxDefinition = selectableBoxDefinition;
|
package/shared/definition45.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { C as Checkbox, c as checkboxDefinition } from './definition15.js';
|
|
2
|
+
import { R as Radio, r as radioDefinition } from './definition40.js';
|
|
3
|
+
import { V as VividElement, a as attr, h as html, d as createRegisterFunction, f as defineVividComponent } from './vivid-element.js';
|
|
4
|
+
import { C as Connotation } from './enums.js';
|
|
4
5
|
import { c as classNames } from './class-names.js';
|
|
6
|
+
import { w as when } from './when.js';
|
|
7
|
+
|
|
8
|
+
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)}";
|
|
5
9
|
|
|
6
10
|
var __defProp = Object.defineProperty;
|
|
7
11
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -12,113 +16,132 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
12
16
|
if (result) __defProp(target, key, result);
|
|
13
17
|
return result;
|
|
14
18
|
};
|
|
15
|
-
class
|
|
19
|
+
class SelectableBox extends VividElement {
|
|
16
20
|
constructor() {
|
|
17
21
|
super(...arguments);
|
|
18
|
-
this.
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
22
|
-
|
|
23
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
24
|
-
super.attributeChangedCallback(name, oldValue, newValue);
|
|
25
|
-
switch (name) {
|
|
26
|
-
case "open": {
|
|
27
|
-
this.open ? this.#open() : this.#close();
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
#close() {
|
|
32
|
-
this.$emit("close", void 0, { bubbles: false });
|
|
33
|
-
}
|
|
34
|
-
#open() {
|
|
35
|
-
this.$emit("open", void 0, { bubbles: false });
|
|
22
|
+
this.ariaLabel = null;
|
|
23
|
+
this.checked = false;
|
|
24
|
+
this.clickable = false;
|
|
25
|
+
this.clickableBox = false;
|
|
26
|
+
this.tight = false;
|
|
36
27
|
}
|
|
37
28
|
/**
|
|
38
29
|
* @internal
|
|
39
30
|
*/
|
|
40
|
-
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
} else {
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
31
|
+
_handleCheckedChange() {
|
|
32
|
+
if (this.controlType === "radio" && this.checked) return;
|
|
33
|
+
this.checked = !this.checked;
|
|
34
|
+
if (this.clickableBox || this.clickable) this.$emit("change");
|
|
47
35
|
}
|
|
48
36
|
/**
|
|
49
37
|
* @internal
|
|
50
38
|
*/
|
|
51
|
-
|
|
52
|
-
if (
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
})) {
|
|
56
|
-
this.open = false;
|
|
57
|
-
}
|
|
39
|
+
_handleKeydown(event) {
|
|
40
|
+
if ((event.code === "Space" || event.code === "Enter") && (this.clickableBox || this.clickable))
|
|
41
|
+
return this._handleCheckedChange();
|
|
42
|
+
return true;
|
|
58
43
|
}
|
|
59
44
|
}
|
|
60
45
|
__decorateClass([
|
|
61
|
-
attr({
|
|
62
|
-
|
|
63
|
-
})
|
|
64
|
-
], SideDrawer.prototype, "alternate");
|
|
46
|
+
attr({ attribute: "aria-label" })
|
|
47
|
+
], SelectableBox.prototype, "ariaLabel");
|
|
65
48
|
__decorateClass([
|
|
66
|
-
attr({
|
|
67
|
-
|
|
68
|
-
})
|
|
69
|
-
], SideDrawer.prototype, "modal");
|
|
49
|
+
attr({ mode: "boolean" })
|
|
50
|
+
], SelectableBox.prototype, "checked");
|
|
70
51
|
__decorateClass([
|
|
71
|
-
attr({
|
|
72
|
-
|
|
73
|
-
})
|
|
74
|
-
], SideDrawer.prototype, "open");
|
|
52
|
+
attr({ mode: "boolean" })
|
|
53
|
+
], SelectableBox.prototype, "clickable");
|
|
75
54
|
__decorateClass([
|
|
76
|
-
attr({
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
55
|
+
attr({ attribute: "clickable-box", mode: "boolean" })
|
|
56
|
+
], SelectableBox.prototype, "clickableBox");
|
|
57
|
+
__decorateClass([
|
|
58
|
+
attr
|
|
59
|
+
], SelectableBox.prototype, "connotation");
|
|
60
|
+
__decorateClass([
|
|
61
|
+
attr({ attribute: "control-type" })
|
|
62
|
+
], SelectableBox.prototype, "controlType");
|
|
63
|
+
__decorateClass([
|
|
64
|
+
attr({ mode: "boolean" })
|
|
65
|
+
], SelectableBox.prototype, "tight");
|
|
82
66
|
|
|
83
|
-
const getClasses = ({
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
67
|
+
const getClasses = ({
|
|
68
|
+
connotation,
|
|
69
|
+
tight,
|
|
70
|
+
checked,
|
|
71
|
+
clickableBox,
|
|
72
|
+
clickable
|
|
73
|
+
}) => classNames(
|
|
74
|
+
"base",
|
|
75
|
+
[`connotation-${connotation}`, Boolean(connotation)],
|
|
76
|
+
["tight", tight],
|
|
77
|
+
["selected", checked],
|
|
78
|
+
["clickable", clickableBox || clickable],
|
|
79
|
+
["readonly", !clickableBox && !clickable]
|
|
88
80
|
);
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
)
|
|
111
|
-
|
|
81
|
+
function handleControlChange(x) {
|
|
82
|
+
if (!x.clickableBox) x._handleCheckedChange();
|
|
83
|
+
}
|
|
84
|
+
function checkbox(context) {
|
|
85
|
+
const checkboxTag = context.tagFor(Checkbox);
|
|
86
|
+
return html`${when(
|
|
87
|
+
(x) => x.controlType !== "radio",
|
|
88
|
+
html`
|
|
89
|
+
<${checkboxTag}
|
|
90
|
+
aria-label="${(x) => !x.clickableBox && !x.clickable && x.ariaLabel ? x.ariaLabel : null}"
|
|
91
|
+
@change="${(x) => handleControlChange(x)}"
|
|
92
|
+
class="control checkbox"
|
|
93
|
+
connotation="${(x) => x.connotation === "cta" ? Connotation.CTA : Connotation.Accent}"
|
|
94
|
+
:checked="${(x) => x.checked}"
|
|
95
|
+
inert="${(x) => x.clickableBox || x.clickable ? true : null}"
|
|
96
|
+
></${checkboxTag}>`
|
|
97
|
+
)} `;
|
|
98
|
+
}
|
|
99
|
+
function radio(context) {
|
|
100
|
+
const radioTag = context.tagFor(Radio);
|
|
101
|
+
return html`${when(
|
|
102
|
+
(x) => x.controlType === "radio",
|
|
103
|
+
html`
|
|
104
|
+
<${radioTag}
|
|
105
|
+
aria-label="${(x) => !x.clickableBox && !x.clickable && x.ariaLabel ? x.ariaLabel : null}"
|
|
106
|
+
@change="${(x) => handleControlChange(x)}"
|
|
107
|
+
class="control radio"
|
|
108
|
+
connotation="${(x) => x.connotation === "cta" ? Connotation.CTA : Connotation.Accent}"
|
|
109
|
+
:checked="${(x) => x.checked}"
|
|
110
|
+
inert="${(x) => x.clickableBox || x.clickable ? true : null}"
|
|
111
|
+
></${radioTag}>`
|
|
112
|
+
)} `;
|
|
113
|
+
}
|
|
114
|
+
const SelectableBoxTemplate = (context) => {
|
|
115
|
+
return html`<template role="presentation">
|
|
116
|
+
<div
|
|
117
|
+
class="${getClasses}"
|
|
118
|
+
tabindex="${(x) => x.clickableBox || x.clickable ? "0" : null}"
|
|
119
|
+
role="${(x) => x.clickableBox || x.clickable ? "button" : null}"
|
|
120
|
+
aria-pressed="${(x) => x.clickableBox || x.clickable ? x.checked ? "true" : "false" : null}"
|
|
121
|
+
aria-label="${(x) => x.clickableBox || x.clickable ? x.ariaLabel : null}"
|
|
122
|
+
@keydown="${(x, c) => x._handleKeydown(c.event)}"
|
|
123
|
+
@click="${(x) => x.clickableBox || x.clickable ? x._handleCheckedChange() : null}"
|
|
124
|
+
>
|
|
125
|
+
${checkbox(context)} ${radio(context)}
|
|
126
|
+
<slot></slot>
|
|
127
|
+
</div>
|
|
128
|
+
</template>`;
|
|
129
|
+
};
|
|
112
130
|
|
|
113
|
-
const
|
|
114
|
-
"
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
[],
|
|
131
|
+
const selectableBoxDefinition = defineVividComponent(
|
|
132
|
+
"selectable-box",
|
|
133
|
+
SelectableBox,
|
|
134
|
+
SelectableBoxTemplate,
|
|
135
|
+
[checkboxDefinition, radioDefinition],
|
|
118
136
|
{
|
|
119
|
-
styles
|
|
137
|
+
styles,
|
|
138
|
+
shadowOptions: {
|
|
139
|
+
delegatesFocus: true
|
|
140
|
+
}
|
|
120
141
|
}
|
|
121
142
|
);
|
|
122
|
-
const
|
|
143
|
+
const registerSelectableBox = createRegisterFunction(
|
|
144
|
+
selectableBoxDefinition
|
|
145
|
+
);
|
|
123
146
|
|
|
124
|
-
export {
|
|
147
|
+
export { SelectableBox as S, registerSelectableBox as r, selectableBoxDefinition as s };
|