@vonage/vivid 3.40.0 → 3.42.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 (161) 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 +438 -41
  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 +2 -2
  46. package/lib/split-button/locale.d.ts +3 -0
  47. package/lib/split-button/split-button.d.ts +4 -2
  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 +167 -664
  77. package/shared/definition16.js +576 -1137
  78. package/shared/definition17.js +1278 -143
  79. package/shared/definition18.js +68 -306
  80. package/shared/definition19.js +359 -217
  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 +117 -78
  107. package/shared/definition43.js +74 -567
  108. package/shared/definition44.js +567 -98
  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 +502 -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/index.js +1 -1
  133. package/shared/index2.js +1 -1
  134. package/shared/listbox.js +1 -1
  135. package/shared/localization/Locale.d.ts +8 -0
  136. package/shared/patterns/form-elements/form-elements.d.ts +6 -6
  137. package/shared/presentationDate.js +10 -8
  138. package/shared/text-field.js +1 -1
  139. package/side-drawer/index.js +1 -1
  140. package/slider/index.js +3 -3
  141. package/split-button/index.js +6 -3
  142. package/style.css +329 -242
  143. package/styles/core/all.css +31 -25
  144. package/styles/core/theme.css +1 -1
  145. package/styles/core/typography.css +31 -25
  146. package/styles/tokens/theme-dark.css +4 -4
  147. package/styles/tokens/theme-light.css +4 -4
  148. package/styles/tokens/vivid-2-compat.css +1 -1
  149. package/switch/index.js +3 -3
  150. package/tab/index.js +3 -3
  151. package/tab-panel/index.js +1 -1
  152. package/tabs/index.js +5 -5
  153. package/tag/index.js +3 -3
  154. package/tag-group/index.js +1 -1
  155. package/text-area/index.js +3 -3
  156. package/text-field/index.js +3 -3
  157. package/toggletip/index.js +7 -7
  158. package/tooltip/index.js +7 -7
  159. package/tree-item/index.js +3 -3
  160. package/tree-view/index.js +1 -1
  161. package/vivid.api.json +270 -1
@@ -1,14 +1,209 @@
1
- import { B as Button, a as buttonRegistries } from './definition10.js';
2
- import { a as attr, F as FoundationElement, o as observable, v as volatile, h as html, r as registerFactory } from './index.js';
3
- import { b as Size, S as Shape } from './enums.js';
4
- import { e as elements } from './slotted.js';
5
- import { r as ref } from './ref.js';
6
- import { c as children } from './children.js';
7
- import { r as repeat } from './repeat.js';
8
- import { c as classNames } from './class-names.js';
1
+ import { F as FoundationElement, O as Observable, _ as __decorate, o as observable, a as attr, h as html, r as registerFactory } from './index.js';
2
+ import { a as iconRegistries } from './definition26.js';
3
+ import { f as focusRegistries } from './definition58.js';
4
+ import { b as AffixIconWithTrailing, a as affixIconTemplateFactory, I as IconWrapper } 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 './index2.js';
9
11
  import { w as when } from './when.js';
12
+ import { c as classNames } from './class-names.js';
10
13
 
11
- const styles = "/**\n * Do not edit directly\n * Generated on Wed, 01 Nov 2023 12:16:28 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.vwc-pagination-button[size=super-condensed] {\n --base-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 16));\n}\n.vwc-pagination-button[size=condensed] {\n --base-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 8));\n}\n.vwc-pagination-button[size=normal] {\n --base-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)));\n}\n.vwc-pagination-button::part(button) {\n padding-inline: 0;\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}";
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
+ let ListboxOption$1 = class ListboxOption 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);
12
207
 
13
208
  var __defProp = Object.defineProperty;
14
209
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -21,195 +216,74 @@ var __decorateClass = (decorators, target, key, kind) => {
21
216
  __defProp(target, key, result);
22
217
  return result;
23
218
  };
24
- const MAX_DIGITS_AND_PLACEHOLDERS = 7;
25
- const totalConverter = {
26
- fromView: (value) => parseInt(value, 10),
27
- toView: (value) => value.toString()
28
- };
29
- class Pagination extends FoundationElement {
30
- constructor() {
31
- super();
32
- this.navIcons = false;
33
- this.total = 0;
34
- this.selectedIndex = 0;
35
- this.addEventListener("tabpressed", (e) => {
36
- const { value: currentLabel, shiftKey } = e.detail;
37
- const index = this.paginationButtons.findIndex((button) => Number(button.label) === currentLabel);
38
- const focusDirection = shiftKey ? -1 : 1;
39
- const newIndex = index + focusDirection;
40
- if (newIndex < 0) {
41
- return this.prevButton.focus();
42
- }
43
- if (newIndex > this.paginationButtons.length - 1) {
44
- return this.nextButton.focus();
45
- }
46
- this.paginationButtons && this.paginationButtons[index + focusDirection].focus();
47
- });
48
- }
49
- get pagesList() {
50
- return new Array(this.total < MAX_DIGITS_AND_PLACEHOLDERS ? this.total : MAX_DIGITS_AND_PLACEHOLDERS).fill(0).map((_, i, arr) => {
51
- if (i === 0)
52
- return 1;
53
- if (i === arr.length - 1)
54
- return this.total;
55
- if (this.selectedIndex !== void 0 && this.total > MAX_DIGITS_AND_PLACEHOLDERS) {
56
- if (this.selectedIndex < 4) {
57
- if (i === MAX_DIGITS_AND_PLACEHOLDERS - 2)
58
- return "...";
59
- }
60
- if (this.selectedIndex >= 4 && this.selectedIndex <= this.total - 5) {
61
- if (i > 1 && i < MAX_DIGITS_AND_PLACEHOLDERS - 2)
62
- return this.selectedIndex + (i - 2);
63
- if (i === 1 || i === MAX_DIGITS_AND_PLACEHOLDERS - 2)
64
- return "...";
65
- }
66
- if (this.selectedIndex > this.total - 5) {
67
- if (i > 1)
68
- return this.total - (6 - i);
69
- if (i === 1)
70
- return "...";
71
- }
72
- }
73
- return i + 1;
74
- });
219
+ class ListboxOption extends ListboxOption$1 {
220
+ // #region overrides base class accessor
221
+ set text(value) {
222
+ this._text = value;
75
223
  }
76
- totalChanged(_, newValue) {
77
- if (newValue < 0) {
78
- this.total = 0;
79
- }
80
- this.selectedIndex = 0;
224
+ get text() {
225
+ return this._text ?? "";
81
226
  }
82
- selectedIndexChanged(oldValue, newValue) {
83
- if (oldValue === void 0)
84
- return;
85
- this.$emit("pagination-change", { selectedIndex: newValue, total: this.total, oldIndex: oldValue });
227
+ get label() {
228
+ return this._label ?? this.text;
86
229
  }
87
- paginationButtonsChanged(_, newValue) {
88
- newValue.forEach((button) => {
89
- button.shadowRoot.querySelector("button").setAttribute("part", "button");
90
- });
230
+ set label(value) {
231
+ this._label = value;
91
232
  }
233
+ // #endregion overrides
92
234
  }
93
235
  __decorateClass([
94
- attr
95
- ], Pagination.prototype, "size", 2);
96
- __decorateClass([
97
- attr
98
- ], Pagination.prototype, "shape", 2);
99
- __decorateClass([
100
- observable
101
- ], Pagination.prototype, "paginationButtons", 2);
102
- __decorateClass([
103
- observable
104
- ], Pagination.prototype, "prevButton", 2);
105
- __decorateClass([
106
- observable
107
- ], Pagination.prototype, "nextButton", 2);
108
- __decorateClass([
109
- attr({ attribute: "nav-icons", mode: "boolean" })
110
- ], Pagination.prototype, "navIcons", 2);
236
+ attr({
237
+ attribute: "text"
238
+ })
239
+ ], ListboxOption.prototype, "_text", 2);
111
240
  __decorateClass([
112
- volatile
113
- ], Pagination.prototype, "pagesList", 1);
114
- __decorateClass([
115
- attr({ mode: "reflect", converter: totalConverter })
116
- ], Pagination.prototype, "total", 2);
117
- __decorateClass([
118
- attr({ mode: "reflect", converter: totalConverter, attribute: "selected-index" })
119
- ], Pagination.prototype, "selectedIndex", 2);
241
+ attr({
242
+ attribute: "label"
243
+ })
244
+ ], ListboxOption.prototype, "_label", 2);
245
+ applyMixins(ListboxOption, AffixIconWithTrailing);
120
246
 
121
- const ALLOWED_SIZES = [Size.SuperCondensed, Size.Condensed, Size.Normal];
122
- const ALLOWED_SHAPES = [Shape.Rounded, Shape.Pill];
123
- const handleSelection = (value, { parent: x }) => {
124
- return x.selectedIndex = Number(value) - 1;
125
- };
126
- const handleKeyDown = (value, { event, parent }) => {
127
- if (event.key === " " || event.key === "Enter") {
128
- handleSelection(value, { parent });
129
- }
130
- if (event.key === "Tab") {
131
- event.target.dispatchEvent(
132
- new CustomEvent("tabpressed", { detail: { value, shiftKey: event.shiftKey }, bubbles: true, composed: true })
133
- );
134
- }
135
- };
136
- const getClasses = (_) => classNames("control");
137
- function getButtonAppearance(value, { parent }) {
138
- return parent.selectedIndex === Number(value) - 1 ? "filled" : "ghost";
139
- }
140
- const paginationButtonRenderer = (buttonTag) => html`
141
- ${when(
142
- (value) => value !== "...",
143
- html`
144
- <${buttonTag} class="vwc-pagination-button"
145
- label="${(value) => value}"
146
- appearance="${getButtonAppearance}"
147
- size="${(_, { parent: x }) => getPaginationSize(x)}"
148
- shape="${(_, { parent: x }) => getPaginationShape(x)}"
149
- style="inline-size: ${(value) => getPaginationButtonWidth(value)};"
150
- tabindex="0"
151
- aria-current="${(value, { parent }) => parent.selectedIndex === Number(value) - 1}"
152
- @click="${handleSelection}"
153
- @keydown="${handleKeyDown}">
154
- </${buttonTag}>
155
- `
156
- )}
157
- ${when(
158
- (value) => value === "...",
159
- html`
160
- <div
161
- class="dots size-${(_, { parent: x }) => getPaginationSize(x)}">
162
- ...
163
- </div>`
164
- )}`;
165
- const getPaginationSize = (x) => {
166
- if (!x.size || !ALLOWED_SIZES.includes(x.size)) {
167
- return Size.SuperCondensed;
168
- }
169
- return x.size;
170
- };
171
- const getPaginationShape = (x) => {
172
- if (!x.shape || !ALLOWED_SHAPES.includes(x.shape)) {
173
- return Shape.Rounded;
174
- }
175
- return x.shape;
176
- };
177
- const getPaginationButtonWidth = (value) => {
178
- return `calc(var(--base-size) + ${String(value).length - 1}ch)`;
179
- };
180
- const PaginationTemplate = (context) => {
181
- const buttonTag = context.tagFor(Button);
182
- const paginationButtonTemplate = paginationButtonRenderer(buttonTag);
247
+ const getClasses = ({
248
+ icon,
249
+ disabled,
250
+ selected,
251
+ checked
252
+ }) => classNames(
253
+ "base",
254
+ ["disabled", disabled],
255
+ ["selected", Boolean(selected)],
256
+ ["active", Boolean(checked)],
257
+ ["icon", Boolean(icon)]
258
+ );
259
+ const ListboxOptionTemplate = (context) => {
260
+ const affixIconTemplate = affixIconTemplateFactory(context);
261
+ const focusTemplate = focusTemplateFactory(context);
183
262
  return html`
184
- <div class="${getClasses}">
185
- <${buttonTag} class="prev-button" ${ref("prevButton")}
186
- label="${(x) => !x.navIcons ? "Previous" : null}"
187
- icon="${(x) => x.navIcons ? "chevron-left-line" : null}"
188
- size="${getPaginationSize}"
189
- shape="${getPaginationShape}"
190
- ?disabled="${(x) => x.total === 0 || x.selectedIndex === 0}"
191
- @click="${(x) => x.selectedIndex !== void 0 && x.selectedIndex--}"
192
- ></${buttonTag}>
193
- <div id="buttons-wrapper" class="buttons-wrapper" ${children({ property: "paginationButtons", filter: elements(buttonTag) })}>
194
- ${repeat((x) => x.pagesList, paginationButtonTemplate, { positioning: true })}
263
+ <template
264
+ aria-checked="${(x) => x.ariaChecked}"
265
+ aria-disabled="${(x) => x.ariaDisabled}"
266
+ aria-posinset="${(x) => x.ariaPosInSet}"
267
+ aria-selected="${(x) => x.ariaSelected}"
268
+ aria-setsize="${(x) => x.ariaSetSize}"
269
+ role="option">
270
+ <div class="${getClasses}">
271
+ ${() => focusTemplate}
272
+ ${(x) => affixIconTemplate(x.icon, IconWrapper.Slot)}
273
+ ${when((x) => x.text, html`<div class="text">${(x) => x.text}</div>`)}
195
274
  </div>
196
- <${buttonTag} class="next-button" ${ref("nextButton")}
197
- label="${(x) => !x.navIcons ? "Next" : null}"
198
- icon="${(x) => x.navIcons ? "chevron-right-line" : null}"
199
- size="${getPaginationSize}"
200
- shape="${getPaginationShape}"
201
- ?disabled="${(x) => x.total === 0 || x.selectedIndex === x.total - 1}"
202
- @click="${(x) => x.selectedIndex !== void 0 && x.selectedIndex++}"
203
- ></${buttonTag}>
204
- </div>`;
275
+ </template>
276
+ `;
205
277
  };
206
278
 
207
- const paginationDefinition = Pagination.compose({
208
- baseName: "pagination",
209
- template: PaginationTemplate,
279
+ const styles = "/**\n * Do not edit directly\n * Generated on Thu, 30 Nov 2023 11:42:28 GMT\n */\n:host([disabled]) {\n cursor: not-allowed;\n}\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-inline: 16px;\n vertical-align: middle;\n word-break: break-word;\n}\n.base {\n /* @cssprop [--vvd-option-accent-primary=var(--vvd-color-canvas-text)] */\n --_connotation-color-primary: var(--vvd-option-accent-primary, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-option-accent-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-option-accent-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-option-accent-primary-increment=var(--vvd-color-neutral-800)] */\n --_connotation-color-primary-increment: var(--vvd-option-accent-primary-increment, var(--vvd-color-neutral-800));\n /* @cssprop [--vvd-option-accent-faint=var(--vvd-color-neutral-50)] */\n --_connotation-color-faint: var(--vvd-option-accent-faint, var(--vvd-color-neutral-50));\n /* @cssprop [--vvd-option-accent-soft=var(--vvd-color-neutral-100)] */\n --_connotation-color-soft: var(--vvd-option-accent-soft, var(--vvd-color-neutral-100));\n /* @cssprop [--vvd-option-accent-pale=var(--vvd-color-neutral-300)] */\n --_connotation-color-pale: var(--vvd-option-accent-pale, var(--vvd-color-neutral-300));\n /* @cssprop [--vvd-option-accent-dim=var(--vvd-color-neutral-200)] */\n --_connotation-color-dim: var(--vvd-option-accent-dim, var(--vvd-color-neutral-200));\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-300);\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)) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-dim);\n --_appearance-color-outline: transparent;\n}\n.base:where(.selected, [aria-current]):where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-pale);\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 pointer-events: none;\n}\n.base .text {\n font: var(--vvd-typography-base);\n}\n\nslot[name=icon] {\n font-size: 20px;\n line-height: 1;\n}\n.base:not(.disabled, .selected) slot[name=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}";
280
+
281
+ const listboxOptionDefinition = ListboxOption.compose({
282
+ baseName: "option",
283
+ template: ListboxOptionTemplate,
210
284
  styles
211
285
  });
212
- const paginationRegistries = [paginationDefinition(), buttonRegistries];
213
- const registerPagination = registerFactory(paginationRegistries);
286
+ const listboxOptionRegistries = [listboxOptionDefinition(), ...iconRegistries, ...focusRegistries];
287
+ const registerOption = registerFactory(listboxOptionRegistries);
214
288
 
215
- export { paginationRegistries as a, paginationDefinition as p, registerPagination as r };
289
+ export { ListboxOption as L, listboxOptionRegistries as a, isListboxOption as i, listboxOptionDefinition as l, registerOption as r };