@ds-mo/ui 14.34.0 → 14.35.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.
- package/dist/.package-ready.json +1 -1
- package/dist/agent-patterns.json +1 -1
- package/dist/agent.json +310 -23
- package/dist/angular/ds-filter-menu.d.ts +1 -1
- package/dist/angular/ds-filter-menu.js +3 -3
- package/dist/angular/ds-menu.d.ts +1 -1
- package/dist/angular/ds-menu.js +3 -3
- package/dist/angular/ds-select.d.ts +1 -1
- package/dist/angular/ds-select.js +3 -3
- package/dist/angular/ds-tab-group.d.ts +1 -1
- package/dist/angular/ds-tab-group.js +3 -3
- package/dist/angular/ds-table-filter.d.ts +1 -1
- package/dist/angular/ds-table-filter.js +3 -3
- package/dist/angular/ds-table-group.d.ts +1 -1
- package/dist/angular/ds-table-group.js +3 -3
- package/dist/angular/ds-table-preferences.d.ts +39 -0
- package/dist/angular/ds-table-preferences.js +69 -0
- package/dist/angular/ds-table-saved-views.d.ts +1 -1
- package/dist/angular/ds-table-saved-views.js +3 -3
- package/dist/angular/ds-table-search.d.ts +1 -1
- package/dist/angular/ds-table-search.js +3 -3
- package/dist/angular/ds-table-sort.d.ts +1 -1
- package/dist/angular/ds-table-sort.js +3 -3
- package/dist/angular/ds-table-toolbar.d.ts +1 -1
- package/dist/angular/ds-table-toolbar.js +3 -3
- package/dist/angular/ds-table.d.ts +3 -1
- package/dist/angular/ds-table.js +8 -5
- package/dist/angular/index.d.ts +1 -1
- package/dist/angular/index.js +1 -0
- package/dist/angular/proxies.d.ts +1 -0
- package/dist/angular/proxies.js +1 -0
- package/dist/components/ds-agent-activity.js +1 -1
- package/dist/components/ds-agent-questionnaire.js +1 -1
- package/dist/components/ds-agent-response.js +1 -1
- package/dist/components/ds-agent-source-list.js +1 -1
- package/dist/components/ds-agent-tool-call.js +1 -1
- package/dist/components/ds-attachment-list.js +1 -1
- package/dist/components/ds-badge.js +1 -1
- package/dist/components/ds-banner.js +1 -1
- package/dist/components/ds-bar-action.js +1 -1
- package/dist/components/ds-bar-nav.js +1 -1
- package/dist/components/ds-bar-page-title.js +1 -1
- package/dist/components/ds-bar-title.js +1 -1
- package/dist/components/ds-bar-workflow.js +1 -1
- package/dist/components/ds-breadcrumb.js +1 -1
- package/dist/components/ds-button-filled.js +1 -1
- package/dist/components/ds-button-unfilled.js +1 -1
- package/dist/components/ds-card-action-center.js +1 -1
- package/dist/components/ds-card-chart.js +1 -1
- package/dist/components/ds-card-navigation.js +1 -1
- package/dist/components/ds-card-overview.js +1 -1
- package/dist/components/ds-card-setting.js +1 -1
- package/dist/components/ds-card-settings-scope.js +1 -1
- package/dist/components/ds-chart-legend.js +1 -1
- package/dist/components/ds-chart.js +1 -1
- package/dist/components/ds-checkbox.js +1 -1
- package/dist/components/ds-chip.js +1 -1
- package/dist/components/ds-code-block.js +1 -1
- package/dist/components/ds-conversation-list-item.js +1 -1
- package/dist/components/ds-conversation-list-section.js +1 -1
- package/dist/components/ds-empty-state.js +1 -1
- package/dist/components/ds-field.js +1 -1
- package/dist/components/ds-filter-menu.js +1 -1
- package/dist/components/ds-input.js +1 -1
- package/dist/components/ds-markdown.js +1 -1
- package/dist/components/ds-menu.js +1 -1
- package/dist/components/ds-message-actions.js +1 -1
- package/dist/components/ds-message-bubble.js +1 -1
- package/dist/components/ds-message-bubble.js.map +1 -1
- package/dist/components/ds-message-composer.js +1 -1
- package/dist/components/ds-message-scroller.js +1 -1
- package/dist/components/ds-message.js +1 -1
- package/dist/components/ds-mobile-bar-nav.js +1 -1
- package/dist/components/ds-mobile-header.js +1 -1
- package/dist/components/ds-mobile-section-switcher.js +1 -1
- package/dist/components/ds-mobile-sheet-nav.js +1 -1
- package/dist/components/ds-modal.js +1 -1
- package/dist/components/ds-pagination.js +1 -1
- package/dist/components/ds-panel-nav.js +1 -1
- package/dist/components/ds-panel-sub-nav.js +1 -1
- package/dist/components/ds-panel-tool-header.js +1 -1
- package/dist/components/ds-panel-tool-search.js +1 -1
- package/dist/components/ds-panel-tools.js +1 -1
- package/dist/components/ds-paper-texture.js +1 -1
- package/dist/components/ds-radio.js +1 -1
- package/dist/components/ds-score.js +1 -1
- package/dist/components/ds-scroll-overlay.js +1 -1
- package/dist/components/ds-select.js +1 -1
- package/dist/components/ds-shell-app.js +1 -1
- package/dist/components/ds-shell-app.js.map +1 -1
- package/dist/components/ds-shell-page.js +1 -1
- package/dist/components/ds-shell-tools.js +1 -1
- package/dist/components/ds-skeleton.js +1 -1
- package/dist/components/ds-slider.js +1 -1
- package/dist/components/ds-swatch-picker.js +1 -1
- package/dist/components/ds-switch.js +1 -1
- package/dist/components/ds-tab-group.js +1 -1
- package/dist/components/ds-table-filter.js +1 -1
- package/dist/components/ds-table-filter.js.map +1 -1
- package/dist/components/ds-table-group.js +1 -1
- package/dist/components/ds-table-group.js.map +1 -1
- package/dist/components/ds-table-preferences.d.ts +11 -0
- package/dist/components/ds-table-preferences.js +2 -0
- package/dist/components/ds-table-preferences.js.map +1 -0
- package/dist/components/ds-table-saved-views.js +1 -1
- package/dist/components/ds-table-saved-views.js.map +1 -1
- package/dist/components/ds-table-search.js +1 -1
- package/dist/components/ds-table-search.js.map +1 -1
- package/dist/components/ds-table-sort.js +1 -1
- package/dist/components/ds-table-sort.js.map +1 -1
- package/dist/components/ds-table-toolbar.js +1 -1
- package/dist/components/ds-table-toolbar.js.map +1 -1
- package/dist/components/ds-table.js +1 -1
- package/dist/components/ds-table.js.map +1 -1
- package/dist/components/ds-tag.js +1 -1
- package/dist/components/ds-text.js +1 -1
- package/dist/components/ds-textarea.js +1 -1
- package/dist/components/ds-toast.js +1 -1
- package/dist/components/ds-tooltip-chart.js +1 -1
- package/dist/components/ds-tooltip.js +1 -1
- package/dist/components/ds-typing-indicator.js +1 -1
- package/dist/components/{p-ByoywoBH.js → p-B-9fdIWv.js} +2 -2
- package/dist/components/{p-CnK36Be0.js → p-BINSI_KF.js} +2 -2
- package/dist/components/{p-CK2S28gU.js → p-BPhbwXOv.js} +2 -2
- package/dist/components/{p-CMq-jKEI.js → p-BPlWEidl.js} +2 -2
- package/dist/components/{p-DyyfWSLB.js → p-BQaO7cg_.js} +2 -2
- package/dist/components/{p-Br0dx2uP.js → p-BQsVI_vO.js} +2 -2
- package/dist/components/{p-B_nPct4G.js → p-BbfBvMRR.js} +2 -2
- package/dist/components/p-BcdHgPi5.js +2 -0
- package/dist/components/p-BcdHgPi5.js.map +1 -0
- package/dist/components/{p-D_QtZZR8.js → p-BmFeeR4q.js} +2 -2
- package/dist/components/{p-CXAa9TUM.js → p-BnWxbhFP.js} +2 -2
- package/dist/components/{p-CvplapTD.js → p-BnzsBNUY.js} +2 -2
- package/dist/components/{p-BlWNMytv.js → p-C1_3CVma.js} +2 -2
- package/dist/components/p-C1_3CVma.js.map +1 -0
- package/dist/components/{p-DjCnGxSd.js → p-C7CZ9pnP.js} +2 -2
- package/dist/components/{p-DBZwI7HY.js → p-C8ek-1SP.js} +2 -2
- package/dist/components/{p-BEttT0UB.js → p-CAxDdYjh.js} +2 -2
- package/dist/components/{p-BqGdNrVl.js → p-CE540WZ7.js} +2 -2
- package/dist/components/{p-B5QVra1K.js → p-CI7VfYC3.js} +2 -2
- package/dist/components/p-CKarsuR2.js +2 -0
- package/dist/components/p-CKarsuR2.js.map +1 -0
- package/dist/components/{p-AkSwrAKR.js → p-CLGtPE0K.js} +2 -2
- package/dist/components/{p-C51ytXM6.js → p-CSnsz3Eb.js} +2 -2
- package/dist/components/{p-Dx7WcWW1.js → p-CZOiTaNa.js} +2 -2
- package/dist/components/{p-xxuHxP3u.js → p-Cmj04E5Q.js} +2 -2
- package/dist/components/p-Cmj04E5Q.js.map +1 -0
- package/dist/components/{p-zZuAAiiI.js → p-Cq_Qpe_C.js} +2 -2
- package/dist/components/{p-CweS0FfJ.js → p-CqlBlv55.js} +2 -2
- package/dist/components/p-CwqFJMvP.js +2 -0
- package/dist/components/{p-DEyvEIYL.js.map → p-CwqFJMvP.js.map} +1 -1
- package/dist/components/{p-C8XJgV1n.js → p-Cwz9TPVS.js} +2 -2
- package/dist/components/{p-C1QHxVvP.js → p-D44g2Kw1.js} +2 -2
- package/dist/components/{p-CKo2nySr.js → p-DC69DgAR.js} +2 -2
- package/dist/components/{p-CQqZgTYk.js → p-DEGNrPLe.js} +2 -2
- package/dist/components/{p-OxdAzO4v.js → p-DFjIBS5B.js} +2 -2
- package/dist/components/{p-BwsS_Hyr.js → p-DGzn4k4h.js} +2 -2
- package/dist/components/{p-Dj296RmE.js → p-DQQFN2sw.js} +2 -2
- package/dist/components/{p-CIoeHcCk.js → p-DTDLlinw.js} +2 -2
- package/dist/components/p-D_u8WhlU.js +2 -0
- package/dist/components/{p-CHBuzAYH.js.map → p-D_u8WhlU.js.map} +1 -1
- package/dist/components/{p-CqeMumqy.js → p-DdspY23v.js} +2 -2
- package/dist/components/{p-DzbEJN1A.js → p-Dk-8Ju0Q.js} +2 -2
- package/dist/components/{p-Da9VpZX2.js → p-DtLQIMsa.js} +2 -2
- package/dist/components/{p-Cw_npFwN.js → p-FPZbS19l.js} +2 -2
- package/dist/components/{p-BMERUCe1.js → p-KBrC9IG4.js} +2 -2
- package/dist/components/p-N5SHSVo2.js +2 -0
- package/dist/components/{p-CHUdAW1Q.js.map → p-N5SHSVo2.js.map} +1 -1
- package/dist/components/p-QjkufCcn.js +2 -0
- package/dist/components/p-QjkufCcn.js.map +1 -0
- package/dist/components/p-UAIxh67Q.js +2 -0
- package/dist/components/p-UAIxh67Q.js.map +1 -0
- package/dist/components/{p-CIYJhyKt.js → p-beCz9OnD.js} +2 -2
- package/dist/components/{p-LZ8F08Fj.js → p-beRFLHbB.js} +2 -2
- package/dist/components/p-beRFLHbB.js.map +1 -0
- package/dist/components/{p-4DNyCYKM.js → p-mpk_Mm8_.js} +2 -2
- package/dist/components/{p-DrjY8Mpy.js → p-n68x-ZKp.js} +2 -2
- package/dist/components/{p-CNDTHTf6.js → p-omPm8_vx.js} +2 -2
- package/dist/components/{p-lv4YQEsa.js → p-umAf0fBn.js} +2 -2
- package/dist/components/{p-ya8A_SMw.js → p-xHGqrz_p.js} +2 -2
- package/dist/components/{p-ya8A_SMw.js.map → p-xHGqrz_p.js.map} +1 -1
- package/dist/components/{p-CBQzTgvI.js → p-y06IxxoN.js} +2 -2
- package/dist/components/{p-CoE7yza3.js → p-yZRXPHDe.js} +2 -2
- package/dist/docs/components.json +2242 -720
- package/dist/lib/components/ShellApp/shell-app-types.d.ts +3 -1
- package/dist/mcp-data/registry/filter-menu.json +102 -15
- package/dist/mcp-data/registry/menu.json +22 -3
- package/dist/mcp-data/registry/registry.json +312 -22
- package/dist/mcp-data/registry/select.json +43 -8
- package/dist/mcp-data/registry/shell-app.json +4 -3
- package/dist/mcp-data/registry/tab-group.json +20 -3
- package/dist/mcp-data/registry/table-filter.json +26 -6
- package/dist/mcp-data/registry/table-group.json +59 -7
- package/dist/mcp-data/registry/table-preferences.json +511 -0
- package/dist/mcp-data/registry/table-saved-views.json +45 -7
- package/dist/mcp-data/registry/table-search.json +24 -6
- package/dist/mcp-data/registry/table-sort.json +22 -4
- package/dist/mcp-data/registry/table-toolbar.json +26 -6
- package/dist/mcp-data/registry/table.json +70 -4
- package/dist/react/components.d.ts +1 -0
- package/dist/react/components.js +1 -0
- package/dist/react/ds-table-preferences.d.ts +21 -0
- package/dist/react/ds-table-preferences.js +23 -0
- package/dist/react/ds-table.d.ts +1 -0
- package/dist/react/ds-table.js +1 -0
- package/dist/types/components/FilterMenu/FilterMenu.d.ts +16 -0
- package/dist/types/components/Menu/Menu.d.ts +2 -0
- package/dist/types/components/Select/Select.d.ts +5 -1
- package/dist/types/components/ShellApp/shell-app-types.d.ts +3 -1
- package/dist/types/components/TabGroup/TabGroup.d.ts +1 -0
- package/dist/types/components/Table/Table.d.ts +8 -0
- package/dist/types/components/TableFilter/TableFilter.d.ts +2 -0
- package/dist/types/components/TableGroup/TableGroup.d.ts +5 -0
- package/dist/types/components/TablePreferences/TablePreferences.d.ts +56 -0
- package/dist/types/components/TableSavedViews/TableSavedViews.d.ts +4 -0
- package/dist/types/components/TableSearch/TableSearch.d.ts +2 -0
- package/dist/types/components/TableSort/TableSort.d.ts +2 -0
- package/dist/types/components/TableToolbar/TableToolbar.d.ts +2 -0
- package/dist/types/components.d.ts +420 -18
- package/dist/vue/components.d.ts +1 -0
- package/dist/vue/components.js +1 -0
- package/dist/vue/ds-filter-menu.js +5 -0
- package/dist/vue/ds-menu.js +1 -0
- package/dist/vue/ds-select.js +2 -0
- package/dist/vue/ds-tab-group.js +1 -0
- package/dist/vue/ds-table-filter.js +1 -0
- package/dist/vue/ds-table-group.js +3 -0
- package/dist/vue/ds-table-preferences.d.ts +3 -0
- package/dist/vue/ds-table-preferences.js +45 -0
- package/dist/vue/ds-table-saved-views.js +2 -0
- package/dist/vue/ds-table-search.js +1 -0
- package/dist/vue/ds-table-sort.js +1 -0
- package/dist/vue/ds-table-toolbar.js +2 -1
- package/dist/vue/ds-table.js +5 -0
- package/package.json +1 -1
- package/dist/components/p-BlWNMytv.js.map +0 -1
- package/dist/components/p-CHBuzAYH.js +0 -2
- package/dist/components/p-CHUdAW1Q.js +0 -2
- package/dist/components/p-CUL5_8JM.js +0 -2
- package/dist/components/p-CUL5_8JM.js.map +0 -1
- package/dist/components/p-DEyvEIYL.js +0 -2
- package/dist/components/p-DVWOUQfT.js +0 -2
- package/dist/components/p-DVWOUQfT.js.map +0 -1
- package/dist/components/p-LZ8F08Fj.js.map +0 -1
- package/dist/components/p-xxuHxP3u.js.map +0 -1
- /package/dist/components/{p-ByoywoBH.js.map → p-B-9fdIWv.js.map} +0 -0
- /package/dist/components/{p-CnK36Be0.js.map → p-BINSI_KF.js.map} +0 -0
- /package/dist/components/{p-CK2S28gU.js.map → p-BPhbwXOv.js.map} +0 -0
- /package/dist/components/{p-CMq-jKEI.js.map → p-BPlWEidl.js.map} +0 -0
- /package/dist/components/{p-DyyfWSLB.js.map → p-BQaO7cg_.js.map} +0 -0
- /package/dist/components/{p-Br0dx2uP.js.map → p-BQsVI_vO.js.map} +0 -0
- /package/dist/components/{p-B_nPct4G.js.map → p-BbfBvMRR.js.map} +0 -0
- /package/dist/components/{p-D_QtZZR8.js.map → p-BmFeeR4q.js.map} +0 -0
- /package/dist/components/{p-CXAa9TUM.js.map → p-BnWxbhFP.js.map} +0 -0
- /package/dist/components/{p-CvplapTD.js.map → p-BnzsBNUY.js.map} +0 -0
- /package/dist/components/{p-DjCnGxSd.js.map → p-C7CZ9pnP.js.map} +0 -0
- /package/dist/components/{p-DBZwI7HY.js.map → p-C8ek-1SP.js.map} +0 -0
- /package/dist/components/{p-BEttT0UB.js.map → p-CAxDdYjh.js.map} +0 -0
- /package/dist/components/{p-BqGdNrVl.js.map → p-CE540WZ7.js.map} +0 -0
- /package/dist/components/{p-B5QVra1K.js.map → p-CI7VfYC3.js.map} +0 -0
- /package/dist/components/{p-AkSwrAKR.js.map → p-CLGtPE0K.js.map} +0 -0
- /package/dist/components/{p-C51ytXM6.js.map → p-CSnsz3Eb.js.map} +0 -0
- /package/dist/components/{p-Dx7WcWW1.js.map → p-CZOiTaNa.js.map} +0 -0
- /package/dist/components/{p-zZuAAiiI.js.map → p-Cq_Qpe_C.js.map} +0 -0
- /package/dist/components/{p-CweS0FfJ.js.map → p-CqlBlv55.js.map} +0 -0
- /package/dist/components/{p-C8XJgV1n.js.map → p-Cwz9TPVS.js.map} +0 -0
- /package/dist/components/{p-C1QHxVvP.js.map → p-D44g2Kw1.js.map} +0 -0
- /package/dist/components/{p-CKo2nySr.js.map → p-DC69DgAR.js.map} +0 -0
- /package/dist/components/{p-CQqZgTYk.js.map → p-DEGNrPLe.js.map} +0 -0
- /package/dist/components/{p-OxdAzO4v.js.map → p-DFjIBS5B.js.map} +0 -0
- /package/dist/components/{p-BwsS_Hyr.js.map → p-DGzn4k4h.js.map} +0 -0
- /package/dist/components/{p-Dj296RmE.js.map → p-DQQFN2sw.js.map} +0 -0
- /package/dist/components/{p-CIoeHcCk.js.map → p-DTDLlinw.js.map} +0 -0
- /package/dist/components/{p-CqeMumqy.js.map → p-DdspY23v.js.map} +0 -0
- /package/dist/components/{p-DzbEJN1A.js.map → p-Dk-8Ju0Q.js.map} +0 -0
- /package/dist/components/{p-Da9VpZX2.js.map → p-DtLQIMsa.js.map} +0 -0
- /package/dist/components/{p-Cw_npFwN.js.map → p-FPZbS19l.js.map} +0 -0
- /package/dist/components/{p-BMERUCe1.js.map → p-KBrC9IG4.js.map} +0 -0
- /package/dist/components/{p-CIYJhyKt.js.map → p-beCz9OnD.js.map} +0 -0
- /package/dist/components/{p-4DNyCYKM.js.map → p-mpk_Mm8_.js.map} +0 -0
- /package/dist/components/{p-DrjY8Mpy.js.map → p-n68x-ZKp.js.map} +0 -0
- /package/dist/components/{p-CNDTHTf6.js.map → p-omPm8_vx.js.map} +0 -0
- /package/dist/components/{p-lv4YQEsa.js.map → p-umAf0fBn.js.map} +0 -0
- /package/dist/components/{p-CBQzTgvI.js.map → p-y06IxxoN.js.map} +0 -0
- /package/dist/components/{p-CoE7yza3.js.map → p-yZRXPHDe.js.map} +0 -0
|
@@ -5,7 +5,7 @@ import type { MobileHeaderTone } from '../MobileHeader/mobile-header-types';
|
|
|
5
5
|
import type { PanelNavGroup, PanelNavItem, PanelNavRouterMode } from '../PanelNav/panel-nav-types';
|
|
6
6
|
import type { PanelToolsHeaders, PanelToolsHeaderAction, PanelToolsItem, PanelToolsRailAccessory } from '../PanelTools/panel-tools-types';
|
|
7
7
|
import type { NavChromeStyle } from '../../shell/nav-chrome';
|
|
8
|
-
import type { ShellPageContentInset, ShellPageContentSurface } from '../ShellPage/shell-page-types';
|
|
8
|
+
import type { ShellPageContentInset, ShellPageContentSurface, ShellPageHeaderPresentation } from '../ShellPage/shell-page-types';
|
|
9
9
|
export type ShellAppComposition = 'managed' | 'slotted';
|
|
10
10
|
export type ShellSectionNavigation = 'bar' | 'panel';
|
|
11
11
|
/**
|
|
@@ -48,6 +48,8 @@ export interface ShellNavigationConfig {
|
|
|
48
48
|
* the intentionally different mobile MobileHeader presentation.
|
|
49
49
|
*/
|
|
50
50
|
export interface ShellPageChromeConfig {
|
|
51
|
+
/** Explicit presentation for the page-local title. */
|
|
52
|
+
headerPresentation?: ShellPageHeaderPresentation;
|
|
51
53
|
heading?: string;
|
|
52
54
|
/** Desktop/tablet route-navigation heading when it differs from the page h1. */
|
|
53
55
|
routeHeading?: string;
|
|
@@ -60,7 +60,10 @@
|
|
|
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
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
|
+
"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.",
|
|
64
|
+
"Embedded mode renders the same controlled content inside a parent-owned surface; the parent owns positioning, initial focus, Escape, Tab exit, and dismissal.",
|
|
65
|
+
"Apply-required filtering stages edits locally, including match mode. Clear immediately emits dsClear and discards pending edits. The footer appears when filters are selected or applied; Apply stays in place and inactive without pending changes; applying emits controlled changes. Closing discards unapplied edits.",
|
|
66
|
+
"Vertical presentation renders initially expanded, independently collapsible filter categories and emits edits immediately to its controlled owner. The owning panel supplies the draft and action footer."
|
|
64
67
|
],
|
|
65
68
|
"responsiveBehavior": [
|
|
66
69
|
"The popup defaults to the large menu-width token and clamps to the nearest data-ds-overlay-boundary rectangle or the viewport fallback.",
|
|
@@ -98,8 +101,7 @@
|
|
|
98
101
|
"attribute": "active-fill",
|
|
99
102
|
"default": "false",
|
|
100
103
|
"required": false,
|
|
101
|
-
"mutable": false
|
|
102
|
-
"description": "Show selected interaction fill when one or more criteria are active."
|
|
104
|
+
"mutable": false
|
|
103
105
|
},
|
|
104
106
|
"activeFilterId": {
|
|
105
107
|
"type": "string | undefined",
|
|
@@ -142,6 +144,15 @@
|
|
|
142
144
|
"mutable": false,
|
|
143
145
|
"description": "ID of the external trigger element used for positioning and focus return."
|
|
144
146
|
},
|
|
147
|
+
"applyRequired": {
|
|
148
|
+
"type": "boolean",
|
|
149
|
+
"resolvedType": "boolean",
|
|
150
|
+
"attribute": "apply-required",
|
|
151
|
+
"default": "false",
|
|
152
|
+
"required": false,
|
|
153
|
+
"mutable": false,
|
|
154
|
+
"description": "Stage filter edits until Apply is pressed."
|
|
155
|
+
},
|
|
145
156
|
"ariaLabel": {
|
|
146
157
|
"type": "string | null",
|
|
147
158
|
"resolvedType": "null | string",
|
|
@@ -185,6 +196,15 @@
|
|
|
185
196
|
"mutable": false,
|
|
186
197
|
"description": "Opt into table-caption icon-only chrome below 900px. The trigger omits its\nvisible label and chevron; keep an accessible name via aria-label."
|
|
187
198
|
},
|
|
199
|
+
"embedded": {
|
|
200
|
+
"type": "boolean",
|
|
201
|
+
"resolvedType": "boolean",
|
|
202
|
+
"attribute": "embedded",
|
|
203
|
+
"default": "false",
|
|
204
|
+
"required": false,
|
|
205
|
+
"mutable": false,
|
|
206
|
+
"description": "Render content inside a parent-owned surface; the parent owns dismissal and positioning."
|
|
207
|
+
},
|
|
188
208
|
"filters": {
|
|
189
209
|
"type": "FilterMenuFilter[]",
|
|
190
210
|
"resolvedType": "FilterMenuFilter[]",
|
|
@@ -208,8 +228,7 @@
|
|
|
208
228
|
"attribute": "has-border",
|
|
209
229
|
"default": "true",
|
|
210
230
|
"required": false,
|
|
211
|
-
"mutable": false
|
|
212
|
-
"description": "Show the surface-aware inset border around the select trigger."
|
|
231
|
+
"mutable": false
|
|
213
232
|
},
|
|
214
233
|
"icon": {
|
|
215
234
|
"type": "string | undefined",
|
|
@@ -263,6 +282,15 @@
|
|
|
263
282
|
"mutable": false,
|
|
264
283
|
"description": "Popup width. It remains clamped to its collision boundary by the component recipe."
|
|
265
284
|
},
|
|
285
|
+
"neutralTrigger": {
|
|
286
|
+
"type": "boolean",
|
|
287
|
+
"resolvedType": "boolean",
|
|
288
|
+
"attribute": "neutral-trigger",
|
|
289
|
+
"default": "false",
|
|
290
|
+
"required": false,
|
|
291
|
+
"mutable": false,
|
|
292
|
+
"description": "Keep trigger colors neutral when a value is selected."
|
|
293
|
+
},
|
|
266
294
|
"noResultsText": {
|
|
267
295
|
"type": "string",
|
|
268
296
|
"resolvedType": "string",
|
|
@@ -278,8 +306,7 @@
|
|
|
278
306
|
"attribute": "open",
|
|
279
307
|
"default": "false",
|
|
280
308
|
"required": false,
|
|
281
|
-
"mutable": true
|
|
282
|
-
"description": "Controlled popup visibility."
|
|
309
|
+
"mutable": true
|
|
283
310
|
},
|
|
284
311
|
"searchPlaceholder": {
|
|
285
312
|
"type": "string",
|
|
@@ -290,6 +317,15 @@
|
|
|
290
317
|
"mutable": false,
|
|
291
318
|
"description": "Placeholder shown in each non-date option search header."
|
|
292
319
|
},
|
|
320
|
+
"showIndicator": {
|
|
321
|
+
"type": "boolean",
|
|
322
|
+
"resolvedType": "boolean",
|
|
323
|
+
"attribute": "show-indicator",
|
|
324
|
+
"default": "true",
|
|
325
|
+
"required": false,
|
|
326
|
+
"mutable": false,
|
|
327
|
+
"description": "Show the trigger chevron."
|
|
328
|
+
},
|
|
293
329
|
"showSelectedCount": {
|
|
294
330
|
"type": "boolean",
|
|
295
331
|
"resolvedType": "boolean",
|
|
@@ -343,6 +379,15 @@
|
|
|
343
379
|
"mutable": false,
|
|
344
380
|
"description": "Controlled values keyed by filter id."
|
|
345
381
|
},
|
|
382
|
+
"vertical": {
|
|
383
|
+
"type": "boolean",
|
|
384
|
+
"resolvedType": "boolean",
|
|
385
|
+
"attribute": "vertical",
|
|
386
|
+
"default": "false",
|
|
387
|
+
"required": false,
|
|
388
|
+
"mutable": false,
|
|
389
|
+
"description": "Stacked, collapsible sections for a configuration panel."
|
|
390
|
+
},
|
|
346
391
|
"width": {
|
|
347
392
|
"type": "FilterMenuWidth",
|
|
348
393
|
"resolvedType": "\"fill\" | \"hug\"",
|
|
@@ -421,8 +466,7 @@
|
|
|
421
466
|
"attribute": "active-fill",
|
|
422
467
|
"default": "false",
|
|
423
468
|
"required": false,
|
|
424
|
-
"mutable": false
|
|
425
|
-
"description": "Show selected interaction fill when one or more criteria are active."
|
|
469
|
+
"mutable": false
|
|
426
470
|
},
|
|
427
471
|
"activeFilterId": {
|
|
428
472
|
"type": "string | undefined",
|
|
@@ -465,6 +509,15 @@
|
|
|
465
509
|
"mutable": false,
|
|
466
510
|
"description": "ID of the external trigger element used for positioning and focus return."
|
|
467
511
|
},
|
|
512
|
+
"applyRequired": {
|
|
513
|
+
"type": "boolean",
|
|
514
|
+
"resolvedType": "boolean",
|
|
515
|
+
"attribute": "apply-required",
|
|
516
|
+
"default": "false",
|
|
517
|
+
"required": false,
|
|
518
|
+
"mutable": false,
|
|
519
|
+
"description": "Stage filter edits until Apply is pressed."
|
|
520
|
+
},
|
|
468
521
|
"ariaLabel": {
|
|
469
522
|
"type": "string | null",
|
|
470
523
|
"resolvedType": "null | string",
|
|
@@ -508,6 +561,15 @@
|
|
|
508
561
|
"mutable": false,
|
|
509
562
|
"description": "Opt into table-caption icon-only chrome below 900px. The trigger omits its\nvisible label and chevron; keep an accessible name via aria-label."
|
|
510
563
|
},
|
|
564
|
+
"embedded": {
|
|
565
|
+
"type": "boolean",
|
|
566
|
+
"resolvedType": "boolean",
|
|
567
|
+
"attribute": "embedded",
|
|
568
|
+
"default": "false",
|
|
569
|
+
"required": false,
|
|
570
|
+
"mutable": false,
|
|
571
|
+
"description": "Render content inside a parent-owned surface; the parent owns dismissal and positioning."
|
|
572
|
+
},
|
|
511
573
|
"filters": {
|
|
512
574
|
"type": "FilterMenuFilter[]",
|
|
513
575
|
"resolvedType": "FilterMenuFilter[]",
|
|
@@ -531,8 +593,7 @@
|
|
|
531
593
|
"attribute": "has-border",
|
|
532
594
|
"default": "true",
|
|
533
595
|
"required": false,
|
|
534
|
-
"mutable": false
|
|
535
|
-
"description": "Show the surface-aware inset border around the select trigger."
|
|
596
|
+
"mutable": false
|
|
536
597
|
},
|
|
537
598
|
"icon": {
|
|
538
599
|
"type": "string | undefined",
|
|
@@ -586,6 +647,15 @@
|
|
|
586
647
|
"mutable": false,
|
|
587
648
|
"description": "Popup width. It remains clamped to its collision boundary by the component recipe."
|
|
588
649
|
},
|
|
650
|
+
"neutralTrigger": {
|
|
651
|
+
"type": "boolean",
|
|
652
|
+
"resolvedType": "boolean",
|
|
653
|
+
"attribute": "neutral-trigger",
|
|
654
|
+
"default": "false",
|
|
655
|
+
"required": false,
|
|
656
|
+
"mutable": false,
|
|
657
|
+
"description": "Keep trigger colors neutral when a value is selected."
|
|
658
|
+
},
|
|
589
659
|
"noResultsText": {
|
|
590
660
|
"type": "string",
|
|
591
661
|
"resolvedType": "string",
|
|
@@ -601,8 +671,7 @@
|
|
|
601
671
|
"attribute": "open",
|
|
602
672
|
"default": "false",
|
|
603
673
|
"required": false,
|
|
604
|
-
"mutable": true
|
|
605
|
-
"description": "Controlled popup visibility."
|
|
674
|
+
"mutable": true
|
|
606
675
|
},
|
|
607
676
|
"searchPlaceholder": {
|
|
608
677
|
"type": "string",
|
|
@@ -613,6 +682,15 @@
|
|
|
613
682
|
"mutable": false,
|
|
614
683
|
"description": "Placeholder shown in each non-date option search header."
|
|
615
684
|
},
|
|
685
|
+
"showIndicator": {
|
|
686
|
+
"type": "boolean",
|
|
687
|
+
"resolvedType": "boolean",
|
|
688
|
+
"attribute": "show-indicator",
|
|
689
|
+
"default": "true",
|
|
690
|
+
"required": false,
|
|
691
|
+
"mutable": false,
|
|
692
|
+
"description": "Show the trigger chevron."
|
|
693
|
+
},
|
|
616
694
|
"showSelectedCount": {
|
|
617
695
|
"type": "boolean",
|
|
618
696
|
"resolvedType": "boolean",
|
|
@@ -666,6 +744,15 @@
|
|
|
666
744
|
"mutable": false,
|
|
667
745
|
"description": "Controlled values keyed by filter id."
|
|
668
746
|
},
|
|
747
|
+
"vertical": {
|
|
748
|
+
"type": "boolean",
|
|
749
|
+
"resolvedType": "boolean",
|
|
750
|
+
"attribute": "vertical",
|
|
751
|
+
"default": "false",
|
|
752
|
+
"required": false,
|
|
753
|
+
"mutable": false,
|
|
754
|
+
"description": "Stacked, collapsible sections for a configuration panel."
|
|
755
|
+
},
|
|
669
756
|
"width": {
|
|
670
757
|
"type": "FilterMenuWidth",
|
|
671
758
|
"resolvedType": "\"fill\" | \"hug\"",
|
|
@@ -791,12 +878,12 @@
|
|
|
791
878
|
"files": [
|
|
792
879
|
{
|
|
793
880
|
"path": "src/wc/components/FilterMenu/FilterMenu.css",
|
|
794
|
-
"content": "@import '../../utils/radius.css';\n@import '../../utils/choice-list.css';\n@import '../../utils/chrome-header.css';\n@import '../../utils/control-parts.css';\n@import '../../utils/control-width.css';\n@import '../../utils/select-trigger.css';\n@import '../../utils/search-control.css';\n@import '../../utils/table-caption-control.css';\n\n:host(.filter-menu-host--external-trigger) {\n display: contents;\n}\n\n.filter-menu {\n display: flex;\n min-height: 0;\n flex-direction: column;\n color: var(--color-foreground-secondary);\n}\n\n.filter-menu__body {\n display: grid;\n grid-template-columns: var(--dimension-menu-width-xs) var(--dimension-menu-width-sm);\n min-height: calc(var(--dimension-size-800) * 4 + var(--dimension-space-150));\n max-height: calc(100vh - var(--dimension-size-800) - var(--dimension-size-600));\n}\n\n.filter-menu__category-pane {\n display: flex;\n min-width: 0;\n min-height: 0;\n flex-direction: column;\n border-inline-end: var(--dimension-stroke-width-012) solid var(--color-border-tertiary);\n}\n\n.filter-menu__categories {\n flex: 1 1 auto;\n min-width: 0;\n}\n\n.filter-menu__category-section {\n display: flex;\n min-width: 0;\n flex-direction: column;\n}\n\n.filter-menu__category-section.ds-choice-section--divided {\n padding-block-end: var(--dimension-space-050);\n}\n\n.filter-menu__category {\n justify-content: space-between;\n width: 100%;\n border: 0;\n background: transparent;\n color: var(--color-foreground-secondary);\n cursor: default;\n text-align: start;\n}\n\n.filter-menu__category--active {\n color: var(--color-foreground-primary);\n}\n\n.filter-menu__category-dot-box {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: var(--ds-control-icon, var(--dimension-iconography-md));\n height: var(--ds-control-icon, var(--dimension-iconography-md));\n pointer-events: none;\n}\n\n.filter-menu__options {\n display: flex;\n min-width: 0;\n min-height: 0;\n flex-direction: column;\n overflow: hidden;\n}\n\n.filter-menu__options-content {\n display: flex;\n min-width: 0;\n min-height: 0;\n flex: 1 1 auto;\n flex-direction: column;\n overflow: auto;\n}\n\n.filter-menu__option-search {\n position: relative;\n flex: 0 0 var(--dimension-size-500);\n min-width: 0;\n min-height: var(--dimension-size-500);\n background: transparent;\n}\n\n.filter-menu__option-search::after {\n content: '';\n position: absolute;\n inset: auto 0 0;\n height: var(--dimension-stroke-width-012);\n background-color: var(--color-border-tertiary);\n pointer-events: none;\n}\n\n.filter-menu__option-search .select-search {\n height: 100%;\n background: transparent;\n}\n\n.filter-menu__options--date,\n.filter-menu__option-list--date,\n.filter-menu__date {\n display: flex;\n min-width: 0;\n min-height: 0;\n flex-direction: column;\n}\n\n.filter-menu__option-list--date,\n.filter-menu__date {\n flex: 1 1 auto;\n}\n\n.filter-menu__date-header {\n flex: 0 0 var(--dimension-size-500);\n justify-content: center;\n min-block-size: var(--dimension-size-500);\n padding: var(--dimension-space-050);\n background: var(--color-background-secondary);\n}\n\n.filter-menu__date-body {\n display: flex;\n flex: 1 1 auto;\n min-height: 0;\n flex-direction: column;\n}\n\n.filter-menu__date-relative {\n flex: 1 1 auto;\n}\n\n.filter-menu__calendar {\n display: flex;\n min-height: 0;\n flex-direction: column;\n padding: var(--dimension-space-100);\n}\n\n.filter-menu__calendar-heading {\n display: grid;\n grid-template-columns: var(--dimension-size-400) minmax(0, 1fr) var(--dimension-size-400);\n align-items: center;\n text-align: center;\n}\n\n.filter-menu__calendar-nav--previous {\n justify-self: start;\n}\n\n.filter-menu__calendar-nav--next {\n justify-self: end;\n}\n\n.filter-menu__calendar-weekdays,\n.filter-menu__calendar-grid {\n display: grid;\n grid-template-columns: repeat(7, minmax(0, 1fr));\n column-gap: var(--dimension-space-050);\n}\n\n.filter-menu__calendar-grid {\n row-gap: var(--dimension-space-050);\n}\n\n.filter-menu__calendar-weekdays {\n align-items: center;\n min-height: var(--dimension-size-400);\n margin-block-start: var(--dimension-space-050);\n color: var(--color-foreground-secondary);\n text-align: center;\n}\n\n.filter-menu__calendar-day {\n appearance: none;\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n min-width: 0;\n width: 100%;\n height: var(--dimension-size-400);\n padding: 0;\n border: 0;\n border-radius: var(--dimension-radius-025);\n background: transparent;\n color: var(--color-foreground-primary);\n cursor: default;\n}\n\n.filter-menu__calendar-day--outside {\n color: var(--color-foreground-tertiary);\n}\n\n.filter-menu__calendar-day--in-range {\n background: var(--color-background-faint-brand);\n color: var(--color-foreground-primary);\n}\n\n/* Pending range preview stays faint while the already-selected start keeps its bold edge. */\n.filter-menu__calendar-day--range-preview {\n background: var(--color-background-faint-brand);\n}\n\n.filter-menu__calendar-day--today {\n color: var(--color-foreground-primary);\n}\n\n.filter-menu__calendar-day--range-edge {\n background: var(--color-background-bold-brand);\n color: var(--color-foreground-on-bold-background-primary);\n}\n\n.filter-menu__footer {\n flex: 0 0 auto;\n}\n\n.filter-menu__footer--categories-clear .ds-choice-footer__content {\n justify-content: flex-start;\n}\n\n.filter-menu__footer--categories-clear[aria-hidden='true']::before {\n visibility: hidden;\n}\n\n.filter-menu__clear {\n color: var(--color-foreground-bold-brand);\n}\n\n.filter-menu__match-mode-footer {\n flex: 0 0 auto;\n}\n\n.filter-menu__match-mode-content {\n justify-content: flex-start;\n padding-inline: calc(\n var(--dimension-space-050) + var(--ds-control-padding-inline, var(--dimension-space-075)) +\n var(--ds-control-label-inset, var(--dimension-space-025))\n );\n}\n\n.filter-menu__match-mode-toggle {\n appearance: none;\n display: inline-flex;\n align-items: center;\n padding: 0;\n border: 0;\n border-radius: var(--dimension-radius-025);\n background: transparent;\n cursor: default;\n}\n\n@media (forced-colors: active) {\n .filter-menu__category-pane {\n border-inline-end-color: var(--ds-forced-color-content);\n }\n\n .filter-menu__calendar-day--range-edge {\n outline: var(--dimension-stroke-width-012) solid var(--ds-forced-color-content);\n }\n}\n",
|
|
881
|
+
"content": "@import '../../utils/radius.css';\n@import '../../utils/choice-list.css';\n@import '../../utils/chrome-header.css';\n@import '../../utils/control-parts.css';\n@import '../../utils/control-width.css';\n@import '../../utils/select-trigger.css';\n@import '../../utils/search-control.css';\n@import '../../utils/table-caption-control.css';\n\n:host(.filter-menu-host--external-trigger) {\n display: contents;\n}\n\n.filter-menu {\n display: flex;\n min-height: 0;\n flex-direction: column;\n color: var(--color-foreground-secondary);\n}\n\n.filter-menu__body {\n display: grid;\n grid-template-columns: var(--dimension-menu-width-xs) var(--dimension-menu-width-sm);\n min-height: calc(var(--dimension-size-800) * 4 + var(--dimension-space-150));\n max-height: calc(100vh - var(--dimension-size-800) - var(--dimension-size-600));\n}\n\n.filter-menu__category-pane {\n display: flex;\n min-width: 0;\n min-height: 0;\n flex-direction: column;\n border-inline-end: var(--dimension-stroke-width-012) solid var(--color-border-tertiary);\n}\n\n.filter-menu__categories {\n flex: 1 1 auto;\n min-width: 0;\n}\n\n.filter-menu__category-section {\n display: flex;\n min-width: 0;\n flex-direction: column;\n}\n\n.filter-menu__category-section.ds-choice-section--divided {\n padding-block-end: var(--dimension-space-050);\n}\n\n.filter-menu__category {\n justify-content: space-between;\n width: 100%;\n border: 0;\n background: transparent;\n color: var(--color-foreground-secondary);\n cursor: default;\n text-align: start;\n}\n\n.filter-menu__category--active {\n color: var(--color-foreground-primary);\n}\n\n.filter-menu__category-dot-box {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: var(--ds-control-icon, var(--dimension-iconography-md));\n height: var(--ds-control-icon, var(--dimension-iconography-md));\n pointer-events: none;\n}\n\n.filter-menu__options {\n display: flex;\n min-width: 0;\n min-height: 0;\n flex-direction: column;\n overflow: hidden;\n}\n\n.filter-menu__options-content {\n display: flex;\n min-width: 0;\n min-height: 0;\n flex: 1 1 auto;\n flex-direction: column;\n overflow: auto;\n}\n\n.filter-menu__option-search {\n position: relative;\n flex: 0 0 var(--dimension-size-500);\n min-width: 0;\n min-height: var(--dimension-size-500);\n background: transparent;\n}\n\n.filter-menu__option-search::after {\n content: '';\n position: absolute;\n inset: auto 0 0;\n height: var(--dimension-stroke-width-012);\n background-color: var(--color-border-tertiary);\n pointer-events: none;\n}\n\n.filter-menu__option-search .select-search {\n height: 100%;\n background: transparent;\n}\n\n.filter-menu__options--date,\n.filter-menu__option-list--date,\n.filter-menu__date {\n display: flex;\n min-width: 0;\n min-height: 0;\n flex-direction: column;\n}\n\n.filter-menu__option-list--date,\n.filter-menu__date {\n flex: 1 1 auto;\n}\n\n.filter-menu__date-header {\n flex: 0 0 var(--dimension-size-500);\n justify-content: center;\n min-block-size: var(--dimension-size-500);\n padding: var(--dimension-space-050);\n background: var(--color-background-secondary);\n}\n\n.filter-menu__date-body {\n display: flex;\n flex: 1 1 auto;\n min-height: 0;\n flex-direction: column;\n}\n\n.filter-menu__date-relative {\n flex: 1 1 auto;\n}\n\n.filter-menu__calendar {\n display: flex;\n min-height: 0;\n flex-direction: column;\n padding: var(--dimension-space-100);\n}\n\n.filter-menu__calendar-heading {\n display: grid;\n grid-template-columns: var(--dimension-size-400) minmax(0, 1fr) var(--dimension-size-400);\n align-items: center;\n text-align: center;\n}\n\n.filter-menu__calendar-nav--previous {\n justify-self: start;\n}\n\n.filter-menu__calendar-nav--next {\n justify-self: end;\n}\n\n.filter-menu__calendar-weekdays,\n.filter-menu__calendar-grid {\n display: grid;\n grid-template-columns: repeat(7, minmax(0, 1fr));\n column-gap: var(--dimension-space-050);\n}\n\n.filter-menu__calendar-grid {\n row-gap: var(--dimension-space-050);\n}\n\n.filter-menu__calendar-weekdays {\n align-items: center;\n min-height: var(--dimension-size-400);\n margin-block-start: var(--dimension-space-050);\n color: var(--color-foreground-secondary);\n text-align: center;\n}\n\n.filter-menu__calendar-day {\n appearance: none;\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n min-width: 0;\n width: 100%;\n height: var(--dimension-size-400);\n padding: 0;\n border: 0;\n border-radius: var(--dimension-radius-025);\n background: transparent;\n color: var(--color-foreground-primary);\n cursor: default;\n}\n\n.filter-menu__calendar-day--outside {\n color: var(--color-foreground-tertiary);\n}\n\n.filter-menu__calendar-day--in-range {\n background: var(--color-background-faint-brand);\n color: var(--color-foreground-primary);\n}\n\n/* Pending range preview stays faint while the already-selected start keeps its bold edge. */\n.filter-menu__calendar-day--range-preview {\n background: var(--color-background-faint-brand);\n}\n\n.filter-menu__calendar-day--today {\n color: var(--color-foreground-primary);\n}\n\n.filter-menu__calendar-day--range-edge {\n background: var(--color-background-bold-brand);\n color: var(--color-foreground-on-bold-background-primary);\n}\n\n.filter-menu__footer {\n flex: 0 0 auto;\n}\n\n.filter-menu__footer--categories-clear .ds-choice-footer__content {\n justify-content: flex-start;\n}\n\n.filter-menu__footer--categories-clear[aria-hidden='true']::before {\n visibility: hidden;\n}\n\n.ds-choice-footer__content:has(.filter-menu__apply) {\n column-gap: var(--dimension-space-100);\n}\n\n.filter-menu__apply ds-text {\n padding-right: 0;\n}\n\n.filter-menu__action-separator + .filter-menu__clear ds-text {\n padding-left: 0;\n}\n\n.filter-menu__apply {\n color: var(--color-foreground-bold-brand);\n}\n\n.filter-menu__apply:disabled {\n color: var(--color-foreground-tertiary);\n text-decoration-line: none;\n}\n\n.filter-menu__clear {\n --ds-text-action-foreground: var(--color-foreground-bold-negative);\n\n color: var(--ds-text-action-foreground);\n}\n\n.filter-menu__match-mode-footer {\n flex: 0 0 auto;\n}\n\n.filter-menu__match-mode-content {\n justify-content: flex-start;\n padding-inline: calc(\n var(--dimension-space-050) + var(--ds-control-padding-inline, var(--dimension-space-075)) +\n var(--ds-control-label-inset, var(--dimension-space-025))\n );\n}\n\n.filter-menu__match-mode-toggle {\n appearance: none;\n display: inline-flex;\n align-items: center;\n padding: 0;\n border: 0;\n border-radius: var(--dimension-radius-025);\n background: transparent;\n cursor: default;\n}\n\n@media (forced-colors: active) {\n .filter-menu__category-pane {\n border-inline-end-color: var(--ds-forced-color-content);\n }\n\n .filter-menu__calendar-day--range-edge {\n outline: var(--dimension-stroke-width-012) solid var(--ds-forced-color-content);\n }\n}\n\n.table-preferences-embedded {\n display: flex;\n flex-direction: column;\n min-width: 0;\n min-height: 0;\n color: var(--color-foreground-secondary);\n}\n\n.table-preferences-embedded .filter-menu__body {\n grid-template-columns: min(var(--dimension-menu-width-xs), 40%) minmax(0, 1fr);\n}\n\n.filter-menu-vertical__section {\n border-bottom: var(--dimension-stroke-width-012) solid var(--color-border-tertiary);\n}\n.filter-menu-vertical__section > summary {\n cursor: default;\n padding: var(--dimension-space-200);\n}\n.filter-menu-vertical__section > summary ds-text {\n display: inline;\n}\n\n.filter-menu-vertical__section > summary {\n display: flex;\n align-items: center;\n gap: var(--dimension-space-100);\n list-style: none;\n}\n.filter-menu-vertical__section > summary::-webkit-details-marker {\n display: none;\n}\n.filter-menu-vertical__section:not([open]) .filter-menu-vertical__chevron {\n transform: rotate(-90deg);\n}\n",
|
|
795
882
|
"type": "registry:ui"
|
|
796
883
|
},
|
|
797
884
|
{
|
|
798
885
|
"path": "src/wc/components/FilterMenu/FilterMenu.tsx",
|
|
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",
|
|
886
|
+
"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 /** Render content inside a parent-owned surface; the parent owns dismissal and positioning. */\n @Prop() embedded: boolean = false;\n /** Stacked, collapsible sections for a configuration panel. */\n @Prop() vertical: boolean = false;\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 /** Show the trigger chevron. */\n @Prop() showIndicator: boolean = true;\n @Prop() hasBorder: boolean = true;\n /** Show selected interaction fill when one or more criteria are active. */\n /** Keep trigger colors neutral when a value is selected. */\n @Prop() neutralTrigger: boolean = false;\n /** Stage filter edits until Apply is pressed. */\n @Prop() applyRequired: boolean = false;\n @State() private draftValues?: FilterMenuValues;\n @State() private draftModes?: FilterMenuMatchModes;\n\n private changeValue(detail: FilterMenuChangeDetail): void {\n if (this.applyRequired)\n this.draftValues = { ...(this.draftValues ?? this.values), [detail.filterId]: detail.value };\n else this.dsChange.emit(detail);\n }\n private changeMode(detail: FilterMenuMatchModeChangeDetail): void {\n if (this.applyRequired)\n this.draftModes = { ...(this.draftModes ?? this.matchModes), [detail.filterId]: detail.mode };\n else this.dsMatchModeChange.emit(detail);\n }\n private get hasPendingChanges(): boolean {\n const normalize = (value: FilterMenuValue | undefined) =>\n Array.isArray(value) ? (value.length ? [...value].sort() : undefined) : value || undefined;\n const values = this.draftValues ?? this.values;\n const modes = this.draftModes ?? this.matchModes;\n return this.filters.some(\n filter =>\n JSON.stringify(normalize(values[filter.id])) !==\n JSON.stringify(normalize(this.values[filter.id])) ||\n (modes[filter.id] ?? 'any') !== (this.matchModes[filter.id] ?? 'any')\n );\n }\n private applyDraft(): void {\n if (!this.hasPendingChanges) return;\n if (this.draftValues && Object.keys(this.draftValues).length === 0) {\n this.dsClear.emit();\n } else if (this.draftValues) {\n for (const id of new Set([...Object.keys(this.values), ...Object.keys(this.draftValues)])) {\n if (JSON.stringify(this.values[id]) !== JSON.stringify(this.draftValues[id]))\n this.dsChange.emit({\n filterId: id,\n value:\n this.draftValues[id] ??\n (Array.isArray(this.values[id])\n ? []\n : typeof this.values[id] === 'boolean'\n ? false\n : ''),\n });\n }\n }\n if (this.draftModes) {\n for (const filterId of new Set([\n ...Object.keys(this.matchModes),\n ...Object.keys(this.draftModes),\n ])) {\n const mode = this.draftModes[filterId] ?? 'any';\n if ((this.matchModes[filterId] ?? 'any') !== mode)\n this.dsMatchModeChange.emit({ filterId, mode });\n }\n }\n }\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.draftValues = undefined;\n this.draftModes = undefined;\n }\n if (this.embedded) return;\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.embedded && (event.key === 'Escape' || event.key === 'Tab')) return;\n if ((!this.shouldRender && !this.embedded) || 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.embedded && !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.changeValue({ 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.changeValue({ 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.changeValue({\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.changeValue({ 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.changeValue({ filterId: filter.id, value: value !== true });\n }\n }}\n onHover={() => {\n this.focusRingVisible = false;\n }}\n onSelect={() => this.changeValue({ 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 const appliedCount = this.totalSelected(this.filters, this.values);\n if (this.applyRequired && totalSelected === 0 && appliedCount === 0) return null;\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={\n !this.applyRequired &&\n categoriesClear &&\n totalSelected === 0 &&\n !this.draftValues &&\n !this.draftModes\n ? 'true'\n : undefined\n }\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 {this.applyRequired ? (\n <button\n class=\"filter-menu__apply ds-choice-footer__clear ds-text-action\"\n type=\"button\"\n disabled={!this.hasPendingChanges}\n onClick={() => this.applyDraft()}\n >\n <ds-text as=\"span\" variant=\"text-body-medium\" color=\"inherit\">\n Apply\n </ds-text>\n </button>\n ) : null}\n {this.applyRequired && (totalSelected > 0 || appliedCount > 0) ? (\n <ds-text\n class=\"filter-menu__action-separator\"\n as=\"span\"\n variant=\"text-body-medium\"\n color=\"tertiary\"\n aria-hidden=\"true\"\n >\n ·\n </ds-text>\n ) : null}\n {totalSelected > 0 || (this.applyRequired && appliedCount > 0) ? (\n <button\n class=\"filter-menu__clear ds-choice-footer__clear ds-text-action\"\n type=\"button\"\n onClick={() => {\n this.pendingRangeStartByFilter = {};\n if (this.applyRequired) {\n this.draftValues = {};\n this.draftModes = {};\n }\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.changeMode({ 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 if (this.vertical)\n return (\n <Host class=\"filter-menu-vertical\">\n {this.filters.map(filter => (\n <details open key={filter.id} class=\"filter-menu-vertical__section\">\n <summary>\n <ds-icon class=\"filter-menu-vertical__chevron\" name=\"ChevronDown\" size=\"md\" />\n <ds-text variant=\"text-body-medium\" emphasis>\n {filter.label}\n </ds-text>\n </summary>\n {filter.kind !== 'date' && this.renderOptionSearch(filter)}\n <div\n id={`${this.generatedId}-${filter.id}-options`}\n role={filter.kind === 'date' ? undefined : 'listbox'}\n aria-label={filter.label}\n aria-multiselectable={filter.kind === 'multiple' ? 'true' : undefined}\n class=\"ds-choice-list ds-chrome-column ds-chrome-space--sm\"\n >\n {this.renderOptions(filter, this.values)}\n </div>\n {filter.kind === 'multiple' && this.renderMatchModeFooter(filter, this.matchModes)}\n </details>\n ))}\n </Host>\n );\n const state =\n this.closing && this.closingSnapshot\n ? this.closingSnapshot\n : {\n filters: this.filters,\n values: this.draftValues ?? this.values,\n matchModes: this.draftModes ?? 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 && !this.neutralTrigger,\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 || !this.showIndicator ? 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 || this.embedded ? (\n <div\n id={popupId}\n popover={this.embedded ? undefined : 'manual'}\n class={{\n 'filter-menu-popup': true,\n 'ds-choice-popup': !this.embedded,\n 'table-preferences-embedded': this.embedded,\n 'ds-choice-popup--closing': this.closing,\n }}\n style={this.embedded ? undefined : 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",
|
|
800
887
|
"type": "registry:ui"
|
|
801
888
|
},
|
|
802
889
|
{
|