@vonage/vivid 3.0.0-next.129 → 3.0.0-next.130

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 (83) hide show
  1. package/combobox/index.js +33 -0
  2. package/custom-elements.json +102 -0
  3. package/dialog/index.js +1 -1
  4. package/divider/index.js +1 -1
  5. package/fab/index.js +1 -1
  6. package/header/index.js +1 -1
  7. package/index.js +30 -26
  8. package/layout/index.js +1 -1
  9. package/lib/combobox/combobox.d.ts +14 -0
  10. package/lib/combobox/combobox.template.d.ts +4 -0
  11. package/lib/combobox/definition.d.ts +3 -0
  12. package/lib/combobox/index.d.ts +1 -0
  13. package/lib/components.d.ts +1 -0
  14. package/listbox/index.js +3 -2
  15. package/menu/index.js +3 -3
  16. package/menu-item/index.js +1 -1
  17. package/nav/index.js +1 -1
  18. package/nav-disclosure/index.js +1 -1
  19. package/nav-item/index.js +1 -1
  20. package/note/index.js +1 -1
  21. package/number-field/index.js +4 -3
  22. package/option/index.js +1 -1
  23. package/package.json +1 -1
  24. package/popup/index.js +1 -1
  25. package/progress/index.js +1 -1
  26. package/progress-ring/index.js +1 -1
  27. package/radio/index.js +1 -1
  28. package/radio-group/index.js +1 -1
  29. package/shared/definition.js +1 -1
  30. package/shared/definition11.js +1 -1
  31. package/shared/definition12.js +1 -1
  32. package/shared/definition13.js +1 -1
  33. package/shared/definition14.js +1 -1
  34. package/shared/definition16.js +1 -1
  35. package/shared/definition17.js +709 -198
  36. package/shared/definition18.js +1630 -64
  37. package/shared/definition19.js +242 -68
  38. package/shared/definition2.js +1 -1
  39. package/shared/definition20.js +205 -40
  40. package/shared/definition21.js +67 -33
  41. package/shared/definition22.js +70 -1038
  42. package/shared/definition23.js +44 -247
  43. package/shared/definition24.js +35 -339
  44. package/shared/definition25.js +46 -1632
  45. package/shared/definition26.js +268 -271
  46. package/shared/definition27.js +344 -14
  47. package/shared/definition28.js +13 -67
  48. package/shared/definition29.js +65 -21
  49. package/shared/definition30.js +20 -45
  50. package/shared/definition31.js +40 -78
  51. package/shared/definition32.js +76 -59
  52. package/shared/definition33.js +67 -35
  53. package/shared/definition34.js +31 -421
  54. package/shared/definition35.js +418 -69
  55. package/shared/definition36.js +66 -572
  56. package/shared/definition37.js +526 -81
  57. package/shared/definition38.js +85 -217
  58. package/shared/definition39.js +246 -85
  59. package/shared/definition4.js +1 -1
  60. package/shared/definition40.js +110 -68
  61. package/shared/definition41.js +77 -0
  62. package/shared/definition5.js +1 -1
  63. package/shared/definition6.js +1 -1
  64. package/shared/definition7.js +1 -1
  65. package/shared/definition8.js +1 -1
  66. package/shared/definition9.js +1 -1
  67. package/shared/form-elements.js +3 -225
  68. package/shared/listbox.js +1002 -0
  69. package/shared/patterns/form-elements/form-elements.d.ts +2 -2
  70. package/shared/text-field.js +3 -0
  71. package/shared/text-field2.js +225 -0
  72. package/side-drawer/index.js +1 -1
  73. package/slider/index.js +1 -1
  74. package/styles/core/all.css +1 -1
  75. package/styles/core/theme.css +1 -1
  76. package/styles/core/typography.css +1 -1
  77. package/styles/tokens/theme-dark.css +4 -4
  78. package/styles/tokens/theme-light.css +4 -4
  79. package/switch/index.js +1 -1
  80. package/text-area/index.js +2 -1
  81. package/text-field/index.js +3 -1
  82. package/tooltip/index.js +2 -2
  83. package/vivid.api.json +123 -0
@@ -1,261 +1,58 @@
1
- import { F as FoundationElement, V as Observable, _ as __decorate, N as observable, a as attr, b as __metadata, h as html, r as registerFactory } from './index.js';
2
- import { i as iconRegistries } from './definition3.js';
3
- import { f as focusRegistries } from './definition4.js';
4
- import { A as AffixIconWithTrailing, a as affixIconTemplateFactory } from './affix.js';
5
- import { A as ARIAGlobalStatesAndProperties } from './aria-global.js';
6
- import { S as StartEnd } from './start-end.js';
7
- import { a as applyMixins } from './apply-mixins.js';
8
- import { i as isHTMLElement } from './dom.js';
9
- import { f as focusTemplateFactory } from './focus2.js';
10
- import './icon.js';
11
- import { w as when } from './when.js';
1
+ import { F as FoundationElement, _ as __decorate, a as attr, b as __metadata, h as html, r as registerFactory } from './index.js';
2
+ import { E as Elevation, e as elevationRegistries } from './definition15.js';
12
3
  import { c as classNames } from './class-names.js';
13
4
 
14
- /**
15
- * Determines if the element is a {@link (ListboxOption:class)}
16
- *
17
- * @param element - the element to test.
18
- * @public
19
- */
20
- function isListboxOption(el) {
21
- return (isHTMLElement(el) &&
22
- (el.getAttribute("role") === "option" ||
23
- el instanceof HTMLOptionElement));
24
- }
25
- /**
26
- * An Option Custom HTML Element.
27
- * Implements {@link https://www.w3.org/TR/wai-aria-1.1/#option | ARIA option }.
28
- *
29
- * @slot start - Content which can be provided before the listbox option content
30
- * @slot end - Content which can be provided after the listbox option content
31
- * @slot - The default slot for listbox option content
32
- * @csspart content - Wraps the listbox option content
33
- *
34
- * @public
35
- */
36
- class ListboxOption$1 extends FoundationElement {
37
- constructor(text, value, defaultSelected, selected) {
38
- super();
39
- /**
40
- * The defaultSelected state of the option.
41
- * @public
42
- */
43
- this.defaultSelected = false;
44
- /**
45
- * Tracks whether the "selected" property has been changed.
46
- * @internal
47
- */
48
- this.dirtySelected = false;
49
- /**
50
- * The checked state of the control.
51
- *
52
- * @public
53
- */
54
- this.selected = this.defaultSelected;
55
- /**
56
- * Track whether the value has been changed from the initial value
57
- */
58
- this.dirtyValue = false;
59
- if (text) {
60
- this.textContent = text;
61
- }
62
- if (value) {
63
- this.initialValue = value;
64
- }
65
- if (defaultSelected) {
66
- this.defaultSelected = defaultSelected;
67
- }
68
- if (selected) {
69
- this.selected = selected;
70
- }
71
- this.proxy = new Option(`${this.textContent}`, this.initialValue, this.defaultSelected, this.selected);
72
- this.proxy.disabled = this.disabled;
73
- }
74
- /**
75
- * Updates the ariaChecked property when the checked property changes.
76
- *
77
- * @param prev - the previous checked value
78
- * @param next - the current checked value
79
- *
80
- * @public
81
- */
82
- checkedChanged(prev, next) {
83
- if (typeof next === "boolean") {
84
- this.ariaChecked = next ? "true" : "false";
85
- return;
86
- }
87
- this.ariaChecked = null;
88
- }
89
- /**
90
- * Updates the proxy's text content when the default slot changes.
91
- * @param prev - the previous content value
92
- * @param next - the current content value
93
- *
94
- * @internal
95
- */
96
- contentChanged(prev, next) {
97
- if (this.proxy instanceof HTMLOptionElement) {
98
- this.proxy.textContent = this.textContent;
99
- }
100
- this.$emit("contentchange", null, { bubbles: true });
101
- }
102
- defaultSelectedChanged() {
103
- if (!this.dirtySelected) {
104
- this.selected = this.defaultSelected;
105
- if (this.proxy instanceof HTMLOptionElement) {
106
- this.proxy.selected = this.defaultSelected;
107
- }
108
- }
109
- }
110
- disabledChanged(prev, next) {
111
- this.ariaDisabled = this.disabled ? "true" : "false";
112
- if (this.proxy instanceof HTMLOptionElement) {
113
- this.proxy.disabled = this.disabled;
114
- }
115
- }
116
- selectedAttributeChanged() {
117
- this.defaultSelected = this.selectedAttribute;
118
- if (this.proxy instanceof HTMLOptionElement) {
119
- this.proxy.defaultSelected = this.defaultSelected;
120
- }
121
- }
122
- selectedChanged() {
123
- this.ariaSelected = this.selected ? "true" : "false";
124
- if (!this.dirtySelected) {
125
- this.dirtySelected = true;
126
- }
127
- if (this.proxy instanceof HTMLOptionElement) {
128
- this.proxy.selected = this.selected;
129
- }
130
- }
131
- initialValueChanged(previous, next) {
132
- // If the value is clean and the component is connected to the DOM
133
- // then set value equal to the attribute value.
134
- if (!this.dirtyValue) {
135
- this.value = this.initialValue;
136
- this.dirtyValue = false;
137
- }
138
- }
139
- get label() {
140
- var _a;
141
- return (_a = this.value) !== null && _a !== void 0 ? _a : this.text;
142
- }
143
- get text() {
144
- var _a, _b;
145
- return (_b = (_a = this.textContent) === null || _a === void 0 ? void 0 : _a.replace(/\s+/g, " ").trim()) !== null && _b !== void 0 ? _b : "";
146
- }
147
- set value(next) {
148
- const newValue = `${next !== null && next !== void 0 ? next : ""}`;
149
- this._value = newValue;
150
- this.dirtyValue = true;
151
- if (this.proxy instanceof HTMLOptionElement) {
152
- this.proxy.value = newValue;
153
- }
154
- Observable.notify(this, "value");
155
- }
156
- get value() {
157
- var _a;
158
- Observable.track(this, "value");
159
- return (_a = this._value) !== null && _a !== void 0 ? _a : this.text;
160
- }
161
- get form() {
162
- return this.proxy ? this.proxy.form : null;
163
- }
164
- }
165
- __decorate([
166
- observable
167
- ], ListboxOption$1.prototype, "checked", void 0);
168
- __decorate([
169
- observable
170
- ], ListboxOption$1.prototype, "content", void 0);
171
- __decorate([
172
- observable
173
- ], ListboxOption$1.prototype, "defaultSelected", void 0);
174
- __decorate([
175
- attr({ mode: "boolean" })
176
- ], ListboxOption$1.prototype, "disabled", void 0);
177
- __decorate([
178
- attr({ attribute: "selected", mode: "boolean" })
179
- ], ListboxOption$1.prototype, "selectedAttribute", void 0);
180
- __decorate([
181
- observable
182
- ], ListboxOption$1.prototype, "selected", void 0);
183
- __decorate([
184
- attr({ attribute: "value", mode: "fromView" })
185
- ], ListboxOption$1.prototype, "initialValue", void 0);
186
- /**
187
- * States and properties relating to the ARIA `option` role.
188
- *
189
- * @public
190
- */
191
- class DelegatesARIAListboxOption {
192
- }
193
- __decorate([
194
- observable
195
- ], DelegatesARIAListboxOption.prototype, "ariaChecked", void 0);
196
- __decorate([
197
- observable
198
- ], DelegatesARIAListboxOption.prototype, "ariaPosInSet", void 0);
199
- __decorate([
200
- observable
201
- ], DelegatesARIAListboxOption.prototype, "ariaSelected", void 0);
202
- __decorate([
203
- observable
204
- ], DelegatesARIAListboxOption.prototype, "ariaSetSize", void 0);
205
- applyMixins(DelegatesARIAListboxOption, ARIAGlobalStatesAndProperties);
206
- applyMixins(ListboxOption$1, StartEnd, DelegatesARIAListboxOption);
5
+ var css_248z = "/**\n * Do not edit directly\n * Generated on Thu, 05 Jan 2023 11:33:10 GMT\n */\n.base {\n z-index: 1;\n block-size: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2))) + calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 16)));\n font: var(--vvd-typography-heading-4);\n inline-size: 100%;\n}\n.base .header-content {\n display: inline-flex;\n align-items: center;\n column-gap: 4px;\n}\n\n.container {\n display: flex;\n box-sizing: border-box;\n justify-content: space-between;\n block-size: inherit;\n color: var(--vvd-color-canvas-text);\n column-gap: 12px;\n padding-block: 8px;\n padding-inline: 16px;\n}\n.container[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\n.app-content {\n --vvd-header-block-size: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2))) + calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 16)));\n}";
207
6
 
208
- class ListboxOption extends ListboxOption$1 {
209
- set text(value) {
210
- this._text = value;
211
- }
212
- get text() {
213
- var _a;
214
- return (_a = this._text) !== null && _a !== void 0 ? _a : '';
7
+ class Header extends FoundationElement {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.elevationShadow = false;
11
+ this.alternate = false;
215
12
  }
216
13
  }
217
14
  __decorate([attr({
218
- attribute: 'text'
219
- }), __metadata("design:type", String)], ListboxOption.prototype, "_text", void 0);
220
- applyMixins(ListboxOption, AffixIconWithTrailing);
15
+ attribute: 'elevation-shadow',
16
+ mode: 'boolean'
17
+ }), __metadata("design:type", Object)], Header.prototype, "elevationShadow", void 0);
18
+ __decorate([attr({
19
+ mode: 'boolean'
20
+ }), __metadata("design:type", Object)], Header.prototype, "alternate", void 0);
221
21
 
222
22
  let _ = t => t,
223
- _t,
224
- _t2;
225
- const getClasses = ({
226
- icon,
227
- disabled,
228
- selected,
229
- checked
230
- }) => classNames('base', ['disabled', disabled], ['selected', Boolean(selected)], ['active', Boolean(checked)], ['icon', Boolean(icon)]);
231
- const ListboxOptionTemplate = context => {
232
- const affixIconTemplate = affixIconTemplateFactory(context);
233
- const focusTemplate = focusTemplateFactory(context);
23
+ _t;
24
+ const getPartAlternate = ({
25
+ alternate
26
+ }) => classNames(['vvd-theme-alternate', Boolean(alternate)]);
27
+ const headerTemplate = context => {
28
+ const elevationTag = context.tagFor(Elevation);
234
29
  return html(_t || (_t = _`
235
- <template
236
- aria-checked="${0}"
237
- aria-disabled="${0}"
238
- aria-posinset="${0}"
239
- aria-selected="${0}"
240
- aria-setsize="${0}"
241
- role="option">
242
- <div class="${0}">
243
- ${0}
244
- ${0}
245
- ${0}
246
- </div>
247
- </template>
248
- `), x => x.ariaChecked, x => x.ariaDisabled, x => x.ariaPosInSet, x => x.ariaSelected, x => x.ariaSetSize, getClasses, () => focusTemplate, x => affixIconTemplate(x.icon), when(x => x.text, html(_t2 || (_t2 = _`<div class="text">${0}</div>`), x => x.text)));
30
+ <${0} dp="4" ?no-shadow=${0}>
31
+ <header class="base" part="base">
32
+ <!-- a container is needed to distinguish the surface background color of the
33
+ element from its shadow when applying elevation with alternate -->
34
+ <div class="container" part="${0}">
35
+ <section class="header-content">
36
+ <slot></slot>
37
+ </section>
38
+ <section class="header-content">
39
+ <slot name="action-items"></slot>
40
+ </section>
41
+ </div>
42
+ </header>
43
+ </${0}>
44
+ <div class="app-content">
45
+ <slot name="app-content"></slot>
46
+ </div>
47
+ `), elevationTag, x => !x.elevationShadow, getPartAlternate, elevationTag);
249
48
  };
250
49
 
251
- var css_248z = "/**\n * Do not edit directly\n * Generated on Mon, 02 Jan 2023 10:04:45 GMT\n */\n.base {\n position: relative; /* this is needed for the focus */\n display: flex;\n box-sizing: border-box;\n align-items: center;\n background-color: var(--_appearance-color-fill);\n border-radius: 6px;\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n color: var(--_option-appearance-color-text, var(--_appearance-color-text));\n font: var(--vvd-typography-base);\n gap: 12px;\n hyphens: auto;\n inline-size: 100%;\n min-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)));\n padding-block: 10px;\n padding-inline: 16px;\n vertical-align: middle;\n word-break: break-word;\n}\n.base {\n --_connotation-color-primary: var(--vvd-color-canvas-text);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-primary-increment: var(--vvd-color-neutral-800);\n --_connotation-color-faint: var(--vvd-color-neutral-50);\n --_connotation-color-soft: var(--vvd-color-neutral-100);\n}\n.base {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-faint);\n --_appearance-color-outline: transparent;\n}\n.base:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-400);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base:where(:active, .active):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-soft);\n --_appearance-color-outline: transparent;\n}\n.base:where(.selected, [aria-current]):where(:not(:disabled, .disabled, :hover, .hover)) {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary);\n --_appearance-color-outline: transparent;\n}\n.base:where(.selected, [aria-current]):where(:hover, .hover) {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary-increment);\n --_appearance-color-outline: transparent;\n}\n@supports (user-select: none) {\n .base {\n user-select: none;\n }\n}\n.base:not(.disabled) {\n cursor: pointer;\n}\n.base.disabled {\n cursor: not-allowed;\n}\n.base .text {\n font: var(--vvd-typography-base);\n}\n\n.icon {\n font-size: 20px;\n}\n.base:not(.disabled, .selected) .icon {\n color: var(--vvd-color-neutral-600);\n}\n\n.focus-indicator {\n --focus-stroke-color: var(--vvd-color-neutral-500);\n --focus-stroke-gap-color: transparent;\n}\n:host(:not([aria-checked=true])) .focus-indicator {\n display: none;\n}";
252
-
253
- const listboxOptionDefinition = ListboxOption.compose({
254
- baseName: 'option',
255
- template: ListboxOptionTemplate,
50
+ const headerDefinition = Header.compose({
51
+ baseName: 'header',
52
+ template: headerTemplate,
256
53
  styles: css_248z
257
54
  });
258
- const listboxOptionRegistries = [listboxOptionDefinition(), ...iconRegistries, ...focusRegistries];
259
- const registerOption = registerFactory(listboxOptionRegistries);
55
+ const headerRegistries = [headerDefinition(), ...elevationRegistries];
56
+ const registerHeader = registerFactory(headerRegistries);
260
57
 
261
- export { listboxOptionDefinition as a, isListboxOption as i, listboxOptionRegistries as l, registerOption as r };
58
+ export { headerRegistries as a, headerDefinition as h, registerHeader as r };