@vonage/vivid 3.40.0 → 3.41.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.
Files changed (160) hide show
  1. package/accordion/index.js +2 -2
  2. package/accordion-item/index.js +2 -2
  3. package/alert/index.js +6 -5
  4. package/audio-player/index.js +33 -0
  5. package/avatar/index.js +2 -2
  6. package/badge/index.js +2 -2
  7. package/banner/index.js +8 -5
  8. package/breadcrumb/index.js +1 -1
  9. package/breadcrumb-item/index.js +3 -3
  10. package/button/index.js +4 -4
  11. package/calendar/index.js +1 -1
  12. package/calendar-event/index.js +1 -1
  13. package/card/index.js +4 -3
  14. package/checkbox/index.js +3 -3
  15. package/combobox/index.js +8 -8
  16. package/custom-elements.json +330 -38
  17. package/data-grid/index.js +2 -2
  18. package/date-picker/index.js +9 -9
  19. package/date-range-picker/index.js +8 -8
  20. package/dialog/index.js +6 -6
  21. package/divider/index.js +1 -1
  22. package/elevation/index.js +1 -1
  23. package/empty-state/index.js +2 -2
  24. package/fab/index.js +3 -3
  25. package/file-picker/index.js +5 -5
  26. package/focus/index.js +1 -1
  27. package/header/index.js +2 -2
  28. package/icon/index.js +1 -1
  29. package/index.js +57 -56
  30. package/layout/index.js +1 -1
  31. package/lib/alert/alert.d.ts +3 -1
  32. package/lib/alert/locale.d.ts +3 -0
  33. package/lib/audio-player/audio-player.d.ts +17 -0
  34. package/lib/audio-player/audio-player.template.d.ts +4 -0
  35. package/lib/audio-player/definition.d.ts +4 -0
  36. package/lib/audio-player/locale.d.ts +5 -0
  37. package/lib/banner/banner.d.ts +3 -1
  38. package/lib/banner/locale.d.ts +3 -0
  39. package/lib/card/card.d.ts +3 -0
  40. package/lib/card/card.template.d.ts +1 -1
  41. package/lib/card/definition.d.ts +1 -0
  42. package/lib/checkbox/checkbox.d.ts +1 -0
  43. package/lib/components.d.ts +1 -0
  44. package/lib/enums.d.ts +2 -1
  45. package/lib/selectable-box/selectable-box.d.ts +1 -2
  46. package/lib/split-button/locale.d.ts +3 -0
  47. package/lib/split-button/split-button.d.ts +3 -1
  48. package/listbox/index.js +4 -4
  49. package/locales/en-GB.js +14 -0
  50. package/locales/en-US.js +14 -0
  51. package/locales/ja-JP.js +14 -0
  52. package/locales/zh-CN.js +14 -0
  53. package/menu/index.js +8 -8
  54. package/menu-item/index.js +3 -3
  55. package/nav/index.js +1 -1
  56. package/nav-disclosure/index.js +3 -3
  57. package/nav-item/index.js +3 -3
  58. package/note/index.js +2 -2
  59. package/number-field/index.js +6 -6
  60. package/option/index.js +3 -3
  61. package/package.json +1 -1
  62. package/pagination/index.js +5 -5
  63. package/popup/index.js +6 -6
  64. package/progress/index.js +1 -1
  65. package/progress-ring/index.js +1 -1
  66. package/radio/index.js +2 -2
  67. package/radio-group/index.js +2 -2
  68. package/select/index.js +8 -8
  69. package/selectable-box/index.js +5 -5
  70. package/shared/definition.js +3 -3
  71. package/shared/definition10.js +90 -159
  72. package/shared/definition11.js +151 -29
  73. package/shared/definition12.js +37 -766
  74. package/shared/definition13.js +747 -106
  75. package/shared/definition14.js +121 -198
  76. package/shared/definition15.js +156 -664
  77. package/shared/definition16.js +576 -1137
  78. package/shared/definition17.js +1278 -143
  79. package/shared/definition18.js +64 -305
  80. package/shared/definition19.js +357 -218
  81. package/shared/definition2.js +1 -1
  82. package/shared/definition20.js +259 -67
  83. package/shared/definition21.js +66 -58
  84. package/shared/definition22.js +43 -84
  85. package/shared/definition23.js +76 -2353
  86. package/shared/definition24.js +2362 -45
  87. package/shared/definition25.js +63 -27
  88. package/shared/definition26.js +24 -51
  89. package/shared/definition27.js +36 -822
  90. package/shared/definition28.js +837 -49
  91. package/shared/definition29.js +52 -89
  92. package/shared/definition3.js +1 -1
  93. package/shared/definition30.js +88 -24
  94. package/shared/definition31.js +25 -12
  95. package/shared/definition32.js +12 -52
  96. package/shared/definition33.js +28 -502
  97. package/shared/definition34.js +442 -197
  98. package/shared/definition35.js +260 -186
  99. package/shared/definition36.js +186 -75
  100. package/shared/definition37.js +70 -54
  101. package/shared/definition38.js +65 -421
  102. package/shared/definition39.js +437 -38
  103. package/shared/definition4.js +43 -16
  104. package/shared/definition40.js +32 -680
  105. package/shared/definition41.js +654 -105
  106. package/shared/definition42.js +105 -77
  107. package/shared/definition43.js +74 -567
  108. package/shared/definition44.js +568 -102
  109. package/shared/definition45.js +110 -135
  110. package/shared/definition46.js +153 -17
  111. package/shared/definition47.js +16 -79
  112. package/shared/definition48.js +53 -475
  113. package/shared/definition49.js +493 -25
  114. package/shared/definition5.js +160 -44
  115. package/shared/definition50.js +22 -121
  116. package/shared/definition51.js +113 -271
  117. package/shared/definition52.js +249 -243
  118. package/shared/definition53.js +270 -109
  119. package/shared/definition54.js +84 -74
  120. package/shared/definition55.js +114 -69
  121. package/shared/definition56.js +81 -292
  122. package/shared/definition57.js +302 -13
  123. package/shared/definition58.js +11 -41
  124. package/shared/definition59.js +20 -154
  125. package/shared/definition6.js +43 -33
  126. package/shared/definition60.js +181 -0
  127. package/shared/definition7.js +39 -106
  128. package/shared/definition8.js +122 -38
  129. package/shared/definition9.js +56 -89
  130. package/shared/enums.js +1 -0
  131. package/shared/icon.js +2 -2
  132. package/shared/index2.js +1 -1
  133. package/shared/listbox.js +1 -1
  134. package/shared/localization/Locale.d.ts +8 -0
  135. package/shared/patterns/form-elements/form-elements.d.ts +6 -6
  136. package/shared/presentationDate.js +5 -5
  137. package/shared/text-field.js +1 -1
  138. package/side-drawer/index.js +1 -1
  139. package/slider/index.js +3 -3
  140. package/split-button/index.js +6 -3
  141. package/style.css +248 -208
  142. package/styles/core/all.css +1 -1
  143. package/styles/core/theme.css +1 -1
  144. package/styles/core/typography.css +1 -1
  145. package/styles/tokens/theme-dark.css +4 -4
  146. package/styles/tokens/theme-light.css +4 -4
  147. package/styles/tokens/vivid-2-compat.css +1 -1
  148. package/switch/index.js +3 -3
  149. package/tab/index.js +3 -3
  150. package/tab-panel/index.js +1 -1
  151. package/tabs/index.js +5 -5
  152. package/tag/index.js +3 -3
  153. package/tag-group/index.js +1 -1
  154. package/text-area/index.js +3 -3
  155. package/text-field/index.js +3 -3
  156. package/toggletip/index.js +7 -7
  157. package/tooltip/index.js +7 -7
  158. package/tree-item/index.js +3 -3
  159. package/tree-view/index.js +1 -1
  160. package/vivid.api.json +251 -0
@@ -1,6 +1,14 @@
1
1
  import { a as attr, F as FoundationElement, h as html, r as registerFactory } from './index.js';
2
- import { w as when } from './when.js';
2
+ import { C as Checkbox, a as checkboxRegistries } from './definition15.js';
3
+ import { f as focusRegistries } from './definition58.js';
4
+ import { a as radioRegistries } from './definition40.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, 22 Nov 2023 16:09:43 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,117 @@ var __decorateClass = (decorators, target, key, kind) => {
13
21
  __defProp(target, key, result);
14
22
  return result;
15
23
  };
16
- class SideDrawer extends FoundationElement {
24
+ class SelectableBox extends FoundationElement {
17
25
  constructor() {
18
26
  super(...arguments);
19
- this.alternate = false;
20
- this.modal = false;
21
- this.open = false;
22
- this.trailing = false;
23
- }
24
- attributeChangedCallback(name, oldValue, newValue) {
25
- super.attributeChangedCallback(name, oldValue, newValue);
26
- switch (name) {
27
- case "open": {
28
- this.open ? this.#open() : this.#close();
29
- }
30
- }
27
+ this.ariaLabel = null;
28
+ this.checked = false;
29
+ this.clickable = false;
30
+ this.tight = false;
31
31
  }
32
- #close() {
33
- this.$emit("close", void 0, { bubbles: false });
32
+ /**
33
+ * @internal
34
+ */
35
+ _handleCheckedChange() {
36
+ if (this.controlType === "radio" && this.checked)
37
+ return;
38
+ this.checked = !this.checked;
39
+ this.$emit("change");
34
40
  }
35
- #open() {
36
- this.$emit("open", void 0, { bubbles: false });
41
+ /**
42
+ * @internal
43
+ */
44
+ _handleKeydown(event) {
45
+ if ((event.code === "Space" || event.code === "Enter") && this.clickable)
46
+ return this._handleCheckedChange();
47
+ return true;
37
48
  }
38
49
  }
39
50
  __decorateClass([
40
- attr({
41
- mode: "boolean"
42
- })
43
- ], SideDrawer.prototype, "alternate", 2);
51
+ attr({ attribute: "aria-label" })
52
+ ], SelectableBox.prototype, "ariaLabel", 2);
44
53
  __decorateClass([
45
- attr({
46
- mode: "boolean"
47
- })
48
- ], SideDrawer.prototype, "modal", 2);
54
+ attr({ mode: "boolean" })
55
+ ], SelectableBox.prototype, "checked", 2);
49
56
  __decorateClass([
50
- attr({
51
- mode: "boolean"
52
- })
53
- ], SideDrawer.prototype, "open", 2);
57
+ attr({ mode: "boolean" })
58
+ ], SelectableBox.prototype, "clickable", 2);
54
59
  __decorateClass([
55
- attr({
56
- mode: "boolean"
57
- })
58
- ], SideDrawer.prototype, "trailing", 2);
59
-
60
- const styles = "/**\n * Do not edit directly\n * Generated on Wed, 01 Nov 2023 12:16:28 GMT\n */\n.control {\n position: fixed;\n z-index: 1;\n background-color: var(--vvd-color-canvas);\n color: var(--vvd-color-canvas-text);\n inline-size: 280px;\n inset-block: 0;\n overflow-y: auto;\n}\n.control[part~=vvd-theme-alternate] {\n background-color: var(--vvd-color-canvas);\n color: var(--vvd-color-canvas-text);\n color-scheme: var(--vvd-color-scheme);\n}\n.control.trailing {\n inset-inline-end: 0;\n}\n.control:not(.open).trailing {\n transform: translateX(100%);\n}\n.control:not(.open):not(.trailing) {\n transform: translateX(-100%);\n}\n.control.open:not(.modal).trailing + .side-drawer-app-content {\n margin-inline-end: var(--side-drawer-app-content-offset, 280px);\n}\n.control.open:not(.modal):not(.trailing) + .side-drawer-app-content {\n margin-inline-start: var(--side-drawer-app-content-offset, 280px);\n}\n@media (prefers-reduced-motion: no-preference) {\n .control {\n transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);\n }\n}\n\n.scrim {\n background-color: var(--vvd-color-canvas-text, currentColor);\n opacity: 0.5;\n position: fixed;\n inset: 0;\n}\n.scrim:not(.open) {\n display: none;\n}";
60
+ attr
61
+ ], SelectableBox.prototype, "connotation", 2);
62
+ __decorateClass([
63
+ attr({ attribute: "control-type" })
64
+ ], SelectableBox.prototype, "controlType", 2);
65
+ __decorateClass([
66
+ attr({ mode: "boolean" })
67
+ ], SelectableBox.prototype, "tight", 2);
61
68
 
62
- const getClasses = ({
63
- modal,
64
- open,
65
- trailing
66
- }) => classNames(
67
- "control",
68
- ["modal", modal],
69
- ["open", open],
70
- ["trailing", trailing]
69
+ const getClasses = ({ connotation, tight, checked, clickable }) => classNames(
70
+ "base",
71
+ [`connotation-${connotation}`, Boolean(connotation)],
72
+ ["tight", tight],
73
+ ["checked", checked],
74
+ ["clickable", clickable],
75
+ ["readonly", !clickable]
71
76
  );
72
- const getScrimClasses = ({
73
- open
74
- }) => classNames(
75
- "scrim",
76
- ["open", open]
77
- );
78
- const sideDrawerTemplate = () => html`
79
- <aside class="${getClasses}" part="base ${(x) => x.alternate ? "vvd-theme-alternate" : ""}"
80
- @keydown="${(x, c) => handleKeydown(x, c.event)}">
81
- <slot></slot>
82
- </aside>
83
-
84
- <div class="side-drawer-app-content" ?inert="${(x) => x.open && x.modal}">
85
- <slot name="app-content"></slot>
77
+ function handleControlChange(x) {
78
+ if (!x.clickable)
79
+ x._handleCheckedChange();
80
+ }
81
+ function checkbox(context) {
82
+ const checkboxTag = context.tagFor(Checkbox);
83
+ return html`${when((x) => x.controlType !== "radio", html`
84
+ <${checkboxTag}
85
+ aria-label="${(x) => !x.clickable && x.ariaLabel ? x.ariaLabel : null}"
86
+ tabindex="${(x) => x.clickable ? "-1" : null}"
87
+ aria-hidden="${(x) => x.clickable}"
88
+ @change="${(x) => handleControlChange(x)}"
89
+ class="control checkbox"
90
+ connotation="${(x) => x.connotation === "cta" ? Connotation.CTA : Connotation.Accent}"
91
+ :checked="${(x) => x.checked}"
92
+ ></${checkboxTag}>`)}
93
+ `;
94
+ }
95
+ function radio(context) {
96
+ const radioTag = context.tagFor(Radio);
97
+ return html`${when((x) => x.controlType === "radio", html`
98
+ <${radioTag}
99
+ aria-label="${(x) => !x.clickable && x.ariaLabel ? x.ariaLabel : null}"
100
+ tabindex="${(x) => x.clickable ? "-1" : null}"
101
+ aria-hidden="${(x) => x.clickable}"
102
+ @change="${(x) => handleControlChange(x)}"
103
+ class="control radio"
104
+ connotation="${(x) => x.connotation === "cta" ? Connotation.CTA : Connotation.Accent}"
105
+ :checked="${(x) => x.checked}"
106
+ ></${radioTag}>`)}
107
+ `;
108
+ }
109
+ const SelectableBoxTemplate = (context) => {
110
+ const focusTemplate = focusTemplateFactory(context);
111
+ return html`<template role="presentation">
112
+ <div
113
+ class="${getClasses}"
114
+ tabindex="${(x) => x.clickable ? "0" : null}"
115
+ role="${(x) => x.clickable ? "button" : null}"
116
+ aria-pressed="${(x) => x.clickable && x.checked ? x.checked : null}"
117
+ aria-label="${(x) => x.clickable ? x.ariaLabel : null}"
118
+ @keydown="${(x, c) => x._handleKeydown(c.event)}"
119
+ @click="${(x) => x.clickable ? x._handleCheckedChange() : null}"
120
+ >
121
+ ${(x) => x.clickable ? focusTemplate : ""}
122
+ ${checkbox(context)}
123
+ ${radio(context)}
124
+ <slot></slot>
86
125
  </div>
87
-
88
- ${when(
89
- (x) => x.modal,
90
- html`<div class="${getScrimClasses}" @click="${(x) => x.open = false}"></div>`
91
- )}
92
- `;
93
- const handleKeydown = (x, { key }) => {
94
- if (key === "Escape") {
95
- x.open = false;
96
- } else {
97
- return true;
98
- }
126
+ </template>`;
99
127
  };
100
128
 
101
- const sideDrawerDefinition = SideDrawer.compose({
102
- baseName: "side-drawer",
103
- template: sideDrawerTemplate,
129
+ const selectableBoxDefinition = SelectableBox.compose({
130
+ baseName: "selectable-box",
131
+ template: SelectableBoxTemplate,
104
132
  styles
105
133
  });
106
- const sideDrawerRegistries = [sideDrawerDefinition()];
107
- const registerSideDrawer = registerFactory(sideDrawerRegistries);
134
+ const selectableBoxRegistries = [selectableBoxDefinition(), ...checkboxRegistries, ...focusRegistries, ...radioRegistries];
135
+ const registerSelectableBox = registerFactory(selectableBoxRegistries);
108
136
 
109
- export { sideDrawerRegistries as a, registerSideDrawer as r, sideDrawerDefinition as s };
137
+ export { selectableBoxRegistries as a, registerSelectableBox as r, selectableBoxDefinition as s };