@webquark/browser 1.1.0-dev.10 → 1.1.0-dev.11

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 (271) hide show
  1. package/dist/cjs/{action.props-N0urQtdP.js → action.props-DmLaQuU2.js} +1 -1
  2. package/dist/cjs/{field-CsrQGhG-.js → field-CEZ9NsWK.js} +1 -1
  3. package/dist/cjs/{index-DWXhKHCB.js → index-CMAcJ6t1.js} +1 -1
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/cjs/q-accordion.cjs.entry.js +1 -1
  6. package/dist/cjs/q-alert.cjs.entry.js +1 -1
  7. package/dist/cjs/q-avatar.cjs.entry.js +2 -2
  8. package/dist/cjs/q-banner.cjs.entry.js +1 -1
  9. package/dist/cjs/q-button_2.cjs.entry.js +4 -4
  10. package/dist/cjs/q-card.cjs.entry.js +2 -2
  11. package/dist/cjs/q-carousel.cjs.entry.js +1 -1
  12. package/dist/cjs/q-chip.cjs.entry.js +2 -2
  13. package/dist/cjs/q-conversation-bubble.cjs.entry.js +1 -1
  14. package/dist/cjs/q-data-table.cjs.entry.js +1 -1
  15. package/dist/cjs/q-dialog.cjs.entry.js +3 -3
  16. package/dist/cjs/q-divider.cjs.entry.js +26 -0
  17. package/dist/cjs/q-dropdown.cjs.entry.js +111 -92
  18. package/dist/cjs/q-form.cjs.entry.js +4 -4
  19. package/dist/cjs/q-grid.cjs.entry.js +3 -3
  20. package/dist/cjs/q-icon.cjs.entry.js +1 -1
  21. package/dist/cjs/q-image-comparison.cjs.entry.js +2 -2
  22. package/dist/cjs/q-inline.cjs.entry.js +3 -3
  23. package/dist/cjs/q-input_2.cjs.entry.js +8 -6
  24. package/dist/cjs/q-link.cjs.entry.js +2 -2
  25. package/dist/cjs/q-map.cjs.entry.js +1 -1
  26. package/dist/cjs/q-media.cjs.entry.js +2 -2
  27. package/dist/cjs/q-navbar.cjs.entry.js +3 -3
  28. package/dist/cjs/q-pagination.cjs.entry.js +1 -1
  29. package/dist/cjs/q-panel.cjs.entry.js +6 -6
  30. package/dist/cjs/q-quantity-selector.cjs.entry.js +5 -5
  31. package/dist/cjs/q-radio-group.cjs.entry.js +4 -4
  32. package/dist/cjs/q-reel.cjs.entry.js +3 -3
  33. package/dist/cjs/q-scrollable.cjs.entry.js +4 -4
  34. package/dist/cjs/q-section.cjs.entry.js +2 -2
  35. package/dist/cjs/q-sidepanel.cjs.entry.js +1 -1
  36. package/dist/cjs/q-stack.cjs.entry.js +3 -3
  37. package/dist/cjs/q-step-diagram-item.cjs.entry.js +1 -1
  38. package/dist/cjs/q-step-diagram.cjs.entry.js +1 -1
  39. package/dist/cjs/q-syntax-box.cjs.entry.js +1 -1
  40. package/dist/cjs/q-tabs.cjs.entry.js +2 -2
  41. package/dist/cjs/q-textarea.cjs.entry.js +7 -5
  42. package/dist/cjs/q-thumbnail.cjs.entry.js +3 -3
  43. package/dist/cjs/q-toast.cjs.entry.js +1 -1
  44. package/dist/cjs/q-toggle.cjs.entry.js +6 -6
  45. package/dist/cjs/q-toolbar.cjs.entry.js +4 -4
  46. package/dist/cjs/{tokens-RMRaIOqv.js → tokens-Cd7g-VMz.js} +3 -0
  47. package/dist/cjs/webquark.cjs.js +2 -2
  48. package/dist/collection/collection-manifest.json +1 -0
  49. package/dist/collection/components/inputs/dropdown/dropdown.css +33 -0
  50. package/dist/collection/components/inputs/dropdown/dropdown.js +158 -91
  51. package/dist/collection/components/inputs/dropdown/test/dropdown.cmp.test.js +28 -0
  52. package/dist/collection/components/inputs/dropdown/test/search-mode.cmp.test.js +186 -0
  53. package/dist/collection/components/inputs/form/form.js +2 -2
  54. package/dist/collection/components/inputs/form/test/form-submit.cmp.test.js +14 -8
  55. package/dist/collection/components/inputs/input/input.css +20 -0
  56. package/dist/collection/components/inputs/input/input.js +31 -3
  57. package/dist/collection/components/inputs/quantity-selector/quantity-selector.js +4 -4
  58. package/dist/collection/components/inputs/radio-group/radio-group.js +2 -2
  59. package/dist/collection/components/inputs/textarea/textarea.css +20 -0
  60. package/dist/collection/components/inputs/textarea/textarea.js +30 -2
  61. package/dist/collection/components/inputs/toggle/test/toggle-layout.cmp.test.js +69 -0
  62. package/dist/collection/components/inputs/toggle/toggle.css +5 -0
  63. package/dist/collection/components/inputs/toggle/toggle.js +3 -3
  64. package/dist/collection/components/layout/divider/divider.css +40 -0
  65. package/dist/collection/components/layout/divider/divider.js +121 -0
  66. package/dist/collection/components/layout/divider/test/divider.cmp.test.js +105 -0
  67. package/dist/collection/components/layout/grid/grid.js +1 -1
  68. package/dist/collection/components/layout/inline/inline.js +1 -1
  69. package/dist/collection/components/layout/navbar/navbar.js +2 -2
  70. package/dist/collection/components/layout/panel/panel.js +4 -4
  71. package/dist/collection/components/layout/scrollable/scrollable.js +3 -3
  72. package/dist/collection/components/layout/section/section.js +1 -1
  73. package/dist/collection/components/layout/stack/stack.js +1 -1
  74. package/dist/collection/components/layout/tabs/tabs.js +1 -1
  75. package/dist/collection/components/layout/toolbar/toolbar.js +2 -2
  76. package/dist/collection/components/media/avatar/avatar.js +1 -1
  77. package/dist/collection/components/media/image-comparison/image-comparison.js +1 -1
  78. package/dist/collection/components/media/media/media.js +1 -1
  79. package/dist/collection/components/media/reel/reel.js +2 -2
  80. package/dist/collection/components/media/thumbnail/thumbnail.js +2 -2
  81. package/dist/collection/components/overlays/dialog/dialog.js +2 -2
  82. package/dist/collection/components/overlays/tooltip/tooltip.js +2 -2
  83. package/dist/collection/theme/test/input-width.cmp.test.js +117 -0
  84. package/dist/collection/theme/test/presets.unit.test.js +20 -2
  85. package/dist/collection/theme/tokens.js +3 -0
  86. package/dist/components/index.js +1 -1
  87. package/dist/components/{p-Dfp_If-_.js → p--r63tfQH.js} +1 -1
  88. package/dist/components/{p-Cg0Mv7Vb.js → p-0feRVg70.js} +1 -1
  89. package/dist/components/p-BDsIecIx.js +1 -0
  90. package/dist/components/p-CLErjC1f.js +1 -0
  91. package/dist/{webquark/p-Dhsn99q4.js → components/p-CSucjZb7.js} +1 -1
  92. package/dist/components/{p-BH4gQWub.js → p-CYG3Oakz.js} +1 -1
  93. package/dist/components/{p-CKuPOxKN.js → p-DBbiaYqQ.js} +1 -1
  94. package/dist/components/{p-DlIn_ZWk.js → p-DbI_F3z0.js} +1 -1
  95. package/dist/components/p-cSh-5xis.js +1 -0
  96. package/dist/components/{p-6PPZ2sIO.js → p-iXEnb5d5.js} +1 -1
  97. package/dist/components/q-accordion.js +1 -1
  98. package/dist/components/q-alert.js +1 -1
  99. package/dist/components/q-avatar.js +1 -1
  100. package/dist/components/q-banner.js +1 -1
  101. package/dist/components/q-button.js +1 -1
  102. package/dist/components/q-card.js +1 -1
  103. package/dist/components/q-carousel.js +1 -1
  104. package/dist/components/q-chip.js +1 -1
  105. package/dist/components/q-conversation-bubble.js +1 -1
  106. package/dist/components/q-data-table.js +1 -1
  107. package/dist/components/q-dialog.js +1 -1
  108. package/dist/components/q-divider.d.ts +11 -0
  109. package/dist/components/q-divider.js +1 -0
  110. package/dist/components/q-dropdown.js +1 -1
  111. package/dist/components/q-form.js +1 -1
  112. package/dist/components/q-grid.js +1 -1
  113. package/dist/components/q-icon.js +1 -1
  114. package/dist/components/q-image-comparison.js +1 -1
  115. package/dist/components/q-inline.js +1 -1
  116. package/dist/components/q-input.js +1 -1
  117. package/dist/components/q-link.js +1 -1
  118. package/dist/components/q-map.js +1 -1
  119. package/dist/components/q-media.js +1 -1
  120. package/dist/components/q-navbar.js +1 -1
  121. package/dist/components/q-pagination.js +1 -1
  122. package/dist/components/q-panel.js +1 -1
  123. package/dist/components/q-progress.js +1 -1
  124. package/dist/components/q-quantity-selector.js +1 -1
  125. package/dist/components/q-radio-group.js +1 -1
  126. package/dist/components/q-reel.js +1 -1
  127. package/dist/components/q-scrollable.js +1 -1
  128. package/dist/components/q-section.js +1 -1
  129. package/dist/components/q-sidepanel.js +1 -1
  130. package/dist/components/q-stack.js +1 -1
  131. package/dist/components/q-step-diagram-item.js +1 -1
  132. package/dist/components/q-step-diagram.js +1 -1
  133. package/dist/components/q-syntax-box.js +2 -2
  134. package/dist/components/q-tabs.js +1 -1
  135. package/dist/components/q-textarea.js +1 -1
  136. package/dist/components/q-thumbnail.js +1 -1
  137. package/dist/components/q-toast.js +1 -1
  138. package/dist/components/q-toggle.js +1 -1
  139. package/dist/components/q-toolbar.js +1 -1
  140. package/dist/components/q-tooltip.js +1 -1
  141. package/dist/esm/{action.props-CpnGza8z.js → action.props-DhnvhbLl.js} +1 -1
  142. package/dist/esm/{field-zfD6OQ02.js → field-u-k7C7Rf.js} +1 -1
  143. package/dist/esm/{index-B5ElFlHv.js → index-DaJmsCb7.js} +1 -1
  144. package/dist/esm/loader.js +3 -3
  145. package/dist/esm/q-accordion.entry.js +1 -1
  146. package/dist/esm/q-alert.entry.js +1 -1
  147. package/dist/esm/q-avatar.entry.js +2 -2
  148. package/dist/esm/q-banner.entry.js +1 -1
  149. package/dist/esm/q-button_2.entry.js +4 -4
  150. package/dist/esm/q-card.entry.js +2 -2
  151. package/dist/esm/q-carousel.entry.js +1 -1
  152. package/dist/esm/q-chip.entry.js +2 -2
  153. package/dist/esm/q-conversation-bubble.entry.js +1 -1
  154. package/dist/esm/q-data-table.entry.js +1 -1
  155. package/dist/esm/q-dialog.entry.js +3 -3
  156. package/dist/esm/q-divider.entry.js +24 -0
  157. package/dist/esm/q-dropdown.entry.js +111 -92
  158. package/dist/esm/q-form.entry.js +4 -4
  159. package/dist/esm/q-grid.entry.js +3 -3
  160. package/dist/esm/q-icon.entry.js +1 -1
  161. package/dist/esm/q-image-comparison.entry.js +2 -2
  162. package/dist/esm/q-inline.entry.js +3 -3
  163. package/dist/esm/q-input_2.entry.js +8 -6
  164. package/dist/esm/q-link.entry.js +2 -2
  165. package/dist/esm/q-map.entry.js +1 -1
  166. package/dist/esm/q-media.entry.js +2 -2
  167. package/dist/esm/q-navbar.entry.js +3 -3
  168. package/dist/esm/q-pagination.entry.js +1 -1
  169. package/dist/esm/q-panel.entry.js +6 -6
  170. package/dist/esm/q-quantity-selector.entry.js +5 -5
  171. package/dist/esm/q-radio-group.entry.js +4 -4
  172. package/dist/esm/q-reel.entry.js +3 -3
  173. package/dist/esm/q-scrollable.entry.js +4 -4
  174. package/dist/esm/q-section.entry.js +2 -2
  175. package/dist/esm/q-sidepanel.entry.js +1 -1
  176. package/dist/esm/q-stack.entry.js +3 -3
  177. package/dist/esm/q-step-diagram-item.entry.js +1 -1
  178. package/dist/esm/q-step-diagram.entry.js +1 -1
  179. package/dist/esm/q-syntax-box.entry.js +1 -1
  180. package/dist/esm/q-tabs.entry.js +2 -2
  181. package/dist/esm/q-textarea.entry.js +7 -5
  182. package/dist/esm/q-thumbnail.entry.js +3 -3
  183. package/dist/esm/q-toast.entry.js +1 -1
  184. package/dist/esm/q-toggle.entry.js +6 -6
  185. package/dist/esm/q-toolbar.entry.js +4 -4
  186. package/dist/esm/{tokens-B4Mg1xEw.js → tokens-BDsIecIx.js} +3 -0
  187. package/dist/esm/webquark.js +3 -3
  188. package/dist/playground/components/theme-designer/dimension-tokens.js +9 -0
  189. package/dist/playground/components/theme-designer/token-row.js +89 -0
  190. package/dist/playground/dom-factory.js +76 -0
  191. package/dist/playground/utils/color.js +26 -0
  192. package/dist/playground/utils/dom.js +38 -0
  193. package/dist/playground/utils/index.js +2 -0
  194. package/dist/types/components/inputs/dropdown/dropdown.d.ts +18 -1
  195. package/dist/types/components/inputs/dropdown/test/search-mode.cmp.test.d.ts +1 -0
  196. package/dist/types/components/inputs/input/input.d.ts +3 -0
  197. package/dist/types/components/inputs/textarea/textarea.d.ts +3 -1
  198. package/dist/types/components/inputs/toggle/test/toggle-layout.cmp.test.d.ts +1 -0
  199. package/dist/types/components/layout/divider/divider.d.ts +15 -0
  200. package/dist/types/components/layout/divider/test/divider.cmp.test.d.ts +1 -0
  201. package/dist/types/components.d.ts +111 -2
  202. package/dist/types/home/runner/work/WebQuark/WebQuark/.stencil/src/playground/components/theme-designer/dimension-tokens.d.ts +3 -0
  203. package/dist/types/home/runner/work/WebQuark/WebQuark/.stencil/src/playground/components/theme-designer/token-row.d.ts +14 -0
  204. package/dist/types/home/runner/work/WebQuark/WebQuark/.stencil/src/playground/dom-factory.d.ts +12 -0
  205. package/dist/types/home/runner/work/WebQuark/WebQuark/.stencil/src/playground/utils/color.d.ts +8 -0
  206. package/dist/types/home/runner/work/WebQuark/WebQuark/.stencil/src/playground/utils/dom.d.ts +15 -0
  207. package/dist/types/home/runner/work/WebQuark/WebQuark/.stencil/src/playground/utils/index.d.ts +2 -0
  208. package/dist/types/index.d.ts +1 -1
  209. package/dist/types/theme/test/input-width.cmp.test.d.ts +3 -0
  210. package/dist/types/theme/tokens.d.ts +9 -0
  211. package/dist/webquark/{p-023f8437.entry.js → p-0f04ceab.entry.js} +1 -1
  212. package/dist/webquark/{p-97a89cae.entry.js → p-10dc5cce.entry.js} +1 -1
  213. package/dist/webquark/p-191a7063.entry.js +1 -0
  214. package/dist/webquark/p-1e8797d1.entry.js +1 -0
  215. package/dist/webquark/{p-09cca7b9.entry.js → p-220ec9cf.entry.js} +1 -1
  216. package/dist/webquark/p-2291095e.entry.js +1 -0
  217. package/dist/webquark/{p-fec6fe0a.entry.js → p-32055acd.entry.js} +1 -1
  218. package/dist/webquark/{p-5f232b44.entry.js → p-3af50215.entry.js} +2 -2
  219. package/dist/webquark/{p-6bfffa79.entry.js → p-41deb44c.entry.js} +1 -1
  220. package/dist/webquark/{p-9ff7e5a4.entry.js → p-44eda084.entry.js} +1 -1
  221. package/dist/webquark/{p-d0253d64.entry.js → p-473a1810.entry.js} +1 -1
  222. package/dist/webquark/p-4cf40080.entry.js +1 -0
  223. package/dist/webquark/{p-f98f9439.entry.js → p-4d611b93.entry.js} +1 -1
  224. package/dist/webquark/{p-0aa74ad6.entry.js → p-596737cc.entry.js} +1 -1
  225. package/dist/webquark/{p-36118d90.entry.js → p-5cccb6bc.entry.js} +1 -1
  226. package/dist/webquark/{p-9e78b796.entry.js → p-5d6fb0d1.entry.js} +1 -1
  227. package/dist/webquark/{p-f4f97e74.entry.js → p-687be7d4.entry.js} +1 -1
  228. package/dist/webquark/{p-144ef339.entry.js → p-6a5033da.entry.js} +1 -1
  229. package/dist/webquark/{p-059daa8a.entry.js → p-6d2d016a.entry.js} +1 -1
  230. package/dist/webquark/p-70e3a23a.entry.js +1 -0
  231. package/dist/webquark/p-7723e966.entry.js +1 -0
  232. package/dist/webquark/{p-64096386.entry.js → p-78c56cd3.entry.js} +1 -1
  233. package/dist/webquark/{p-d0fbd2b1.entry.js → p-8a0733a1.entry.js} +1 -1
  234. package/dist/webquark/p-BDsIecIx.js +1 -0
  235. package/dist/webquark/{p-DWO-pleQ.js → p-Bk4FnOfb.js} +1 -1
  236. package/dist/{components/p-BofcK-7Z.js → webquark/p-BuctNczf.js} +1 -1
  237. package/dist/webquark/p-DaJmsCb7.js +3 -0
  238. package/dist/webquark/{p-dd115868.entry.js → p-a199de7d.entry.js} +1 -1
  239. package/dist/webquark/{p-fe8c634a.entry.js → p-a30d212f.entry.js} +1 -1
  240. package/dist/webquark/{p-f1bac94c.entry.js → p-a87f0bde.entry.js} +1 -1
  241. package/dist/webquark/{p-f9ad63ff.entry.js → p-b75ec829.entry.js} +1 -1
  242. package/dist/webquark/{p-48fb5228.entry.js → p-b82aaf4c.entry.js} +1 -1
  243. package/dist/webquark/p-b8f4994a.entry.js +1 -0
  244. package/dist/webquark/{p-f63b7214.entry.js → p-b9c8c081.entry.js} +1 -1
  245. package/dist/webquark/{p-296fbdb1.entry.js → p-bf568cda.entry.js} +1 -1
  246. package/dist/webquark/{p-6e28cfe2.entry.js → p-c662904e.entry.js} +1 -1
  247. package/dist/webquark/{p-4d61b70d.entry.js → p-cab898c2.entry.js} +1 -1
  248. package/dist/webquark/{p-030ecde3.entry.js → p-d2c4696f.entry.js} +1 -1
  249. package/dist/webquark/{p-3bc4629c.entry.js → p-ddeb2d4c.entry.js} +1 -1
  250. package/dist/webquark/{p-888e46a8.entry.js → p-dee50f0a.entry.js} +1 -1
  251. package/dist/webquark/{p-8ece2c62.entry.js → p-e3c18c0e.entry.js} +1 -1
  252. package/dist/webquark/{p-90b0858c.entry.js → p-e7384b6e.entry.js} +1 -1
  253. package/dist/webquark/p-f63fd66f.entry.js +1 -0
  254. package/dist/webquark/p-f95aeb8d.entry.js +1 -0
  255. package/dist/webquark/{p-99d785ca.entry.js → p-fbd1cbbe.entry.js} +1 -1
  256. package/dist/webquark/webquark.css +1 -1
  257. package/dist/webquark/webquark.esm.js +1 -1
  258. package/package.json +1 -1
  259. package/dist/components/p-B4Mg1xEw.js +0 -1
  260. package/dist/components/p-CN1ut2Lb.js +0 -1
  261. package/dist/components/p-ye27qtRo.js +0 -1
  262. package/dist/webquark/p-04c8cb9e.entry.js +0 -1
  263. package/dist/webquark/p-0ae43d6c.entry.js +0 -1
  264. package/dist/webquark/p-0c3aac3f.entry.js +0 -1
  265. package/dist/webquark/p-70d9ffde.entry.js +0 -1
  266. package/dist/webquark/p-91fff6b6.entry.js +0 -1
  267. package/dist/webquark/p-923dac41.entry.js +0 -1
  268. package/dist/webquark/p-B4Mg1xEw.js +0 -1
  269. package/dist/webquark/p-B5ElFlHv.js +0 -3
  270. package/dist/webquark/p-c523ec6f.entry.js +0 -1
  271. package/dist/webquark/p-fe200f68.entry.js +0 -1
@@ -11,7 +11,7 @@ const MENU_OFFSET = 4;
11
11
  * and externally loaded option pages.
12
12
  * @slot icon-left - Optional leading content rendered inside the trigger.
13
13
  * @part label - Optional field label.
14
- * @part trigger - Button that opens the option menu.
14
+ * @part trigger - Active input or button that opens the option menu.
15
15
  * @part menu - Floating option menu.
16
16
  */
17
17
  export class QDropdown {
@@ -30,7 +30,11 @@ export class QDropdown {
30
30
  /** Omitted inherits the enclosing form; false cancels reservation. */
31
31
  reserveFeedback;
32
32
  size = 'inherit';
33
+ /** Opt-in horizontal width; independent of size. Omitted uses the existing full-width layout. */
34
+ width;
33
35
  searchable = false;
36
+ /** Search in the main editable control (default) or a separate menu field. Applies only when searchable. */
37
+ searchMode = 'default';
34
38
  /** Delegates filtering and pagination to the consumer. */
35
39
  externalSearch = false;
36
40
  /** Indicates another externally loaded option page is available. */
@@ -78,6 +82,39 @@ export class QDropdown {
78
82
  positionFrame = null;
79
83
  floatingCleanup;
80
84
  floatingResizeObserver;
85
+ draftEdited = false;
86
+ selectedLabelCache;
87
+ composing = false;
88
+ lastSearchValue;
89
+ get editableSearch() { return this.searchable && this.searchMode !== 'menu'; }
90
+ reconcileSelectedLabel() {
91
+ const selected = this.getSelectedOption();
92
+ if (selected)
93
+ this.selectedLabelCache = { value: this.value, label: this.getOptionLabel(selected) };
94
+ else if (!this.value || !this.externalSearch || this.selectedLabelCache?.value !== this.value)
95
+ this.selectedLabelCache = undefined;
96
+ }
97
+ closeMenu() {
98
+ this.isOpen = false;
99
+ this.focusedIndex = -1;
100
+ this.searchTerm = '';
101
+ this.lastSearchValue = undefined;
102
+ this.draftEdited = false;
103
+ this.composing = false;
104
+ this.visibleCount = 20;
105
+ this.clearScrollLoading();
106
+ if (this.triggerEl?.tagName === 'INPUT') {
107
+ const selected = this.getSelectedOption();
108
+ this.triggerEl.value = this.getOptionLabel(selected) || (this.externalSearch && this.selectedLabelCache?.value === this.value ? this.selectedLabelCache.label : '');
109
+ }
110
+ }
111
+ watchSearchMode() {
112
+ const hadFocus = Boolean(this.el.shadowRoot?.activeElement);
113
+ this.closeMenu();
114
+ this.searchInputEl = undefined;
115
+ if (hadFocus)
116
+ requestAnimationFrame(() => focusWithoutScroll(this.triggerEl));
117
+ }
81
118
  // ========================= [3] LIFECYCLE & WATCHERS ==========================
82
119
  disconnectedCallback() {
83
120
  this.clearScrollLoading();
@@ -109,6 +146,8 @@ export class QDropdown {
109
146
  this.stopFloatingUpdates();
110
147
  }
111
148
  watchValue(newValue) {
149
+ this.reconcileSelectedLabel();
150
+ this.closeMenu();
112
151
  if (this.internals && typeof this.internals.setFormValue === 'function') {
113
152
  this.internals.setFormValue(newValue);
114
153
  }
@@ -123,7 +162,7 @@ export class QDropdown {
123
162
  if (this.searchInputEl)
124
163
  this.searchInputEl.disabled = disabled;
125
164
  if (disabled && this.isOpen) {
126
- this.isOpen = false;
165
+ this.closeMenu();
127
166
  this.stopFloatingUpdates();
128
167
  }
129
168
  const selected = this.getFormSelection();
@@ -149,6 +188,8 @@ export class QDropdown {
149
188
  this.triggerEl?.focus();
150
189
  }
151
190
  watchOptions() {
191
+ this.reconcileSelectedLabel();
192
+ this.focusedIndex = -1;
152
193
  this.syncValidity();
153
194
  if (this.externalSearch) {
154
195
  this.isScrollingLoading = false;
@@ -160,6 +201,7 @@ export class QDropdown {
160
201
  }
161
202
  }
162
203
  componentWillLoad() {
204
+ this.reconcileSelectedLabel();
163
205
  this.initialValue = this.value || '';
164
206
  if (this.internals && typeof this.internals.setFormValue === 'function') {
165
207
  this.internals.setFormValue(this.value);
@@ -170,6 +212,7 @@ export class QDropdown {
170
212
  this.syncValidity();
171
213
  }
172
214
  formResetCallback() {
215
+ this.closeMenu();
173
216
  this.value = this.initialValue;
174
217
  if (this.internals && typeof this.internals.setFormValue === 'function') {
175
218
  this.internals.setFormValue(this.value);
@@ -221,7 +264,7 @@ export class QDropdown {
221
264
  this.visibleCount = 20;
222
265
  if (this.searchable) {
223
266
  this.focusedIndex = -1;
224
- requestAnimationFrame(() => focusWithoutScroll(this.searchInputEl));
267
+ requestAnimationFrame(() => focusWithoutScroll(this.editableSearch ? this.triggerEl : this.searchInputEl));
225
268
  }
226
269
  else {
227
270
  const activeIdx = this.parsedOptions.findIndex(opt => opt.value === this.value);
@@ -230,9 +273,7 @@ export class QDropdown {
230
273
  }
231
274
  }
232
275
  else {
233
- this.focusedIndex = -1;
234
- this.searchTerm = '';
235
- this.visibleCount = 20;
276
+ this.closeMenu();
236
277
  requestAnimationFrame(() => focusWithoutScroll(this.triggerEl));
237
278
  }
238
279
  };
@@ -240,10 +281,8 @@ export class QDropdown {
240
281
  if (this.isDisabled)
241
282
  return;
242
283
  this.value = option.value;
243
- this.isOpen = false;
244
- this.focusedIndex = -1;
245
- this.searchTerm = '';
246
- this.clearScrollLoading();
284
+ this.selectedLabelCache = { value: option.value, label: this.getOptionLabel(option) };
285
+ this.closeMenu();
247
286
  this.qChange.emit(option.value);
248
287
  this.qSelect.emit(option);
249
288
  requestAnimationFrame(() => focusWithoutScroll(this.triggerEl));
@@ -254,6 +293,23 @@ export class QDropdown {
254
293
  handleBlur = (ev) => {
255
294
  this.qBlur.emit(ev);
256
295
  };
296
+ handleFocusOut = (ev) => {
297
+ const next = ev.relatedTarget;
298
+ if (!next || (!this.el.contains(next) && !this.el.shadowRoot?.contains(next)))
299
+ this.closeMenu();
300
+ };
301
+ handleEditableClick = (ev) => {
302
+ if (this.isDisabled)
303
+ return;
304
+ this.qClick.emit(ev);
305
+ if (!this.isOpen)
306
+ this.toggleMenu();
307
+ };
308
+ handleCompositionStart = () => { this.composing = true; };
309
+ handleCompositionEnd = (ev) => {
310
+ this.composing = false;
311
+ this.handleSearchInput(ev);
312
+ };
257
313
  handleTriggerClick = (ev) => {
258
314
  if (this.isDisabled)
259
315
  return;
@@ -264,11 +320,16 @@ export class QDropdown {
264
320
  if (this.isDisabled)
265
321
  return;
266
322
  const target = ev.target;
323
+ if (this.composing || ev.isComposing)
324
+ return;
325
+ this.draftEdited = true;
267
326
  this.searchTerm = target.value || '';
327
+ this.isOpen = true;
268
328
  this.focusedIndex = -1;
269
329
  this.visibleCount = 20;
270
330
  this.clearScrollLoading();
271
- if (this.externalSearch) {
331
+ if (this.externalSearch && this.searchTerm !== this.lastSearchValue) {
332
+ this.lastSearchValue = this.searchTerm;
272
333
  this.qSearch.emit(this.searchTerm);
273
334
  }
274
335
  };
@@ -404,114 +465,70 @@ export class QDropdown {
404
465
  menu.style.visibility = 'visible';
405
466
  }
406
467
  handleKeyDown = (ev) => {
407
- if (this.isDisabled)
468
+ if (this.isDisabled || this.composing || ev.isComposing || ev.keyCode === 229)
408
469
  return;
409
- const target = ev.target;
410
- const isInput = target && target.tagName && target.tagName.toLowerCase() === 'input';
470
+ const isInput = ev.target?.tagName?.toLowerCase() === 'input';
411
471
  const maxIndex = this.parsedOptions.length - 1;
412
472
  switch (ev.key) {
413
473
  case 'ArrowDown':
474
+ case 'ArrowUp': {
414
475
  ev.preventDefault();
415
- if (!this.isOpen) {
416
- this.isOpen = true;
417
- if (this.searchable) {
418
- this.focusedIndex = -1;
419
- requestAnimationFrame(() => focusWithoutScroll(this.searchInputEl));
420
- }
421
- else {
422
- const activeIdx = this.parsedOptions.findIndex(opt => opt.value === this.value);
423
- const nextIdx = activeIdx >= 0 ? activeIdx : 0;
424
- this.updateFocusedIndex(nextIdx);
425
- }
426
- }
427
- else {
428
- if (isInput) {
429
- if (maxIndex >= 0) {
430
- this.updateFocusedIndex(0);
431
- }
432
- }
433
- else {
434
- const nextIdx = Math.min(this.focusedIndex + 1, maxIndex);
435
- this.updateFocusedIndex(nextIdx);
436
- }
476
+ const opening = !this.isOpen;
477
+ this.isOpen = true;
478
+ if (opening && this.searchable && !this.editableSearch) {
479
+ this.focusedIndex = -1;
480
+ requestAnimationFrame(() => focusWithoutScroll(this.searchInputEl));
437
481
  }
438
- break;
439
- case 'ArrowUp':
440
- ev.preventDefault();
441
- if (!this.isOpen) {
442
- this.isOpen = true;
443
- const activeIdx = this.parsedOptions.findIndex(opt => opt.value === this.value);
444
- const nextIdx = activeIdx >= 0 ? activeIdx : maxIndex;
445
- this.updateFocusedIndex(nextIdx);
482
+ else if (ev.key === 'ArrowDown') {
483
+ const selected = opening && !isInput ? this.parsedOptions.findIndex(option => option.value === this.value) : -1;
484
+ this.updateFocusedIndex(selected >= 0 ? selected : Math.min(this.focusedIndex + 1, maxIndex));
446
485
  }
447
486
  else {
448
- if (this.focusedIndex === 0 && this.searchable) {
449
- this.focusedIndex = -1;
450
- requestAnimationFrame(() => focusWithoutScroll(this.searchInputEl));
451
- }
452
- else if (this.focusedIndex > 0) {
453
- const nextIdx = this.focusedIndex - 1;
454
- this.updateFocusedIndex(nextIdx);
455
- }
487
+ this.updateFocusedIndex(this.focusedIndex < 0 ? maxIndex : Math.max(-1, this.focusedIndex - 1));
456
488
  }
457
489
  break;
490
+ }
458
491
  case 'Home':
459
- if (this.isOpen && !isInput) {
460
- ev.preventDefault();
461
- this.updateFocusedIndex(0);
462
- }
463
- break;
464
492
  case 'End':
465
493
  if (this.isOpen && !isInput) {
466
494
  ev.preventDefault();
467
- this.updateFocusedIndex(maxIndex);
495
+ this.updateFocusedIndex(ev.key === 'Home' ? 0 : maxIndex);
468
496
  }
469
497
  break;
470
498
  case 'Enter':
471
499
  if (isInput) {
472
- if (this.parsedOptions.length > 0) {
500
+ if (this.isOpen) {
473
501
  ev.preventDefault();
474
- this.handleSelect(this.parsedOptions[0]);
502
+ if (this.focusedIndex >= 0 && this.focusedIndex <= maxIndex)
503
+ this.handleSelect(this.parsedOptions[this.focusedIndex]);
475
504
  }
476
505
  }
477
506
  else {
478
507
  ev.preventDefault();
479
- if (this.isOpen && this.focusedIndex >= 0 && this.focusedIndex < this.parsedOptions.length) {
508
+ if (this.isOpen && this.focusedIndex >= 0 && this.focusedIndex <= maxIndex)
480
509
  this.handleSelect(this.parsedOptions[this.focusedIndex]);
481
- }
482
- else {
510
+ else
483
511
  this.toggleMenu();
484
- }
485
512
  }
486
513
  break;
487
514
  case ' ':
488
515
  if (!isInput) {
489
516
  ev.preventDefault();
490
- if (this.isOpen && this.focusedIndex >= 0 && this.focusedIndex < this.parsedOptions.length) {
517
+ if (this.isOpen && this.focusedIndex >= 0 && this.focusedIndex <= maxIndex)
491
518
  this.handleSelect(this.parsedOptions[this.focusedIndex]);
492
- }
493
- else {
519
+ else
494
520
  this.toggleMenu();
495
- }
496
521
  }
497
522
  break;
498
523
  case 'Escape':
499
- if (this.isOpen) {
524
+ if (this.isOpen || this.draftEdited) {
500
525
  ev.preventDefault();
501
- this.isOpen = false;
502
- this.focusedIndex = -1;
503
- this.searchTerm = '';
504
- this.clearScrollLoading();
526
+ this.closeMenu();
505
527
  requestAnimationFrame(() => focusWithoutScroll(this.triggerEl));
506
528
  }
507
529
  break;
508
530
  case 'Tab':
509
- if (this.isOpen) {
510
- this.isOpen = false;
511
- this.focusedIndex = -1;
512
- this.searchTerm = '';
513
- this.clearScrollLoading();
514
- }
531
+ this.closeMenu();
515
532
  break;
516
533
  }
517
534
  };
@@ -519,11 +536,7 @@ export class QDropdown {
519
536
  handleClickOutside(ev) {
520
537
  const path = ev.composedPath();
521
538
  if (this.el && !path.includes(this.el)) {
522
- this.isOpen = false;
523
- this.focusedIndex = -1;
524
- this.searchTerm = '';
525
- this.visibleCount = 20;
526
- this.clearScrollLoading();
539
+ this.closeMenu();
527
540
  }
528
541
  }
529
542
  // ===================== [6] RENDER (Visual Template Only) =====================
@@ -534,20 +547,20 @@ export class QDropdown {
534
547
  warningContext: 'q-dropdown options',
535
548
  });
536
549
  const selectedOption = this.getSelectedOption(allOptions);
537
- const selectedLabel = this.getOptionLabel(selectedOption);
538
- const displayLabel = selectedOption && selectedLabel ? selectedLabel : this.placeholder;
539
- const hasSelection = selectedOption !== undefined;
550
+ const selectedLabel = this.getOptionLabel(selectedOption) || (this.externalSearch && this.selectedLabelCache?.value === this.value ? this.selectedLabelCache.label : '');
551
+ const displayLabel = selectedLabel || this.placeholder;
552
+ const hasSelection = selectedOption !== undefined || Boolean(this.externalSearch && this.selectedLabelCache?.value === this.value);
540
553
  const ariaLabel = this.ariaLabel?.trim() || undefined;
541
- return (h("div", { key: '1294d517bf3a3094421034b04c22ee248cfd0730', style: feedbackStyle(this.reserveFeedback), class: {
554
+ return (h("div", { key: '2c3ac6a3001c9a68f0be6a16bd6305149c06784a', style: feedbackStyle(this.reserveFeedback), class: {
542
555
  'dropdown-wrapper': true,
543
556
  'is-open': this.isOpen,
544
557
  'is-disabled': this.isDisabled,
545
558
  [`size-${this.size}`]: true
546
- }, onKeyDown: this.handleKeyDown }, this.label && (h("label", { key: '6e9b7ea8d8272669c307d3f00975cd2fb3a91db1', class: { 'dropdown-label': true, 'q-label-hidden': this.labelHidden }, htmlFor: "q-field", part: "label" }, this.label)), h("button", { key: 'ece6703623acdfc325f01a068e5dd0e85a85263e', ref: (el) => (this.triggerEl = el), id: "q-field", class: "dropdown-trigger", part: "trigger", type: "button", disabled: this.isDisabled, onClick: this.handleTriggerClick, onFocus: this.handleFocus, onBlur: this.handleBlur, "aria-haspopup": "listbox", "aria-required": this.required ? 'true' : 'false', "aria-invalid": this.error || (this.required && !this.value) ? 'true' : 'false', "aria-describedby": this.error || this.description ? 'q-field-error' : undefined, "aria-label": ariaLabel, "aria-expanded": this.isOpen ? 'true' : 'false', "aria-controls": this.isOpen ? 'q-field-menu' : undefined, "aria-activedescendant": this.isOpen && this.focusedIndex >= 0 ? `q-field-item-${this.focusedIndex}` : undefined }, h("span", { key: 'a3c6a847dc3f04cdcc57c5222b70b0fe18d4d91b', class: "trigger-content" }, h("slot", { key: 'dce0925e5e0c11579e8e8e6a0c8b12555949ce06', name: "icon-left" }), h("span", { key: '60af77209db71dcc5fa49552ea098754e1c56699', class: { 'trigger-text': true, 'is-placeholder': !hasSelection } }, displayLabel)), h("svg", { key: '083f67294926fe7e9cac6f061015b0f99187a14c', class: "chevron-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2" }, h("polyline", { key: 'fc000f99b853cec98b05baf545d7d9deb58f903c', points: "6 9 12 15 18 9" }))), fieldFeedback('q-field-error', this.error, this.description), this.isOpen && (h("div", { key: '3fcf4fa46a7192bd5102218b86622ff68cfcf21e', ref: (el) => (this.menuEl = el), id: "q-field-menu", class: "dropdown-menu", part: "menu", role: "listbox", popover: "manual", "aria-label": ariaLabel || this.label || 'Options' }, this.searchable && (h("div", { key: '6da89836381e1fd4fdaa51567ef76efd115d82ab', class: "dropdown-search-container" }, h("input", { key: '65b9ddc1dd4a3d431e7550cba6c1cdebdbb2481a', ref: (el) => (this.searchInputEl = el), type: "text", class: "dropdown-search-input", placeholder: "Search...", value: this.searchTerm, onInput: this.handleSearchInput, role: "combobox", "aria-autocomplete": "list", "aria-controls": "q-field-menu", "aria-expanded": this.isOpen ? 'true' : 'false', "aria-activedescendant": this.focusedIndex >= 0 ? `q-field-item-${this.focusedIndex}` : undefined }))), h("ul", { key: '6a0f2ed2711cbfd82ed61fd20ff9e19fc8563c3f', ref: (el) => (this.itemsListEl = el), class: "dropdown-items-list", onScroll: this.handleScroll }, opts.length === 0 && !this.loading ? (h("li", { class: "menu-item is-empty" }, "No matches found")) : (identifiedOptions.map(({ item: option, index, key }) => (h("li", { key: key, id: `q-field-item-${index}`, class: {
559
+ }, onKeyDown: this.handleKeyDown, onFocusout: this.handleFocusOut }, this.label && (h("label", { key: '869b65fe2fb4f0fe67faa22849ec5f36148aaa9f', class: { 'dropdown-label': true, 'q-label-hidden': this.labelHidden }, htmlFor: "q-field", part: "label" }, this.label)), this.editableSearch ? h("div", { class: { 'editable-trigger': true, 'has-leading-icon': Boolean(this.el.querySelector('[slot="icon-left"]')) } }, h("span", { class: "editable-leading" }, h("slot", { name: "icon-left" })), h("input", { ref: el => (this.triggerEl = el), id: "q-field", class: "dropdown-trigger dropdown-main-input", part: "trigger", type: "text", role: "combobox", autocomplete: "off", disabled: this.isDisabled, value: this.composing ? this.triggerEl?.value ?? selectedLabel : this.draftEdited ? this.searchTerm : selectedLabel, placeholder: this.placeholder, onClick: this.handleEditableClick, onFocus: this.handleFocus, onBlur: this.handleBlur, onInput: this.handleSearchInput, onCompositionstart: this.handleCompositionStart, onCompositionend: this.handleCompositionEnd, "aria-autocomplete": "list", "aria-haspopup": "listbox", "aria-required": this.required ? 'true' : 'false', "aria-invalid": this.error || (this.required && !this.value) ? 'true' : 'false', "aria-describedby": this.error || this.description ? 'q-field-error' : undefined, "aria-label": ariaLabel, "aria-expanded": this.isOpen ? 'true' : 'false', "aria-controls": this.isOpen ? 'q-field-menu' : undefined, "aria-activedescendant": this.isOpen && this.focusedIndex >= 0 ? `q-field-item-${this.focusedIndex}` : undefined }), h("svg", { class: "chevron-icon", "aria-hidden": "true", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2" }, h("polyline", { points: "6 9 12 15 18 9" }))) : h("button", { ref: (el) => (this.triggerEl = el), id: "q-field", class: "dropdown-trigger", part: "trigger", type: "button", disabled: this.isDisabled, onClick: this.handleTriggerClick, onFocus: this.handleFocus, onBlur: this.handleBlur, "aria-haspopup": "listbox", "aria-required": this.required ? 'true' : 'false', "aria-invalid": this.error || (this.required && !this.value) ? 'true' : 'false', "aria-describedby": this.error || this.description ? 'q-field-error' : undefined, "aria-label": ariaLabel, "aria-expanded": this.isOpen ? 'true' : 'false', "aria-controls": this.isOpen ? 'q-field-menu' : undefined, "aria-activedescendant": this.isOpen && this.focusedIndex >= 0 ? `q-field-item-${this.focusedIndex}` : undefined }, h("span", { class: "trigger-content" }, h("slot", { name: "icon-left" }), h("span", { class: { 'trigger-text': true, 'is-placeholder': !hasSelection } }, displayLabel)), h("svg", { class: "chevron-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2" }, h("polyline", { points: "6 9 12 15 18 9" }))), fieldFeedback('q-field-error', this.error, this.description), this.isOpen && (h("div", { key: '1660f2411c485d2988f5a510ae5faa496f574e08', ref: (el) => (this.menuEl = el), id: "q-field-menu", class: "dropdown-menu", part: "menu", role: "listbox", popover: "manual", "aria-label": ariaLabel || this.label || 'Options' }, this.searchable && !this.editableSearch && (h("div", { key: '2f1cadc1aaa76b3403a16d5d620e1f2f02a5de19', class: "dropdown-search-container" }, h("input", { key: '324fa2f19e4aa2f35ecb613096f70c48eb1dbc46', ref: (el) => (this.searchInputEl = el), type: "text", class: "dropdown-search-input", placeholder: "Search...", value: this.searchTerm, onInput: this.handleSearchInput, onCompositionstart: this.handleCompositionStart, onCompositionend: this.handleCompositionEnd, "aria-label": ariaLabel || this.label || 'Search options', role: "combobox", "aria-autocomplete": "list", "aria-controls": "q-field-menu", "aria-expanded": this.isOpen ? 'true' : 'false', "aria-activedescendant": this.focusedIndex >= 0 ? `q-field-item-${this.focusedIndex}` : undefined }))), h("ul", { key: '1e5d5700839986475ccd46a86814ace71b8e4985', ref: (el) => (this.itemsListEl = el), class: "dropdown-items-list", onScroll: this.handleScroll }, opts.length === 0 && !this.loading ? (h("li", { class: "menu-item is-empty" }, "No matches found")) : (identifiedOptions.map(({ item: option, index, key }) => (h("li", { key: key, id: `q-field-item-${index}`, class: {
547
560
  'menu-item': true,
548
561
  'is-selected': option.value === this.value,
549
562
  'is-focused': index === this.focusedIndex
550
- }, tabindex: -1, part: `item ${option.value === this.value ? 'selected-item' : ''} ${index === this.focusedIndex ? 'focused-item' : ''}`, role: "option", "aria-selected": option.value === this.value ? 'true' : 'false', onClick: () => this.handleSelect(option) }, this.getOptionLabel(option))))), (this.loading || this.isScrollingLoading) && (h("li", { key: 'd79cc4772b8d99a809627de29ccd6da3fbbf2f01', class: "menu-item is-loading-more" }, h("span", { key: '2eea8fb3a471c7aeea5a7cb9e1d7c0be62b4ff5b', class: "spinner-circle" }), h("span", { key: '364f7e446f1f7b6ddad5087480f2ce4e88843ed6' }, "Loading..."))))))));
563
+ }, tabindex: -1, part: `item ${option.value === this.value ? 'selected-item' : ''} ${index === this.focusedIndex ? 'focused-item' : ''}`, role: "option", "aria-selected": option.value === this.value ? 'true' : 'false', onClick: () => this.handleSelect(option), onMouseDown: ev => ev.preventDefault() }, this.getOptionLabel(option))))), (this.loading || this.isScrollingLoading) && (h("li", { key: 'ac29617e51c86039b86be6ab3ebecb0c14a6e093', class: "menu-item is-loading-more" }, h("span", { key: 'ac9161bb78203625474898a32071ba58a638f12d', class: "spinner-circle" }), h("span", { key: '0e70057d70098ed830eedaa3eb22b4d90ef88924' }, "Loading..."))))))));
551
564
  }
552
565
  static get is() { return "q-dropdown"; }
553
566
  static get encapsulation() { return "shadow"; }
@@ -756,6 +769,32 @@ export class QDropdown {
756
769
  "attribute": "size",
757
770
  "defaultValue": "'inherit'"
758
771
  },
772
+ "width": {
773
+ "type": "string",
774
+ "mutable": false,
775
+ "complexType": {
776
+ "original": "QInputWidth",
777
+ "resolved": "\"full\" | \"lg\" | \"md\" | \"sm\" | \"xl\" | \"xs\" | \"xxl\"",
778
+ "references": {
779
+ "QInputWidth": {
780
+ "location": "import",
781
+ "path": "../../../theme/tokens",
782
+ "id": "../../../src/browser/theme/tokens.ts::QInputWidth",
783
+ "referenceLocation": "QInputWidth"
784
+ }
785
+ }
786
+ },
787
+ "required": false,
788
+ "optional": true,
789
+ "docs": {
790
+ "tags": [],
791
+ "text": "Opt-in horizontal width; independent of size. Omitted uses the existing full-width layout."
792
+ },
793
+ "getter": false,
794
+ "setter": false,
795
+ "reflect": true,
796
+ "attribute": "width"
797
+ },
759
798
  "searchable": {
760
799
  "type": "boolean",
761
800
  "mutable": false,
@@ -776,6 +815,26 @@ export class QDropdown {
776
815
  "attribute": "searchable",
777
816
  "defaultValue": "false"
778
817
  },
818
+ "searchMode": {
819
+ "type": "string",
820
+ "mutable": false,
821
+ "complexType": {
822
+ "original": "'default' | 'menu'",
823
+ "resolved": "\"default\" | \"menu\"",
824
+ "references": {}
825
+ },
826
+ "required": false,
827
+ "optional": false,
828
+ "docs": {
829
+ "tags": [],
830
+ "text": "Search in the main editable control (default) or a separate menu field. Applies only when searchable."
831
+ },
832
+ "getter": false,
833
+ "setter": false,
834
+ "reflect": false,
835
+ "attribute": "search-mode",
836
+ "defaultValue": "'default'"
837
+ },
779
838
  "externalSearch": {
780
839
  "type": "boolean",
781
840
  "mutable": false,
@@ -970,7 +1029,9 @@ export class QDropdown {
970
1029
  "searchTerm": {},
971
1030
  "visibleCount": {},
972
1031
  "isScrollingLoading": {},
973
- "disabledState": {}
1032
+ "disabledState": {},
1033
+ "draftEdited": {},
1034
+ "selectedLabelCache": {}
974
1035
  };
975
1036
  }
976
1037
  static get events() {
@@ -1161,6 +1222,12 @@ export class QDropdown {
1161
1222
  static get elementRef() { return "el"; }
1162
1223
  static get watchers() {
1163
1224
  return [{
1225
+ "propName": "searchMode",
1226
+ "methodName": "watchSearchMode"
1227
+ }, {
1228
+ "propName": "searchable",
1229
+ "methodName": "watchSearchMode"
1230
+ }, {
1164
1231
  "propName": "value",
1165
1232
  "methodName": "watchValue"
1166
1233
  }, {
@@ -1,5 +1,6 @@
1
1
  import { afterEach, describe, expect, it } from "vitest";
2
2
  import "../dropdown";
3
+ import dropdownCss from "../dropdown.css?inline";
3
4
  async function nextFrame() {
4
5
  await new Promise(resolve => requestAnimationFrame(() => resolve()));
5
6
  }
@@ -10,12 +11,39 @@ async function createDropdown(options) {
10
11
  document.body.append(element);
11
12
  await customElements.whenDefined('q-dropdown');
12
13
  await nextFrame();
14
+ const style = document.createElement('style');
15
+ style.textContent = dropdownCss;
16
+ element.shadowRoot.append(style);
13
17
  return element;
14
18
  }
15
19
  describe('q-dropdown floating menu in Chromium', () => {
16
20
  afterEach(() => {
17
21
  document.body.replaceChildren();
18
22
  });
23
+ it.each(['sm', 'md', 'lg', 'inherit'])('keeps search spacing even at size %s', async (size) => {
24
+ const element = await createDropdown([{ label: 'Option', value: 'option' }]);
25
+ element.size = size;
26
+ element.searchable = true;
27
+ element.searchMode = 'menu';
28
+ await nextFrame();
29
+ element.shadowRoot?.querySelector('.dropdown-trigger')?.click();
30
+ await nextFrame();
31
+ await nextFrame();
32
+ const menu = element.shadowRoot.querySelector('.dropdown-menu');
33
+ const container = element.shadowRoot.querySelector('.dropdown-search-container');
34
+ const input = element.shadowRoot.querySelector('.dropdown-search-input');
35
+ const menuBounds = menu.getBoundingClientRect();
36
+ const inputBounds = input.getBoundingClientRect();
37
+ const menuStyle = getComputedStyle(menu);
38
+ const topGap = inputBounds.top - menuBounds.top - parseFloat(menuStyle.borderTopWidth);
39
+ const leftGap = inputBounds.left - menuBounds.left - parseFloat(menuStyle.borderLeftWidth);
40
+ const rightGap = menuBounds.right - inputBounds.right - parseFloat(menuStyle.borderRightWidth);
41
+ const bottomGap = container.getBoundingClientRect().bottom - inputBounds.bottom
42
+ - parseFloat(getComputedStyle(container).borderBottomWidth);
43
+ expect(topGap).toBeCloseTo(leftGap, 0);
44
+ expect(topGap).toBeCloseTo(rightGap, 0);
45
+ expect(topGap).toBeCloseTo(bottomGap, 0);
46
+ });
19
47
  it('keeps focus and scroll position on the trigger while opening', async () => {
20
48
  const scroller = document.createElement('div');
21
49
  scroller.style.cssText = 'position:fixed;left:20px;top:20px;width:280px;height:140px;overflow:auto;';