@vonage/vivid 3.31.0 → 3.32.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 (132) hide show
  1. package/alert/index.js +2 -1
  2. package/checkbox/index.js +2 -1
  3. package/combobox/index.js +2 -1
  4. package/custom-elements.json +748 -11
  5. package/date-picker/index.js +35 -0
  6. package/dialog/index.js +1 -1
  7. package/divider/index.js +1 -1
  8. package/empty-state/index.js +1 -1
  9. package/fab/index.js +1 -1
  10. package/file-picker/index.js +3 -2
  11. package/header/index.js +1 -1
  12. package/index.d.ts +1 -0
  13. package/index.js +48 -46
  14. package/layout/index.js +1 -1
  15. package/lib/button/button.d.ts +2 -0
  16. package/lib/components.d.ts +20 -19
  17. package/lib/date-picker/calendar/calendarGrid.d.ts +17 -0
  18. package/lib/date-picker/calendar/dateStr.d.ts +6 -0
  19. package/lib/date-picker/calendar/month.d.ts +11 -0
  20. package/lib/date-picker/calendar/monthPickerGrid.d.ts +10 -0
  21. package/lib/date-picker/calendar/presentationDate.d.ts +4 -0
  22. package/lib/date-picker/date-picker.d.ts +16 -0
  23. package/lib/date-picker/date-picker.template.d.ts +4 -0
  24. package/lib/date-picker/definition.d.ts +3 -0
  25. package/lib/date-picker/index.d.ts +1 -0
  26. package/lib/date-picker/locale.d.ts +21 -0
  27. package/lib/select/select.d.ts +4 -2
  28. package/listbox/index.js +3 -2
  29. package/locales/en-GB.d.ts +3 -0
  30. package/locales/en-GB.js +25 -0
  31. package/locales/en-US.d.ts +3 -0
  32. package/locales/en-US.js +25 -0
  33. package/locales/ja-JP.d.ts +3 -0
  34. package/locales/ja-JP.js +25 -0
  35. package/locales/zh-CN.d.ts +3 -0
  36. package/locales/zh-CN.js +25 -0
  37. package/menu/index.js +2 -2
  38. package/menu-item/index.js +1 -1
  39. package/nav/index.js +1 -1
  40. package/nav-disclosure/index.js +1 -1
  41. package/nav-item/index.js +1 -1
  42. package/note/index.js +3 -2
  43. package/number-field/index.js +4 -3
  44. package/option/index.js +2 -1
  45. package/package.json +2 -1
  46. package/pagination/index.js +1 -1
  47. package/progress/index.js +1 -1
  48. package/radio/index.js +1 -1
  49. package/radio-group/index.js +1 -1
  50. package/select/index.js +3 -2
  51. package/shared/definition.js +1 -1
  52. package/shared/definition10.js +1 -1
  53. package/shared/definition11.js +1 -1
  54. package/shared/definition12.js +1 -1
  55. package/shared/definition14.js +1 -1
  56. package/shared/definition15.js +1 -1
  57. package/shared/definition16.js +1 -1
  58. package/shared/definition17.js +1 -1
  59. package/shared/definition18.js +2 -2
  60. package/shared/definition19.js +2 -2
  61. package/shared/definition2.js +1 -1
  62. package/shared/definition21.js +3 -3
  63. package/shared/definition22.js +2 -2
  64. package/shared/definition23.js +5750 -189
  65. package/shared/definition24.js +116 -68
  66. package/shared/definition25.js +68 -38
  67. package/shared/definition26.js +222 -74
  68. package/shared/definition27.js +33 -2282
  69. package/shared/definition28.js +76 -47
  70. package/shared/definition29.js +2287 -38
  71. package/shared/definition30.js +39 -417
  72. package/shared/definition31.js +38 -364
  73. package/shared/definition32.js +427 -12
  74. package/shared/definition33.js +350 -59
  75. package/shared/definition34.js +12 -26
  76. package/shared/definition35.js +67 -31
  77. package/shared/definition36.js +20 -431
  78. package/shared/definition37.js +34 -194
  79. package/shared/definition38.js +427 -45
  80. package/shared/definition39.js +195 -33
  81. package/shared/definition4.js +1 -1
  82. package/shared/definition40.js +53 -425
  83. package/shared/definition41.js +29 -645
  84. package/shared/definition42.js +420 -73
  85. package/shared/definition43.js +549 -444
  86. package/shared/definition44.js +68 -90
  87. package/shared/definition45.js +501 -79
  88. package/shared/definition46.js +84 -45
  89. package/shared/definition47.js +131 -17
  90. package/shared/definition48.js +44 -471
  91. package/shared/definition49.js +21 -108
  92. package/shared/definition5.js +1 -1
  93. package/shared/definition50.js +487 -15
  94. package/shared/definition51.js +92 -255
  95. package/shared/definition52.js +16 -115
  96. package/shared/definition53.js +264 -115
  97. package/shared/definition54.js +91 -82
  98. package/shared/definition55.js +111 -65
  99. package/shared/definition56.js +64 -291
  100. package/shared/definition57.js +303 -0
  101. package/shared/definition6.js +2 -2
  102. package/shared/definition7.js +10 -3
  103. package/shared/definition9.js +1 -1
  104. package/shared/{form-elements.js → index2.js} +14 -2
  105. package/shared/localization/Locale.d.ts +4 -0
  106. package/shared/localization/index.d.ts +7 -0
  107. package/shared/patterns/form-elements/form-elements.d.ts +4 -4
  108. package/shared/patterns/index.d.ts +1 -0
  109. package/shared/patterns/localized.d.ts +4 -0
  110. package/shared/text-field.js +1 -1
  111. package/side-drawer/index.js +1 -1
  112. package/slider/index.js +1 -1
  113. package/split-button/index.js +1 -1
  114. package/styles/core/all.css +25 -3
  115. package/styles/core/theme.css +1 -1
  116. package/styles/core/typography.css +25 -3
  117. package/styles/tokens/theme-dark.css +4 -4
  118. package/styles/tokens/theme-light.css +4 -4
  119. package/styles/tokens/vivid-2-compat.css +2 -2
  120. package/switch/index.js +3 -2
  121. package/tab/index.js +1 -1
  122. package/tab-panel/index.js +1 -1
  123. package/tabs/index.js +3 -3
  124. package/tag/index.js +1 -1
  125. package/tag-group/index.js +1 -1
  126. package/text-area/index.js +3 -2
  127. package/text-field/index.js +3 -2
  128. package/toggletip/index.js +1 -1
  129. package/tooltip/index.js +1 -1
  130. package/tree-item/index.js +1 -1
  131. package/tree-view/index.js +1 -1
  132. package/vivid.api.json +137 -0
@@ -1,205 +1,45 @@
1
- import { a as Size, S as Shape, B as Button, b as buttonRegistries } from './definition7.js';
2
- import { F as FoundationElement, _ as __decorate, a as attr, b as __metadata, o as observable, v as volatile, h as html, r as registerFactory } from './index.js';
3
- import { e as elements } from './node-observation.js';
4
- import { r as ref } from './ref.js';
5
- import { c as children } from './children.js';
6
- import { r as repeat } from './repeat.js';
7
- import { c as classNames } from './class-names.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 { i as iconRegistries } from './definition3.js';
3
+ import { b as AffixIcon } from './affix.js';
4
+ import './focus.js';
5
+ import './index2.js';
6
+ import { a as applyMixins } from './apply-mixins.js';
7
+ import { I as Icon } from './icon.js';
8
8
  import { w as when } from './when.js';
9
+ import { c as classNames } from './class-names.js';
9
10
 
10
- var css_248z = "/**\n * Do not edit directly\n * Generated on Thu, 17 Aug 2023 11:13:18 GMT\n */\n.control {\n display: inline-flex;\n justify-content: space-between;\n}\n.control:not(.shape-pill) {\n border-radius: 4px;\n}\n.control.shape-pill {\n border-radius: 14px;\n}\n\n.buttons-wrapper {\n display: flex;\n column-gap: 4px;\n}\n\n.dots {\n align-self: center;\n text-align: center;\n}\n.dots:not(.size-super-condensed) {\n font: var(--vvd-typography-base-bold);\n}\n.dots.size-super-condensed {\n font: var(--vvd-typography-base-condensed-bold);\n inline-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 16));\n}\n.dots.size-condensed {\n inline-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 8));\n}\n.dots.size-normal {\n inline-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)));\n}";
11
+ var css_248z = "/**\n * Do not edit directly\n * Generated on Tue, 22 Aug 2023 13:37:39 GMT\n */\n.base {\n display: flex;\n align-items: flex-start;\n padding: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20));\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(--_appearance-color-text);\n column-gap: 16px;\n}\n.base.connotation-success {\n /* @cssprop [--vvd-note-success-primary=var(--vvd-color-success-500)] */\n --_connotation-color-primary: var(--vvd-note-success-primary, var(--vvd-color-success-500));\n /* @cssprop [--vvd-note-success-intermediate=var(--vvd-color-success-500)] */\n --_connotation-color-intermediate: var(--vvd-note-success-intermediate, var(--vvd-color-success-500));\n /* @cssprop [--vvd-note-success-backdrop=var(--vvd-color-success-50)] */\n --_connotation-color-backdrop: var(--vvd-note-success-backdrop, var(--vvd-color-success-50));\n}\n.base.connotation-information {\n /* @cssprop [--vvd-note-information-primary=var(--vvd-color-information-500)] */\n --_connotation-color-primary: var(--vvd-note-information-primary, var(--vvd-color-information-500));\n /* @cssprop [--vvd-note-information-intermediate=var(--vvd-color-information-500)] */\n --_connotation-color-intermediate: var(--vvd-note-information-intermediate, var(--vvd-color-information-500));\n /* @cssprop [--vvd-note-information-backdrop=var(--vvd-color-information-50)] */\n --_connotation-color-backdrop: var(--vvd-note-information-backdrop, var(--vvd-color-information-50));\n}\n.base.connotation-alert {\n /* @cssprop [--vvd-note-alert-primary=var(--vvd-color-alert-500)] */\n --_connotation-color-primary: var(--vvd-note-alert-primary, var(--vvd-color-alert-500));\n /* @cssprop [--vvd-note-alert-intermediate=var(--vvd-color-alert-500)] */\n --_connotation-color-intermediate: var(--vvd-note-alert-intermediate, var(--vvd-color-alert-500));\n /* @cssprop [--vvd-note-alert-backdrop=var(--vvd-color-alert-50)] */\n --_connotation-color-backdrop: var(--vvd-note-alert-backdrop, var(--vvd-color-alert-50));\n}\n.base.connotation-warning {\n /* @cssprop [--vvd-note-warning-primary=var(--vvd-color-warning-300)] */\n --_connotation-color-primary: var(--vvd-note-warning-primary, var(--vvd-color-warning-300));\n /* @cssprop [--vvd-note-warning-intermediate=var(--vvd-color-warning-300)] */\n --_connotation-color-intermediate: var(--vvd-note-warning-intermediate, var(--vvd-color-warning-300));\n /* @cssprop [--vvd-note-warning-backdrop=var(--vvd-color-warning-50)] */\n --_connotation-color-backdrop: var(--vvd-note-warning-backdrop, var(--vvd-color-warning-50));\n}\n.base:not(.connotation-success, .connotation-information, .connotation-alert, .connotation-warning) {\n /* @cssprop [--vvd-note-accent-primary=var(--vvd-color-canvas-text)] */\n --_connotation-color-primary: var(--vvd-note-accent-primary, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-note-accent-intermediate=var(--vvd-color-neutral-500)] */\n --_connotation-color-intermediate: var(--vvd-note-accent-intermediate, var(--vvd-color-neutral-500));\n /* @cssprop [--vvd-note-accent-backdrop=var(--vvd-color-canvas)] */\n --_connotation-color-backdrop: var(--vvd-note-accent-backdrop, var(--vvd-color-canvas));\n}\n.base {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--_connotation-color-backdrop);\n --_appearance-color-outline: var(--_connotation-color-intermediate);\n}\n@supports (contain: content) {\n .base {\n contain: content;\n }\n}\n@supports not (contain: content) {\n .base {\n overflow: hidden;\n }\n}\n\n.icon {\n color: var(--_appearance-color-outline);\n font-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 16));\n}\n\n.text {\n display: flex;\n min-height: 24px;\n flex-direction: column;\n flex-grow: 1;\n align-items: flex-start;\n justify-content: center;\n gap: 4px;\n text-align: start;\n}\n.text .headline {\n font: var(--vvd-typography-base-bold);\n}\n.text .message {\n font: var(--vvd-typography-base);\n}";
11
12
 
12
- const MAX_DIGITS_AND_PLACEHOLDERS = 7;
13
- const totalConverter = {
14
- fromView: value => parseInt(value, 10),
15
- toView: value => value.toString()
16
- };
17
- class Pagination extends FoundationElement {
18
- get pagesList() {
19
- return new Array(this.total < MAX_DIGITS_AND_PLACEHOLDERS ? this.total : MAX_DIGITS_AND_PLACEHOLDERS).fill(0).map((_, i, arr) => {
20
- if (i === 0) return 1;
21
- if (i === arr.length - 1) return this.total;
22
- if (this.selectedIndex !== undefined && this.total > MAX_DIGITS_AND_PLACEHOLDERS) {
23
- if (this.selectedIndex < 4) {
24
- if (i === MAX_DIGITS_AND_PLACEHOLDERS - 2) return '...';
25
- }
26
- if (this.selectedIndex >= 4 && this.selectedIndex <= this.total - 5) {
27
- if (i > 1 && i < MAX_DIGITS_AND_PLACEHOLDERS - 2) return this.selectedIndex + (i - 2);
28
- if (i === 1 || i === MAX_DIGITS_AND_PLACEHOLDERS - 2) return '...';
29
- }
30
- if (this.selectedIndex > this.total - 5) {
31
- if (i > 1) return this.total - (6 - i);
32
- if (i === 1) return '...';
33
- }
34
- }
35
- return i + 1;
36
- });
37
- }
38
- constructor() {
39
- super();
40
- this.navIcons = false;
41
- this.total = 0;
42
- this.selectedIndex = 0;
43
- this.addEventListener('tabpressed', e => {
44
- const {
45
- value: currentLabel,
46
- shiftKey
47
- } = e.detail;
48
- const index = this.paginationButtons.findIndex(button => Number(button.label) === currentLabel);
49
- const focusDirection = shiftKey ? -1 : 1;
50
- const newIndex = index + focusDirection;
51
- if (newIndex < 0) {
52
- return this.prevButton.focus();
53
- }
54
- if (newIndex > this.paginationButtons.length - 1) {
55
- return this.nextButton.focus();
56
- }
57
- this.paginationButtons && this.paginationButtons[index + focusDirection].focus();
58
- });
59
- }
60
- totalChanged(_, newValue) {
61
- if (newValue < 0) {
62
- this.total = 0;
63
- }
64
- this.selectedIndex = 0;
65
- }
66
- selectedIndexChanged(oldValue, newValue) {
67
- if (oldValue === undefined) return;
68
- this.$emit('pagination-change', {
69
- selectedIndex: newValue,
70
- total: this.total,
71
- oldIndex: oldValue
72
- });
73
- }
74
- paginationButtonsChanged(_, newValue) {
75
- newValue.forEach(button => {
76
- button.shadowRoot.querySelector('button').classList.add('icon-only');
77
- });
78
- }
79
- }
80
- __decorate([attr, __metadata("design:type", String)], Pagination.prototype, "size", void 0);
81
- __decorate([attr, __metadata("design:type", String)], Pagination.prototype, "shape", void 0);
82
- __decorate([observable, __metadata("design:type", Array)], Pagination.prototype, "paginationButtons", void 0);
83
- __decorate([observable, __metadata("design:type", Function)], Pagination.prototype, "prevButton", void 0);
84
- __decorate([observable, __metadata("design:type", Function)], Pagination.prototype, "nextButton", void 0);
85
- __decorate([attr({
86
- attribute: 'nav-icons',
87
- mode: 'boolean'
88
- }), __metadata("design:type", Object)], Pagination.prototype, "navIcons", void 0);
89
- __decorate([volatile, __metadata("design:type", Object), __metadata("design:paramtypes", [])], Pagination.prototype, "pagesList", null);
90
- __decorate([attr({
91
- mode: 'reflect',
92
- converter: totalConverter
93
- }), __metadata("design:type", Number)], Pagination.prototype, "total", void 0);
94
- __decorate([attr({
95
- mode: 'reflect',
96
- converter: totalConverter,
97
- attribute: 'selected-index'
98
- }), __metadata("design:type", Object)], Pagination.prototype, "selectedIndex", void 0);
13
+ class Note extends FoundationElement {}
14
+ __decorate([attr, __metadata("design:type", String)], Note.prototype, "headline", void 0);
15
+ __decorate([attr, __metadata("design:type", String)], Note.prototype, "connotation", void 0);
16
+ applyMixins(Note, AffixIcon);
99
17
 
100
- const ALLOWED_SIZES = [Size.SuperCondensed, Size.Condensed, Size.Normal];
101
- const ALLOWED_SHAPES = [Shape.Rounded, Shape.Pill];
102
- const handleSelection = (value, {
103
- parent: x
104
- }) => {
105
- return x.selectedIndex = Number(value) - 1;
106
- };
107
- const handleKeyDown = (value, {
108
- event,
109
- parent
110
- }) => {
111
- if (event.key === ' ' || event.key === 'Enter') {
112
- handleSelection(value, {
113
- parent
114
- });
115
- }
116
- if (event.key === 'Tab') {
117
- event.target.dispatchEvent(new CustomEvent('tabpressed', {
118
- detail: {
119
- value,
120
- shiftKey: event.shiftKey
121
- },
122
- bubbles: true,
123
- composed: true
124
- }));
125
- }
126
- };
127
- const getClasses = _ => classNames('control');
128
- function getButtonAppearance(value, {
129
- parent
130
- }) {
131
- return parent.selectedIndex === Number(value) - 1 ? 'filled' : 'ghost';
18
+ const getClasses = ({
19
+ connotation
20
+ }) => classNames('base', `connotation-${connotation}`);
21
+ function getHeaderTemplate() {
22
+ return html`<div class="headline">${x => x.headline}</div>`;
132
23
  }
133
- const paginationButtonRenderer = buttonTag => html`
134
- ${when(value => value !== '...', html`
135
- <${buttonTag} class="vwc-pagination-button"
136
- label="${value => value}"
137
- appearance="${getButtonAppearance}"
138
- size="${(_, {
139
- parent: x
140
- }) => getPaginationSize(x)}"
141
- shape="${(_, {
142
- parent: x
143
- }) => getPaginationShape(x)}"
144
- tabindex="0"
145
- aria-pressed="${(value, {
146
- parent
147
- }) => parent.selectedIndex === Number(value) - 1}"
148
- @click="${handleSelection}"
149
- @keydown="${handleKeyDown}"
150
- </${buttonTag}>
151
- `)}
152
- ${when(value => value === '...', html`<div class="dots size-${getPaginationSize} shape-${getPaginationShape}">...</div>`)}`;
153
- const getPaginationSize = x => {
154
- if (!x.size || !ALLOWED_SIZES.includes(x.size)) {
155
- return Size.SuperCondensed;
156
- }
157
- return x.size;
158
- };
159
- const getPaginationShape = x => {
160
- if (!x.shape || !ALLOWED_SHAPES.includes(x.shape)) {
161
- return Shape.Rounded;
162
- }
163
- return x.shape;
164
- };
165
- const PaginationTemplate = context => {
166
- const buttonTag = context.tagFor(Button);
167
- const paginationButtonTemplate = paginationButtonRenderer(buttonTag);
24
+ const NoteTemplate = context => {
25
+ const iconTag = context.tagFor(Icon);
168
26
  return html`
169
- <div class="${getClasses}">
170
- <${buttonTag} class="prev-button" ${ref('prevButton')}
171
- label="${x => !x.navIcons ? 'Previous' : null}"
172
- icon="${x => x.navIcons ? 'chevron-left-line' : null}"
173
- size="${getPaginationSize}"
174
- shape="${getPaginationShape}"
175
- ?disabled="${x => x.total === 0 || x.selectedIndex === 0}"
176
- @click="${x => x.selectedIndex !== undefined && x.selectedIndex--}"
177
- ></${buttonTag}>
178
- <div id="buttons-wrapper" class="buttons-wrapper" ${children({
179
- property: 'paginationButtons',
180
- filter: elements(buttonTag)
181
- })}>
182
- ${repeat(x => x.pagesList, paginationButtonTemplate, {
183
- positioning: true
184
- })}
185
- </div>
186
- <${buttonTag} class="next-button" ${ref('nextButton')}
187
- label="${x => !x.navIcons ? 'Next' : null}"
188
- icon="${x => x.navIcons ? 'chevron-right-line' : null}"
189
- size="${getPaginationSize}"
190
- shape="${getPaginationShape}"
191
- ?disabled="${x => x.total === 0 || x.selectedIndex === x.total - 1}"
192
- @click="${x => x.selectedIndex !== undefined && x.selectedIndex++}"
193
- ></${buttonTag}>
194
- </div>`;
27
+ <div class="${getClasses}">
28
+ ${when(x => x.icon, html`<${iconTag} class="icon" name="${x => x.icon}"></${iconTag}>`)}
29
+ <div class="text">
30
+ ${when(x => x.headline, getHeaderTemplate())}
31
+ <slot class="message"></slot>
32
+ </div>
33
+ </div>
34
+ `;
195
35
  };
196
36
 
197
- const paginationDefinition = Pagination.compose({
198
- baseName: 'pagination',
199
- template: PaginationTemplate,
37
+ const noteDefinition = Note.compose({
38
+ baseName: 'note',
39
+ template: NoteTemplate,
200
40
  styles: css_248z
201
41
  });
202
- const paginationRegistries = [paginationDefinition(), buttonRegistries];
203
- const registerPagination = registerFactory(paginationRegistries);
42
+ const noteRegistries = [noteDefinition(), ...iconRegistries];
43
+ const registerNote = registerFactory(noteRegistries);
204
44
 
205
- export { paginationRegistries as a, paginationDefinition as p, registerPagination as r };
45
+ export { noteRegistries as a, noteDefinition as n, registerNote as r };