@vonage/vivid 3.51.0 → 3.53.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 (340) 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 +19 -11
  9. package/appearance-ui/index.js +19 -11
  10. package/audio-player/index.cjs +4 -3
  11. package/audio-player/index.js +4 -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 -8
  27. package/combobox/index.js +5 -8
  28. package/custom-elements.json +2310 -769
  29. package/data-grid/index.cjs +1 -1
  30. package/data-grid/index.js +1 -1
  31. package/date-picker/index.cjs +7 -9
  32. package/date-picker/index.js +7 -9
  33. package/date-range-picker/index.cjs +7 -9
  34. package/date-range-picker/index.js +7 -9
  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 -5
  48. package/file-picker/index.js +4 -5
  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 +135 -123
  54. package/index.js +48 -46
  55. package/layout/index.cjs +1 -1
  56. package/layout/index.js +1 -1
  57. package/lib/avatar/definition.d.ts +1 -1
  58. package/lib/button/button.d.ts +1 -0
  59. package/lib/button/definition.d.ts +1 -1
  60. package/lib/calendar-event/definition.d.ts +1 -1
  61. package/lib/components.d.ts +3 -0
  62. package/lib/dial-pad/definition.d.ts +3 -0
  63. package/lib/dial-pad/dial-pad.d.ts +14 -0
  64. package/lib/dial-pad/dial-pad.template.d.ts +4 -0
  65. package/lib/dial-pad/locale.d.ts +18 -0
  66. package/lib/enums.d.ts +6 -0
  67. package/lib/layout/definition.d.ts +1 -1
  68. package/lib/menu-item/menu-item.d.ts +3 -0
  69. package/lib/range-slider/definition.d.ts +3 -0
  70. package/lib/range-slider/locale.d.ts +4 -0
  71. package/lib/range-slider/range-slider.d.ts +32 -0
  72. package/lib/range-slider/range-slider.form-associated.d.ts +10 -0
  73. package/lib/range-slider/range-slider.template.d.ts +4 -0
  74. package/lib/range-slider/utils/lerp.d.ts +2 -0
  75. package/lib/range-slider/utils/roundToStepValue.d.ts +1 -0
  76. package/lib/slider/slider.template.d.ts +1 -0
  77. package/lib/split-button/definition.d.ts +1 -1
  78. package/lib/text-anchor/definition.d.ts +1 -0
  79. package/lib/text-anchor/text-anchor.d.ts +5 -0
  80. package/lib/video-player/definition.d.ts +3 -0
  81. package/lib/video-player/locale.d.ts +1 -0
  82. package/lib/video-player/video-player.d.ts +17 -0
  83. package/lib/video-player/video-player.template.d.ts +4 -0
  84. package/listbox/index.cjs +25 -24
  85. package/listbox/index.js +25 -24
  86. package/locales/en-GB.cjs +34 -0
  87. package/locales/en-GB.js +34 -0
  88. package/locales/en-US.cjs +202 -0
  89. package/locales/en-US.js +202 -0
  90. package/locales/ja-JP.cjs +202 -1
  91. package/locales/ja-JP.js +202 -1
  92. package/locales/zh-CN.cjs +203 -0
  93. package/locales/zh-CN.js +203 -0
  94. package/menu/index.cjs +7 -7
  95. package/menu/index.js +7 -7
  96. package/menu-item/index.cjs +4 -4
  97. package/menu-item/index.js +4 -4
  98. package/nav/index.cjs +1 -1
  99. package/nav/index.js +1 -1
  100. package/nav-disclosure/index.cjs +2 -2
  101. package/nav-disclosure/index.js +2 -2
  102. package/nav-item/index.cjs +2 -2
  103. package/nav-item/index.js +2 -2
  104. package/note/index.cjs +2 -2
  105. package/note/index.js +2 -2
  106. package/number-field/index.cjs +5 -6
  107. package/number-field/index.js +5 -6
  108. package/option/index.cjs +2 -2
  109. package/option/index.js +2 -2
  110. package/package.json +34 -34
  111. package/pagination/index.cjs +3 -3
  112. package/pagination/index.js +3 -3
  113. package/popup/index.cjs +4 -4
  114. package/popup/index.js +4 -4
  115. package/progress/index.cjs +1 -1
  116. package/progress/index.js +1 -1
  117. package/progress-ring/index.cjs +1 -1
  118. package/progress-ring/index.js +1 -1
  119. package/radio/index.cjs +1 -1
  120. package/radio/index.js +1 -1
  121. package/radio-group/index.cjs +1 -1
  122. package/radio-group/index.js +1 -1
  123. package/range-slider/index.cjs +22 -0
  124. package/range-slider/index.js +20 -0
  125. package/select/index.cjs +7 -6
  126. package/select/index.js +7 -6
  127. package/selectable-box/index.cjs +5 -4
  128. package/selectable-box/index.js +5 -4
  129. package/shared/Reflector.cjs +5 -1
  130. package/shared/Reflector.js +5 -1
  131. package/shared/affix.cjs +11 -4
  132. package/shared/affix.js +12 -4
  133. package/shared/anchored.cjs +8 -2
  134. package/shared/anchored.js +8 -2
  135. package/shared/applyMixinsWithObservables.cjs +15 -0
  136. package/shared/applyMixinsWithObservables.js +13 -0
  137. package/shared/definition.cjs +9 -4
  138. package/shared/definition.js +9 -4
  139. package/shared/definition10.cjs +5 -5
  140. package/shared/definition10.js +5 -5
  141. package/shared/definition11.cjs +77 -49
  142. package/shared/definition11.js +78 -50
  143. package/shared/definition12.cjs +12 -14
  144. package/shared/definition12.js +12 -14
  145. package/shared/definition13.cjs +118 -75
  146. package/shared/definition13.js +118 -75
  147. package/shared/definition14.cjs +34 -33
  148. package/shared/definition14.js +34 -33
  149. package/shared/definition15.cjs +24 -12
  150. package/shared/definition15.js +24 -12
  151. package/shared/definition16.cjs +38 -43
  152. package/shared/definition16.js +38 -43
  153. package/shared/definition17.cjs +126 -66
  154. package/shared/definition17.js +127 -67
  155. package/shared/definition18.cjs +31 -15
  156. package/shared/definition18.js +31 -15
  157. package/shared/definition19.cjs +117 -81
  158. package/shared/definition19.js +117 -81
  159. package/shared/definition2.cjs +10 -5
  160. package/shared/definition2.js +10 -5
  161. package/shared/definition20.cjs +187 -227
  162. package/shared/definition20.js +183 -223
  163. package/shared/definition21.cjs +262 -69
  164. package/shared/definition21.js +261 -67
  165. package/shared/definition22.cjs +66 -61
  166. package/shared/definition22.js +64 -60
  167. package/shared/definition23.cjs +42 -77
  168. package/shared/definition23.js +41 -76
  169. package/shared/definition24.cjs +65 -2350
  170. package/shared/definition24.js +64 -2349
  171. package/shared/definition25.cjs +2402 -48
  172. package/shared/definition25.js +2401 -47
  173. package/shared/definition26.cjs +62 -28
  174. package/shared/definition26.js +61 -27
  175. package/shared/definition27.cjs +28 -54
  176. package/shared/definition27.js +27 -53
  177. package/shared/definition28.cjs +39 -819
  178. package/shared/definition28.js +38 -817
  179. package/shared/definition29.cjs +893 -54
  180. package/shared/definition29.js +893 -55
  181. package/shared/definition3.cjs +7 -10
  182. package/shared/definition3.js +7 -10
  183. package/shared/definition30.cjs +69 -85
  184. package/shared/definition30.js +68 -84
  185. package/shared/definition31.cjs +86 -23
  186. package/shared/definition31.js +86 -23
  187. package/shared/definition32.cjs +24 -14
  188. package/shared/definition32.js +23 -13
  189. package/shared/definition33.cjs +11 -53
  190. package/shared/definition33.js +10 -52
  191. package/shared/definition34.cjs +28 -500
  192. package/shared/definition34.js +28 -500
  193. package/shared/definition35.cjs +447 -194
  194. package/shared/definition35.js +447 -192
  195. package/shared/definition36.cjs +258 -188
  196. package/shared/definition36.js +255 -187
  197. package/shared/definition37.cjs +204 -78
  198. package/shared/definition37.js +203 -76
  199. package/shared/definition38.cjs +55 -51
  200. package/shared/definition38.js +52 -49
  201. package/shared/definition39.cjs +65 -423
  202. package/shared/definition39.js +64 -422
  203. package/shared/definition4.cjs +24 -12
  204. package/shared/definition4.js +24 -12
  205. package/shared/definition40.cjs +447 -35
  206. package/shared/definition40.js +444 -32
  207. package/shared/definition41.cjs +35 -678
  208. package/shared/definition41.js +34 -677
  209. package/shared/definition42.cjs +544 -99
  210. package/shared/definition42.js +543 -98
  211. package/shared/definition43.cjs +696 -77
  212. package/shared/definition43.js +695 -76
  213. package/shared/definition44.cjs +113 -563
  214. package/shared/definition44.js +112 -561
  215. package/shared/definition45.cjs +77 -117
  216. package/shared/definition45.js +75 -115
  217. package/shared/definition46.cjs +474 -86
  218. package/shared/definition46.js +474 -87
  219. package/shared/definition47.cjs +140 -23
  220. package/shared/definition47.js +139 -22
  221. package/shared/definition48.cjs +132 -57
  222. package/shared/definition48.js +131 -56
  223. package/shared/definition49.cjs +18 -524
  224. package/shared/definition49.js +17 -523
  225. package/shared/definition5.cjs +20 -17
  226. package/shared/definition5.js +20 -17
  227. package/shared/definition50.cjs +73 -25
  228. package/shared/definition50.js +72 -24
  229. package/shared/definition51.cjs +506 -99
  230. package/shared/definition51.js +505 -99
  231. package/shared/definition52.cjs +29 -277
  232. package/shared/definition52.js +28 -276
  233. package/shared/definition53.cjs +97 -256
  234. package/shared/definition53.js +97 -255
  235. package/shared/definition54.cjs +287 -769
  236. package/shared/definition54.js +287 -769
  237. package/shared/definition55.cjs +305 -105
  238. package/shared/definition55.js +304 -104
  239. package/shared/definition56.cjs +841 -81
  240. package/shared/definition56.js +840 -80
  241. package/shared/definition57.cjs +153 -69
  242. package/shared/definition57.js +152 -68
  243. package/shared/definition58.cjs +138 -299
  244. package/shared/definition58.js +137 -298
  245. package/shared/definition59.cjs +72 -27
  246. package/shared/definition59.js +71 -26
  247. package/shared/definition6.cjs +4 -5
  248. package/shared/definition6.js +4 -5
  249. package/shared/definition60.cjs +279 -1780
  250. package/shared/definition60.js +278 -1779
  251. package/shared/definition61.cjs +65870 -11
  252. package/shared/definition61.js +65869 -11
  253. package/shared/definition62.cjs +50 -0
  254. package/shared/definition62.js +46 -0
  255. package/shared/definition63.cjs +1828 -0
  256. package/shared/definition63.js +1824 -0
  257. package/shared/definition7.cjs +8 -6
  258. package/shared/definition7.js +8 -6
  259. package/shared/definition8.cjs +27 -20
  260. package/shared/definition8.js +27 -20
  261. package/shared/definition9.cjs +7 -10
  262. package/shared/definition9.js +7 -10
  263. package/shared/enums.cjs +8 -0
  264. package/shared/enums.js +8 -1
  265. package/shared/icon.cjs +7 -2
  266. package/shared/icon.js +7 -2
  267. package/shared/index2.cjs +67 -38
  268. package/shared/index2.js +67 -38
  269. package/shared/key-codes2.cjs +8 -0
  270. package/shared/key-codes2.js +5 -1
  271. package/shared/listbox.cjs +1 -1
  272. package/shared/listbox.js +1 -1
  273. package/shared/localization/Locale.d.ts +6 -0
  274. package/shared/patterns/form-elements/form-elements.d.ts +2 -3
  275. package/shared/patterns/index.d.ts +0 -1
  276. package/shared/presentationDate.cjs +140 -81
  277. package/shared/presentationDate.js +140 -81
  278. package/shared/slider.template.cjs +71 -0
  279. package/shared/slider.template.js +67 -0
  280. package/shared/text-anchor.cjs +6 -0
  281. package/shared/text-anchor.js +6 -0
  282. package/shared/text-anchor.template.cjs +33 -33
  283. package/shared/text-anchor.template.js +33 -33
  284. package/shared/text-field.cjs +1 -1
  285. package/shared/text-field.js +1 -1
  286. package/shared/utils/applyMixinsWithObservables.d.ts +1 -0
  287. package/side-drawer/index.cjs +1 -1
  288. package/side-drawer/index.js +1 -1
  289. package/slider/index.cjs +2 -1
  290. package/slider/index.js +2 -1
  291. package/split-button/index.cjs +2 -2
  292. package/split-button/index.js +2 -2
  293. package/style.css +1 -0
  294. package/styles/core/all.css +1 -1
  295. package/styles/core/theme.css +1 -1
  296. package/styles/core/typography.css +1 -1
  297. package/styles/fonts/spezia-variable.css +39 -13
  298. package/styles/tokens/theme-dark.css +4 -4
  299. package/styles/tokens/theme-light.css +4 -4
  300. package/styles/tokens/vivid-2-compat.css +4 -2
  301. package/switch/index.cjs +2 -2
  302. package/switch/index.js +2 -2
  303. package/tab/index.cjs +2 -2
  304. package/tab/index.js +2 -2
  305. package/tab-panel/index.cjs +1 -1
  306. package/tab-panel/index.js +1 -1
  307. package/tabs/index.cjs +4 -4
  308. package/tabs/index.js +4 -4
  309. package/tag/index.cjs +2 -2
  310. package/tag/index.js +2 -2
  311. package/tag-group/index.cjs +1 -1
  312. package/tag-group/index.js +1 -1
  313. package/text-area/index.cjs +4 -3
  314. package/text-area/index.js +4 -3
  315. package/text-field/index.cjs +4 -6
  316. package/text-field/index.js +4 -6
  317. package/time-picker/index.cjs +8 -10
  318. package/time-picker/index.js +8 -10
  319. package/toggletip/index.cjs +5 -5
  320. package/toggletip/index.js +5 -5
  321. package/tooltip/index.cjs +5 -5
  322. package/tooltip/index.js +5 -5
  323. package/tree-item/index.cjs +2 -2
  324. package/tree-item/index.js +2 -2
  325. package/tree-view/index.cjs +1 -1
  326. package/tree-view/index.js +1 -1
  327. package/video-player/index.cjs +17 -0
  328. package/video-player/index.js +15 -0
  329. package/vivid.api.json +428 -1
  330. package/focus/index.cjs +0 -7
  331. package/focus/index.js +0 -5
  332. package/lib/focus/definition.d.ts +0 -3
  333. package/lib/focus/focus.d.ts +0 -3
  334. package/lib/focus/focus.template.d.ts +0 -4
  335. package/lib/popup/popup.d.ts +0 -21
  336. package/shared/focus.cjs +0 -8
  337. package/shared/focus.js +0 -6
  338. package/shared/focus2.cjs +0 -11
  339. package/shared/focus2.js +0 -9
  340. package/shared/patterns/focus.d.ts +0 -3
@@ -1,7 +1,521 @@
1
- import { a as attr, F as FoundationElement, h as html, r as registerFactory } from './index.js';
1
+ import { D as DOM, O as Observable, _ as __decorate, a as attr, v as volatile, o as observable, h as html, r as registerFactory } from './index.js';
2
+ import { P as Popup, p as popupRegistries } from './definition63.js';
3
+ import { a as iconRegistries } from './definition27.js';
4
+ import { L as ListboxOption, a as listboxOptionRegistries } from './definition36.js';
5
+ import { b as AffixIconWithTrailing, a as affixIconTemplateFactory, I as IconWrapper } from './affix.js';
6
+ import { e as errorText, f as formElements, F as FormElementSuccessText, a as FormElementHelperText, g as getFeedbackTemplate } from './index2.js';
7
+ import { L as ListboxElement, b as Listbox, D as DelegatesARIAListbox, a as Listbox$1 } from './listbox.js';
8
+ import { a as applyMixinsWithObservables } from './applyMixinsWithObservables.js';
9
+ import { S as StartEnd } from './start-end.js';
10
+ import { a as applyMixins } from './apply-mixins.js';
11
+ import { F as FormAssociated } from './form-associated.js';
12
+ import { S as SelectPosition } from './select.options.js';
13
+ import { u as uniqueId } from './strings.js';
14
+ import { c as keyTab, b as keyEscape, k as keyEnter, d as keyEnd, g as keyHome, a as keySpace, f as keyArrowDown, e as keyArrowUp } from './key-codes.js';
15
+ import { r as ref } from './ref.js';
2
16
  import { w as when } from './when.js';
17
+ import { s as slotted } from './slotted.js';
3
18
  import { c as classNames } from './class-names.js';
4
19
 
20
+ class _Select extends ListboxElement {
21
+ }
22
+ /**
23
+ * A form-associated base class for the {@link @microsoft/fast-foundation#(Select:class)} component.
24
+ *
25
+ * @internal
26
+ */
27
+ class FormAssociatedSelect extends FormAssociated(_Select) {
28
+ constructor() {
29
+ super(...arguments);
30
+ this.proxy = document.createElement("select");
31
+ }
32
+ }
33
+
34
+ /**
35
+ * A Select Custom HTML Element.
36
+ * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#select | ARIA select }.
37
+ *
38
+ * @slot start - Content which can be provided before the button content
39
+ * @slot end - Content which can be provided after the button content
40
+ * @slot button-container - The element representing the select button
41
+ * @slot selected-value - The selected value
42
+ * @slot indicator - The visual indicator for the expand/collapse state of the button
43
+ * @slot - The default slot for slotted options
44
+ * @csspart control - The element representing the select invoking element
45
+ * @csspart selected-value - The element wrapping the selected value
46
+ * @csspart indicator - The element wrapping the visual indicator
47
+ * @csspart listbox - The listbox element
48
+ * @fires input - Fires a custom 'input' event when the value updates
49
+ * @fires change - Fires a custom 'change' event when the value updates
50
+ *
51
+ * @public
52
+ */
53
+ let Select$1 = class Select extends FormAssociatedSelect {
54
+ constructor() {
55
+ super(...arguments);
56
+ /**
57
+ * The open attribute.
58
+ *
59
+ * @public
60
+ * @remarks
61
+ * HTML Attribute: open
62
+ */
63
+ this.open = false;
64
+ /**
65
+ * Indicates the initial state of the position attribute.
66
+ *
67
+ * @internal
68
+ */
69
+ this.forcedPosition = false;
70
+ /**
71
+ * The unique id for the internal listbox element.
72
+ *
73
+ * @internal
74
+ */
75
+ this.listboxId = uniqueId("listbox-");
76
+ /**
77
+ * The max height for the listbox when opened.
78
+ *
79
+ * @internal
80
+ */
81
+ this.maxHeight = 0;
82
+ }
83
+ /**
84
+ * Sets focus and synchronizes ARIA attributes when the open property changes.
85
+ *
86
+ * @param prev - the previous open value
87
+ * @param next - the current open value
88
+ *
89
+ * @internal
90
+ */
91
+ openChanged(prev, next) {
92
+ if (!this.collapsible) {
93
+ return;
94
+ }
95
+ if (this.open) {
96
+ this.ariaControls = this.listboxId;
97
+ this.ariaExpanded = "true";
98
+ this.setPositioning();
99
+ this.focusAndScrollOptionIntoView();
100
+ this.indexWhenOpened = this.selectedIndex;
101
+ // focus is directed to the element when `open` is changed programmatically
102
+ DOM.queueUpdate(() => this.focus());
103
+ return;
104
+ }
105
+ this.ariaControls = "";
106
+ this.ariaExpanded = "false";
107
+ }
108
+ /**
109
+ * The component is collapsible when in single-selection mode with no size attribute.
110
+ *
111
+ * @internal
112
+ */
113
+ get collapsible() {
114
+ return !(this.multiple || typeof this.size === "number");
115
+ }
116
+ /**
117
+ * The value property.
118
+ *
119
+ * @public
120
+ */
121
+ get value() {
122
+ Observable.track(this, "value");
123
+ return this._value;
124
+ }
125
+ set value(next) {
126
+ var _a, _b, _c, _d, _e, _f, _g;
127
+ const prev = `${this._value}`;
128
+ if ((_a = this._options) === null || _a === void 0 ? void 0 : _a.length) {
129
+ const selectedIndex = this._options.findIndex(el => el.value === next);
130
+ const prevSelectedValue = (_c = (_b = this._options[this.selectedIndex]) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : null;
131
+ const nextSelectedValue = (_e = (_d = this._options[selectedIndex]) === null || _d === void 0 ? void 0 : _d.value) !== null && _e !== void 0 ? _e : null;
132
+ if (selectedIndex === -1 || prevSelectedValue !== nextSelectedValue) {
133
+ next = "";
134
+ this.selectedIndex = selectedIndex;
135
+ }
136
+ next = (_g = (_f = this.firstSelectedOption) === null || _f === void 0 ? void 0 : _f.value) !== null && _g !== void 0 ? _g : next;
137
+ }
138
+ if (prev !== next) {
139
+ this._value = next;
140
+ super.valueChanged(prev, next);
141
+ Observable.notify(this, "value");
142
+ this.updateDisplayValue();
143
+ }
144
+ }
145
+ /**
146
+ * Sets the value and display value to match the first selected option.
147
+ *
148
+ * @param shouldEmit - if true, the input and change events will be emitted
149
+ *
150
+ * @internal
151
+ */
152
+ updateValue(shouldEmit) {
153
+ var _a, _b;
154
+ if (this.$fastController.isConnected) {
155
+ this.value = (_b = (_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "";
156
+ }
157
+ if (shouldEmit) {
158
+ this.$emit("input");
159
+ this.$emit("change", this, {
160
+ bubbles: true,
161
+ composed: undefined,
162
+ });
163
+ }
164
+ }
165
+ /**
166
+ * Updates the proxy value when the selected index changes.
167
+ *
168
+ * @param prev - the previous selected index
169
+ * @param next - the next selected index
170
+ *
171
+ * @internal
172
+ */
173
+ selectedIndexChanged(prev, next) {
174
+ super.selectedIndexChanged(prev, next);
175
+ this.updateValue();
176
+ }
177
+ positionChanged(prev, next) {
178
+ this.positionAttribute = next;
179
+ this.setPositioning();
180
+ }
181
+ /**
182
+ * Calculate and apply listbox positioning based on available viewport space.
183
+ *
184
+ * @public
185
+ */
186
+ setPositioning() {
187
+ const currentBox = this.getBoundingClientRect();
188
+ const viewportHeight = window.innerHeight;
189
+ const availableBottom = viewportHeight - currentBox.bottom;
190
+ this.position = this.forcedPosition
191
+ ? this.positionAttribute
192
+ : currentBox.top > availableBottom
193
+ ? SelectPosition.above
194
+ : SelectPosition.below;
195
+ this.positionAttribute = this.forcedPosition
196
+ ? this.positionAttribute
197
+ : this.position;
198
+ this.maxHeight =
199
+ this.position === SelectPosition.above ? ~~currentBox.top : ~~availableBottom;
200
+ }
201
+ /**
202
+ * The value displayed on the button.
203
+ *
204
+ * @public
205
+ */
206
+ get displayValue() {
207
+ var _a, _b;
208
+ Observable.track(this, "displayValue");
209
+ return (_b = (_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.text) !== null && _b !== void 0 ? _b : "";
210
+ }
211
+ /**
212
+ * Synchronize the `aria-disabled` property when the `disabled` property changes.
213
+ *
214
+ * @param prev - The previous disabled value
215
+ * @param next - The next disabled value
216
+ *
217
+ * @internal
218
+ */
219
+ disabledChanged(prev, next) {
220
+ if (super.disabledChanged) {
221
+ super.disabledChanged(prev, next);
222
+ }
223
+ this.ariaDisabled = this.disabled ? "true" : "false";
224
+ }
225
+ /**
226
+ * Reset the element to its first selectable option when its parent form is reset.
227
+ *
228
+ * @internal
229
+ */
230
+ formResetCallback() {
231
+ this.setProxyOptions();
232
+ // Call the base class's implementation setDefaultSelectedOption instead of the select's
233
+ // override, in order to reset the selectedIndex without using the value property.
234
+ super.setDefaultSelectedOption();
235
+ if (this.selectedIndex === -1) {
236
+ this.selectedIndex = 0;
237
+ }
238
+ }
239
+ /**
240
+ * Handle opening and closing the listbox when the select is clicked.
241
+ *
242
+ * @param e - the mouse event
243
+ * @internal
244
+ */
245
+ clickHandler(e) {
246
+ // do nothing if the select is disabled
247
+ if (this.disabled) {
248
+ return;
249
+ }
250
+ if (this.open) {
251
+ const captured = e.target.closest(`option,[role=option]`);
252
+ if (captured && captured.disabled) {
253
+ return;
254
+ }
255
+ }
256
+ super.clickHandler(e);
257
+ this.open = this.collapsible && !this.open;
258
+ if (!this.open && this.indexWhenOpened !== this.selectedIndex) {
259
+ this.updateValue(true);
260
+ }
261
+ return true;
262
+ }
263
+ /**
264
+ * Handles focus state when the element or its children lose focus.
265
+ *
266
+ * @param e - The focus event
267
+ * @internal
268
+ */
269
+ focusoutHandler(e) {
270
+ var _a;
271
+ super.focusoutHandler(e);
272
+ if (!this.open) {
273
+ return true;
274
+ }
275
+ const focusTarget = e.relatedTarget;
276
+ if (this.isSameNode(focusTarget)) {
277
+ this.focus();
278
+ return;
279
+ }
280
+ if (!((_a = this.options) === null || _a === void 0 ? void 0 : _a.includes(focusTarget))) {
281
+ this.open = false;
282
+ if (this.indexWhenOpened !== this.selectedIndex) {
283
+ this.updateValue(true);
284
+ }
285
+ }
286
+ }
287
+ /**
288
+ * Updates the value when an option's value changes.
289
+ *
290
+ * @param source - the source object
291
+ * @param propertyName - the property to evaluate
292
+ *
293
+ * @internal
294
+ * @override
295
+ */
296
+ handleChange(source, propertyName) {
297
+ super.handleChange(source, propertyName);
298
+ if (propertyName === "value") {
299
+ this.updateValue();
300
+ }
301
+ }
302
+ /**
303
+ * Synchronize the form-associated proxy and updates the value property of the element.
304
+ *
305
+ * @param prev - the previous collection of slotted option elements
306
+ * @param next - the next collection of slotted option elements
307
+ *
308
+ * @internal
309
+ */
310
+ slottedOptionsChanged(prev, next) {
311
+ this.options.forEach(o => {
312
+ const notifier = Observable.getNotifier(o);
313
+ notifier.unsubscribe(this, "value");
314
+ });
315
+ super.slottedOptionsChanged(prev, next);
316
+ this.options.forEach(o => {
317
+ const notifier = Observable.getNotifier(o);
318
+ notifier.subscribe(this, "value");
319
+ });
320
+ this.setProxyOptions();
321
+ this.updateValue();
322
+ }
323
+ /**
324
+ * Prevents focus when size is set and a scrollbar is clicked.
325
+ *
326
+ * @param e - the mouse event object
327
+ *
328
+ * @override
329
+ * @internal
330
+ */
331
+ mousedownHandler(e) {
332
+ var _a;
333
+ if (e.offsetX >= 0 && e.offsetX <= ((_a = this.listbox) === null || _a === void 0 ? void 0 : _a.scrollWidth)) {
334
+ return super.mousedownHandler(e);
335
+ }
336
+ return this.collapsible;
337
+ }
338
+ /**
339
+ * Sets the multiple property on the proxy element.
340
+ *
341
+ * @param prev - the previous multiple value
342
+ * @param next - the current multiple value
343
+ */
344
+ multipleChanged(prev, next) {
345
+ super.multipleChanged(prev, next);
346
+ if (this.proxy) {
347
+ this.proxy.multiple = next;
348
+ }
349
+ }
350
+ /**
351
+ * Updates the selectedness of each option when the list of selected options changes.
352
+ *
353
+ * @param prev - the previous list of selected options
354
+ * @param next - the current list of selected options
355
+ *
356
+ * @override
357
+ * @internal
358
+ */
359
+ selectedOptionsChanged(prev, next) {
360
+ var _a;
361
+ super.selectedOptionsChanged(prev, next);
362
+ (_a = this.options) === null || _a === void 0 ? void 0 : _a.forEach((o, i) => {
363
+ var _a;
364
+ const proxyOption = (_a = this.proxy) === null || _a === void 0 ? void 0 : _a.options.item(i);
365
+ if (proxyOption) {
366
+ proxyOption.selected = o.selected;
367
+ }
368
+ });
369
+ }
370
+ /**
371
+ * Sets the selected index to match the first option with the selected attribute, or
372
+ * the first selectable option.
373
+ *
374
+ * @override
375
+ * @internal
376
+ */
377
+ setDefaultSelectedOption() {
378
+ var _a;
379
+ const options = (_a = this.options) !== null && _a !== void 0 ? _a : Array.from(this.children).filter(Listbox.slottedOptionFilter);
380
+ const selectedIndex = options === null || options === void 0 ? void 0 : options.findIndex(el => el.hasAttribute("selected") || el.selected || el.value === this.value);
381
+ if (selectedIndex !== -1) {
382
+ this.selectedIndex = selectedIndex;
383
+ return;
384
+ }
385
+ this.selectedIndex = 0;
386
+ }
387
+ /**
388
+ * Resets and fills the proxy to match the component's options.
389
+ *
390
+ * @internal
391
+ */
392
+ setProxyOptions() {
393
+ if (this.proxy instanceof HTMLSelectElement && this.options) {
394
+ this.proxy.options.length = 0;
395
+ this.options.forEach(option => {
396
+ const proxyOption = option.proxy ||
397
+ (option instanceof HTMLOptionElement ? option.cloneNode() : null);
398
+ if (proxyOption) {
399
+ this.proxy.options.add(proxyOption);
400
+ }
401
+ });
402
+ }
403
+ }
404
+ /**
405
+ * Handle keyboard interaction for the select.
406
+ *
407
+ * @param e - the keyboard event
408
+ * @internal
409
+ */
410
+ keydownHandler(e) {
411
+ super.keydownHandler(e);
412
+ const key = e.key || e.key.charCodeAt(0);
413
+ switch (key) {
414
+ case keySpace: {
415
+ e.preventDefault();
416
+ if (this.collapsible && this.typeAheadExpired) {
417
+ this.open = !this.open;
418
+ }
419
+ break;
420
+ }
421
+ case keyHome:
422
+ case keyEnd: {
423
+ e.preventDefault();
424
+ break;
425
+ }
426
+ case keyEnter: {
427
+ e.preventDefault();
428
+ this.open = !this.open;
429
+ break;
430
+ }
431
+ case keyEscape: {
432
+ if (this.collapsible && this.open) {
433
+ e.preventDefault();
434
+ this.open = false;
435
+ }
436
+ break;
437
+ }
438
+ case keyTab: {
439
+ if (this.collapsible && this.open) {
440
+ e.preventDefault();
441
+ this.open = false;
442
+ }
443
+ return true;
444
+ }
445
+ }
446
+ if (!this.open && this.indexWhenOpened !== this.selectedIndex) {
447
+ this.updateValue(true);
448
+ this.indexWhenOpened = this.selectedIndex;
449
+ }
450
+ return !(key === keyArrowDown || key === keyArrowUp);
451
+ }
452
+ connectedCallback() {
453
+ super.connectedCallback();
454
+ this.forcedPosition = !!this.positionAttribute;
455
+ this.addEventListener("contentchange", this.updateDisplayValue);
456
+ }
457
+ disconnectedCallback() {
458
+ this.removeEventListener("contentchange", this.updateDisplayValue);
459
+ super.disconnectedCallback();
460
+ }
461
+ /**
462
+ * Updates the proxy's size property when the size attribute changes.
463
+ *
464
+ * @param prev - the previous size
465
+ * @param next - the current size
466
+ *
467
+ * @override
468
+ * @internal
469
+ */
470
+ sizeChanged(prev, next) {
471
+ super.sizeChanged(prev, next);
472
+ if (this.proxy) {
473
+ this.proxy.size = next;
474
+ }
475
+ }
476
+ /**
477
+ *
478
+ * @internal
479
+ */
480
+ updateDisplayValue() {
481
+ if (this.collapsible) {
482
+ Observable.notify(this, "displayValue");
483
+ }
484
+ }
485
+ };
486
+ __decorate([
487
+ attr({ attribute: "open", mode: "boolean" })
488
+ ], Select$1.prototype, "open", void 0);
489
+ __decorate([
490
+ volatile
491
+ ], Select$1.prototype, "collapsible", null);
492
+ __decorate([
493
+ observable
494
+ ], Select$1.prototype, "control", void 0);
495
+ __decorate([
496
+ attr({ attribute: "position" })
497
+ ], Select$1.prototype, "positionAttribute", void 0);
498
+ __decorate([
499
+ observable
500
+ ], Select$1.prototype, "position", void 0);
501
+ __decorate([
502
+ observable
503
+ ], Select$1.prototype, "maxHeight", void 0);
504
+ /**
505
+ * Includes ARIA states and properties relating to the ARIA select role.
506
+ *
507
+ * @public
508
+ */
509
+ class DelegatesARIASelect {
510
+ }
511
+ __decorate([
512
+ observable
513
+ ], DelegatesARIASelect.prototype, "ariaControls", void 0);
514
+ applyMixins(DelegatesARIASelect, DelegatesARIAListbox);
515
+ applyMixins(Select$1, StartEnd, DelegatesARIASelect);
516
+
517
+ const styles = ":host(:focus-visible){outline:none}:host{display:inline-flex;flex-direction:column;gap:4px;--_low-ink-color: var(--vvd-color-neutral-600);--focus-stroke-gap-color: transparent}:host([disabled]){--_low-ink-color: var(--vvd-color-neutral-400);cursor:not-allowed}.label{color:var(--vvd-color-canvas-text);contain:inline-size;font:var(--vvd-typography-base)}.control{display:flex;align-items:center;justify-content:space-between;border-radius:var(--_select-control-border-radius);background-color:var(--_appearance-color-fill);block-size:calc(1px*(40 + 4*clamp(-1,var(--vvd-size-density, 0),2)));box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);color:var(--_appearance-color-text);font:var(--vvd-typography-base);gap:8px;padding-inline:16px;transition:box-shadow .2s,background-color .2s}.control{--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-intermediate)}.control.appearance-ghost{--_appearance-color-text: var(--_connotation-color-primary);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.control:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-fierce)}.control:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)).appearance-ghost{--_appearance-color-text: var(--_connotation-color-primary);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.control:where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-100);--_appearance-color-outline: var(--vvd-color-neutral-300)}.control:where(.disabled,:disabled).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.control:where(.readonly):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: var(--vvd-color-neutral-400)}.control:where(.readonly):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-600);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.control:where(.error):where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: var(--vvd-color-alert-500)}.control:where(.error):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: transparent}.control:where(.success):where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: var(--vvd-color-success-500)}.control:where(.success):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: transparent}.control{--_connotation-color-primary: var(--vvd-select-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-select-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-select-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-intermediate: var(--vvd-select-accent-intermediate, var(--vvd-color-neutral-500));--_connotation-color-firm: var(--vvd-select-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-fierce: var(--vvd-select-accent-fierce, var(--vvd-color-neutral-700))}.control-wrapper{position:relative}.control:not(.disabled){cursor:pointer}.control.disabled{pointer-events:none}.control:not(.shape-pill){--_select-control-border-radius: 8px}.control.shape-pill{--_select-control-border-radius: 24px}:host(:focus-visible) .control{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))}.listbox{display:flex;max-height:var(--select-height, 408px);flex-direction:column;padding:4px;gap:2px;overflow-y:auto}:host([multiple]:focus-visible) .listbox{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));border-radius:8px}.icon{display:flex;flex-shrink:0}.selected-value{display:flex;overflow:hidden;flex-grow:1;align-items:center;column-gap:12px;white-space:nowrap}.selected-value .text{overflow:hidden;max-inline-size:100%;text-overflow:ellipsis}.selected-value slot[name=icon]{flex:0 0 20px;font-size:20px;line-height:1}.control.has-meta .selected-value{padding-inline-end:8px}.feedback-wrapper{display:contents}::part(popup-base){inline-size:max-content;min-inline-size:var(--_select-fixed-width, 100%)}:host([multiple]) ::part(popup-base){position:static}\n";
518
+
5
519
  var __defProp = Object.defineProperty;
6
520
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
521
  var __decorateClass = (decorators, target, key, kind) => {
@@ -13,97 +527,202 @@ var __decorateClass = (decorators, target, key, kind) => {
13
527
  __defProp(target, key, result);
14
528
  return result;
15
529
  };
16
- class SideDrawer extends FoundationElement {
530
+ let Select = class extends Select$1 {
17
531
  constructor() {
18
532
  super(...arguments);
19
- this.alternate = false;
20
- this.modal = false;
21
- this.open = false;
22
- this.trailing = false;
533
+ this.fixedDropdown = false;
534
+ this.placeholderOption = null;
535
+ this._feedbackWrapper = null;
23
536
  }
24
- attributeChangedCallback(name, oldValue, newValue) {
25
- super.attributeChangedCallback(name, oldValue, newValue);
26
- switch (name) {
27
- case "open": {
28
- this.open ? this.#open() : this.#close();
29
- }
30
- }
537
+ connectedCallback() {
538
+ super.connectedCallback();
31
539
  }
32
- #close() {
33
- this.$emit("close", void 0, { bubbles: false });
540
+ get displayValue() {
541
+ Observable.track(this, "displayValue");
542
+ return this.firstSelectedOption?.getAttribute("label") ?? this.firstSelectedOption?.text ?? this.placeholder ?? "";
34
543
  }
35
- #open() {
36
- this.$emit("open", void 0, { bubbles: false });
544
+ setDefaultSelectedOption() {
545
+ const options = Array.from(this.children).filter(
546
+ Listbox$1.slottedOptionFilter
547
+ );
548
+ const selectedIndex = options.findIndex(
549
+ (el) => el.hasAttribute("selected") || el.selected || el.value === this.value
550
+ );
551
+ if (selectedIndex === -1 && !this.placeholderOption) {
552
+ this.selectedIndex = 0;
553
+ return;
554
+ }
555
+ if (selectedIndex !== -1 || this.placeholder !== "") {
556
+ this.selectedIndex = selectedIndex;
557
+ return;
558
+ }
37
559
  }
38
- }
560
+ };
39
561
  __decorateClass([
40
- attr({
41
- mode: "boolean"
42
- })
43
- ], SideDrawer.prototype, "alternate", 2);
562
+ observable
563
+ ], Select.prototype, "_anchor", 2);
44
564
  __decorateClass([
45
- attr({
46
- mode: "boolean"
47
- })
48
- ], SideDrawer.prototype, "modal", 2);
565
+ attr
566
+ ], Select.prototype, "appearance", 2);
49
567
  __decorateClass([
50
- attr({
51
- mode: "boolean"
52
- })
53
- ], SideDrawer.prototype, "open", 2);
568
+ attr
569
+ ], Select.prototype, "shape", 2);
54
570
  __decorateClass([
55
- attr({
56
- mode: "boolean"
57
- })
58
- ], SideDrawer.prototype, "trailing", 2);
59
-
60
- const styles = ":host{display:block}.side-drawer-app-content{block-size:100%}.control{position:fixed;z-index:1;background-color:var(--vvd-color-canvas);color:var(--vvd-color-canvas-text);inline-size:280px;inset-block:0;overflow-y:auto}.control[part~=vvd-theme-alternate]{background-color:var(--vvd-color-canvas);color:var(--vvd-color-canvas-text);color-scheme:var(--vvd-color-scheme)}.control.trailing{inset-inline-end:0}.control:not(.open).trailing{transform:translate(100%)}.control:not(.open):not(.trailing){transform:translate(-100%)}.control.open:not(.modal).trailing+.side-drawer-app-content{margin-inline-end:var(--side-drawer-app-content-offset, 280px)}.control.open:not(.modal):not(.trailing)+.side-drawer-app-content{margin-inline-start:var(--side-drawer-app-content-offset, 280px)}@media (prefers-reduced-motion: no-preference){.control{transition:transform .2s cubic-bezier(.4,0,.2,1)}}.scrim{background-color:var(--vvd-color-canvas-text, currentColor);opacity:.5;position:fixed;inset:0}.scrim:not(.open){display:none}\n";
61
-
62
- const getClasses = ({
63
- modal,
64
- open,
65
- trailing
66
- }) => classNames(
67
- "control",
68
- ["modal", modal],
69
- ["open", open],
70
- ["trailing", trailing]
571
+ attr({ mode: "boolean", attribute: "fixed-dropdown" })
572
+ ], Select.prototype, "fixedDropdown", 2);
573
+ __decorateClass([
574
+ attr
575
+ ], Select.prototype, "placeholder", 2);
576
+ __decorateClass([
577
+ observable
578
+ ], Select.prototype, "placeholderOption", 2);
579
+ __decorateClass([
580
+ observable
581
+ ], Select.prototype, "_feedbackWrapper", 2);
582
+ __decorateClass([
583
+ observable
584
+ ], Select.prototype, "metaSlottedContent", 2);
585
+ Select = __decorateClass([
586
+ errorText,
587
+ formElements
588
+ ], Select);
589
+ applyMixinsWithObservables(
590
+ Select,
591
+ AffixIconWithTrailing,
592
+ FormElementHelperText,
593
+ FormElementSuccessText
71
594
  );
72
- const getScrimClasses = ({
73
- open
595
+
596
+ const getStateClasses = ({
597
+ shape,
598
+ disabled,
599
+ appearance,
600
+ metaSlottedContent,
601
+ errorValidationMessage,
602
+ successText
74
603
  }) => classNames(
75
- "scrim",
76
- ["open", open]
604
+ ["disabled", disabled],
605
+ [`appearance-${appearance}`, Boolean(appearance)],
606
+ [`shape-${shape}`, Boolean(shape)],
607
+ ["has-meta", Boolean(metaSlottedContent?.length)],
608
+ ["error", Boolean(errorValidationMessage)],
609
+ ["success", !!successText],
610
+ ["has-meta", Boolean(metaSlottedContent?.length)]
77
611
  );
78
- const sideDrawerTemplate = () => html`
79
- <div class="${getClasses}" ?inert="${(x) => !x.open}" part="base ${(x) => x.alternate ? "vvd-theme-alternate" : ""}"
80
- @keydown="${(x, c) => handleKeydown(x, c.event)}">
81
- <slot></slot>
82
- </div>
83
-
84
- <div class="side-drawer-app-content" ?inert="${(x) => x.open && x.modal}">
85
- <slot name="app-content"></slot>
86
- </div>
87
-
88
- ${when(
89
- (x) => x.modal,
90
- html`<div class="${getScrimClasses}" @click="${(x) => x.open = false}"></div>`
91
- )}
92
- `;
93
- const handleKeydown = (x, { key }) => {
94
- if (key === "Escape") {
95
- x.open = false;
96
- } else {
612
+ function renderLabel() {
613
+ return html` <label for="control" class="label" id="label">
614
+ ${(x) => x.label}
615
+ </label>`;
616
+ }
617
+ function renderPlaceholder(context) {
618
+ const optionTag = context.tagFor(ListboxOption);
619
+ return html`
620
+ <${optionTag} ${ref("placeholderOption")}
621
+ text="${(x) => x.placeholder}" hidden disabled>
622
+ </${optionTag}>`;
623
+ }
624
+ function selectValue(context) {
625
+ const affixIconTemplate = affixIconTemplateFactory(context);
626
+ return html` <div
627
+ class="control ${getStateClasses}"
628
+ ${ref("_anchor")}
629
+ id="control"
630
+ ?disabled="${(x) => x.disabled}"
631
+ >
632
+ <div class="selected-value">
633
+ ${(x) => affixIconTemplate(x.icon, IconWrapper.Slot)}
634
+ <span class="text">${(x) => x.displayValue}</span>
635
+ <slot name="meta" ${slotted("metaSlottedContent")}></slot>
636
+ </div>
637
+ ${() => affixIconTemplate("chevron-down-line")}
638
+ </div>`;
639
+ }
640
+ function setFixedDropdownVarWidth(x) {
641
+ return x.open && x.fixedDropdown ? `--_select-fixed-width: ${Math.round(x.getBoundingClientRect().width)}px` : null;
642
+ }
643
+ function renderControl(context) {
644
+ const popupTag = context.tagFor(Popup);
645
+ return html`
646
+ ${when((x) => x.label, renderLabel())}
647
+ <div class="control-wrapper">
648
+ ${when((x) => !x.multiple, selectValue(context))}
649
+ <${popupTag} class="popup"
650
+ style="${setFixedDropdownVarWidth}"
651
+ ?open="${(x) => x.collapsible ? x.open : true}"
652
+ :anchor="${(x) => x._anchor}"
653
+ placement="bottom-start"
654
+ strategy="${(x) => x.fixedDropdown ? null : "absolute"}">
655
+ <div class="listbox"
656
+ id="${(x) => x.listboxId}"
657
+ role="listbox"
658
+ ?disabled="${(x) => x.disabled}"
659
+ ?hidden="${(x) => x.collapsible ? !x.open : false}"
660
+ ${ref("listbox")}>
661
+ ${when((x) => x.placeholder, renderPlaceholder(context))}
662
+ <slot
663
+ ${slotted({
664
+ filter: Listbox$1.slottedOptionFilter,
665
+ flatten: true,
666
+ property: "slottedOptions"
667
+ })}>
668
+ </slot>
669
+ </div>
670
+ </${popupTag}>
671
+ </div>
672
+ `;
673
+ }
674
+ function ifNotFromFeedback(handler) {
675
+ return (x, c) => {
676
+ if (!c.event.composedPath().includes(x._feedbackWrapper)) {
677
+ return handler(x, c.event);
678
+ }
97
679
  return true;
98
- }
680
+ };
681
+ }
682
+ const SelectTemplate = (context) => {
683
+ return html`
684
+ <template
685
+ class="base"
686
+ aria-label="${(x) => x.ariaLabel}"
687
+ aria-activedescendant="${(x) => x.ariaActiveDescendant}"
688
+ aria-controls="${(x) => x.ariaControls}"
689
+ aria-disabled="${(x) => x.ariaDisabled}"
690
+ aria-expanded="${(x) => x.ariaExpanded}"
691
+ aria-haspopup="${(x) => x.collapsible ? "listbox" : null}"
692
+ aria-multiselectable="${(x) => x.ariaMultiSelectable}"
693
+ role="combobox"
694
+ tabindex="${(x) => !x.disabled ? "0" : null}"
695
+ @click="${ifNotFromFeedback((x, e) => x.clickHandler(e))}"
696
+ @focusin="${ifNotFromFeedback((x, e) => x.focusinHandler(e))}"
697
+ @focusout="${ifNotFromFeedback(
698
+ (x, e) => x.focusoutHandler(e)
699
+ )}"
700
+ @keydown="${ifNotFromFeedback(
701
+ (x, e) => x.keydownHandler(e)
702
+ )}"
703
+ @mousedown="${ifNotFromFeedback(
704
+ (x, e) => x.mousedownHandler(e)
705
+ )}"
706
+ >
707
+ ${renderControl(context)}
708
+ <div class="feedback-wrapper" ${ref("_feedbackWrapper")}>
709
+ ${getFeedbackTemplate(context)}
710
+ </div>
711
+ </template>
712
+ `;
99
713
  };
100
714
 
101
- const sideDrawerDefinition = SideDrawer.compose({
102
- baseName: "side-drawer",
103
- template: sideDrawerTemplate,
715
+ const selectDefinition = Select.compose({
716
+ baseName: "select",
717
+ template: SelectTemplate,
104
718
  styles
105
719
  });
106
- const sideDrawerRegistries = [sideDrawerDefinition()];
107
- const registerSideDrawer = registerFactory(sideDrawerRegistries);
720
+ const selectRegistries = [
721
+ selectDefinition(),
722
+ ...popupRegistries,
723
+ ...iconRegistries,
724
+ ...listboxOptionRegistries
725
+ ];
726
+ const registerSelect = registerFactory(selectRegistries);
108
727
 
109
- export { sideDrawerRegistries as a, registerSideDrawer as r, sideDrawerDefinition as s };
728
+ export { selectRegistries as a, registerSelect as r, selectDefinition as s };