@ds-mo/ui 14.27.1 → 14.29.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 (338) hide show
  1. package/dist/.package-ready.json +1 -1
  2. package/dist/agent-patterns.json +28 -18
  3. package/dist/agent.json +436 -33
  4. package/dist/angular/ds-button-filled.d.ts +1 -1
  5. package/dist/angular/ds-button-filled.js +3 -3
  6. package/dist/angular/ds-button-unfilled.d.ts +1 -1
  7. package/dist/angular/ds-button-unfilled.js +3 -3
  8. package/dist/angular/ds-card-navigation.d.ts +20 -0
  9. package/dist/angular/ds-card-navigation.js +42 -0
  10. package/dist/angular/ds-card-settings-scope.d.ts +19 -0
  11. package/dist/angular/ds-card-settings-scope.js +42 -0
  12. package/dist/angular/ds-menu.d.ts +1 -1
  13. package/dist/angular/ds-menu.js +3 -3
  14. package/dist/angular/ds-mobile-bar-nav.d.ts +1 -1
  15. package/dist/angular/ds-mobile-bar-nav.js +3 -3
  16. package/dist/angular/ds-mobile-header.d.ts +1 -1
  17. package/dist/angular/ds-mobile-header.js +3 -3
  18. package/dist/angular/ds-mobile-section-switcher.d.ts +1 -1
  19. package/dist/angular/ds-mobile-section-switcher.js +3 -3
  20. package/dist/angular/ds-mobile-sheet-nav.d.ts +7 -1
  21. package/dist/angular/ds-mobile-sheet-nav.js +7 -4
  22. package/dist/angular/ds-panel-nav.d.ts +1 -1
  23. package/dist/angular/ds-panel-nav.js +3 -3
  24. package/dist/angular/ds-panel-tool-header.d.ts +1 -1
  25. package/dist/angular/ds-panel-tool-header.js +3 -3
  26. package/dist/angular/ds-panel-tool-search.d.ts +1 -1
  27. package/dist/angular/ds-panel-tool-search.js +3 -3
  28. package/dist/angular/ds-table.d.ts +1 -1
  29. package/dist/angular/ds-table.js +3 -3
  30. package/dist/angular/ds-tag.d.ts +1 -1
  31. package/dist/angular/ds-tag.js +3 -3
  32. package/dist/angular/index.d.ts +1 -1
  33. package/dist/angular/index.js +2 -0
  34. package/dist/angular/proxies.d.ts +2 -0
  35. package/dist/angular/proxies.js +2 -0
  36. package/dist/components/ds-agent-activity.js +1 -1
  37. package/dist/components/ds-agent-questionnaire.js +1 -1
  38. package/dist/components/ds-agent-response.js +1 -1
  39. package/dist/components/ds-agent-source-list.js +1 -1
  40. package/dist/components/ds-agent-tool-call.js +1 -1
  41. package/dist/components/ds-attachment-list.js +1 -1
  42. package/dist/components/ds-badge.js +1 -1
  43. package/dist/components/ds-banner.js +1 -1
  44. package/dist/components/ds-bar-action.js +1 -1
  45. package/dist/components/ds-bar-nav.js +1 -1
  46. package/dist/components/ds-bar-title.js +1 -1
  47. package/dist/components/ds-bar-workflow.js +1 -1
  48. package/dist/components/ds-breadcrumb.js +1 -1
  49. package/dist/components/ds-button-filled.js +1 -1
  50. package/dist/components/ds-button-unfilled.js +1 -1
  51. package/dist/components/ds-card-chart.js +1 -1
  52. package/dist/components/ds-card-navigation.d.ts +11 -0
  53. package/dist/components/ds-card-navigation.js +2 -0
  54. package/dist/components/ds-card-navigation.js.map +1 -0
  55. package/dist/components/ds-card-overview.js +1 -1
  56. package/dist/components/ds-card-overview.js.map +1 -1
  57. package/dist/components/ds-card-setting.js +1 -1
  58. package/dist/components/ds-card-settings-scope.d.ts +11 -0
  59. package/dist/components/ds-card-settings-scope.js +2 -0
  60. package/dist/components/ds-card-settings-scope.js.map +1 -0
  61. package/dist/components/ds-chart-legend.js +1 -1
  62. package/dist/components/ds-chart-legend.js.map +1 -1
  63. package/dist/components/ds-chart.js +1 -1
  64. package/dist/components/ds-checkbox.js +1 -1
  65. package/dist/components/ds-chip.js +1 -1
  66. package/dist/components/ds-code-block.js +1 -1
  67. package/dist/components/ds-conversation-list-item.js +1 -1
  68. package/dist/components/ds-conversation-list-item.js.map +1 -1
  69. package/dist/components/ds-conversation-list-section.js +1 -1
  70. package/dist/components/ds-conversation-list.js +1 -1
  71. package/dist/components/ds-divider.js +1 -1
  72. package/dist/components/ds-empty-state.js +1 -1
  73. package/dist/components/ds-field.js +1 -1
  74. package/dist/components/ds-filter-menu.js +1 -1
  75. package/dist/components/ds-input.js +1 -1
  76. package/dist/components/ds-markdown.js +1 -1
  77. package/dist/components/ds-menu.js +1 -1
  78. package/dist/components/ds-message-actions.js +1 -1
  79. package/dist/components/ds-message-bubble.js +1 -1
  80. package/dist/components/ds-message-composer.js +1 -1
  81. package/dist/components/ds-message-scroller.js +1 -1
  82. package/dist/components/ds-message.js +1 -1
  83. package/dist/components/ds-mobile-bar-nav.js +1 -1
  84. package/dist/components/ds-mobile-header.js +1 -1
  85. package/dist/components/ds-mobile-section-switcher.js +1 -1
  86. package/dist/components/ds-mobile-sheet-nav.js +1 -1
  87. package/dist/components/ds-modal.js +1 -1
  88. package/dist/components/ds-pagination.js +1 -1
  89. package/dist/components/ds-panel-nav.js +1 -1
  90. package/dist/components/ds-panel-sub-nav.js +1 -1
  91. package/dist/components/ds-panel-sub-nav.js.map +1 -1
  92. package/dist/components/ds-panel-tool-header.js +1 -1
  93. package/dist/components/ds-panel-tool-search.js +1 -1
  94. package/dist/components/ds-panel-tool-search.js.map +1 -1
  95. package/dist/components/ds-panel-tools.js +1 -1
  96. package/dist/components/ds-paper-texture.js +1 -1
  97. package/dist/components/ds-radio.js +1 -1
  98. package/dist/components/ds-score.js +1 -1
  99. package/dist/components/ds-scroll-overlay.js +1 -1
  100. package/dist/components/ds-select.js +1 -1
  101. package/dist/components/ds-shell-app.js +1 -1
  102. package/dist/components/ds-shell-app.js.map +1 -1
  103. package/dist/components/ds-shell-page.js +1 -1
  104. package/dist/components/ds-shell-tools.js +1 -1
  105. package/dist/components/ds-skeleton.js +1 -1
  106. package/dist/components/ds-slider.js +1 -1
  107. package/dist/components/ds-swatch-picker.js +1 -1
  108. package/dist/components/ds-switch.js +1 -1
  109. package/dist/components/ds-tab-group.js +1 -1
  110. package/dist/components/ds-table-filter.js +1 -1
  111. package/dist/components/ds-table-group.js +1 -1
  112. package/dist/components/ds-table-group.js.map +1 -1
  113. package/dist/components/ds-table-saved-views.js +1 -1
  114. package/dist/components/ds-table-saved-views.js.map +1 -1
  115. package/dist/components/ds-table-search.js +1 -1
  116. package/dist/components/ds-table-search.js.map +1 -1
  117. package/dist/components/ds-table-sort.js +1 -1
  118. package/dist/components/ds-table-sort.js.map +1 -1
  119. package/dist/components/ds-table-toolbar.js +1 -1
  120. package/dist/components/ds-table.js +1 -1
  121. package/dist/components/ds-table.js.map +1 -1
  122. package/dist/components/ds-tag.js +1 -1
  123. package/dist/components/ds-text.js +1 -1
  124. package/dist/components/ds-textarea.js +1 -1
  125. package/dist/components/ds-textarea.js.map +1 -1
  126. package/dist/components/ds-toast.js +1 -1
  127. package/dist/components/ds-tooltip-chart.js +1 -1
  128. package/dist/components/ds-tooltip.js +1 -1
  129. package/dist/components/ds-typing-indicator.js +1 -1
  130. package/dist/components/p--yvQzZoO.js +2 -0
  131. package/dist/components/p--yvQzZoO.js.map +1 -0
  132. package/dist/components/{p-Is1lFmwp.js → p-1gt8QlyW.js} +2 -2
  133. package/dist/components/p-B5AZd41L.js +2 -0
  134. package/dist/components/p-B5AZd41L.js.map +1 -0
  135. package/dist/components/p-B5eMVBlz.js +2 -0
  136. package/dist/components/p-B5eMVBlz.js.map +1 -0
  137. package/dist/components/{p-Q7AOgrg5.js → p-BCFpqnAg.js} +2 -2
  138. package/dist/components/p-BFHWoNH3.js +2 -0
  139. package/dist/components/{p-BVz-r3g0.js.map → p-BFHWoNH3.js.map} +1 -1
  140. package/dist/components/p-BGnRFtBa.js +2 -0
  141. package/dist/components/p-BGnRFtBa.js.map +1 -0
  142. package/dist/components/p-BIDGQ4tc.js +2 -0
  143. package/dist/components/p-BIDGQ4tc.js.map +1 -0
  144. package/dist/components/{p-Ctnm9NJP.js → p-BLTHIBsE.js} +2 -2
  145. package/dist/components/{p-C68oSTb1.js → p-BXT2opmZ.js} +2 -2
  146. package/dist/components/p-BZDQLjE0.js +2 -0
  147. package/dist/components/p-BZDQLjE0.js.map +1 -0
  148. package/dist/components/{p-Q0dkeoJ6.js → p-BdC7wxhu.js} +2 -2
  149. package/dist/components/{p-Q0dkeoJ6.js.map → p-BdC7wxhu.js.map} +1 -1
  150. package/dist/components/p-BfVlFinS.js +2 -0
  151. package/dist/components/{p-CQjUOHiN.js.map → p-BfVlFinS.js.map} +1 -1
  152. package/dist/components/{p-DGkn8FwV.js → p-Bl5wd3v3.js} +2 -2
  153. package/dist/components/p-BmRHJ_jo.js +2 -0
  154. package/dist/components/p-BmRHJ_jo.js.map +1 -0
  155. package/dist/components/{p-Bb9dA7sl.js → p-BpB2EF9g.js} +2 -2
  156. package/dist/components/{p-2wIPUcSL.js → p-BwAWZAHk.js} +2 -2
  157. package/dist/components/{p-B3sRZBZk.js → p-By5TDnbF.js} +2 -2
  158. package/dist/components/{p-BVpn_e-r.js → p-CDXcINTO.js} +2 -2
  159. package/dist/components/p-CDXcINTO.js.map +1 -0
  160. package/dist/components/{p-B3Z5sQin.js → p-CE8gsv7V.js} +2 -2
  161. package/dist/components/p-CLcwh1kq.js +2 -0
  162. package/dist/components/p-CLcwh1kq.js.map +1 -0
  163. package/dist/components/{p-DW8ssbfI.js → p-CN8PQLZu.js} +2 -2
  164. package/dist/components/p-CcK3UiTu.js +2 -0
  165. package/dist/components/{p-1604KY3B.js.map → p-CcK3UiTu.js.map} +1 -1
  166. package/dist/components/{p-CaF5WCci.js → p-Cocq-utR.js} +2 -2
  167. package/dist/components/p-Cr5vn5JO.js +2 -0
  168. package/dist/components/{p-to8BxxgT.js.map → p-Cr5vn5JO.js.map} +1 -1
  169. package/dist/components/{p-Cf5Ai4xx.js → p-Crd3PEUx.js} +2 -2
  170. package/dist/components/{p-Cf5Ai4xx.js.map → p-Crd3PEUx.js.map} +1 -1
  171. package/dist/components/{p-BZiGtBBk.js → p-Ct90k-nz.js} +2 -2
  172. package/dist/components/p-Cx2dWjaW.js +2 -0
  173. package/dist/components/p-Cx2dWjaW.js.map +1 -0
  174. package/dist/components/p-CyoLh8su.js +2 -0
  175. package/dist/components/p-CyoLh8su.js.map +1 -0
  176. package/dist/components/{p-BXDLR072.js → p-CysCSinT.js} +2 -2
  177. package/dist/components/{p-BXDLR072.js.map → p-CysCSinT.js.map} +1 -1
  178. package/dist/components/p-CzbsTZt7.js.map +1 -1
  179. package/dist/components/p-D1pPq-y0.js +2 -0
  180. package/dist/components/p-D1pPq-y0.js.map +1 -0
  181. package/dist/components/{p-VT-5XDkB.js → p-DDOuPq-N.js} +2 -2
  182. package/dist/components/{p-DkxOEFHN.js → p-DF8W85Tz.js} +2 -2
  183. package/dist/components/{p-DDqRCDXh.js → p-DSJSnQ1U.js} +2 -2
  184. package/dist/components/{p-Cr6pDY-e.js → p-DYK0slTb.js} +2 -2
  185. package/dist/components/{p-D9wZlB_N.js → p-D_QtZZR8.js} +2 -2
  186. package/dist/components/{p-Bv6FSDPR.js → p-DbDYEEWq.js} +2 -2
  187. package/dist/components/{p-BEXkJ9lg.js → p-DnQN0pLp.js} +2 -2
  188. package/dist/components/{p-DIqAdmui.js → p-FiM3rF7B.js} +2 -2
  189. package/dist/components/p-GbtafFds.js +2 -0
  190. package/dist/components/p-GbtafFds.js.map +1 -0
  191. package/dist/components/{p-WFo1x6dN.js → p-Hzz2j1Je.js} +2 -2
  192. package/dist/components/{p-B9esvbYk.js → p-K39w53Bw.js} +2 -2
  193. package/dist/components/p-K39w53Bw.js.map +1 -0
  194. package/dist/components/{p-DQQsS9Rx.js → p-aMyflqva.js} +2 -2
  195. package/dist/components/{p-DZcIt_JJ.js → p-dgep63_i.js} +2 -2
  196. package/dist/components/p-frKsmPQn.js +2 -0
  197. package/dist/components/p-frKsmPQn.js.map +1 -0
  198. package/dist/components/{p-BMzn2Cmw.js → p-rSC7ZUpy.js} +2 -2
  199. package/dist/docs/components.json +1025 -44
  200. package/dist/lib/components/ButtonFilled/ButtonFilled.d.ts +11 -3
  201. package/dist/lib/components/PanelTools/panel-tools-types.d.ts +2 -0
  202. package/dist/lib/components/ShellApp/shell-app-types.d.ts +2 -0
  203. package/dist/lib/shell/index.js.map +1 -1
  204. package/dist/lib/utils/choice-list.d.ts +2 -0
  205. package/dist/mcp-data/registry/bar-nav.json +7 -2
  206. package/dist/mcp-data/registry/bar-title.json +8 -3
  207. package/dist/mcp-data/registry/button-filled.json +26 -5
  208. package/dist/mcp-data/registry/button-unfilled.json +27 -6
  209. package/dist/mcp-data/registry/card-navigation.json +255 -0
  210. package/dist/mcp-data/registry/card-settings-scope.json +314 -0
  211. package/dist/mcp-data/registry/filter-menu.json +7 -2
  212. package/dist/mcp-data/registry/menu.json +21 -2
  213. package/dist/mcp-data/registry/mobile-bar-nav.json +20 -1
  214. package/dist/mcp-data/registry/mobile-header.json +23 -3
  215. package/dist/mcp-data/registry/mobile-section-switcher.json +50 -6
  216. package/dist/mcp-data/registry/mobile-sheet-nav.json +40 -3
  217. package/dist/mcp-data/registry/panel-nav.json +27 -6
  218. package/dist/mcp-data/registry/panel-tool-header.json +23 -2
  219. package/dist/mcp-data/registry/panel-tool-search.json +23 -2
  220. package/dist/mcp-data/registry/panel-tools.json +7 -2
  221. package/dist/mcp-data/registry/registry.json +441 -32
  222. package/dist/mcp-data/registry/select.json +8 -3
  223. package/dist/mcp-data/registry/shell-app.json +14 -8
  224. package/dist/mcp-data/registry/shell-tools.json +7 -2
  225. package/dist/mcp-data/registry/table-group.json +7 -2
  226. package/dist/mcp-data/registry/table-saved-views.json +7 -2
  227. package/dist/mcp-data/registry/table-search.json +7 -2
  228. package/dist/mcp-data/registry/table-sort.json +7 -2
  229. package/dist/mcp-data/registry/table.json +24 -3
  230. package/dist/mcp-data/registry/tag.json +24 -3
  231. package/dist/react/components.d.ts +2 -0
  232. package/dist/react/components.js +2 -0
  233. package/dist/react/ds-card-navigation.d.ts +12 -0
  234. package/dist/react/ds-card-navigation.js +12 -0
  235. package/dist/react/ds-card-settings-scope.d.ts +12 -0
  236. package/dist/react/ds-card-settings-scope.js +12 -0
  237. package/dist/react/ds-mobile-sheet-nav.d.ts +2 -1
  238. package/dist/react/ds-mobile-sheet-nav.js +1 -0
  239. package/dist/styles/table.css +1 -0
  240. package/dist/types/components/BarTitle/BarTitle.d.ts +3 -0
  241. package/dist/types/components/ButtonFilled/ButtonFilled.d.ts +11 -3
  242. package/dist/types/components/ButtonUnfilled/ButtonUnfilled.d.ts +11 -5
  243. package/dist/types/components/CardNavigation/CardNavigation.d.ts +31 -0
  244. package/dist/types/components/CardNavigation/index.d.ts +2 -0
  245. package/dist/types/components/CardSettingsScope/CardSettingsScope.d.ts +33 -0
  246. package/dist/types/components/CardSettingsScope/index.d.ts +2 -0
  247. package/dist/types/components/Menu/Menu.d.ts +4 -0
  248. package/dist/types/components/MobileBarNav/MobileBarNav.d.ts +2 -0
  249. package/dist/types/components/MobileHeader/MobileHeader.d.ts +3 -0
  250. package/dist/types/components/MobileSectionSwitcher/MobileSectionSwitcher.d.ts +19 -0
  251. package/dist/types/components/MobileSheetNav/MobileSheetNav.d.ts +15 -2
  252. package/dist/types/components/PanelNav/PanelNav.d.ts +4 -1
  253. package/dist/types/components/PanelToolHeader/PanelToolHeader.d.ts +2 -0
  254. package/dist/types/components/PanelToolSearch/PanelToolSearch.d.ts +2 -0
  255. package/dist/types/components/PanelTools/panel-tools-types.d.ts +2 -0
  256. package/dist/types/components/ShellApp/ShellApp.d.ts +5 -2
  257. package/dist/types/components/ShellApp/shell-app-types.d.ts +2 -0
  258. package/dist/types/components/Table/Table.d.ts +10 -0
  259. package/dist/types/components/Table/table-row-view.d.ts +6 -1
  260. package/dist/types/components/TableSort/TableSort.d.ts +1 -0
  261. package/dist/types/components/Tag/Tag.d.ts +3 -0
  262. package/dist/types/components.d.ts +369 -8
  263. package/dist/types/utils/choice-list.d.ts +2 -0
  264. package/dist/vue/components.d.ts +2 -0
  265. package/dist/vue/components.js +2 -0
  266. package/dist/vue/ds-button-filled.js +1 -0
  267. package/dist/vue/ds-button-unfilled.js +1 -0
  268. package/dist/vue/ds-card-navigation.d.ts +3 -0
  269. package/dist/vue/ds-card-navigation.js +15 -0
  270. package/dist/vue/ds-card-settings-scope.d.ts +3 -0
  271. package/dist/vue/ds-card-settings-scope.js +20 -0
  272. package/dist/vue/ds-menu.js +1 -0
  273. package/dist/vue/ds-mobile-bar-nav.js +1 -0
  274. package/dist/vue/ds-mobile-header.js +1 -0
  275. package/dist/vue/ds-mobile-section-switcher.js +2 -0
  276. package/dist/vue/ds-mobile-sheet-nav.js +3 -0
  277. package/dist/vue/ds-panel-nav.js +1 -0
  278. package/dist/vue/ds-panel-tool-header.js +1 -0
  279. package/dist/vue/ds-panel-tool-search.js +1 -0
  280. package/dist/vue/ds-table.js +1 -0
  281. package/dist/vue/ds-tag.js +1 -0
  282. package/package.json +1 -1
  283. package/dist/components/p-1604KY3B.js +0 -2
  284. package/dist/components/p-537t6oRD.js +0 -2
  285. package/dist/components/p-537t6oRD.js.map +0 -1
  286. package/dist/components/p-6_CNVbqa.js +0 -2
  287. package/dist/components/p-6_CNVbqa.js.map +0 -1
  288. package/dist/components/p-B9esvbYk.js.map +0 -1
  289. package/dist/components/p-BIGpc__9.js +0 -2
  290. package/dist/components/p-BIGpc__9.js.map +0 -1
  291. package/dist/components/p-BRLDf-NK.js +0 -2
  292. package/dist/components/p-BRLDf-NK.js.map +0 -1
  293. package/dist/components/p-BUh2GkPJ.js +0 -2
  294. package/dist/components/p-BUh2GkPJ.js.map +0 -1
  295. package/dist/components/p-BVpn_e-r.js.map +0 -1
  296. package/dist/components/p-BVz-r3g0.js +0 -2
  297. package/dist/components/p-Bjt_8sLe.js +0 -2
  298. package/dist/components/p-Bjt_8sLe.js.map +0 -1
  299. package/dist/components/p-BssZ4SbT.js +0 -2
  300. package/dist/components/p-BssZ4SbT.js.map +0 -1
  301. package/dist/components/p-CGQnHNuW.js +0 -2
  302. package/dist/components/p-CGQnHNuW.js.map +0 -1
  303. package/dist/components/p-CQjUOHiN.js +0 -2
  304. package/dist/components/p-Cy1oWIaV.js +0 -2
  305. package/dist/components/p-Cy1oWIaV.js.map +0 -1
  306. package/dist/components/p-DQsFmleZ.js +0 -2
  307. package/dist/components/p-DQsFmleZ.js.map +0 -1
  308. package/dist/components/p-DlbhmXjH.js +0 -2
  309. package/dist/components/p-DlbhmXjH.js.map +0 -1
  310. package/dist/components/p-GEi3hDJQ.js +0 -2
  311. package/dist/components/p-GEi3hDJQ.js.map +0 -1
  312. package/dist/components/p-LMmrjmI_.js +0 -2
  313. package/dist/components/p-LMmrjmI_.js.map +0 -1
  314. package/dist/components/p-to8BxxgT.js +0 -2
  315. /package/dist/components/{p-Is1lFmwp.js.map → p-1gt8QlyW.js.map} +0 -0
  316. /package/dist/components/{p-Q7AOgrg5.js.map → p-BCFpqnAg.js.map} +0 -0
  317. /package/dist/components/{p-Ctnm9NJP.js.map → p-BLTHIBsE.js.map} +0 -0
  318. /package/dist/components/{p-C68oSTb1.js.map → p-BXT2opmZ.js.map} +0 -0
  319. /package/dist/components/{p-DGkn8FwV.js.map → p-Bl5wd3v3.js.map} +0 -0
  320. /package/dist/components/{p-Bb9dA7sl.js.map → p-BpB2EF9g.js.map} +0 -0
  321. /package/dist/components/{p-2wIPUcSL.js.map → p-BwAWZAHk.js.map} +0 -0
  322. /package/dist/components/{p-B3sRZBZk.js.map → p-By5TDnbF.js.map} +0 -0
  323. /package/dist/components/{p-B3Z5sQin.js.map → p-CE8gsv7V.js.map} +0 -0
  324. /package/dist/components/{p-DW8ssbfI.js.map → p-CN8PQLZu.js.map} +0 -0
  325. /package/dist/components/{p-CaF5WCci.js.map → p-Cocq-utR.js.map} +0 -0
  326. /package/dist/components/{p-BZiGtBBk.js.map → p-Ct90k-nz.js.map} +0 -0
  327. /package/dist/components/{p-VT-5XDkB.js.map → p-DDOuPq-N.js.map} +0 -0
  328. /package/dist/components/{p-DkxOEFHN.js.map → p-DF8W85Tz.js.map} +0 -0
  329. /package/dist/components/{p-DDqRCDXh.js.map → p-DSJSnQ1U.js.map} +0 -0
  330. /package/dist/components/{p-Cr6pDY-e.js.map → p-DYK0slTb.js.map} +0 -0
  331. /package/dist/components/{p-D9wZlB_N.js.map → p-D_QtZZR8.js.map} +0 -0
  332. /package/dist/components/{p-Bv6FSDPR.js.map → p-DbDYEEWq.js.map} +0 -0
  333. /package/dist/components/{p-BEXkJ9lg.js.map → p-DnQN0pLp.js.map} +0 -0
  334. /package/dist/components/{p-DIqAdmui.js.map → p-FiM3rF7B.js.map} +0 -0
  335. /package/dist/components/{p-WFo1x6dN.js.map → p-Hzz2j1Je.js.map} +0 -0
  336. /package/dist/components/{p-DQQsS9Rx.js.map → p-aMyflqva.js.map} +0 -0
  337. /package/dist/components/{p-DZcIt_JJ.js.map → p-dgep63_i.js.map} +0 -0
  338. /package/dist/components/{p-BMzn2Cmw.js.map → p-rSC7ZUpy.js.map} +0 -0
@@ -0,0 +1,314 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "card-settings-scope",
4
+ "title": "CardSettingsScope",
5
+ "description": "Compact, theme-aware settings context card with inline product-area and profile menu triggers.",
6
+ "type": "registry:ui",
7
+ "meta": {
8
+ "library": "@ds-mo/ui",
9
+ "distribution": "npm",
10
+ "storybook": "https://zainadeel.github.io/compomo/?path=/story/card-settings-scope",
11
+ "source": "src/wc/components/CardSettingsScope/CardSettingsScope.tsx",
12
+ "intentStatus": "complete",
13
+ "intent": {
14
+ "audience": "general",
15
+ "status": "stable",
16
+ "summary": "Compact, theme-aware settings context card with inline product-area and profile menu triggers.",
17
+ "useWhen": [
18
+ "A settings workspace needs to show and change both its product area and the organization or profile being managed."
19
+ ],
20
+ "avoidWhen": [
21
+ "The content is a reporting period and metrics summary; use CardOverview.",
22
+ "The card edits settings in place; use CardSetting."
23
+ ],
24
+ "commonlyComposedWith": [
25
+ "component:ds-menu",
26
+ "component:ds-card-setting"
27
+ ],
28
+ "accessibility": [
29
+ "Both scope values are native buttons with popup relationships and controlled expanded state.",
30
+ "Use the emitted native anchor for menu placement and focus return.",
31
+ "An empty informational profiles popup uses dialog semantics.",
32
+ "The shared text-action recipe supplies brand foreground, hover underline, and keyboard focus indication."
33
+ ],
34
+ "states": [
35
+ "The application owns the selected area, profile, available choices, permissions, and empty-state copy.",
36
+ "The card reports popup requests without changing selection or expanded state.",
37
+ "The surface follows the active theme rather than imposing always-dark colors."
38
+ ],
39
+ "responsiveBehavior": [
40
+ "The parent owns sticky positioning and shell offsets.",
41
+ "The compact sentence wraps when space is constrained so both controls remain available."
42
+ ],
43
+ "frameworkCaveats": {
44
+ "angular": [
45
+ "Import the generated standalone adapter; bind controlled labels and expanded states and handle dsScopeRequest."
46
+ ]
47
+ },
48
+ "references": [
49
+ {
50
+ "label": "Storybook examples",
51
+ "path": "src/wc/components/CardSettingsScope/CardSettingsScope.stories.ts"
52
+ }
53
+ ]
54
+ },
55
+ "api": {
56
+ "props": {
57
+ "areaControls": {
58
+ "type": "string | undefined",
59
+ "resolvedType": "string | undefined",
60
+ "attribute": "area-controls",
61
+ "required": false,
62
+ "mutable": false,
63
+ "description": "ID of the application-owned product-area menu."
64
+ },
65
+ "areaExpanded": {
66
+ "type": "boolean",
67
+ "resolvedType": "boolean",
68
+ "attribute": "area-expanded",
69
+ "default": "false",
70
+ "required": false,
71
+ "mutable": false,
72
+ "description": "Whether the product-area menu is open."
73
+ },
74
+ "areaLabel": {
75
+ "type": "string",
76
+ "resolvedType": "string",
77
+ "attribute": "area-label",
78
+ "default": "'All settings'",
79
+ "required": false,
80
+ "mutable": false,
81
+ "description": "Current product area or the label for the combined settings view."
82
+ },
83
+ "forLabel": {
84
+ "type": "string",
85
+ "resolvedType": "string",
86
+ "attribute": "for-label",
87
+ "default": "'for'",
88
+ "required": false,
89
+ "mutable": false,
90
+ "description": "Sentence connector, supplied separately for localization."
91
+ },
92
+ "managingLabel": {
93
+ "type": "string",
94
+ "resolvedType": "string",
95
+ "attribute": "managing-label",
96
+ "default": "'Managing'",
97
+ "required": false,
98
+ "mutable": false,
99
+ "description": "Sentence prefix, supplied separately for localization."
100
+ },
101
+ "profileControls": {
102
+ "type": "string | undefined",
103
+ "resolvedType": "string | undefined",
104
+ "attribute": "profile-controls",
105
+ "required": false,
106
+ "mutable": false,
107
+ "description": "ID of the application-owned profiles popup."
108
+ },
109
+ "profileExpanded": {
110
+ "type": "boolean",
111
+ "resolvedType": "boolean",
112
+ "attribute": "profile-expanded",
113
+ "default": "false",
114
+ "required": false,
115
+ "mutable": false,
116
+ "description": "Whether the profiles popup is open."
117
+ },
118
+ "profileLabel": {
119
+ "type": "string",
120
+ "resolvedType": "string",
121
+ "attribute": "profile-label",
122
+ "default": "'Organization'",
123
+ "required": false,
124
+ "mutable": false,
125
+ "description": "Current organization or settings profile."
126
+ },
127
+ "profilePopup": {
128
+ "type": "'menu' | 'dialog'",
129
+ "resolvedType": "\"dialog\" | \"menu\"",
130
+ "attribute": "profile-popup",
131
+ "default": "'menu'",
132
+ "required": false,
133
+ "mutable": false,
134
+ "description": "Empty informational profile popups use dialog semantics instead of a menu."
135
+ },
136
+ "scopeLabel": {
137
+ "type": "string",
138
+ "resolvedType": "string",
139
+ "attribute": "scope-label",
140
+ "default": "'Settings scope'",
141
+ "required": false,
142
+ "mutable": false,
143
+ "description": "Accessible name for this context region."
144
+ }
145
+ },
146
+ "events": [
147
+ {
148
+ "name": "dsScopeRequest",
149
+ "detail": "SettingsScopeRequest",
150
+ "bubbles": true,
151
+ "cancelable": true,
152
+ "composed": true,
153
+ "description": "Requests a popup; the owner supplies choices, open state, and selection."
154
+ }
155
+ ],
156
+ "methods": [],
157
+ "slots": []
158
+ },
159
+ "props": {
160
+ "areaControls": {
161
+ "type": "string | undefined",
162
+ "resolvedType": "string | undefined",
163
+ "attribute": "area-controls",
164
+ "required": false,
165
+ "mutable": false,
166
+ "description": "ID of the application-owned product-area menu."
167
+ },
168
+ "areaExpanded": {
169
+ "type": "boolean",
170
+ "resolvedType": "boolean",
171
+ "attribute": "area-expanded",
172
+ "default": "false",
173
+ "required": false,
174
+ "mutable": false,
175
+ "description": "Whether the product-area menu is open."
176
+ },
177
+ "areaLabel": {
178
+ "type": "string",
179
+ "resolvedType": "string",
180
+ "attribute": "area-label",
181
+ "default": "'All settings'",
182
+ "required": false,
183
+ "mutable": false,
184
+ "description": "Current product area or the label for the combined settings view."
185
+ },
186
+ "forLabel": {
187
+ "type": "string",
188
+ "resolvedType": "string",
189
+ "attribute": "for-label",
190
+ "default": "'for'",
191
+ "required": false,
192
+ "mutable": false,
193
+ "description": "Sentence connector, supplied separately for localization."
194
+ },
195
+ "managingLabel": {
196
+ "type": "string",
197
+ "resolvedType": "string",
198
+ "attribute": "managing-label",
199
+ "default": "'Managing'",
200
+ "required": false,
201
+ "mutable": false,
202
+ "description": "Sentence prefix, supplied separately for localization."
203
+ },
204
+ "profileControls": {
205
+ "type": "string | undefined",
206
+ "resolvedType": "string | undefined",
207
+ "attribute": "profile-controls",
208
+ "required": false,
209
+ "mutable": false,
210
+ "description": "ID of the application-owned profiles popup."
211
+ },
212
+ "profileExpanded": {
213
+ "type": "boolean",
214
+ "resolvedType": "boolean",
215
+ "attribute": "profile-expanded",
216
+ "default": "false",
217
+ "required": false,
218
+ "mutable": false,
219
+ "description": "Whether the profiles popup is open."
220
+ },
221
+ "profileLabel": {
222
+ "type": "string",
223
+ "resolvedType": "string",
224
+ "attribute": "profile-label",
225
+ "default": "'Organization'",
226
+ "required": false,
227
+ "mutable": false,
228
+ "description": "Current organization or settings profile."
229
+ },
230
+ "profilePopup": {
231
+ "type": "'menu' | 'dialog'",
232
+ "resolvedType": "\"dialog\" | \"menu\"",
233
+ "attribute": "profile-popup",
234
+ "default": "'menu'",
235
+ "required": false,
236
+ "mutable": false,
237
+ "description": "Empty informational profile popups use dialog semantics instead of a menu."
238
+ },
239
+ "scopeLabel": {
240
+ "type": "string",
241
+ "resolvedType": "string",
242
+ "attribute": "scope-label",
243
+ "default": "'Settings scope'",
244
+ "required": false,
245
+ "mutable": false,
246
+ "description": "Accessible name for this context region."
247
+ }
248
+ },
249
+ "events": [
250
+ {
251
+ "name": "dsScopeRequest",
252
+ "detail": "SettingsScopeRequest",
253
+ "bubbles": true,
254
+ "cancelable": true,
255
+ "composed": true,
256
+ "description": "Requests a popup; the owner supplies choices, open state, and selection."
257
+ }
258
+ ],
259
+ "methods": [],
260
+ "slots": [],
261
+ "exports": {
262
+ "customElement": "ds-card-settings-scope",
263
+ "react": "DsCardSettingsScope",
264
+ "vue": "DsCardSettingsScope",
265
+ "angular": "DsCardSettingsScope"
266
+ },
267
+ "consumption": {
268
+ "install": "npm install @ds-mo/ui @ds-mo/tokens @ds-mo/icons",
269
+ "cssSetup": "import '@ds-mo/tokens';\nimport '@ds-mo/tokens/reset';\nimport '@ds-mo/tokens/globals';",
270
+ "customElements": {
271
+ "import": "import '@ds-mo/ui/dist/components/ds-card-settings-scope.js';",
272
+ "example": "<ds-card-settings-scope></ds-card-settings-scope>"
273
+ },
274
+ "react": {
275
+ "import": "import { DsCardSettingsScope } from '@ds-mo/ui/react';",
276
+ "example": "<DsCardSettingsScope />"
277
+ },
278
+ "vue": {
279
+ "import": "import { DsCardSettingsScope } from '@ds-mo/ui/vue';",
280
+ "example": "<DsCardSettingsScope />"
281
+ },
282
+ "angular": {
283
+ "import": "import { DsCardSettingsScope } from '@ds-mo/ui/angular/ds-card-settings-scope';",
284
+ "example": "<ds-card-settings-scope></ds-card-settings-scope>"
285
+ },
286
+ "peerDependencies": {
287
+ "required": [
288
+ "@ds-mo/tokens ^6.5.1",
289
+ "@ds-mo/icons ^7.0.0"
290
+ ],
291
+ "frameworks": "Custom Elements; React 18/19 wrappers; Vue 3 wrappers; Angular 19-22 standalone adapters."
292
+ }
293
+ }
294
+ },
295
+ "dependencies": [
296
+ "@ds-mo/ui",
297
+ "@ds-mo/tokens"
298
+ ],
299
+ "registryDependencies": [
300
+ "text"
301
+ ],
302
+ "files": [
303
+ {
304
+ "path": "src/wc/components/CardSettingsScope/CardSettingsScope.css",
305
+ "content": "@import '../../utils/text-decoration.css';\n@import '../../utils/focus-ring.css';\n@import '../../styles/control-elevation.css';\n\n:host {\n display: block;\n min-width: 0;\n width: var(--dimension-card-width-md);\n max-width: 100%;\n}\n\n.card-settings-scope {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 0 var(--dimension-space-050);\n box-sizing: border-box;\n min-height: var(--dimension-size-600);\n padding: var(--dimension-space-100) var(--dimension-space-200);\n border-radius: var(--dimension-radius-125);\n background: var(--color-background-primary);\n color: var(--color-foreground-primary);\n}\n\n.card-settings-scope__action {\n display: inline-flex;\n align-items: center;\n min-height: var(--dimension-size-400);\n max-width: 100%;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: var(--dimension-radius-025);\n background: transparent;\n cursor: pointer;\n}\n\n.card-settings-scope__action ds-text {\n overflow-wrap: anywhere;\n text-align: start;\n}\n\n@media (forced-colors: active) {\n .card-settings-scope {\n outline: var(--dimension-stroke-width-012) solid var(--ds-forced-color-content);\n outline-offset: calc(-1 * var(--dimension-stroke-width-012));\n }\n}\n",
306
+ "type": "registry:ui"
307
+ },
308
+ {
309
+ "path": "src/wc/components/CardSettingsScope/CardSettingsScope.tsx",
310
+ "content": "import { Component, Event, EventEmitter, h, Host, Prop } from '@stencil/core';\n\nexport interface SettingsScopeRequest {\n scope: 'area' | 'profile';\n anchor: HTMLButtonElement;\n originalEvent: MouseEvent;\n}\n\n@Component({\n tag: 'ds-card-settings-scope',\n styleUrl: 'CardSettingsScope.css',\n scoped: true,\n})\nexport class CardSettingsScope {\n /** Current product area or the label for the combined settings view. */\n @Prop() areaLabel: string = 'All settings';\n /** Current organization or settings profile. */\n @Prop() profileLabel: string = 'Organization';\n /** Sentence prefix, supplied separately for localization. */\n @Prop() managingLabel: string = 'Managing';\n /** Sentence connector, supplied separately for localization. */\n @Prop() forLabel: string = 'for';\n /** Accessible name for this context region. */\n @Prop() scopeLabel: string = 'Settings scope';\n /** ID of the application-owned product-area menu. */\n @Prop() areaControls: string | undefined;\n /** ID of the application-owned profiles popup. */\n @Prop() profileControls: string | undefined;\n /** Whether the product-area menu is open. */\n @Prop() areaExpanded: boolean = false;\n /** Whether the profiles popup is open. */\n @Prop() profileExpanded: boolean = false;\n /** Empty informational profile popups use dialog semantics instead of a menu. */\n @Prop() profilePopup: 'menu' | 'dialog' = 'menu';\n\n /** Requests a popup; the owner supplies choices, open state, and selection. */\n @Event() dsScopeRequest!: EventEmitter<SettingsScopeRequest>;\n\n private request(scope: SettingsScopeRequest['scope'], event: MouseEvent) {\n this.dsScopeRequest.emit({\n scope,\n anchor: event.currentTarget as HTMLButtonElement,\n originalEvent: event,\n });\n }\n\n render() {\n return (\n <Host>\n <div\n class=\"card-settings-scope ds-control-elevation ds-control-elevation--sm\"\n role=\"region\"\n aria-label={this.scopeLabel}\n >\n <ds-text as=\"span\" variant=\"text-body-medium\" color=\"primary\">\n {this.managingLabel}\n </ds-text>\n <button\n type=\"button\"\n class=\"card-settings-scope__action ds-text-action ds-focus-ring\"\n aria-haspopup=\"menu\"\n aria-controls={this.areaControls}\n aria-expanded={String(this.areaExpanded)}\n onClick={event => this.request('area', event)}\n >\n <ds-text as=\"span\" variant=\"text-body-medium\" color=\"inherit\">\n {this.areaLabel}\n </ds-text>\n </button>\n <ds-text as=\"span\" variant=\"text-body-medium\" color=\"primary\">\n {this.forLabel}\n </ds-text>\n <button\n type=\"button\"\n class=\"card-settings-scope__action ds-text-action ds-focus-ring\"\n aria-haspopup={this.profilePopup}\n aria-controls={this.profileControls}\n aria-expanded={String(this.profileExpanded)}\n onClick={event => this.request('profile', event)}\n >\n <ds-text as=\"span\" variant=\"text-body-medium\" color=\"inherit\">\n {this.profileLabel}\n </ds-text>\n </button>\n </div>\n </Host>\n );\n }\n}\n",
311
+ "type": "registry:ui"
312
+ }
313
+ ]
314
+ }
@@ -59,7 +59,8 @@
59
59
  "Range selection applies the first date immediately as a one-day range; while an end is pending, that selected start retains its bold treatment and hovering or focusing another day paints the rest of the provisional inclusive span faint without emitting a value. A second activation completes an ordered inclusive range and gives both edges the bold treatment. A new activation after completion starts a replacement range.",
60
60
  "Selection applies immediately and does not close the popup.",
61
61
  "Changing category replaces the option-pane subtree so checkbox and other option visuals mount in their new state instead of transitioning from the previous category's row state.",
62
- "The trigger reports how many filter categories have selections. footerLayout=summary adds a full-width selected-count footer only while values are selected; footerLayout=categories-clear always reserves the category-pane footer height while keeping its inactive divider hidden, then reveals the divider and only its left-aligned Clear action while values are selected."
62
+ "The trigger reports how many filter categories have selections. footerLayout=summary adds a full-width selected-count footer only while values are selected; footerLayout=categories-clear always reserves the category-pane footer height while keeping its inactive divider hidden, then reveals the divider and only its left-aligned Clear action while values are selected.",
63
+ "The built-in trigger derives the shared surface-open wash from the rendered popup lifecycle, including closing. For an external trigger, the application owns that relationship and retains the wash until dsAfterClose; selected filter values remain independent."
63
64
  ],
64
65
  "responsiveBehavior": [
65
66
  "The popup defaults to the large menu-width token and clamps to the nearest data-ds-overlay-boundary rectangle or the viewport fallback.",
@@ -82,6 +83,10 @@
82
83
  {
83
84
  "label": "Storybook example",
84
85
  "path": "src/wc/components/FilterMenu/FilterMenu.stories.ts"
86
+ },
87
+ {
88
+ "label": "Surface ownership and trigger state",
89
+ "path": "src/docs/SurfaceOwnership.mdx"
85
90
  }
86
91
  ]
87
92
  },
@@ -791,7 +796,7 @@
791
796
  },
792
797
  {
793
798
  "path": "src/wc/components/FilterMenu/FilterMenu.tsx",
794
- "content": "import {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Listen,\n Prop,\n State,\n type VNode,\n Watch,\n} from '@stencil/core';\nimport {\n CONTROL_TEXT_VARIANT,\n DATE_FILTER_RELATIVE_PRESETS,\n controlWidthClass,\n dateFilterRangeValue,\n dateFilterRelativeValue,\n parseDateFilterValue,\n resolveChoicePopupAlignOffset,\n resolveCssLengthPx,\n resolveMotionTimeMs,\n shiftIsoCalendarDate,\n TOKEN_CSS_LENGTHS,\n TOKEN_DEFAULTS,\n type ControlWidth,\n} from '../../utils';\nimport { observeTableCaptionCompact } from '../../utils/table-caption-compact';\nimport type { AnchoredAlign, AnchoredSide } from '../../utils/anchored-position';\nimport { AnchoredPositionController } from '../../utils/anchored-position-controller';\nimport { AnchoredOverlayInteractionController } from '../../utils/anchored-overlay-interaction-controller';\nimport { resolveAnchoredOverlayBoundaryRect } from '../../utils/anchored-overlay-boundary';\nimport { ChoiceOptionRow, ChoiceSearch } from '../../utils/choice-list-parts';\nimport { choiceListUsesSubtext } from '../../utils/choice-list';\nimport {\n FILTER_MENU_WEEKDAYS,\n filterMenuCalendarDays,\n filterMenuCalendarMonth,\n filterMenuCalendarMonthLabel,\n filterMenuToday,\n shiftFilterMenuCalendarMonth,\n} from './filter-menu-calendar';\n\nexport type FilterMenuFilterKind = 'single' | 'multiple' | 'boolean' | 'date';\nexport type FilterMenuSize = 'lg' | 'md' | 'sm' | 'xs';\nexport type FilterMenuWidth = ControlWidth;\nexport type FilterMenuFooterLayout = 'summary' | 'categories-clear';\nexport type FilterMenuMatchMode = 'any' | 'all';\ntype FilterMenuDateMode = 'range' | 'relative';\n\nexport interface FilterMenuOption {\n label: string;\n value: string;\n description?: string;\n isInactive?: boolean;\n}\n\nexport interface FilterMenuFilter {\n id: string;\n label: string;\n kind: FilterMenuFilterKind;\n options?: FilterMenuOption[];\n description?: string;\n fieldLabel?: string;\n /** Draw a standard menu-section divider after this category. */\n divider?: boolean;\n}\n\nexport type FilterMenuValue = string[] | boolean | string;\nexport type FilterMenuValues = Record<string, FilterMenuValue | undefined>;\nexport type FilterMenuMatchModes = Record<string, FilterMenuMatchMode | undefined>;\n\nexport interface FilterMenuChangeDetail {\n filterId: string;\n value: FilterMenuValue;\n}\n\nexport interface FilterMenuMatchModeChangeDetail {\n filterId: string;\n mode: FilterMenuMatchMode;\n}\n\nlet filterMenuId = 0;\n\nconst ICON_SIZE: Record<FilterMenuSize, 'lg' | 'md' | 'sm' | 'xs'> = {\n lg: 'lg',\n md: 'md',\n sm: 'sm',\n xs: 'xs',\n};\n\nconst DATE_MODE_TABS = [\n { id: 'relative', label: 'Relative' },\n { id: 'range', label: 'Range' },\n];\n\nconst RELATIVE_DATE_OPTIONS: FilterMenuOption[] = DATE_FILTER_RELATIVE_PRESETS.map(preset => ({\n label: preset.label,\n value: dateFilterRelativeValue(preset.value),\n}));\n\n@Component({\n tag: 'ds-filter-menu',\n styleUrl: 'FilterMenu.css',\n scoped: true,\n})\nexport class FilterMenu {\n @Element() el!: HTMLElement;\n\n /** Controlled popup visibility. */\n @Prop({ mutable: true }) open: boolean = false;\n /** Select trigger text. */\n @Prop() triggerLabel: string = 'Filters';\n /** Append the active-filter count to the visible trigger label. */\n @Prop() showSelectedCount: boolean = true;\n /** Optional select trigger prefix icon name. */\n @Prop() icon: string | undefined = 'Filters';\n /** Select trigger density. */\n @Prop() size: FilterMenuSize = 'md';\n /** Select trigger width fit. */\n @Prop() width: FilterMenuWidth = 'hug';\n /** Show the surface-aware inset border around the select trigger. */\n @Prop() hasBorder: boolean = true;\n /** Show selected interaction fill when one or more criteria are active. */\n @Prop() activeFill: boolean = false;\n /**\n * Opt into table-caption icon-only chrome below 900px. The trigger omits its\n * visible label and chevron; keep an accessible name via aria-label.\n */\n @Prop({ reflect: true }) collapseLabel: boolean = false;\n /** ID applied to the internal select trigger. */\n @Prop() inputId: string | undefined;\n /** Direct accessible name for the internal select trigger. */\n @Prop({ attribute: 'aria-label' }) ariaLabel: string | null = null;\n /** Product-owned filter categories and option definitions. */\n @Prop() filters: FilterMenuFilter[] = [];\n /** Controlled values keyed by filter id. */\n @Prop() values: FilterMenuValues = {};\n /** Controlled any/all match mode keyed by multiple-choice filter id. Defaults to any. */\n @Prop() matchModes: FilterMenuMatchModes = {};\n /** Controlled category shown in the option pane. */\n @Prop() activeFilterId: string | undefined;\n /** External trigger element to position against. */\n @Prop() anchor: HTMLElement | undefined;\n /** ID of the external trigger element used for positioning and focus return. */\n @Prop() anchorId: string | undefined;\n /** Explicit collision owner; otherwise the nearest data-ds-overlay-boundary ancestor is used. */\n @Prop() boundary: HTMLElement | undefined;\n /** Preferred popup side; collision handling may flip it. */\n @Prop() side: AnchoredSide = 'bottom';\n /** Cross-axis alignment against the trigger. */\n @Prop() align: AnchoredAlign = 'end';\n /** Gap between trigger and popup — number in px or a TokoMo length. */\n @Prop() sideOffset: number | string = TOKEN_CSS_LENGTHS.space050;\n /** Cross-axis offset — number in px or a TokoMo length. */\n @Prop() alignOffset: number | string = 0;\n /** Popup width. It remains clamped to its collision boundary by the component recipe. */\n @Prop() menuWidth: string = TOKEN_CSS_LENGTHS.menuWidthLg;\n /** Accessible name for the non-modal filter dialog. */\n @Prop() menuLabel: string = 'Filters';\n /** Accessible name for the category tab list. */\n @Prop() categoriesLabel: string = 'Filter categories';\n /** Footer action and date-clear accessible label. */\n @Prop() clearLabel: string = 'Clear';\n /** Placeholder shown in each non-date option search header. */\n @Prop() searchPlaceholder: string = 'Search';\n /** Empty-state text shown when an option search has no matches. */\n @Prop() noResultsText: string = 'No results';\n /** Footer recipe: full-width selected summary or reserved category-pane Clear action. */\n @Prop() footerLayout: FilterMenuFooterLayout = 'summary';\n /** Show a visible focus ring on initial entry after keyboard activation. */\n @Prop() initialFocusVisible: boolean = false;\n\n @State() private shouldRender = false;\n @State() private closing = false;\n @State() private positionReady = false;\n @State() private pos: { x: number; y: number } = { x: 0, y: 0 };\n @State() private focusRingVisible = false;\n @State() private activeOptionIndex = 0;\n @State() private captionCompact = false;\n @State() private dateModeByFilter: Record<string, FilterMenuDateMode> = {};\n @State() private calendarMonthByFilter: Record<string, string> = {};\n @State() private pendingRangeStartByFilter: Record<string, string> = {};\n @State() private previewRangeEndByFilter: Record<string, string> = {};\n @State() private optionQueryByFilter: Record<string, string> = {};\n\n /** Requests a controlled value replacement without closing the popup. */\n @Event() dsChange!: EventEmitter<FilterMenuChangeDetail>;\n /** Requests that the consumer clear every filter value. */\n @Event() dsClear!: EventEmitter<void>;\n /** Requests a controlled any/all mode replacement for a multiple-choice filter. */\n @Event() dsMatchModeChange!: EventEmitter<FilterMenuMatchModeChangeDetail>;\n /** Requests a controlled active-category replacement. */\n @Event() dsActiveFilterChange!: EventEmitter<string>;\n /** Requests that the controlled popup close. */\n @Event() dsClose!: EventEmitter<void>;\n /** Emitted whenever internal select-trigger activation changes popup visibility. */\n @Event() dsOpenChange!: EventEmitter<boolean>;\n /** Emitted after exit motion and rendered popup removal complete. */\n @Event() dsAfterClose!: EventEmitter<void>;\n\n private readonly generatedId = `ds-filter-menu-${++filterMenuId}`;\n private triggerElement: HTMLButtonElement | null = null;\n private pendingInitialFocusVisible = false;\n private closeTimer: ReturnType<typeof setTimeout> | null = null;\n private captionCompactDisconnect: (() => void) | undefined;\n private hasLoaded = false;\n private closingSnapshot: {\n filters: FilterMenuFilter[];\n values: FilterMenuValues;\n matchModes: FilterMenuMatchModes;\n activeFilterId: string | undefined;\n } | null = null;\n\n private readonly position = new AnchoredPositionController({\n getAnchor: () => this.resolvedAnchor,\n getPopup: () => this.el.querySelector<HTMLElement>('.filter-menu-popup'),\n getOwnerDocument: () => this.el.ownerDocument,\n measure: (anchor, popup) => {\n if (!this.open) return null;\n const anchorRect = anchor.getBoundingClientRect();\n const sectionInsetPx = resolveCssLengthPx(TOKEN_DEFAULTS.space050, TOKEN_DEFAULTS.space050);\n return {\n anchorRect,\n popupWidth: popup.offsetWidth || this.popupFallbackWidth,\n popupHeight: popup.offsetHeight || this.popupFallbackHeight,\n side: this.side,\n align: this.align,\n sideOffsetPx: resolveCssLengthPx(this.sideOffset, TOKEN_DEFAULTS.space050),\n alignOffsetPx: resolveChoicePopupAlignOffset({\n align: this.align,\n alignOffsetPx: resolveCssLengthPx(this.alignOffset, 0),\n sectionInsetPx,\n }),\n viewportPadPx: this.viewportPad,\n viewportWidth: window.innerWidth,\n viewportHeight: window.innerHeight,\n collisionRect: resolveAnchoredOverlayBoundaryRect(anchor, this.boundary),\n };\n },\n apply: ({ x, y }) => {\n this.pos = { x, y };\n },\n onReady: () => {\n this.positionReady = true;\n },\n liveUpdate: 'double-frame',\n observeResize: true,\n topLayer: true,\n });\n private readonly interaction = new AnchoredOverlayInteractionController({\n getAnchor: () => this.resolvedAnchor,\n getPopup: () => this.el.querySelector<HTMLElement>('.filter-menu-popup'),\n getOwnerDocument: () => this.el.ownerDocument,\n onOutsideActivation: () => this.close(),\n });\n\n componentDidLoad() {\n this.hasLoaded = true;\n this.syncCaptionCompactObserver();\n if (this.open) this.onOpenChange(true);\n }\n\n connectedCallback() {\n if (!this.hasLoaded) return;\n this.syncCaptionCompactObserver();\n if (this.open) this.onOpenChange(true);\n }\n\n disconnectedCallback() {\n this.disconnectCaptionCompactObserver();\n this.position.unobserve();\n this.teardownListeners();\n }\n\n @Watch('collapseLabel')\n onCollapseLabelChange() {\n this.syncCaptionCompactObserver();\n }\n\n @Watch('open')\n onOpenChange(isOpen: boolean) {\n if (isOpen) {\n this.teardownListeners();\n this.closingSnapshot = null;\n this.shouldRender = true;\n this.closing = false;\n this.positionReady = false;\n this.focusRingVisible = this.pendingInitialFocusVisible || this.initialFocusVisible;\n this.setupListeners();\n this.position.schedule(() => this.focusInitialCategory());\n return;\n }\n\n if (!this.shouldRender) return;\n this.position.cancel();\n this.captureClosingSnapshot();\n this.closing = true;\n this.teardownListeners();\n const duration = resolveMotionTimeMs(\n TOKEN_DEFAULTS.motionShort2,\n TOKEN_DEFAULTS.animationDurationShort3\n );\n if (duration <= 0) {\n this.finishClose();\n return;\n }\n this.closeTimer = setTimeout(() => this.finishClose(), duration);\n }\n\n @Watch('anchor')\n @Watch('anchorId')\n @Watch('boundary')\n @Watch('side')\n @Watch('align')\n @Watch('sideOffset')\n @Watch('alignOffset')\n @Watch('menuWidth')\n onPositionInputChange() {\n if (this.open) this.position.schedule();\n }\n\n @Listen('keydown')\n handleKeyDown(event: KeyboardEvent) {\n if (!this.shouldRender || this.closing) return;\n if (event.key === 'Escape') {\n event.preventDefault();\n this.close();\n return;\n }\n if (event.key !== 'Tab' || !this.tabLeavesPopup(event)) return;\n event.preventDefault();\n this.close(false);\n this.interaction.moveFocusAfterTab(event.shiftKey);\n }\n\n private get resolvedAnchor(): HTMLElement | null {\n if (this.anchor) return this.anchor;\n if (this.anchorId) return document.getElementById(this.anchorId);\n return this.triggerElement;\n }\n\n private get usesInternalTrigger(): boolean {\n return !this.anchor && !this.anchorId;\n }\n\n private get viewportPad(): number {\n return resolveCssLengthPx(TOKEN_DEFAULTS.space050, TOKEN_DEFAULTS.space050);\n }\n\n private get popupFallbackWidth(): number {\n return resolveCssLengthPx(TOKEN_DEFAULTS.menuWidthLg, TOKEN_DEFAULTS.menuWidthLg);\n }\n\n private get popupFallbackHeight(): number {\n return resolveCssLengthPx(TOKEN_DEFAULTS.menuFallbackHeight, TOKEN_DEFAULTS.menuFallbackHeight);\n }\n\n private setupListeners() {\n this.interaction.connect();\n this.position.observe();\n }\n\n private teardownListeners() {\n this.position.unobserve();\n this.interaction.disconnect();\n if (this.closeTimer) {\n clearTimeout(this.closeTimer);\n this.closeTimer = null;\n }\n }\n\n private close(restoreFocus = true) {\n this.captureClosingSnapshot();\n if (restoreFocus) this.interaction.focusAnchor();\n this.dsOpenChange.emit(false);\n this.dsClose.emit();\n this.open = false;\n this.onOpenChange(false);\n }\n\n private toggleFromTrigger(event: MouseEvent) {\n if (this.open) {\n this.close();\n return;\n }\n this.pendingInitialFocusVisible = event.detail === 0;\n this.open = true;\n this.dsOpenChange.emit(true);\n this.onOpenChange(true);\n }\n\n private handleTriggerKeyDown(event: KeyboardEvent) {\n if (event.key !== 'ArrowDown' || this.open) return;\n event.preventDefault();\n this.pendingInitialFocusVisible = true;\n this.open = true;\n this.dsOpenChange.emit(true);\n this.onOpenChange(true);\n }\n\n private finishClose() {\n const popup = this.el.querySelector<HTMLElement>('.filter-menu-popup');\n if (popup?.matches(':popover-open')) popup.hidePopover();\n this.shouldRender = false;\n this.closing = false;\n this.closingSnapshot = null;\n this.closeTimer = null;\n this.dateModeByFilter = {};\n this.calendarMonthByFilter = {};\n this.pendingRangeStartByFilter = {};\n this.previewRangeEndByFilter = {};\n this.optionQueryByFilter = {};\n this.dsAfterClose.emit();\n }\n\n private captureClosingSnapshot() {\n if (this.closingSnapshot) return;\n this.closingSnapshot = {\n filters: this.filters.map(filter => ({\n ...filter,\n options: filter.options?.map(option => ({ ...option })),\n })),\n values: Object.fromEntries(\n Object.entries(this.values).map(([key, value]) => [\n key,\n Array.isArray(value) ? [...value] : value,\n ])\n ),\n matchModes: { ...this.matchModes },\n activeFilterId: this.activeFilterId,\n };\n }\n\n private focusInitialCategory() {\n requestAnimationFrame(() => {\n this.el.querySelector<HTMLElement>('.filter-menu__category[tabindex=\"0\"]')?.focus();\n this.pendingInitialFocusVisible = false;\n });\n }\n\n private tabLeavesPopup(event: KeyboardEvent): boolean {\n return this.interaction.tabLeavesPopup(event);\n }\n\n private selectedFilter(filters: FilterMenuFilter[], activeFilterId: string | undefined) {\n return filters.find(filter => filter.id === activeFilterId) ?? filters[0];\n }\n\n private selectedCount(filter: FilterMenuFilter, values: FilterMenuValues): number {\n const value = values[filter.id];\n if (filter.kind === 'multiple') return Array.isArray(value) ? value.length : 0;\n if (filter.kind === 'boolean') return value === true ? 1 : 0;\n return typeof value === 'string' && value.length > 0 ? 1 : 0;\n }\n\n private totalSelected(filters: FilterMenuFilter[], values: FilterMenuValues): number {\n return filters.reduce((total, filter) => total + this.selectedCount(filter, values), 0);\n }\n\n private activeFilterCount(filters: FilterMenuFilter[], values: FilterMenuValues): number {\n return filters.filter(filter => this.selectedCount(filter, values) > 0).length;\n }\n\n private selectCategory(filterId: string, focus = false) {\n this.activeOptionIndex = 0;\n this.dsActiveFilterChange.emit(filterId);\n if (!focus) return;\n requestAnimationFrame(() => {\n this.el.querySelector<HTMLElement>(`[data-filter-category=\"${filterId}\"]`)?.focus();\n });\n }\n\n private handleCategoryKeyDown(\n event: KeyboardEvent,\n filters: FilterMenuFilter[],\n filterId: string\n ) {\n const currentIndex = filters.findIndex(filter => filter.id === filterId);\n let nextIndex: number;\n if (event.key === 'ArrowDown') nextIndex = (currentIndex + 1) % filters.length;\n else if (event.key === 'ArrowUp')\n nextIndex = (currentIndex - 1 + filters.length) % filters.length;\n else if (event.key === 'Home') nextIndex = 0;\n else if (event.key === 'End') nextIndex = filters.length - 1;\n else if (event.key === 'ArrowRight') {\n event.preventDefault();\n requestAnimationFrame(() => {\n this.el\n .querySelector<HTMLElement>(\n '.filter-menu__options [role=\"option\"], .filter-menu__options [data-date-option], .filter-menu__options input'\n )\n ?.focus();\n });\n return;\n } else return;\n\n event.preventDefault();\n this.focusRingVisible = true;\n this.selectCategory(filters[nextIndex].id, true);\n }\n\n private handlePanelKeyDown(event: KeyboardEvent, filterId: string) {\n if (event.key !== 'ArrowLeft') return;\n event.preventDefault();\n this.el.querySelector<HTMLElement>(`[data-filter-category=\"${filterId}\"]`)?.focus();\n }\n\n private handleOptionKeyDown(\n event: KeyboardEvent,\n filter: FilterMenuFilter,\n option: FilterMenuOption,\n index: number,\n values: FilterMenuValues,\n visibleOptions: FilterMenuOption[] = filter.options ?? []\n ) {\n if (event.key === 'ArrowLeft') {\n this.handlePanelKeyDown(event, filter.id);\n return;\n }\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n this.selectOption(filter, option, values);\n return;\n }\n if (!['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(event.key)) return;\n event.preventDefault();\n const enabled = visibleOptions\n .map((candidate, optionIndex) => ({ candidate, optionIndex }))\n .filter(({ candidate }) => !candidate.isInactive)\n .map(({ optionIndex }) => optionIndex);\n if (!enabled.length) return;\n const current = enabled.indexOf(index);\n let next: number;\n if (event.key === 'Home') next = enabled[0];\n else if (event.key === 'End') next = enabled[enabled.length - 1];\n else {\n const direction = event.key === 'ArrowDown' ? 1 : -1;\n const start = current >= 0 ? current : direction === 1 ? -1 : 0;\n next = enabled[(start + direction + enabled.length) % enabled.length];\n }\n this.activeOptionIndex = next;\n this.focusRingVisible = true;\n requestAnimationFrame(() => {\n this.el\n .querySelector<HTMLElement>(`#${this.generatedId}-${filter.id}-option-${next}`)\n ?.focus();\n });\n }\n\n private optionMatchesQuery(option: FilterMenuOption, query: string): boolean {\n const normalized = query.trim().toLocaleLowerCase();\n if (!normalized) return true;\n return `${option.label} ${option.description ?? ''}`.toLocaleLowerCase().includes(normalized);\n }\n\n private visibleOptions(\n filter: FilterMenuFilter,\n query = this.optionQueryByFilter[filter.id] ?? ''\n ) {\n if (filter.kind === 'boolean') {\n const option = this.booleanOption(filter);\n return this.optionMatchesQuery(option, query) ? [option] : [];\n }\n return (filter.options ?? []).filter(option => this.optionMatchesQuery(option, query));\n }\n\n private booleanOption(filter: FilterMenuFilter): FilterMenuOption {\n return {\n label: filter.fieldLabel ?? filter.label,\n value: 'true',\n description: filter.description,\n };\n }\n\n private setOptionQuery(filter: FilterMenuFilter, value: string) {\n const visibleOptions = this.visibleOptions(filter, value);\n const firstEnabled = visibleOptions.findIndex(option => !option.isInactive);\n this.activeOptionIndex = firstEnabled;\n this.focusRingVisible = false;\n this.optionQueryByFilter = { ...this.optionQueryByFilter, [filter.id]: value };\n requestAnimationFrame(() => {\n const content = this.el.querySelector<HTMLElement>('.filter-menu__options-content');\n if (content) content.scrollTop = 0;\n this.position.schedule();\n });\n }\n\n private handleOptionSearchKeyDown(event: KeyboardEvent, filter: FilterMenuFilter) {\n if (event.key !== 'ArrowDown' && event.key !== 'ArrowUp') return;\n const visibleOptions = this.visibleOptions(filter);\n const enabled = visibleOptions\n .map((option, index) => ({ option, index }))\n .filter(({ option }) => !option.isInactive)\n .map(({ index }) => index);\n if (!enabled.length) return;\n event.preventDefault();\n const next = event.key === 'ArrowDown' ? enabled[0] : enabled[enabled.length - 1];\n this.activeOptionIndex = next;\n this.focusRingVisible = true;\n requestAnimationFrame(() => {\n this.el\n .querySelector<HTMLElement>(`#${this.generatedId}-${filter.id}-option-${next}`)\n ?.focus();\n });\n }\n\n private toggleMultiple(\n filter: FilterMenuFilter,\n option: FilterMenuOption,\n checked: boolean,\n values: FilterMenuValues\n ) {\n if (option.isInactive) return;\n const current = Array.isArray(values[filter.id]) ? (values[filter.id] as string[]) : [];\n const selected = new Set(current);\n if (checked) selected.add(option.value);\n else selected.delete(option.value);\n const ordered = (filter.options ?? [])\n .map(candidate => candidate.value)\n .filter(value => selected.has(value));\n this.dsChange.emit({ filterId: filter.id, value: ordered });\n }\n\n private selectOption(\n filter: FilterMenuFilter,\n option: FilterMenuOption,\n values: FilterMenuValues\n ) {\n if (option.isInactive) return;\n if (filter.kind === 'single') {\n this.dsChange.emit({ filterId: filter.id, value: option.value });\n return;\n }\n const selected = Array.isArray(values[filter.id])\n ? (values[filter.id] as string[]).includes(option.value)\n : false;\n this.toggleMultiple(filter, option, !selected, values);\n }\n\n private dateMode(filterId: string, value: FilterMenuValue | undefined): FilterMenuDateMode {\n return this.dateModeByFilter[filterId] ?? parseDateFilterValue(value)?.kind ?? 'relative';\n }\n\n private setDateMode(filter: FilterMenuFilter, value: FilterMenuValue | undefined, mode: string) {\n if (mode !== 'range' && mode !== 'relative') return;\n this.dateModeByFilter = { ...this.dateModeByFilter, [filter.id]: mode };\n this.activeOptionIndex = 0;\n if (mode === 'range' && !this.calendarMonthByFilter[filter.id]) {\n const parsed = parseDateFilterValue(value);\n const initialDate = parsed?.kind === 'range' ? parsed.start : filterMenuToday();\n this.calendarMonthByFilter = {\n ...this.calendarMonthByFilter,\n [filter.id]: filterMenuCalendarMonth(initialDate),\n };\n }\n if (mode === 'relative' && this.pendingRangeStartByFilter[filter.id]) {\n const next = { ...this.pendingRangeStartByFilter };\n delete next[filter.id];\n this.pendingRangeStartByFilter = next;\n }\n if (mode === 'relative') this.clearCalendarRangePreview(filter.id);\n }\n\n private calendarMonth(filterId: string, value: FilterMenuValue | undefined): string {\n const parsed = parseDateFilterValue(value);\n const initialDate = parsed?.kind === 'range' ? parsed.start : filterMenuToday();\n return this.calendarMonthByFilter[filterId] ?? filterMenuCalendarMonth(initialDate);\n }\n\n private moveCalendarMonth(filterId: string, month: string, offset: number) {\n this.clearCalendarRangePreview(filterId);\n this.calendarMonthByFilter = {\n ...this.calendarMonthByFilter,\n [filterId]: shiftFilterMenuCalendarMonth(month, offset),\n };\n }\n\n private selectCalendarDate(filterId: string, value: string) {\n this.clearCalendarRangePreview(filterId);\n const pendingStart = this.pendingRangeStartByFilter[filterId];\n const next = { ...this.pendingRangeStartByFilter };\n if (pendingStart) delete next[filterId];\n else next[filterId] = value;\n this.pendingRangeStartByFilter = next;\n this.dsChange.emit({\n filterId,\n value: dateFilterRangeValue(pendingStart ?? value, value),\n });\n }\n\n private previewCalendarRange(filterId: string, value: string) {\n if (!this.pendingRangeStartByFilter[filterId]) return;\n if (this.previewRangeEndByFilter[filterId] === value) return;\n this.previewRangeEndByFilter = { ...this.previewRangeEndByFilter, [filterId]: value };\n }\n\n private clearCalendarRangePreview(filterId: string) {\n if (!this.previewRangeEndByFilter[filterId]) return;\n const next = { ...this.previewRangeEndByFilter };\n delete next[filterId];\n this.previewRangeEndByFilter = next;\n }\n\n private focusCalendarDate(filterId: string, value: string) {\n this.previewCalendarRange(filterId, value);\n const targetMonth = filterMenuCalendarMonth(value);\n if (this.calendarMonthByFilter[filterId] !== targetMonth) {\n this.calendarMonthByFilter = { ...this.calendarMonthByFilter, [filterId]: targetMonth };\n }\n requestAnimationFrame(() => {\n this.el.querySelector<HTMLElement>(`[data-date-option=\"${value}\"]`)?.focus();\n });\n }\n\n private handleCalendarDayKeyDown(event: KeyboardEvent, filterId: string, value: string) {\n let offset: number | null = null;\n if (event.key === 'ArrowLeft') offset = -1;\n else if (event.key === 'ArrowRight') offset = 1;\n else if (event.key === 'ArrowUp') offset = -7;\n else if (event.key === 'ArrowDown') offset = 7;\n else if (event.key === 'Home') {\n offset = -new Date(`${value}T00:00:00Z`).getUTCDay();\n } else if (event.key === 'End') {\n offset = 6 - new Date(`${value}T00:00:00Z`).getUTCDay();\n } else if (event.key === 'PageUp') {\n const month = shiftFilterMenuCalendarMonth(filterMenuCalendarMonth(value), -1);\n const day = value.slice(8, 10);\n const candidate = `${month}-${day}`;\n const target = parseDateFilterValue(candidate) ? candidate : `${month}-01`;\n event.preventDefault();\n this.focusCalendarDate(filterId, target);\n return;\n } else if (event.key === 'PageDown') {\n const month = shiftFilterMenuCalendarMonth(filterMenuCalendarMonth(value), 1);\n const day = value.slice(8, 10);\n const candidate = `${month}-${day}`;\n const target = parseDateFilterValue(candidate) ? candidate : `${month}-01`;\n event.preventDefault();\n this.focusCalendarDate(filterId, target);\n return;\n }\n if (offset === null) return;\n event.preventDefault();\n this.focusCalendarDate(filterId, shiftIsoCalendarDate(value, offset));\n }\n\n private renderRelativeDateOptions(filter: FilterMenuFilter, value: FilterMenuValue | undefined) {\n const relativeFilter: FilterMenuFilter = {\n ...filter,\n kind: 'single',\n options: RELATIVE_DATE_OPTIONS,\n };\n return (\n <div\n class=\"filter-menu__date-relative ds-choice-list ds-chrome-column ds-chrome-space--sm\"\n role=\"listbox\"\n aria-label=\"Relative date\"\n >\n {RELATIVE_DATE_OPTIONS.map((option, index) => (\n <ChoiceOptionRow\n size=\"md\"\n id={`${this.generatedId}-${filter.id}-relative-${index}`}\n option={option}\n selected={value === option.value}\n active={index === this.activeOptionIndex}\n focusRingVisible={this.focusRingVisible}\n usesSubtext={false}\n tabIndex={index === this.activeOptionIndex ? 0 : -1}\n onFocus={() => {\n this.activeOptionIndex = index;\n }}\n onKeyDown={(event: KeyboardEvent) =>\n this.handleOptionKeyDown(event, relativeFilter, option, index, {\n [filter.id]: value,\n })\n }\n onHover={() => {\n this.focusRingVisible = false;\n this.activeOptionIndex = index;\n }}\n onSelect={() => this.dsChange.emit({ filterId: filter.id, value: option.value })}\n />\n ))}\n </div>\n );\n }\n\n private renderDateCalendar(filter: FilterMenuFilter, value: FilterMenuValue | undefined) {\n const parsed = parseDateFilterValue(value);\n const range = parsed?.kind === 'range' ? parsed : null;\n const month = this.calendarMonth(filter.id, value);\n const days = filterMenuCalendarDays(month);\n const today = filterMenuToday();\n const pendingStart = this.pendingRangeStartByFilter[filter.id];\n const previewEnd = this.previewRangeEndByFilter[filter.id];\n const previewStart = pendingStart && previewEnd ? [pendingStart, previewEnd].sort()[0] : null;\n const previewFinish = pendingStart && previewEnd ? [pendingStart, previewEnd].sort()[1] : null;\n const preferredFocus =\n this.pendingRangeStartByFilter[filter.id] ??\n range?.end ??\n (month === today.slice(0, 7) ? today : '');\n const focusDate = days.some(day => day.value === preferredFocus)\n ? preferredFocus\n : (days.find(day => day.inMonth)?.value ?? days[0]?.value);\n\n return (\n <div class=\"filter-menu__calendar\">\n <div class=\"filter-menu__calendar-heading ds-control--md\">\n <ds-button-unfilled\n class=\"filter-menu__calendar-nav filter-menu__calendar-nav--previous\"\n variant=\"icon\"\n icon=\"ChevronLeft\"\n size=\"md\"\n hasBorder={false}\n ariaLabel=\"Previous month\"\n onDsClick={() => this.moveCalendarMonth(filter.id, month, -1)}\n />\n <ds-text as=\"span\" variant=\"text-body-medium\" emphasis color=\"primary\">\n {filterMenuCalendarMonthLabel(month)}\n </ds-text>\n <ds-button-unfilled\n class=\"filter-menu__calendar-nav filter-menu__calendar-nav--next\"\n variant=\"icon\"\n icon=\"ChevronRight\"\n size=\"md\"\n hasBorder={false}\n ariaLabel=\"Next month\"\n onDsClick={() => this.moveCalendarMonth(filter.id, month, 1)}\n />\n </div>\n <div class=\"filter-menu__calendar-weekdays\" aria-hidden=\"true\">\n {FILTER_MENU_WEEKDAYS.map(day => (\n <ds-text as=\"span\" variant=\"text-body-small\" color=\"secondary\">\n {day}\n </ds-text>\n ))}\n </div>\n <div\n class=\"filter-menu__calendar-grid\"\n role=\"grid\"\n aria-label={filterMenuCalendarMonthLabel(month)}\n onMouseLeave={() => this.clearCalendarRangePreview(filter.id)}\n >\n {days.map(day => {\n const selectedInRange = Boolean(\n range && day.value >= range.start && day.value <= range.end\n );\n const previewInRange = Boolean(\n previewStart &&\n previewFinish &&\n day.value >= previewStart &&\n day.value <= previewFinish\n );\n const inRange = previewInRange || selectedInRange;\n const rangeEdge = Boolean(\n previewStart\n ? day.value === pendingStart\n : range && (day.value === range.start || day.value === range.end)\n );\n const textColor = rangeEdge\n ? 'on-bold'\n : inRange || day.value === today\n ? 'primary'\n : day.inMonth\n ? 'secondary'\n : 'tertiary';\n return (\n <button\n type=\"button\"\n role=\"gridcell\"\n data-date-option={day.value}\n class={{\n 'filter-menu__calendar-day': true,\n 'filter-menu__calendar-day--outside': !day.inMonth,\n 'filter-menu__calendar-day--today': day.value === today,\n 'filter-menu__calendar-day--in-range': inRange,\n 'filter-menu__calendar-day--range-preview': previewInRange,\n 'filter-menu__calendar-day--range-edge': rangeEdge,\n 'ds-focus-ring-inset': true,\n 'ds-interaction-fill': true,\n }}\n aria-label={day.label}\n aria-selected={selectedInRange ? 'true' : 'false'}\n tabIndex={day.value === focusDate ? 0 : -1}\n onMouseEnter={() => this.previewCalendarRange(filter.id, day.value)}\n onFocus={() => this.previewCalendarRange(filter.id, day.value)}\n onClick={() => this.selectCalendarDate(filter.id, day.value)}\n onKeyDown={(event: KeyboardEvent) =>\n this.handleCalendarDayKeyDown(event, filter.id, day.value)\n }\n >\n <ds-text\n class=\"ds-interaction-fill__content\"\n as=\"span\"\n variant=\"text-body-medium\"\n color={textColor}\n emphasis={day.value === today}\n >\n {day.day}\n </ds-text>\n </button>\n );\n })}\n </div>\n </div>\n );\n }\n\n private renderDateFilter(filter: FilterMenuFilter, value: FilterMenuValue | undefined) {\n const mode = this.dateMode(filter.id, value);\n return (\n <div class=\"filter-menu__date\">\n <header class=\"filter-menu__date-header ds-chrome-header ds-chrome-header--bounded\">\n <ds-tab-group\n ariaLabel=\"Date filter mode\"\n size=\"md\"\n width=\"fill\"\n hasContainer={false}\n value={mode}\n tabs={DATE_MODE_TABS}\n onDsChange={(event: CustomEvent<string>) => {\n event.stopPropagation();\n this.setDateMode(filter, value, event.detail);\n }}\n />\n </header>\n <div class=\"filter-menu__date-body\">\n {mode === 'relative'\n ? this.renderRelativeDateOptions(filter, value)\n : this.renderDateCalendar(filter, value)}\n </div>\n </div>\n );\n }\n\n private renderOptionSearch(filter: FilterMenuFilter) {\n return (\n <div class=\"filter-menu__option-search\">\n <ChoiceSearch\n size=\"md\"\n hasFocusBoundary={false}\n hasInteractionFill={false}\n value={this.optionQueryByFilter[filter.id] ?? ''}\n placeholder={this.searchPlaceholder}\n ariaLabel={`Search ${filter.label} options`}\n controls={`${this.generatedId}-${filter.id}-options`}\n inputRef={() => undefined}\n clearLabel={`Clear ${filter.label} search`}\n onValueChange={value => this.setOptionQuery(filter, value)}\n onKeyDown={(event: KeyboardEvent) => this.handleOptionSearchKeyDown(event, filter)}\n />\n </div>\n );\n }\n\n private renderNoOptionResults() {\n return (\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 }\n\n private renderOptions(filter: FilterMenuFilter, values: FilterMenuValues) {\n const value = values[filter.id];\n if (filter.kind === 'multiple' || filter.kind === 'single') {\n const selected = Array.isArray(value) ? value : [];\n const allOptions = filter.options ?? [];\n const options = this.visibleOptions(filter);\n const usesSubtext = choiceListUsesSubtext(\n allOptions.map(option => ({\n label: option.label,\n value: option.value,\n subtext: option.description,\n }))\n );\n if (!options.length) return this.renderNoOptionResults();\n return options.map((option, index) => {\n const isSelected =\n filter.kind === 'multiple' ? selected.includes(option.value) : value === option.value;\n return (\n <ChoiceOptionRow\n size=\"md\"\n id={`${this.generatedId}-${filter.id}-option-${index}`}\n option={{\n label: option.label,\n value: option.value,\n subtext: option.description,\n isInactive: option.isInactive,\n }}\n selected={isSelected}\n active={index === this.activeOptionIndex}\n focusRingVisible={this.focusRingVisible}\n usesSubtext={usesSubtext}\n tabIndex={index === this.activeOptionIndex ? 0 : -1}\n leading={\n filter.kind === 'multiple' ? (\n <span\n class=\"ds-choice-item__icon ds-control-icon-box ds-interaction-fill__content\"\n aria-hidden=\"true\"\n >\n <ds-checkbox label=\"\" size=\"md\" checked={isSelected} presentation />\n </span>\n ) : undefined\n }\n onFocus={() => {\n this.activeOptionIndex = index;\n }}\n onKeyDown={(event: KeyboardEvent) =>\n this.handleOptionKeyDown(event, filter, option, index, values, options)\n }\n onHover={() => {\n this.focusRingVisible = false;\n this.activeOptionIndex = index;\n }}\n onSelect={() => this.selectOption(filter, option, values)}\n />\n );\n });\n }\n\n if (filter.kind === 'boolean') {\n const [option] = this.visibleOptions(filter);\n if (!option) return this.renderNoOptionResults();\n return (\n <ChoiceOptionRow\n size=\"md\"\n id={`${this.generatedId}-${filter.id}-option-0`}\n option={{\n label: option.label,\n value: option.value,\n subtext: option.description,\n }}\n selected={value === true}\n active\n focusRingVisible={this.focusRingVisible}\n usesSubtext={Boolean(option.description)}\n tabIndex={0}\n leading={\n <span\n class=\"ds-choice-item__icon ds-control-icon-box ds-interaction-fill__content\"\n aria-hidden=\"true\"\n >\n <ds-checkbox label=\"\" size=\"md\" checked={value === true} presentation />\n </span>\n }\n onKeyDown={(event: KeyboardEvent) => {\n if (event.key === 'ArrowLeft') this.handlePanelKeyDown(event, filter.id);\n else if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n this.dsChange.emit({ filterId: filter.id, value: value !== true });\n }\n }}\n onHover={() => {\n this.focusRingVisible = false;\n }}\n onSelect={() => this.dsChange.emit({ filterId: filter.id, value: value !== true })}\n />\n );\n }\n\n return this.renderDateFilter(filter, value);\n }\n\n private get captionIconOnly(): boolean {\n return (\n this.collapseLabel && this.captionCompact && this.usesInternalTrigger && Boolean(this.icon)\n );\n }\n\n private syncCaptionCompactObserver(): void {\n this.disconnectCaptionCompactObserver();\n if (!this.collapseLabel) {\n if (this.captionCompact) this.captionCompact = false;\n return;\n }\n this.captionCompactDisconnect = observeTableCaptionCompact(this.el, compact => {\n if (this.captionCompact !== compact) this.captionCompact = compact;\n });\n }\n\n private disconnectCaptionCompactObserver(): void {\n this.captionCompactDisconnect?.();\n this.captionCompactDisconnect = undefined;\n }\n\n private renderCaptionTooltip(trigger: VNode, label: string): VNode {\n if (!this.collapseLabel) return trigger;\n return (\n <ds-tooltip label={label} side=\"top\" size=\"sm\">\n {trigger}\n </ds-tooltip>\n );\n }\n\n private renderFooter(totalSelected: number, categoriesClear: boolean) {\n return (\n <div\n class={{\n 'filter-menu__footer': true,\n 'filter-menu__footer--categories-clear': categoriesClear,\n 'ds-choice-footer': true,\n }}\n aria-hidden={categoriesClear && totalSelected === 0 ? 'true' : undefined}\n >\n <div class=\"ds-choice-footer__content ds-control--md\">\n {!categoriesClear ? (\n <ds-text\n class=\"ds-choice-footer__summary\"\n as=\"span\"\n variant=\"text-body-medium\"\n color=\"secondary\"\n aria-live=\"polite\"\n >\n {totalSelected} selected\n </ds-text>\n ) : null}\n {totalSelected > 0 ? (\n <button\n class=\"filter-menu__clear ds-choice-footer__clear ds-text-action\"\n type=\"button\"\n onClick={() => {\n this.pendingRangeStartByFilter = {};\n this.dsClear.emit();\n }}\n >\n <ds-text as=\"span\" variant=\"text-body-medium\" color=\"inherit\">\n {this.clearLabel}\n </ds-text>\n </button>\n ) : null}\n </div>\n </div>\n );\n }\n\n private renderMatchModeFooter(filter: FilterMenuFilter, matchModes: FilterMenuMatchModes) {\n const mode: FilterMenuMatchMode = matchModes[filter.id] === 'all' ? 'all' : 'any';\n const nextMode: FilterMenuMatchMode = mode === 'any' ? 'all' : 'any';\n return (\n <div class=\"filter-menu__match-mode-footer ds-choice-footer\">\n <div class=\"filter-menu__match-mode-content ds-choice-footer__content ds-control--md\">\n <ds-text as=\"span\" variant=\"text-body-medium\" color=\"secondary\">\n Limit results to\n </ds-text>\n <button\n class=\"filter-menu__match-mode-toggle ds-text-action ds-focus-ring\"\n type=\"button\"\n aria-label={`Limit ${filter.label} results to ${nextMode} selected`}\n onClick={() => this.dsMatchModeChange.emit({ filterId: filter.id, mode: nextMode })}\n onKeyDown={(event: KeyboardEvent) => this.handlePanelKeyDown(event, filter.id)}\n >\n <ds-text as=\"span\" variant=\"text-body-medium\" color=\"inherit\">\n {mode}\n </ds-text>\n </button>\n <ds-text as=\"span\" variant=\"text-body-medium\" color=\"secondary\">\n selected\n </ds-text>\n </div>\n </div>\n );\n }\n\n render() {\n const state =\n this.closing && this.closingSnapshot\n ? this.closingSnapshot\n : {\n filters: this.filters,\n values: this.values,\n matchModes: this.matchModes,\n activeFilterId: this.activeFilterId,\n };\n const activeFilter = this.selectedFilter(state.filters, state.activeFilterId);\n const totalSelected = this.totalSelected(state.filters, state.values);\n const activeFilterCount = this.activeFilterCount(state.filters, state.values);\n const hasActiveFilters = activeFilterCount > 0;\n const categoriesClearFooter = this.footerLayout === 'categories-clear';\n const label = `${this.triggerLabel}${\n this.showSelectedCount && hasActiveFilters ? ` · ${activeFilterCount}` : ''\n }`;\n const textVariant = CONTROL_TEXT_VARIANT[this.size];\n const iconSize = ICON_SIZE[this.size];\n const popupId = `${this.generatedId}-popup`;\n const popupStyle: Record<string, string> = {\n position: 'fixed',\n left: '0',\n top: '0',\n width: this.menuWidth,\n transform: `translate(${Math.round(this.pos.x)}px, ${Math.round(this.pos.y)}px)`,\n zIndex: '9998',\n visibility: this.positionReady ? 'visible' : 'hidden',\n };\n\n return (\n <Host\n class={{\n 'filter-menu-host': true,\n 'filter-menu-host--external-trigger': !this.usesInternalTrigger,\n 'ds-select-trigger-host': this.usesInternalTrigger,\n [`ds-control--${this.size}`]: true,\n 'ds-table-caption-control': this.collapseLabel,\n 'ds-table-caption-control--compact': this.captionIconOnly,\n ...controlWidthClass(this.width),\n }}\n >\n {this.usesInternalTrigger\n ? this.renderCaptionTooltip(\n <button\n ref={element => {\n this.triggerElement = (element as HTMLButtonElement) ?? null;\n }}\n id={this.inputId ?? `${this.generatedId}-trigger`}\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': this.activeFill && hasActiveFilters,\n 'trigger--expanded': this.open || this.closing,\n 'trigger--bordered': this.hasBorder,\n 'trigger--has-value': hasActiveFilters,\n [`ds-control--${this.size}`]: true,\n }}\n role=\"combobox\"\n aria-haspopup=\"dialog\"\n aria-expanded={String(this.open)}\n aria-controls={this.open ? popupId : undefined}\n aria-label={this.ariaLabel ?? this.menuLabel}\n onClick={(event: MouseEvent) => this.toggleFromTrigger(event)}\n onKeyDown={(event: KeyboardEvent) => this.handleTriggerKeyDown(event)}\n >\n {this.icon ? (\n <span\n class=\"trigger__prefix ds-control-icon-box ds-interaction-fill__content\"\n aria-hidden=\"true\"\n >\n <ds-icon name={this.icon} size={iconSize} color=\"inherit\" />\n </span>\n ) : null}\n {this.captionIconOnly ? null : (\n <ds-text\n class=\"trigger__label-box trigger__label trigger__label-content 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 )}\n {this.captionIconOnly ? null : (\n <span\n class=\"trigger__chevron ds-control-icon-box ds-interaction-fill__content\"\n aria-hidden=\"true\"\n >\n <ds-icon name=\"ChevronDown\" size={iconSize} color=\"inherit\" />\n </span>\n )}\n </button>,\n this.captionIconOnly ? label : ''\n )\n : null}\n\n {this.shouldRender ? (\n <div\n id={popupId}\n popover=\"manual\"\n class={{\n 'filter-menu-popup': true,\n 'ds-choice-popup': true,\n 'ds-choice-popup--closing': this.closing,\n }}\n style={popupStyle}\n role=\"dialog\"\n aria-label={this.menuLabel}\n >\n {activeFilter ? (\n <div class=\"filter-menu\">\n <div class=\"filter-menu__body\">\n <div class=\"filter-menu__category-pane\">\n <div\n class=\"filter-menu__categories ds-choice-list ds-chrome-column ds-chrome-space--sm\"\n role=\"tablist\"\n aria-label={this.categoriesLabel}\n aria-orientation=\"vertical\"\n >\n {state.filters.map(filter => {\n const active = filter.id === activeFilter.id;\n const count = this.selectedCount(filter, state.values);\n return (\n <div\n key={filter.id}\n class={{\n 'filter-menu__category-section': true,\n 'ds-choice-section--divided': Boolean(filter.divider),\n }}\n >\n <button\n id={`${this.generatedId}-${filter.id}-tab`}\n type=\"button\"\n role=\"tab\"\n data-filter-category={filter.id}\n class={{\n 'filter-menu__category': true,\n 'filter-menu__category--active': active,\n 'ds-choice-item': true,\n 'ds-control-frame': true,\n 'ds-control--md': true,\n 'ds-focus-ring-inset': true,\n 'ds-focus-ring--visible': active && this.focusRingVisible,\n 'ds-interaction-fill': true,\n 'ds-interaction-fill--selected': active,\n }}\n aria-selected={String(active)}\n aria-controls={`${this.generatedId}-panel`}\n tabIndex={active ? 0 : -1}\n onMouseDown={() => {\n this.focusRingVisible = false;\n }}\n onClick={() => this.selectCategory(filter.id)}\n onKeyDown={(event: KeyboardEvent) =>\n this.handleCategoryKeyDown(event, state.filters, filter.id)\n }\n >\n <ds-text\n class=\"ds-choice-item__content ds-choice-item__label ds-control-label-box ds-interaction-fill__content\"\n as=\"span\"\n variant=\"text-body-medium\"\n color={active ? 'primary' : 'secondary'}\n >\n {filter.label}\n </ds-text>\n {count > 0 && filter.kind === 'date' ? (\n <span\n class=\"filter-menu__category-dot-box ds-interaction-fill__content\"\n aria-hidden=\"true\"\n >\n <ds-badge variant=\"dot\" hasRing={false} label=\"\" />\n </span>\n ) : count > 0 ? (\n <ds-tag\n class=\"ds-choice-item__tag ds-interaction-fill__content\"\n label={String(count)}\n size=\"sm\"\n intent=\"brand\"\n contrast=\"bold\"\n isInset\n rounded\n />\n ) : null}\n </button>\n </div>\n );\n })}\n </div>\n {categoriesClearFooter ? this.renderFooter(totalSelected, true) : null}\n </div>\n\n <div\n id={`${this.generatedId}-panel`}\n class={{\n 'filter-menu__options': true,\n 'filter-menu__options--date': activeFilter.kind === 'date',\n }}\n role=\"tabpanel\"\n aria-labelledby={`${this.generatedId}-${activeFilter.id}-tab`}\n >\n {activeFilter.kind === 'date' ? null : this.renderOptionSearch(activeFilter)}\n <div class=\"filter-menu__options-content\">\n {activeFilter.kind === 'date' ? (\n <div key={activeFilter.id} class=\"filter-menu__option-list--date\">\n {this.renderOptions(activeFilter, state.values)}\n </div>\n ) : (\n <div\n id={`${this.generatedId}-${activeFilter.id}-options`}\n key={activeFilter.id}\n class=\"filter-menu__option-list ds-choice-list ds-chrome-column ds-chrome-space--sm\"\n role=\"listbox\"\n aria-label={activeFilter.label}\n aria-multiselectable={\n activeFilter.kind === 'multiple' ? 'true' : undefined\n }\n >\n {this.renderOptions(activeFilter, state.values)}\n </div>\n )}\n </div>\n {activeFilter.kind === 'multiple'\n ? this.renderMatchModeFooter(activeFilter, state.matchModes)\n : null}\n </div>\n </div>\n\n {!categoriesClearFooter && totalSelected > 0\n ? this.renderFooter(totalSelected, false)\n : null}\n </div>\n ) : null}\n </div>\n ) : null}\n </Host>\n );\n }\n}\n",
799
+ "content": "import {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Listen,\n Prop,\n State,\n type VNode,\n Watch,\n} from '@stencil/core';\nimport {\n CONTROL_TEXT_VARIANT,\n DATE_FILTER_RELATIVE_PRESETS,\n controlWidthClass,\n dateFilterRangeValue,\n dateFilterRelativeValue,\n parseDateFilterValue,\n resolveChoicePopupAlignOffset,\n resolveCssLengthPx,\n resolveMotionTimeMs,\n shiftIsoCalendarDate,\n TOKEN_CSS_LENGTHS,\n TOKEN_DEFAULTS,\n type ControlWidth,\n} from '../../utils';\nimport { observeTableCaptionCompact } from '../../utils/table-caption-compact';\nimport type { AnchoredAlign, AnchoredSide } from '../../utils/anchored-position';\nimport { AnchoredPositionController } from '../../utils/anchored-position-controller';\nimport { AnchoredOverlayInteractionController } from '../../utils/anchored-overlay-interaction-controller';\nimport { resolveAnchoredOverlayBoundaryRect } from '../../utils/anchored-overlay-boundary';\nimport { ChoiceOptionRow, ChoiceSearch } from '../../utils/choice-list-parts';\nimport { choiceListUsesSubtext } from '../../utils/choice-list';\nimport {\n FILTER_MENU_WEEKDAYS,\n filterMenuCalendarDays,\n filterMenuCalendarMonth,\n filterMenuCalendarMonthLabel,\n filterMenuToday,\n shiftFilterMenuCalendarMonth,\n} from './filter-menu-calendar';\n\nexport type FilterMenuFilterKind = 'single' | 'multiple' | 'boolean' | 'date';\nexport type FilterMenuSize = 'lg' | 'md' | 'sm' | 'xs';\nexport type FilterMenuWidth = ControlWidth;\nexport type FilterMenuFooterLayout = 'summary' | 'categories-clear';\nexport type FilterMenuMatchMode = 'any' | 'all';\ntype FilterMenuDateMode = 'range' | 'relative';\n\nexport interface FilterMenuOption {\n label: string;\n value: string;\n description?: string;\n isInactive?: boolean;\n}\n\nexport interface FilterMenuFilter {\n id: string;\n label: string;\n kind: FilterMenuFilterKind;\n options?: FilterMenuOption[];\n description?: string;\n fieldLabel?: string;\n /** Draw a standard menu-section divider after this category. */\n divider?: boolean;\n}\n\nexport type FilterMenuValue = string[] | boolean | string;\nexport type FilterMenuValues = Record<string, FilterMenuValue | undefined>;\nexport type FilterMenuMatchModes = Record<string, FilterMenuMatchMode | undefined>;\n\nexport interface FilterMenuChangeDetail {\n filterId: string;\n value: FilterMenuValue;\n}\n\nexport interface FilterMenuMatchModeChangeDetail {\n filterId: string;\n mode: FilterMenuMatchMode;\n}\n\nlet filterMenuId = 0;\n\nconst ICON_SIZE: Record<FilterMenuSize, 'lg' | 'md' | 'sm' | 'xs'> = {\n lg: 'lg',\n md: 'md',\n sm: 'sm',\n xs: 'xs',\n};\n\nconst DATE_MODE_TABS = [\n { id: 'relative', label: 'Relative' },\n { id: 'range', label: 'Range' },\n];\n\nconst RELATIVE_DATE_OPTIONS: FilterMenuOption[] = DATE_FILTER_RELATIVE_PRESETS.map(preset => ({\n label: preset.label,\n value: dateFilterRelativeValue(preset.value),\n}));\n\n@Component({\n tag: 'ds-filter-menu',\n styleUrl: 'FilterMenu.css',\n scoped: true,\n})\nexport class FilterMenu {\n @Element() el!: HTMLElement;\n\n /** Controlled popup visibility. */\n @Prop({ mutable: true }) open: boolean = false;\n /** Select trigger text. */\n @Prop() triggerLabel: string = 'Filters';\n /** Append the active-filter count to the visible trigger label. */\n @Prop() showSelectedCount: boolean = true;\n /** Optional select trigger prefix icon name. */\n @Prop() icon: string | undefined = 'Filters';\n /** Select trigger density. */\n @Prop() size: FilterMenuSize = 'md';\n /** Select trigger width fit. */\n @Prop() width: FilterMenuWidth = 'hug';\n /** Show the surface-aware inset border around the select trigger. */\n @Prop() hasBorder: boolean = true;\n /** Show selected interaction fill when one or more criteria are active. */\n @Prop() activeFill: boolean = false;\n /**\n * Opt into table-caption icon-only chrome below 900px. The trigger omits its\n * visible label and chevron; keep an accessible name via aria-label.\n */\n @Prop({ reflect: true }) collapseLabel: boolean = false;\n /** ID applied to the internal select trigger. */\n @Prop() inputId: string | undefined;\n /** Direct accessible name for the internal select trigger. */\n @Prop({ attribute: 'aria-label' }) ariaLabel: string | null = null;\n /** Product-owned filter categories and option definitions. */\n @Prop() filters: FilterMenuFilter[] = [];\n /** Controlled values keyed by filter id. */\n @Prop() values: FilterMenuValues = {};\n /** Controlled any/all match mode keyed by multiple-choice filter id. Defaults to any. */\n @Prop() matchModes: FilterMenuMatchModes = {};\n /** Controlled category shown in the option pane. */\n @Prop() activeFilterId: string | undefined;\n /** External trigger element to position against. */\n @Prop() anchor: HTMLElement | undefined;\n /** ID of the external trigger element used for positioning and focus return. */\n @Prop() anchorId: string | undefined;\n /** Explicit collision owner; otherwise the nearest data-ds-overlay-boundary ancestor is used. */\n @Prop() boundary: HTMLElement | undefined;\n /** Preferred popup side; collision handling may flip it. */\n @Prop() side: AnchoredSide = 'bottom';\n /** Cross-axis alignment against the trigger. */\n @Prop() align: AnchoredAlign = 'end';\n /** Gap between trigger and popup — number in px or a TokoMo length. */\n @Prop() sideOffset: number | string = TOKEN_CSS_LENGTHS.space050;\n /** Cross-axis offset — number in px or a TokoMo length. */\n @Prop() alignOffset: number | string = 0;\n /** Popup width. It remains clamped to its collision boundary by the component recipe. */\n @Prop() menuWidth: string = TOKEN_CSS_LENGTHS.menuWidthLg;\n /** Accessible name for the non-modal filter dialog. */\n @Prop() menuLabel: string = 'Filters';\n /** Accessible name for the category tab list. */\n @Prop() categoriesLabel: string = 'Filter categories';\n /** Footer action and date-clear accessible label. */\n @Prop() clearLabel: string = 'Clear';\n /** Placeholder shown in each non-date option search header. */\n @Prop() searchPlaceholder: string = 'Search';\n /** Empty-state text shown when an option search has no matches. */\n @Prop() noResultsText: string = 'No results';\n /** Footer recipe: full-width selected summary or reserved category-pane Clear action. */\n @Prop() footerLayout: FilterMenuFooterLayout = 'summary';\n /** Show a visible focus ring on initial entry after keyboard activation. */\n @Prop() initialFocusVisible: boolean = false;\n\n @State() private shouldRender = false;\n @State() private closing = false;\n @State() private positionReady = false;\n @State() private pos: { x: number; y: number } = { x: 0, y: 0 };\n @State() private focusRingVisible = false;\n @State() private activeOptionIndex = 0;\n @State() private captionCompact = false;\n @State() private dateModeByFilter: Record<string, FilterMenuDateMode> = {};\n @State() private calendarMonthByFilter: Record<string, string> = {};\n @State() private pendingRangeStartByFilter: Record<string, string> = {};\n @State() private previewRangeEndByFilter: Record<string, string> = {};\n @State() private optionQueryByFilter: Record<string, string> = {};\n\n /** Requests a controlled value replacement without closing the popup. */\n @Event() dsChange!: EventEmitter<FilterMenuChangeDetail>;\n /** Requests that the consumer clear every filter value. */\n @Event() dsClear!: EventEmitter<void>;\n /** Requests a controlled any/all mode replacement for a multiple-choice filter. */\n @Event() dsMatchModeChange!: EventEmitter<FilterMenuMatchModeChangeDetail>;\n /** Requests a controlled active-category replacement. */\n @Event() dsActiveFilterChange!: EventEmitter<string>;\n /** Requests that the controlled popup close. */\n @Event() dsClose!: EventEmitter<void>;\n /** Emitted whenever internal select-trigger activation changes popup visibility. */\n @Event() dsOpenChange!: EventEmitter<boolean>;\n /** Emitted after exit motion and rendered popup removal complete. */\n @Event() dsAfterClose!: EventEmitter<void>;\n\n private readonly generatedId = `ds-filter-menu-${++filterMenuId}`;\n private triggerElement: HTMLButtonElement | null = null;\n private pendingInitialFocusVisible = false;\n private closeTimer: ReturnType<typeof setTimeout> | null = null;\n private captionCompactDisconnect: (() => void) | undefined;\n private hasLoaded = false;\n private closingSnapshot: {\n filters: FilterMenuFilter[];\n values: FilterMenuValues;\n matchModes: FilterMenuMatchModes;\n activeFilterId: string | undefined;\n } | null = null;\n\n private readonly position = new AnchoredPositionController({\n getAnchor: () => this.resolvedAnchor,\n getPopup: () => this.el.querySelector<HTMLElement>('.filter-menu-popup'),\n getOwnerDocument: () => this.el.ownerDocument,\n measure: (anchor, popup) => {\n if (!this.open) return null;\n const anchorRect = anchor.getBoundingClientRect();\n const sectionInsetPx = resolveCssLengthPx(TOKEN_DEFAULTS.space050, TOKEN_DEFAULTS.space050);\n return {\n anchorRect,\n popupWidth: popup.offsetWidth || this.popupFallbackWidth,\n popupHeight: popup.offsetHeight || this.popupFallbackHeight,\n side: this.side,\n align: this.align,\n sideOffsetPx: resolveCssLengthPx(this.sideOffset, TOKEN_DEFAULTS.space050),\n alignOffsetPx: resolveChoicePopupAlignOffset({\n align: this.align,\n alignOffsetPx: resolveCssLengthPx(this.alignOffset, 0),\n sectionInsetPx,\n }),\n viewportPadPx: this.viewportPad,\n viewportWidth: window.innerWidth,\n viewportHeight: window.innerHeight,\n collisionRect: resolveAnchoredOverlayBoundaryRect(anchor, this.boundary),\n };\n },\n apply: ({ x, y }) => {\n this.pos = { x, y };\n },\n onReady: () => {\n this.positionReady = true;\n },\n liveUpdate: 'double-frame',\n observeResize: true,\n topLayer: true,\n });\n private readonly interaction = new AnchoredOverlayInteractionController({\n getAnchor: () => this.resolvedAnchor,\n getPopup: () => this.el.querySelector<HTMLElement>('.filter-menu-popup'),\n getOwnerDocument: () => this.el.ownerDocument,\n onOutsideActivation: () => this.close(),\n });\n\n componentDidLoad() {\n this.hasLoaded = true;\n this.syncCaptionCompactObserver();\n if (this.open) this.onOpenChange(true);\n }\n\n connectedCallback() {\n if (!this.hasLoaded) return;\n this.syncCaptionCompactObserver();\n if (this.open) this.onOpenChange(true);\n }\n\n disconnectedCallback() {\n this.disconnectCaptionCompactObserver();\n this.position.unobserve();\n this.teardownListeners();\n }\n\n @Watch('collapseLabel')\n onCollapseLabelChange() {\n this.syncCaptionCompactObserver();\n }\n\n @Watch('open')\n onOpenChange(isOpen: boolean) {\n if (isOpen) {\n this.teardownListeners();\n this.closingSnapshot = null;\n this.shouldRender = true;\n this.closing = false;\n this.positionReady = false;\n this.focusRingVisible = this.pendingInitialFocusVisible || this.initialFocusVisible;\n this.setupListeners();\n this.position.schedule(() => this.focusInitialCategory());\n return;\n }\n\n if (!this.shouldRender) return;\n this.position.cancel();\n this.captureClosingSnapshot();\n this.closing = true;\n this.teardownListeners();\n const duration = resolveMotionTimeMs(\n TOKEN_DEFAULTS.motionShort2,\n TOKEN_DEFAULTS.animationDurationShort3\n );\n if (duration <= 0) {\n this.finishClose();\n return;\n }\n this.closeTimer = setTimeout(() => this.finishClose(), duration);\n }\n\n @Watch('anchor')\n @Watch('anchorId')\n @Watch('boundary')\n @Watch('side')\n @Watch('align')\n @Watch('sideOffset')\n @Watch('alignOffset')\n @Watch('menuWidth')\n onPositionInputChange() {\n if (this.open) this.position.schedule();\n }\n\n @Listen('keydown')\n handleKeyDown(event: KeyboardEvent) {\n if (!this.shouldRender || this.closing) return;\n if (event.key === 'Escape') {\n event.preventDefault();\n this.close();\n return;\n }\n if (event.key !== 'Tab' || !this.tabLeavesPopup(event)) return;\n event.preventDefault();\n this.close(false);\n this.interaction.moveFocusAfterTab(event.shiftKey);\n }\n\n private get resolvedAnchor(): HTMLElement | null {\n if (this.anchor) return this.anchor;\n if (this.anchorId) return document.getElementById(this.anchorId);\n return this.triggerElement;\n }\n\n private get usesInternalTrigger(): boolean {\n return !this.anchor && !this.anchorId;\n }\n\n private get viewportPad(): number {\n return resolveCssLengthPx(TOKEN_DEFAULTS.space050, TOKEN_DEFAULTS.space050);\n }\n\n private get popupFallbackWidth(): number {\n return resolveCssLengthPx(TOKEN_DEFAULTS.menuWidthLg, TOKEN_DEFAULTS.menuWidthLg);\n }\n\n private get popupFallbackHeight(): number {\n return resolveCssLengthPx(TOKEN_DEFAULTS.menuFallbackHeight, TOKEN_DEFAULTS.menuFallbackHeight);\n }\n\n private setupListeners() {\n this.interaction.connect();\n this.position.observe();\n }\n\n private teardownListeners() {\n this.position.unobserve();\n this.interaction.disconnect();\n if (this.closeTimer) {\n clearTimeout(this.closeTimer);\n this.closeTimer = null;\n }\n }\n\n private close(restoreFocus = true) {\n this.captureClosingSnapshot();\n if (restoreFocus) this.interaction.focusAnchor();\n this.dsOpenChange.emit(false);\n this.dsClose.emit();\n this.open = false;\n this.onOpenChange(false);\n }\n\n private toggleFromTrigger(event: MouseEvent) {\n if (this.open) {\n this.close();\n return;\n }\n this.pendingInitialFocusVisible = event.detail === 0;\n this.open = true;\n this.dsOpenChange.emit(true);\n this.onOpenChange(true);\n }\n\n private handleTriggerKeyDown(event: KeyboardEvent) {\n if (event.key !== 'ArrowDown' || this.open) return;\n event.preventDefault();\n this.pendingInitialFocusVisible = true;\n this.open = true;\n this.dsOpenChange.emit(true);\n this.onOpenChange(true);\n }\n\n private finishClose() {\n const popup = this.el.querySelector<HTMLElement>('.filter-menu-popup');\n if (popup?.matches(':popover-open')) popup.hidePopover();\n this.shouldRender = false;\n this.closing = false;\n this.closingSnapshot = null;\n this.closeTimer = null;\n this.dateModeByFilter = {};\n this.calendarMonthByFilter = {};\n this.pendingRangeStartByFilter = {};\n this.previewRangeEndByFilter = {};\n this.optionQueryByFilter = {};\n this.dsAfterClose.emit();\n }\n\n private captureClosingSnapshot() {\n if (this.closingSnapshot) return;\n this.closingSnapshot = {\n filters: this.filters.map(filter => ({\n ...filter,\n options: filter.options?.map(option => ({ ...option })),\n })),\n values: Object.fromEntries(\n Object.entries(this.values).map(([key, value]) => [\n key,\n Array.isArray(value) ? [...value] : value,\n ])\n ),\n matchModes: { ...this.matchModes },\n activeFilterId: this.activeFilterId,\n };\n }\n\n private focusInitialCategory() {\n requestAnimationFrame(() => {\n this.el.querySelector<HTMLElement>('.filter-menu__category[tabindex=\"0\"]')?.focus();\n this.pendingInitialFocusVisible = false;\n });\n }\n\n private tabLeavesPopup(event: KeyboardEvent): boolean {\n return this.interaction.tabLeavesPopup(event);\n }\n\n private selectedFilter(filters: FilterMenuFilter[], activeFilterId: string | undefined) {\n return filters.find(filter => filter.id === activeFilterId) ?? filters[0];\n }\n\n private selectedCount(filter: FilterMenuFilter, values: FilterMenuValues): number {\n const value = values[filter.id];\n if (filter.kind === 'multiple') return Array.isArray(value) ? value.length : 0;\n if (filter.kind === 'boolean') return value === true ? 1 : 0;\n return typeof value === 'string' && value.length > 0 ? 1 : 0;\n }\n\n private totalSelected(filters: FilterMenuFilter[], values: FilterMenuValues): number {\n return filters.reduce((total, filter) => total + this.selectedCount(filter, values), 0);\n }\n\n private activeFilterCount(filters: FilterMenuFilter[], values: FilterMenuValues): number {\n return filters.filter(filter => this.selectedCount(filter, values) > 0).length;\n }\n\n private selectCategory(filterId: string, focus = false) {\n this.activeOptionIndex = 0;\n this.dsActiveFilterChange.emit(filterId);\n if (!focus) return;\n requestAnimationFrame(() => {\n this.el.querySelector<HTMLElement>(`[data-filter-category=\"${filterId}\"]`)?.focus();\n });\n }\n\n private handleCategoryKeyDown(\n event: KeyboardEvent,\n filters: FilterMenuFilter[],\n filterId: string\n ) {\n const currentIndex = filters.findIndex(filter => filter.id === filterId);\n let nextIndex: number;\n if (event.key === 'ArrowDown') nextIndex = (currentIndex + 1) % filters.length;\n else if (event.key === 'ArrowUp')\n nextIndex = (currentIndex - 1 + filters.length) % filters.length;\n else if (event.key === 'Home') nextIndex = 0;\n else if (event.key === 'End') nextIndex = filters.length - 1;\n else if (event.key === 'ArrowRight') {\n event.preventDefault();\n requestAnimationFrame(() => {\n this.el\n .querySelector<HTMLElement>(\n '.filter-menu__options [role=\"option\"], .filter-menu__options [data-date-option], .filter-menu__options input'\n )\n ?.focus();\n });\n return;\n } else return;\n\n event.preventDefault();\n this.focusRingVisible = true;\n this.selectCategory(filters[nextIndex].id, true);\n }\n\n private handlePanelKeyDown(event: KeyboardEvent, filterId: string) {\n if (event.key !== 'ArrowLeft') return;\n event.preventDefault();\n this.el.querySelector<HTMLElement>(`[data-filter-category=\"${filterId}\"]`)?.focus();\n }\n\n private handleOptionKeyDown(\n event: KeyboardEvent,\n filter: FilterMenuFilter,\n option: FilterMenuOption,\n index: number,\n values: FilterMenuValues,\n visibleOptions: FilterMenuOption[] = filter.options ?? []\n ) {\n if (event.key === 'ArrowLeft') {\n this.handlePanelKeyDown(event, filter.id);\n return;\n }\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n this.selectOption(filter, option, values);\n return;\n }\n if (!['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(event.key)) return;\n event.preventDefault();\n const enabled = visibleOptions\n .map((candidate, optionIndex) => ({ candidate, optionIndex }))\n .filter(({ candidate }) => !candidate.isInactive)\n .map(({ optionIndex }) => optionIndex);\n if (!enabled.length) return;\n const current = enabled.indexOf(index);\n let next: number;\n if (event.key === 'Home') next = enabled[0];\n else if (event.key === 'End') next = enabled[enabled.length - 1];\n else {\n const direction = event.key === 'ArrowDown' ? 1 : -1;\n const start = current >= 0 ? current : direction === 1 ? -1 : 0;\n next = enabled[(start + direction + enabled.length) % enabled.length];\n }\n this.activeOptionIndex = next;\n this.focusRingVisible = true;\n requestAnimationFrame(() => {\n this.el\n .querySelector<HTMLElement>(`#${this.generatedId}-${filter.id}-option-${next}`)\n ?.focus();\n });\n }\n\n private optionMatchesQuery(option: FilterMenuOption, query: string): boolean {\n const normalized = query.trim().toLocaleLowerCase();\n if (!normalized) return true;\n return `${option.label} ${option.description ?? ''}`.toLocaleLowerCase().includes(normalized);\n }\n\n private visibleOptions(\n filter: FilterMenuFilter,\n query = this.optionQueryByFilter[filter.id] ?? ''\n ) {\n if (filter.kind === 'boolean') {\n const option = this.booleanOption(filter);\n return this.optionMatchesQuery(option, query) ? [option] : [];\n }\n return (filter.options ?? []).filter(option => this.optionMatchesQuery(option, query));\n }\n\n private booleanOption(filter: FilterMenuFilter): FilterMenuOption {\n return {\n label: filter.fieldLabel ?? filter.label,\n value: 'true',\n description: filter.description,\n };\n }\n\n private setOptionQuery(filter: FilterMenuFilter, value: string) {\n const visibleOptions = this.visibleOptions(filter, value);\n const firstEnabled = visibleOptions.findIndex(option => !option.isInactive);\n this.activeOptionIndex = firstEnabled;\n this.focusRingVisible = false;\n this.optionQueryByFilter = { ...this.optionQueryByFilter, [filter.id]: value };\n requestAnimationFrame(() => {\n const content = this.el.querySelector<HTMLElement>('.filter-menu__options-content');\n if (content) content.scrollTop = 0;\n this.position.schedule();\n });\n }\n\n private handleOptionSearchKeyDown(event: KeyboardEvent, filter: FilterMenuFilter) {\n if (event.key !== 'ArrowDown' && event.key !== 'ArrowUp') return;\n const visibleOptions = this.visibleOptions(filter);\n const enabled = visibleOptions\n .map((option, index) => ({ option, index }))\n .filter(({ option }) => !option.isInactive)\n .map(({ index }) => index);\n if (!enabled.length) return;\n event.preventDefault();\n const next = event.key === 'ArrowDown' ? enabled[0] : enabled[enabled.length - 1];\n this.activeOptionIndex = next;\n this.focusRingVisible = true;\n requestAnimationFrame(() => {\n this.el\n .querySelector<HTMLElement>(`#${this.generatedId}-${filter.id}-option-${next}`)\n ?.focus();\n });\n }\n\n private toggleMultiple(\n filter: FilterMenuFilter,\n option: FilterMenuOption,\n checked: boolean,\n values: FilterMenuValues\n ) {\n if (option.isInactive) return;\n const current = Array.isArray(values[filter.id]) ? (values[filter.id] as string[]) : [];\n const selected = new Set(current);\n if (checked) selected.add(option.value);\n else selected.delete(option.value);\n const ordered = (filter.options ?? [])\n .map(candidate => candidate.value)\n .filter(value => selected.has(value));\n this.dsChange.emit({ filterId: filter.id, value: ordered });\n }\n\n private selectOption(\n filter: FilterMenuFilter,\n option: FilterMenuOption,\n values: FilterMenuValues\n ) {\n if (option.isInactive) return;\n if (filter.kind === 'single') {\n this.dsChange.emit({ filterId: filter.id, value: option.value });\n return;\n }\n const selected = Array.isArray(values[filter.id])\n ? (values[filter.id] as string[]).includes(option.value)\n : false;\n this.toggleMultiple(filter, option, !selected, values);\n }\n\n private dateMode(filterId: string, value: FilterMenuValue | undefined): FilterMenuDateMode {\n return this.dateModeByFilter[filterId] ?? parseDateFilterValue(value)?.kind ?? 'relative';\n }\n\n private setDateMode(filter: FilterMenuFilter, value: FilterMenuValue | undefined, mode: string) {\n if (mode !== 'range' && mode !== 'relative') return;\n this.dateModeByFilter = { ...this.dateModeByFilter, [filter.id]: mode };\n this.activeOptionIndex = 0;\n if (mode === 'range' && !this.calendarMonthByFilter[filter.id]) {\n const parsed = parseDateFilterValue(value);\n const initialDate = parsed?.kind === 'range' ? parsed.start : filterMenuToday();\n this.calendarMonthByFilter = {\n ...this.calendarMonthByFilter,\n [filter.id]: filterMenuCalendarMonth(initialDate),\n };\n }\n if (mode === 'relative' && this.pendingRangeStartByFilter[filter.id]) {\n const next = { ...this.pendingRangeStartByFilter };\n delete next[filter.id];\n this.pendingRangeStartByFilter = next;\n }\n if (mode === 'relative') this.clearCalendarRangePreview(filter.id);\n }\n\n private calendarMonth(filterId: string, value: FilterMenuValue | undefined): string {\n const parsed = parseDateFilterValue(value);\n const initialDate = parsed?.kind === 'range' ? parsed.start : filterMenuToday();\n return this.calendarMonthByFilter[filterId] ?? filterMenuCalendarMonth(initialDate);\n }\n\n private moveCalendarMonth(filterId: string, month: string, offset: number) {\n this.clearCalendarRangePreview(filterId);\n this.calendarMonthByFilter = {\n ...this.calendarMonthByFilter,\n [filterId]: shiftFilterMenuCalendarMonth(month, offset),\n };\n }\n\n private selectCalendarDate(filterId: string, value: string) {\n this.clearCalendarRangePreview(filterId);\n const pendingStart = this.pendingRangeStartByFilter[filterId];\n const next = { ...this.pendingRangeStartByFilter };\n if (pendingStart) delete next[filterId];\n else next[filterId] = value;\n this.pendingRangeStartByFilter = next;\n this.dsChange.emit({\n filterId,\n value: dateFilterRangeValue(pendingStart ?? value, value),\n });\n }\n\n private previewCalendarRange(filterId: string, value: string) {\n if (!this.pendingRangeStartByFilter[filterId]) return;\n if (this.previewRangeEndByFilter[filterId] === value) return;\n this.previewRangeEndByFilter = { ...this.previewRangeEndByFilter, [filterId]: value };\n }\n\n private clearCalendarRangePreview(filterId: string) {\n if (!this.previewRangeEndByFilter[filterId]) return;\n const next = { ...this.previewRangeEndByFilter };\n delete next[filterId];\n this.previewRangeEndByFilter = next;\n }\n\n private focusCalendarDate(filterId: string, value: string) {\n this.previewCalendarRange(filterId, value);\n const targetMonth = filterMenuCalendarMonth(value);\n if (this.calendarMonthByFilter[filterId] !== targetMonth) {\n this.calendarMonthByFilter = { ...this.calendarMonthByFilter, [filterId]: targetMonth };\n }\n requestAnimationFrame(() => {\n this.el.querySelector<HTMLElement>(`[data-date-option=\"${value}\"]`)?.focus();\n });\n }\n\n private handleCalendarDayKeyDown(event: KeyboardEvent, filterId: string, value: string) {\n let offset: number | null = null;\n if (event.key === 'ArrowLeft') offset = -1;\n else if (event.key === 'ArrowRight') offset = 1;\n else if (event.key === 'ArrowUp') offset = -7;\n else if (event.key === 'ArrowDown') offset = 7;\n else if (event.key === 'Home') {\n offset = -new Date(`${value}T00:00:00Z`).getUTCDay();\n } else if (event.key === 'End') {\n offset = 6 - new Date(`${value}T00:00:00Z`).getUTCDay();\n } else if (event.key === 'PageUp') {\n const month = shiftFilterMenuCalendarMonth(filterMenuCalendarMonth(value), -1);\n const day = value.slice(8, 10);\n const candidate = `${month}-${day}`;\n const target = parseDateFilterValue(candidate) ? candidate : `${month}-01`;\n event.preventDefault();\n this.focusCalendarDate(filterId, target);\n return;\n } else if (event.key === 'PageDown') {\n const month = shiftFilterMenuCalendarMonth(filterMenuCalendarMonth(value), 1);\n const day = value.slice(8, 10);\n const candidate = `${month}-${day}`;\n const target = parseDateFilterValue(candidate) ? candidate : `${month}-01`;\n event.preventDefault();\n this.focusCalendarDate(filterId, target);\n return;\n }\n if (offset === null) return;\n event.preventDefault();\n this.focusCalendarDate(filterId, shiftIsoCalendarDate(value, offset));\n }\n\n private renderRelativeDateOptions(filter: FilterMenuFilter, value: FilterMenuValue | undefined) {\n const relativeFilter: FilterMenuFilter = {\n ...filter,\n kind: 'single',\n options: RELATIVE_DATE_OPTIONS,\n };\n return (\n <div\n class=\"filter-menu__date-relative ds-choice-list ds-chrome-column ds-chrome-space--sm\"\n role=\"listbox\"\n aria-label=\"Relative date\"\n >\n {RELATIVE_DATE_OPTIONS.map((option, index) => (\n <ChoiceOptionRow\n size=\"md\"\n id={`${this.generatedId}-${filter.id}-relative-${index}`}\n option={option}\n selected={value === option.value}\n active={index === this.activeOptionIndex}\n focusRingVisible={this.focusRingVisible}\n usesSubtext={false}\n tabIndex={index === this.activeOptionIndex ? 0 : -1}\n onFocus={() => {\n this.activeOptionIndex = index;\n }}\n onKeyDown={(event: KeyboardEvent) =>\n this.handleOptionKeyDown(event, relativeFilter, option, index, {\n [filter.id]: value,\n })\n }\n onHover={() => {\n this.focusRingVisible = false;\n this.activeOptionIndex = index;\n }}\n onSelect={() => this.dsChange.emit({ filterId: filter.id, value: option.value })}\n />\n ))}\n </div>\n );\n }\n\n private renderDateCalendar(filter: FilterMenuFilter, value: FilterMenuValue | undefined) {\n const parsed = parseDateFilterValue(value);\n const range = parsed?.kind === 'range' ? parsed : null;\n const month = this.calendarMonth(filter.id, value);\n const days = filterMenuCalendarDays(month);\n const today = filterMenuToday();\n const pendingStart = this.pendingRangeStartByFilter[filter.id];\n const previewEnd = this.previewRangeEndByFilter[filter.id];\n const previewStart = pendingStart && previewEnd ? [pendingStart, previewEnd].sort()[0] : null;\n const previewFinish = pendingStart && previewEnd ? [pendingStart, previewEnd].sort()[1] : null;\n const preferredFocus =\n this.pendingRangeStartByFilter[filter.id] ??\n range?.end ??\n (month === today.slice(0, 7) ? today : '');\n const focusDate = days.some(day => day.value === preferredFocus)\n ? preferredFocus\n : (days.find(day => day.inMonth)?.value ?? days[0]?.value);\n\n return (\n <div class=\"filter-menu__calendar\">\n <div class=\"filter-menu__calendar-heading ds-control--md\">\n <ds-button-unfilled\n class=\"filter-menu__calendar-nav filter-menu__calendar-nav--previous\"\n variant=\"icon\"\n icon=\"ChevronLeft\"\n size=\"md\"\n hasBorder={false}\n ariaLabel=\"Previous month\"\n onDsClick={() => this.moveCalendarMonth(filter.id, month, -1)}\n />\n <ds-text as=\"span\" variant=\"text-body-medium\" emphasis color=\"primary\">\n {filterMenuCalendarMonthLabel(month)}\n </ds-text>\n <ds-button-unfilled\n class=\"filter-menu__calendar-nav filter-menu__calendar-nav--next\"\n variant=\"icon\"\n icon=\"ChevronRight\"\n size=\"md\"\n hasBorder={false}\n ariaLabel=\"Next month\"\n onDsClick={() => this.moveCalendarMonth(filter.id, month, 1)}\n />\n </div>\n <div class=\"filter-menu__calendar-weekdays\" aria-hidden=\"true\">\n {FILTER_MENU_WEEKDAYS.map(day => (\n <ds-text as=\"span\" variant=\"text-body-small\" color=\"secondary\">\n {day}\n </ds-text>\n ))}\n </div>\n <div\n class=\"filter-menu__calendar-grid\"\n role=\"grid\"\n aria-label={filterMenuCalendarMonthLabel(month)}\n onMouseLeave={() => this.clearCalendarRangePreview(filter.id)}\n >\n {days.map(day => {\n const selectedInRange = Boolean(\n range && day.value >= range.start && day.value <= range.end\n );\n const previewInRange = Boolean(\n previewStart &&\n previewFinish &&\n day.value >= previewStart &&\n day.value <= previewFinish\n );\n const inRange = previewInRange || selectedInRange;\n const rangeEdge = Boolean(\n previewStart\n ? day.value === pendingStart\n : range && (day.value === range.start || day.value === range.end)\n );\n const textColor = rangeEdge\n ? 'on-bold'\n : inRange || day.value === today\n ? 'primary'\n : day.inMonth\n ? 'secondary'\n : 'tertiary';\n return (\n <button\n type=\"button\"\n role=\"gridcell\"\n data-date-option={day.value}\n class={{\n 'filter-menu__calendar-day': true,\n 'filter-menu__calendar-day--outside': !day.inMonth,\n 'filter-menu__calendar-day--today': day.value === today,\n 'filter-menu__calendar-day--in-range': inRange,\n 'filter-menu__calendar-day--range-preview': previewInRange,\n 'filter-menu__calendar-day--range-edge': rangeEdge,\n 'ds-focus-ring-inset': true,\n 'ds-interaction-fill': true,\n }}\n aria-label={day.label}\n aria-selected={selectedInRange ? 'true' : 'false'}\n tabIndex={day.value === focusDate ? 0 : -1}\n onMouseEnter={() => this.previewCalendarRange(filter.id, day.value)}\n onFocus={() => this.previewCalendarRange(filter.id, day.value)}\n onClick={() => this.selectCalendarDate(filter.id, day.value)}\n onKeyDown={(event: KeyboardEvent) =>\n this.handleCalendarDayKeyDown(event, filter.id, day.value)\n }\n >\n <ds-text\n class=\"ds-interaction-fill__content\"\n as=\"span\"\n variant=\"text-body-medium\"\n color={textColor}\n emphasis={day.value === today}\n >\n {day.day}\n </ds-text>\n </button>\n );\n })}\n </div>\n </div>\n );\n }\n\n private renderDateFilter(filter: FilterMenuFilter, value: FilterMenuValue | undefined) {\n const mode = this.dateMode(filter.id, value);\n return (\n <div class=\"filter-menu__date\">\n <header class=\"filter-menu__date-header ds-chrome-header ds-chrome-header--bounded\">\n <ds-tab-group\n ariaLabel=\"Date filter mode\"\n size=\"md\"\n width=\"fill\"\n hasContainer={false}\n value={mode}\n tabs={DATE_MODE_TABS}\n onDsChange={(event: CustomEvent<string>) => {\n event.stopPropagation();\n this.setDateMode(filter, value, event.detail);\n }}\n />\n </header>\n <div class=\"filter-menu__date-body\">\n {mode === 'relative'\n ? this.renderRelativeDateOptions(filter, value)\n : this.renderDateCalendar(filter, value)}\n </div>\n </div>\n );\n }\n\n private renderOptionSearch(filter: FilterMenuFilter) {\n return (\n <div class=\"filter-menu__option-search\">\n <ChoiceSearch\n size=\"md\"\n hasFocusBoundary={false}\n hasInteractionFill={false}\n value={this.optionQueryByFilter[filter.id] ?? ''}\n placeholder={this.searchPlaceholder}\n ariaLabel={`Search ${filter.label} options`}\n controls={`${this.generatedId}-${filter.id}-options`}\n inputRef={() => undefined}\n clearLabel={`Clear ${filter.label} search`}\n onValueChange={value => this.setOptionQuery(filter, value)}\n onKeyDown={(event: KeyboardEvent) => this.handleOptionSearchKeyDown(event, filter)}\n />\n </div>\n );\n }\n\n private renderNoOptionResults() {\n return (\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 }\n\n private renderOptions(filter: FilterMenuFilter, values: FilterMenuValues) {\n const value = values[filter.id];\n if (filter.kind === 'multiple' || filter.kind === 'single') {\n const selected = Array.isArray(value) ? value : [];\n const allOptions = filter.options ?? [];\n const options = this.visibleOptions(filter);\n const usesSubtext = choiceListUsesSubtext(\n allOptions.map(option => ({\n label: option.label,\n value: option.value,\n subtext: option.description,\n }))\n );\n if (!options.length) return this.renderNoOptionResults();\n return options.map((option, index) => {\n const isSelected =\n filter.kind === 'multiple' ? selected.includes(option.value) : value === option.value;\n return (\n <ChoiceOptionRow\n size=\"md\"\n id={`${this.generatedId}-${filter.id}-option-${index}`}\n option={{\n label: option.label,\n value: option.value,\n subtext: option.description,\n isInactive: option.isInactive,\n }}\n selected={isSelected}\n active={index === this.activeOptionIndex}\n focusRingVisible={this.focusRingVisible}\n usesSubtext={usesSubtext}\n tabIndex={index === this.activeOptionIndex ? 0 : -1}\n leading={\n filter.kind === 'multiple' ? (\n <span\n class=\"ds-choice-item__icon ds-control-icon-box ds-interaction-fill__content\"\n aria-hidden=\"true\"\n >\n <ds-checkbox label=\"\" size=\"md\" checked={isSelected} presentation />\n </span>\n ) : undefined\n }\n onFocus={() => {\n this.activeOptionIndex = index;\n }}\n onKeyDown={(event: KeyboardEvent) =>\n this.handleOptionKeyDown(event, filter, option, index, values, options)\n }\n onHover={() => {\n this.focusRingVisible = false;\n this.activeOptionIndex = index;\n }}\n onSelect={() => this.selectOption(filter, option, values)}\n />\n );\n });\n }\n\n if (filter.kind === 'boolean') {\n const [option] = this.visibleOptions(filter);\n if (!option) return this.renderNoOptionResults();\n return (\n <ChoiceOptionRow\n size=\"md\"\n id={`${this.generatedId}-${filter.id}-option-0`}\n option={{\n label: option.label,\n value: option.value,\n subtext: option.description,\n }}\n selected={value === true}\n active\n focusRingVisible={this.focusRingVisible}\n usesSubtext={Boolean(option.description)}\n tabIndex={0}\n leading={\n <span\n class=\"ds-choice-item__icon ds-control-icon-box ds-interaction-fill__content\"\n aria-hidden=\"true\"\n >\n <ds-checkbox label=\"\" size=\"md\" checked={value === true} presentation />\n </span>\n }\n onKeyDown={(event: KeyboardEvent) => {\n if (event.key === 'ArrowLeft') this.handlePanelKeyDown(event, filter.id);\n else if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n this.dsChange.emit({ filterId: filter.id, value: value !== true });\n }\n }}\n onHover={() => {\n this.focusRingVisible = false;\n }}\n onSelect={() => this.dsChange.emit({ filterId: filter.id, value: value !== true })}\n />\n );\n }\n\n return this.renderDateFilter(filter, value);\n }\n\n private get captionIconOnly(): boolean {\n return (\n this.collapseLabel && this.captionCompact && this.usesInternalTrigger && Boolean(this.icon)\n );\n }\n\n private syncCaptionCompactObserver(): void {\n this.disconnectCaptionCompactObserver();\n if (!this.collapseLabel) {\n if (this.captionCompact) this.captionCompact = false;\n return;\n }\n this.captionCompactDisconnect = observeTableCaptionCompact(this.el, compact => {\n if (this.captionCompact !== compact) this.captionCompact = compact;\n });\n }\n\n private disconnectCaptionCompactObserver(): void {\n this.captionCompactDisconnect?.();\n this.captionCompactDisconnect = undefined;\n }\n\n private renderCaptionTooltip(trigger: VNode, label: string): VNode {\n if (!this.collapseLabel) return trigger;\n return (\n <ds-tooltip label={label} side=\"top\" size=\"sm\">\n {trigger}\n </ds-tooltip>\n );\n }\n\n private renderFooter(totalSelected: number, categoriesClear: boolean) {\n return (\n <div\n class={{\n 'filter-menu__footer': true,\n 'filter-menu__footer--categories-clear': categoriesClear,\n 'ds-choice-footer': true,\n }}\n aria-hidden={categoriesClear && totalSelected === 0 ? 'true' : undefined}\n >\n <div class=\"ds-choice-footer__content ds-control--md\">\n {!categoriesClear ? (\n <ds-text\n class=\"ds-choice-footer__summary\"\n as=\"span\"\n variant=\"text-body-medium\"\n color=\"secondary\"\n aria-live=\"polite\"\n >\n {totalSelected} selected\n </ds-text>\n ) : null}\n {totalSelected > 0 ? (\n <button\n class=\"filter-menu__clear ds-choice-footer__clear ds-text-action\"\n type=\"button\"\n onClick={() => {\n this.pendingRangeStartByFilter = {};\n this.dsClear.emit();\n }}\n >\n <ds-text as=\"span\" variant=\"text-body-medium\" color=\"inherit\">\n {this.clearLabel}\n </ds-text>\n </button>\n ) : null}\n </div>\n </div>\n );\n }\n\n private renderMatchModeFooter(filter: FilterMenuFilter, matchModes: FilterMenuMatchModes) {\n const mode: FilterMenuMatchMode = matchModes[filter.id] === 'all' ? 'all' : 'any';\n const nextMode: FilterMenuMatchMode = mode === 'any' ? 'all' : 'any';\n return (\n <div class=\"filter-menu__match-mode-footer ds-choice-footer\">\n <div class=\"filter-menu__match-mode-content ds-choice-footer__content ds-control--md\">\n <ds-text as=\"span\" variant=\"text-body-medium\" color=\"secondary\">\n Limit results to\n </ds-text>\n <button\n class=\"filter-menu__match-mode-toggle ds-text-action ds-focus-ring\"\n type=\"button\"\n aria-label={`Limit ${filter.label} results to ${nextMode} selected`}\n onClick={() => this.dsMatchModeChange.emit({ filterId: filter.id, mode: nextMode })}\n onKeyDown={(event: KeyboardEvent) => this.handlePanelKeyDown(event, filter.id)}\n >\n <ds-text as=\"span\" variant=\"text-body-medium\" color=\"inherit\">\n {mode}\n </ds-text>\n </button>\n <ds-text as=\"span\" variant=\"text-body-medium\" color=\"secondary\">\n selected\n </ds-text>\n </div>\n </div>\n );\n }\n\n render() {\n const state =\n this.closing && this.closingSnapshot\n ? this.closingSnapshot\n : {\n filters: this.filters,\n values: this.values,\n matchModes: this.matchModes,\n activeFilterId: this.activeFilterId,\n };\n const activeFilter = this.selectedFilter(state.filters, state.activeFilterId);\n const totalSelected = this.totalSelected(state.filters, state.values);\n const activeFilterCount = this.activeFilterCount(state.filters, state.values);\n const hasActiveFilters = activeFilterCount > 0;\n const categoriesClearFooter = this.footerLayout === 'categories-clear';\n const label = `${this.triggerLabel}${\n this.showSelectedCount && hasActiveFilters ? ` · ${activeFilterCount}` : ''\n }`;\n const textVariant = CONTROL_TEXT_VARIANT[this.size];\n const iconSize = ICON_SIZE[this.size];\n const popupId = `${this.generatedId}-popup`;\n const popupStyle: Record<string, string> = {\n position: 'fixed',\n left: '0',\n top: '0',\n width: this.menuWidth,\n transform: `translate(${Math.round(this.pos.x)}px, ${Math.round(this.pos.y)}px)`,\n zIndex: '9998',\n visibility: this.positionReady ? 'visible' : 'hidden',\n };\n\n return (\n <Host\n class={{\n 'filter-menu-host': true,\n 'filter-menu-host--external-trigger': !this.usesInternalTrigger,\n 'ds-select-trigger-host': this.usesInternalTrigger,\n [`ds-control--${this.size}`]: true,\n 'ds-table-caption-control': this.collapseLabel,\n 'ds-table-caption-control--compact': this.captionIconOnly,\n ...controlWidthClass(this.width),\n }}\n >\n {this.usesInternalTrigger\n ? this.renderCaptionTooltip(\n <button\n ref={element => {\n this.triggerElement = (element as HTMLButtonElement) ?? null;\n }}\n id={this.inputId ?? `${this.generatedId}-trigger`}\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': this.activeFill && hasActiveFilters,\n 'trigger--expanded': this.open || this.closing,\n 'ds-interaction-fill--surface-open': this.open || this.closing,\n 'trigger--bordered': this.hasBorder,\n 'trigger--has-value': hasActiveFilters,\n [`ds-control--${this.size}`]: true,\n }}\n role=\"combobox\"\n aria-haspopup=\"dialog\"\n aria-expanded={String(this.open)}\n aria-controls={this.open ? popupId : undefined}\n aria-label={this.ariaLabel ?? this.menuLabel}\n onClick={(event: MouseEvent) => this.toggleFromTrigger(event)}\n onKeyDown={(event: KeyboardEvent) => this.handleTriggerKeyDown(event)}\n >\n {this.icon ? (\n <span\n class=\"trigger__prefix ds-control-icon-box ds-interaction-fill__content\"\n aria-hidden=\"true\"\n >\n <ds-icon name={this.icon} size={iconSize} color=\"inherit\" />\n </span>\n ) : null}\n {this.captionIconOnly ? null : (\n <ds-text\n class=\"trigger__label-box trigger__label trigger__label-content 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 )}\n {this.captionIconOnly ? null : (\n <span\n class=\"trigger__chevron ds-control-icon-box ds-interaction-fill__content\"\n aria-hidden=\"true\"\n >\n <ds-icon name=\"ChevronDown\" size={iconSize} color=\"inherit\" />\n </span>\n )}\n </button>,\n this.captionIconOnly ? label : ''\n )\n : null}\n\n {this.shouldRender ? (\n <div\n id={popupId}\n popover=\"manual\"\n class={{\n 'filter-menu-popup': true,\n 'ds-choice-popup': true,\n 'ds-choice-popup--closing': this.closing,\n }}\n style={popupStyle}\n role=\"dialog\"\n aria-label={this.menuLabel}\n >\n {activeFilter ? (\n <div class=\"filter-menu\">\n <div class=\"filter-menu__body\">\n <div class=\"filter-menu__category-pane\">\n <div\n class=\"filter-menu__categories ds-choice-list ds-chrome-column ds-chrome-space--sm\"\n role=\"tablist\"\n aria-label={this.categoriesLabel}\n aria-orientation=\"vertical\"\n >\n {state.filters.map(filter => {\n const active = filter.id === activeFilter.id;\n const count = this.selectedCount(filter, state.values);\n return (\n <div\n key={filter.id}\n class={{\n 'filter-menu__category-section': true,\n 'ds-choice-section--divided': Boolean(filter.divider),\n }}\n >\n <button\n id={`${this.generatedId}-${filter.id}-tab`}\n type=\"button\"\n role=\"tab\"\n data-filter-category={filter.id}\n class={{\n 'filter-menu__category': true,\n 'filter-menu__category--active': active,\n 'ds-choice-item': true,\n 'ds-control-frame': true,\n 'ds-control--md': true,\n 'ds-focus-ring-inset': true,\n 'ds-focus-ring--visible': active && this.focusRingVisible,\n 'ds-interaction-fill': true,\n 'ds-interaction-fill--selected': active,\n }}\n aria-selected={String(active)}\n aria-controls={`${this.generatedId}-panel`}\n tabIndex={active ? 0 : -1}\n onMouseDown={() => {\n this.focusRingVisible = false;\n }}\n onClick={() => this.selectCategory(filter.id)}\n onKeyDown={(event: KeyboardEvent) =>\n this.handleCategoryKeyDown(event, state.filters, filter.id)\n }\n >\n <ds-text\n class=\"ds-choice-item__content ds-choice-item__label ds-control-label-box ds-interaction-fill__content\"\n as=\"span\"\n variant=\"text-body-medium\"\n color={active ? 'primary' : 'secondary'}\n >\n {filter.label}\n </ds-text>\n {count > 0 && filter.kind === 'date' ? (\n <span\n class=\"filter-menu__category-dot-box ds-interaction-fill__content\"\n aria-hidden=\"true\"\n >\n <ds-badge variant=\"dot\" hasRing={false} label=\"\" />\n </span>\n ) : count > 0 ? (\n <ds-tag\n class=\"ds-choice-item__tag ds-interaction-fill__content\"\n label={String(count)}\n size=\"sm\"\n intent=\"brand\"\n contrast=\"bold\"\n isInset\n rounded\n />\n ) : null}\n </button>\n </div>\n );\n })}\n </div>\n {categoriesClearFooter ? this.renderFooter(totalSelected, true) : null}\n </div>\n\n <div\n id={`${this.generatedId}-panel`}\n class={{\n 'filter-menu__options': true,\n 'filter-menu__options--date': activeFilter.kind === 'date',\n }}\n role=\"tabpanel\"\n aria-labelledby={`${this.generatedId}-${activeFilter.id}-tab`}\n >\n {activeFilter.kind === 'date' ? null : this.renderOptionSearch(activeFilter)}\n <div class=\"filter-menu__options-content\">\n {activeFilter.kind === 'date' ? (\n <div key={activeFilter.id} class=\"filter-menu__option-list--date\">\n {this.renderOptions(activeFilter, state.values)}\n </div>\n ) : (\n <div\n id={`${this.generatedId}-${activeFilter.id}-options`}\n key={activeFilter.id}\n class=\"filter-menu__option-list ds-choice-list ds-chrome-column ds-chrome-space--sm\"\n role=\"listbox\"\n aria-label={activeFilter.label}\n aria-multiselectable={\n activeFilter.kind === 'multiple' ? 'true' : undefined\n }\n >\n {this.renderOptions(activeFilter, state.values)}\n </div>\n )}\n </div>\n {activeFilter.kind === 'multiple'\n ? this.renderMatchModeFooter(activeFilter, state.matchModes)\n : null}\n </div>\n </div>\n\n {!categoriesClearFooter && totalSelected > 0\n ? this.renderFooter(totalSelected, false)\n : null}\n </div>\n ) : null}\n </div>\n ) : null}\n </Host>\n );\n }\n}\n",
795
800
  "type": "registry:ui"
796
801
  },
797
802
  {