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