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