@vonage/vivid 3.0.0-test.0 → 3.0.1

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 (325) hide show
  1. package/README.md +176 -4
  2. package/accordion/index.js +22 -61
  3. package/accordion-item/index.js +16 -123
  4. package/action-group/index.js +5 -0
  5. package/avatar/index.js +11 -0
  6. package/badge/index.js +9 -60
  7. package/banner/index.js +20 -208
  8. package/breadcrumb/index.js +7 -96
  9. package/breadcrumb-item/index.js +15 -48
  10. package/button/index.js +19 -758
  11. package/calendar/index.js +5 -1519
  12. package/calendar-event/index.js +9 -0
  13. package/card/index.js +13 -0
  14. package/checkbox/index.js +16 -0
  15. package/combobox/index.js +35 -0
  16. package/dialog/index.js +24 -0
  17. package/divider/index.js +6 -0
  18. package/elevation/index.js +4 -30
  19. package/fab/index.js +22 -0
  20. package/focus/index.js +4 -2
  21. package/header/index.js +6 -0
  22. package/icon/index.js +8 -32
  23. package/index.js +76 -25
  24. package/layout/index.js +4 -52
  25. package/lib/accordion/accordion.d.ts +3 -7
  26. package/lib/accordion/accordion.template.d.ts +1 -2
  27. package/lib/accordion/definition.d.ts +1 -0
  28. package/lib/accordion/index.d.ts +1 -2
  29. package/lib/accordion-item/accordion-item.d.ts +4 -8
  30. package/lib/accordion-item/accordion-item.template.d.ts +4 -4
  31. package/lib/accordion-item/definition.d.ts +1 -0
  32. package/lib/accordion-item/index.d.ts +1 -3
  33. package/lib/action-group/action-group.d.ts +10 -0
  34. package/lib/{sidenav-item/sidenav-item.template.d.ts → action-group/action-group.template.d.ts} +2 -2
  35. package/lib/action-group/definition.d.ts +1 -0
  36. package/lib/action-group/index.d.ts +1 -0
  37. package/lib/avatar/avatar.d.ts +15 -0
  38. package/lib/avatar/avatar.template.d.ts +4 -0
  39. package/lib/avatar/definition.d.ts +1 -0
  40. package/lib/avatar/index.d.ts +1 -0
  41. package/lib/badge/badge.d.ts +4 -6
  42. package/lib/badge/definition.d.ts +3 -0
  43. package/lib/badge/index.d.ts +1 -3
  44. package/lib/banner/banner.d.ts +1 -1
  45. package/lib/banner/banner.template.d.ts +0 -2
  46. package/lib/banner/definition.d.ts +1 -0
  47. package/lib/banner/index.d.ts +1 -2
  48. package/lib/breadcrumb/breadcrumb.template.d.ts +4 -0
  49. package/lib/breadcrumb/definition.d.ts +1 -0
  50. package/lib/breadcrumb/index.d.ts +1 -2
  51. package/lib/breadcrumb-item/breadcrumb-item.d.ts +1 -1
  52. package/lib/breadcrumb-item/definition.d.ts +1 -0
  53. package/lib/breadcrumb-item/index.d.ts +1 -3
  54. package/lib/button/button.d.ts +4 -3
  55. package/lib/button/definition.d.ts +1 -0
  56. package/lib/button/index.d.ts +1 -21
  57. package/lib/calendar/calendar.d.ts +3 -1
  58. package/lib/calendar/definition.d.ts +1 -0
  59. package/lib/calendar/index.d.ts +1 -3
  60. package/lib/calendar-event/calendar-event.d.ts +14 -0
  61. package/lib/calendar-event/calendar-event.template.d.ts +4 -0
  62. package/lib/calendar-event/definition.d.ts +1 -0
  63. package/lib/calendar-event/index.d.ts +1 -0
  64. package/lib/card/card.d.ts +10 -0
  65. package/lib/{text/text.template.d.ts → card/card.template.d.ts} +2 -2
  66. package/lib/card/definition.d.ts +1 -0
  67. package/lib/card/index.d.ts +1 -0
  68. package/lib/checkbox/checkbox.d.ts +5 -0
  69. package/lib/checkbox/checkbox.template.d.ts +4 -0
  70. package/lib/checkbox/definition.d.ts +1 -0
  71. package/lib/checkbox/index.d.ts +1 -0
  72. package/lib/combobox/combobox.d.ts +14 -0
  73. package/lib/combobox/combobox.template.d.ts +4 -0
  74. package/lib/combobox/definition.d.ts +3 -0
  75. package/lib/combobox/index.d.ts +1 -0
  76. package/lib/components.d.ts +44 -16
  77. package/lib/dialog/definition.d.ts +1 -0
  78. package/lib/dialog/dialog.d.ts +23 -0
  79. package/lib/dialog/dialog.template.d.ts +4 -0
  80. package/lib/dialog/index.d.ts +1 -0
  81. package/lib/divider/definition.d.ts +1 -0
  82. package/lib/divider/divider.d.ts +3 -0
  83. package/lib/divider/divider.template.d.ts +4 -0
  84. package/lib/divider/index.d.ts +1 -0
  85. package/lib/elevation/definition.d.ts +1 -0
  86. package/lib/elevation/elevation.d.ts +1 -0
  87. package/lib/elevation/index.d.ts +1 -2
  88. package/lib/enums.d.ts +20 -6
  89. package/lib/fab/definition.d.ts +3 -0
  90. package/lib/fab/fab.d.ts +13 -0
  91. package/lib/fab/fab.template.d.ts +4 -0
  92. package/lib/fab/index.d.ts +1 -0
  93. package/lib/focus/definition.d.ts +3 -0
  94. package/lib/focus/index.d.ts +1 -2
  95. package/lib/{sidenav-item/index.d.ts → header/definition.d.ts} +2 -2
  96. package/lib/header/header.d.ts +5 -0
  97. package/lib/header/header.template.d.ts +4 -0
  98. package/lib/header/index.d.ts +1 -0
  99. package/lib/icon/definition.d.ts +3 -0
  100. package/lib/icon/icon.d.ts +5 -6
  101. package/lib/icon/index.d.ts +1 -2
  102. package/lib/layout/definition.d.ts +3 -0
  103. package/lib/layout/index.d.ts +1 -2
  104. package/lib/layout/layout.d.ts +4 -4
  105. package/lib/listbox/definition.d.ts +3 -0
  106. package/lib/listbox/index.d.ts +1 -0
  107. package/lib/listbox/listbox.d.ts +6 -0
  108. package/lib/listbox/listbox.template.d.ts +4 -0
  109. package/lib/menu/definition.d.ts +11 -0
  110. package/lib/menu/index.d.ts +1 -0
  111. package/lib/menu/menu.d.ts +10 -0
  112. package/lib/menu/menu.template.d.ts +3 -0
  113. package/lib/menu-item/definition.d.ts +3 -0
  114. package/lib/menu-item/index.d.ts +1 -0
  115. package/lib/menu-item/menu-item.d.ts +8 -0
  116. package/lib/menu-item/menu-item.template.d.ts +5 -0
  117. package/lib/nav/definition.d.ts +3 -0
  118. package/lib/nav/index.d.ts +1 -0
  119. package/lib/nav/nav.d.ts +3 -0
  120. package/lib/nav/nav.template.d.ts +4 -0
  121. package/lib/nav-disclosure/definition.d.ts +3 -0
  122. package/lib/nav-disclosure/index.d.ts +1 -0
  123. package/lib/nav-disclosure/nav-disclosure.d.ts +10 -0
  124. package/lib/nav-disclosure/nav-disclosure.template.d.ts +4 -0
  125. package/lib/nav-item/definition.d.ts +3 -0
  126. package/lib/nav-item/index.d.ts +1 -0
  127. package/lib/{sidenav-item/sidenav-item.d.ts → nav-item/nav-item.d.ts} +2 -2
  128. package/lib/nav-item/nav-item.template.d.ts +4 -0
  129. package/lib/note/definition.d.ts +3 -0
  130. package/lib/note/index.d.ts +1 -0
  131. package/lib/note/note.d.ts +10 -0
  132. package/lib/note/note.template.d.ts +4 -0
  133. package/lib/number-field/definition.d.ts +4 -0
  134. package/lib/number-field/index.d.ts +1 -0
  135. package/lib/number-field/number-field.d.ts +14 -0
  136. package/lib/number-field/number-field.template.d.ts +4 -0
  137. package/lib/option/definition.d.ts +3 -0
  138. package/lib/option/index.d.ts +1 -0
  139. package/lib/option/option.d.ts +9 -0
  140. package/lib/option/option.template.d.ts +4 -0
  141. package/lib/popup/definition.d.ts +4 -0
  142. package/lib/popup/index.d.ts +1 -4
  143. package/lib/popup/popup.d.ts +8 -4
  144. package/lib/progress/definition.d.ts +3 -0
  145. package/lib/progress/index.d.ts +1 -2
  146. package/lib/progress/progress.d.ts +1 -1
  147. package/lib/progress-ring/definition.d.ts +3 -0
  148. package/lib/progress-ring/index.d.ts +1 -2
  149. package/lib/progress-ring/progress-ring.d.ts +2 -1
  150. package/lib/radio/definition.d.ts +3 -0
  151. package/lib/radio/index.d.ts +1 -0
  152. package/lib/radio/radio.d.ts +4 -0
  153. package/lib/radio/radio.template.d.ts +4 -0
  154. package/lib/radio-group/definition.d.ts +11 -0
  155. package/lib/radio-group/index.d.ts +1 -0
  156. package/lib/radio-group/radio-group.d.ts +4 -0
  157. package/lib/radio-group/radio-group.template.d.ts +4 -0
  158. package/lib/select/definition.d.ts +3 -0
  159. package/lib/select/index.d.ts +1 -0
  160. package/lib/select/select.d.ts +17 -0
  161. package/lib/select/select.template.d.ts +4 -0
  162. package/lib/side-drawer/definition.d.ts +3 -0
  163. package/lib/side-drawer/index.d.ts +1 -2
  164. package/lib/side-drawer/side-drawer.d.ts +3 -2
  165. package/lib/slider/definition.d.ts +3 -0
  166. package/lib/slider/index.d.ts +1 -0
  167. package/lib/slider/slider.d.ts +4 -0
  168. package/lib/slider/slider.template.d.ts +4 -0
  169. package/lib/switch/definition.d.ts +3 -0
  170. package/lib/switch/index.d.ts +1 -0
  171. package/lib/switch/switch.d.ts +7 -0
  172. package/lib/switch/switch.template.d.ts +4 -0
  173. package/lib/tab/definition.d.ts +3 -0
  174. package/lib/tab/index.d.ts +1 -0
  175. package/lib/tab/tab.d.ts +9 -0
  176. package/lib/tab/tab.template.d.ts +3 -0
  177. package/lib/tab-panel/definition.d.ts +3 -0
  178. package/lib/tab-panel/index.d.ts +1 -0
  179. package/lib/tab-panel/tab-panel.d.ts +3 -0
  180. package/lib/tab-panel/tab-panel.template.d.ts +2 -0
  181. package/lib/tabs/definition.d.ts +3 -0
  182. package/lib/tabs/index.d.ts +1 -0
  183. package/lib/tabs/tabs.d.ts +10 -0
  184. package/lib/tabs/tabs.template.d.ts +2 -0
  185. package/lib/text-anchor/definition.d.ts +3 -0
  186. package/lib/text-anchor/index.d.ts +1 -2
  187. package/lib/text-anchor/text-anchor.d.ts +1 -1
  188. package/lib/text-area/definition.d.ts +3 -0
  189. package/lib/text-area/index.d.ts +1 -0
  190. package/lib/text-area/text-area.d.ts +9 -0
  191. package/lib/text-area/text-area.template.d.ts +4 -0
  192. package/lib/text-field/definition.d.ts +3 -0
  193. package/lib/text-field/index.d.ts +1 -0
  194. package/lib/text-field/text-field.d.ts +14 -0
  195. package/lib/text-field/text-field.template.d.ts +4 -0
  196. package/lib/tooltip/definition.d.ts +3 -0
  197. package/lib/tooltip/index.d.ts +1 -3
  198. package/lib/tooltip/tooltip.d.ts +7 -7
  199. package/listbox/index.js +27 -0
  200. package/menu/index.js +30 -0
  201. package/menu-item/index.js +20 -0
  202. package/nav/index.js +4 -0
  203. package/nav-disclosure/index.js +17 -0
  204. package/nav-item/index.js +22 -0
  205. package/note/index.js +15 -0
  206. package/number-field/index.js +459 -0
  207. package/option/index.js +21 -0
  208. package/package.json +29 -19
  209. package/popup/index.js +21 -2061
  210. package/progress/index.js +6 -97
  211. package/progress-ring/index.js +6 -75
  212. package/radio/index.js +12 -0
  213. package/radio-group/index.js +11 -0
  214. package/select/index.js +34 -0
  215. package/shared/affix.js +2 -8
  216. package/shared/anchor.js +10 -2
  217. package/shared/apply-mixins.js +5 -4
  218. package/shared/aria-global.js +2 -86
  219. package/shared/aria.js +9 -0
  220. package/shared/base-progress.js +5 -0
  221. package/shared/breadcrumb-item.js +1 -1
  222. package/shared/button.js +200 -0
  223. package/shared/calendar-event.js +19 -0
  224. package/shared/definition.js +225 -0
  225. package/shared/definition10.js +99 -0
  226. package/shared/definition11.js +48 -0
  227. package/shared/definition12.js +1523 -0
  228. package/shared/definition13.js +111 -0
  229. package/shared/definition14.js +114 -0
  230. package/shared/definition15.js +32 -0
  231. package/shared/definition16.js +172 -0
  232. package/shared/definition17.js +727 -0
  233. package/shared/definition18.js +1842 -0
  234. package/shared/definition19.js +261 -0
  235. package/shared/definition2.js +150 -0
  236. package/shared/definition20.js +221 -0
  237. package/shared/definition21.js +78 -0
  238. package/shared/definition22.js +87 -0
  239. package/shared/definition23.js +58 -0
  240. package/shared/definition24.js +44 -0
  241. package/shared/definition25.js +58 -0
  242. package/shared/definition26.js +348 -0
  243. package/shared/definition27.js +363 -0
  244. package/shared/definition28.js +21 -0
  245. package/shared/definition29.js +75 -0
  246. package/shared/definition3.js +29 -0
  247. package/shared/definition30.js +31 -0
  248. package/shared/definition31.js +49 -0
  249. package/shared/definition32.js +94 -0
  250. package/shared/definition33.js +77 -0
  251. package/shared/definition34.js +45 -0
  252. package/shared/definition35.js +435 -0
  253. package/shared/definition36.js +634 -0
  254. package/shared/definition37.js +86 -0
  255. package/shared/definition38.js +592 -0
  256. package/shared/definition39.js +147 -0
  257. package/shared/definition4.js +19 -0
  258. package/shared/definition40.js +67 -0
  259. package/shared/definition41.js +32 -0
  260. package/shared/definition42.js +440 -0
  261. package/shared/definition43.js +282 -0
  262. package/shared/definition44.js +119 -0
  263. package/shared/definition45.js +77 -0
  264. package/shared/definition5.js +38 -0
  265. package/shared/definition6.js +60 -0
  266. package/shared/definition7.js +45 -0
  267. package/shared/definition8.js +113 -0
  268. package/shared/definition9.js +107 -0
  269. package/shared/design-system/index.d.ts +1 -1
  270. package/shared/dialog-polyfill.esm.js +858 -0
  271. package/shared/direction.js +20 -0
  272. package/shared/dom.js +8 -0
  273. package/shared/enums.js +70 -0
  274. package/shared/es.object.assign.js +2 -2
  275. package/shared/es.regexp.to-string.js +59 -0
  276. package/shared/focus.js +5 -0
  277. package/shared/focus2.js +11 -0
  278. package/shared/form-associated.js +466 -0
  279. package/shared/form-elements.js +127 -0
  280. package/shared/icon.js +538 -572
  281. package/shared/index.js +1664 -83
  282. package/shared/key-codes.js +97 -0
  283. package/shared/listbox.js +995 -0
  284. package/shared/numbers.js +34 -0
  285. package/shared/patterns/affix.d.ts +1 -1
  286. package/shared/patterns/focus.d.ts +3 -0
  287. package/shared/patterns/form-elements/form-elements.d.ts +43 -0
  288. package/shared/patterns/form-elements/index.d.ts +1 -0
  289. package/shared/patterns/index.d.ts +2 -0
  290. package/shared/radio.js +127 -0
  291. package/shared/ref.js +41 -0
  292. package/shared/select.options.js +10 -0
  293. package/shared/start-end.js +50 -0
  294. package/shared/string-trim.js +40 -0
  295. package/shared/strings.js +9 -0
  296. package/shared/text-anchor.js +2 -13
  297. package/shared/text-anchor.template.js +6 -5
  298. package/shared/text-field.js +3 -0
  299. package/shared/text-field2.js +225 -0
  300. package/shared/to-string.js +51 -0
  301. package/side-drawer/index.js +5 -80
  302. package/slider/index.js +17 -0
  303. package/styles/core/all.css +83 -0
  304. package/styles/core/theme.css +11 -0
  305. package/styles/core/typography.css +77 -0
  306. package/styles/tokens/theme-dark.css +228 -0
  307. package/styles/tokens/theme-light.css +228 -0
  308. package/switch/index.js +18 -0
  309. package/tab/index.js +16 -0
  310. package/tab-panel/index.js +4 -0
  311. package/tabs/index.js +24 -0
  312. package/text-anchor/index.js +11 -5
  313. package/text-area/index.js +23 -0
  314. package/text-field/index.js +24 -0
  315. package/tooltip/index.js +18 -57
  316. package/lib/text/index.d.ts +0 -2
  317. package/lib/text/text.d.ts +0 -10
  318. package/shared/index2.js +0 -21
  319. package/shared/style-inject.es.js +0 -28
  320. package/shared/web.dom-collections.iterator.js +0 -1479
  321. package/sidenav-item/index.js +0 -38
  322. package/styles/fonts/spezia.css +0 -23
  323. package/styles/themes/dark.css +0 -205
  324. package/styles/themes/light.css +0 -205
  325. package/text/index.js +0 -45
@@ -0,0 +1,727 @@
1
+ import { W as DOM, O as Observable, _ as __decorate, a as attr, o as observable, b as __metadata, h as html, r as registerFactory } from './index.js';
2
+ import { i as iconRegistries } from './definition3.js';
3
+ import { P as Popup, p as popupRegistries } from './definition18.js';
4
+ import { f as focusRegistries } from './definition4.js';
5
+ import { l as listboxOptionRegistries } from './definition19.js';
6
+ import { c as css_248z$1 } from './text-field.js';
7
+ import { b as AffixIcon, a as affixIconTemplateFactory } from './affix.js';
8
+ import './focus.js';
9
+ import { f as formElements } from './form-elements.js';
10
+ import { L as Listbox, D as DelegatesARIAListbox, a as Listbox$1 } from './listbox.js';
11
+ import { S as StartEnd } from './start-end.js';
12
+ import { S as SelectPosition } from './select.options.js';
13
+ import { a as applyMixins } from './apply-mixins.js';
14
+ import { F as FormAssociated } from './form-associated.js';
15
+ import { l as limit } from './numbers.js';
16
+ import { u as uniqueId } from './strings.js';
17
+ import { f as focusTemplateFactory } from './focus2.js';
18
+ import { s as slotted } from './slotted.js';
19
+ import { r as ref } from './ref.js';
20
+ import { w as when } from './when.js';
21
+ import { c as classNames } from './class-names.js';
22
+
23
+ class _Combobox extends Listbox {
24
+ }
25
+ /**
26
+ * A form-associated base class for the {@link (Combobox:class)} component.
27
+ *
28
+ * @internal
29
+ */
30
+ class FormAssociatedCombobox extends FormAssociated(_Combobox) {
31
+ constructor() {
32
+ super(...arguments);
33
+ this.proxy = document.createElement("input");
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Autocomplete values for combobox.
39
+ * @public
40
+ */
41
+ const ComboboxAutocomplete = {
42
+ inline: "inline",
43
+ list: "list",
44
+ both: "both",
45
+ none: "none",
46
+ };
47
+
48
+ /**
49
+ * A Combobox Custom HTML Element.
50
+ * Implements the {@link https://w3c.github.io/aria-practices/#combobox | ARIA combobox }.
51
+ *
52
+ * @slot start - Content which can be provided before the input
53
+ * @slot end - Content which can be provided after the input
54
+ * @slot control - Used to replace the input element representing the combobox
55
+ * @slot indicator - The visual indicator representing the expanded state
56
+ * @slot - The default slot for the options
57
+ * @csspart control - The wrapper element containing the input area, including start and end
58
+ * @csspart selected-value - The input element representing the selected value
59
+ * @csspart indicator - The element wrapping the indicator slot
60
+ * @csspart listbox - The wrapper for the listbox slotted options
61
+ * @fires change - Fires a custom 'change' event when the value updates
62
+ *
63
+ * @public
64
+ */
65
+ class Combobox$1 extends FormAssociatedCombobox {
66
+ constructor() {
67
+ super(...arguments);
68
+ /**
69
+ * The internal value property.
70
+ *
71
+ * @internal
72
+ */
73
+ this._value = "";
74
+ /**
75
+ * The collection of currently filtered options.
76
+ *
77
+ * @public
78
+ */
79
+ this.filteredOptions = [];
80
+ /**
81
+ * The current filter value.
82
+ *
83
+ * @internal
84
+ */
85
+ this.filter = "";
86
+ /**
87
+ * The initial state of the position attribute.
88
+ *
89
+ * @internal
90
+ */
91
+ this.forcedPosition = false;
92
+ /**
93
+ * The unique id for the internal listbox element.
94
+ *
95
+ * @internal
96
+ */
97
+ this.listboxId = uniqueId("listbox-");
98
+ /**
99
+ * The max height for the listbox when opened.
100
+ *
101
+ * @internal
102
+ */
103
+ this.maxHeight = 0;
104
+ /**
105
+ * The open attribute.
106
+ *
107
+ * @public
108
+ * @remarks
109
+ * HTML Attribute: open
110
+ */
111
+ this.open = false;
112
+ }
113
+ /**
114
+ * Reset the element to its first selectable option when its parent form is reset.
115
+ *
116
+ * @internal
117
+ */
118
+ formResetCallback() {
119
+ super.formResetCallback();
120
+ this.setDefaultSelectedOption();
121
+ this.updateValue();
122
+ }
123
+ /** {@inheritDoc (FormAssociated:interface).validate} */
124
+ validate() {
125
+ super.validate(this.control);
126
+ }
127
+ get isAutocompleteInline() {
128
+ return (this.autocomplete === ComboboxAutocomplete.inline || this.isAutocompleteBoth);
129
+ }
130
+ get isAutocompleteList() {
131
+ return this.autocomplete === ComboboxAutocomplete.list || this.isAutocompleteBoth;
132
+ }
133
+ get isAutocompleteBoth() {
134
+ return this.autocomplete === ComboboxAutocomplete.both;
135
+ }
136
+ /**
137
+ * Sets focus and synchronize ARIA attributes when the open property changes.
138
+ *
139
+ * @param prev - the previous open value
140
+ * @param next - the current open value
141
+ *
142
+ * @internal
143
+ */
144
+ openChanged() {
145
+ if (this.open) {
146
+ this.ariaControls = this.listboxId;
147
+ this.ariaExpanded = "true";
148
+ this.setPositioning();
149
+ this.focusAndScrollOptionIntoView();
150
+ // focus is directed to the element when `open` is changed programmatically
151
+ DOM.queueUpdate(() => this.focus());
152
+ return;
153
+ }
154
+ this.ariaControls = "";
155
+ this.ariaExpanded = "false";
156
+ }
157
+ /**
158
+ * The list of options.
159
+ *
160
+ * @public
161
+ * @remarks
162
+ * Overrides `Listbox.options`.
163
+ */
164
+ get options() {
165
+ Observable.track(this, "options");
166
+ return this.filteredOptions.length ? this.filteredOptions : this._options;
167
+ }
168
+ set options(value) {
169
+ this._options = value;
170
+ Observable.notify(this, "options");
171
+ }
172
+ /**
173
+ * Updates the placeholder on the proxy element.
174
+ * @internal
175
+ */
176
+ placeholderChanged() {
177
+ if (this.proxy instanceof HTMLInputElement) {
178
+ this.proxy.placeholder = this.placeholder;
179
+ }
180
+ }
181
+ positionChanged(prev, next) {
182
+ this.positionAttribute = next;
183
+ this.setPositioning();
184
+ }
185
+ /**
186
+ * The value property.
187
+ *
188
+ * @public
189
+ */
190
+ get value() {
191
+ Observable.track(this, "value");
192
+ return this._value;
193
+ }
194
+ set value(next) {
195
+ var _a, _b, _c;
196
+ const prev = `${this._value}`;
197
+ if (this.$fastController.isConnected && this.options) {
198
+ const selectedIndex = this.options.findIndex(el => el.text.toLowerCase() === next.toLowerCase());
199
+ const prevSelectedValue = (_a = this.options[this.selectedIndex]) === null || _a === void 0 ? void 0 : _a.text;
200
+ const nextSelectedValue = (_b = this.options[selectedIndex]) === null || _b === void 0 ? void 0 : _b.text;
201
+ this.selectedIndex =
202
+ prevSelectedValue !== nextSelectedValue
203
+ ? selectedIndex
204
+ : this.selectedIndex;
205
+ next = ((_c = this.firstSelectedOption) === null || _c === void 0 ? void 0 : _c.text) || next;
206
+ }
207
+ if (prev !== next) {
208
+ this._value = next;
209
+ super.valueChanged(prev, next);
210
+ Observable.notify(this, "value");
211
+ }
212
+ }
213
+ /**
214
+ * Handle opening and closing the listbox when the combobox is clicked.
215
+ *
216
+ * @param e - the mouse event
217
+ * @internal
218
+ */
219
+ clickHandler(e) {
220
+ if (this.disabled) {
221
+ return;
222
+ }
223
+ if (this.open) {
224
+ const captured = e.target.closest(`option,[role=option]`);
225
+ if (!captured || captured.disabled) {
226
+ return;
227
+ }
228
+ this.selectedOptions = [captured];
229
+ this.control.value = captured.text;
230
+ this.clearSelectionRange();
231
+ this.updateValue(true);
232
+ }
233
+ this.open = !this.open;
234
+ if (this.open) {
235
+ this.control.focus();
236
+ }
237
+ return true;
238
+ }
239
+ connectedCallback() {
240
+ super.connectedCallback();
241
+ this.forcedPosition = !!this.positionAttribute;
242
+ if (this.value) {
243
+ this.initialValue = this.value;
244
+ }
245
+ }
246
+ /**
247
+ * Synchronize the `aria-disabled` property when the `disabled` property changes.
248
+ *
249
+ * @param prev - The previous disabled value
250
+ * @param next - The next disabled value
251
+ *
252
+ * @internal
253
+ */
254
+ disabledChanged(prev, next) {
255
+ if (super.disabledChanged) {
256
+ super.disabledChanged(prev, next);
257
+ }
258
+ this.ariaDisabled = this.disabled ? "true" : "false";
259
+ }
260
+ /**
261
+ * Filter available options by text value.
262
+ *
263
+ * @public
264
+ */
265
+ filterOptions() {
266
+ if (!this.autocomplete || this.autocomplete === ComboboxAutocomplete.none) {
267
+ this.filter = "";
268
+ }
269
+ const filter = this.filter.toLowerCase();
270
+ this.filteredOptions = this._options.filter(o => o.text.toLowerCase().startsWith(this.filter.toLowerCase()));
271
+ if (this.isAutocompleteList) {
272
+ if (!this.filteredOptions.length && !filter) {
273
+ this.filteredOptions = this._options;
274
+ }
275
+ this._options.forEach(o => {
276
+ o.hidden = !this.filteredOptions.includes(o);
277
+ });
278
+ }
279
+ }
280
+ /**
281
+ * Focus the control and scroll the first selected option into view.
282
+ *
283
+ * @internal
284
+ * @remarks
285
+ * Overrides: `Listbox.focusAndScrollOptionIntoView`
286
+ */
287
+ focusAndScrollOptionIntoView() {
288
+ if (this.contains(document.activeElement)) {
289
+ this.control.focus();
290
+ if (this.firstSelectedOption) {
291
+ requestAnimationFrame(() => {
292
+ var _a;
293
+ (_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ block: "nearest" });
294
+ });
295
+ }
296
+ }
297
+ }
298
+ /**
299
+ * Handle focus state when the element or its children lose focus.
300
+ *
301
+ * @param e - The focus event
302
+ * @internal
303
+ */
304
+ focusoutHandler(e) {
305
+ this.syncValue();
306
+ if (!this.open) {
307
+ return true;
308
+ }
309
+ const focusTarget = e.relatedTarget;
310
+ if (this.isSameNode(focusTarget)) {
311
+ this.focus();
312
+ return;
313
+ }
314
+ if (!this.options || !this.options.includes(focusTarget)) {
315
+ this.open = false;
316
+ }
317
+ }
318
+ /**
319
+ * Handle content changes on the control input.
320
+ *
321
+ * @param e - the input event
322
+ * @internal
323
+ */
324
+ inputHandler(e) {
325
+ this.filter = this.control.value;
326
+ this.filterOptions();
327
+ if (!this.isAutocompleteInline) {
328
+ this.selectedIndex = this.options
329
+ .map(option => option.text)
330
+ .indexOf(this.control.value);
331
+ }
332
+ if (e.inputType.includes("deleteContent") || !this.filter.length) {
333
+ return true;
334
+ }
335
+ if (this.isAutocompleteList && !this.open) {
336
+ this.open = true;
337
+ }
338
+ if (this.isAutocompleteInline) {
339
+ if (this.filteredOptions.length) {
340
+ this.selectedOptions = [this.filteredOptions[0]];
341
+ this.selectedIndex = this.options.indexOf(this.firstSelectedOption);
342
+ this.setInlineSelection();
343
+ }
344
+ else {
345
+ this.selectedIndex = -1;
346
+ }
347
+ }
348
+ return;
349
+ }
350
+ /**
351
+ * Handle keydown actions for listbox navigation.
352
+ *
353
+ * @param e - the keyboard event
354
+ * @internal
355
+ */
356
+ keydownHandler(e) {
357
+ const key = e.key;
358
+ if (e.ctrlKey || e.shiftKey) {
359
+ return true;
360
+ }
361
+ switch (key) {
362
+ case "Enter": {
363
+ this.syncValue();
364
+ if (this.isAutocompleteInline) {
365
+ this.filter = this.value;
366
+ }
367
+ this.open = false;
368
+ this.clearSelectionRange();
369
+ break;
370
+ }
371
+ case "Escape": {
372
+ if (!this.isAutocompleteInline) {
373
+ this.selectedIndex = -1;
374
+ }
375
+ if (this.open) {
376
+ this.open = false;
377
+ break;
378
+ }
379
+ this.value = "";
380
+ this.control.value = "";
381
+ this.filter = "";
382
+ this.filterOptions();
383
+ break;
384
+ }
385
+ case "Tab": {
386
+ this.setInputToSelection();
387
+ if (!this.open) {
388
+ return true;
389
+ }
390
+ e.preventDefault();
391
+ this.open = false;
392
+ break;
393
+ }
394
+ case "ArrowUp":
395
+ case "ArrowDown": {
396
+ this.filterOptions();
397
+ if (!this.open) {
398
+ this.open = true;
399
+ break;
400
+ }
401
+ if (this.filteredOptions.length > 0) {
402
+ super.keydownHandler(e);
403
+ }
404
+ if (this.isAutocompleteInline) {
405
+ this.setInlineSelection();
406
+ }
407
+ break;
408
+ }
409
+ default: {
410
+ return true;
411
+ }
412
+ }
413
+ }
414
+ /**
415
+ * Handle keyup actions for value input and text field manipulations.
416
+ *
417
+ * @param e - the keyboard event
418
+ * @internal
419
+ */
420
+ keyupHandler(e) {
421
+ const key = e.key;
422
+ switch (key) {
423
+ case "ArrowLeft":
424
+ case "ArrowRight":
425
+ case "Backspace":
426
+ case "Delete":
427
+ case "Home":
428
+ case "End": {
429
+ this.filter = this.control.value;
430
+ this.selectedIndex = -1;
431
+ this.filterOptions();
432
+ break;
433
+ }
434
+ }
435
+ }
436
+ /**
437
+ * Ensure that the selectedIndex is within the current allowable filtered range.
438
+ *
439
+ * @param prev - the previous selected index value
440
+ * @param next - the current selected index value
441
+ *
442
+ * @internal
443
+ */
444
+ selectedIndexChanged(prev, next) {
445
+ if (this.$fastController.isConnected) {
446
+ next = limit(-1, this.options.length - 1, next);
447
+ // we only want to call the super method when the selectedIndex is in range
448
+ if (next !== this.selectedIndex) {
449
+ this.selectedIndex = next;
450
+ return;
451
+ }
452
+ super.selectedIndexChanged(prev, next);
453
+ }
454
+ }
455
+ /**
456
+ * Move focus to the previous selectable option.
457
+ *
458
+ * @internal
459
+ * @remarks
460
+ * Overrides `Listbox.selectPreviousOption`
461
+ */
462
+ selectPreviousOption() {
463
+ if (!this.disabled && this.selectedIndex >= 0) {
464
+ this.selectedIndex = this.selectedIndex - 1;
465
+ }
466
+ }
467
+ /**
468
+ * Set the default selected options at initialization or reset.
469
+ *
470
+ * @internal
471
+ * @remarks
472
+ * Overrides `Listbox.setDefaultSelectedOption`
473
+ */
474
+ setDefaultSelectedOption() {
475
+ if (this.$fastController.isConnected && this.options) {
476
+ const selectedIndex = this.options.findIndex(el => el.getAttribute("selected") !== null || el.selected);
477
+ this.selectedIndex = selectedIndex;
478
+ if (!this.dirtyValue && this.firstSelectedOption) {
479
+ this.value = this.firstSelectedOption.text;
480
+ }
481
+ this.setSelectedOptions();
482
+ }
483
+ }
484
+ /**
485
+ * Focus and set the content of the control based on the first selected option.
486
+ *
487
+ * @internal
488
+ */
489
+ setInputToSelection() {
490
+ if (this.firstSelectedOption) {
491
+ this.control.value = this.firstSelectedOption.text;
492
+ this.control.focus();
493
+ }
494
+ }
495
+ /**
496
+ * Focus, set and select the content of the control based on the first selected option.
497
+ *
498
+ * @internal
499
+ */
500
+ setInlineSelection() {
501
+ if (this.firstSelectedOption) {
502
+ this.setInputToSelection();
503
+ this.control.setSelectionRange(this.filter.length, this.control.value.length, "backward");
504
+ }
505
+ }
506
+ /**
507
+ * Determines if a value update should involve emitting a change event, then updates the value.
508
+ *
509
+ * @internal
510
+ */
511
+ syncValue() {
512
+ var _a;
513
+ const newValue = this.selectedIndex > -1 ? (_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.text : this.control.value;
514
+ this.updateValue(this.value !== newValue);
515
+ }
516
+ /**
517
+ * Calculate and apply listbox positioning based on available viewport space.
518
+ *
519
+ * @param force - direction to force the listbox to display
520
+ * @public
521
+ */
522
+ setPositioning() {
523
+ const currentBox = this.getBoundingClientRect();
524
+ const viewportHeight = window.innerHeight;
525
+ const availableBottom = viewportHeight - currentBox.bottom;
526
+ this.position = this.forcedPosition
527
+ ? this.positionAttribute
528
+ : currentBox.top > availableBottom
529
+ ? SelectPosition.above
530
+ : SelectPosition.below;
531
+ this.positionAttribute = this.forcedPosition
532
+ ? this.positionAttribute
533
+ : this.position;
534
+ this.maxHeight =
535
+ this.position === SelectPosition.above ? ~~currentBox.top : ~~availableBottom;
536
+ }
537
+ /**
538
+ * Ensure that the entire list of options is used when setting the selected property.
539
+ *
540
+ * @param prev - the previous list of selected options
541
+ * @param next - the current list of selected options
542
+ *
543
+ * @internal
544
+ * @remarks
545
+ * Overrides: `Listbox.selectedOptionsChanged`
546
+ */
547
+ selectedOptionsChanged(prev, next) {
548
+ if (this.$fastController.isConnected) {
549
+ this._options.forEach(o => {
550
+ o.selected = next.includes(o);
551
+ });
552
+ }
553
+ }
554
+ /**
555
+ * Synchronize the form-associated proxy and update the value property of the element.
556
+ *
557
+ * @param prev - the previous collection of slotted option elements
558
+ * @param next - the next collection of slotted option elements
559
+ *
560
+ * @internal
561
+ */
562
+ slottedOptionsChanged(prev, next) {
563
+ super.slottedOptionsChanged(prev, next);
564
+ this.updateValue();
565
+ }
566
+ /**
567
+ * Sets the value and to match the first selected option.
568
+ *
569
+ * @param shouldEmit - if true, the change event will be emitted
570
+ *
571
+ * @internal
572
+ */
573
+ updateValue(shouldEmit) {
574
+ var _a;
575
+ if (this.$fastController.isConnected) {
576
+ this.value = ((_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.text) || this.control.value;
577
+ this.control.value = this.value;
578
+ }
579
+ if (shouldEmit) {
580
+ this.$emit("change");
581
+ }
582
+ }
583
+ /**
584
+ * @internal
585
+ */
586
+ clearSelectionRange() {
587
+ const controlValueLength = this.control.value.length;
588
+ this.control.setSelectionRange(controlValueLength, controlValueLength);
589
+ }
590
+ }
591
+ __decorate([
592
+ attr({ attribute: "autocomplete", mode: "fromView" })
593
+ ], Combobox$1.prototype, "autocomplete", void 0);
594
+ __decorate([
595
+ observable
596
+ ], Combobox$1.prototype, "maxHeight", void 0);
597
+ __decorate([
598
+ attr({ attribute: "open", mode: "boolean" })
599
+ ], Combobox$1.prototype, "open", void 0);
600
+ __decorate([
601
+ attr
602
+ ], Combobox$1.prototype, "placeholder", void 0);
603
+ __decorate([
604
+ attr({ attribute: "position" })
605
+ ], Combobox$1.prototype, "positionAttribute", void 0);
606
+ __decorate([
607
+ observable
608
+ ], Combobox$1.prototype, "position", void 0);
609
+ /**
610
+ * Includes ARIA states and properties relating to the ARIA combobox role.
611
+ *
612
+ * @public
613
+ */
614
+ class DelegatesARIACombobox {
615
+ }
616
+ __decorate([
617
+ observable
618
+ ], DelegatesARIACombobox.prototype, "ariaAutoComplete", void 0);
619
+ __decorate([
620
+ observable
621
+ ], DelegatesARIACombobox.prototype, "ariaControls", void 0);
622
+ applyMixins(DelegatesARIACombobox, DelegatesARIAListbox);
623
+ applyMixins(Combobox$1, StartEnd, DelegatesARIACombobox);
624
+
625
+ var css_248z = "/**\n * Do not edit directly\n * Generated on Mon, 30 Jan 2023 11:28:31 GMT\n */\n:host {\n position: relative;\n}\n\n.control {\n display: flex;\n padding-inline-end: 44px;\n}\n\n.icon {\n inset-inline-end: 16px;\n inset-inline-start: unset;\n}\n:not(.disabled) .icon {\n cursor: pointer;\n}\n.disabled .icon {\n cursor: not-allowed;\n}\n\n.listbox {\n padding: 4px;\n background-color: var(--_appearance-color-fill);\n border-radius: 6px;\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n contain: paint;\n}\n.listbox {\n --_connotation-color-backdrop: var(--vvd-color-canvas);\n --_connotation-color-intermediate: var(--vvd-color-neutral-500);\n --_connotation-color-primary: var(--vvd-color-canvas-text);\n --_connotation-color-soft: var(--vvd-color-neutral-100);\n}\n.listbox {\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.listbox.appearance-ghost {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.listbox:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-400);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: var(--vvd-color-neutral-400);\n}\n.listbox:where(:disabled, .disabled).appearance-ghost {\n --_appearance-color-text: var(--vvd-color-neutral-400);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n\n.popup {\n --_popup-width: 100%;\n}";
626
+
627
+ let Combobox = class Combobox extends Combobox$1 {
628
+ connectedCallback() {
629
+ super.connectedCallback();
630
+ this._popup.anchor = this._anchor;
631
+ }
632
+ };
633
+ __decorate([attr, __metadata("design:type", String)], Combobox.prototype, "placement", void 0);
634
+ Combobox = __decorate([formElements], Combobox);
635
+ applyMixins(Combobox, AffixIcon);
636
+
637
+ let _ = t => t,
638
+ _t,
639
+ _t2,
640
+ _t3;
641
+ function renderLabel() {
642
+ return html(_t || (_t = _`
643
+ <label for="control" class="label">
644
+ ${0}
645
+ </label>`), x => x.label);
646
+ }
647
+ const getStateClasses = ({
648
+ disabled,
649
+ placeholder,
650
+ label
651
+ }) => classNames('base', ['disabled', disabled], ['placeholder', Boolean(placeholder)], ['no-label', !label]);
652
+ function renderInput(context) {
653
+ const affixIconTemplate = affixIconTemplateFactory(context);
654
+ const focusTemplate = focusTemplateFactory(context);
655
+ return html(_t2 || (_t2 = _`
656
+ <div class="${0}" ${0}>
657
+ ${0}
658
+ <div class="fieldset">
659
+ <input
660
+ id="control"
661
+ class="control"
662
+ aria-activedescendant="${0}"
663
+ aria-autocomplete="${0}"
664
+ aria-controls="${0}"
665
+ aria-disabled="${0}"
666
+ aria-expanded="${0}"
667
+ aria-haspopup="listbox"
668
+ placeholder="${0}"
669
+ role="combobox"
670
+ type="text"
671
+ ?disabled="${0}"
672
+ :value="${0}"
673
+ @input="${0}"
674
+ @keyup="${0}"
675
+ ${0}
676
+ />
677
+ ${0}
678
+ ${0}
679
+ </div>
680
+ </div>`), getStateClasses, ref('_anchor'), when(x => x.label, renderLabel()), x => x.open ? x.ariaActiveDescendant : null, x => x.ariaAutoComplete, x => x.ariaControls, x => x.ariaDisabled, x => x.ariaExpanded, x => x.placeholder, x => x.disabled, x => x.value, (x, c) => x.inputHandler(c.event), (x, c) => x.keyupHandler(c.event), ref('control'), () => affixIconTemplate('chevron-down-line'), () => focusTemplate);
681
+ }
682
+ const comboboxTemplate = context => {
683
+ const popupTag = context.tagFor(Popup);
684
+ return html(_t3 || (_t3 = _`
685
+ <template
686
+ aria-disabled="${0}"
687
+ autocomplete="${0}"
688
+ tabindex="${0}"
689
+ @click="${0}"
690
+ @focusout="${0}"
691
+ @keydown="${0}"
692
+ >
693
+ ${0}
694
+ <${0} class="popup"
695
+ ?open="${0}"
696
+ placement="${0}"
697
+ strategy="absolute"
698
+ ${0}>
699
+ <div id="${0}"
700
+ class="listbox"
701
+ role="listbox"
702
+ ?disabled="${0}"
703
+ ${0}>
704
+ <slot ${0}>
705
+ </slot>
706
+ </div>
707
+ </${0}>
708
+ </template>
709
+ `), x => x.ariaDisabled, x => x.autocomplete, x => !x.disabled ? '0' : null, (x, c) => x.clickHandler(c.event), (x, c) => x.focusoutHandler(c.event), (x, c) => x.keydownHandler(c.event), () => renderInput(context), popupTag, x => x.open, x => x.placement, ref('_popup'), x => x.listboxId, x => x.disabled, ref('listbox'), slotted({
710
+ filter: Listbox$1.slottedOptionFilter,
711
+ flatten: true,
712
+ property: 'slottedOptions'
713
+ }), popupTag);
714
+ };
715
+
716
+ const combobox = Combobox.compose({
717
+ baseName: 'combobox',
718
+ template: comboboxTemplate,
719
+ styles: [css_248z$1, css_248z],
720
+ shadowOptions: {
721
+ delegatesFocus: true
722
+ }
723
+ })();
724
+ const comboboxRegistries = [combobox, ...iconRegistries, ...popupRegistries, ...focusRegistries, ...listboxOptionRegistries];
725
+ const registerCombobox = registerFactory(comboboxRegistries);
726
+
727
+ export { comboboxRegistries as a, combobox as c, registerCombobox as r };