@vonage/vivid 3.52.0 → 3.54.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 (299) hide show
  1. package/README.md +1 -1
  2. package/accordion/index.cjs +1 -1
  3. package/accordion/index.js +1 -1
  4. package/accordion-item/index.cjs +1 -1
  5. package/accordion-item/index.js +1 -1
  6. package/alert/index.cjs +3 -3
  7. package/alert/index.js +3 -3
  8. package/appearance-ui/index.cjs +1 -1
  9. package/appearance-ui/index.js +1 -1
  10. package/audio-player/index.cjs +3 -3
  11. package/audio-player/index.js +3 -3
  12. package/avatar/index.cjs +1 -1
  13. package/avatar/index.js +1 -1
  14. package/badge/index.cjs +1 -1
  15. package/badge/index.js +1 -1
  16. package/banner/index.cjs +2 -2
  17. package/banner/index.js +2 -2
  18. package/breadcrumb-item/index.cjs +1 -1
  19. package/breadcrumb-item/index.js +1 -1
  20. package/button/index.cjs +2 -2
  21. package/button/index.js +2 -2
  22. package/card/index.cjs +2 -2
  23. package/card/index.js +2 -2
  24. package/checkbox/index.cjs +3 -2
  25. package/checkbox/index.js +3 -2
  26. package/combobox/index.cjs +5 -5
  27. package/combobox/index.js +5 -5
  28. package/custom-elements.json +1162 -99
  29. package/data-grid/index.cjs +1 -1
  30. package/data-grid/index.js +1 -1
  31. package/date-picker/index.cjs +7 -6
  32. package/date-picker/index.js +7 -6
  33. package/date-range-picker/index.cjs +7 -6
  34. package/date-range-picker/index.js +7 -6
  35. package/dial-pad/index.cjs +33 -0
  36. package/dial-pad/index.js +31 -0
  37. package/dialog/index.cjs +4 -4
  38. package/dialog/index.js +4 -4
  39. package/divider/index.cjs +1 -1
  40. package/divider/index.js +1 -1
  41. package/elevation/index.cjs +1 -1
  42. package/elevation/index.js +1 -1
  43. package/empty-state/index.cjs +2 -2
  44. package/empty-state/index.js +2 -2
  45. package/fab/index.cjs +2 -2
  46. package/fab/index.js +2 -2
  47. package/file-picker/index.cjs +4 -3
  48. package/file-picker/index.js +4 -3
  49. package/header/index.cjs +2 -2
  50. package/header/index.js +2 -2
  51. package/icon/index.cjs +1 -1
  52. package/icon/index.js +1 -1
  53. package/index.cjs +132 -122
  54. package/index.js +46 -43
  55. package/layout/index.cjs +1 -1
  56. package/layout/index.js +1 -1
  57. package/lib/appearance-ui/appearance-ui.d.ts +1 -1
  58. package/lib/audio-player/audio-player.d.ts +4 -0
  59. package/lib/audio-player/locale.d.ts +2 -0
  60. package/lib/components.d.ts +2 -0
  61. package/lib/dial-pad/definition.d.ts +3 -0
  62. package/lib/dial-pad/dial-pad.d.ts +17 -0
  63. package/lib/dial-pad/dial-pad.template.d.ts +4 -0
  64. package/lib/dial-pad/locale.d.ts +18 -0
  65. package/lib/enums.d.ts +7 -0
  66. package/lib/menu/menu.d.ts +1 -0
  67. package/lib/nav-disclosure/nav-disclosure.d.ts +5 -0
  68. package/lib/text-anchor/definition.d.ts +1 -0
  69. package/lib/text-anchor/text-anchor.d.ts +5 -0
  70. package/lib/video-player/definition.d.ts +3 -0
  71. package/lib/video-player/locale.d.ts +1 -0
  72. package/lib/video-player/video-player.d.ts +17 -0
  73. package/lib/video-player/video-player.template.d.ts +4 -0
  74. package/lib/video-player/vivid-video-svg.d.ts +1 -0
  75. package/listbox/index.cjs +2 -2
  76. package/listbox/index.js +2 -2
  77. package/locales/en-GB.cjs +33 -1
  78. package/locales/en-GB.js +33 -1
  79. package/locales/en-US.cjs +201 -1
  80. package/locales/en-US.js +201 -1
  81. package/locales/ja-JP.cjs +200 -1
  82. package/locales/ja-JP.js +200 -1
  83. package/locales/zh-CN.cjs +202 -1
  84. package/locales/zh-CN.js +202 -1
  85. package/menu/index.cjs +6 -6
  86. package/menu/index.js +6 -6
  87. package/menu-item/index.cjs +2 -2
  88. package/menu-item/index.js +2 -2
  89. package/nav/index.cjs +1 -1
  90. package/nav/index.js +1 -1
  91. package/nav-disclosure/index.cjs +2 -2
  92. package/nav-disclosure/index.js +2 -2
  93. package/nav-item/index.cjs +2 -2
  94. package/nav-item/index.js +2 -2
  95. package/note/index.cjs +2 -2
  96. package/note/index.js +2 -2
  97. package/number-field/index.cjs +5 -4
  98. package/number-field/index.js +5 -4
  99. package/option/index.cjs +2 -2
  100. package/option/index.js +2 -2
  101. package/package.json +1 -1
  102. package/pagination/index.cjs +3 -3
  103. package/pagination/index.js +3 -3
  104. package/popup/index.cjs +4 -4
  105. package/popup/index.js +4 -4
  106. package/progress/index.cjs +1 -1
  107. package/progress/index.js +1 -1
  108. package/progress-ring/index.cjs +1 -1
  109. package/progress-ring/index.js +1 -1
  110. package/radio/index.cjs +1 -1
  111. package/radio/index.js +1 -1
  112. package/radio-group/index.cjs +1 -1
  113. package/radio-group/index.js +1 -1
  114. package/range-slider/index.cjs +2 -2
  115. package/range-slider/index.js +2 -2
  116. package/select/index.cjs +7 -6
  117. package/select/index.js +7 -6
  118. package/selectable-box/index.cjs +5 -4
  119. package/selectable-box/index.js +5 -4
  120. package/shared/applyMixinsWithObservables.cjs +15 -0
  121. package/shared/applyMixinsWithObservables.js +13 -0
  122. package/shared/definition.cjs +1 -1
  123. package/shared/definition.js +1 -1
  124. package/shared/definition11.cjs +3 -3
  125. package/shared/definition11.js +3 -3
  126. package/shared/definition14.cjs +2 -2
  127. package/shared/definition14.js +2 -2
  128. package/shared/definition15.cjs +8 -9
  129. package/shared/definition15.js +8 -9
  130. package/shared/definition16.cjs +3 -3
  131. package/shared/definition16.js +3 -3
  132. package/shared/definition17.cjs +2 -2
  133. package/shared/definition17.js +3 -3
  134. package/shared/definition18.cjs +3 -3
  135. package/shared/definition18.js +3 -3
  136. package/shared/definition19.cjs +3 -3
  137. package/shared/definition19.js +3 -3
  138. package/shared/definition20.cjs +196 -224
  139. package/shared/definition20.js +191 -219
  140. package/shared/definition21.cjs +264 -67
  141. package/shared/definition21.js +263 -65
  142. package/shared/definition22.cjs +66 -57
  143. package/shared/definition22.js +64 -56
  144. package/shared/definition23.cjs +42 -76
  145. package/shared/definition23.js +41 -75
  146. package/shared/definition24.cjs +70 -2402
  147. package/shared/definition24.js +69 -2401
  148. package/shared/definition25.cjs +2402 -46
  149. package/shared/definition25.js +2401 -45
  150. package/shared/definition26.cjs +63 -30
  151. package/shared/definition26.js +62 -29
  152. package/shared/definition27.cjs +28 -56
  153. package/shared/definition27.js +27 -55
  154. package/shared/definition28.cjs +35 -881
  155. package/shared/definition28.js +34 -879
  156. package/shared/definition29.cjs +922 -60
  157. package/shared/definition29.js +922 -61
  158. package/shared/definition30.cjs +68 -86
  159. package/shared/definition30.js +67 -85
  160. package/shared/definition31.cjs +98 -21
  161. package/shared/definition31.js +98 -21
  162. package/shared/definition32.cjs +24 -12
  163. package/shared/definition32.js +23 -11
  164. package/shared/definition33.cjs +11 -50
  165. package/shared/definition33.js +10 -49
  166. package/shared/definition34.cjs +26 -515
  167. package/shared/definition34.js +26 -515
  168. package/shared/definition35.cjs +448 -194
  169. package/shared/definition35.js +448 -192
  170. package/shared/definition36.cjs +256 -202
  171. package/shared/definition36.js +253 -201
  172. package/shared/definition37.cjs +204 -65
  173. package/shared/definition37.js +203 -63
  174. package/shared/definition38.cjs +63 -57
  175. package/shared/definition38.js +60 -55
  176. package/shared/definition39.cjs +65 -432
  177. package/shared/definition39.js +64 -431
  178. package/shared/definition4.cjs +2 -2
  179. package/shared/definition4.js +2 -2
  180. package/shared/definition40.cjs +441 -34
  181. package/shared/definition40.js +438 -31
  182. package/shared/definition41.cjs +34 -576
  183. package/shared/definition41.js +33 -575
  184. package/shared/definition42.cjs +531 -654
  185. package/shared/definition42.js +531 -654
  186. package/shared/definition43.cjs +690 -114
  187. package/shared/definition43.js +689 -113
  188. package/shared/definition44.cjs +124 -79
  189. package/shared/definition44.js +122 -77
  190. package/shared/definition45.cjs +78 -520
  191. package/shared/definition45.js +77 -518
  192. package/shared/definition46.cjs +520 -119
  193. package/shared/definition46.js +518 -118
  194. package/shared/definition47.cjs +118 -135
  195. package/shared/definition47.js +117 -134
  196. package/shared/definition48.cjs +151 -19
  197. package/shared/definition48.js +150 -18
  198. package/shared/definition49.cjs +21 -84
  199. package/shared/definition49.js +20 -83
  200. package/shared/definition5.cjs +100 -19
  201. package/shared/definition5.js +100 -19
  202. package/shared/definition50.cjs +52 -505
  203. package/shared/definition50.js +51 -504
  204. package/shared/definition51.cjs +526 -28
  205. package/shared/definition51.js +525 -27
  206. package/shared/definition52.cjs +28 -123
  207. package/shared/definition52.js +26 -122
  208. package/shared/definition53.cjs +110 -309
  209. package/shared/definition53.js +110 -308
  210. package/shared/definition54.cjs +255 -271
  211. package/shared/definition54.js +255 -271
  212. package/shared/definition55.cjs +315 -776
  213. package/shared/definition55.js +314 -775
  214. package/shared/definition56.cjs +818 -107
  215. package/shared/definition56.js +817 -106
  216. package/shared/definition57.cjs +85 -55
  217. package/shared/definition57.js +84 -54
  218. package/shared/definition58.cjs +125 -72
  219. package/shared/definition58.js +124 -71
  220. package/shared/definition59.cjs +72 -285
  221. package/shared/definition59.js +73 -286
  222. package/shared/definition6.cjs +1 -1
  223. package/shared/definition6.js +1 -1
  224. package/shared/definition60.cjs +298 -39
  225. package/shared/definition60.js +297 -38
  226. package/shared/definition61.cjs +66044 -1687
  227. package/shared/definition61.js +66043 -1686
  228. package/shared/definition62.cjs +50 -0
  229. package/shared/definition62.js +46 -0
  230. package/shared/definition63.cjs +1828 -0
  231. package/shared/definition63.js +1824 -0
  232. package/shared/definition7.cjs +2 -2
  233. package/shared/definition7.js +2 -2
  234. package/shared/definition8.cjs +2 -2
  235. package/shared/definition8.js +2 -2
  236. package/shared/definition9.cjs +1 -1
  237. package/shared/definition9.js +1 -1
  238. package/shared/enums.cjs +9 -0
  239. package/shared/enums.js +9 -1
  240. package/shared/icon.cjs +20 -2
  241. package/shared/icon.js +21 -3
  242. package/shared/index2.cjs +73 -37
  243. package/shared/index2.js +73 -37
  244. package/shared/key-codes2.js +1 -1
  245. package/shared/listbox.cjs +1 -1
  246. package/shared/listbox.js +1 -1
  247. package/shared/localization/Locale.d.ts +4 -0
  248. package/shared/patterns/form-elements/form-elements.d.ts +2 -3
  249. package/shared/presentationDate.cjs +16 -5
  250. package/shared/presentationDate.js +16 -5
  251. package/shared/text-anchor.cjs +6 -0
  252. package/shared/text-anchor.js +6 -0
  253. package/shared/text-anchor.template.cjs +6 -1
  254. package/shared/text-anchor.template.js +6 -1
  255. package/shared/text-field.cjs +1 -1
  256. package/shared/text-field.js +1 -1
  257. package/shared/utils/applyMixinsWithObservables.d.ts +1 -0
  258. package/shared/utils/numberConverter.d.ts +2 -0
  259. package/side-drawer/index.cjs +1 -1
  260. package/side-drawer/index.js +1 -1
  261. package/slider/index.cjs +1 -1
  262. package/slider/index.js +1 -1
  263. package/split-button/index.cjs +2 -2
  264. package/split-button/index.js +2 -2
  265. package/styles/core/all.css +1 -1
  266. package/styles/core/theme.css +1 -1
  267. package/styles/core/typography.css +1 -1
  268. package/styles/tokens/theme-dark.css +4 -4
  269. package/styles/tokens/theme-light.css +4 -4
  270. package/styles/tokens/vivid-2-compat.css +1 -1
  271. package/switch/index.cjs +2 -2
  272. package/switch/index.js +2 -2
  273. package/tab/index.cjs +2 -2
  274. package/tab/index.js +2 -2
  275. package/tab-panel/index.cjs +1 -1
  276. package/tab-panel/index.js +1 -1
  277. package/tabs/index.cjs +4 -4
  278. package/tabs/index.js +4 -4
  279. package/tag/index.cjs +2 -2
  280. package/tag/index.js +2 -2
  281. package/tag-group/index.cjs +1 -1
  282. package/tag-group/index.js +1 -1
  283. package/text-area/index.cjs +4 -3
  284. package/text-area/index.js +4 -3
  285. package/text-field/index.cjs +4 -3
  286. package/text-field/index.js +4 -3
  287. package/time-picker/index.cjs +8 -7
  288. package/time-picker/index.js +8 -7
  289. package/toggletip/index.cjs +5 -5
  290. package/toggletip/index.js +5 -5
  291. package/tooltip/index.cjs +5 -5
  292. package/tooltip/index.js +5 -5
  293. package/tree-item/index.cjs +2 -2
  294. package/tree-item/index.js +2 -2
  295. package/tree-view/index.cjs +1 -1
  296. package/tree-view/index.js +1 -1
  297. package/video-player/index.cjs +17 -0
  298. package/video-player/index.js +15 -0
  299. package/vivid.api.json +332 -0
@@ -1,16 +1,208 @@
1
1
  'use strict';
2
2
 
3
- const definition = require('./definition11.cjs');
4
3
  const index = require('./index.cjs');
5
- const enums = require('./enums.cjs');
6
- const slotted = require('./slotted.cjs');
7
- const ref = require('./ref.cjs');
8
- const children = require('./children.cjs');
9
- const repeat = require('./repeat.cjs');
10
- const classNames = require('./class-names.cjs');
4
+ const definition = require('./definition27.cjs');
5
+ const affix = require('./affix.cjs');
6
+ const ariaGlobal = require('./aria-global.cjs');
7
+ const startEnd = require('./start-end.cjs');
8
+ const applyMixins = require('./apply-mixins.cjs');
9
+ const dom = require('./dom.cjs');
11
10
  const when = require('./when.cjs');
11
+ const classNames = require('./class-names.cjs');
12
12
 
13
- const styles = ".control{display:inline-flex;justify-content:space-between}.control:not(.shape-pill){border-radius:4px}.control.shape-pill{border-radius:14px}.buttons-wrapper{display:flex;column-gap:4px}.vwc-pagination-button[size=super-condensed]{--base-size:calc(1px*(24 + 4*clamp(-1, var(--vvd-size-density, 0), 2)))}.vwc-pagination-button[size=condensed]{--base-size:calc(1px*(32 + 4*clamp(-1, var(--vvd-size-density, 0), 2)))}.vwc-pagination-button[size=normal]{--base-size:calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2)))}.vwc-pagination-button::part(button){padding-inline:0}.dots{align-self:center;text-align:center}.dots:not(.size-super-condensed){font:var(--vvd-typography-base-bold)}.dots.size-super-condensed{font:var(--vvd-typography-base-condensed-bold);inline-size:calc(1px*(24 + 4*clamp(-1,var(--vvd-size-density, 0),2)))}.dots.size-condensed{inline-size:calc(1px*(32 + 4*clamp(-1,var(--vvd-size-density, 0),2)))}.dots.size-normal{inline-size:calc(1px*(40 + 4*clamp(-1,var(--vvd-size-density, 0),2)))}\n";
13
+ /**
14
+ * Determines if the element is a {@link (ListboxOption:class)}
15
+ *
16
+ * @param element - the element to test.
17
+ * @public
18
+ */
19
+ function isListboxOption(el) {
20
+ return (dom.isHTMLElement(el) &&
21
+ (el.getAttribute("role") === "option" ||
22
+ el instanceof HTMLOptionElement));
23
+ }
24
+ /**
25
+ * An Option Custom HTML Element.
26
+ * Implements {@link https://www.w3.org/TR/wai-aria-1.1/#option | ARIA option }.
27
+ *
28
+ * @slot start - Content which can be provided before the listbox option content
29
+ * @slot end - Content which can be provided after the listbox option content
30
+ * @slot - The default slot for listbox option content
31
+ * @csspart content - Wraps the listbox option content
32
+ *
33
+ * @public
34
+ */
35
+ let ListboxOption$1 = class ListboxOption extends index.FoundationElement {
36
+ constructor(text, value, defaultSelected, selected) {
37
+ super();
38
+ /**
39
+ * The defaultSelected state of the option.
40
+ * @public
41
+ */
42
+ this.defaultSelected = false;
43
+ /**
44
+ * Tracks whether the "selected" property has been changed.
45
+ * @internal
46
+ */
47
+ this.dirtySelected = false;
48
+ /**
49
+ * The checked state of the control.
50
+ *
51
+ * @public
52
+ */
53
+ this.selected = this.defaultSelected;
54
+ /**
55
+ * Track whether the value has been changed from the initial value
56
+ */
57
+ this.dirtyValue = false;
58
+ if (text) {
59
+ this.textContent = text;
60
+ }
61
+ if (value) {
62
+ this.initialValue = value;
63
+ }
64
+ if (defaultSelected) {
65
+ this.defaultSelected = defaultSelected;
66
+ }
67
+ if (selected) {
68
+ this.selected = selected;
69
+ }
70
+ this.proxy = new Option(`${this.textContent}`, this.initialValue, this.defaultSelected, this.selected);
71
+ this.proxy.disabled = this.disabled;
72
+ }
73
+ /**
74
+ * Updates the ariaChecked property when the checked property changes.
75
+ *
76
+ * @param prev - the previous checked value
77
+ * @param next - the current checked value
78
+ *
79
+ * @public
80
+ */
81
+ checkedChanged(prev, next) {
82
+ if (typeof next === "boolean") {
83
+ this.ariaChecked = next ? "true" : "false";
84
+ return;
85
+ }
86
+ this.ariaChecked = null;
87
+ }
88
+ /**
89
+ * Updates the proxy's text content when the default slot changes.
90
+ * @param prev - the previous content value
91
+ * @param next - the current content value
92
+ *
93
+ * @internal
94
+ */
95
+ contentChanged(prev, next) {
96
+ if (this.proxy instanceof HTMLOptionElement) {
97
+ this.proxy.textContent = this.textContent;
98
+ }
99
+ this.$emit("contentchange", null, { bubbles: true });
100
+ }
101
+ defaultSelectedChanged() {
102
+ if (!this.dirtySelected) {
103
+ this.selected = this.defaultSelected;
104
+ if (this.proxy instanceof HTMLOptionElement) {
105
+ this.proxy.selected = this.defaultSelected;
106
+ }
107
+ }
108
+ }
109
+ disabledChanged(prev, next) {
110
+ this.ariaDisabled = this.disabled ? "true" : "false";
111
+ if (this.proxy instanceof HTMLOptionElement) {
112
+ this.proxy.disabled = this.disabled;
113
+ }
114
+ }
115
+ selectedAttributeChanged() {
116
+ this.defaultSelected = this.selectedAttribute;
117
+ if (this.proxy instanceof HTMLOptionElement) {
118
+ this.proxy.defaultSelected = this.defaultSelected;
119
+ }
120
+ }
121
+ selectedChanged() {
122
+ this.ariaSelected = this.selected ? "true" : "false";
123
+ if (!this.dirtySelected) {
124
+ this.dirtySelected = true;
125
+ }
126
+ if (this.proxy instanceof HTMLOptionElement) {
127
+ this.proxy.selected = this.selected;
128
+ }
129
+ }
130
+ initialValueChanged(previous, next) {
131
+ // If the value is clean and the component is connected to the DOM
132
+ // then set value equal to the attribute value.
133
+ if (!this.dirtyValue) {
134
+ this.value = this.initialValue;
135
+ this.dirtyValue = false;
136
+ }
137
+ }
138
+ get label() {
139
+ var _a;
140
+ return (_a = this.value) !== null && _a !== void 0 ? _a : this.text;
141
+ }
142
+ get text() {
143
+ var _a, _b;
144
+ return (_b = (_a = this.textContent) === null || _a === void 0 ? void 0 : _a.replace(/\s+/g, " ").trim()) !== null && _b !== void 0 ? _b : "";
145
+ }
146
+ set value(next) {
147
+ const newValue = `${next !== null && next !== void 0 ? next : ""}`;
148
+ this._value = newValue;
149
+ this.dirtyValue = true;
150
+ if (this.proxy instanceof HTMLOptionElement) {
151
+ this.proxy.value = newValue;
152
+ }
153
+ index.Observable.notify(this, "value");
154
+ }
155
+ get value() {
156
+ var _a;
157
+ index.Observable.track(this, "value");
158
+ return (_a = this._value) !== null && _a !== void 0 ? _a : this.text;
159
+ }
160
+ get form() {
161
+ return this.proxy ? this.proxy.form : null;
162
+ }
163
+ };
164
+ index.__decorate([
165
+ index.observable
166
+ ], ListboxOption$1.prototype, "checked", void 0);
167
+ index.__decorate([
168
+ index.observable
169
+ ], ListboxOption$1.prototype, "content", void 0);
170
+ index.__decorate([
171
+ index.observable
172
+ ], ListboxOption$1.prototype, "defaultSelected", void 0);
173
+ index.__decorate([
174
+ index.attr({ mode: "boolean" })
175
+ ], ListboxOption$1.prototype, "disabled", void 0);
176
+ index.__decorate([
177
+ index.attr({ attribute: "selected", mode: "boolean" })
178
+ ], ListboxOption$1.prototype, "selectedAttribute", void 0);
179
+ index.__decorate([
180
+ index.observable
181
+ ], ListboxOption$1.prototype, "selected", void 0);
182
+ index.__decorate([
183
+ index.attr({ attribute: "value", mode: "fromView" })
184
+ ], ListboxOption$1.prototype, "initialValue", void 0);
185
+ /**
186
+ * States and properties relating to the ARIA `option` role.
187
+ *
188
+ * @public
189
+ */
190
+ class DelegatesARIAListboxOption {
191
+ }
192
+ index.__decorate([
193
+ index.observable
194
+ ], DelegatesARIAListboxOption.prototype, "ariaChecked", void 0);
195
+ index.__decorate([
196
+ index.observable
197
+ ], DelegatesARIAListboxOption.prototype, "ariaPosInSet", void 0);
198
+ index.__decorate([
199
+ index.observable
200
+ ], DelegatesARIAListboxOption.prototype, "ariaSelected", void 0);
201
+ index.__decorate([
202
+ index.observable
203
+ ], DelegatesARIAListboxOption.prototype, "ariaSetSize", void 0);
204
+ applyMixins.applyMixins(DelegatesARIAListboxOption, ariaGlobal.ARIAGlobalStatesAndProperties);
205
+ applyMixins.applyMixins(ListboxOption$1, startEnd.StartEnd, DelegatesARIAListboxOption);
14
206
 
15
207
  var __defProp = Object.defineProperty;
16
208
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -23,213 +215,75 @@ var __decorateClass = (decorators, target, key, kind) => {
23
215
  __defProp(target, key, result);
24
216
  return result;
25
217
  };
26
- const MAX_DIGITS_AND_PLACEHOLDERS = 7;
27
- const totalConverter = {
28
- fromView: (value) => parseInt(value, 10),
29
- toView: (value) => value.toString()
30
- };
31
- class Pagination extends index.FoundationElement {
32
- constructor() {
33
- super();
34
- this.navIcons = false;
35
- this.total = 0;
36
- this.selectedIndex = 0;
37
- this.addEventListener("tabpressed", (e) => {
38
- const { value: currentLabel, shiftKey } = e.detail;
39
- const index = this.paginationButtons.findIndex(
40
- (button) => Number(button.label) === currentLabel
41
- );
42
- const focusDirection = shiftKey ? -1 : 1;
43
- const newIndex = index + focusDirection;
44
- if (newIndex < 0) {
45
- return this.prevButton.focus();
46
- }
47
- if (newIndex > this.paginationButtons.length - 1) {
48
- return this.nextButton.focus();
49
- }
50
- this.paginationButtons && this.paginationButtons[index + focusDirection].focus();
51
- });
52
- }
53
- get pagesList() {
54
- return new Array(
55
- this.total < MAX_DIGITS_AND_PLACEHOLDERS ? this.total : MAX_DIGITS_AND_PLACEHOLDERS
56
- ).fill(0).map((_, i, arr) => {
57
- if (i === 0)
58
- return 1;
59
- if (i === arr.length - 1)
60
- return this.total;
61
- if (this.selectedIndex !== void 0 && this.total > MAX_DIGITS_AND_PLACEHOLDERS) {
62
- if (this.selectedIndex < 4) {
63
- if (i === MAX_DIGITS_AND_PLACEHOLDERS - 2)
64
- return "...";
65
- }
66
- if (this.selectedIndex >= 4 && this.selectedIndex <= this.total - 5) {
67
- if (i > 1 && i < MAX_DIGITS_AND_PLACEHOLDERS - 2)
68
- return this.selectedIndex + (i - 2);
69
- if (i === 1 || i === MAX_DIGITS_AND_PLACEHOLDERS - 2)
70
- return "...";
71
- }
72
- if (this.selectedIndex > this.total - 5) {
73
- if (i > 1)
74
- return this.total - (6 - i);
75
- if (i === 1)
76
- return "...";
77
- }
78
- }
79
- return i + 1;
80
- });
218
+ class ListboxOption extends ListboxOption$1 {
219
+ // #region overrides base class accessor
220
+ set text(value) {
221
+ this._text = value;
81
222
  }
82
- totalChanged(_, newValue) {
83
- if (newValue < 0) {
84
- this.total = 0;
85
- }
86
- this.selectedIndex = 0;
223
+ get text() {
224
+ return this._text ?? "";
87
225
  }
88
- selectedIndexChanged(oldValue, newValue) {
89
- if (oldValue === void 0)
90
- return;
91
- this.$emit("pagination-change", {
92
- selectedIndex: newValue,
93
- total: this.total,
94
- oldIndex: oldValue
95
- });
226
+ get label() {
227
+ return this._label ?? this.text;
96
228
  }
97
- paginationButtonsChanged(_, newValue) {
98
- newValue.forEach((button) => {
99
- button.shadowRoot.querySelector("button").setAttribute("part", "button");
100
- });
229
+ set label(value) {
230
+ this._label = value;
101
231
  }
232
+ // #endregion overrides
102
233
  }
103
234
  __decorateClass([
104
- index.attr
105
- ], Pagination.prototype, "size", 2);
106
- __decorateClass([
107
- index.attr
108
- ], Pagination.prototype, "shape", 2);
109
- __decorateClass([
110
- index.observable
111
- ], Pagination.prototype, "paginationButtons", 2);
112
- __decorateClass([
113
- index.observable
114
- ], Pagination.prototype, "prevButton", 2);
115
- __decorateClass([
116
- index.observable
117
- ], Pagination.prototype, "nextButton", 2);
118
- __decorateClass([
119
- index.attr({ attribute: "nav-icons", mode: "boolean" })
120
- ], Pagination.prototype, "navIcons", 2);
121
- __decorateClass([
122
- index.volatile
123
- ], Pagination.prototype, "pagesList", 1);
124
- __decorateClass([
125
- index.attr({ mode: "reflect", converter: totalConverter })
126
- ], Pagination.prototype, "total", 2);
235
+ index.attr({
236
+ attribute: "text"
237
+ })
238
+ ], ListboxOption.prototype, "_text", 2);
127
239
  __decorateClass([
128
240
  index.attr({
129
- mode: "reflect",
130
- converter: totalConverter,
131
- attribute: "selected-index"
241
+ attribute: "label"
132
242
  })
133
- ], Pagination.prototype, "selectedIndex", 2);
243
+ ], ListboxOption.prototype, "_label", 2);
244
+ applyMixins.applyMixins(ListboxOption, affix.AffixIconWithTrailing);
134
245
 
135
- const ALLOWED_SIZES = [enums.Size.SuperCondensed, enums.Size.Condensed, enums.Size.Normal];
136
- const ALLOWED_SHAPES = [enums.Shape.Rounded, enums.Shape.Pill];
137
- const handleSelection = (value, { parent: x }) => {
138
- return x.selectedIndex = Number(value) - 1;
139
- };
140
- const handleKeyDown = (value, { event, parent }) => {
141
- if (event.key === " " || event.key === "Enter") {
142
- handleSelection(value, { parent });
143
- }
144
- if (event.key === "Tab") {
145
- event.target.dispatchEvent(
146
- new CustomEvent("tabpressed", {
147
- detail: { value, shiftKey: event.shiftKey },
148
- bubbles: true,
149
- composed: true
150
- })
151
- );
152
- }
153
- };
154
- const getClasses = (_) => classNames.classNames("control");
155
- function getButtonAppearance(value, { parent }) {
156
- return parent.selectedIndex === Number(value) - 1 ? "filled" : "ghost";
157
- }
158
- const paginationButtonRenderer = (buttonTag) => index.html` ${when.when(
159
- (value) => value !== "...",
160
- index.html`
161
- <${buttonTag} class="vwc-pagination-button"
162
- label="${(value) => value}"
163
- appearance="${getButtonAppearance}"
164
- size="${(_, { parent: x }) => getPaginationSize(x)}"
165
- shape="${(_, { parent: x }) => getPaginationShape(x)}"
166
- style="inline-size: ${(value) => getPaginationButtonWidth(value)};"
167
- tabindex="0"
168
- aria-current="${(value, { parent }) => parent.selectedIndex === Number(value) - 1}"
169
- @click="${handleSelection}"
170
- @keydown="${handleKeyDown}">
171
- </${buttonTag}>
172
- `
173
- )}
174
- ${when.when(
175
- (value) => value === "...",
176
- index.html` <div class="dots size-${(_, { parent: x }) => getPaginationSize(x)}">
177
- ...
178
- </div>`
179
- )}`;
180
- const getPaginationSize = (x) => {
181
- if (!x.size || !ALLOWED_SIZES.includes(x.size)) {
182
- return enums.Size.SuperCondensed;
183
- }
184
- return x.size;
185
- };
186
- const getPaginationShape = (x) => {
187
- if (!x.shape || !ALLOWED_SHAPES.includes(x.shape)) {
188
- return enums.Shape.Rounded;
189
- }
190
- return x.shape;
191
- };
192
- const getPaginationButtonWidth = (value) => {
193
- return `calc(var(--base-size) + ${String(value).length - 1}ch)`;
194
- };
195
- const PaginationTemplate = (context) => {
196
- const buttonTag = context.tagFor(definition.Button);
197
- const paginationButtonTemplate = paginationButtonRenderer(buttonTag);
246
+ const getClasses = ({ icon, disabled, selected, checked }) => classNames.classNames(
247
+ "base",
248
+ ["disabled", disabled],
249
+ ["selected", Boolean(selected)],
250
+ ["active", Boolean(checked)],
251
+ ["icon", Boolean(icon)]
252
+ );
253
+ const ListboxOptionTemplate = (context) => {
254
+ const affixIconTemplate = affix.affixIconTemplateFactory(context);
198
255
  return index.html`
199
- <div class="${getClasses}">
200
- <${buttonTag} class="prev-button" ${ref.ref("prevButton")}
201
- label="${(x) => !x.navIcons ? "Previous" : null}"
202
- icon="${(x) => x.navIcons ? "chevron-left-line" : null}"
203
- size="${getPaginationSize}"
204
- shape="${getPaginationShape}"
205
- ?disabled="${(x) => x.total === 0 || x.selectedIndex === 0}"
206
- @click="${(x) => x.selectedIndex !== void 0 && x.selectedIndex--}"
207
- ></${buttonTag}>
208
- <div id="buttons-wrapper" class="buttons-wrapper" ${children.children({
209
- property: "paginationButtons",
210
- filter: slotted.elements(buttonTag)
211
- })}>
212
- ${repeat.repeat((x) => x.pagesList, paginationButtonTemplate, { positioning: true })}
213
- </div>
214
- <${buttonTag} class="next-button" ${ref.ref("nextButton")}
215
- label="${(x) => !x.navIcons ? "Next" : null}"
216
- icon="${(x) => x.navIcons ? "chevron-right-line" : null}"
217
- size="${getPaginationSize}"
218
- shape="${getPaginationShape}"
219
- ?disabled="${(x) => x.total === 0 || x.selectedIndex === x.total - 1}"
220
- @click="${(x) => x.selectedIndex !== void 0 && x.selectedIndex++}"
221
- ></${buttonTag}>
222
- </div>`;
256
+ <template
257
+ aria-checked="${(x) => x.ariaChecked}"
258
+ aria-disabled="${(x) => x.ariaDisabled}"
259
+ aria-posinset="${(x) => x.ariaPosInSet}"
260
+ aria-selected="${(x) => x.ariaSelected}"
261
+ aria-setsize="${(x) => x.ariaSetSize}"
262
+ role="option"
263
+ >
264
+ <div class="${getClasses}">
265
+ ${(x) => affixIconTemplate(x.icon, affix.IconWrapper.Slot)}
266
+ ${when.when((x) => x.text, index.html`<div class="text">${(x) => x.text}</div>`)}
267
+ </div>
268
+ </template>
269
+ `;
223
270
  };
224
271
 
225
- const paginationDefinition = Pagination.compose({
226
- baseName: "pagination",
227
- template: PaginationTemplate,
272
+ const styles = ":host([disabled]){cursor:not-allowed}.base{display:flex;box-sizing:border-box;align-items:center;border-radius:8px;background-color:var(--_appearance-color-fill);box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);color:var(--_option-appearance-color-text, var(--_appearance-color-text));font:var(--vvd-typography-base);gap:12px;hyphens:auto;inline-size:100%;min-block-size:calc(1px*(40 + 4*clamp(-1,var(--vvd-size-density, 0),2)));padding-inline:16px;vertical-align:middle;word-break:break-word}.base{--_connotation-color-primary: var(--vvd-option-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-option-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-option-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-firm: var(--vvd-option-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-faint: var(--vvd-option-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-option-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-pale: var(--vvd-option-accent-pale, var(--vvd-color-neutral-300));--_connotation-color-dim: var(--vvd-option-accent-dim, var(--vvd-color-neutral-200))}.base{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.base:where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.active,:active):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.base:where(.selected):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.base:where(.selected):where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}@supports (user-select: none){.base{user-select:none}}.base:not(.disabled){cursor:pointer}.base.disabled{pointer-events:none}.base .text{font:var(--vvd-typography-base)}:host([aria-checked=true]) .base{--focus-stroke-color: var(--vvd-color-neutral-500);--focus-stroke-gap-color: transparent;box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px))}slot[name=icon]{font-size:20px;line-height:1}.base:not(.disabled,.selected) slot[name=icon]{color:var(--vvd-color-neutral-600)}\n";
273
+
274
+ const listboxOptionDefinition = ListboxOption.compose({
275
+ baseName: "option",
276
+ template: ListboxOptionTemplate,
228
277
  styles
229
278
  });
230
- const paginationRegistries = [paginationDefinition(), definition.buttonRegistries];
231
- const registerPagination = index.registerFactory(paginationRegistries);
279
+ const listboxOptionRegistries = [
280
+ listboxOptionDefinition(),
281
+ ...definition.iconRegistries
282
+ ];
283
+ const registerOption = index.registerFactory(listboxOptionRegistries);
232
284
 
233
- exports.paginationDefinition = paginationDefinition;
234
- exports.paginationRegistries = paginationRegistries;
235
- exports.registerPagination = registerPagination;
285
+ exports.ListboxOption = ListboxOption;
286
+ exports.isListboxOption = isListboxOption;
287
+ exports.listboxOptionDefinition = listboxOptionDefinition;
288
+ exports.listboxOptionRegistries = listboxOptionRegistries;
289
+ exports.registerOption = registerOption;