@ds-mo/ui 12.6.2 → 12.7.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 (242) hide show
  1. package/README.md +44 -115
  2. package/dist/.build-stamp +1 -1
  3. package/dist/agent-patterns.json +5 -3
  4. package/dist/agent.json +56 -32
  5. package/dist/angular/ds-menu.d.ts +1 -1
  6. package/dist/angular/ds-menu.js +3 -3
  7. package/dist/components/ds-agent-activity.js +1 -1
  8. package/dist/components/ds-agent-response.js +1 -1
  9. package/dist/components/ds-agent-source-list.js +1 -1
  10. package/dist/components/ds-agent-tool-call.js +1 -1
  11. package/dist/components/ds-attachment-list.js +1 -1
  12. package/dist/components/ds-badge.js +1 -1
  13. package/dist/components/ds-bar-nav.js +1 -1
  14. package/dist/components/ds-bar-nav.js.map +1 -1
  15. package/dist/components/ds-bar-title.js +1 -1
  16. package/dist/components/ds-bar-title.js.map +1 -1
  17. package/dist/components/ds-bar-workflow.js +1 -1
  18. package/dist/components/ds-bar-workflow.js.map +1 -1
  19. package/dist/components/ds-breadcrumb.js +1 -1
  20. package/dist/components/ds-button-filled.js +1 -1
  21. package/dist/components/ds-button-unfilled.js +1 -1
  22. package/dist/components/ds-card-data-viz-bar.js +1 -1
  23. package/dist/components/ds-card-data-viz-bar.js.map +1 -1
  24. package/dist/components/ds-card-data-viz-donut.js +1 -1
  25. package/dist/components/ds-card-data-viz-donut.js.map +1 -1
  26. package/dist/components/ds-card-data-viz-line.js +1 -1
  27. package/dist/components/ds-card-data-viz-line.js.map +1 -1
  28. package/dist/components/ds-card-setting.js +1 -1
  29. package/dist/components/ds-card-setting.js.map +1 -1
  30. package/dist/components/ds-card-shell-data-viz.js +1 -1
  31. package/dist/components/ds-chart-bar.js +1 -1
  32. package/dist/components/ds-chart-donut.js +1 -1
  33. package/dist/components/ds-chart-legend.js +1 -1
  34. package/dist/components/ds-chart-line.js +1 -1
  35. package/dist/components/ds-checkbox.js +1 -1
  36. package/dist/components/ds-chip.js +1 -1
  37. package/dist/components/ds-code-block.js +1 -1
  38. package/dist/components/ds-conversation-list-item.js +1 -1
  39. package/dist/components/ds-conversation-list-item.js.map +1 -1
  40. package/dist/components/ds-conversation-list-section.js +1 -1
  41. package/dist/components/ds-conversation-list.js +1 -1
  42. package/dist/components/ds-conversation-list.js.map +1 -1
  43. package/dist/components/ds-empty-state.js +1 -1
  44. package/dist/components/ds-field.js +1 -1
  45. package/dist/components/ds-field.js.map +1 -1
  46. package/dist/components/ds-input.js +1 -1
  47. package/dist/components/ds-input.js.map +1 -1
  48. package/dist/components/ds-markdown.js +1 -1
  49. package/dist/components/ds-menu.js +1 -1
  50. package/dist/components/ds-message-composer.js +1 -1
  51. package/dist/components/ds-message-composer.js.map +1 -1
  52. package/dist/components/ds-message-scroller.js +1 -1
  53. package/dist/components/ds-message-scroller.js.map +1 -1
  54. package/dist/components/ds-message.js +1 -1
  55. package/dist/components/ds-mobile-bar-nav.js +1 -1
  56. package/dist/components/ds-mobile-bar-nav.js.map +1 -1
  57. package/dist/components/ds-mobile-header.js +1 -1
  58. package/dist/components/ds-mobile-section-switcher.js +1 -1
  59. package/dist/components/ds-mobile-sheet-nav.js +1 -1
  60. package/dist/components/ds-mobile-sheet-nav.js.map +1 -1
  61. package/dist/components/ds-modal.js +1 -1
  62. package/dist/components/ds-modal.js.map +1 -1
  63. package/dist/components/ds-panel-nav.js +1 -1
  64. package/dist/components/ds-panel-nav.js.map +1 -1
  65. package/dist/components/ds-panel-sub-nav.js +1 -1
  66. package/dist/components/ds-panel-tool-header.js +1 -1
  67. package/dist/components/ds-panel-tool-search.js +1 -1
  68. package/dist/components/ds-panel-tool-search.js.map +1 -1
  69. package/dist/components/ds-panel-tools.js +1 -1
  70. package/dist/components/ds-radio.js +1 -1
  71. package/dist/components/ds-radio.js.map +1 -1
  72. package/dist/components/ds-scroll-overlay.js +1 -1
  73. package/dist/components/ds-scroll-overlay.js.map +1 -1
  74. package/dist/components/ds-select-multi.js +1 -1
  75. package/dist/components/ds-select-multi.js.map +1 -1
  76. package/dist/components/ds-select.js +1 -1
  77. package/dist/components/ds-select.js.map +1 -1
  78. package/dist/components/ds-shell-app.js +1 -1
  79. package/dist/components/ds-shell-app.js.map +1 -1
  80. package/dist/components/ds-shell-gradient-picker.js +1 -1
  81. package/dist/components/ds-shell-gradient-picker.js.map +1 -1
  82. package/dist/components/ds-shell-gradient-swatch.js +1 -1
  83. package/dist/components/ds-shell-page.js +1 -1
  84. package/dist/components/ds-shell-tools.js +1 -1
  85. package/dist/components/ds-shell-tools.js.map +1 -1
  86. package/dist/components/ds-skeleton.js +1 -1
  87. package/dist/components/ds-slider.js +1 -1
  88. package/dist/components/ds-slider.js.map +1 -1
  89. package/dist/components/ds-swatch-picker.js +1 -1
  90. package/dist/components/ds-switch.js +1 -1
  91. package/dist/components/ds-tab-group.js +1 -1
  92. package/dist/components/ds-tag.js +1 -1
  93. package/dist/components/ds-text.js +1 -1
  94. package/dist/components/ds-toast.js +1 -1
  95. package/dist/components/ds-tooltip-data-viz.js +1 -1
  96. package/dist/components/ds-tooltip.js +1 -1
  97. package/dist/components/ds-typing-indicator.js +1 -1
  98. package/dist/components/{p-DwX7UmLl.js → p--eKXTylf.js} +2 -2
  99. package/dist/components/p-1darPzys.js +2 -0
  100. package/dist/components/{p-DXLWm4PF.js.map → p-1darPzys.js.map} +1 -1
  101. package/dist/components/{p-DIoiApa-.js → p-5-QAFB4j.js} +2 -2
  102. package/dist/components/{p-D-xttdpn.js → p-B-9A0e_0.js} +2 -2
  103. package/dist/components/{p-CaRyxTMz.js → p-BT5hgg5i.js} +2 -2
  104. package/dist/components/{p-DQDpDYyF.js → p-B_5nxOeB.js} +2 -2
  105. package/dist/components/p-BcfC6phQ.js +2 -0
  106. package/dist/components/p-BcfC6phQ.js.map +1 -0
  107. package/dist/components/{p-BkAMkjIR.js → p-Bl001G0Y.js} +2 -2
  108. package/dist/components/p-BuiZcSga.js +2 -0
  109. package/dist/components/p-BuiZcSga.js.map +1 -0
  110. package/dist/components/p-Bv9frkvW.js +2 -0
  111. package/dist/components/p-Bv9frkvW.js.map +1 -0
  112. package/dist/components/{p-DWdRSOBV.js → p-C0-K8vnW.js} +2 -2
  113. package/dist/components/p-C61yJkfr.js +2 -0
  114. package/dist/components/p-C61yJkfr.js.map +1 -0
  115. package/dist/components/p-C6xC48hG.js +2 -0
  116. package/dist/components/p-C6xC48hG.js.map +1 -0
  117. package/dist/components/p-C9h13YnX.js +2 -0
  118. package/dist/components/{p-CnHrJTD5.js → p-CUAYsK44.js} +2 -2
  119. package/dist/components/p-C_9ZH0A3.js +2 -0
  120. package/dist/components/p-C_9ZH0A3.js.map +1 -0
  121. package/dist/components/p-Ca9-fnFl.js +2 -0
  122. package/dist/components/p-Ca9-fnFl.js.map +1 -0
  123. package/dist/components/p-CnAkobDW.js +2 -0
  124. package/dist/components/p-CnAkobDW.js.map +1 -0
  125. package/dist/components/{p-CWTih3Gc.js → p-CqWV4Hl_.js} +2 -2
  126. package/dist/components/{p-B9bxDfZV.js → p-Crsn82rz.js} +2 -2
  127. package/dist/components/p-CuwopElg.js +2 -0
  128. package/dist/components/p-CuwopElg.js.map +1 -0
  129. package/dist/components/{p-BwsGYxZx.js → p-CvyTZ4Mg.js} +2 -2
  130. package/dist/components/p-DIa73GJP.js +2 -0
  131. package/dist/components/p-DIa73GJP.js.map +1 -0
  132. package/dist/components/{p-DqubRds2.js → p-DNFd4Ao-.js} +2 -2
  133. package/dist/components/p-De7NquTI.js +2 -0
  134. package/dist/components/p-De7NquTI.js.map +1 -0
  135. package/dist/components/p-DjbTFy2B.js +2 -0
  136. package/dist/components/p-DjbTFy2B.js.map +1 -0
  137. package/dist/components/p-guQ7hv6W.js +2 -0
  138. package/dist/components/p-guQ7hv6W.js.map +1 -0
  139. package/dist/components/{p-BwGnhInj.js → p-k0Hmj1KV.js} +2 -2
  140. package/dist/components/p-pgxlkvUy.js +2 -0
  141. package/dist/docs/components.json +110 -25
  142. package/dist/lib/utils/control-text.d.ts +3 -1
  143. package/dist/lib/utils/index.d.ts +1 -1
  144. package/dist/lib/utils/index.js +8 -0
  145. package/dist/lib/utils/index.js.map +2 -2
  146. package/dist/mcp-data/registry/bar-nav.json +2 -2
  147. package/dist/mcp-data/registry/bar-title.json +2 -2
  148. package/dist/mcp-data/registry/bar-workflow.json +2 -2
  149. package/dist/mcp-data/registry/button-filled.json +5 -4
  150. package/dist/mcp-data/registry/button-unfilled.json +3 -2
  151. package/dist/mcp-data/registry/card-data-viz-bar.json +3 -2
  152. package/dist/mcp-data/registry/card-data-viz-donut.json +3 -2
  153. package/dist/mcp-data/registry/card-data-viz-line.json +3 -2
  154. package/dist/mcp-data/registry/card-setting.json +2 -2
  155. package/dist/mcp-data/registry/card-shell-data-viz.json +2 -2
  156. package/dist/mcp-data/registry/checkbox.json +9 -9
  157. package/dist/mcp-data/registry/conversation-list-item.json +2 -2
  158. package/dist/mcp-data/registry/conversation-list.json +2 -2
  159. package/dist/mcp-data/registry/empty-state.json +5 -1
  160. package/dist/mcp-data/registry/field.json +3 -2
  161. package/dist/mcp-data/registry/input.json +8 -7
  162. package/dist/mcp-data/registry/menu.json +22 -3
  163. package/dist/mcp-data/registry/message-scroller.json +2 -2
  164. package/dist/mcp-data/registry/mobile-bar-nav.json +3 -3
  165. package/dist/mcp-data/registry/mobile-header.json +2 -2
  166. package/dist/mcp-data/registry/mobile-sheet-nav.json +5 -3
  167. package/dist/mcp-data/registry/modal.json +2 -2
  168. package/dist/mcp-data/registry/panel-nav.json +2 -2
  169. package/dist/mcp-data/registry/panel-tool-header.json +2 -2
  170. package/dist/mcp-data/registry/panel-tool-search.json +2 -2
  171. package/dist/mcp-data/registry/panel-tools.json +2 -2
  172. package/dist/mcp-data/registry/radio.json +9 -9
  173. package/dist/mcp-data/registry/registry.json +55 -31
  174. package/dist/mcp-data/registry/select-multi.json +9 -7
  175. package/dist/mcp-data/registry/select.json +9 -7
  176. package/dist/mcp-data/registry/shell-app.json +2 -1
  177. package/dist/mcp-data/registry/shell-tools.json +1 -1
  178. package/dist/mcp-data/registry/skeleton.json +2 -2
  179. package/dist/mcp-data/registry/slider.json +3 -2
  180. package/dist/mcp-data/registry/switch.json +7 -7
  181. package/dist/styles/control-elevation.css +27 -2
  182. package/dist/types/components/ButtonFilled/ButtonFilled.d.ts +1 -1
  183. package/dist/types/components/Checkbox/Checkbox.d.ts +1 -1
  184. package/dist/types/components/Input/Input.d.ts +1 -1
  185. package/dist/types/components/Menu/Menu.d.ts +4 -1
  186. package/dist/types/components/MobileSheetNav/MobileSheetNav.d.ts +0 -1
  187. package/dist/types/components/Radio/Radio.d.ts +1 -1
  188. package/dist/types/components/Select/Select.d.ts +6 -23
  189. package/dist/types/components/SelectMulti/SelectMulti.d.ts +5 -20
  190. package/dist/types/components/ShellTools/ShellTools.d.ts +1 -0
  191. package/dist/types/components/Switch/Switch.d.ts +1 -1
  192. package/dist/types/components.d.ts +13 -2
  193. package/dist/types/utils/choice-list-parts.d.ts +4 -0
  194. package/dist/types/utils/control-press.d.ts +9 -0
  195. package/dist/types/utils/control-text.d.ts +3 -1
  196. package/dist/types/utils/index.d.ts +1 -1
  197. package/dist/types/utils/select-controller.d.ts +67 -0
  198. package/package.json +1 -1
  199. package/dist/components/p-B9xVWER6.js +0 -2
  200. package/dist/components/p-B9xVWER6.js.map +0 -1
  201. package/dist/components/p-BLea0TrP.js +0 -2
  202. package/dist/components/p-BLea0TrP.js.map +0 -1
  203. package/dist/components/p-BY0PzkUp.js +0 -2
  204. package/dist/components/p-BbgPGF2a.js +0 -2
  205. package/dist/components/p-BbgPGF2a.js.map +0 -1
  206. package/dist/components/p-BhC1YyId.js +0 -2
  207. package/dist/components/p-BhC1YyId.js.map +0 -1
  208. package/dist/components/p-Ccj5Op6E.js +0 -2
  209. package/dist/components/p-CiqnkENu.js +0 -2
  210. package/dist/components/p-CiqnkENu.js.map +0 -1
  211. package/dist/components/p-Cx-ywr1e.js +0 -2
  212. package/dist/components/p-Cx-ywr1e.js.map +0 -1
  213. package/dist/components/p-DPME1wUJ.js +0 -2
  214. package/dist/components/p-DPME1wUJ.js.map +0 -1
  215. package/dist/components/p-DSa0Hnd3.js +0 -2
  216. package/dist/components/p-DSa0Hnd3.js.map +0 -1
  217. package/dist/components/p-DUlqUNbE.js +0 -2
  218. package/dist/components/p-DUlqUNbE.js.map +0 -1
  219. package/dist/components/p-DXLWm4PF.js +0 -2
  220. package/dist/components/p-DYcC5-R9.js +0 -2
  221. package/dist/components/p-DYcC5-R9.js.map +0 -1
  222. package/dist/components/p-DbpfpeQT.js +0 -2
  223. package/dist/components/p-DbpfpeQT.js.map +0 -1
  224. package/dist/components/p-DuFm-ieS.js +0 -2
  225. package/dist/components/p-DuFm-ieS.js.map +0 -1
  226. package/dist/components/p-uQhuDEVt.js +0 -2
  227. package/dist/components/p-uQhuDEVt.js.map +0 -1
  228. /package/dist/components/{p-DwX7UmLl.js.map → p--eKXTylf.js.map} +0 -0
  229. /package/dist/components/{p-DIoiApa-.js.map → p-5-QAFB4j.js.map} +0 -0
  230. /package/dist/components/{p-D-xttdpn.js.map → p-B-9A0e_0.js.map} +0 -0
  231. /package/dist/components/{p-CaRyxTMz.js.map → p-BT5hgg5i.js.map} +0 -0
  232. /package/dist/components/{p-DQDpDYyF.js.map → p-B_5nxOeB.js.map} +0 -0
  233. /package/dist/components/{p-BkAMkjIR.js.map → p-Bl001G0Y.js.map} +0 -0
  234. /package/dist/components/{p-DWdRSOBV.js.map → p-C0-K8vnW.js.map} +0 -0
  235. /package/dist/components/{p-Ccj5Op6E.js.map → p-C9h13YnX.js.map} +0 -0
  236. /package/dist/components/{p-CnHrJTD5.js.map → p-CUAYsK44.js.map} +0 -0
  237. /package/dist/components/{p-CWTih3Gc.js.map → p-CqWV4Hl_.js.map} +0 -0
  238. /package/dist/components/{p-B9bxDfZV.js.map → p-Crsn82rz.js.map} +0 -0
  239. /package/dist/components/{p-BwsGYxZx.js.map → p-CvyTZ4Mg.js.map} +0 -0
  240. /package/dist/components/{p-DqubRds2.js.map → p-DNFd4Ao-.js.map} +0 -0
  241. /package/dist/components/{p-BwGnhInj.js.map → p-k0Hmj1KV.js.map} +0 -0
  242. /package/dist/components/{p-BY0PzkUp.js.map → p-pgxlkvUy.js.map} +0 -0
@@ -49,23 +49,25 @@
49
49
  "The popup is a listbox with aria-multiselectable and every option exposes its independent aria-selected state.",
50
50
  "Disabled options expose aria-disabled and are skipped by keyboard navigation and typeahead.",
51
51
  "Keyboard navigation keeps the aria-activedescendant option scrolled into the visible listbox viewport.",
52
- "Each row uses a medium-size presentation-only ds-checkbox indicator; multi-select option rows never add a prefix icon alongside it, and the option remains the sole selection semantic and interaction target.",
52
+ "Each row uses a presentation-only ds-checkbox indicator at the same density as the row; multi-select option rows never add a prefix icon alongside it, and the option remains the sole selection semantic and interaction target.",
53
53
  "The trigger keeps its field label visible and appends the current selected count; an explicit aria-label or aria-labelledby remains the authoritative accessible name when supplied.",
54
54
  "Use errorMessage with error so the trigger is described by the rendered alert."
55
55
  ],
56
56
  "states": [
57
+ "Select and SelectMulti share popup positioning, dismissal, focus, typeahead, and listbox traversal while retaining their distinct scalar and array selection contracts.",
58
+ "Every size applies one complete control-density recipe across trigger height, inline padding, icon zones, text-container inset, gap, and radius; error content follows the shared 4px field flow.",
57
59
  "Values is a controlled JavaScript array; dsChange emits a new array after each user toggle.",
58
60
  "Required SelectMulti controls begin without an automatic selection and require the user to make an explicit choice.",
59
61
  "Selecting an option keeps the popup open so additional values can be toggled.",
60
- "The trigger label stays left-aligned at every width; every option row uses the same leading medium Checkbox indicator. The default control size is md in both forms and filter bars.",
62
+ "The trigger label stays left-aligned at every width; every option row uses the same leading Checkbox indicator at its density. The default control size is md in both forms and filter bars.",
61
63
  "The selected count always follows the persistent label as plain text separated by a centered dot, including for one selection, and counts every selected value even when search or grouping hides it. Never replace the count with selected option names.",
62
64
  "Create sections only for categories that are meaningful to customers, not merely to break a long list into arbitrary chunks.",
63
65
  "When any option supplies subtext, every row uses the same subtext structure and missing values render an em dash. Subtext should disambiguate or add decision-helpful information.",
64
66
  "Option labels stay on one line and truncate when constrained. Option subtext may wrap to at most two lines.",
65
67
  "The optional prefix icon and chevron always use the parent surface's secondary foreground color, including when selection promotes the label and count to primary.",
66
- "The shared popup search control stays md at every trigger size, using body-medium text, a 20px icon, and the same internal spacing as a borderless Select trigger. Its container uses menu-item padding on every side and owns a 1px bottom divider that becomes a 1.5px bold-brand stroke while search has focus. Search placeholder text is secondary at rest and quaternary while focused because it becomes decorative once the editable field is active.",
68
+ "The shared popup search control follows the SelectMulti density, using the same text, icon, and internal spacing as a borderless trigger. Its container uses menu-item padding on every side and owns a 1px bottom divider that becomes a 1.5px bold-brand stroke while search has focus. Search placeholder text is secondary at rest and quaternary while focused because it becomes decorative once the editable field is active.",
67
69
  "When search contains text, the shared control shows a rounded sm icon-only ButtonUnfilled with the Cross icon and no border. It clears the local term, stays hidden for an empty term, and returns focus to search.",
68
- "The shared summary-and-clear footer mirrors the search region's sizing: menu-item padding surrounds an md-height borderless row, and both texts use the same row and label insets as option text. The outer footer owns a 1px top divider.",
70
+ "The shared summary-and-clear footer mirrors the owning density: menu-item padding surrounds a borderless density row, and both texts use the same row and label insets as option text. The outer footer owns a 1px top divider.",
69
71
  "An empty filtered list composes the message-only body variant of EmptyState. Keep the default neutral no-results message unless localized product guidance makes the outcome clearer.",
70
72
  "Enable searchable for more than roughly 20 options, user-managed listings, large domains such as addresses, or sets users cannot efficiently scan. Local matching includes option labels, subtext, and section headings; the owner resolves remote data before assigning options.",
71
73
  "When allowClear is enabled, clear-all appears only after at least one value exists. Clearing is valid for optional and required fields; a required field becomes invalid until the user selects again.",
@@ -343,7 +345,7 @@
343
345
  },
344
346
  "size": {
345
347
  "type": "SelectMultiSize",
346
- "resolvedType": "\"md\" | \"sm\" | \"xs\"",
348
+ "resolvedType": "\"lg\" | \"md\" | \"sm\" | \"xs\"",
347
349
  "attribute": "size",
348
350
  "default": "'md'",
349
351
  "required": false,
@@ -639,7 +641,7 @@
639
641
  },
640
642
  "size": {
641
643
  "type": "SelectMultiSize",
642
- "resolvedType": "\"md\" | \"sm\" | \"xs\"",
644
+ "resolvedType": "\"lg\" | \"md\" | \"sm\" | \"xs\"",
643
645
  "attribute": "size",
644
646
  "default": "'md'",
645
647
  "required": false,
@@ -749,7 +751,7 @@
749
751
  },
750
752
  {
751
753
  "path": "src/wc/components/SelectMulti/SelectMulti.tsx",
752
- "content": "import {\n AttachInternals,\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Method,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport {\n controlWidthClass,\n CONTROL_TEXT_VARIANT,\n choicePopupMinWidth,\n resolveCssLengthPx,\n resolveCssTimeMs,\n resolveChoicePopupAlignOffset,\n TOKEN_DEFAULTS,\n DEFAULT_REQUIRED_MESSAGE,\n setRequiredValidity,\n type ControlWidth,\n} from '../../utils';\nimport { computeAnchoredPopupPosition } from '../../utils/anchored-popup';\nimport { ChoiceFooter, ChoiceOptionRow, ChoiceSearch } from '../../utils/choice-list-parts';\nimport {\n choiceBackgroundClassMap,\n choiceListUsesSubtext,\n enabledChoiceIndexes,\n filterChoiceSections,\n findChoiceTypeaheadMatch,\n flattenChoiceSections,\n moveChoiceIndex,\n resolveChoiceSections,\n} from '../../utils/choice-list';\nimport type {\n SelectBackground,\n SelectOption,\n SelectSection,\n SelectSize,\n} from '../Select/Select';\n\nexport type SelectMultiOption = Omit<SelectOption, 'icon'>;\nexport type SelectMultiSection = Omit<SelectSection, 'options'> & {\n options: SelectMultiOption[];\n};\nexport type SelectMultiBackground = SelectBackground;\nexport type SelectMultiSize = SelectSize;\nexport type SelectMultiWidth = ControlWidth;\n\nconst ICON_SIZE: Record<SelectMultiSize, 'md' | 'sm' | 'xs'> = {\n md: 'md',\n sm: 'sm',\n xs: 'xs',\n};\n\nlet selectMultiId = 0;\n/** rAF retries while the conditionally rendered popup mounts. */\nconst POSITION_RETRY_BUDGET = 8;\n\n@Component({\n tag: 'ds-select-multi',\n styleUrl: 'SelectMulti.css',\n scoped: true,\n formAssociated: true,\n})\nexport class SelectMulti {\n @Element() el!: HTMLElement;\n @AttachInternals() internals!: ElementInternals;\n\n /** Flat choices. Assign arrays through the JavaScript property. */\n @Prop() options: SelectMultiOption[] = [];\n /** Grouped choices; takes precedence over options. Assign through JavaScript. */\n @Prop() sections: SelectMultiSection[] = [];\n /** Selected values. Assign arrays through the JavaScript property. */\n @Prop({ mutable: true }) values: string[] = [];\n /** Controlled popup visibility. */\n @Prop({ mutable: true, reflect: true }) open: boolean = false;\n /** Native form field name used for each repeated selected-value entry. */\n @Prop({ reflect: true }) name: string | undefined;\n /** Native disabled state. */\n @Prop({ reflect: true }) disabled: boolean = false;\n /** Require at least one valid selected value. */\n @Prop({ reflect: true }) required: boolean = false;\n /** Validation message used when required is missing. */\n @Prop() requiredMessage: string = DEFAULT_REQUIRED_MESSAGE;\n /** Persistent trigger label; selected option labels never replace it. */\n @Prop() placeholder: string = 'Select';\n /** Control density. */\n @Prop() size: SelectMultiSize = 'md';\n /** Width fit — hug content (default) or fill the parent. */\n @Prop() width: SelectMultiWidth = 'hug';\n /** Shared inactive treatment; removes interaction and form submission. */\n @Prop() isInactive: boolean = false;\n /** Replace the prefix with a loader and disable option interaction. */\n @Prop() isLoading: boolean = false;\n /** Show the selected interaction fill when at least one value exists. */\n @Prop() activeFill: boolean = true;\n /** Show the surface-aware inset border. */\n @Prop() hasBorder: boolean = true;\n /** Optional trigger prefix icon name. */\n @Prop() icon: string | undefined;\n /** Show the clear-all footer action when values exist. */\n @Prop() allowClear: boolean = true;\n /** Localized clear-all action label. */\n @Prop() clearLabel: string = 'Clear';\n /** Localized noun displayed after the selected count. */\n @Prop() selectedLabel: string = 'selected';\n /** Show immediate local filtering over option labels, subtext, and section headings. */\n @Prop() searchable: boolean = false;\n /** Localized search-field placeholder and accessible name. */\n @Prop() searchPlaceholder: string = 'Search';\n /** Localized empty-filter result text. */\n @Prop() noResultsText: string = 'No results found';\n /** Accessible loading status label. */\n @Prop() loadingLabel: string = 'Loading';\n /** Actual parent surface context; omit on primary and secondary surfaces. */\n @Prop() background: SelectMultiBackground | undefined;\n /** Show invalid visual state. */\n @Prop() error: boolean = false;\n /** Error text rendered below the trigger when error is true. */\n @Prop() errorMessage: string | undefined;\n /** ID applied to the internal combobox trigger for external labels. */\n @Prop() inputId: string | undefined;\n /** Direct accessible name when no external label is available. */\n @Prop({ attribute: 'aria-label' }) ariaLabel: string | null = null;\n /** IDs of elements that label the combobox. */\n @Prop({ attribute: 'aria-labelledby' }) ariaLabelledby: string | undefined;\n /** Additional IDs that describe the combobox. */\n @Prop({ attribute: 'aria-describedby' }) ariaDescribedby: string | undefined;\n\n /** Emitted after user toggles or clearing with a new values array. */\n @Event() dsChange!: EventEmitter<string[]>;\n /** Emitted after the footer clear-all action. */\n @Event() dsClear!: EventEmitter<void>;\n /** Emitted whenever popup visibility changes. */\n @Event() dsOpenChange!: EventEmitter<boolean>;\n\n @State() private activeIndex = -1;\n @State() private searchTerm = '';\n @State() private formDisabled = false;\n @State() private position = { x: 0, y: 0 };\n @State() private positionReady = false;\n @State() private focusRingVisible = false;\n\n private readonly generatedId = `ds-select-multi-${++selectMultiId}`;\n private readonly listboxId = `${this.generatedId}-listbox`;\n private readonly errorId = `${this.generatedId}-error`;\n private triggerEl: HTMLButtonElement | null = null;\n private popupEl: HTMLDivElement | null = null;\n private searchEl: HTMLInputElement | null = null;\n private initialValues: string[] = [];\n private typeahead = '';\n private typeaheadTimer: ReturnType<typeof setTimeout> | null = null;\n private outsideHandler: ((event: MouseEvent) => void) | null = null;\n private repositionHandler: (() => void) | null = null;\n private positionRetryRaf: number | null = null;\n\n componentWillLoad() {\n this.initialValues = [...this.values];\n this.syncFormValue();\n }\n\n componentDidLoad() {\n if (this.open) this.onOpenChange(true);\n }\n\n disconnectedCallback() {\n this.cancelPositionRetry();\n this.unbindPopupListeners();\n if (this.typeaheadTimer) clearTimeout(this.typeaheadTimer);\n }\n\n @Watch('values')\n @Watch('disabled')\n @Watch('isInactive')\n @Watch('required')\n @Watch('name')\n @Watch('options')\n @Watch('sections')\n syncFormValue() {\n const resolvedValues = this.resolvedValues;\n if (this.isDisabled || !this.name || resolvedValues.length === 0) {\n this.internals.setFormValue(null);\n } else {\n const data = new FormData();\n resolvedValues.forEach(value => data.append(this.name as string, value));\n this.internals.setFormValue(data, JSON.stringify(resolvedValues));\n }\n const missing = this.required && !this.isDisabled && resolvedValues.length === 0;\n setRequiredValidity(this.internals, missing, this.requiredMessage);\n if (this.open) {\n const enabled = enabledChoiceIndexes(this.visibleOptions);\n if (!enabled.includes(this.activeIndex)) this.activeIndex = enabled[0] ?? -1;\n requestAnimationFrame(() => this.updatePosition());\n }\n }\n\n @Watch('isLoading')\n onLoadingChange() {\n if (this.open) requestAnimationFrame(() => this.updatePosition());\n }\n\n @Watch('open')\n onOpenChange(open: boolean) {\n this.dsOpenChange.emit(open);\n if (open) {\n this.bindPopupListeners();\n this.schedulePositionUpdate(() => {\n this.scrollActiveOptionIntoView();\n if (this.searchable) this.searchEl?.focus();\n });\n } else {\n this.cancelPositionRetry();\n this.unbindPopupListeners();\n this.searchTerm = '';\n this.positionReady = false;\n }\n }\n\n @Watch('searchTerm')\n onSearchTermChange() {\n this.activeIndex = enabledChoiceIndexes(this.visibleOptions)[0] ?? -1;\n requestAnimationFrame(() => {\n this.updatePosition();\n this.scrollActiveOptionIntoView();\n });\n }\n\n @Watch('activeIndex')\n onActiveIndexChange() {\n requestAnimationFrame(() => this.scrollActiveOptionIntoView());\n }\n\n formDisabledCallback(disabled: boolean) {\n this.formDisabled = disabled;\n this.syncFormValue();\n }\n\n formResetCallback() {\n this.values = [...this.initialValues];\n this.closePopup();\n }\n\n formStateRestoreCallback(state: string | File | FormData | null) {\n if (typeof state !== 'string') {\n this.values = [];\n return;\n }\n try {\n const restored = JSON.parse(state);\n this.values = Array.isArray(restored)\n ? restored.filter((value): value is string => typeof value === 'string')\n : [];\n } catch {\n this.values = [];\n }\n }\n\n @Method()\n async setFocus() {\n this.triggerEl?.focus();\n }\n\n private get isDisabled(): boolean {\n return this.disabled || this.isInactive || this.formDisabled;\n }\n\n private get allSections(): SelectMultiSection[] {\n return resolveChoiceSections(this.options, this.sections);\n }\n\n private get allOptions(): SelectMultiOption[] {\n return flattenChoiceSections(this.allSections);\n }\n\n private get visibleSections(): SelectMultiSection[] {\n return this.searchable\n ? filterChoiceSections(this.allSections, this.searchTerm)\n : this.allSections;\n }\n\n private get visibleOptions(): SelectMultiOption[] {\n return flattenChoiceSections(this.visibleSections);\n }\n\n private get resolvedValues(): string[] {\n const valid = new Set(this.allOptions.map(option => option.value));\n return [...new Set(this.values.filter(value => valid.has(value)))];\n }\n\n private get hasSelection(): boolean {\n return this.resolvedValues.length > 0;\n }\n\n private get activeOptionId(): string | undefined {\n return !this.isLoading && this.activeIndex >= 0\n ? `${this.generatedId}-option-${this.activeIndex}`\n : undefined;\n }\n\n private scrollActiveOptionIntoView() {\n if (!this.open || !this.activeOptionId) return;\n this.el\n .querySelector<HTMLElement>(`#${this.activeOptionId}`)\n ?.scrollIntoView({ block: 'nearest', inline: 'nearest' });\n }\n\n private bindPopupListeners() {\n this.unbindPopupListeners();\n this.outsideHandler = event => {\n if (this.el.contains(event.target as Node)) return;\n this.closePopup();\n };\n this.repositionHandler = () => this.updatePosition();\n document.addEventListener('mousedown', this.outsideHandler, true);\n window.addEventListener('scroll', this.repositionHandler, true);\n window.addEventListener('resize', this.repositionHandler);\n }\n\n private unbindPopupListeners() {\n if (this.outsideHandler) {\n document.removeEventListener('mousedown', this.outsideHandler, true);\n this.outsideHandler = null;\n }\n if (this.repositionHandler) {\n window.removeEventListener('scroll', this.repositionHandler, true);\n window.removeEventListener('resize', this.repositionHandler);\n this.repositionHandler = null;\n }\n }\n\n private cancelPositionRetry() {\n if (this.positionRetryRaf !== null) {\n cancelAnimationFrame(this.positionRetryRaf);\n this.positionRetryRaf = null;\n }\n }\n\n /** Retry until the conditionally rendered popup is mounted and measurable. */\n private schedulePositionUpdate(onReady?: () => void) {\n if (!this.open) return;\n\n this.cancelPositionRetry();\n this.positionReady = false;\n let remaining = POSITION_RETRY_BUDGET;\n\n const attempt = () => {\n this.positionRetryRaf = null;\n if (!this.open) return;\n\n if (this.updatePosition()) {\n onReady?.();\n return;\n }\n\n if (remaining > 0) {\n remaining -= 1;\n this.positionRetryRaf = requestAnimationFrame(attempt);\n }\n };\n\n this.positionRetryRaf = requestAnimationFrame(attempt);\n }\n\n /** @returns `true` when the current popup was found and positioned. */\n private updatePosition(): boolean {\n if (\n !this.open ||\n !this.triggerEl ||\n !this.popupEl ||\n !this.popupEl.isConnected ||\n !this.el.contains(this.popupEl)\n ) return false;\n const sectionPadding = resolveCssLengthPx(TOKEN_DEFAULTS.space050, TOKEN_DEFAULTS.space050);\n this.popupEl.style.minWidth = `${choicePopupMinWidth(this.triggerEl.offsetWidth, sectionPadding)}px`;\n this.position = computeAnchoredPopupPosition({\n anchorRect: this.triggerEl.getBoundingClientRect(),\n popupWidth: this.popupEl.offsetWidth,\n popupHeight: this.popupEl.offsetHeight,\n side: 'bottom',\n align: 'start',\n sideOffsetPx: sectionPadding,\n alignOffsetPx: resolveChoicePopupAlignOffset({\n align: 'start',\n alignOffsetPx: 0,\n sectionInsetPx: sectionPadding,\n }),\n viewportPadPx: sectionPadding,\n viewportWidth: window.innerWidth,\n viewportHeight: window.innerHeight,\n });\n this.positionReady = true;\n return true;\n }\n\n private openPopup(focusVisible: boolean, edge?: 'first' | 'last') {\n if (this.isDisabled || (!this.allOptions.length && !this.isLoading)) return;\n const enabled = enabledChoiceIndexes(this.visibleOptions);\n this.activeIndex =\n edge === 'last'\n ? (enabled[enabled.length - 1] ?? -1)\n : (enabled[0] ?? -1);\n this.focusRingVisible = focusVisible;\n this.open = true;\n }\n\n private closePopup(restoreFocus = false) {\n if (!this.open) return;\n this.open = false;\n if (restoreFocus) requestAnimationFrame(() => this.triggerEl?.focus());\n }\n\n private toggleOption(option: SelectMultiOption) {\n if (option.isInactive || this.isLoading) return;\n const current = this.resolvedValues;\n const next = current.includes(option.value)\n ? current.filter(value => value !== option.value)\n : [...current, option.value];\n this.values = next;\n this.dsChange.emit([...next]);\n }\n\n private clearSelection = (event: Event) => {\n event.preventDefault();\n event.stopPropagation();\n this.values = [];\n this.dsChange.emit([]);\n this.dsClear.emit();\n requestAnimationFrame(() => (this.searchable ? this.searchEl?.focus() : this.triggerEl?.focus()));\n };\n\n private handleTypeahead(key: string) {\n if (this.typeaheadTimer) clearTimeout(this.typeaheadTimer);\n this.focusRingVisible = true;\n const normalized = key.toLocaleLowerCase();\n const repeatedCharacter =\n this.typeahead.length > 0 &&\n [...this.typeahead].every(character => character === normalized);\n this.typeahead = repeatedCharacter ? normalized : `${this.typeahead}${normalized}`;\n const match = findChoiceTypeaheadMatch(this.visibleOptions, this.typeahead, this.activeIndex);\n if (match >= 0) this.activeIndex = match;\n const resetMs = resolveCssTimeMs(\n TOKEN_DEFAULTS.animationDurationMedium1,\n TOKEN_DEFAULTS.animationDurationMedium1,\n );\n this.typeaheadTimer = setTimeout(() => {\n this.typeahead = '';\n this.typeaheadTimer = null;\n }, resetMs);\n }\n\n private handleListKeyDown(event: KeyboardEvent) {\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n this.focusRingVisible = true;\n this.activeIndex = moveChoiceIndex(this.visibleOptions, this.activeIndex, 1);\n break;\n case 'ArrowUp':\n event.preventDefault();\n this.focusRingVisible = true;\n this.activeIndex = moveChoiceIndex(this.visibleOptions, this.activeIndex, -1);\n break;\n case 'Home':\n event.preventDefault();\n this.focusRingVisible = true;\n this.activeIndex = enabledChoiceIndexes(this.visibleOptions)[0] ?? -1;\n break;\n case 'End': {\n event.preventDefault();\n this.focusRingVisible = true;\n const enabled = enabledChoiceIndexes(this.visibleOptions);\n this.activeIndex = enabled[enabled.length - 1] ?? -1;\n break;\n }\n case 'Enter':\n case ' ': {\n if (event.key === ' ' && this.searchable && event.target === this.searchEl) break;\n event.preventDefault();\n const option = this.visibleOptions[this.activeIndex];\n if (option) this.toggleOption(option);\n break;\n }\n case 'Escape':\n event.preventDefault();\n this.closePopup(true);\n break;\n case 'Tab':\n this.closePopup();\n break;\n default:\n if (!this.searchable && event.key.length === 1 && !event.metaKey && !event.ctrlKey && !event.altKey) {\n this.handleTypeahead(event.key);\n }\n }\n }\n\n private handleTriggerKeyDown = (event: KeyboardEvent) => {\n if (!this.open) {\n if (['ArrowDown', 'ArrowUp', 'Enter', ' '].includes(event.key)) {\n event.preventDefault();\n this.openPopup(true, event.key === 'ArrowUp' ? 'last' : 'first');\n } else if (event.key.length === 1 && !event.metaKey && !event.ctrlKey && !event.altKey) {\n event.preventDefault();\n this.openPopup(true);\n if (this.searchable) this.searchTerm = event.key;\n else this.handleTypeahead(event.key);\n }\n return;\n }\n this.handleListKeyDown(event);\n };\n\n private renderOption(option: SelectMultiOption, index: number, usesSubtext: boolean) {\n const selected = this.values.includes(option.value);\n const active = this.activeIndex === index;\n return (\n <ChoiceOptionRow\n id={`${this.generatedId}-option-${index}`}\n option={option}\n selected={selected}\n active={active}\n focusRingVisible={this.focusRingVisible}\n usesSubtext={usesSubtext}\n leading={(\n <span class=\"ds-choice-item__icon ds-interaction-fill__content\" aria-hidden=\"true\">\n <ds-checkbox\n class=\"select-option__checkbox\"\n label=\"\"\n size=\"md\"\n checked={selected}\n presentation\n />\n </span>\n )}\n onHover={() => {\n this.focusRingVisible = false;\n this.activeIndex = index;\n }}\n onSelect={() => this.toggleOption(option)}\n />\n );\n }\n\n render() {\n const inactive = this.isDisabled;\n const count = this.resolvedValues.length;\n const textVariant = CONTROL_TEXT_VARIANT[this.size];\n const iconSize = ICON_SIZE[this.size];\n const usesOptionSubtext = choiceListUsesSubtext(this.allOptions);\n const showError = this.error && Boolean(this.errorMessage);\n const describedBy = [this.ariaDescribedby, showError ? this.errorId : undefined]\n .filter(Boolean)\n .join(' ') || undefined;\n const popupStyle = {\n position: 'fixed',\n left: '0',\n top: '0',\n transform: `translate(${Math.round(this.position.x)}px, ${Math.round(this.position.y)}px)`,\n zIndex: 'var(--dimension-z-index-floating)',\n visibility: this.positionReady ? 'visible' : 'hidden',\n };\n let flatIndex = 0;\n\n return (\n <Host\n class={{\n 'select-host': true,\n 'ds-control-inactive': inactive,\n 'ds-control--md': this.size === 'md',\n 'ds-control--sm': this.size === 'sm',\n 'ds-control--xs': this.size === 'xs',\n ...controlWidthClass(this.width),\n [`select-host--background-${this.background}`]: !!this.background,\n }}\n >\n <button\n ref={element => {\n this.triggerEl = (element as HTMLButtonElement) ?? null;\n }}\n id={this.inputId ?? this.generatedId}\n type=\"button\"\n class={{\n trigger: true,\n 'ds-focus-ring-inset': true,\n 'ds-interaction-fill': true,\n 'ds-interaction-fill--selected':\n !inactive && this.activeFill && this.hasSelection,\n 'trigger--bordered': this.hasBorder || this.error,\n 'trigger--has-value': this.hasSelection,\n 'wrapper--error': this.error,\n [`ds-control--${this.size}`]: true,\n ...choiceBackgroundClassMap(this.background),\n }}\n disabled={inactive}\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded={String(this.open)}\n aria-controls={this.open ? this.listboxId : undefined}\n aria-activedescendant={this.open && !this.searchable ? this.activeOptionId : undefined}\n aria-label={this.ariaLabel}\n aria-labelledby={this.ariaLabelledby}\n aria-describedby={describedBy}\n aria-invalid={this.error ? 'true' : undefined}\n aria-required={this.required || undefined}\n aria-busy={this.isLoading ? 'true' : undefined}\n onClick={() => (this.open ? this.closePopup() : this.openPopup(false))}\n onKeyDown={this.handleTriggerKeyDown}\n >\n {(this.icon || this.isLoading) && (\n <span class=\"trigger__prefix ds-interaction-fill__content\" aria-hidden=\"true\">\n {this.isLoading ? (\n <ds-loader size={iconSize} color=\"inherit\" />\n ) : (\n <ds-icon name={this.icon} size={iconSize} color=\"inherit\" />\n )}\n </span>\n )}\n <ds-text\n class=\"trigger__label ds-interaction-fill__content\"\n as=\"span\"\n variant={textVariant}\n color=\"inherit\"\n lineTruncation={1}\n >\n {`${this.placeholder}${count > 0 ? ` · ${count}` : ''}`}\n </ds-text>\n <span class=\"trigger__chevron ds-interaction-fill__content\" aria-hidden=\"true\">\n <ds-icon name=\"ChevronDown\" size={iconSize} color=\"inherit\" />\n </span>\n </button>\n\n {this.open && (\n <div\n ref={element => {\n this.popupEl = (element as HTMLDivElement) ?? null;\n }}\n class=\"select-popup ds-choice-popup\"\n style={popupStyle}\n >\n {this.searchable && (\n <ChoiceSearch\n value={this.searchTerm}\n placeholder={this.searchPlaceholder}\n controls={this.listboxId}\n activeDescendant={this.activeOptionId}\n inputRef={element => {\n this.searchEl = element;\n }}\n clearLabel={this.clearLabel}\n onValueChange={value => {\n this.searchTerm = value;\n }}\n onKeyDown={event => this.handleListKeyDown(event)}\n />\n )}\n <div\n id={this.listboxId}\n class=\"ds-choice-list\"\n role=\"listbox\"\n aria-multiselectable=\"true\"\n aria-label={this.ariaLabel ?? this.placeholder}\n aria-busy={this.isLoading ? 'true' : undefined}\n >\n {this.isLoading ? (\n <div\n class=\"ds-choice-loading\"\n role=\"option\"\n aria-selected=\"false\"\n aria-disabled=\"true\"\n aria-label={this.loadingLabel}\n aria-live=\"polite\"\n >\n <ds-loader size=\"md\" color=\"inherit\" />\n </div>\n ) : this.visibleOptions.length === 0 ? (\n <div\n class=\"ds-choice-empty\"\n role=\"option\"\n aria-selected=\"false\"\n aria-disabled=\"true\"\n aria-label={this.noResultsText}\n aria-live=\"polite\"\n >\n <ds-empty-state body={this.noResultsText} />\n </div>\n ) : (\n this.visibleSections.map(section => (\n <div\n class={{\n 'ds-choice-section': true,\n 'ds-choice-section--divided': !!section.divider,\n }}\n role={section.header ? 'group' : undefined}\n aria-label={section.header}\n >\n {section.header && (\n <ds-text\n class=\"ds-choice-section__header ds-control--md\"\n as=\"span\"\n variant=\"text-body-small\"\n emphasis\n color=\"primary\"\n aria-hidden=\"true\"\n >\n {section.header}\n </ds-text>\n )}\n {section.options.map(option => this.renderOption(\n option,\n flatIndex++,\n usesOptionSubtext,\n ))}\n </div>\n ))\n )}\n </div>\n {this.allowClear && this.hasSelection && !this.isLoading && (\n <ChoiceFooter\n summary={`${count} ${this.selectedLabel}`}\n clearLabel={this.clearLabel}\n onClear={this.clearSelection}\n />\n )}\n </div>\n )}\n\n {showError && (\n <ds-text\n class=\"error-text\"\n as=\"div\"\n variant=\"text-body-small\"\n color=\"negative\"\n textId={this.errorId}\n role=\"alert\"\n >\n {this.errorMessage}\n </ds-text>\n )}\n </Host>\n );\n }\n}\n",
754
+ "content": "import {\n AttachInternals,\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Method,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport {\n controlWidthClass,\n CONTROL_SUPPORTING_TEXT_VARIANT,\n CONTROL_TEXT_VARIANT,\n DEFAULT_REQUIRED_MESSAGE,\n setRequiredValidity,\n type ControlWidth,\n} from '../../utils';\nimport { ChoiceFooter, ChoiceOptionRow, ChoiceSearch } from '../../utils/choice-list-parts';\nimport {\n choiceBackgroundClassMap,\n choiceListUsesSubtext,\n filterChoiceSections,\n flattenChoiceSections,\n resolveChoiceSections,\n} from '../../utils/choice-list';\nimport { SelectController } from '../../utils/select-controller';\nimport type {\n SelectBackground,\n SelectOption,\n SelectSection,\n SelectSize,\n} from '../Select/Select';\n\nexport type SelectMultiOption = Omit<SelectOption, 'icon'>;\nexport type SelectMultiSection = Omit<SelectSection, 'options'> & {\n options: SelectMultiOption[];\n};\nexport type SelectMultiBackground = SelectBackground;\nexport type SelectMultiSize = SelectSize;\nexport type SelectMultiWidth = ControlWidth;\n\nconst ICON_SIZE: Record<SelectMultiSize, 'lg' | 'md' | 'sm' | 'xs'> = {\n lg: 'lg',\n md: 'md',\n sm: 'sm',\n xs: 'xs',\n};\n\nlet selectMultiId = 0;\n\n@Component({\n tag: 'ds-select-multi',\n styleUrl: 'SelectMulti.css',\n scoped: true,\n formAssociated: true,\n})\nexport class SelectMulti {\n @Element() el!: HTMLElement;\n @AttachInternals() internals!: ElementInternals;\n\n /** Flat choices. Assign arrays through the JavaScript property. */\n @Prop() options: SelectMultiOption[] = [];\n /** Grouped choices; takes precedence over options. Assign through JavaScript. */\n @Prop() sections: SelectMultiSection[] = [];\n /** Selected values. Assign arrays through the JavaScript property. */\n @Prop({ mutable: true }) values: string[] = [];\n /** Controlled popup visibility. */\n @Prop({ mutable: true, reflect: true }) open: boolean = false;\n /** Native form field name used for each repeated selected-value entry. */\n @Prop({ reflect: true }) name: string | undefined;\n /** Native disabled state. */\n @Prop({ reflect: true }) disabled: boolean = false;\n /** Require at least one valid selected value. */\n @Prop({ reflect: true }) required: boolean = false;\n /** Validation message used when required is missing. */\n @Prop() requiredMessage: string = DEFAULT_REQUIRED_MESSAGE;\n /** Persistent trigger label; selected option labels never replace it. */\n @Prop() placeholder: string = 'Select';\n /** Control density. */\n @Prop() size: SelectMultiSize = 'md';\n /** Width fit — hug content (default) or fill the parent. */\n @Prop() width: SelectMultiWidth = 'hug';\n /** Shared inactive treatment; removes interaction and form submission. */\n @Prop() isInactive: boolean = false;\n /** Replace the prefix with a loader and disable option interaction. */\n @Prop() isLoading: boolean = false;\n /** Show the selected interaction fill when at least one value exists. */\n @Prop() activeFill: boolean = true;\n /** Show the surface-aware inset border. */\n @Prop() hasBorder: boolean = true;\n /** Optional trigger prefix icon name. */\n @Prop() icon: string | undefined;\n /** Show the clear-all footer action when values exist. */\n @Prop() allowClear: boolean = true;\n /** Localized clear-all action label. */\n @Prop() clearLabel: string = 'Clear';\n /** Localized noun displayed after the selected count. */\n @Prop() selectedLabel: string = 'selected';\n /** Show immediate local filtering over option labels, subtext, and section headings. */\n @Prop() searchable: boolean = false;\n /** Localized search-field placeholder and accessible name. */\n @Prop() searchPlaceholder: string = 'Search';\n /** Localized empty-filter result text. */\n @Prop() noResultsText: string = 'No results found';\n /** Accessible loading status label. */\n @Prop() loadingLabel: string = 'Loading';\n /** Actual parent surface context; omit on primary and secondary surfaces. */\n @Prop() background: SelectMultiBackground | undefined;\n /** Show invalid visual state. */\n @Prop() error: boolean = false;\n /** Error text rendered below the trigger when error is true. */\n @Prop() errorMessage: string | undefined;\n /** ID applied to the internal combobox trigger for external labels. */\n @Prop() inputId: string | undefined;\n /** Direct accessible name when no external label is available. */\n @Prop({ attribute: 'aria-label' }) ariaLabel: string | null = null;\n /** IDs of elements that label the combobox. */\n @Prop({ attribute: 'aria-labelledby' }) ariaLabelledby: string | undefined;\n /** Additional IDs that describe the combobox. */\n @Prop({ attribute: 'aria-describedby' }) ariaDescribedby: string | undefined;\n\n /** Emitted after user toggles or clearing with a new values array. */\n @Event() dsChange!: EventEmitter<string[]>;\n /** Emitted after the footer clear-all action. */\n @Event() dsClear!: EventEmitter<void>;\n /** Emitted whenever popup visibility changes. */\n @Event() dsOpenChange!: EventEmitter<boolean>;\n\n @State() private activeIndex = -1;\n @State() private searchTerm = '';\n @State() private formDisabled = false;\n @State() private position = { x: 0, y: 0 };\n @State() private positionReady = false;\n @State() private focusRingVisible = false;\n\n private readonly generatedId = `ds-select-multi-${++selectMultiId}`;\n private readonly listboxId = `${this.generatedId}-listbox`;\n private readonly errorId = `${this.generatedId}-error`;\n private initialValues: string[] = [];\n private readonly controller = this.createController();\n\n private createController() {\n // eslint-disable-next-line @typescript-eslint/no-this-alias -- adapter getters preserve reactive component ownership without inheritance.\n const owner = this;\n return new SelectController<SelectMultiOption>({\n get host() { return owner.el; },\n generatedId: owner.generatedId,\n get options() { return owner.visibleOptions; },\n get searchable() { return owner.searchable; },\n get isLoading() { return owner.isLoading; },\n get isDisabled() { return owner.isDisabled; },\n get preferredIndex() { return -1; },\n get open() { return owner.open; },\n set open(value) { owner.open = value; },\n get activeIndex() { return owner.activeIndex; },\n set activeIndex(value) { owner.activeIndex = value; },\n get searchTerm() { return owner.searchTerm; },\n set searchTerm(value) { owner.searchTerm = value; },\n get focusRingVisible() { return owner.focusRingVisible; },\n set focusRingVisible(value) { owner.focusRingVisible = value; },\n get position() { return owner.position; },\n set position(value) { owner.position = value; },\n get positionReady() { return owner.positionReady; },\n set positionReady(value) { owner.positionReady = value; },\n selectOption: option => owner.toggleOption(option),\n });\n }\n\n componentWillLoad() {\n this.initialValues = [...this.values];\n this.syncFormValue();\n }\n\n componentDidLoad() {\n this.controller.connect();\n }\n\n disconnectedCallback() {\n this.controller.disconnect();\n }\n\n @Watch('values')\n @Watch('disabled')\n @Watch('isInactive')\n @Watch('required')\n @Watch('name')\n @Watch('options')\n @Watch('sections')\n syncFormValue() {\n const resolvedValues = this.resolvedValues;\n if (this.isDisabled || !this.name || resolvedValues.length === 0) {\n this.internals.setFormValue(null);\n } else {\n const data = new FormData();\n resolvedValues.forEach(value => data.append(this.name as string, value));\n this.internals.setFormValue(data, JSON.stringify(resolvedValues));\n }\n const missing = this.required && !this.isDisabled && resolvedValues.length === 0;\n setRequiredValidity(this.internals, missing, this.requiredMessage);\n this.controller.optionsChanged();\n }\n\n @Watch('isLoading')\n onLoadingChange() {\n this.controller.loadingChanged();\n }\n\n @Watch('open')\n onOpenChange(open: boolean) {\n this.dsOpenChange.emit(open);\n this.controller.openChanged(open);\n }\n\n @Watch('searchTerm')\n onSearchTermChange() {\n this.controller.searchChanged();\n }\n\n @Watch('activeIndex')\n onActiveIndexChange() {\n this.controller.activeIndexChanged();\n }\n\n formDisabledCallback(disabled: boolean) {\n this.formDisabled = disabled;\n this.syncFormValue();\n }\n\n formResetCallback() {\n this.values = [...this.initialValues];\n this.closePopup();\n }\n\n formStateRestoreCallback(state: string | File | FormData | null) {\n if (typeof state !== 'string') {\n this.values = [];\n return;\n }\n try {\n const restored = JSON.parse(state);\n this.values = Array.isArray(restored)\n ? restored.filter((value): value is string => typeof value === 'string')\n : [];\n } catch {\n this.values = [];\n }\n }\n\n @Method()\n async setFocus() {\n this.controller.setFocus();\n }\n\n private get isDisabled(): boolean {\n return this.disabled || this.isInactive || this.formDisabled;\n }\n\n private get allSections(): SelectMultiSection[] {\n return resolveChoiceSections(this.options, this.sections);\n }\n\n private get allOptions(): SelectMultiOption[] {\n return flattenChoiceSections(this.allSections);\n }\n\n private get visibleSections(): SelectMultiSection[] {\n return this.searchable\n ? filterChoiceSections(this.allSections, this.searchTerm)\n : this.allSections;\n }\n\n private get visibleOptions(): SelectMultiOption[] {\n return flattenChoiceSections(this.visibleSections);\n }\n\n private get resolvedValues(): string[] {\n const valid = new Set(this.allOptions.map(option => option.value));\n return [...new Set(this.values.filter(value => valid.has(value)))];\n }\n\n private get hasSelection(): boolean {\n return this.resolvedValues.length > 0;\n }\n\n private get activeOptionId(): string | undefined {\n return this.controller.activeOptionId;\n }\n\n private closePopup(restoreFocus = false) {\n this.controller.closePopup(restoreFocus);\n }\n\n private openPopup(focusVisible: boolean, edge?: 'first' | 'last') {\n this.controller.openPopup(focusVisible, edge);\n }\n\n private toggleOption(option: SelectMultiOption) {\n if (option.isInactive || this.isLoading) return;\n const current = this.resolvedValues;\n const next = current.includes(option.value)\n ? current.filter(value => value !== option.value)\n : [...current, option.value];\n this.values = next;\n this.dsChange.emit([...next]);\n }\n\n private clearSelection = (event: Event) => {\n event.preventDefault();\n event.stopPropagation();\n this.values = [];\n this.dsChange.emit([]);\n this.dsClear.emit();\n this.controller.focusSearchOrTrigger();\n };\n\n private readonly handleListKeyDown = this.controller.handleListKeyDown;\n private readonly handleTriggerKeyDown = this.controller.handleTriggerKeyDown;\n\n private renderOption(option: SelectMultiOption, index: number, usesSubtext: boolean) {\n const selected = this.values.includes(option.value);\n const active = this.activeIndex === index;\n return (\n <ChoiceOptionRow\n size={this.size}\n id={`${this.generatedId}-option-${index}`}\n option={option}\n selected={selected}\n active={active}\n focusRingVisible={this.focusRingVisible}\n usesSubtext={usesSubtext}\n leading={(\n <span class=\"ds-choice-item__icon ds-control-icon-box ds-interaction-fill__content\" aria-hidden=\"true\">\n <ds-checkbox\n class=\"select-option__checkbox\"\n label=\"\"\n size={this.size}\n checked={selected}\n presentation\n />\n </span>\n )}\n onHover={() => {\n this.focusRingVisible = false;\n this.activeIndex = index;\n }}\n onSelect={() => this.toggleOption(option)}\n />\n );\n }\n\n render() {\n const inactive = this.isDisabled;\n const count = this.resolvedValues.length;\n const textVariant = CONTROL_TEXT_VARIANT[this.size];\n const iconSize = ICON_SIZE[this.size];\n const usesOptionSubtext = choiceListUsesSubtext(this.allOptions);\n const showError = this.error && Boolean(this.errorMessage);\n const describedBy = [this.ariaDescribedby, showError ? this.errorId : undefined]\n .filter(Boolean)\n .join(' ') || undefined;\n const popupStyle = {\n position: 'fixed',\n left: '0',\n top: '0',\n transform: `translate(${Math.round(this.position.x)}px, ${Math.round(this.position.y)}px)`,\n zIndex: 'var(--dimension-z-index-floating)',\n visibility: this.positionReady ? 'visible' : 'hidden',\n };\n let flatIndex = 0;\n\n return (\n <Host\n class={{\n 'select-host': true,\n 'ds-field-stack': true,\n 'ds-control-inactive': inactive,\n [`ds-control--${this.size}`]: true,\n ...controlWidthClass(this.width),\n [`select-host--background-${this.background}`]: !!this.background,\n }}\n >\n <button\n ref={element => {\n this.controller.setTriggerElement((element as HTMLButtonElement) ?? null);\n }}\n id={this.inputId ?? this.generatedId}\n type=\"button\"\n class={{\n trigger: true,\n 'ds-control-frame': true,\n 'ds-focus-ring-inset': true,\n 'ds-interaction-fill': true,\n 'ds-interaction-fill--selected':\n !inactive && this.activeFill && this.hasSelection,\n 'trigger--bordered': this.hasBorder || this.error,\n 'trigger--has-value': this.hasSelection,\n 'wrapper--error': this.error,\n [`ds-control--${this.size}`]: true,\n ...choiceBackgroundClassMap(this.background),\n }}\n disabled={inactive}\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded={String(this.open)}\n aria-controls={this.open ? this.listboxId : undefined}\n aria-activedescendant={this.open && !this.searchable ? this.activeOptionId : undefined}\n aria-label={this.ariaLabel}\n aria-labelledby={this.ariaLabelledby}\n aria-describedby={describedBy}\n aria-invalid={this.error ? 'true' : undefined}\n aria-required={this.required || undefined}\n aria-busy={this.isLoading ? 'true' : undefined}\n onClick={() => (this.open ? this.closePopup() : this.openPopup(false))}\n onKeyDown={this.handleTriggerKeyDown}\n >\n {(this.icon || this.isLoading) && (\n <span class=\"trigger__prefix ds-control-icon-box ds-interaction-fill__content\" aria-hidden=\"true\">\n {this.isLoading ? (\n <ds-loader size={iconSize} color=\"inherit\" />\n ) : (\n <ds-icon name={this.icon} size={iconSize} color=\"inherit\" />\n )}\n </span>\n )}\n <ds-text\n class=\"trigger__label ds-control-label-box ds-interaction-fill__content\"\n as=\"span\"\n variant={textVariant}\n color=\"inherit\"\n lineTruncation={1}\n >\n {`${this.placeholder}${count > 0 ? ` · ${count}` : ''}`}\n </ds-text>\n <span class=\"trigger__chevron ds-control-icon-box ds-interaction-fill__content\" aria-hidden=\"true\">\n <ds-icon name=\"ChevronDown\" size={iconSize} color=\"inherit\" />\n </span>\n </button>\n\n {this.open && (\n <div\n ref={element => {\n this.controller.setPopupElement((element as HTMLDivElement) ?? null);\n }}\n class=\"select-popup ds-choice-popup\"\n style={popupStyle}\n >\n {this.searchable && (\n <ChoiceSearch\n size={this.size}\n value={this.searchTerm}\n placeholder={this.searchPlaceholder}\n controls={this.listboxId}\n activeDescendant={this.activeOptionId}\n inputRef={this.controller.setSearchElement}\n clearLabel={this.clearLabel}\n onValueChange={value => {\n this.searchTerm = value;\n }}\n onKeyDown={event => this.handleListKeyDown(event)}\n />\n )}\n <div\n id={this.listboxId}\n class=\"ds-choice-list\"\n role=\"listbox\"\n aria-multiselectable=\"true\"\n aria-label={this.ariaLabel ?? this.placeholder}\n aria-busy={this.isLoading ? 'true' : undefined}\n >\n {this.isLoading ? (\n <div\n class=\"ds-choice-loading\"\n role=\"option\"\n aria-selected=\"false\"\n aria-disabled=\"true\"\n aria-label={this.loadingLabel}\n aria-live=\"polite\"\n >\n <ds-loader size={this.size} color=\"inherit\" />\n </div>\n ) : this.visibleOptions.length === 0 ? (\n <div\n class=\"ds-choice-empty ds-empty-region\"\n role=\"option\"\n aria-selected=\"false\"\n aria-disabled=\"true\"\n aria-label={this.noResultsText}\n aria-live=\"polite\"\n >\n <ds-empty-state body={this.noResultsText} />\n </div>\n ) : (\n this.visibleSections.map(section => (\n <div\n class={{\n 'ds-choice-section': true,\n 'ds-chrome-column': true,\n 'ds-chrome-space--sm': true,\n 'ds-choice-section--divided': !!section.divider,\n }}\n role={section.header ? 'group' : undefined}\n aria-label={section.header}\n >\n {section.header && (\n <ds-text\n class={`ds-choice-section__header ds-control--${this.size}`}\n as=\"span\"\n variant={CONTROL_SUPPORTING_TEXT_VARIANT[this.size]}\n emphasis\n color=\"primary\"\n aria-hidden=\"true\"\n >\n {section.header}\n </ds-text>\n )}\n {section.options.map(option => this.renderOption(\n option,\n flatIndex++,\n usesOptionSubtext,\n ))}\n </div>\n ))\n )}\n </div>\n {this.allowClear && this.hasSelection && !this.isLoading && (\n <ChoiceFooter\n size={this.size}\n summary={`${count} ${this.selectedLabel}`}\n clearLabel={this.clearLabel}\n onClear={this.clearSelection}\n />\n )}\n </div>\n )}\n\n {showError && (\n <ds-text\n class=\"error-text\"\n as=\"div\"\n variant=\"text-body-small\"\n color=\"negative\"\n textId={this.errorId}\n role=\"alert\"\n >\n {this.errorMessage}\n </ds-text>\n )}\n </Host>\n );\n }\n}\n",
753
755
  "type": "registry:ui"
754
756
  }
755
757
  ]
@@ -58,6 +58,8 @@
58
58
  "Use errorMessage with error so the trigger is described by the rendered alert."
59
59
  ],
60
60
  "states": [
61
+ "Select and SelectMulti share popup positioning, dismissal, focus, typeahead, and listbox traversal while retaining their distinct scalar and array selection contracts.",
62
+ "Every size applies one complete control-density recipe across trigger height, inline padding, icon zones, text-container inset, gap, and radius; error content follows the shared 4px field flow.",
61
63
  "Value is controlled through the mutable value property; dsChange reports user selection and clearing.",
62
64
  "Required Selects begin without an automatic selection and require the user to make an explicit choice; do not preselect the first option merely to satisfy validity.",
63
65
  "When allowClear is enabled, the clear affordance appears only after a value exists. Clearing is valid for optional and required fields; a required field becomes invalid until the user selects again.",
@@ -69,9 +71,9 @@
69
71
  "When any option supplies subtext, every row uses the same subtext structure and missing values render an em dash. Subtext should disambiguate or add decision-helpful information.",
70
72
  "Option labels and the selected trigger label stay on one line and truncate when constrained. Option subtext may wrap to at most two lines.",
71
73
  "The optional prefix icon and chevron always use the parent surface's secondary foreground color, including when a selected value promotes the label to primary.",
72
- "The shared popup search control stays md at every trigger size, using body-medium text, a 20px icon, and the same internal spacing as a borderless Select trigger. Its container uses menu-item padding on every side and owns a 1px bottom divider that becomes a 1.5px bold-brand stroke while search has focus. Search placeholder text is secondary at rest and quaternary while focused because it becomes decorative once the editable field is active.",
73
- "When search contains text, the shared control shows a rounded sm icon-only ButtonUnfilled with the CrossCircle icon and no border. It clears the local term, stays hidden for an empty term, and returns focus to search.",
74
- "The shared clear footer mirrors the search region's sizing: menu-item padding surrounds an md-height borderless row, and the Clear label uses the same row and label insets as option text. The outer footer owns a 1px top divider.",
74
+ "The shared popup search control follows the Select density, using the same text, icon, and internal spacing as a borderless trigger. Its container uses menu-item padding on every side and owns a 1px bottom divider that becomes a 1.5px bold-brand stroke while search has focus. Search placeholder text is secondary at rest and quaternary while focused because it becomes decorative once the editable field is active.",
75
+ "When search contains text, the shared control shows a rounded icon-only ButtonUnfilled with the CrossCircle icon and no border, sized to remain inset within the current row density. It clears the local term, stays hidden for an empty term, and returns focus to search.",
76
+ "The shared clear footer mirrors the owning density: menu-item padding surrounds a borderless density row, and the Clear label uses the same row and label insets as option text. The outer footer owns a 1px top divider.",
75
77
  "An empty filtered list composes the message-only body variant of EmptyState. Keep the default neutral no-results message unless localized product guidance makes the outcome clearer.",
76
78
  "Enable searchable for more than roughly 20 options, user-managed listings, large domains such as addresses, or sets users cannot efficiently scan. Local matching includes option labels, subtext, and section headings; the owner resolves remote data before assigning options.",
77
79
  "Validation timing belongs to the form owner and may be immediate or deferred until blur or submit; the Select exposes validity and error presentation without imposing that policy.",
@@ -336,7 +338,7 @@
336
338
  },
337
339
  "size": {
338
340
  "type": "SelectSize",
339
- "resolvedType": "\"md\" | \"sm\" | \"xs\"",
341
+ "resolvedType": "\"lg\" | \"md\" | \"sm\" | \"xs\"",
340
342
  "attribute": "size",
341
343
  "default": "'md'",
342
344
  "required": false,
@@ -624,7 +626,7 @@
624
626
  },
625
627
  "size": {
626
628
  "type": "SelectSize",
627
- "resolvedType": "\"md\" | \"sm\" | \"xs\"",
629
+ "resolvedType": "\"lg\" | \"md\" | \"sm\" | \"xs\"",
628
630
  "attribute": "size",
629
631
  "default": "'md'",
630
632
  "required": false,
@@ -729,12 +731,12 @@
729
731
  "files": [
730
732
  {
731
733
  "path": "src/wc/components/Select/Select.css",
732
- "content": "@import '../../utils/choice-list.css';\n@import '../../utils/control-width.css';\n@import '../../utils/search-control.css';\n@import '../../utils/typography.css';\n\n:host(.select-host) {\n display: inline-flex;\n flex-direction: column;\n gap: var(--dimension-space-050);\n position: relative;\n outline: none;\n --ds-select-fg: var(--color-foreground-secondary);\n --ds-select-fg-active: var(--color-foreground-primary);\n --ds-select-prefix-fg: var(--ds-select-fg);\n --ds-select-chevron-fg: var(--ds-select-fg);\n --ds-select-border: var(--color-border-secondary);\n}\n\n:host(.ds-control-width--fill),\n:host(.ds-control-width--fill) .trigger {\n width: 100%;\n}\n\n.trigger {\n display: inline-flex;\n align-items: center;\n justify-content: flex-start;\n box-sizing: border-box;\n height: var(--ds-control-height, var(--dimension-size-400));\n padding: 0 var(--ds-control-padding-inline, var(--dimension-space-075));\n gap: var(--ds-control-gap, var(--dimension-space-050));\n background: transparent;\n border: none;\n border-radius: var(--ds-control-radius, var(--dimension-radius-025));\n color: var(--ds-select-fg);\n cursor: default;\n font-family: inherit;\n -webkit-user-select: none;\n user-select: none;\n overflow: hidden;\n transition: color var(--effect-motion-short-2);\n}\n\n.trigger--bordered {\n --ds-interaction-border-width: var(--dimension-stroke-width-012);\n --ds-interaction-border-color: var(--ds-select-border);\n}\n\n.trigger--has-value .trigger__label {\n color: var(--ds-select-fg-active);\n}\n\n.wrapper--error {\n --ds-interaction-border-width: var(--dimension-stroke-width-018);\n --ds-interaction-border-color: var(--color-border-bold-negative);\n}\n\n.trigger__prefix,\n.trigger__chevron {\n position: relative;\n z-index: 2;\n flex-shrink: 0;\n width: var(--ds-control-icon, var(--dimension-iconography-md));\n height: var(--ds-control-icon, var(--dimension-iconography-md));\n display: inline-flex;\n align-items: center;\n justify-content: center;\n}\n\n.trigger__prefix {\n color: var(--ds-select-prefix-fg);\n}\n\n.trigger__chevron {\n color: var(--ds-select-chevron-fg);\n}\n\n.trigger__label {\n position: relative;\n z-index: 2;\n flex: 1 1 auto;\n min-width: 0;\n padding: 0 var(--ds-control-label-inset, var(--dimension-space-025));\n text-align: left;\n color: inherit;\n transition: color var(--effect-motion-short-2);\n}\n\n.select-popup {\n color: var(--color-foreground-secondary);\n}\n\n.select-option[aria-selected='true'] .ds-choice-item__icon {\n color: var(--color-foreground-primary);\n}\n\n.error-text {\n width: 100%;\n}\n\n:host(.select-host--background-medium) {\n --ds-select-fg: var(--color-foreground-on-medium-background-secondary);\n --ds-select-fg-active: var(--color-foreground-on-medium-background-primary);\n --ds-select-border: var(--color-border-on-medium-background-secondary);\n}\n\n:host(.select-host--background-bold) {\n --ds-select-fg: var(--color-foreground-on-bold-background-secondary);\n --ds-select-fg-active: var(--color-foreground-on-bold-background-primary);\n --ds-select-border: var(--color-border-on-bold-background-secondary);\n}\n\n:host(.select-host--background-strong) {\n --ds-select-fg: var(--color-foreground-on-strong-background-secondary);\n --ds-select-fg-active: var(--color-foreground-on-strong-background-primary);\n --ds-select-border: var(--color-border-on-strong-background-secondary);\n}\n\n:host(.select-host--background-translucent) {\n --ds-select-fg: var(--color-translucent-foreground-secondary);\n --ds-select-fg-active: var(--color-translucent-foreground-primary);\n --ds-select-border: var(--color-translucent-border-secondary);\n}\n\n:host(.select-host--background-inverted) {\n --ds-select-fg: var(--color-inverted-foreground-secondary);\n --ds-select-fg-active: var(--color-inverted-foreground-primary);\n --ds-select-border: var(--color-inverted-border-secondary);\n}\n\n:host(.select-host--background-media) {\n --ds-select-fg: var(--color-media-foreground-secondary);\n --ds-select-fg-active: var(--color-media-foreground-primary);\n --ds-select-border: var(--color-media-border-secondary);\n}\n\n:host(.select-host--background-always-dark) {\n --ds-select-fg: var(--color-always-dark-foreground-secondary);\n --ds-select-fg-active: var(--color-always-dark-foreground-primary);\n --ds-select-border: var(--color-always-dark-border-secondary);\n}\n",
734
+ "content": "@import '../../utils/choice-list.css';\n@import '../../utils/control-parts.css';\n@import '../../utils/control-width.css';\n@import '../../utils/field-stack.css';\n@import '../../utils/search-control.css';\n@import '../../utils/typography.css';\n\n:host(.select-host) {\n display: inline-flex;\n position: relative;\n outline: none;\n --ds-select-fg: var(--color-foreground-secondary);\n --ds-select-fg-active: var(--color-foreground-primary);\n --ds-select-prefix-fg: var(--ds-select-fg);\n --ds-select-chevron-fg: var(--ds-select-fg);\n --ds-select-border: var(--color-border-secondary);\n}\n\n:host(.ds-control-width--fill),\n:host(.ds-control-width--fill) .trigger {\n width: 100%;\n}\n\n.trigger {\n justify-content: flex-start;\n background: transparent;\n border: none;\n border-radius: var(--ds-control-radius, var(--dimension-radius-025));\n color: var(--ds-select-fg);\n cursor: default;\n font-family: inherit;\n -webkit-user-select: none;\n user-select: none;\n overflow: hidden;\n transition: color var(--effect-motion-short-2);\n}\n\n.trigger--bordered {\n --ds-interaction-border-width: var(--dimension-stroke-width-012);\n --ds-interaction-border-color: var(--ds-select-border);\n}\n\n.trigger--has-value .trigger__label {\n color: var(--ds-select-fg-active);\n}\n\n.wrapper--error {\n --ds-interaction-border-width: var(--dimension-stroke-width-018);\n --ds-interaction-border-color: var(--color-border-bold-negative);\n}\n\n.trigger__prefix,\n.trigger__chevron {\n position: relative;\n z-index: 2;\n}\n\n.trigger__prefix {\n color: var(--ds-select-prefix-fg);\n}\n\n.trigger__chevron {\n color: var(--ds-select-chevron-fg);\n}\n\n.trigger__label {\n position: relative;\n z-index: 2;\n flex: 1 1 auto;\n text-align: left;\n color: inherit;\n transition: color var(--effect-motion-short-2);\n}\n\n.select-popup {\n color: var(--color-foreground-secondary);\n}\n\n.select-option[aria-selected='true'] .ds-choice-item__icon {\n color: var(--color-foreground-primary);\n}\n\n.error-text {\n width: 100%;\n}\n\n:host(.select-host--background-medium) {\n --ds-select-fg: var(--color-foreground-on-medium-background-secondary);\n --ds-select-fg-active: var(--color-foreground-on-medium-background-primary);\n --ds-select-border: var(--color-border-on-medium-background-secondary);\n}\n\n:host(.select-host--background-bold) {\n --ds-select-fg: var(--color-foreground-on-bold-background-secondary);\n --ds-select-fg-active: var(--color-foreground-on-bold-background-primary);\n --ds-select-border: var(--color-border-on-bold-background-secondary);\n}\n\n:host(.select-host--background-strong) {\n --ds-select-fg: var(--color-foreground-on-strong-background-secondary);\n --ds-select-fg-active: var(--color-foreground-on-strong-background-primary);\n --ds-select-border: var(--color-border-on-strong-background-secondary);\n}\n\n:host(.select-host--background-translucent) {\n --ds-select-fg: var(--color-translucent-foreground-secondary);\n --ds-select-fg-active: var(--color-translucent-foreground-primary);\n --ds-select-border: var(--color-translucent-border-secondary);\n}\n\n:host(.select-host--background-inverted) {\n --ds-select-fg: var(--color-inverted-foreground-secondary);\n --ds-select-fg-active: var(--color-inverted-foreground-primary);\n --ds-select-border: var(--color-inverted-border-secondary);\n}\n\n:host(.select-host--background-media) {\n --ds-select-fg: var(--color-media-foreground-secondary);\n --ds-select-fg-active: var(--color-media-foreground-primary);\n --ds-select-border: var(--color-media-border-secondary);\n}\n\n:host(.select-host--background-always-dark) {\n --ds-select-fg: var(--color-always-dark-foreground-secondary);\n --ds-select-fg-active: var(--color-always-dark-foreground-primary);\n --ds-select-border: var(--color-always-dark-border-secondary);\n}\n",
733
735
  "type": "registry:ui"
734
736
  },
735
737
  {
736
738
  "path": "src/wc/components/Select/Select.tsx",
737
- "content": "import {\n AttachInternals,\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Method,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport {\n controlWidthClass,\n CONTROL_TEXT_VARIANT,\n choicePopupMinWidth,\n resolveCssLengthPx,\n resolveCssTimeMs,\n resolveChoicePopupAlignOffset,\n TOKEN_DEFAULTS,\n DEFAULT_REQUIRED_MESSAGE,\n setRequiredValidity,\n type ControlWidth,\n} from '../../utils';\nimport { computeAnchoredPopupPosition } from '../../utils/anchored-popup';\nimport { ChoiceFooter, ChoiceOptionRow, ChoiceSearch } from '../../utils/choice-list-parts';\nimport {\n choiceBackgroundClassMap,\n choiceListUsesIcons,\n choiceListUsesSubtext,\n enabledChoiceIndexes,\n filterChoiceSections,\n findChoiceTypeaheadMatch,\n flattenChoiceSections,\n moveChoiceIndex,\n resolveChoiceSections,\n type ChoiceBackground,\n type ChoiceOption,\n type ChoiceSection,\n} from '../../utils/choice-list';\n\nexport type SelectOption = ChoiceOption;\nexport type SelectSection = ChoiceSection;\nexport type SelectBackground = ChoiceBackground;\nexport type SelectSize = 'md' | 'sm' | 'xs';\nexport type SelectWidth = ControlWidth;\n\nconst ICON_SIZE: Record<SelectSize, 'md' | 'sm' | 'xs'> = {\n md: 'md',\n sm: 'sm',\n xs: 'xs',\n};\n\nlet selectId = 0;\n/** rAF retries while the conditionally rendered popup mounts. */\nconst POSITION_RETRY_BUDGET = 8;\n\n@Component({\n tag: 'ds-select',\n styleUrl: 'Select.css',\n scoped: true,\n formAssociated: true,\n})\nexport class Select {\n @Element() el!: HTMLElement;\n @AttachInternals() internals!: ElementInternals;\n\n /** Flat choices. Assign arrays through the JavaScript property. */\n @Prop() options: SelectOption[] = [];\n /** Grouped choices; takes precedence over options. Assign through JavaScript. */\n @Prop() sections: SelectSection[] = [];\n /** Selected string value. Unknown values render the placeholder and are not submitted. */\n @Prop({ mutable: true }) value: string = '';\n /** Controlled popup visibility. */\n @Prop({ mutable: true, reflect: true }) open: boolean = false;\n /** Native form field name. */\n @Prop({ reflect: true }) name: string | undefined;\n /** Native disabled state. */\n @Prop({ reflect: true }) disabled: boolean = false;\n /** Require one valid selected value. */\n @Prop({ reflect: true }) required: boolean = false;\n /** Validation message used when required is missing. */\n @Prop() requiredMessage: string = DEFAULT_REQUIRED_MESSAGE;\n /** Trigger text shown when no valid value is selected. */\n @Prop() placeholder: string = 'Select';\n /** Control density. */\n @Prop() size: SelectSize = 'md';\n /** Width fit — hug content (default) or fill the parent. */\n @Prop() width: SelectWidth = 'hug';\n /** Shared inactive treatment; removes interaction and form submission. */\n @Prop() isInactive: boolean = false;\n /** Replace the prefix with a loader and disable option interaction. */\n @Prop() isLoading: boolean = false;\n /** Show the selected interaction fill when a valid value exists. */\n @Prop() activeFill: boolean = true;\n /** Show the surface-aware inset border. */\n @Prop() hasBorder: boolean = true;\n /** Optional trigger prefix icon name. */\n @Prop() icon: string | undefined;\n /** Show the clear footer action when a value exists. */\n @Prop() allowClear: boolean = true;\n /** Localized clear action label. */\n @Prop() clearLabel: string = 'Clear';\n /** Show immediate local filtering over option labels, subtext, and section headings. */\n @Prop() searchable: boolean = false;\n /** Localized search-field placeholder and accessible name. */\n @Prop() searchPlaceholder: string = 'Search';\n /** Localized empty-filter result text. */\n @Prop() noResultsText: string = 'No results found';\n /** Accessible loading status label. */\n @Prop() loadingLabel: string = 'Loading';\n /** Actual parent surface context; omit on primary and secondary surfaces. */\n @Prop() background: SelectBackground | undefined;\n /** Show invalid visual state. */\n @Prop() error: boolean = false;\n /** Error text rendered below the trigger when error is true. */\n @Prop() errorMessage: string | undefined;\n /** ID applied to the internal combobox trigger for external labels. */\n @Prop() inputId: string | undefined;\n /** Direct accessible name when no external label is available. */\n @Prop({ attribute: 'aria-label' }) ariaLabel: string | null = null;\n /** IDs of elements that label the combobox. */\n @Prop({ attribute: 'aria-labelledby' }) ariaLabelledby: string | undefined;\n /** Additional IDs that describe the combobox. */\n @Prop({ attribute: 'aria-describedby' }) ariaDescribedby: string | undefined;\n\n /** Emitted after user selection or clearing with the next scalar value. */\n @Event() dsChange!: EventEmitter<string>;\n /** Emitted after the footer clear action. */\n @Event() dsClear!: EventEmitter<void>;\n /** Emitted whenever popup visibility changes. */\n @Event() dsOpenChange!: EventEmitter<boolean>;\n\n @State() private activeIndex = -1;\n @State() private searchTerm = '';\n @State() private formDisabled = false;\n @State() private position = { x: 0, y: 0 };\n @State() private positionReady = false;\n @State() private focusRingVisible = false;\n\n private readonly generatedId = `ds-select-${++selectId}`;\n private readonly listboxId = `${this.generatedId}-listbox`;\n private readonly errorId = `${this.generatedId}-error`;\n private triggerEl: HTMLButtonElement | null = null;\n private popupEl: HTMLDivElement | null = null;\n private searchEl: HTMLInputElement | null = null;\n private initialValue = '';\n private typeahead = '';\n private typeaheadTimer: ReturnType<typeof setTimeout> | null = null;\n private outsideHandler: ((event: MouseEvent) => void) | null = null;\n private repositionHandler: (() => void) | null = null;\n private positionRetryRaf: number | null = null;\n\n componentWillLoad() {\n this.initialValue = this.value;\n this.syncFormValue();\n }\n\n componentDidLoad() {\n if (this.open) this.onOpenChange(true);\n }\n\n disconnectedCallback() {\n this.cancelPositionRetry();\n this.unbindPopupListeners();\n if (this.typeaheadTimer) clearTimeout(this.typeaheadTimer);\n }\n\n @Watch('value')\n @Watch('disabled')\n @Watch('isInactive')\n @Watch('required')\n @Watch('options')\n @Watch('sections')\n syncFormValue() {\n const inactive = this.isDisabled;\n const resolvedValue = this.hasSelection ? this.value : '';\n this.internals.setFormValue(inactive ? null : resolvedValue);\n const missing = this.required && !inactive && !resolvedValue;\n setRequiredValidity(this.internals, missing, this.requiredMessage);\n if (this.open) {\n const enabled = enabledChoiceIndexes(this.visibleOptions);\n if (!enabled.includes(this.activeIndex)) this.activeIndex = enabled[0] ?? -1;\n requestAnimationFrame(() => this.updatePosition());\n }\n }\n\n @Watch('isLoading')\n onLoadingChange() {\n if (this.open) requestAnimationFrame(() => this.updatePosition());\n }\n\n @Watch('open')\n onOpenChange(open: boolean) {\n this.dsOpenChange.emit(open);\n if (open) {\n this.bindPopupListeners();\n this.schedulePositionUpdate(() => {\n this.scrollActiveOptionIntoView();\n if (this.searchable) this.searchEl?.focus();\n });\n } else {\n this.cancelPositionRetry();\n this.unbindPopupListeners();\n this.searchTerm = '';\n this.positionReady = false;\n }\n }\n\n @Watch('searchTerm')\n onSearchTermChange() {\n const enabled = enabledChoiceIndexes(this.visibleOptions);\n this.activeIndex = enabled[0] ?? -1;\n requestAnimationFrame(() => {\n this.updatePosition();\n this.scrollActiveOptionIntoView();\n });\n }\n\n @Watch('activeIndex')\n onActiveIndexChange() {\n requestAnimationFrame(() => this.scrollActiveOptionIntoView());\n }\n\n formDisabledCallback(disabled: boolean) {\n this.formDisabled = disabled;\n this.syncFormValue();\n }\n\n formResetCallback() {\n this.value = this.initialValue;\n this.closePopup();\n }\n\n formStateRestoreCallback(state: string | File | FormData | null) {\n this.value = typeof state === 'string' ? state : '';\n }\n\n @Method()\n async setFocus() {\n this.triggerEl?.focus();\n }\n\n private get isDisabled(): boolean {\n return this.disabled || this.isInactive || this.formDisabled;\n }\n\n private get allSections(): SelectSection[] {\n return resolveChoiceSections(this.options, this.sections);\n }\n\n private get allOptions(): SelectOption[] {\n return flattenChoiceSections(this.allSections);\n }\n\n private get visibleSections(): SelectSection[] {\n return this.searchable\n ? filterChoiceSections(this.allSections, this.searchTerm)\n : this.allSections;\n }\n\n private get visibleOptions(): SelectOption[] {\n return flattenChoiceSections(this.visibleSections);\n }\n\n private get selectedOption(): SelectOption | undefined {\n return this.allOptions.find(option => option.value === this.value);\n }\n\n private get hasSelection(): boolean {\n return Boolean(this.selectedOption);\n }\n\n private get activeOptionId(): string | undefined {\n return !this.isLoading && this.activeIndex >= 0\n ? `${this.generatedId}-option-${this.activeIndex}`\n : undefined;\n }\n\n private scrollActiveOptionIntoView() {\n if (!this.open || !this.activeOptionId) return;\n this.el\n .querySelector<HTMLElement>(`#${this.activeOptionId}`)\n ?.scrollIntoView({ block: 'nearest', inline: 'nearest' });\n }\n\n private bindPopupListeners() {\n this.unbindPopupListeners();\n this.outsideHandler = event => {\n const target = event.target as Node;\n if (this.el.contains(target)) return;\n this.closePopup();\n };\n this.repositionHandler = () => this.updatePosition();\n document.addEventListener('mousedown', this.outsideHandler, true);\n window.addEventListener('scroll', this.repositionHandler, true);\n window.addEventListener('resize', this.repositionHandler);\n }\n\n private unbindPopupListeners() {\n if (this.outsideHandler) {\n document.removeEventListener('mousedown', this.outsideHandler, true);\n this.outsideHandler = null;\n }\n if (this.repositionHandler) {\n window.removeEventListener('scroll', this.repositionHandler, true);\n window.removeEventListener('resize', this.repositionHandler);\n this.repositionHandler = null;\n }\n }\n\n private cancelPositionRetry() {\n if (this.positionRetryRaf !== null) {\n cancelAnimationFrame(this.positionRetryRaf);\n this.positionRetryRaf = null;\n }\n }\n\n /** Retry until the conditionally rendered popup is mounted and measurable. */\n private schedulePositionUpdate(onReady?: () => void) {\n if (!this.open) return;\n\n this.cancelPositionRetry();\n this.positionReady = false;\n let remaining = POSITION_RETRY_BUDGET;\n\n const attempt = () => {\n this.positionRetryRaf = null;\n if (!this.open) return;\n\n if (this.updatePosition()) {\n onReady?.();\n return;\n }\n\n if (remaining > 0) {\n remaining -= 1;\n this.positionRetryRaf = requestAnimationFrame(attempt);\n }\n };\n\n this.positionRetryRaf = requestAnimationFrame(attempt);\n }\n\n /** @returns `true` when the current popup was found and positioned. */\n private updatePosition(): boolean {\n if (\n !this.open ||\n !this.triggerEl ||\n !this.popupEl ||\n !this.popupEl.isConnected ||\n !this.el.contains(this.popupEl)\n ) return false;\n const sectionPadding = resolveCssLengthPx(TOKEN_DEFAULTS.space050, TOKEN_DEFAULTS.space050);\n this.popupEl.style.minWidth = `${choicePopupMinWidth(this.triggerEl.offsetWidth, sectionPadding)}px`;\n this.position = computeAnchoredPopupPosition({\n anchorRect: this.triggerEl.getBoundingClientRect(),\n popupWidth: this.popupEl.offsetWidth,\n popupHeight: this.popupEl.offsetHeight,\n side: 'bottom',\n align: 'start',\n sideOffsetPx: sectionPadding,\n alignOffsetPx: resolveChoicePopupAlignOffset({\n align: 'start',\n alignOffsetPx: 0,\n sectionInsetPx: sectionPadding,\n }),\n viewportPadPx: sectionPadding,\n viewportWidth: window.innerWidth,\n viewportHeight: window.innerHeight,\n });\n this.positionReady = true;\n return true;\n }\n\n private openPopup(focusVisible: boolean, edge?: 'first' | 'last') {\n if (this.isDisabled || (!this.allOptions.length && !this.isLoading)) return;\n const enabled = enabledChoiceIndexes(this.visibleOptions);\n const selectedIndex = this.visibleOptions.findIndex(\n option => option.value === this.value && !option.isInactive,\n );\n this.activeIndex =\n edge === 'last'\n ? (enabled[enabled.length - 1] ?? -1)\n : selectedIndex >= 0\n ? selectedIndex\n : (enabled[0] ?? -1);\n this.focusRingVisible = focusVisible;\n this.open = true;\n }\n\n private closePopup(restoreFocus = false) {\n if (!this.open) return;\n this.open = false;\n if (restoreFocus) requestAnimationFrame(() => this.triggerEl?.focus());\n }\n\n private selectOption(option: SelectOption) {\n if (option.isInactive || this.isLoading) return;\n this.value = option.value;\n this.dsChange.emit(this.value);\n this.closePopup(true);\n }\n\n private clearSelection = (event: Event) => {\n event.preventDefault();\n event.stopPropagation();\n this.value = '';\n this.dsChange.emit('');\n this.dsClear.emit();\n const enabled = enabledChoiceIndexes(this.visibleOptions);\n this.activeIndex = enabled[0] ?? -1;\n requestAnimationFrame(() => (this.searchable ? this.searchEl?.focus() : this.triggerEl?.focus()));\n };\n\n private moveActive(direction: 1 | -1) {\n this.activeIndex = moveChoiceIndex(this.visibleOptions, this.activeIndex, direction);\n }\n\n private setActiveEdge(edge: 'first' | 'last') {\n const enabled = enabledChoiceIndexes(this.visibleOptions);\n this.activeIndex =\n edge === 'first' ? (enabled[0] ?? -1) : (enabled[enabled.length - 1] ?? -1);\n }\n\n private handleTypeahead(key: string) {\n if (this.typeaheadTimer) clearTimeout(this.typeaheadTimer);\n this.focusRingVisible = true;\n const normalized = key.toLocaleLowerCase();\n const repeatedCharacter =\n this.typeahead.length > 0 &&\n [...this.typeahead].every(character => character === normalized);\n this.typeahead = repeatedCharacter ? normalized : `${this.typeahead}${normalized}`;\n const match = findChoiceTypeaheadMatch(this.visibleOptions, this.typeahead, this.activeIndex);\n if (match >= 0) this.activeIndex = match;\n const resetMs = resolveCssTimeMs(\n TOKEN_DEFAULTS.animationDurationMedium1,\n TOKEN_DEFAULTS.animationDurationMedium1,\n );\n this.typeaheadTimer = setTimeout(() => {\n this.typeahead = '';\n this.typeaheadTimer = null;\n }, resetMs);\n }\n\n private handleListKeyDown(event: KeyboardEvent) {\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n this.focusRingVisible = true;\n this.moveActive(1);\n break;\n case 'ArrowUp':\n event.preventDefault();\n this.focusRingVisible = true;\n this.moveActive(-1);\n break;\n case 'Home':\n event.preventDefault();\n this.focusRingVisible = true;\n this.setActiveEdge('first');\n break;\n case 'End':\n event.preventDefault();\n this.focusRingVisible = true;\n this.setActiveEdge('last');\n break;\n case 'Enter':\n case ' ': {\n if (event.key === ' ' && this.searchable && event.target === this.searchEl) break;\n event.preventDefault();\n const option = this.visibleOptions[this.activeIndex];\n if (option) this.selectOption(option);\n break;\n }\n case 'Escape':\n event.preventDefault();\n this.closePopup(true);\n break;\n case 'Tab':\n this.closePopup();\n break;\n default:\n if (!this.searchable && event.key.length === 1 && !event.metaKey && !event.ctrlKey && !event.altKey) {\n this.handleTypeahead(event.key);\n }\n }\n }\n\n private handleTriggerKeyDown = (event: KeyboardEvent) => {\n if (!this.open) {\n if (['ArrowDown', 'ArrowUp', 'Enter', ' '].includes(event.key)) {\n event.preventDefault();\n this.openPopup(true, event.key === 'ArrowUp' ? 'last' : 'first');\n } else if (event.key.length === 1 && !event.metaKey && !event.ctrlKey && !event.altKey) {\n event.preventDefault();\n this.openPopup(true);\n if (this.searchable) {\n this.searchTerm = event.key;\n } else {\n this.handleTypeahead(event.key);\n }\n }\n return;\n }\n this.handleListKeyDown(event);\n };\n\n private renderOption(\n option: SelectOption,\n index: number,\n usesIcons: boolean,\n usesSubtext: boolean,\n ) {\n const selected = option.value === this.value;\n const active = index === this.activeIndex;\n return (\n <ChoiceOptionRow\n id={`${this.generatedId}-option-${index}`}\n option={option}\n selected={selected}\n active={active}\n focusRingVisible={this.focusRingVisible}\n usesSubtext={usesSubtext}\n leading={usesIcons && option.icon ? (\n <span class=\"ds-choice-item__icon ds-interaction-fill__content\" aria-hidden=\"true\">\n <ds-icon name={option.icon} size=\"md\" color=\"inherit\" />\n </span>\n ) : undefined}\n onHover={() => {\n this.focusRingVisible = false;\n this.activeIndex = index;\n }}\n onSelect={() => this.selectOption(option)}\n />\n );\n }\n\n render() {\n const inactive = this.isDisabled;\n const showPlaceholder = !this.hasSelection;\n const label = showPlaceholder ? this.placeholder : this.selectedOption?.label;\n const textVariant = CONTROL_TEXT_VARIANT[this.size];\n const iconSize = ICON_SIZE[this.size];\n const usesOptionIcons = choiceListUsesIcons(this.allOptions);\n const usesOptionSubtext = choiceListUsesSubtext(this.allOptions);\n const showError = this.error && Boolean(this.errorMessage);\n const describedBy = [this.ariaDescribedby, showError ? this.errorId : undefined]\n .filter(Boolean)\n .join(' ') || undefined;\n const popupStyle = {\n position: 'fixed',\n left: '0',\n top: '0',\n transform: `translate(${Math.round(this.position.x)}px, ${Math.round(this.position.y)}px)`,\n zIndex: 'var(--dimension-z-index-floating)',\n visibility: this.positionReady ? 'visible' : 'hidden',\n };\n let flatIndex = 0;\n\n return (\n <Host\n class={{\n 'select-host': true,\n 'ds-control-inactive': inactive,\n 'ds-control--md': this.size === 'md',\n 'ds-control--sm': this.size === 'sm',\n 'ds-control--xs': this.size === 'xs',\n ...controlWidthClass(this.width),\n [`select-host--background-${this.background}`]: !!this.background,\n }}\n >\n <button\n ref={element => {\n this.triggerEl = (element as HTMLButtonElement) ?? null;\n }}\n id={this.inputId ?? this.generatedId}\n type=\"button\"\n class={{\n trigger: true,\n 'ds-focus-ring-inset': true,\n 'ds-interaction-fill': true,\n 'ds-interaction-fill--selected':\n !inactive && this.activeFill && this.hasSelection,\n 'trigger--bordered': this.hasBorder || this.error,\n 'trigger--placeholder': showPlaceholder,\n 'trigger--has-value': this.hasSelection,\n 'wrapper--error': this.error,\n [`ds-control--${this.size}`]: true,\n ...choiceBackgroundClassMap(this.background),\n }}\n disabled={inactive}\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded={String(this.open)}\n aria-controls={this.open ? this.listboxId : undefined}\n aria-activedescendant={this.open && !this.searchable ? this.activeOptionId : undefined}\n aria-label={this.ariaLabel}\n aria-labelledby={this.ariaLabelledby}\n aria-describedby={describedBy}\n aria-invalid={this.error ? 'true' : undefined}\n aria-required={this.required || undefined}\n aria-busy={this.isLoading ? 'true' : undefined}\n onClick={() => (this.open ? this.closePopup() : this.openPopup(false))}\n onKeyDown={this.handleTriggerKeyDown}\n >\n {(this.icon || this.isLoading) && (\n <span class=\"trigger__prefix ds-interaction-fill__content\" aria-hidden=\"true\">\n {this.isLoading ? (\n <ds-loader size={iconSize} color=\"inherit\" />\n ) : (\n <ds-icon name={this.icon} size={iconSize} color=\"inherit\" />\n )}\n </span>\n )}\n <ds-text\n class=\"trigger__label ds-interaction-fill__content\"\n as=\"span\"\n variant={textVariant}\n color=\"inherit\"\n lineTruncation={1}\n >\n {label}\n </ds-text>\n <span class=\"trigger__chevron ds-interaction-fill__content\" aria-hidden=\"true\">\n <ds-icon name=\"ChevronDown\" size={iconSize} color=\"inherit\" />\n </span>\n </button>\n\n {this.open && (\n <div\n ref={element => {\n this.popupEl = (element as HTMLDivElement) ?? null;\n }}\n class=\"select-popup ds-choice-popup\"\n style={popupStyle}\n >\n {this.searchable && (\n <ChoiceSearch\n value={this.searchTerm}\n placeholder={this.searchPlaceholder}\n controls={this.listboxId}\n activeDescendant={this.activeOptionId}\n inputRef={element => {\n this.searchEl = element;\n }}\n clearLabel={this.clearLabel}\n onValueChange={value => {\n this.searchTerm = value;\n }}\n onKeyDown={event => this.handleListKeyDown(event)}\n />\n )}\n <div\n id={this.listboxId}\n class=\"ds-choice-list\"\n role=\"listbox\"\n aria-label={this.ariaLabel ?? this.placeholder}\n aria-busy={this.isLoading ? 'true' : undefined}\n >\n {this.isLoading ? (\n <div\n class=\"ds-choice-loading\"\n role=\"option\"\n aria-selected=\"false\"\n aria-disabled=\"true\"\n aria-label={this.loadingLabel}\n aria-live=\"polite\"\n >\n <ds-loader size=\"md\" color=\"inherit\" />\n </div>\n ) : this.visibleOptions.length === 0 ? (\n <div\n class=\"ds-choice-empty\"\n role=\"option\"\n aria-selected=\"false\"\n aria-disabled=\"true\"\n aria-label={this.noResultsText}\n aria-live=\"polite\"\n >\n <ds-empty-state body={this.noResultsText} />\n </div>\n ) : (\n this.visibleSections.map(section => (\n <div\n class={{\n 'ds-choice-section': true,\n 'ds-choice-section--divided': !!section.divider,\n }}\n role={section.header ? 'group' : undefined}\n aria-label={section.header}\n >\n {section.header && (\n <ds-text\n class=\"ds-choice-section__header ds-control--md\"\n as=\"span\"\n variant=\"text-body-small\"\n emphasis\n color=\"primary\"\n aria-hidden=\"true\"\n >\n {section.header}\n </ds-text>\n )}\n {section.options.map(option => this.renderOption(\n option,\n flatIndex++,\n usesOptionIcons,\n usesOptionSubtext,\n ))}\n </div>\n ))\n )}\n </div>\n {this.allowClear && this.hasSelection && !this.isLoading && (\n <ChoiceFooter clearLabel={this.clearLabel} onClear={this.clearSelection} />\n )}\n </div>\n )}\n\n {showError && (\n <ds-text\n class=\"error-text\"\n as=\"div\"\n variant=\"text-body-small\"\n color=\"negative\"\n textId={this.errorId}\n role=\"alert\"\n >\n {this.errorMessage}\n </ds-text>\n )}\n </Host>\n );\n }\n}\n",
739
+ "content": "import {\n AttachInternals,\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Method,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport {\n controlWidthClass,\n CONTROL_SUPPORTING_TEXT_VARIANT,\n CONTROL_TEXT_VARIANT,\n DEFAULT_REQUIRED_MESSAGE,\n setRequiredValidity,\n type ControlWidth,\n} from '../../utils';\nimport { ChoiceFooter, ChoiceOptionRow, ChoiceSearch } from '../../utils/choice-list-parts';\nimport {\n choiceBackgroundClassMap,\n choiceListUsesIcons,\n choiceListUsesSubtext,\n enabledChoiceIndexes,\n filterChoiceSections,\n flattenChoiceSections,\n resolveChoiceSections,\n type ChoiceBackground,\n type ChoiceOption,\n type ChoiceSection,\n} from '../../utils/choice-list';\nimport { SelectController } from '../../utils/select-controller';\n\nexport type SelectOption = ChoiceOption;\nexport type SelectSection = ChoiceSection;\nexport type SelectBackground = ChoiceBackground;\nexport type SelectSize = 'lg' | 'md' | 'sm' | 'xs';\nexport type SelectWidth = ControlWidth;\n\nconst ICON_SIZE: Record<SelectSize, 'lg' | 'md' | 'sm' | 'xs'> = {\n lg: 'lg',\n md: 'md',\n sm: 'sm',\n xs: 'xs',\n};\n\nlet selectId = 0;\n\n@Component({\n tag: 'ds-select',\n styleUrl: 'Select.css',\n scoped: true,\n formAssociated: true,\n})\nexport class Select {\n @Element() el!: HTMLElement;\n @AttachInternals() internals!: ElementInternals;\n\n /** Flat choices. Assign arrays through the JavaScript property. */\n @Prop() options: SelectOption[] = [];\n /** Grouped choices; takes precedence over options. Assign through JavaScript. */\n @Prop() sections: SelectSection[] = [];\n /** Selected string value. Unknown values render the placeholder and are not submitted. */\n @Prop({ mutable: true }) value: string = '';\n /** Controlled popup visibility. */\n @Prop({ mutable: true, reflect: true }) open: boolean = false;\n /** Native form field name. */\n @Prop({ reflect: true }) name: string | undefined;\n /** Native disabled state. */\n @Prop({ reflect: true }) disabled: boolean = false;\n /** Require one valid selected value. */\n @Prop({ reflect: true }) required: boolean = false;\n /** Validation message used when required is missing. */\n @Prop() requiredMessage: string = DEFAULT_REQUIRED_MESSAGE;\n /** Trigger text shown when no valid value is selected. */\n @Prop() placeholder: string = 'Select';\n /** Control density. */\n @Prop() size: SelectSize = 'md';\n /** Width fit — hug content (default) or fill the parent. */\n @Prop() width: SelectWidth = 'hug';\n /** Shared inactive treatment; removes interaction and form submission. */\n @Prop() isInactive: boolean = false;\n /** Replace the prefix with a loader and disable option interaction. */\n @Prop() isLoading: boolean = false;\n /** Show the selected interaction fill when a valid value exists. */\n @Prop() activeFill: boolean = true;\n /** Show the surface-aware inset border. */\n @Prop() hasBorder: boolean = true;\n /** Optional trigger prefix icon name. */\n @Prop() icon: string | undefined;\n /** Show the clear footer action when a value exists. */\n @Prop() allowClear: boolean = true;\n /** Localized clear action label. */\n @Prop() clearLabel: string = 'Clear';\n /** Show immediate local filtering over option labels, subtext, and section headings. */\n @Prop() searchable: boolean = false;\n /** Localized search-field placeholder and accessible name. */\n @Prop() searchPlaceholder: string = 'Search';\n /** Localized empty-filter result text. */\n @Prop() noResultsText: string = 'No results found';\n /** Accessible loading status label. */\n @Prop() loadingLabel: string = 'Loading';\n /** Actual parent surface context; omit on primary and secondary surfaces. */\n @Prop() background: SelectBackground | undefined;\n /** Show invalid visual state. */\n @Prop() error: boolean = false;\n /** Error text rendered below the trigger when error is true. */\n @Prop() errorMessage: string | undefined;\n /** ID applied to the internal combobox trigger for external labels. */\n @Prop() inputId: string | undefined;\n /** Direct accessible name when no external label is available. */\n @Prop({ attribute: 'aria-label' }) ariaLabel: string | null = null;\n /** IDs of elements that label the combobox. */\n @Prop({ attribute: 'aria-labelledby' }) ariaLabelledby: string | undefined;\n /** Additional IDs that describe the combobox. */\n @Prop({ attribute: 'aria-describedby' }) ariaDescribedby: string | undefined;\n\n /** Emitted after user selection or clearing with the next scalar value. */\n @Event() dsChange!: EventEmitter<string>;\n /** Emitted after the footer clear action. */\n @Event() dsClear!: EventEmitter<void>;\n /** Emitted whenever popup visibility changes. */\n @Event() dsOpenChange!: EventEmitter<boolean>;\n\n @State() private activeIndex = -1;\n @State() private searchTerm = '';\n @State() private formDisabled = false;\n @State() private position = { x: 0, y: 0 };\n @State() private positionReady = false;\n @State() private focusRingVisible = false;\n\n private readonly generatedId = `ds-select-${++selectId}`;\n private readonly listboxId = `${this.generatedId}-listbox`;\n private readonly errorId = `${this.generatedId}-error`;\n private initialValue = '';\n private readonly controller = this.createController();\n\n private createController() {\n // eslint-disable-next-line @typescript-eslint/no-this-alias -- adapter getters preserve reactive component ownership without inheritance.\n const owner = this;\n return new SelectController<SelectOption>({\n get host() { return owner.el; },\n generatedId: owner.generatedId,\n get options() { return owner.visibleOptions; },\n get searchable() { return owner.searchable; },\n get isLoading() { return owner.isLoading; },\n get isDisabled() { return owner.isDisabled; },\n get preferredIndex() {\n return owner.visibleOptions.findIndex(\n option => option.value === owner.value && !option.isInactive,\n );\n },\n get open() { return owner.open; },\n set open(value) { owner.open = value; },\n get activeIndex() { return owner.activeIndex; },\n set activeIndex(value) { owner.activeIndex = value; },\n get searchTerm() { return owner.searchTerm; },\n set searchTerm(value) { owner.searchTerm = value; },\n get focusRingVisible() { return owner.focusRingVisible; },\n set focusRingVisible(value) { owner.focusRingVisible = value; },\n get position() { return owner.position; },\n set position(value) { owner.position = value; },\n get positionReady() { return owner.positionReady; },\n set positionReady(value) { owner.positionReady = value; },\n selectOption: option => owner.selectOption(option),\n });\n }\n\n componentWillLoad() {\n this.initialValue = this.value;\n this.syncFormValue();\n }\n\n componentDidLoad() {\n this.controller.connect();\n }\n\n disconnectedCallback() {\n this.controller.disconnect();\n }\n\n @Watch('value')\n @Watch('disabled')\n @Watch('isInactive')\n @Watch('required')\n @Watch('options')\n @Watch('sections')\n syncFormValue() {\n const inactive = this.isDisabled;\n const resolvedValue = this.hasSelection ? this.value : '';\n this.internals.setFormValue(inactive ? null : resolvedValue);\n const missing = this.required && !inactive && !resolvedValue;\n setRequiredValidity(this.internals, missing, this.requiredMessage);\n this.controller.optionsChanged();\n }\n\n @Watch('isLoading')\n onLoadingChange() {\n this.controller.loadingChanged();\n }\n\n @Watch('open')\n onOpenChange(open: boolean) {\n this.dsOpenChange.emit(open);\n this.controller.openChanged(open);\n }\n\n @Watch('searchTerm')\n onSearchTermChange() {\n this.controller.searchChanged();\n }\n\n @Watch('activeIndex')\n onActiveIndexChange() {\n this.controller.activeIndexChanged();\n }\n\n formDisabledCallback(disabled: boolean) {\n this.formDisabled = disabled;\n this.syncFormValue();\n }\n\n formResetCallback() {\n this.value = this.initialValue;\n this.closePopup();\n }\n\n formStateRestoreCallback(state: string | File | FormData | null) {\n this.value = typeof state === 'string' ? state : '';\n }\n\n @Method()\n async setFocus() {\n this.controller.setFocus();\n }\n\n private get isDisabled(): boolean {\n return this.disabled || this.isInactive || this.formDisabled;\n }\n\n private get allSections(): SelectSection[] {\n return resolveChoiceSections(this.options, this.sections);\n }\n\n private get allOptions(): SelectOption[] {\n return flattenChoiceSections(this.allSections);\n }\n\n private get visibleSections(): SelectSection[] {\n return this.searchable\n ? filterChoiceSections(this.allSections, this.searchTerm)\n : this.allSections;\n }\n\n private get visibleOptions(): SelectOption[] {\n return flattenChoiceSections(this.visibleSections);\n }\n\n private get selectedOption(): SelectOption | undefined {\n return this.allOptions.find(option => option.value === this.value);\n }\n\n private get hasSelection(): boolean {\n return Boolean(this.selectedOption);\n }\n\n private get activeOptionId(): string | undefined {\n return this.controller.activeOptionId;\n }\n\n private closePopup(restoreFocus = false) {\n this.controller.closePopup(restoreFocus);\n }\n\n private openPopup(focusVisible: boolean, edge?: 'first' | 'last') {\n this.controller.openPopup(focusVisible, edge);\n }\n\n private selectOption(option: SelectOption) {\n if (option.isInactive || this.isLoading) return;\n this.value = option.value;\n this.dsChange.emit(this.value);\n this.controller.closePopup(true);\n }\n\n private clearSelection = (event: Event) => {\n event.preventDefault();\n event.stopPropagation();\n this.value = '';\n this.dsChange.emit('');\n this.dsClear.emit();\n const enabled = enabledChoiceIndexes(this.visibleOptions);\n this.activeIndex = enabled[0] ?? -1;\n this.controller.focusSearchOrTrigger();\n };\n\n private readonly handleListKeyDown = this.controller.handleListKeyDown;\n private readonly handleTriggerKeyDown = this.controller.handleTriggerKeyDown;\n\n private renderOption(\n option: SelectOption,\n index: number,\n usesIcons: boolean,\n usesSubtext: boolean,\n ) {\n const selected = option.value === this.value;\n const active = index === this.activeIndex;\n return (\n <ChoiceOptionRow\n size={this.size}\n id={`${this.generatedId}-option-${index}`}\n option={option}\n selected={selected}\n active={active}\n focusRingVisible={this.focusRingVisible}\n usesSubtext={usesSubtext}\n leading={usesIcons && option.icon ? (\n <span class=\"ds-choice-item__icon ds-control-icon-box ds-interaction-fill__content\" aria-hidden=\"true\">\n <ds-icon name={option.icon} size={this.size} color=\"inherit\" />\n </span>\n ) : undefined}\n onHover={() => {\n this.focusRingVisible = false;\n this.activeIndex = index;\n }}\n onSelect={() => this.selectOption(option)}\n />\n );\n }\n\n render() {\n const inactive = this.isDisabled;\n const showPlaceholder = !this.hasSelection;\n const label = showPlaceholder ? this.placeholder : this.selectedOption?.label;\n const textVariant = CONTROL_TEXT_VARIANT[this.size];\n const iconSize = ICON_SIZE[this.size];\n const usesOptionIcons = choiceListUsesIcons(this.allOptions);\n const usesOptionSubtext = choiceListUsesSubtext(this.allOptions);\n const showError = this.error && Boolean(this.errorMessage);\n const describedBy = [this.ariaDescribedby, showError ? this.errorId : undefined]\n .filter(Boolean)\n .join(' ') || undefined;\n const popupStyle = {\n position: 'fixed',\n left: '0',\n top: '0',\n transform: `translate(${Math.round(this.position.x)}px, ${Math.round(this.position.y)}px)`,\n zIndex: 'var(--dimension-z-index-floating)',\n visibility: this.positionReady ? 'visible' : 'hidden',\n };\n let flatIndex = 0;\n\n return (\n <Host\n class={{\n 'select-host': true,\n 'ds-field-stack': true,\n 'ds-control-inactive': inactive,\n [`ds-control--${this.size}`]: true,\n ...controlWidthClass(this.width),\n [`select-host--background-${this.background}`]: !!this.background,\n }}\n >\n <button\n ref={element => {\n this.controller.setTriggerElement((element as HTMLButtonElement) ?? null);\n }}\n id={this.inputId ?? this.generatedId}\n type=\"button\"\n class={{\n trigger: true,\n 'ds-control-frame': true,\n 'ds-focus-ring-inset': true,\n 'ds-interaction-fill': true,\n 'ds-interaction-fill--selected':\n !inactive && this.activeFill && this.hasSelection,\n 'trigger--bordered': this.hasBorder || this.error,\n 'trigger--placeholder': showPlaceholder,\n 'trigger--has-value': this.hasSelection,\n 'wrapper--error': this.error,\n [`ds-control--${this.size}`]: true,\n ...choiceBackgroundClassMap(this.background),\n }}\n disabled={inactive}\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded={String(this.open)}\n aria-controls={this.open ? this.listboxId : undefined}\n aria-activedescendant={this.open && !this.searchable ? this.activeOptionId : undefined}\n aria-label={this.ariaLabel}\n aria-labelledby={this.ariaLabelledby}\n aria-describedby={describedBy}\n aria-invalid={this.error ? 'true' : undefined}\n aria-required={this.required || undefined}\n aria-busy={this.isLoading ? 'true' : undefined}\n onClick={() => (this.open ? this.closePopup() : this.openPopup(false))}\n onKeyDown={this.handleTriggerKeyDown}\n >\n {(this.icon || this.isLoading) && (\n <span class=\"trigger__prefix ds-control-icon-box ds-interaction-fill__content\" aria-hidden=\"true\">\n {this.isLoading ? (\n <ds-loader size={iconSize} color=\"inherit\" />\n ) : (\n <ds-icon name={this.icon} size={iconSize} color=\"inherit\" />\n )}\n </span>\n )}\n <ds-text\n class=\"trigger__label ds-control-label-box ds-interaction-fill__content\"\n as=\"span\"\n variant={textVariant}\n color=\"inherit\"\n lineTruncation={1}\n >\n {label}\n </ds-text>\n <span class=\"trigger__chevron ds-control-icon-box ds-interaction-fill__content\" aria-hidden=\"true\">\n <ds-icon name=\"ChevronDown\" size={iconSize} color=\"inherit\" />\n </span>\n </button>\n\n {this.open && (\n <div\n ref={element => {\n this.controller.setPopupElement((element as HTMLDivElement) ?? null);\n }}\n class=\"select-popup ds-choice-popup\"\n style={popupStyle}\n >\n {this.searchable && (\n <ChoiceSearch\n size={this.size}\n value={this.searchTerm}\n placeholder={this.searchPlaceholder}\n controls={this.listboxId}\n activeDescendant={this.activeOptionId}\n inputRef={this.controller.setSearchElement}\n clearLabel={this.clearLabel}\n onValueChange={value => {\n this.searchTerm = value;\n }}\n onKeyDown={event => this.handleListKeyDown(event)}\n />\n )}\n <div\n id={this.listboxId}\n class=\"ds-choice-list\"\n role=\"listbox\"\n aria-label={this.ariaLabel ?? this.placeholder}\n aria-busy={this.isLoading ? 'true' : undefined}\n >\n {this.isLoading ? (\n <div\n class=\"ds-choice-loading\"\n role=\"option\"\n aria-selected=\"false\"\n aria-disabled=\"true\"\n aria-label={this.loadingLabel}\n aria-live=\"polite\"\n >\n <ds-loader size={this.size} color=\"inherit\" />\n </div>\n ) : this.visibleOptions.length === 0 ? (\n <div\n class=\"ds-choice-empty ds-empty-region\"\n role=\"option\"\n aria-selected=\"false\"\n aria-disabled=\"true\"\n aria-label={this.noResultsText}\n aria-live=\"polite\"\n >\n <ds-empty-state body={this.noResultsText} />\n </div>\n ) : (\n this.visibleSections.map(section => (\n <div\n class={{\n 'ds-choice-section': true,\n 'ds-chrome-column': true,\n 'ds-chrome-space--sm': true,\n 'ds-choice-section--divided': !!section.divider,\n }}\n role={section.header ? 'group' : undefined}\n aria-label={section.header}\n >\n {section.header && (\n <ds-text\n class={`ds-choice-section__header ds-control--${this.size}`}\n as=\"span\"\n variant={CONTROL_SUPPORTING_TEXT_VARIANT[this.size]}\n emphasis\n color=\"primary\"\n aria-hidden=\"true\"\n >\n {section.header}\n </ds-text>\n )}\n {section.options.map(option => this.renderOption(\n option,\n flatIndex++,\n usesOptionIcons,\n usesOptionSubtext,\n ))}\n </div>\n ))\n )}\n </div>\n {this.allowClear && this.hasSelection && !this.isLoading && (\n <ChoiceFooter size={this.size} clearLabel={this.clearLabel} onClear={this.clearSelection} />\n )}\n </div>\n )}\n\n {showError && (\n <ds-text\n class=\"error-text\"\n as=\"div\"\n variant=\"text-body-small\"\n color=\"negative\"\n textId={this.errorId}\n role=\"alert\"\n >\n {this.errorMessage}\n </ds-text>\n )}\n </Host>\n );\n }\n}\n",
738
740
  "type": "registry:ui"
739
741
  }
740
742
  ]
@@ -66,6 +66,7 @@
66
66
  "On desktop, PanelNav defaults expanded, permits user collapse or expansion, and respects the locally persisted desktop preference.",
67
67
  "On tablet, ShellApp keeps PanelNav permanently collapsed and prevents user expansion without overwriting the desktop preference.",
68
68
  "On mobile, ShellApp hides and inerts PanelNav and BarNav, uses a solid primary stage, and composes routed ShellPage MobileHeader presentations, MobileSheetNav, ShellTools, and the persistent five-item MobileBarNav.",
69
+ "When the application enables viewport-fit=cover, ShellApp reserves the shared top safe-area inset once for the complete mobile stage; nested routed, sheet, and tool headers must not add a second top inset.",
69
70
  "Mobile global surfaces conceal and inert the routed workspace without unmounting it, preserving nested routes and scroll state.",
70
71
  "Keep PanelNav width, BarNav height, PanelTools chrome, and main-content origin stable except during intentional responsive or collapse transitions.",
71
72
  "The bottom bar remains visible at all route and tool depths in the foundation release."
@@ -261,7 +262,7 @@
261
262
  "files": [
262
263
  {
263
264
  "path": "src/wc/components/ShellApp/ShellApp.css",
264
- "content": ":host {\n display: block;\n height: 100%;\n min-height: 0;\n box-sizing: border-box;\n overflow: hidden;\n overscroll-behavior: none;\n --ds-shell-panel-tools-width: var(--dimension-panel-width-xs);\n}\n\n.shell-app {\n display: flex;\n flex-direction: column;\n height: 100%;\n min-height: 0;\n box-sizing: border-box;\n overflow: hidden;\n overscroll-behavior: none;\n font-family: var(--typography-font-family, system-ui);\n}\n\n:host {\n --_shell-chrome-bg: var(--color-background-secondary);\n}\n\n.shell-app__row {\n display: flex;\n flex: 1 1 auto;\n min-height: 0;\n height: 100%;\n position: relative;\n}\n\n/*\n * One chrome layer behind the shell row. Wash uses background-attachment: fixed\n * so the pattern is locked to the viewport — panel/tools collapse only changes the\n * transparent window, not the pattern phase. JS sets wash background-size from\n * readShellViewportDimensions(), not the shell element box.\n */\n.shell-app__chrome {\n position: absolute;\n inset: 0;\n pointer-events: none;\n z-index: 0;\n background-color: var(--_shell-chrome-bg);\n}\n\n:host(.shell-app--gradient) .shell-app__chrome::before {\n content: '';\n position: absolute;\n inset: 0;\n pointer-events: none;\n background-position: 0 0;\n background-attachment: fixed;\n z-index: 1;\n opacity: var(--ds-shell-gradient-opacity, 1);\n background-image: var(--ds-shell-gradient-image, none);\n background-size: var(--ds-shell-gradient-size, auto);\n background-repeat: no-repeat;\n}\n\n.shell-app__panel {\n flex: 0 0 auto;\n min-height: 0;\n height: 100%;\n position: relative;\n /* Above main so resize handle line can paint over the workspace edge */\n z-index: 2;\n}\n\n.shell-app__panel ::slotted(ds-panel-nav) {\n display: block;\n height: 100%;\n}\n\n.shell-app__main {\n flex: 1 1 auto;\n min-width: 0;\n min-height: 0;\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n grid-template-rows: auto minmax(0, 1fr);\n grid-template-areas:\n 'bar tools'\n 'content tools';\n position: relative;\n z-index: 1;\n}\n\n.shell-app__mobile-sheet-nav,\n.shell-app__mobile-bar-nav {\n display: none;\n}\n\n.shell-app__bar {\n grid-area: bar;\n flex: 0 0 auto;\n min-width: 0;\n}\n\n.shell-app__bar ::slotted(ds-bar-nav) {\n display: block;\n}\n\n.shell-app__content {\n grid-area: content;\n flex: 1 1 auto;\n min-width: 0;\n min-height: 0;\n overflow: auto;\n overscroll-behavior: none;\n /* Limit reflow to the page column — not on __main (breaks tools flex shrink). */\n contain: layout;\n}\n\n/* Opaque page surface — masks the fixed chrome layer in the content column. */\n.shell-app__content {\n position: relative;\n z-index: 1;\n background-color: var(--color-background-primary);\n}\n\n.shell-app__tools {\n grid-area: tools;\n flex: 0 0 auto;\n min-width: 0;\n min-height: 0;\n height: 100%;\n display: flex;\n position: relative;\n z-index: 0;\n overflow: hidden;\n}\n\n.shell-app__tools ::slotted(ds-panel-tools) {\n display: block;\n height: 100%;\n min-height: 0;\n}\n\n.shell-app__tools ::slotted(ds-shell-tools) {\n display: block;\n height: 100%;\n min-height: 0;\n}\n\n:host(.shell-app--tools-fullscreen) .shell-app__panel,\n:host(.shell-app--tools-fullscreen) .shell-app__bar,\n:host(.shell-app--tools-fullscreen) .shell-app__content {\n visibility: hidden;\n}\n\n:host(.shell-app--mobile) {\n --_shell-chrome-bg: var(--color-background-primary);\n}\n\n:host(.shell-app--mobile) .shell-app__chrome,\n:host(.shell-app--mobile) .shell-app__panel,\n:host(.shell-app--mobile) .shell-app__bar {\n display: none;\n}\n\n:host(.shell-app--mobile) .shell-app__main {\n width: 100%;\n grid-template-columns: minmax(0, 1fr);\n grid-template-rows: minmax(0, 1fr) auto;\n grid-template-areas:\n 'stage'\n 'mobile-bar-nav';\n background: var(--color-background-primary);\n}\n\n:host(.shell-app--mobile) .shell-app__content,\n:host(.shell-app--mobile) .shell-app__tools,\n:host(.shell-app--mobile) .shell-app__mobile-sheet-nav {\n grid-area: stage;\n min-width: 0;\n min-height: 0;\n height: 100%;\n position: relative;\n}\n\n:host(.shell-app--mobile) .shell-app__content {\n z-index: 1;\n overflow: auto;\n}\n\n:host(.shell-app--mobile) .shell-app__tools {\n z-index: 2;\n width: 100%;\n overflow: hidden;\n background: var(--color-background-primary);\n}\n\n:host(.shell-app--mobile) .shell-app__mobile-sheet-nav {\n display: block;\n z-index: 3;\n overflow: hidden;\n background: var(--color-background-primary);\n}\n\n:host(.shell-app--mobile) .shell-app__mobile-bar-nav {\n grid-area: mobile-bar-nav;\n display: block;\n min-width: 0;\n position: relative;\n z-index: 4;\n}\n\n:host(.shell-app--mobile) .shell-app__tools[hidden],\n:host(.shell-app--mobile) .shell-app__mobile-sheet-nav[hidden],\n:host(.shell-app--mobile) .shell-app__mobile-bar-nav[hidden] {\n display: none;\n}\n\n:host(.shell-app--mobile-tool-active) .shell-app__content,\n:host(.shell-app--mobile-sheet-nav-open) .shell-app__content,\n:host(.shell-app--mobile-sheet-nav-open) .shell-app__tools {\n visibility: hidden;\n}\n",
265
+ "content": ":host {\n display: block;\n height: 100%;\n min-height: 0;\n box-sizing: border-box;\n overflow: hidden;\n overscroll-behavior: none;\n --ds-shell-panel-tools-width: var(--dimension-panel-width-xs);\n}\n\n.shell-app {\n display: flex;\n flex-direction: column;\n height: 100%;\n min-height: 0;\n box-sizing: border-box;\n overflow: hidden;\n overscroll-behavior: none;\n font-family: var(--typography-font-family, system-ui);\n}\n\n:host {\n --_shell-chrome-bg: var(--color-background-secondary);\n}\n\n.shell-app__row {\n display: flex;\n flex: 1 1 auto;\n min-height: 0;\n height: 100%;\n position: relative;\n}\n\n/*\n * One chrome layer behind the shell row. Wash uses background-attachment: fixed\n * so the pattern is locked to the viewport — panel/tools collapse only changes the\n * transparent window, not the pattern phase. JS sets wash background-size from\n * readShellViewportDimensions(), not the shell element box.\n */\n.shell-app__chrome {\n position: absolute;\n inset: 0;\n pointer-events: none;\n z-index: 0;\n background-color: var(--_shell-chrome-bg);\n}\n\n:host(.shell-app--gradient) .shell-app__chrome::before {\n content: '';\n position: absolute;\n inset: 0;\n pointer-events: none;\n background-position: 0 0;\n background-attachment: fixed;\n z-index: 1;\n opacity: var(--ds-shell-gradient-opacity, 1);\n background-image: var(--ds-shell-gradient-image, none);\n background-size: var(--ds-shell-gradient-size, auto);\n background-repeat: no-repeat;\n}\n\n.shell-app__panel {\n flex: 0 0 auto;\n min-height: 0;\n height: 100%;\n position: relative;\n /* Above main so resize handle line can paint over the workspace edge */\n z-index: 2;\n}\n\n.shell-app__panel ::slotted(ds-panel-nav) {\n display: block;\n height: 100%;\n}\n\n.shell-app__main {\n flex: 1 1 auto;\n min-width: 0;\n min-height: 0;\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n grid-template-rows: auto minmax(0, 1fr);\n grid-template-areas:\n 'bar tools'\n 'content tools';\n position: relative;\n z-index: 1;\n}\n\n.shell-app__mobile-sheet-nav,\n.shell-app__mobile-bar-nav {\n display: none;\n}\n\n.shell-app__bar {\n grid-area: bar;\n flex: 0 0 auto;\n min-width: 0;\n}\n\n.shell-app__bar ::slotted(ds-bar-nav) {\n display: block;\n}\n\n.shell-app__content {\n grid-area: content;\n flex: 1 1 auto;\n min-width: 0;\n min-height: 0;\n overflow: auto;\n overscroll-behavior: none;\n /* Limit reflow to the page column — not on __main (breaks tools flex shrink). */\n contain: layout;\n}\n\n/* Opaque page surface — masks the fixed chrome layer in the content column. */\n.shell-app__content {\n position: relative;\n z-index: 1;\n background-color: var(--color-background-primary);\n}\n\n.shell-app__tools {\n grid-area: tools;\n flex: 0 0 auto;\n min-width: 0;\n min-height: 0;\n height: 100%;\n display: flex;\n position: relative;\n z-index: 0;\n overflow: hidden;\n}\n\n.shell-app__tools ::slotted(ds-panel-tools) {\n display: block;\n height: 100%;\n min-height: 0;\n}\n\n.shell-app__tools ::slotted(ds-shell-tools) {\n display: block;\n height: 100%;\n min-height: 0;\n}\n\n:host(.shell-app--tools-fullscreen) .shell-app__panel,\n:host(.shell-app--tools-fullscreen) .shell-app__bar,\n:host(.shell-app--tools-fullscreen) .shell-app__content {\n visibility: hidden;\n}\n\n:host(.shell-app--mobile) {\n --_shell-chrome-bg: var(--color-background-primary);\n}\n\n:host(.shell-app--mobile) .shell-app__chrome,\n:host(.shell-app--mobile) .shell-app__panel,\n:host(.shell-app--mobile) .shell-app__bar {\n display: none;\n}\n\n:host(.shell-app--mobile) .shell-app__main {\n width: 100%;\n padding-block-start: env(safe-area-inset-top);\n box-sizing: border-box;\n grid-template-columns: minmax(0, 1fr);\n grid-template-rows: minmax(0, 1fr) auto;\n grid-template-areas:\n 'stage'\n 'mobile-bar-nav';\n background: var(--color-background-primary);\n}\n\n:host(.shell-app--mobile) .shell-app__content,\n:host(.shell-app--mobile) .shell-app__tools,\n:host(.shell-app--mobile) .shell-app__mobile-sheet-nav {\n grid-area: stage;\n min-width: 0;\n min-height: 0;\n height: 100%;\n position: relative;\n}\n\n:host(.shell-app--mobile) .shell-app__content {\n z-index: 1;\n overflow: auto;\n}\n\n:host(.shell-app--mobile) .shell-app__tools {\n z-index: 2;\n width: 100%;\n overflow: hidden;\n background: var(--color-background-primary);\n}\n\n:host(.shell-app--mobile) .shell-app__mobile-sheet-nav {\n display: block;\n z-index: 3;\n overflow: hidden;\n background: var(--color-background-primary);\n}\n\n:host(.shell-app--mobile) .shell-app__mobile-bar-nav {\n grid-area: mobile-bar-nav;\n display: block;\n min-width: 0;\n position: relative;\n z-index: 4;\n}\n\n:host(.shell-app--mobile) .shell-app__tools[hidden],\n:host(.shell-app--mobile) .shell-app__mobile-sheet-nav[hidden],\n:host(.shell-app--mobile) .shell-app__mobile-bar-nav[hidden] {\n display: none;\n}\n\n:host(.shell-app--mobile-tool-active) .shell-app__content,\n:host(.shell-app--mobile-sheet-nav-open) .shell-app__content,\n:host(.shell-app--mobile-sheet-nav-open) .shell-app__tools {\n visibility: hidden;\n}\n",
265
266
  "type": "registry:ui"
266
267
  },
267
268
  {
@@ -446,7 +446,7 @@
446
446
  },
447
447
  {
448
448
  "path": "src/wc/components/ShellTools/ShellTools.tsx",
449
- "content": "import {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Method,\n Prop,\n Watch,\n} from '@stencil/core';\nimport {\n PANEL_TOOLS_LABELS,\n PANEL_TOOLS_TOOL_IDS,\n type PanelToolsHeaderConfig,\n type PanelToolsHeaders,\n type PanelToolsItem,\n type PanelToolsToolId,\n} from '../PanelTools/panel-tools-types';\nimport {\n parsePanelToolsItems,\n reconcilePanelToolsAvailability,\n resolvePanelToolActivation,\n} from '../PanelTools/panel-tools-utils';\nimport {\n isShellInboxTool,\n resolveAvailableInboxTool,\n type ShellInboxToolId,\n type ShellResponsiveMode,\n} from '../../shell/shell-responsive';\n\nconst MOBILE_VIEW_ORDER: PanelToolsToolId[] = [\n 'search',\n 'agents',\n 'messages',\n 'stacks',\n 'activity',\n 'help',\n];\n\n@Component({\n tag: 'ds-shell-tools',\n styleUrl: 'ShellTools.css',\n scoped: true,\n})\nexport class ShellTools {\n @Element() el!: HTMLElement;\n\n /** Resolved by ShellApp; mobile uses a full-stage tool presentation. */\n @Prop({ attribute: 'responsive-mode', reflect: true })\n responsiveMode: ShellResponsiveMode = 'desktop';\n @Prop({ mutable: true, reflect: true }) open: boolean = false;\n @Prop({ mutable: true, attribute: 'active-tool', reflect: true })\n activeTool: PanelToolsToolId | '' = '';\n @Prop({ mutable: true, reflect: true }) presentation: 'drawer' | 'fullscreen' = 'drawer';\n @Prop({ attribute: 'fullscreen-header-mode', reflect: true })\n fullscreenHeaderMode: 'shared' | 'split' = 'shared';\n @Prop() items: PanelToolsItem[] = [];\n @Prop({ attribute: 'items-json' }) itemsJson: string = '';\n @Prop() headers: PanelToolsHeaders = {};\n @Prop({ attribute: 'headers-json' }) headersJson: string = '';\n @Prop({ attribute: 'storage-key' }) storageKey: string = '';\n @Prop() toolsLabel: string = 'Tools';\n @Prop() toolShortcutsLabel: string = 'Tool shortcuts';\n @Prop() inboxLabel: string = 'Inbox';\n @Prop() inboxNavigationLabel: string = 'Inbox sections';\n\n @Event({ bubbles: true, composed: true }) dsToolChange!: EventEmitter<{\n id: PanelToolsToolId;\n selected: boolean;\n }>;\n @Event({ bubbles: true, composed: true }) dsPresentationChange!: EventEmitter<{\n presentation: 'drawer' | 'fullscreen';\n }>;\n @Event({ bubbles: true, composed: true }) dsHeaderBack!: EventEmitter<{\n tool: PanelToolsToolId;\n }>;\n @Event({ bubbles: true, composed: true }) dsHeaderAction!: EventEmitter<{\n tool: PanelToolsToolId;\n id: string;\n }>;\n\n private panelToolsEl: HTMLDsPanelToolsElement | null = null;\n\n private get resolvedItems(): PanelToolsItem[] {\n return parsePanelToolsItems(this.items, this.itemsJson);\n }\n\n private get availableInboxTools(): ShellInboxToolId[] {\n return this.resolvedItems\n .filter(item => !item.isInactive && isShellInboxTool(item.id))\n .map(item => item.id as ShellInboxToolId);\n }\n\n private get mobileActiveTool(): PanelToolsToolId | '' {\n if (!isShellInboxTool(this.activeTool)) return this.activeTool;\n return resolveAvailableInboxTool(this.activeTool, this.availableInboxTools);\n }\n\n componentWillLoad() {\n this.reconcileAvailability();\n }\n\n @Watch('items')\n @Watch('itemsJson')\n handleItemsChange() {\n this.reconcileAvailability();\n }\n\n private reconcileAvailability() {\n const next = reconcilePanelToolsAvailability(this.resolvedItems, this.open, this.activeTool);\n this.open = next.open;\n this.activeTool = next.activeTool;\n }\n\n private resolvedHeaders(): PanelToolsHeaders {\n if (Object.keys(this.headers).length) return this.headers;\n if (!this.headersJson.trim()) return {};\n try {\n const parsed = JSON.parse(this.headersJson);\n return parsed && typeof parsed === 'object' && !Array.isArray(parsed)\n ? (parsed as PanelToolsHeaders)\n : {};\n } catch {\n return {};\n }\n }\n\n private activeHeader(tool: PanelToolsToolId): PanelToolsHeaderConfig {\n return this.resolvedHeaders()[tool] ?? {};\n }\n\n private activateMobileTool(id: PanelToolsToolId) {\n const item = this.resolvedItems.find(entry => entry.id === id);\n if (!item || item.isInactive) return;\n const next = resolvePanelToolActivation(this.open, this.activeTool, id);\n this.open = next.open;\n this.activeTool = next.activeTool;\n this.dsToolChange.emit({ id, selected: next.selected });\n }\n\n private selectInboxTool = (event: CustomEvent<string>) => {\n const id = event.detail;\n if (!isShellInboxTool(id) || id === this.mobileActiveTool) return;\n this.open = true;\n this.activeTool = id;\n this.dsToolChange.emit({ id, selected: true });\n };\n\n private handlePanelToolChange = (\n event: CustomEvent<{ id: PanelToolsToolId; selected: boolean }>\n ) => {\n this.activeTool = event.detail.id;\n this.open = event.detail.selected;\n };\n\n private handlePanelPresentationChange = (\n event: CustomEvent<{ presentation: 'drawer' | 'fullscreen' }>\n ) => {\n this.presentation = event.detail.presentation;\n };\n\n private handleMobileHeaderAction = (\n tool: PanelToolsToolId,\n id: string,\n event: CustomEvent<MouseEvent>\n ) => {\n event.stopPropagation();\n this.dsHeaderAction.emit({ tool, id });\n };\n\n /** Match PanelTools' imperative activation contract in every responsive mode. */\n @Method()\n async activateTool(id: PanelToolsToolId) {\n if (this.responsiveMode !== 'mobile') {\n await this.panelToolsEl?.activateTool(id);\n return;\n }\n this.activateMobileTool(id);\n }\n\n /** Close the active global tool surface. */\n @Method()\n async closeDrawer() {\n if (this.responsiveMode !== 'mobile') {\n await this.panelToolsEl?.closeDrawer();\n return;\n }\n if (!this.open) return;\n const id = this.activeTool;\n this.open = false;\n if (id) this.dsToolChange.emit({ id, selected: false });\n }\n\n /** Focus an application-owned action in the visible shared tool header. */\n @Method()\n async focusHeaderAction(id: string) {\n if (this.responsiveMode !== 'mobile') {\n await this.panelToolsEl?.focusHeaderAction(id);\n return;\n }\n const action = this.el.querySelector(`[data-header-action-id=\"${CSS.escape(id)}\"]`) as\n | (HTMLElement & { setFocus?: () => Promise<void> })\n | null;\n await action?.setFocus?.();\n }\n\n private renderForwardedSlots() {\n return PANEL_TOOLS_TOOL_IDS.flatMap(id => [\n <slot name={id} slot={id} />,\n <slot name={`${id}-view`} slot={`${id}-view`} />,\n ]);\n }\n\n private renderDesktop() {\n return (\n <div class=\"shell-tools__desktop\">\n <ds-panel-tools\n open={this.open}\n activeTool={this.activeTool}\n presentation={this.presentation}\n fullscreenHeaderMode={this.fullscreenHeaderMode}\n items={this.resolvedItems}\n headers={this.resolvedHeaders()}\n storageKey={this.storageKey}\n toolsLabel={this.toolsLabel}\n toolShortcutsLabel={this.toolShortcutsLabel}\n ref={element => {\n this.panelToolsEl = element as HTMLDsPanelToolsElement | null;\n }}\n onDsToolChange={this.handlePanelToolChange}\n onDsPresentationChange={this.handlePanelPresentationChange}\n >\n {this.renderForwardedSlots()}\n </ds-panel-tools>\n </div>\n );\n }\n\n private renderMobileHeader(tool: PanelToolsToolId) {\n const header = this.activeHeader(tool);\n const configuredTitle = header.title?.trim();\n const title = configuredTitle || PANEL_TOOLS_LABELS[tool];\n const actions = (header.actions ?? []).filter(action => action.id !== 'fullscreen');\n const sections =\n isShellInboxTool(tool) && !header.showBack\n ? this.availableInboxTools.map(id => ({\n id,\n label: PANEL_TOOLS_LABELS[id],\n }))\n : [];\n\n return (\n <ds-mobile-header\n class=\"shell-tools__mobile-header\"\n heading={title}\n headingLevel=\"h2\"\n sections={sections}\n value={tool}\n sectionsAriaLabel={this.inboxNavigationLabel}\n onDsSectionChange={this.selectInboxTool}\n >\n {header.showBack ? (\n <ds-tooltip\n slot=\"leading\"\n label={header.backAriaLabel || 'Back'}\n side=\"bottom\"\n size=\"sm\"\n >\n <ds-button-unfilled\n variant=\"icon\"\n icon={header.backIcon || 'ChevronLeft'}\n size=\"md\"\n aria-label={header.backAriaLabel || 'Back'}\n activeFill={false}\n hasBorder={false}\n onDsClick={() => this.dsHeaderBack.emit({ tool })}\n />\n </ds-tooltip>\n ) : null}\n {actions.map(action => (\n <ds-tooltip\n slot=\"trailing\"\n key={action.id}\n label={action.ariaLabel}\n side=\"bottom\"\n size=\"sm\"\n >\n <ds-button-unfilled\n id={action.triggerId || undefined}\n data-header-action-id={action.id}\n variant=\"icon\"\n icon={action.icon}\n size=\"md\"\n aria-label={action.ariaLabel}\n haspopup={action.haspopup}\n controls={action.controls}\n expanded={action.expanded}\n pressed={action.pressed}\n isActive={!!action.expanded}\n isInactive={action.isInactive}\n activeFill={false}\n hasBorder={false}\n onDsClick={(event: CustomEvent<MouseEvent>) =>\n this.handleMobileHeaderAction(tool, action.id, event)}\n />\n </ds-tooltip>\n ))}\n </ds-mobile-header>\n );\n }\n\n private renderMobile() {\n const tool = this.mobileActiveTool;\n return (\n <div\n class=\"shell-tools__mobile\"\n aria-hidden={this.open && tool ? undefined : 'true'}\n inert={this.open && tool ? undefined : true}\n >\n {tool ? this.renderMobileHeader(tool) : null}\n <div class=\"shell-tools__mobile-body\">\n {MOBILE_VIEW_ORDER.map(id => {\n const active = this.open && id === tool;\n return (\n <div\n class={{\n 'shell-tools__view': true,\n 'shell-tools__view--active': active,\n }}\n hidden={!active}\n aria-hidden={active ? undefined : 'true'}\n inert={active ? undefined : true}\n >\n <slot name={`${id}-view`}>\n <slot name={id} />\n </slot>\n </div>\n );\n })}\n </div>\n </div>\n );\n }\n\n render() {\n const mobile = this.responsiveMode === 'mobile';\n return (\n <Host\n role={\n mobile\n ? this.presentation === 'fullscreen'\n ? 'dialog'\n : 'complementary'\n : undefined\n }\n aria-modal={mobile && this.presentation === 'fullscreen' ? 'true' : undefined}\n aria-label={mobile ? this.toolsLabel : undefined}\n >\n {mobile ? this.renderMobile() : this.renderDesktop()}\n </Host>\n );\n }\n}\n",
449
+ "content": "import {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Method,\n Prop,\n Watch,\n} from '@stencil/core';\nimport {\n PANEL_TOOLS_LABELS,\n PANEL_TOOLS_TOOL_IDS,\n type PanelToolsHeaderConfig,\n type PanelToolsHeaders,\n type PanelToolsItem,\n type PanelToolsToolId,\n} from '../PanelTools/panel-tools-types';\nimport {\n parsePanelToolsItems,\n reconcilePanelToolsAvailability,\n resolvePanelToolActivation,\n} from '../PanelTools/panel-tools-utils';\nimport {\n isShellInboxTool,\n resolveAvailableInboxTool,\n type ShellInboxToolId,\n type ShellResponsiveMode,\n} from '../../shell/shell-responsive';\n\nconst MOBILE_VIEW_ORDER: PanelToolsToolId[] = [\n 'search',\n 'agents',\n 'messages',\n 'stacks',\n 'activity',\n 'help',\n];\n\n@Component({\n tag: 'ds-shell-tools',\n styleUrl: 'ShellTools.css',\n scoped: true,\n})\nexport class ShellTools {\n @Element() el!: HTMLElement;\n\n /** Resolved by ShellApp; mobile uses a full-stage tool presentation. */\n @Prop({ attribute: 'responsive-mode', reflect: true })\n responsiveMode: ShellResponsiveMode = 'desktop';\n @Prop({ mutable: true, reflect: true }) open: boolean = false;\n @Prop({ mutable: true, attribute: 'active-tool', reflect: true })\n activeTool: PanelToolsToolId | '' = '';\n @Prop({ mutable: true, reflect: true }) presentation: 'drawer' | 'fullscreen' = 'drawer';\n @Prop({ attribute: 'fullscreen-header-mode', reflect: true })\n fullscreenHeaderMode: 'shared' | 'split' = 'shared';\n @Prop() items: PanelToolsItem[] = [];\n @Prop({ attribute: 'items-json' }) itemsJson: string = '';\n @Prop() headers: PanelToolsHeaders = {};\n @Prop({ attribute: 'headers-json' }) headersJson: string = '';\n @Prop({ attribute: 'storage-key' }) storageKey: string = '';\n @Prop() toolsLabel: string = 'Tools';\n @Prop() toolShortcutsLabel: string = 'Tool shortcuts';\n @Prop() inboxLabel: string = 'Inbox';\n @Prop() inboxNavigationLabel: string = 'Inbox sections';\n\n @Watch('presentation')\n presentationChanged(next: 'drawer' | 'fullscreen', previous: 'drawer' | 'fullscreen') {\n if (next === previous) return;\n\n /*\n * Consumers update ShellTools and their slotted master/detail layout in the\n * same render. Forward the request immediately so PanelTools can conceal\n * its surface until its matching render class commits on the next frame.\n */\n if (this.panelToolsEl && this.panelToolsEl.getAttribute('presentation') !== next) {\n this.panelToolsEl.setAttribute('presentation', next);\n }\n }\n\n @Event({ bubbles: true, composed: true }) dsToolChange!: EventEmitter<{\n id: PanelToolsToolId;\n selected: boolean;\n }>;\n @Event({ bubbles: true, composed: true }) dsPresentationChange!: EventEmitter<{\n presentation: 'drawer' | 'fullscreen';\n }>;\n @Event({ bubbles: true, composed: true }) dsHeaderBack!: EventEmitter<{\n tool: PanelToolsToolId;\n }>;\n @Event({ bubbles: true, composed: true }) dsHeaderAction!: EventEmitter<{\n tool: PanelToolsToolId;\n id: string;\n }>;\n\n private panelToolsEl: HTMLDsPanelToolsElement | null = null;\n\n private get resolvedItems(): PanelToolsItem[] {\n return parsePanelToolsItems(this.items, this.itemsJson);\n }\n\n private get availableInboxTools(): ShellInboxToolId[] {\n return this.resolvedItems\n .filter(item => !item.isInactive && isShellInboxTool(item.id))\n .map(item => item.id as ShellInboxToolId);\n }\n\n private get mobileActiveTool(): PanelToolsToolId | '' {\n if (!isShellInboxTool(this.activeTool)) return this.activeTool;\n return resolveAvailableInboxTool(this.activeTool, this.availableInboxTools);\n }\n\n componentWillLoad() {\n this.reconcileAvailability();\n }\n\n @Watch('items')\n @Watch('itemsJson')\n handleItemsChange() {\n this.reconcileAvailability();\n }\n\n private reconcileAvailability() {\n const next = reconcilePanelToolsAvailability(this.resolvedItems, this.open, this.activeTool);\n this.open = next.open;\n this.activeTool = next.activeTool;\n }\n\n private resolvedHeaders(): PanelToolsHeaders {\n if (Object.keys(this.headers).length) return this.headers;\n if (!this.headersJson.trim()) return {};\n try {\n const parsed = JSON.parse(this.headersJson);\n return parsed && typeof parsed === 'object' && !Array.isArray(parsed)\n ? (parsed as PanelToolsHeaders)\n : {};\n } catch {\n return {};\n }\n }\n\n private activeHeader(tool: PanelToolsToolId): PanelToolsHeaderConfig {\n return this.resolvedHeaders()[tool] ?? {};\n }\n\n private activateMobileTool(id: PanelToolsToolId) {\n const item = this.resolvedItems.find(entry => entry.id === id);\n if (!item || item.isInactive) return;\n const next = resolvePanelToolActivation(this.open, this.activeTool, id);\n this.open = next.open;\n this.activeTool = next.activeTool;\n this.dsToolChange.emit({ id, selected: next.selected });\n }\n\n private selectInboxTool = (event: CustomEvent<string>) => {\n const id = event.detail;\n if (!isShellInboxTool(id) || id === this.mobileActiveTool) return;\n this.open = true;\n this.activeTool = id;\n this.dsToolChange.emit({ id, selected: true });\n };\n\n private handlePanelToolChange = (\n event: CustomEvent<{ id: PanelToolsToolId; selected: boolean }>\n ) => {\n this.activeTool = event.detail.id;\n this.open = event.detail.selected;\n };\n\n private handlePanelPresentationChange = (\n event: CustomEvent<{ presentation: 'drawer' | 'fullscreen' }>\n ) => {\n this.presentation = event.detail.presentation;\n };\n\n private handleMobileHeaderAction = (\n tool: PanelToolsToolId,\n id: string,\n event: CustomEvent<MouseEvent>\n ) => {\n event.stopPropagation();\n this.dsHeaderAction.emit({ tool, id });\n };\n\n /** Match PanelTools' imperative activation contract in every responsive mode. */\n @Method()\n async activateTool(id: PanelToolsToolId) {\n if (this.responsiveMode !== 'mobile') {\n await this.panelToolsEl?.activateTool(id);\n return;\n }\n this.activateMobileTool(id);\n }\n\n /** Close the active global tool surface. */\n @Method()\n async closeDrawer() {\n if (this.responsiveMode !== 'mobile') {\n await this.panelToolsEl?.closeDrawer();\n return;\n }\n if (!this.open) return;\n const id = this.activeTool;\n this.open = false;\n if (id) this.dsToolChange.emit({ id, selected: false });\n }\n\n /** Focus an application-owned action in the visible shared tool header. */\n @Method()\n async focusHeaderAction(id: string) {\n if (this.responsiveMode !== 'mobile') {\n await this.panelToolsEl?.focusHeaderAction(id);\n return;\n }\n const action = this.el.querySelector(`[data-header-action-id=\"${CSS.escape(id)}\"]`) as\n | (HTMLElement & { setFocus?: () => Promise<void> })\n | null;\n await action?.setFocus?.();\n }\n\n private renderForwardedSlots() {\n return PANEL_TOOLS_TOOL_IDS.flatMap(id => [\n <slot name={id} slot={id} />,\n <slot name={`${id}-view`} slot={`${id}-view`} />,\n ]);\n }\n\n private renderDesktop() {\n return (\n <div class=\"shell-tools__desktop\">\n <ds-panel-tools\n open={this.open}\n activeTool={this.activeTool}\n presentation={this.presentation}\n fullscreenHeaderMode={this.fullscreenHeaderMode}\n items={this.resolvedItems}\n headers={this.resolvedHeaders()}\n storageKey={this.storageKey}\n toolsLabel={this.toolsLabel}\n toolShortcutsLabel={this.toolShortcutsLabel}\n ref={element => {\n this.panelToolsEl = element as HTMLDsPanelToolsElement | null;\n }}\n onDsToolChange={this.handlePanelToolChange}\n onDsPresentationChange={this.handlePanelPresentationChange}\n >\n {this.renderForwardedSlots()}\n </ds-panel-tools>\n </div>\n );\n }\n\n private renderMobileHeader(tool: PanelToolsToolId) {\n const header = this.activeHeader(tool);\n const configuredTitle = header.title?.trim();\n const title = configuredTitle || PANEL_TOOLS_LABELS[tool];\n const actions = (header.actions ?? []).filter(action => action.id !== 'fullscreen');\n const sections =\n isShellInboxTool(tool) && !header.showBack\n ? this.availableInboxTools.map(id => ({\n id,\n label: PANEL_TOOLS_LABELS[id],\n }))\n : [];\n\n return (\n <ds-mobile-header\n class=\"shell-tools__mobile-header\"\n heading={title}\n headingLevel=\"h2\"\n sections={sections}\n value={tool}\n sectionsAriaLabel={this.inboxNavigationLabel}\n onDsSectionChange={this.selectInboxTool}\n >\n {header.showBack ? (\n <ds-tooltip\n slot=\"leading\"\n label={header.backAriaLabel || 'Back'}\n side=\"bottom\"\n size=\"sm\"\n >\n <ds-button-unfilled\n variant=\"icon\"\n icon={header.backIcon || 'ChevronLeft'}\n size=\"md\"\n aria-label={header.backAriaLabel || 'Back'}\n activeFill={false}\n hasBorder={false}\n onDsClick={() => this.dsHeaderBack.emit({ tool })}\n />\n </ds-tooltip>\n ) : null}\n {actions.map(action => (\n <ds-tooltip\n slot=\"trailing\"\n key={action.id}\n label={action.ariaLabel}\n side=\"bottom\"\n size=\"sm\"\n >\n <ds-button-unfilled\n id={action.triggerId || undefined}\n data-header-action-id={action.id}\n variant=\"icon\"\n icon={action.icon}\n size=\"md\"\n aria-label={action.ariaLabel}\n haspopup={action.haspopup}\n controls={action.controls}\n expanded={action.expanded}\n pressed={action.pressed}\n isActive={!!action.expanded}\n isInactive={action.isInactive}\n activeFill={false}\n hasBorder={false}\n onDsClick={(event: CustomEvent<MouseEvent>) =>\n this.handleMobileHeaderAction(tool, action.id, event)}\n />\n </ds-tooltip>\n ))}\n </ds-mobile-header>\n );\n }\n\n private renderMobile() {\n const tool = this.mobileActiveTool;\n return (\n <div\n class=\"shell-tools__mobile\"\n aria-hidden={this.open && tool ? undefined : 'true'}\n inert={this.open && tool ? undefined : true}\n >\n {tool ? this.renderMobileHeader(tool) : null}\n <div class=\"shell-tools__mobile-body\">\n {MOBILE_VIEW_ORDER.map(id => {\n const active = this.open && id === tool;\n return (\n <div\n class={{\n 'shell-tools__view': true,\n 'shell-tools__view--active': active,\n }}\n hidden={!active}\n aria-hidden={active ? undefined : 'true'}\n inert={active ? undefined : true}\n >\n <slot name={`${id}-view`}>\n <slot name={id} />\n </slot>\n </div>\n );\n })}\n </div>\n </div>\n );\n }\n\n render() {\n const mobile = this.responsiveMode === 'mobile';\n return (\n <Host\n role={\n mobile\n ? this.presentation === 'fullscreen'\n ? 'dialog'\n : 'complementary'\n : undefined\n }\n aria-modal={mobile && this.presentation === 'fullscreen' ? 'true' : undefined}\n aria-label={mobile ? this.toolsLabel : undefined}\n >\n {mobile ? this.renderMobile() : this.renderDesktop()}\n </Host>\n );\n }\n}\n",
450
450
  "type": "registry:ui"
451
451
  }
452
452
  ]
@@ -95,7 +95,7 @@
95
95
  },
96
96
  "controlSize": {
97
97
  "type": "ControlSize",
98
- "resolvedType": "\"md\" | \"sm\" | \"xs\"",
98
+ "resolvedType": "\"lg\" | \"md\" | \"sm\" | \"xs\"",
99
99
  "attribute": "control-size",
100
100
  "default": "'md'",
101
101
  "required": false,
@@ -170,7 +170,7 @@
170
170
  },
171
171
  "controlSize": {
172
172
  "type": "ControlSize",
173
- "resolvedType": "\"md\" | \"sm\" | \"xs\"",
173
+ "resolvedType": "\"lg\" | \"md\" | \"sm\" | \"xs\"",
174
174
  "attribute": "control-size",
175
175
  "default": "'md'",
176
176
  "required": false,