@ds-mo/ui 14.27.1 → 14.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.package-ready.json +1 -1
- package/dist/agent-patterns.json +28 -18
- package/dist/agent.json +436 -33
- package/dist/angular/ds-button-filled.d.ts +1 -1
- package/dist/angular/ds-button-filled.js +3 -3
- package/dist/angular/ds-button-unfilled.d.ts +1 -1
- package/dist/angular/ds-button-unfilled.js +3 -3
- package/dist/angular/ds-card-navigation.d.ts +20 -0
- package/dist/angular/ds-card-navigation.js +42 -0
- package/dist/angular/ds-card-settings-scope.d.ts +19 -0
- package/dist/angular/ds-card-settings-scope.js +42 -0
- package/dist/angular/ds-menu.d.ts +1 -1
- package/dist/angular/ds-menu.js +3 -3
- package/dist/angular/ds-mobile-bar-nav.d.ts +1 -1
- package/dist/angular/ds-mobile-bar-nav.js +3 -3
- package/dist/angular/ds-mobile-header.d.ts +1 -1
- package/dist/angular/ds-mobile-header.js +3 -3
- package/dist/angular/ds-mobile-section-switcher.d.ts +1 -1
- package/dist/angular/ds-mobile-section-switcher.js +3 -3
- package/dist/angular/ds-mobile-sheet-nav.d.ts +7 -1
- package/dist/angular/ds-mobile-sheet-nav.js +7 -4
- package/dist/angular/ds-panel-nav.d.ts +1 -1
- package/dist/angular/ds-panel-nav.js +3 -3
- package/dist/angular/ds-panel-tool-header.d.ts +1 -1
- package/dist/angular/ds-panel-tool-header.js +3 -3
- package/dist/angular/ds-panel-tool-search.d.ts +1 -1
- package/dist/angular/ds-panel-tool-search.js +3 -3
- package/dist/angular/ds-table.d.ts +1 -1
- package/dist/angular/ds-table.js +3 -3
- package/dist/angular/ds-tag.d.ts +1 -1
- package/dist/angular/ds-tag.js +3 -3
- package/dist/angular/index.d.ts +1 -1
- package/dist/angular/index.js +2 -0
- package/dist/angular/proxies.d.ts +2 -0
- package/dist/angular/proxies.js +2 -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-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-chart.js +1 -1
- package/dist/components/ds-card-navigation.d.ts +11 -0
- package/dist/components/ds-card-navigation.js +2 -0
- package/dist/components/ds-card-navigation.js.map +1 -0
- package/dist/components/ds-card-overview.js +1 -1
- package/dist/components/ds-card-overview.js.map +1 -1
- package/dist/components/ds-card-setting.js +1 -1
- package/dist/components/ds-card-settings-scope.d.ts +11 -0
- package/dist/components/ds-card-settings-scope.js +2 -0
- package/dist/components/ds-card-settings-scope.js.map +1 -0
- package/dist/components/ds-chart-legend.js +1 -1
- package/dist/components/ds-chart-legend.js.map +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-item.js.map +1 -1
- package/dist/components/ds-conversation-list-section.js +1 -1
- package/dist/components/ds-conversation-list.js +1 -1
- package/dist/components/ds-divider.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-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-sub-nav.js.map +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-tool-search.js.map +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-group.js +1 -1
- package/dist/components/ds-table-group.js.map +1 -1
- 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.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-textarea.js.map +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--yvQzZoO.js +2 -0
- package/dist/components/p--yvQzZoO.js.map +1 -0
- package/dist/components/{p-Is1lFmwp.js → p-1gt8QlyW.js} +2 -2
- package/dist/components/p-B5AZd41L.js +2 -0
- package/dist/components/p-B5AZd41L.js.map +1 -0
- package/dist/components/p-B5eMVBlz.js +2 -0
- package/dist/components/p-B5eMVBlz.js.map +1 -0
- package/dist/components/{p-Q7AOgrg5.js → p-BCFpqnAg.js} +2 -2
- package/dist/components/p-BFHWoNH3.js +2 -0
- package/dist/components/{p-BVz-r3g0.js.map → p-BFHWoNH3.js.map} +1 -1
- package/dist/components/p-BGnRFtBa.js +2 -0
- package/dist/components/p-BGnRFtBa.js.map +1 -0
- package/dist/components/p-BIDGQ4tc.js +2 -0
- package/dist/components/p-BIDGQ4tc.js.map +1 -0
- package/dist/components/{p-Ctnm9NJP.js → p-BLTHIBsE.js} +2 -2
- package/dist/components/{p-C68oSTb1.js → p-BXT2opmZ.js} +2 -2
- package/dist/components/p-BZDQLjE0.js +2 -0
- package/dist/components/p-BZDQLjE0.js.map +1 -0
- package/dist/components/{p-Q0dkeoJ6.js → p-BdC7wxhu.js} +2 -2
- package/dist/components/{p-Q0dkeoJ6.js.map → p-BdC7wxhu.js.map} +1 -1
- package/dist/components/p-BfVlFinS.js +2 -0
- package/dist/components/{p-CQjUOHiN.js.map → p-BfVlFinS.js.map} +1 -1
- package/dist/components/{p-DGkn8FwV.js → p-Bl5wd3v3.js} +2 -2
- package/dist/components/p-BmRHJ_jo.js +2 -0
- package/dist/components/p-BmRHJ_jo.js.map +1 -0
- package/dist/components/{p-Bb9dA7sl.js → p-BpB2EF9g.js} +2 -2
- package/dist/components/{p-2wIPUcSL.js → p-BwAWZAHk.js} +2 -2
- package/dist/components/{p-B3sRZBZk.js → p-By5TDnbF.js} +2 -2
- package/dist/components/{p-BVpn_e-r.js → p-CDXcINTO.js} +2 -2
- package/dist/components/p-CDXcINTO.js.map +1 -0
- package/dist/components/{p-B3Z5sQin.js → p-CE8gsv7V.js} +2 -2
- package/dist/components/p-CLcwh1kq.js +2 -0
- package/dist/components/p-CLcwh1kq.js.map +1 -0
- package/dist/components/{p-DW8ssbfI.js → p-CN8PQLZu.js} +2 -2
- package/dist/components/p-CcK3UiTu.js +2 -0
- package/dist/components/{p-1604KY3B.js.map → p-CcK3UiTu.js.map} +1 -1
- package/dist/components/{p-CaF5WCci.js → p-Cocq-utR.js} +2 -2
- package/dist/components/p-Cr5vn5JO.js +2 -0
- package/dist/components/{p-to8BxxgT.js.map → p-Cr5vn5JO.js.map} +1 -1
- package/dist/components/{p-Cf5Ai4xx.js → p-Crd3PEUx.js} +2 -2
- package/dist/components/{p-Cf5Ai4xx.js.map → p-Crd3PEUx.js.map} +1 -1
- package/dist/components/{p-BZiGtBBk.js → p-Ct90k-nz.js} +2 -2
- package/dist/components/p-Cx2dWjaW.js +2 -0
- package/dist/components/p-Cx2dWjaW.js.map +1 -0
- package/dist/components/p-CyoLh8su.js +2 -0
- package/dist/components/p-CyoLh8su.js.map +1 -0
- package/dist/components/{p-BXDLR072.js → p-CysCSinT.js} +2 -2
- package/dist/components/{p-BXDLR072.js.map → p-CysCSinT.js.map} +1 -1
- package/dist/components/p-CzbsTZt7.js.map +1 -1
- package/dist/components/p-D1pPq-y0.js +2 -0
- package/dist/components/p-D1pPq-y0.js.map +1 -0
- package/dist/components/{p-VT-5XDkB.js → p-DDOuPq-N.js} +2 -2
- package/dist/components/{p-DkxOEFHN.js → p-DF8W85Tz.js} +2 -2
- package/dist/components/{p-DDqRCDXh.js → p-DSJSnQ1U.js} +2 -2
- package/dist/components/{p-Cr6pDY-e.js → p-DYK0slTb.js} +2 -2
- package/dist/components/{p-D9wZlB_N.js → p-D_QtZZR8.js} +2 -2
- package/dist/components/{p-Bv6FSDPR.js → p-DbDYEEWq.js} +2 -2
- package/dist/components/{p-BEXkJ9lg.js → p-DnQN0pLp.js} +2 -2
- package/dist/components/{p-DIqAdmui.js → p-FiM3rF7B.js} +2 -2
- package/dist/components/p-GbtafFds.js +2 -0
- package/dist/components/p-GbtafFds.js.map +1 -0
- package/dist/components/{p-WFo1x6dN.js → p-Hzz2j1Je.js} +2 -2
- package/dist/components/{p-B9esvbYk.js → p-K39w53Bw.js} +2 -2
- package/dist/components/p-K39w53Bw.js.map +1 -0
- package/dist/components/{p-DQQsS9Rx.js → p-aMyflqva.js} +2 -2
- package/dist/components/{p-DZcIt_JJ.js → p-dgep63_i.js} +2 -2
- package/dist/components/p-frKsmPQn.js +2 -0
- package/dist/components/p-frKsmPQn.js.map +1 -0
- package/dist/components/{p-BMzn2Cmw.js → p-rSC7ZUpy.js} +2 -2
- package/dist/docs/components.json +1025 -44
- package/dist/lib/components/ButtonFilled/ButtonFilled.d.ts +11 -3
- package/dist/lib/components/PanelTools/panel-tools-types.d.ts +2 -0
- package/dist/lib/components/ShellApp/shell-app-types.d.ts +2 -0
- package/dist/lib/shell/index.js.map +1 -1
- package/dist/lib/utils/choice-list.d.ts +2 -0
- package/dist/mcp-data/registry/bar-nav.json +7 -2
- package/dist/mcp-data/registry/bar-title.json +8 -3
- package/dist/mcp-data/registry/button-filled.json +26 -5
- package/dist/mcp-data/registry/button-unfilled.json +27 -6
- package/dist/mcp-data/registry/card-navigation.json +255 -0
- package/dist/mcp-data/registry/card-settings-scope.json +314 -0
- package/dist/mcp-data/registry/filter-menu.json +7 -2
- package/dist/mcp-data/registry/menu.json +21 -2
- package/dist/mcp-data/registry/mobile-bar-nav.json +20 -1
- package/dist/mcp-data/registry/mobile-header.json +23 -3
- package/dist/mcp-data/registry/mobile-section-switcher.json +50 -6
- package/dist/mcp-data/registry/mobile-sheet-nav.json +40 -3
- package/dist/mcp-data/registry/panel-nav.json +27 -6
- package/dist/mcp-data/registry/panel-tool-header.json +23 -2
- package/dist/mcp-data/registry/panel-tool-search.json +23 -2
- package/dist/mcp-data/registry/panel-tools.json +7 -2
- package/dist/mcp-data/registry/registry.json +441 -32
- package/dist/mcp-data/registry/select.json +8 -3
- package/dist/mcp-data/registry/shell-app.json +14 -8
- package/dist/mcp-data/registry/shell-tools.json +7 -2
- package/dist/mcp-data/registry/table-group.json +7 -2
- package/dist/mcp-data/registry/table-saved-views.json +7 -2
- package/dist/mcp-data/registry/table-search.json +7 -2
- package/dist/mcp-data/registry/table-sort.json +7 -2
- package/dist/mcp-data/registry/table.json +24 -3
- package/dist/mcp-data/registry/tag.json +24 -3
- package/dist/react/components.d.ts +2 -0
- package/dist/react/components.js +2 -0
- package/dist/react/ds-card-navigation.d.ts +12 -0
- package/dist/react/ds-card-navigation.js +12 -0
- package/dist/react/ds-card-settings-scope.d.ts +12 -0
- package/dist/react/ds-card-settings-scope.js +12 -0
- package/dist/react/ds-mobile-sheet-nav.d.ts +2 -1
- package/dist/react/ds-mobile-sheet-nav.js +1 -0
- package/dist/styles/table.css +1 -0
- package/dist/types/components/BarTitle/BarTitle.d.ts +3 -0
- package/dist/types/components/ButtonFilled/ButtonFilled.d.ts +11 -3
- package/dist/types/components/ButtonUnfilled/ButtonUnfilled.d.ts +11 -5
- package/dist/types/components/CardNavigation/CardNavigation.d.ts +31 -0
- package/dist/types/components/CardNavigation/index.d.ts +2 -0
- package/dist/types/components/CardSettingsScope/CardSettingsScope.d.ts +33 -0
- package/dist/types/components/CardSettingsScope/index.d.ts +2 -0
- package/dist/types/components/Menu/Menu.d.ts +4 -0
- package/dist/types/components/MobileBarNav/MobileBarNav.d.ts +2 -0
- package/dist/types/components/MobileHeader/MobileHeader.d.ts +3 -0
- package/dist/types/components/MobileSectionSwitcher/MobileSectionSwitcher.d.ts +19 -0
- package/dist/types/components/MobileSheetNav/MobileSheetNav.d.ts +15 -2
- package/dist/types/components/PanelNav/PanelNav.d.ts +4 -1
- package/dist/types/components/PanelToolHeader/PanelToolHeader.d.ts +2 -0
- package/dist/types/components/PanelToolSearch/PanelToolSearch.d.ts +2 -0
- package/dist/types/components/PanelTools/panel-tools-types.d.ts +2 -0
- package/dist/types/components/ShellApp/ShellApp.d.ts +5 -2
- package/dist/types/components/ShellApp/shell-app-types.d.ts +2 -0
- package/dist/types/components/Table/Table.d.ts +10 -0
- package/dist/types/components/Table/table-row-view.d.ts +6 -1
- package/dist/types/components/TableSort/TableSort.d.ts +1 -0
- package/dist/types/components/Tag/Tag.d.ts +3 -0
- package/dist/types/components.d.ts +369 -8
- package/dist/types/utils/choice-list.d.ts +2 -0
- package/dist/vue/components.d.ts +2 -0
- package/dist/vue/components.js +2 -0
- package/dist/vue/ds-button-filled.js +1 -0
- package/dist/vue/ds-button-unfilled.js +1 -0
- package/dist/vue/ds-card-navigation.d.ts +3 -0
- package/dist/vue/ds-card-navigation.js +15 -0
- package/dist/vue/ds-card-settings-scope.d.ts +3 -0
- package/dist/vue/ds-card-settings-scope.js +20 -0
- package/dist/vue/ds-menu.js +1 -0
- package/dist/vue/ds-mobile-bar-nav.js +1 -0
- package/dist/vue/ds-mobile-header.js +1 -0
- package/dist/vue/ds-mobile-section-switcher.js +2 -0
- package/dist/vue/ds-mobile-sheet-nav.js +3 -0
- package/dist/vue/ds-panel-nav.js +1 -0
- package/dist/vue/ds-panel-tool-header.js +1 -0
- package/dist/vue/ds-panel-tool-search.js +1 -0
- package/dist/vue/ds-table.js +1 -0
- package/dist/vue/ds-tag.js +1 -0
- package/package.json +1 -1
- package/dist/components/p-1604KY3B.js +0 -2
- package/dist/components/p-537t6oRD.js +0 -2
- package/dist/components/p-537t6oRD.js.map +0 -1
- package/dist/components/p-6_CNVbqa.js +0 -2
- package/dist/components/p-6_CNVbqa.js.map +0 -1
- package/dist/components/p-B9esvbYk.js.map +0 -1
- package/dist/components/p-BIGpc__9.js +0 -2
- package/dist/components/p-BIGpc__9.js.map +0 -1
- package/dist/components/p-BRLDf-NK.js +0 -2
- package/dist/components/p-BRLDf-NK.js.map +0 -1
- package/dist/components/p-BUh2GkPJ.js +0 -2
- package/dist/components/p-BUh2GkPJ.js.map +0 -1
- package/dist/components/p-BVpn_e-r.js.map +0 -1
- package/dist/components/p-BVz-r3g0.js +0 -2
- package/dist/components/p-Bjt_8sLe.js +0 -2
- package/dist/components/p-Bjt_8sLe.js.map +0 -1
- package/dist/components/p-BssZ4SbT.js +0 -2
- package/dist/components/p-BssZ4SbT.js.map +0 -1
- package/dist/components/p-CGQnHNuW.js +0 -2
- package/dist/components/p-CGQnHNuW.js.map +0 -1
- package/dist/components/p-CQjUOHiN.js +0 -2
- package/dist/components/p-Cy1oWIaV.js +0 -2
- package/dist/components/p-Cy1oWIaV.js.map +0 -1
- package/dist/components/p-DQsFmleZ.js +0 -2
- package/dist/components/p-DQsFmleZ.js.map +0 -1
- package/dist/components/p-DlbhmXjH.js +0 -2
- package/dist/components/p-DlbhmXjH.js.map +0 -1
- package/dist/components/p-GEi3hDJQ.js +0 -2
- package/dist/components/p-GEi3hDJQ.js.map +0 -1
- package/dist/components/p-LMmrjmI_.js +0 -2
- package/dist/components/p-LMmrjmI_.js.map +0 -1
- package/dist/components/p-to8BxxgT.js +0 -2
- /package/dist/components/{p-Is1lFmwp.js.map → p-1gt8QlyW.js.map} +0 -0
- /package/dist/components/{p-Q7AOgrg5.js.map → p-BCFpqnAg.js.map} +0 -0
- /package/dist/components/{p-Ctnm9NJP.js.map → p-BLTHIBsE.js.map} +0 -0
- /package/dist/components/{p-C68oSTb1.js.map → p-BXT2opmZ.js.map} +0 -0
- /package/dist/components/{p-DGkn8FwV.js.map → p-Bl5wd3v3.js.map} +0 -0
- /package/dist/components/{p-Bb9dA7sl.js.map → p-BpB2EF9g.js.map} +0 -0
- /package/dist/components/{p-2wIPUcSL.js.map → p-BwAWZAHk.js.map} +0 -0
- /package/dist/components/{p-B3sRZBZk.js.map → p-By5TDnbF.js.map} +0 -0
- /package/dist/components/{p-B3Z5sQin.js.map → p-CE8gsv7V.js.map} +0 -0
- /package/dist/components/{p-DW8ssbfI.js.map → p-CN8PQLZu.js.map} +0 -0
- /package/dist/components/{p-CaF5WCci.js.map → p-Cocq-utR.js.map} +0 -0
- /package/dist/components/{p-BZiGtBBk.js.map → p-Ct90k-nz.js.map} +0 -0
- /package/dist/components/{p-VT-5XDkB.js.map → p-DDOuPq-N.js.map} +0 -0
- /package/dist/components/{p-DkxOEFHN.js.map → p-DF8W85Tz.js.map} +0 -0
- /package/dist/components/{p-DDqRCDXh.js.map → p-DSJSnQ1U.js.map} +0 -0
- /package/dist/components/{p-Cr6pDY-e.js.map → p-DYK0slTb.js.map} +0 -0
- /package/dist/components/{p-D9wZlB_N.js.map → p-D_QtZZR8.js.map} +0 -0
- /package/dist/components/{p-Bv6FSDPR.js.map → p-DbDYEEWq.js.map} +0 -0
- /package/dist/components/{p-BEXkJ9lg.js.map → p-DnQN0pLp.js.map} +0 -0
- /package/dist/components/{p-DIqAdmui.js.map → p-FiM3rF7B.js.map} +0 -0
- /package/dist/components/{p-WFo1x6dN.js.map → p-Hzz2j1Je.js.map} +0 -0
- /package/dist/components/{p-DQQsS9Rx.js.map → p-aMyflqva.js.map} +0 -0
- /package/dist/components/{p-DZcIt_JJ.js.map → p-dgep63_i.js.map} +0 -0
- /package/dist/components/{p-BMzn2Cmw.js.map → p-rSC7ZUpy.js.map} +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "mobile-section-switcher",
|
|
4
4
|
"title": "MobileSectionSwitcher",
|
|
5
|
-
"description": "Controlled mobile section chooser
|
|
5
|
+
"description": "Controlled mobile section chooser with a viewport-edge sheet for primary pages and an anchored menu for local views.",
|
|
6
6
|
"type": "registry:ui",
|
|
7
7
|
"meta": {
|
|
8
8
|
"library": "@ds-mo/ui",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"intent": {
|
|
14
14
|
"audience": "specialized",
|
|
15
15
|
"status": "experimental",
|
|
16
|
-
"summary": "Controlled mobile section chooser
|
|
16
|
+
"summary": "Controlled mobile section chooser with a viewport-edge sheet for primary pages and an anchored menu for local views.",
|
|
17
17
|
"useWhen": [
|
|
18
18
|
"A mobile page or tool header must combine current-page identity with ordered peer-section navigation."
|
|
19
19
|
],
|
|
@@ -30,13 +30,17 @@
|
|
|
30
30
|
"accessibility": [
|
|
31
31
|
"The trigger exposes the current section, popup relationship, and expanded state.",
|
|
32
32
|
"Decorative previous and next position hints are hidden from assistive technology.",
|
|
33
|
-
"The
|
|
33
|
+
"The sheet is a native modal top-layer dialog: background content is inert, Escape and backdrop dismiss it, and focus returns to the trigger after exit motion. Arrow keys, Home, End, and initial-letter navigation move among enabled destinations.",
|
|
34
|
+
"The sheet initially focuses the current enabled destination, uses emphasis for selection, and never adds decorative icons to its rows.",
|
|
34
35
|
"Peer destinations use menuitem semantics with aria-current on the active page; they do not present a radio-control affordance."
|
|
35
36
|
],
|
|
36
37
|
"states": [
|
|
37
38
|
"Selection is controlled and dsChange reports intent without mutating value.",
|
|
38
39
|
"Dividers group menu items but never participate in previous or next resolution.",
|
|
39
|
-
"The
|
|
40
|
+
"The anchored local-view menu retains its neighboring-direction hints; the primary-page sheet uses an unfilled perimeter trigger without hints.",
|
|
41
|
+
"A sheet trigger can combine stable page identity and the current local view, separated by a decorative middle dot. The whole control opens only the supplied local destinations; long page names truncate before crowding out the active view.",
|
|
42
|
+
"Sheet selection emits navigation intent immediately while exit motion runs independently, so the controlled title can update without waiting for dismissal. Removing the owner or hiding its header closes the top layer without leaving the application blocked.",
|
|
43
|
+
"The trigger automatically retains the shared surface-open pressed wash through menu or sheet exit. Selecting a destination remains separate from owning the open surface."
|
|
40
44
|
],
|
|
41
45
|
"responsiveBehavior": [
|
|
42
46
|
"Use only in the dedicated mobile header presentation."
|
|
@@ -45,6 +49,10 @@
|
|
|
45
49
|
{
|
|
46
50
|
"label": "Storybook",
|
|
47
51
|
"path": "src/wc/components/MobileSectionSwitcher/MobileSectionSwitcher.stories.ts"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"label": "Surface ownership and trigger state",
|
|
55
|
+
"path": "src/docs/SurfaceOwnership.mdx"
|
|
48
56
|
}
|
|
49
57
|
]
|
|
50
58
|
},
|
|
@@ -59,6 +67,24 @@
|
|
|
59
67
|
"mutable": false,
|
|
60
68
|
"description": "Accessible name for the section chooser."
|
|
61
69
|
},
|
|
70
|
+
"pageLabel": {
|
|
71
|
+
"type": "string",
|
|
72
|
+
"resolvedType": "string",
|
|
73
|
+
"attribute": "page-label",
|
|
74
|
+
"default": "''",
|
|
75
|
+
"required": false,
|
|
76
|
+
"mutable": false,
|
|
77
|
+
"description": "Stable page identity shown before the selected section in a sheet trigger."
|
|
78
|
+
},
|
|
79
|
+
"presentation": {
|
|
80
|
+
"type": "'menu' | 'sheet'",
|
|
81
|
+
"resolvedType": "\"menu\" | \"sheet\"",
|
|
82
|
+
"attribute": "presentation",
|
|
83
|
+
"default": "'menu'",
|
|
84
|
+
"required": false,
|
|
85
|
+
"mutable": false,
|
|
86
|
+
"description": "Anchored local-view menu or viewport-edge sheet for primary page sections."
|
|
87
|
+
},
|
|
62
88
|
"sections": {
|
|
63
89
|
"type": "TabItem[]",
|
|
64
90
|
"resolvedType": "TabItem[]",
|
|
@@ -100,6 +126,24 @@
|
|
|
100
126
|
"mutable": false,
|
|
101
127
|
"description": "Accessible name for the section chooser."
|
|
102
128
|
},
|
|
129
|
+
"pageLabel": {
|
|
130
|
+
"type": "string",
|
|
131
|
+
"resolvedType": "string",
|
|
132
|
+
"attribute": "page-label",
|
|
133
|
+
"default": "''",
|
|
134
|
+
"required": false,
|
|
135
|
+
"mutable": false,
|
|
136
|
+
"description": "Stable page identity shown before the selected section in a sheet trigger."
|
|
137
|
+
},
|
|
138
|
+
"presentation": {
|
|
139
|
+
"type": "'menu' | 'sheet'",
|
|
140
|
+
"resolvedType": "\"menu\" | \"sheet\"",
|
|
141
|
+
"attribute": "presentation",
|
|
142
|
+
"default": "'menu'",
|
|
143
|
+
"required": false,
|
|
144
|
+
"mutable": false,
|
|
145
|
+
"description": "Anchored local-view menu or viewport-edge sheet for primary page sections."
|
|
146
|
+
},
|
|
103
147
|
"sections": {
|
|
104
148
|
"type": "TabItem[]",
|
|
105
149
|
"resolvedType": "TabItem[]",
|
|
@@ -176,12 +220,12 @@
|
|
|
176
220
|
"files": [
|
|
177
221
|
{
|
|
178
222
|
"path": "src/wc/components/MobileSectionSwitcher/MobileSectionSwitcher.css",
|
|
179
|
-
"content": "@import '../../utils/focus-ring.css';\n@import '../../utils/interaction-fill.css';\n\n:host {\n display: block;\n min-width: 0;\n max-width: 100%;\n color: var(--color-foreground-primary);\n}\n\n.mobile-section-switcher {\n appearance: none;\n display: grid;\n grid-template-columns: var(--dimension-size-100) minmax(0, auto) var(--dimension-size-100);\n align-items: center;\n justify-content: center;\n gap: var(--dimension-space-050);\n max-width: 100%;\n min-height: var(--dimension-size-400);\n padding-inline: var(--dimension-space-100);\n border: 0;\n border-radius: var(--dimension-radius-100);\n background: var(--color-background-secondary);\n color: inherit;\n box-sizing: border-box;\n cursor: default;\n}\n\n.mobile-section-switcher--
|
|
223
|
+
"content": "@import '../../utils/focus-ring.css';\n@import '../../utils/interaction-fill.css';\n@import '../../utils/control-density.css';\n\n:host {\n display: block;\n min-width: 0;\n max-width: 100%;\n color: var(--color-foreground-primary);\n}\n\n.mobile-section-switcher {\n appearance: none;\n display: grid;\n grid-template-columns: var(--dimension-size-100) minmax(0, auto) var(--dimension-size-100);\n align-items: center;\n justify-content: center;\n gap: var(--dimension-space-050);\n max-width: 100%;\n min-height: var(--dimension-size-400);\n padding-inline: var(--dimension-space-100);\n border: 0;\n border-radius: var(--dimension-radius-100);\n background: var(--color-background-secondary);\n color: inherit;\n box-sizing: border-box;\n cursor: default;\n}\n\n.mobile-section-switcher__label {\n min-width: 0;\n max-width: 100%;\n text-align: center;\n}\n\n.mobile-section-switcher__position {\n width: var(--dimension-size-050);\n height: var(--dimension-size-050);\n border-radius: var(--dimension-radius-half);\n background: currentColor;\n opacity: 0;\n}\n\n.mobile-section-switcher__position--visible {\n opacity: 1;\n}\n\n.mobile-section-switcher--sheet {\n grid-template-columns: minmax(0, auto);\n min-height: var(--dimension-size-500);\n padding-inline: var(--dimension-space-150);\n border-radius: var(--dimension-radius-half);\n background: transparent;\n --ds-interaction-border-width: var(--dimension-stroke-width-012);\n --ds-interaction-border-color: var(--color-border-tertiary);\n}\n\n.mobile-section-switcher--combined {\n display: flex;\n}\n\n.mobile-section-switcher__page-label {\n flex: 0 1 auto;\n min-width: 0;\n}\n\n.mobile-section-switcher__separator {\n flex: 0 0 auto;\n}\n\n.mobile-section-switcher--combined .mobile-section-switcher__label {\n flex: 0 0 auto;\n max-width: 50%;\n}\n\n.mobile-section-sheet {\n position: fixed;\n inset: 0 0 auto;\n width: 100%;\n max-width: none;\n max-height: calc(100dvh - var(--dimension-size-500) - var(--dimension-space-200));\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 0;\n box-sizing: border-box;\n overflow: hidden;\n background: var(--color-background-primary);\n color: var(--color-foreground-secondary);\n box-shadow: var(--effect-elevation-elevated-floating);\n outline: none;\n}\n\n.mobile-section-sheet[open] {\n display: flex;\n flex-direction: column;\n animation: mobileSectionSheetIn var(--effect-motion-short-2) both;\n}\n\n.mobile-section-sheet::backdrop {\n background: var(--color-background-shade);\n animation: mobileSectionShadeIn var(--effect-motion-short-2) both;\n}\n\n.mobile-section-sheet--closing[open] {\n animation-name: mobileSectionSheetOut;\n}\n\n.mobile-section-sheet--closing::backdrop {\n animation-name: mobileSectionShadeOut;\n}\n\n.mobile-section-sheet__items {\n display: flex;\n flex-direction: column;\n gap: var(--dimension-space-100);\n min-height: 0;\n padding: var(--dimension-space-100);\n padding-block-start: max(var(--dimension-space-100), env(safe-area-inset-top, 0px));\n overflow-y: auto;\n overscroll-behavior: contain;\n}\n\n.mobile-section-sheet__item {\n appearance: none;\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n height: var(--ds-control-height);\n width: 100%;\n min-width: 0;\n padding: 0 var(--ds-control-padding-inline);\n box-sizing: border-box;\n border: 0;\n border-radius: var(--ds-control-radius);\n background: transparent;\n color: inherit;\n text-align: start;\n}\n\n.mobile-section-sheet__item[aria-current='page'] {\n color: var(--color-foreground-primary);\n}\n\n.mobile-section-sheet__item:disabled {\n color: var(--color-foreground-tertiary);\n}\n\n.mobile-section-sheet__label {\n min-width: 0;\n padding-inline: var(--ds-control-label-inset);\n}\n\n.mobile-section-sheet__divider {\n flex: 0 0 auto;\n height: var(--dimension-stroke-width-012);\n margin-inline: var(--dimension-space-100);\n background: var(--color-border-tertiary);\n}\n\n@keyframes mobileSectionSheetIn {\n from {\n transform: translateY(-100%);\n }\n to {\n transform: translateY(0);\n }\n}\n\n@keyframes mobileSectionSheetOut {\n from {\n transform: translateY(0);\n }\n to {\n transform: translateY(-100%);\n }\n}\n\n@keyframes mobileSectionShadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n@keyframes mobileSectionShadeOut {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .mobile-section-sheet[open],\n .mobile-section-sheet::backdrop {\n animation: none;\n }\n}\n",
|
|
180
224
|
"type": "registry:ui"
|
|
181
225
|
},
|
|
182
226
|
{
|
|
183
227
|
"path": "src/wc/components/MobileSectionSwitcher/MobileSectionSwitcher.tsx",
|
|
184
|
-
"content": "import {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport type { MenuItemData, MenuSection } from '../Menu/menu-types';\nimport {\n getSelectableTabs,\n isTabDivider,\n type TabItem,\n type TabItemTab,\n} from '../TabGroup/tab-item-utils';\nimport { resolveMobileSectionPosition } from './mobile-section-switcher-utils';\n\nlet nextMobileSectionSwitcherId = 0;\n\n@Component({\n tag: 'ds-mobile-section-switcher',\n styleUrl: 'MobileSectionSwitcher.css',\n scoped: true,\n})\nexport class MobileSectionSwitcher {\n @Element() el!: HTMLElement;\n\n /** Ordered controlled sections. Divider entries group the popup menu. */\n @Prop() sections: TabItem[] = [];\n /** Controlled selected section id. */\n @Prop() value: string = '';\n /** Accessible name for the section chooser. */\n @Prop() navigationLabel: string = 'Change page section';\n\n /** Selection intent. The route, tool, or workflow owner updates `value`. */\n @Event() dsChange!: EventEmitter<string>;\n\n @State() private menuOpen = false;\n @State() private initialFocusVisible = false;\n\n private readonly instanceId = nextMobileSectionSwitcherId++;\n private readonly triggerId = `ds-mobile-section-switcher-trigger-${this.instanceId}`;\n private readonly menuId = `ds-mobile-section-switcher-menu-${this.instanceId}`;\n private triggerEl: HTMLButtonElement | null = null;\n\n private get resolvedSections(): TabItem[] {\n return this.sections ?? [];\n }\n\n private get selectableSections(): TabItemTab[] {\n return getSelectableTabs(this.resolvedSections);\n }\n\n private get selectedIndex(): number {\n return resolveMobileSectionPosition(this.resolvedSections, this.value).selectedIndex;\n }\n\n private get selectedSection(): TabItemTab | undefined {\n return this.selectableSections[this.selectedIndex];\n }\n\n private get hasPrevious(): boolean {\n return resolveMobileSectionPosition(this.resolvedSections, this.value).hasPrevious;\n }\n\n private get hasNext(): boolean {\n return resolveMobileSectionPosition(this.resolvedSections, this.value).hasNext;\n }\n\n private get triggerAriaLabel(): string {\n return `${this.navigationLabel}. Current section: ${this.selectedSection?.label ?? ''}`;\n }\n\n private get menuSections(): MenuSection[] {\n const groups: MenuSection[] = [];\n let items: MenuItemData[] = [];\n const commit = () => {\n if (items.length) groups.push({ items });\n items = [];\n };\n\n for (const section of this.resolvedSections) {\n if (isTabDivider(section)) {\n commit();\n continue;\n }\n items.push({\n label: section.label,\n value: section.id,\n dot: section.dot,\n isSelected: section.id === this.selectedSection?.id,\n isInactive: section.isInactive,\n });\n }\n commit();\n return groups;\n }\n\n @Watch('sections')\n handleSectionsChange() {\n if (this.selectableSections.length <= 1) this.closeMenu();\n }\n\n private toggleMenu = (event: MouseEvent) => {\n if (this.selectableSections.length <= 1) return;\n this.initialFocusVisible = event.detail === 0;\n this.menuOpen = !this.menuOpen;\n };\n\n private closeMenu = () => {\n this.menuOpen = false;\n };\n\n private handleSelect = (event: CustomEvent<MenuItemData>) => {\n const id = String(event.detail.value ?? '');\n const section = this.selectableSections.find(candidate => candidate.id === id);\n if (!section || section.isInactive) return;\n this.closeMenu();\n if (id !== this.selectedSection?.id) this.dsChange.emit(id);\n requestAnimationFrame(() => this.triggerEl?.focus());\n };\n\n render() {\n const selected = this.selectedSection;\n if (!selected) return <Host />;\n\n return (\n <Host>\n <button\n ref={element => {\n this.triggerEl = element ?? null;\n }}\n id={this.triggerId}\n class={{\n 'mobile-section-switcher': true,\n 'mobile-section-switcher--expanded': this.menuOpen,\n 'ds-focus-ring-inset': true,\n 'ds-interaction-fill': true,\n }}\n type=\"button\"\n aria-haspopup=\"menu\"\n aria-controls={this.menuId}\n aria-expanded={String(this.menuOpen)}\n aria-label={this.triggerAriaLabel}\n onClick={this.toggleMenu}\n >\n <span\n class={{\n 'mobile-section-switcher__position': true,\n 'mobile-section-switcher__position--visible': this.hasPrevious,\n 'ds-interaction-fill__content': true,\n }}\n aria-hidden=\"true\"\n />\n <ds-text\n class=\"mobile-section-switcher__label ds-interaction-fill__content\"\n as=\"span\"\n variant=\"text-body-medium\"\n emphasis\n color=\"inherit\"\n lineTruncation={1}\n >\n {selected.label}\n </ds-text>\n <span\n class={{\n 'mobile-section-switcher__position': true,\n 'mobile-section-switcher__position--visible': this.hasNext,\n 'ds-interaction-fill__content': true,\n }}\n aria-hidden=\"true\"\n />\n </button>\n\n {this.selectableSections.length > 1 ? (\n <ds-menu\n id={this.menuId}\n anchorId={this.triggerId}\n align=\"center\"\n menuLabel={this.navigationLabel}\n open={this.menuOpen}\n initialFocusVisible={this.initialFocusVisible}\n sections={this.menuSections}\n onDsClose={this.closeMenu}\n onDsSelect={this.handleSelect}\n />\n ) : null}\n </Host>\n );\n }\n}\n",
|
|
228
|
+
"content": "import {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport type { MenuItemData, MenuSection } from '../Menu/menu-types';\nimport {\n getSelectableTabs,\n isTabDivider,\n type TabItem,\n type TabItemTab,\n} from '../TabGroup/tab-item-utils';\nimport { resolveMobileSectionPosition } from './mobile-section-switcher-utils';\nimport { resolveMotionTimeMs, TOKEN_DEFAULTS } from '../../utils';\n\nlet nextMobileSectionSwitcherId = 0;\n\n@Component({\n tag: 'ds-mobile-section-switcher',\n styleUrl: 'MobileSectionSwitcher.css',\n scoped: true,\n})\nexport class MobileSectionSwitcher {\n @Element() el!: HTMLElement;\n\n /** Ordered controlled sections. Divider entries group the popup menu. */\n @Prop() sections: TabItem[] = [];\n /** Controlled selected section id. */\n @Prop() value: string = '';\n /** Accessible name for the section chooser. */\n @Prop() navigationLabel: string = 'Change page section';\n /** Anchored local-view menu or viewport-edge sheet for primary page sections. */\n @Prop() presentation: 'menu' | 'sheet' = 'menu';\n /** Stable page identity shown before the selected section in a sheet trigger. */\n @Prop() pageLabel: string = '';\n\n /** Selection intent. The route, tool, or workflow owner updates `value`. */\n @Event() dsChange!: EventEmitter<string>;\n\n @State() private menuOpen = false;\n @State() private menuSurfaceOpen = false;\n @State() private initialFocusVisible = false;\n @State() private sheetClosing = false;\n @State() private focusedSection = '';\n\n private readonly instanceId = nextMobileSectionSwitcherId++;\n private readonly triggerId = `ds-mobile-section-switcher-trigger-${this.instanceId}`;\n private readonly menuId = `ds-mobile-section-switcher-menu-${this.instanceId}`;\n private triggerEl: HTMLButtonElement | null = null;\n private dialogEl: HTMLDialogElement | null = null;\n private closeTimer: ReturnType<typeof setTimeout> | null = null;\n private visibilityObserver?: ResizeObserver;\n\n componentDidLoad() {\n this.visibilityObserver = new ResizeObserver(() => {\n if (this.dialogEl?.open && !this.triggerEl?.getClientRects().length) {\n this.finishSheetClose(false);\n }\n });\n this.visibilityObserver.observe(this.el);\n }\n\n componentDidRender() {\n if (!this.dialogEl) return;\n if (this.presentation === 'sheet' && this.menuOpen && !this.dialogEl.open) {\n const initialSection = this.focusedSection;\n this.dialogEl.showModal();\n this.focusSheetItem(initialSection);\n }\n if (this.sheetClosing && this.dialogEl.open && !this.closeTimer) {\n const duration = resolveMotionTimeMs(\n TOKEN_DEFAULTS.motionShort2,\n TOKEN_DEFAULTS.animationDurationShort3\n );\n if (!duration) this.finishSheetClose();\n else this.closeTimer = setTimeout(() => this.finishSheetClose(), duration);\n }\n }\n\n disconnectedCallback() {\n this.visibilityObserver?.disconnect();\n this.menuSurfaceOpen = false;\n this.finishSheetClose(false);\n }\n\n @Watch('presentation')\n handlePresentationChange() {\n this.menuSurfaceOpen = false;\n this.closeMenu();\n }\n\n @Watch('value')\n @Watch('pageLabel')\n handleContextChange() {\n this.closeMenu();\n }\n\n private finishSheetClose(restoreFocus = true) {\n if (this.closeTimer) clearTimeout(this.closeTimer);\n this.closeTimer = null;\n const wasOpen = this.dialogEl?.open;\n this.dialogEl?.close();\n this.menuOpen = false;\n this.sheetClosing = false;\n if (wasOpen && restoreFocus && this.triggerEl?.getClientRects().length) this.triggerEl.focus();\n }\n\n private focusSheetItem(id: string) {\n const buttons = Array.from(this.dialogEl?.querySelectorAll<HTMLButtonElement>('button') ?? []);\n const button =\n buttons.find(item => item.value === id && !item.disabled) ??\n buttons.find(item => !item.disabled);\n if (button) {\n this.focusedSection = button.value;\n button.focus();\n } else this.dialogEl?.focus();\n }\n\n private handleSheetKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n event.preventDefault();\n event.stopPropagation();\n this.closeMenu();\n return;\n }\n const sections = this.selectableSections.filter(section => !section.isInactive);\n if (!sections.length) return;\n const index = Math.max(\n 0,\n sections.findIndex(section => section.id === this.focusedSection)\n );\n let next: number;\n if (event.key === 'ArrowDown') next = (index + 1) % sections.length;\n else if (event.key === 'ArrowUp') next = (index + sections.length - 1) % sections.length;\n else if (event.key === 'Home') next = 0;\n else if (event.key === 'End') next = sections.length - 1;\n else if (event.key === 'Tab') next = index;\n else if (\n event.key.length === 1 &&\n !event.ctrlKey &&\n !event.metaKey &&\n !event.altKey &&\n event.key !== ' '\n ) {\n const match = sections.findIndex((_, offset) =>\n sections[(index + offset + 1) % sections.length].label\n .toLowerCase()\n .startsWith(event.key.toLowerCase())\n );\n if (match < 0) return;\n next = (index + match + 1) % sections.length;\n } else return;\n event.preventDefault();\n this.initialFocusVisible = true;\n this.focusSheetItem(sections[next].id);\n };\n\n private get resolvedSections(): TabItem[] {\n return this.sections ?? [];\n }\n\n private get selectableSections(): TabItemTab[] {\n return getSelectableTabs(this.resolvedSections);\n }\n\n private get selectedIndex(): number {\n return resolveMobileSectionPosition(this.resolvedSections, this.value).selectedIndex;\n }\n\n private get selectedSection(): TabItemTab | undefined {\n return this.selectableSections[this.selectedIndex];\n }\n\n private get hasPrevious(): boolean {\n return resolveMobileSectionPosition(this.resolvedSections, this.value).hasPrevious;\n }\n\n private get hasNext(): boolean {\n return resolveMobileSectionPosition(this.resolvedSections, this.value).hasNext;\n }\n\n private get triggerAriaLabel(): string {\n return `${this.presentation === 'sheet' && this.pageLabel ? `${this.pageLabel}. ` : ''}${this.navigationLabel}. Current section: ${this.selectedSection?.label ?? ''}`;\n }\n\n private get menuSections(): MenuSection[] {\n const groups: MenuSection[] = [];\n let items: MenuItemData[] = [];\n const commit = () => {\n if (items.length) groups.push({ items });\n items = [];\n };\n\n for (const section of this.resolvedSections) {\n if (isTabDivider(section)) {\n commit();\n continue;\n }\n items.push({\n label: section.label,\n value: section.id,\n dot: section.dot,\n isSelected: section.id === this.selectedSection?.id,\n isInactive: section.isInactive,\n });\n }\n commit();\n return groups;\n }\n\n @Watch('sections')\n handleSectionsChange() {\n if (this.selectableSections.length <= 1) {\n this.closeMenu();\n this.menuSurfaceOpen = false;\n } else if (this.dialogEl?.open && !this.sheetClosing) this.focusSheetItem(this.focusedSection);\n }\n\n private toggleMenu = (event: MouseEvent) => {\n if (this.selectableSections.length <= 1) return;\n this.initialFocusVisible = event.detail === 0;\n if (this.presentation === 'sheet') {\n if (this.menuOpen) this.closeMenu();\n else {\n this.focusedSection = this.selectedSection?.id ?? '';\n this.menuOpen = true;\n }\n return;\n }\n this.menuOpen = !this.menuOpen;\n if (this.menuOpen) this.menuSurfaceOpen = true;\n };\n\n private closeMenu = () => {\n this.menuOpen = false;\n if (this.dialogEl?.open) this.sheetClosing = true;\n };\n\n private renderSheet() {\n return (\n <dialog\n id={this.menuId}\n ref={element => {\n this.dialogEl = element ?? null;\n }}\n class={{ 'mobile-section-sheet': true, 'mobile-section-sheet--closing': this.sheetClosing }}\n aria-label={this.navigationLabel}\n tabIndex={-1}\n onCancel={event => {\n event.preventDefault();\n this.closeMenu();\n }}\n onKeyDown={this.handleSheetKeyDown}\n onClick={event => {\n if (!this.dialogEl || event.target !== this.dialogEl) return;\n const rect = this.dialogEl.getBoundingClientRect();\n if (\n event.clientY < rect.top ||\n event.clientY > rect.bottom ||\n event.clientX < rect.left ||\n event.clientX > rect.right\n )\n this.closeMenu();\n }}\n >\n <div class=\"mobile-section-sheet__items\" role=\"menu\" aria-label={this.navigationLabel}>\n {this.resolvedSections.map(section =>\n isTabDivider(section) ? (\n <div class=\"mobile-section-sheet__divider\" role=\"separator\" />\n ) : (\n <button\n type=\"button\"\n role=\"menuitem\"\n value={section.id}\n disabled={section.isInactive}\n aria-current={section.id === this.selectedSection?.id ? 'page' : undefined}\n tabIndex={section.id === this.focusedSection ? 0 : -1}\n class={{\n 'mobile-section-sheet__item': true,\n 'ds-control--lg': true,\n 'ds-interaction-fill': true,\n 'ds-focus-ring-inset': true,\n 'ds-focus-ring--visible':\n this.initialFocusVisible && section.id === this.focusedSection,\n }}\n onFocus={() => {\n this.focusedSection = section.id;\n }}\n onClick={() => {\n if (this.sheetClosing || section.isInactive) return;\n this.closeMenu();\n if (section.id !== this.selectedSection?.id) this.dsChange.emit(section.id);\n }}\n >\n <ds-text\n class=\"mobile-section-sheet__label ds-interaction-fill__content\"\n as=\"span\"\n variant=\"text-body-large\"\n color=\"inherit\"\n emphasis={section.id === this.selectedSection?.id}\n lineTruncation={1}\n >\n {section.label}\n </ds-text>\n </button>\n )\n )}\n </div>\n </dialog>\n );\n }\n\n private handleSelect = (event: CustomEvent<MenuItemData>) => {\n const id = String(event.detail.value ?? '');\n const section = this.selectableSections.find(candidate => candidate.id === id);\n if (!section || section.isInactive) return;\n this.closeMenu();\n if (id !== this.selectedSection?.id) this.dsChange.emit(id);\n requestAnimationFrame(() => this.triggerEl?.focus());\n };\n\n render() {\n const selected = this.selectedSection;\n if (!selected) return <Host />;\n const combined = this.presentation === 'sheet' && !!this.pageLabel;\n\n return (\n <Host>\n <button\n ref={element => {\n this.triggerEl = element ?? null;\n }}\n id={this.triggerId}\n class={{\n 'mobile-section-switcher': true,\n 'mobile-section-switcher--expanded': this.menuOpen,\n 'ds-interaction-fill--surface-open':\n this.menuSurfaceOpen || this.menuOpen || this.sheetClosing,\n 'mobile-section-switcher--sheet': this.presentation === 'sheet',\n 'mobile-section-switcher--combined': combined,\n 'ds-focus-ring-inset': true,\n 'ds-interaction-fill': true,\n }}\n type=\"button\"\n aria-haspopup={this.presentation === 'sheet' ? 'dialog' : 'menu'}\n aria-controls={this.menuId}\n aria-expanded={String(this.menuOpen)}\n aria-label={this.triggerAriaLabel}\n onClick={this.toggleMenu}\n >\n {this.presentation === 'menu' ? (\n <span\n class={{\n 'mobile-section-switcher__position': true,\n 'mobile-section-switcher__position--visible': this.hasPrevious,\n 'ds-interaction-fill__content': true,\n }}\n aria-hidden=\"true\"\n />\n ) : null}\n {combined\n ? [\n <ds-text\n class=\"mobile-section-switcher__page-label ds-interaction-fill__content\"\n as=\"span\"\n variant=\"text-body-large\"\n emphasis\n color=\"inherit\"\n lineTruncation={1}\n >\n {this.pageLabel}\n </ds-text>,\n <ds-text\n class=\"mobile-section-switcher__separator ds-interaction-fill__content\"\n as=\"span\"\n variant=\"text-body-large\"\n color=\"inherit\"\n aria-hidden=\"true\"\n >\n ·\n </ds-text>,\n ]\n : null}\n <ds-text\n class=\"mobile-section-switcher__label ds-interaction-fill__content\"\n as=\"span\"\n variant={this.presentation === 'sheet' ? 'text-body-large' : 'text-body-medium'}\n emphasis\n color=\"inherit\"\n lineTruncation={1}\n >\n {selected.label}\n </ds-text>\n {this.presentation === 'menu' ? (\n <span\n class={{\n 'mobile-section-switcher__position': true,\n 'mobile-section-switcher__position--visible': this.hasNext,\n 'ds-interaction-fill__content': true,\n }}\n aria-hidden=\"true\"\n />\n ) : null}\n </button>\n\n {this.presentation === 'sheet' || this.sheetClosing ? (\n this.renderSheet()\n ) : this.selectableSections.length > 1 ? (\n <ds-menu\n id={this.menuId}\n anchorId={this.triggerId}\n align=\"center\"\n menuLabel={this.navigationLabel}\n open={this.menuOpen}\n initialFocusVisible={this.initialFocusVisible}\n sections={this.menuSections}\n onDsClose={this.closeMenu}\n onDsAfterClose={() => {\n if (!this.menuOpen) this.menuSurfaceOpen = false;\n }}\n onDsSelect={this.handleSelect}\n />\n ) : null}\n </Host>\n );\n }\n}\n",
|
|
185
229
|
"type": "registry:ui"
|
|
186
230
|
},
|
|
187
231
|
{
|
|
@@ -34,7 +34,10 @@
|
|
|
34
34
|
"Escape requests dismissal and opening moves focus to the selected or first available area."
|
|
35
35
|
],
|
|
36
36
|
"states": [
|
|
37
|
-
"Dashboard and Settings change only the
|
|
37
|
+
"Dashboard and Settings change only the destination collection being browsed.",
|
|
38
|
+
"In nested mode, parents with child routes disclose inline without navigating. Only selecting a child emits route intent; parents without children retain direct navigation.",
|
|
39
|
+
"Nested branches use the same positional divider and staggered child motion as expanded desktop navigation, without adding disclosure chevrons. Dividers separate an expanded branch from its siblings, not from the outside edge of its group.",
|
|
40
|
+
"Opening the sheet reveals the current route's branch. Collapsed child groups are inert and hidden from assistive technology while the shared navigation motion runs; child targets keep the mobile row density.",
|
|
38
41
|
"Area, Help, and Account events express intent while the application owns navigation and product behavior.",
|
|
39
42
|
"Set routeSelectionActive to false while a global tool owns the mobile stage so the underlying router URL remains available without marking its area current.",
|
|
40
43
|
"Set showAccount to false when account and user preferences already live in the supplied Settings navigation."
|
|
@@ -117,6 +120,15 @@
|
|
|
117
120
|
"required": false,
|
|
118
121
|
"mutable": false
|
|
119
122
|
},
|
|
123
|
+
"presentation": {
|
|
124
|
+
"type": "PanelNavPresentation",
|
|
125
|
+
"resolvedType": "\"flat\" | \"nested\"",
|
|
126
|
+
"attribute": "presentation",
|
|
127
|
+
"default": "'flat'",
|
|
128
|
+
"required": false,
|
|
129
|
+
"mutable": false,
|
|
130
|
+
"description": "Flat area navigation or inline disclosure of each area's child routes."
|
|
131
|
+
},
|
|
120
132
|
"routeSelectionActive": {
|
|
121
133
|
"type": "boolean",
|
|
122
134
|
"resolvedType": "boolean",
|
|
@@ -172,6 +184,14 @@
|
|
|
172
184
|
"bubbles": true,
|
|
173
185
|
"cancelable": true,
|
|
174
186
|
"composed": true
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"name": "dsNavChildSelect",
|
|
190
|
+
"detail": "PanelNavChildSelectDetail",
|
|
191
|
+
"bubbles": true,
|
|
192
|
+
"cancelable": true,
|
|
193
|
+
"composed": true,
|
|
194
|
+
"description": "Selecting a child requests routing; expanding its parent never navigates."
|
|
175
195
|
}
|
|
176
196
|
],
|
|
177
197
|
"methods": [],
|
|
@@ -241,6 +261,15 @@
|
|
|
241
261
|
"required": false,
|
|
242
262
|
"mutable": false
|
|
243
263
|
},
|
|
264
|
+
"presentation": {
|
|
265
|
+
"type": "PanelNavPresentation",
|
|
266
|
+
"resolvedType": "\"flat\" | \"nested\"",
|
|
267
|
+
"attribute": "presentation",
|
|
268
|
+
"default": "'flat'",
|
|
269
|
+
"required": false,
|
|
270
|
+
"mutable": false,
|
|
271
|
+
"description": "Flat area navigation or inline disclosure of each area's child routes."
|
|
272
|
+
},
|
|
244
273
|
"routeSelectionActive": {
|
|
245
274
|
"type": "boolean",
|
|
246
275
|
"resolvedType": "boolean",
|
|
@@ -296,6 +325,14 @@
|
|
|
296
325
|
"bubbles": true,
|
|
297
326
|
"cancelable": true,
|
|
298
327
|
"composed": true
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"name": "dsNavChildSelect",
|
|
331
|
+
"detail": "PanelNavChildSelectDetail",
|
|
332
|
+
"bubbles": true,
|
|
333
|
+
"cancelable": true,
|
|
334
|
+
"composed": true,
|
|
335
|
+
"description": "Selecting a child requests routing; expanding its parent never navigates."
|
|
299
336
|
}
|
|
300
337
|
],
|
|
301
338
|
"methods": [],
|
|
@@ -351,12 +388,12 @@
|
|
|
351
388
|
"files": [
|
|
352
389
|
{
|
|
353
390
|
"path": "src/wc/components/MobileSheetNav/MobileSheetNav.css",
|
|
354
|
-
"content": "@import '../../utils/control-density.css';\n@import '../../utils/chrome-layout.css';\n@import '../../utils/focus-ring.css';\n@import '../../utils/interaction-fill.css';\n\n:host {\n display: block;\n min-width: 0;\n min-height: 0;\n height: 100%;\n background: var(--color-background-primary);\n}\n\n:host(:not([open])) {\n display: none;\n}\n\n.mobile-sheet-nav {\n display: grid;\n grid-template-rows: auto minmax(0, 1fr);\n height: 100%;\n min-height: 0;\n background: var(--color-background-primary);\n}\n\n.mobile-sheet-nav__header {\n position: relative;\n grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);\n}\n\n.mobile-sheet-nav__header--expanded-context {\n grid-template-columns:\n minmax(var(--dimension-size-500), 1fr)\n minmax(0, 4fr)\n minmax(var(--dimension-size-500), 1fr);\n}\n\n.mobile-sheet-nav__header--expanded-context .mobile-sheet-nav__context {\n width: 100%;\n}\n\n.mobile-sheet-nav__header::after {\n content: '';\n position: absolute;\n inset-inline: 0;\n inset-block-end: 0;\n height: var(--dimension-stroke-width-012);\n background: var(--color-border-tertiary);\n pointer-events: none;\n}\n\n.mobile-sheet-nav__brand {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n min-width: 0;\n}\n\n.mobile-sheet-nav__logo {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: var(--dimension-size-500);\n height: var(--dimension-size-500);\n padding: var(--dimension-space-100);\n box-sizing: border-box;\n color: var(--color-foreground-primary);\n}\n\n.mobile-sheet-nav__logo-mark {\n width: var(--dimension-iconography-lg);\n height: var(--dimension-iconography-lg);\n flex: 0 0 auto;\n}\n\n.mobile-sheet-nav__context {\n justify-self: center;\n}\n\n.mobile-sheet-nav__actions {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: var(--dimension-space-050);\n min-width: 0;\n}\n\n.mobile-sheet-nav__body {\n min-height: 0;\n overflow: auto;\n overscroll-behavior: contain;\n}\n\n.mobile-sheet-nav__sections {\n display: grid;\n gap: var(--dimension-space-400);\n}\n\n.mobile-sheet-nav__items {\n display: grid;\n gap: var(--dimension-space-100);\n}\n\n.mobile-sheet-nav__item {\n appearance: none;\n width: 100%;\n height: var(--ds-control-height);\n min-height: var(--ds-control-height);\n padding-inline: var(--ds-control-padding-inline);\n border: 0;\n border-radius: var(--ds-control-radius);\n background: transparent;\n color: var(--color-foreground-secondary);\n display: flex;\n align-items: center;\n justify-content: flex-start;\n gap: var(--ds-control-gap);\n cursor: default;\n text-align: start;\n box-sizing: border-box;\n}\n\n.mobile-sheet-nav__item--selected {\n color: var(--color-foreground-primary);\n}\n\n.mobile-sheet-nav__item-label {\n min-width: 0;\n padding-inline: var(--ds-control-label-inset);\n}\n\n.mobile-sheet-nav__dot {\n margin-inline-start: auto;\n}\n",
|
|
391
|
+
"content": "@import '../../utils/control-density.css';\n@import '../../utils/chrome-layout.css';\n@import '../../utils/focus-ring.css';\n@import '../../utils/interaction-fill.css';\n@import '../../utils/nav-disclosure.css';\n\n:host {\n display: block;\n min-width: 0;\n min-height: 0;\n height: 100%;\n background: var(--color-background-primary);\n}\n\n:host(:not([open])) {\n display: none;\n}\n\n.mobile-sheet-nav {\n display: grid;\n grid-template-rows: auto minmax(0, 1fr);\n height: 100%;\n min-height: 0;\n background: var(--color-background-primary);\n}\n\n.mobile-sheet-nav__header {\n position: relative;\n grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);\n}\n\n.mobile-sheet-nav__header--expanded-context {\n grid-template-columns:\n minmax(var(--dimension-size-500), 1fr)\n minmax(0, 4fr)\n minmax(var(--dimension-size-500), 1fr);\n}\n\n.mobile-sheet-nav__header--expanded-context .mobile-sheet-nav__context {\n width: 100%;\n}\n\n.mobile-sheet-nav__header::after {\n content: '';\n position: absolute;\n inset-inline: 0;\n inset-block-end: 0;\n height: var(--dimension-stroke-width-012);\n background: var(--color-border-tertiary);\n pointer-events: none;\n}\n\n.mobile-sheet-nav__brand {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n min-width: 0;\n}\n\n.mobile-sheet-nav__logo {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: var(--dimension-size-500);\n height: var(--dimension-size-500);\n padding: var(--dimension-space-100);\n box-sizing: border-box;\n color: var(--color-foreground-primary);\n}\n\n.mobile-sheet-nav__logo-mark {\n width: var(--dimension-iconography-lg);\n height: var(--dimension-iconography-lg);\n flex: 0 0 auto;\n}\n\n.mobile-sheet-nav__context {\n justify-self: center;\n}\n\n.mobile-sheet-nav__actions {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: var(--dimension-space-050);\n min-width: 0;\n}\n\n.mobile-sheet-nav__body {\n min-height: 0;\n overflow: auto;\n overscroll-behavior: contain;\n}\n\n.mobile-sheet-nav__sections {\n display: grid;\n gap: var(--dimension-space-400);\n}\n\n.mobile-sheet-nav__items {\n display: grid;\n gap: var(--dimension-space-100);\n}\n\n.mobile-sheet-nav__item {\n appearance: none;\n width: 100%;\n height: var(--ds-control-height);\n min-height: var(--ds-control-height);\n padding-inline: var(--ds-control-padding-inline);\n border: 0;\n border-radius: var(--ds-control-radius);\n background: transparent;\n color: var(--color-foreground-secondary);\n display: flex;\n align-items: center;\n justify-content: flex-start;\n gap: var(--ds-control-gap);\n cursor: default;\n text-align: start;\n box-sizing: border-box;\n}\n\n.mobile-sheet-nav__item--selected {\n color: var(--color-foreground-primary);\n}\n\n.mobile-sheet-nav__item-label {\n min-width: 0;\n padding-inline: var(--ds-control-label-inset);\n}\n\n.mobile-sheet-nav__dot {\n margin-inline-start: auto;\n}\n\n.mobile-sheet-nav__children {\n display: flex;\n flex-direction: column;\n gap: var(--dimension-space-100);\n min-height: 0;\n overflow: hidden;\n}\n\n.mobile-sheet-nav__child {\n flex: 0 0 var(--ds-control-height);\n padding-inline-start: calc(\n var(--ds-control-padding-inline) + var(--dimension-iconography-lg) + var(--ds-control-gap)\n );\n}\n\n.mobile-sheet-nav__child:first-child {\n margin-block-start: var(--dimension-space-100);\n}\n\n.mobile-sheet-nav__child:disabled {\n color: var(--color-foreground-tertiary);\n}\n\n.mobile-sheet-nav__parent--muted {\n color: var(--color-foreground-secondary);\n}\n\n.mobile-sheet-nav__divider-line {\n display: block;\n height: var(--dimension-stroke-width-012);\n margin-inline: var(--dimension-space-100);\n background: var(--color-border-tertiary);\n}\n\n.mobile-sheet-nav__divider--before .mobile-sheet-nav__divider-line {\n margin-block: var(--dimension-space-050) var(--dimension-space-150);\n}\n\n.mobile-sheet-nav__divider--after .mobile-sheet-nav__divider-line {\n margin-block: var(--dimension-space-150) var(--dimension-space-050);\n}\n",
|
|
355
392
|
"type": "registry:ui"
|
|
356
393
|
},
|
|
357
394
|
{
|
|
358
395
|
"path": "src/wc/components/MobileSheetNav/MobileSheetNav.tsx",
|
|
359
|
-
"content": "import {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Listen,\n Prop,\n Watch,\n} from '@stencil/core';\nimport type { NavChromeStyle } from '../../shell/nav-chrome';\nimport { deriveActiveIdFromUrl } from '../PanelNav/panel-nav-utils';\nimport type { PanelNavGroup, PanelNavItem } from '../PanelNav/panel-nav-types';\n\ntype MobileSheetNavHeaderDestinationId = 'account' | 'help';\n\nconst CONTEXT_TABS = [\n { id: 'dashboard', label: 'Dashboard', icon: 'Dashboard', variant: 'icon' as const },\n { id: 'settings', label: 'Settings', icon: 'Gear', variant: 'icon' as const },\n];\n\n@Component({\n tag: 'ds-mobile-sheet-nav',\n styleUrl: 'MobileSheetNav.css',\n scoped: true,\n})\nexport class MobileSheetNav {\n @Element() el!: HTMLElement;\n\n @Prop({ reflect: true }) open: boolean = false;\n @Prop() browseContext: NavChromeStyle = 'dashboard';\n @Prop() dashboardGroups: PanelNavGroup[] = [];\n @Prop() settingsGroups: PanelNavGroup[] = [];\n @Prop() currentUrl: string = '';\n /** Whether the router-derived current area owns the active mobile stage. */\n @Prop() routeSelectionActive: boolean = true;\n @Prop() navigationLabel: string = 'Application navigation';\n @Prop() dashboardLabel: string = 'Dashboard';\n @Prop() settingsLabel: string = 'Settings';\n @Prop() accountLabel: string = 'Account';\n @Prop() helpLabel: string = 'Help & Support';\n /** Show the optional Account shortcut in the sheet header. */\n @Prop() showAccount: boolean = true;\n\n @Event() dsAreaSelect!: EventEmitter<string>;\n @Event() dsBrowseContextChange!: EventEmitter<NavChromeStyle>;\n @Event() dsClose!: EventEmitter<void>;\n\n private get groups(): PanelNavGroup[] {\n return this.browseContext === 'settings' ? this.settingsGroups : this.dashboardGroups;\n }\n\n private get activeId(): string {\n if (!this.routeSelectionActive) return '';\n return deriveActiveIdFromUrl(this.currentUrl, [\n ...this.dashboardGroups.flatMap(group => group.items),\n ...this.settingsGroups.flatMap(group => group.items),\n ]);\n }\n\n @Watch('open')\n handleOpenChange(open: boolean) {\n if (!open) return;\n requestAnimationFrame(() => {\n const selected = this.el.querySelector<HTMLElement>('[aria-current=\"page\"]');\n const first = this.el.querySelector<HTMLElement>('.mobile-sheet-nav__item');\n (selected ?? first)?.focus({ preventScroll: true });\n });\n }\n\n @Listen('keydown')\n handleKeyDown(event: KeyboardEvent) {\n if (!this.open || event.key !== 'Escape') return;\n event.preventDefault();\n this.dsClose.emit();\n }\n\n private handleContextChange = (event: CustomEvent<string>) => {\n const next = event.detail === 'settings' ? 'settings' : 'dashboard';\n if (next === this.browseContext) return;\n this.dsBrowseContextChange.emit(next);\n };\n\n private renderItem(item: PanelNavItem) {\n const selected = item.id === this.activeId;\n return (\n <button\n type=\"button\"\n class={{\n 'mobile-sheet-nav__item': true,\n 'mobile-sheet-nav__item--selected': selected,\n 'ds-control--lg': true,\n 'ds-focus-ring-inset': true,\n 'ds-interaction-fill': true,\n }}\n aria-current={selected ? 'page' : undefined}\n onClick={() => this.dsAreaSelect.emit(item.id)}\n >\n <ds-icon class=\"ds-interaction-fill__content\" name={item.icon} size=\"lg\" color=\"inherit\" />\n <ds-text\n class=\"mobile-sheet-nav__item-label ds-interaction-fill__content\"\n as=\"span\"\n variant=\"text-body-large\"\n emphasis={selected}\n color=\"inherit\"\n >\n {item.label}\n </ds-text>\n {item.dot && (\n <ds-badge\n class=\"mobile-sheet-nav__dot ds-interaction-fill__content\"\n variant=\"dot\"\n hasRing={false}\n label=\"\"\n aria-hidden=\"true\"\n />\n )}\n </button>\n );\n }\n\n private renderLogo() {\n return (\n <span class=\"mobile-sheet-nav__logo\" aria-hidden=\"true\">\n {/* eslint-disable-next-line local/prefer-ds-icon -- Motive brand mark is not part of the IcoMo runtime catalog. */}\n <svg\n class=\"mobile-sheet-nav__logo-mark\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n focusable=\"false\"\n aria-hidden=\"true\"\n >\n <path\n d=\"M11.1159 4.31537H7.67021L2.53401 13.0703H0V15.6875H4.02716L8.24319 8.49978V15.6846H11.6342L15.8289 8.47829V15.6846H18.7122V4.3125H15.2559L11.1159 11.3648V4.31537Z\"\n fill=\"currentColor\"\n />\n </svg>\n </span>\n );\n }\n\n private renderHeaderDestination(\n id: MobileSheetNavHeaderDestinationId,\n icon: string,\n label: string\n ) {\n return (\n <ds-tooltip label={label} side=\"bottom\" size=\"sm\">\n <ds-button-unfilled\n variant=\"icon\"\n size=\"lg\"\n icon={icon}\n aria-label={label}\n activeFill={false}\n hasBorder={false}\n onDsClick={() => this.dsAreaSelect.emit(id)}\n />\n </ds-tooltip>\n );\n }\n\n render() {\n const contextTabs = [\n { ...CONTEXT_TABS[0], label: this.dashboardLabel },\n { ...CONTEXT_TABS[1], label: this.settingsLabel },\n ];\n\n return (\n <Host aria-hidden={this.open ? undefined : 'true'} inert={this.open ? undefined : true}>\n <section id=\"ds-mobile-sheet-nav\" class=\"mobile-sheet-nav\">\n <header\n class={{\n 'mobile-sheet-nav__header': true,\n 'mobile-sheet-nav__header--expanded-context': !this.showAccount,\n 'ds-chrome-grid': true,\n 'ds-chrome-space--md': true,\n }}\n >\n <div class=\"mobile-sheet-nav__brand\">{this.renderLogo()}</div>\n <ds-tab-group\n class=\"mobile-sheet-nav__context\"\n tabs={contextTabs}\n value={this.browseContext}\n size=\"lg\"\n width={this.showAccount ? 'hug' : 'fill'}\n aria-label=\"Browse context\"\n onDsChange={this.handleContextChange}\n />\n <div class=\"mobile-sheet-nav__actions\">\n {this.renderHeaderDestination('help', 'CircleQuestion', this.helpLabel)}\n {this.showAccount\n ? this.renderHeaderDestination('account', 'Avatar', this.accountLabel)\n : null}\n </div>\n </header>\n\n <nav\n class=\"mobile-sheet-nav__body ds-chrome-column ds-chrome-space--md\"\n aria-label={this.navigationLabel}\n >\n <div class=\"mobile-sheet-nav__sections\">\n {this.groups\n .filter(group => group.items.length > 0)\n .map(group => (\n <div class=\"mobile-sheet-nav__items\">\n {group.items.map(item => this.renderItem(item))}\n </div>\n ))}\n </div>\n </nav>\n </section>\n </Host>\n );\n }\n}\n",
|
|
396
|
+
"content": "import {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Listen,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport type { NavChromeStyle } from '../../shell/nav-chrome';\nimport { derivePanelNavSelectionFromUrl } from '../PanelNav/panel-nav-utils';\nimport type {\n PanelNavChildItem,\n PanelNavChildSelectDetail,\n PanelNavGroup,\n PanelNavItem,\n PanelNavPresentation,\n} from '../PanelNav/panel-nav-types';\n\ntype MobileSheetNavHeaderDestinationId = 'account' | 'help';\n\nconst CONTEXT_TABS = [\n { id: 'dashboard', label: 'Dashboard', icon: 'Dashboard', variant: 'icon' as const },\n { id: 'settings', label: 'Settings', icon: 'Gear', variant: 'icon' as const },\n];\nlet nextSheetId = 0;\n\n@Component({\n tag: 'ds-mobile-sheet-nav',\n styleUrl: 'MobileSheetNav.css',\n scoped: true,\n})\nexport class MobileSheetNav {\n @Element() el!: HTMLElement;\n\n @Prop({ reflect: true }) open: boolean = false;\n @Prop() browseContext: NavChromeStyle = 'dashboard';\n @Prop() dashboardGroups: PanelNavGroup[] = [];\n @Prop() settingsGroups: PanelNavGroup[] = [];\n @Prop() currentUrl: string = '';\n /** Flat area navigation or inline disclosure of each area's child routes. */\n @Prop() presentation: PanelNavPresentation = 'flat';\n /** Whether the router-derived current area owns the active mobile stage. */\n @Prop() routeSelectionActive: boolean = true;\n @Prop() navigationLabel: string = 'Application navigation';\n @Prop() dashboardLabel: string = 'Dashboard';\n @Prop() settingsLabel: string = 'Settings';\n @Prop() accountLabel: string = 'Account';\n @Prop() helpLabel: string = 'Help & Support';\n /** Show the optional Account shortcut in the sheet header. */\n @Prop() showAccount: boolean = true;\n\n @Event() dsAreaSelect!: EventEmitter<string>;\n /** Selecting a child requests routing; expanding its parent never navigates. */\n @Event() dsNavChildSelect!: EventEmitter<PanelNavChildSelectDetail>;\n @Event() dsBrowseContextChange!: EventEmitter<NavChromeStyle>;\n @Event() dsClose!: EventEmitter<void>;\n @State() private expandedParentId = '';\n private readonly instanceId = nextSheetId++;\n\n private get groups(): PanelNavGroup[] {\n return this.browseContext === 'settings' ? this.settingsGroups : this.dashboardGroups;\n }\n\n private get selection() {\n return derivePanelNavSelectionFromUrl(\n this.routeSelectionActive ? this.currentUrl : '',\n this.groups.flatMap(group => group.items)\n );\n }\n\n componentWillLoad() {\n this.syncExpandedParent();\n }\n\n @Watch('presentation')\n @Watch('currentUrl')\n @Watch('browseContext')\n @Watch('routeSelectionActive')\n syncExpandedParent() {\n this.expandedParentId = this.presentation === 'nested' ? this.selection.parentId : '';\n }\n\n @Watch('open')\n handleOpenChange(open: boolean) {\n if (!open) return;\n this.syncExpandedParent();\n requestAnimationFrame(() => {\n const selected = this.el.querySelector<HTMLElement>('[aria-current=\"page\"]');\n const first = this.el.querySelector<HTMLElement>('.mobile-sheet-nav__item:not(:disabled)');\n (selected ?? first)?.focus({ preventScroll: true });\n });\n }\n\n @Listen('keydown')\n handleKeyDown(event: KeyboardEvent) {\n if (!this.open || event.key !== 'Escape') return;\n event.preventDefault();\n this.dsClose.emit();\n }\n\n private handleContextChange = (event: CustomEvent<string>) => {\n const next = event.detail === 'settings' ? 'settings' : 'dashboard';\n if (next === this.browseContext) return;\n this.dsBrowseContextChange.emit(next);\n };\n\n private renderItem(item: PanelNavItem) {\n const selected = item.id === this.selection.parentId;\n const disclosure = this.presentation === 'nested' && !!item.children?.length;\n const expanded = disclosure && item.id === this.expandedParentId;\n return (\n <button\n id={this.parentId(item.id)}\n type=\"button\"\n class={{\n 'mobile-sheet-nav__item': true,\n 'mobile-sheet-nav__item--selected': selected,\n 'mobile-sheet-nav__parent--muted':\n this.presentation === 'nested' &&\n this.expandedParentId !== '' &&\n this.expandedParentId !== item.id,\n 'ds-control--lg': true,\n 'ds-focus-ring-inset': true,\n 'ds-interaction-fill': true,\n }}\n aria-current={selected && !disclosure ? 'page' : undefined}\n aria-expanded={disclosure ? String(expanded) : undefined}\n aria-controls={disclosure ? this.childrenId(item.id) : undefined}\n onClick={() =>\n disclosure\n ? (this.expandedParentId = expanded ? '' : item.id)\n : this.dsAreaSelect.emit(item.id)\n }\n >\n <ds-icon class=\"ds-interaction-fill__content\" name={item.icon} size=\"lg\" color=\"inherit\" />\n <ds-text\n class=\"mobile-sheet-nav__item-label ds-interaction-fill__content\"\n as=\"span\"\n variant=\"text-body-large\"\n emphasis={selected}\n color=\"inherit\"\n lineTruncation={1}\n >\n {item.label}\n </ds-text>\n {item.dot && (\n <ds-badge\n class=\"mobile-sheet-nav__dot ds-interaction-fill__content\"\n variant=\"dot\"\n hasRing={false}\n label=\"\"\n aria-hidden=\"true\"\n />\n )}\n </button>\n );\n }\n\n private parentId(id: string) {\n return `mobile-sheet-${this.instanceId}-${encodeURIComponent(id)}`;\n }\n private childrenId(id: string) {\n return `${this.parentId(id)}-children`;\n }\n\n private renderChild(parent: PanelNavItem, child: PanelNavChildItem, index: number) {\n const selected = parent.id === this.selection.parentId && child.id === this.selection.childId;\n return (\n <button\n type=\"button\"\n disabled={child.isInactive}\n class={{\n 'mobile-sheet-nav__item': true,\n 'mobile-sheet-nav__child': true,\n 'mobile-sheet-nav__item--selected': selected,\n 'ds-nav-disclosure__item': true,\n 'ds-control--lg': true,\n 'ds-focus-ring-inset': true,\n 'ds-interaction-fill': true,\n }}\n style={{\n '--ds-nav-disclosure-index': String(index),\n '--ds-nav-disclosure-reverse-index': String((parent.children?.length ?? 0) - index - 1),\n }}\n aria-current={selected ? 'page' : undefined}\n onClick={() => {\n if (!child.isInactive)\n this.dsNavChildSelect.emit({\n parentId: parent.id,\n childId: child.id,\n href: child.href,\n });\n }}\n onKeyDown={(event: KeyboardEvent) => {\n if (event.key === 'ArrowLeft') {\n event.preventDefault();\n this.expandedParentId = '';\n this.el.querySelector<HTMLElement>(`#${CSS.escape(this.parentId(parent.id))}`)?.focus();\n }\n }}\n >\n <ds-text\n class=\"mobile-sheet-nav__item-label ds-interaction-fill__content\"\n as=\"span\"\n variant=\"text-body-large\"\n emphasis={selected}\n color=\"inherit\"\n lineTruncation={1}\n >\n {child.label}\n </ds-text>\n {child.dot ? (\n <ds-badge\n class=\"mobile-sheet-nav__dot ds-interaction-fill__content\"\n variant=\"dot\"\n hasRing={false}\n label=\"\"\n aria-hidden=\"true\"\n />\n ) : null}\n </button>\n );\n }\n\n private renderBranchDivider(position: 'before' | 'after', expanded: boolean) {\n return (\n <div\n class={{\n 'ds-nav-disclosure-divider': true,\n 'ds-nav-disclosure-divider--open': expanded,\n 'mobile-sheet-nav__divider': true,\n [`mobile-sheet-nav__divider--${position}`]: true,\n }}\n aria-hidden=\"true\"\n >\n <div class=\"ds-nav-disclosure-divider__clip\">\n <span class=\"mobile-sheet-nav__divider-line\" />\n </div>\n </div>\n );\n }\n\n private renderBranch(item: PanelNavItem, index: number, count: number) {\n const hasChildren = this.presentation === 'nested' && !!item.children?.length;\n const expanded = hasChildren && this.expandedParentId === item.id;\n return (\n <div key={item.id} class=\"mobile-sheet-nav__branch\">\n {hasChildren && index > 0 ? this.renderBranchDivider('before', expanded) : null}\n {this.renderItem(item)}\n {this.presentation === 'nested' && item.children?.length ? (\n <div\n class={{ 'ds-nav-disclosure': true, 'ds-nav-disclosure--open': expanded }}\n inert={!expanded ? true : undefined}\n aria-hidden={!expanded ? 'true' : undefined}\n >\n <div\n class=\"mobile-sheet-nav__children\"\n id={this.childrenId(item.id)}\n role=\"group\"\n aria-labelledby={this.parentId(item.id)}\n >\n {item.children.map((child, index) => this.renderChild(item, child, index))}\n </div>\n </div>\n ) : null}\n {hasChildren && index < count - 1 ? this.renderBranchDivider('after', expanded) : null}\n </div>\n );\n }\n\n private renderLogo() {\n return (\n <span class=\"mobile-sheet-nav__logo\" aria-hidden=\"true\">\n {/* eslint-disable-next-line local/prefer-ds-icon -- Motive brand mark is not part of the IcoMo runtime catalog. */}\n <svg\n class=\"mobile-sheet-nav__logo-mark\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n focusable=\"false\"\n aria-hidden=\"true\"\n >\n <path\n d=\"M11.1159 4.31537H7.67021L2.53401 13.0703H0V15.6875H4.02716L8.24319 8.49978V15.6846H11.6342L15.8289 8.47829V15.6846H18.7122V4.3125H15.2559L11.1159 11.3648V4.31537Z\"\n fill=\"currentColor\"\n />\n </svg>\n </span>\n );\n }\n\n private renderHeaderDestination(\n id: MobileSheetNavHeaderDestinationId,\n icon: string,\n label: string\n ) {\n return (\n <ds-tooltip label={label} side=\"bottom\" size=\"sm\">\n <ds-button-unfilled\n variant=\"icon\"\n size=\"lg\"\n icon={icon}\n aria-label={label}\n activeFill={false}\n hasBorder={false}\n onDsClick={() => this.dsAreaSelect.emit(id)}\n />\n </ds-tooltip>\n );\n }\n\n render() {\n const contextTabs = [\n { ...CONTEXT_TABS[0], label: this.dashboardLabel },\n { ...CONTEXT_TABS[1], label: this.settingsLabel },\n ];\n\n return (\n <Host aria-hidden={this.open ? undefined : 'true'} inert={this.open ? undefined : true}>\n <section id=\"ds-mobile-sheet-nav\" class=\"mobile-sheet-nav\">\n <header\n class={{\n 'mobile-sheet-nav__header': true,\n 'mobile-sheet-nav__header--expanded-context': !this.showAccount,\n 'ds-chrome-grid': true,\n 'ds-chrome-space--md': true,\n }}\n >\n <div class=\"mobile-sheet-nav__brand\">{this.renderLogo()}</div>\n <ds-tab-group\n class=\"mobile-sheet-nav__context\"\n tabs={contextTabs}\n value={this.browseContext}\n size=\"lg\"\n width={this.showAccount ? 'hug' : 'fill'}\n aria-label=\"Browse context\"\n onDsChange={this.handleContextChange}\n />\n <div class=\"mobile-sheet-nav__actions\">\n {this.renderHeaderDestination('help', 'CircleQuestion', this.helpLabel)}\n {this.showAccount\n ? this.renderHeaderDestination('account', 'Avatar', this.accountLabel)\n : null}\n </div>\n </header>\n\n <nav\n class=\"mobile-sheet-nav__body ds-chrome-column ds-chrome-space--md\"\n aria-label={this.navigationLabel}\n >\n <div class=\"mobile-sheet-nav__sections\">\n {this.groups\n .filter(group => group.items.length > 0)\n .map(group => (\n <div class=\"mobile-sheet-nav__items\">\n {group.items.map((item, index) =>\n this.renderBranch(item, index, group.items.length)\n )}\n </div>\n ))}\n </div>\n </nav>\n </section>\n </Host>\n );\n }\n}\n",
|
|
360
397
|
"type": "registry:ui"
|
|
361
398
|
}
|
|
362
399
|
]
|