@vonage/vivid 3.30.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 (135) 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 +811 -18
  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/nav-disclosure/nav-disclosure.d.ts +1 -0
  28. package/lib/pagination/definition.d.ts +1 -0
  29. package/lib/pagination/pagination.d.ts +3 -1
  30. package/lib/select/select.d.ts +4 -2
  31. package/listbox/index.js +3 -2
  32. package/locales/en-GB.d.ts +3 -0
  33. package/locales/en-GB.js +25 -0
  34. package/locales/en-US.d.ts +3 -0
  35. package/locales/en-US.js +25 -0
  36. package/locales/ja-JP.d.ts +3 -0
  37. package/locales/ja-JP.js +25 -0
  38. package/locales/zh-CN.d.ts +3 -0
  39. package/locales/zh-CN.js +25 -0
  40. package/menu/index.js +2 -2
  41. package/menu-item/index.js +1 -1
  42. package/nav/index.js +1 -1
  43. package/nav-disclosure/index.js +1 -1
  44. package/nav-item/index.js +1 -1
  45. package/note/index.js +3 -2
  46. package/number-field/index.js +4 -3
  47. package/option/index.js +2 -1
  48. package/package.json +2 -1
  49. package/pagination/index.js +1 -1
  50. package/progress/index.js +1 -1
  51. package/radio/index.js +1 -1
  52. package/radio-group/index.js +1 -1
  53. package/select/index.js +3 -2
  54. package/shared/definition.js +1 -1
  55. package/shared/definition10.js +1 -1
  56. package/shared/definition11.js +1 -1
  57. package/shared/definition12.js +1 -1
  58. package/shared/definition14.js +1 -1
  59. package/shared/definition15.js +1 -1
  60. package/shared/definition16.js +1 -1
  61. package/shared/definition17.js +1 -1
  62. package/shared/definition18.js +2 -2
  63. package/shared/definition19.js +2 -2
  64. package/shared/definition2.js +1 -1
  65. package/shared/definition21.js +3 -3
  66. package/shared/definition22.js +2 -2
  67. package/shared/definition23.js +5750 -189
  68. package/shared/definition24.js +116 -68
  69. package/shared/definition25.js +68 -38
  70. package/shared/definition26.js +222 -74
  71. package/shared/definition27.js +33 -2282
  72. package/shared/definition28.js +76 -47
  73. package/shared/definition29.js +2287 -38
  74. package/shared/definition30.js +39 -417
  75. package/shared/definition31.js +38 -364
  76. package/shared/definition32.js +427 -12
  77. package/shared/definition33.js +351 -53
  78. package/shared/definition34.js +12 -26
  79. package/shared/definition35.js +67 -31
  80. package/shared/definition36.js +20 -431
  81. package/shared/definition37.js +34 -181
  82. package/shared/definition38.js +427 -45
  83. package/shared/definition39.js +195 -33
  84. package/shared/definition4.js +1 -1
  85. package/shared/definition40.js +53 -425
  86. package/shared/definition41.js +29 -645
  87. package/shared/definition42.js +420 -73
  88. package/shared/definition43.js +549 -444
  89. package/shared/definition44.js +68 -90
  90. package/shared/definition45.js +501 -79
  91. package/shared/definition46.js +84 -45
  92. package/shared/definition47.js +131 -17
  93. package/shared/definition48.js +44 -471
  94. package/shared/definition49.js +21 -108
  95. package/shared/definition5.js +1 -1
  96. package/shared/definition50.js +487 -15
  97. package/shared/definition51.js +92 -255
  98. package/shared/definition52.js +16 -115
  99. package/shared/definition53.js +264 -115
  100. package/shared/definition54.js +91 -82
  101. package/shared/definition55.js +111 -65
  102. package/shared/definition56.js +64 -291
  103. package/shared/definition57.js +303 -0
  104. package/shared/definition6.js +2 -2
  105. package/shared/definition7.js +10 -3
  106. package/shared/definition9.js +1 -1
  107. package/shared/{form-elements.js → index2.js} +14 -2
  108. package/shared/localization/Locale.d.ts +4 -0
  109. package/shared/localization/index.d.ts +7 -0
  110. package/shared/patterns/form-elements/form-elements.d.ts +4 -4
  111. package/shared/patterns/index.d.ts +1 -0
  112. package/shared/patterns/localized.d.ts +4 -0
  113. package/shared/text-field.js +1 -1
  114. package/side-drawer/index.js +1 -1
  115. package/slider/index.js +1 -1
  116. package/split-button/index.js +1 -1
  117. package/styles/core/all.css +25 -3
  118. package/styles/core/theme.css +1 -1
  119. package/styles/core/typography.css +25 -3
  120. package/styles/tokens/theme-dark.css +4 -4
  121. package/styles/tokens/theme-light.css +4 -4
  122. package/styles/tokens/vivid-2-compat.css +14 -0
  123. package/switch/index.js +3 -2
  124. package/tab/index.js +1 -1
  125. package/tab-panel/index.js +1 -1
  126. package/tabs/index.js +3 -3
  127. package/tag/index.js +1 -1
  128. package/tag-group/index.js +1 -1
  129. package/text-area/index.js +3 -2
  130. package/text-field/index.js +3 -2
  131. package/toggletip/index.js +1 -1
  132. package/tooltip/index.js +1 -1
  133. package/tree-item/index.js +1 -1
  134. package/tree-view/index.js +1 -1
  135. package/vivid.api.json +262 -0
@@ -1,192 +1,45 @@
1
- import { a as Size, 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 Mon, 14 Aug 2023 13:17:40 GMT\n */\n.control {\n display: inline-flex;\n justify-content: space-between;\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([observable, __metadata("design:type", Array)], Pagination.prototype, "paginationButtons", void 0);
82
- __decorate([observable, __metadata("design:type", Function)], Pagination.prototype, "prevButton", void 0);
83
- __decorate([observable, __metadata("design:type", Function)], Pagination.prototype, "nextButton", void 0);
84
- __decorate([attr({
85
- attribute: 'nav-icons',
86
- mode: 'boolean'
87
- }), __metadata("design:type", Object)], Pagination.prototype, "navIcons", void 0);
88
- __decorate([volatile, __metadata("design:type", Object), __metadata("design:paramtypes", [])], Pagination.prototype, "pagesList", null);
89
- __decorate([attr({
90
- mode: 'reflect',
91
- converter: totalConverter
92
- }), __metadata("design:type", Number)], Pagination.prototype, "total", void 0);
93
- __decorate([attr({
94
- mode: 'reflect',
95
- converter: totalConverter,
96
- attribute: 'selected-index'
97
- }), __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);
98
17
 
99
- const ALLOWED_SIZES = [Size.SuperCondensed, Size.Condensed, Size.Normal];
100
- const handleSelection = (value, {
101
- parent: x
102
- }) => {
103
- return x.selectedIndex = Number(value) - 1;
104
- };
105
- const handleKeyDown = (value, {
106
- event,
107
- parent
108
- }) => {
109
- if (event.key === ' ' || event.key === 'Enter') {
110
- handleSelection(value, {
111
- parent
112
- });
113
- }
114
- if (event.key === 'Tab') {
115
- event.target.dispatchEvent(new CustomEvent('tabpressed', {
116
- detail: {
117
- value,
118
- shiftKey: event.shiftKey
119
- },
120
- bubbles: true,
121
- composed: true
122
- }));
123
- }
124
- };
125
- const getClasses = _ => classNames('control');
126
- function getButtonAppearance(value, {
127
- parent
128
- }) {
129
- 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>`;
130
23
  }
131
- const paginationButtonRenderer = buttonTag => html`
132
- ${when(value => value !== '...', html`
133
- <${buttonTag} class="vwc-pagination-button"
134
- label="${value => value}"
135
- appearance="${getButtonAppearance}"
136
- size="${(_, {
137
- parent: x
138
- }) => getPaginationSize(x)}"
139
- tabindex="0"
140
- aria-pressed="${(value, {
141
- parent
142
- }) => parent.selectedIndex === Number(value) - 1}"
143
- @click="${handleSelection}"
144
- @keydown="${handleKeyDown}"
145
- </${buttonTag}>
146
- `)}
147
- ${when(value => value === '...', html`<div class="dots size-${getPaginationSize}">...</div>`)}`;
148
- const getPaginationSize = x => {
149
- if (!x.size || !ALLOWED_SIZES.includes(x.size)) {
150
- return Size.SuperCondensed;
151
- }
152
- return x.size;
153
- };
154
- const PaginationTemplate = context => {
155
- const buttonTag = context.tagFor(Button);
156
- const paginationButtonTemplate = paginationButtonRenderer(buttonTag);
24
+ const NoteTemplate = context => {
25
+ const iconTag = context.tagFor(Icon);
157
26
  return html`
158
- <div class="${getClasses}">
159
- <${buttonTag} class="prev-button" ${ref('prevButton')}
160
- label="${x => !x.navIcons ? 'Previous' : null}"
161
- icon="${x => x.navIcons ? 'chevron-left-line' : null}"
162
- size="${getPaginationSize}"
163
- ?disabled="${x => x.total === 0 || x.selectedIndex === 0}"
164
- @click="${x => x.selectedIndex !== undefined && x.selectedIndex--}"
165
- ></${buttonTag}>
166
- <div id="buttons-wrapper" class="buttons-wrapper" ${children({
167
- property: 'paginationButtons',
168
- filter: elements(buttonTag)
169
- })}>
170
- ${repeat(x => x.pagesList, paginationButtonTemplate, {
171
- positioning: true
172
- })}
173
- </div>
174
- <${buttonTag} class="next-button" ${ref('nextButton')}
175
- label="${x => !x.navIcons ? 'Next' : null}"
176
- icon="${x => x.navIcons ? 'chevron-right-line' : null}"
177
- size="${getPaginationSize}"
178
- ?disabled="${x => x.total === 0 || x.selectedIndex === x.total - 1}"
179
- @click="${x => x.selectedIndex !== undefined && x.selectedIndex++}"
180
- ></${buttonTag}>
181
- </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
+ `;
182
35
  };
183
36
 
184
- const paginationDefinition = Pagination.compose({
185
- baseName: 'pagination',
186
- template: PaginationTemplate,
37
+ const noteDefinition = Note.compose({
38
+ baseName: 'note',
39
+ template: NoteTemplate,
187
40
  styles: css_248z
188
41
  });
189
- const paginationRegistries = [paginationDefinition(), buttonRegistries];
190
- const registerPagination = registerFactory(paginationRegistries);
42
+ const noteRegistries = [noteDefinition(), ...iconRegistries];
43
+ const registerNote = registerFactory(noteRegistries);
191
44
 
192
- export { paginationRegistries as a, paginationDefinition as p, registerPagination as r };
45
+ export { noteRegistries as a, noteDefinition as n, registerNote as r };