@ds-mo/ui 15.2.0 → 15.4.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 +3 -3
- package/dist/agent.json +936 -80
- package/dist/angular/ds-card-setting.d.ts +1 -1
- package/dist/angular/ds-card-setting.js +3 -3
- package/dist/angular/ds-checkbox-group.d.ts +12 -0
- package/dist/angular/ds-checkbox-group.js +38 -0
- package/dist/angular/ds-checkbox.d.ts +1 -1
- package/dist/angular/ds-checkbox.js +3 -3
- package/dist/angular/ds-inline-banner-settings.d.ts +12 -0
- package/dist/angular/ds-inline-banner-settings.js +38 -0
- package/dist/angular/ds-input-time.d.ts +1 -1
- package/dist/angular/ds-input-time.js +3 -3
- package/dist/angular/ds-input.d.ts +5 -1
- package/dist/angular/ds-input.js +10 -4
- package/dist/angular/ds-map-entity-marker.d.ts +1 -1
- package/dist/angular/ds-map-entity-marker.js +3 -3
- package/dist/angular/ds-radio-tile.d.ts +15 -0
- package/dist/angular/ds-radio-tile.js +43 -0
- package/dist/angular/ds-radio.d.ts +1 -1
- package/dist/angular/ds-radio.js +3 -3
- package/dist/angular/ds-setting-row-checkbox.d.ts +12 -0
- package/dist/angular/ds-setting-row-checkbox.js +38 -0
- package/dist/angular/ds-setting-row-radio.d.ts +12 -0
- package/dist/angular/ds-setting-row-radio.js +38 -0
- package/dist/angular/ds-setting-row-toggle.d.ts +18 -0
- package/dist/angular/ds-setting-row-toggle.js +42 -0
- package/dist/angular/ds-slider.d.ts +1 -1
- package/dist/angular/ds-slider.js +3 -3
- package/dist/angular/ds-textarea.d.ts +1 -1
- package/dist/angular/ds-textarea.js +3 -3
- package/dist/angular/ds-time-picker.d.ts +1 -1
- package/dist/angular/ds-time-picker.js +3 -3
- package/dist/angular/index.d.ts +1 -1
- package/dist/angular/index.js +6 -0
- package/dist/angular/number-value-accessor.d.ts +9 -0
- package/dist/angular/number-value-accessor.js +39 -0
- package/dist/angular/proxies.d.ts +6 -0
- package/dist/angular/proxies.js +6 -0
- package/dist/angular/radio-value-accessor.d.ts +1 -1
- package/dist/angular/radio-value-accessor.js +2 -2
- package/dist/angular/select-value-accessor.d.ts +1 -1
- package/dist/angular/select-value-accessor.js +2 -2
- package/dist/angular/text-value-accessor.d.ts +1 -1
- package/dist/angular/text-value-accessor.js +2 -2
- 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-response.js.map +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-inverted.js +1 -1
- package/dist/components/ds-button-inverted.js.map +1 -1
- package/dist/components/ds-button-unfilled.js +1 -1
- package/dist/components/ds-calendar.js +1 -1
- package/dist/components/ds-card-action-center.js +1 -1
- package/dist/components/ds-card-action-center.js.map +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-navigation.js.map +1 -1
- 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-setting.js.map +1 -1
- package/dist/components/ds-card-settings-scope.js +1 -1
- package/dist/components/ds-card-settings-scope.js.map +1 -1
- 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-group.d.ts +11 -0
- package/dist/components/ds-checkbox-group.js +2 -0
- package/dist/components/ds-checkbox-group.js.map +1 -0
- 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-data-customize.js +1 -1
- package/dist/components/ds-data-customize.js.map +1 -1
- package/dist/components/ds-data-filter.js +1 -1
- package/dist/components/ds-data-filter.js.map +1 -1
- package/dist/components/ds-data-group.js +1 -1
- package/dist/components/ds-data-preferences.js +1 -1
- package/dist/components/ds-data-preferences.js.map +1 -1
- package/dist/components/ds-data-saved-views.js +1 -1
- package/dist/components/ds-data-saved-views.js.map +1 -1
- package/dist/components/ds-data-search.js +1 -1
- package/dist/components/ds-data-search.js.map +1 -1
- package/dist/components/ds-data-sort.js +1 -1
- package/dist/components/ds-data-toolbar.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-inline-banner-settings.d.ts +11 -0
- package/dist/components/ds-inline-banner-settings.js +2 -0
- package/dist/components/ds-inline-banner-settings.js.map +1 -0
- package/dist/components/ds-input-date.js +1 -1
- package/dist/components/ds-input-date.js.map +1 -1
- package/dist/components/ds-input-time.js +1 -1
- package/dist/components/ds-input-time.js.map +1 -1
- package/dist/components/ds-input.js +1 -1
- package/dist/components/ds-map-cluster-marker.js +1 -1
- package/dist/components/ds-map-entity-marker.js +1 -1
- package/dist/components/ds-map-entity-marker.js.map +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-composer.js.map +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-tile.d.ts +11 -0
- package/dist/components/ds-radio-tile.js +2 -0
- package/dist/components/ds-radio-tile.js.map +1 -0
- 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-setting-row-checkbox.d.ts +11 -0
- package/dist/components/ds-setting-row-checkbox.js +2 -0
- package/dist/components/ds-setting-row-checkbox.js.map +1 -0
- package/dist/components/ds-setting-row-radio.d.ts +11 -0
- package/dist/components/ds-setting-row-radio.js +2 -0
- package/dist/components/ds-setting-row-radio.js.map +1 -0
- package/dist/components/ds-setting-row-toggle.d.ts +11 -0
- package/dist/components/ds-setting-row-toggle.js +2 -0
- package/dist/components/ds-setting-row-toggle.js.map +1 -0
- 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-slider.js.map +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.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-time-picker.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-7TVdPhGR.js +2 -0
- package/dist/components/{p-YrnU2fM7.js.map → p-7TVdPhGR.js.map} +1 -1
- package/dist/components/{p-7V1AhetH.js → p-B0BQCVkq.js} +2 -2
- package/dist/components/p-B0EpvBDs.js +2 -0
- package/dist/components/{p-lamoJZE4.js.map → p-B0EpvBDs.js.map} +1 -1
- package/dist/components/{p-Cu8o2rOz.js → p-B39iJO8F.js} +2 -2
- package/dist/components/p-B9TM6FqC.js +2 -0
- package/dist/components/{p-BJJh-Bf7.js.map → p-B9TM6FqC.js.map} +1 -1
- package/dist/components/{p-B6qQaYkB.js → p-B9y6azEw.js} +2 -2
- package/dist/components/p-BDdlJZyL.js +2 -0
- package/dist/components/{p-CZ7hxDy_.js.map → p-BDdlJZyL.js.map} +1 -1
- package/dist/components/{p-5SVmAjXY.js → p-BERXvOCf.js} +2 -2
- package/dist/components/{p-xhn1cZgU.js → p-BFHpU-uU.js} +2 -2
- package/dist/components/{p-CuWPWC3t.js → p-BQspV5U7.js} +2 -2
- package/dist/components/p-BWSIw8AQ.js +2 -0
- package/dist/components/p-BWSIw8AQ.js.map +1 -0
- package/dist/components/p-BhjqYTiY.js +2 -0
- package/dist/components/p-BhjqYTiY.js.map +1 -0
- package/dist/components/{p-BOhefRMt.js → p-Bk3poU91.js} +2 -2
- package/dist/components/{p-QWukusRL.js → p-BnuNaXR2.js} +2 -2
- package/dist/components/p-BwdnVqAY.js +2 -0
- package/dist/components/p-BwdnVqAY.js.map +1 -0
- package/dist/components/p-C4huuwed.js +2 -0
- package/dist/components/{p-CRk0TjQv.js.map → p-C4huuwed.js.map} +1 -1
- package/dist/components/{p-BtnTQp4K.js → p-C8V4lkVy.js} +2 -2
- package/dist/components/p-CJ1NnOEW.js +2 -0
- package/dist/components/p-CJ1NnOEW.js.map +1 -0
- package/dist/components/p-CPamUzaj.js +2 -0
- package/dist/components/{p-CNZ6-kWd.js.map → p-CPamUzaj.js.map} +1 -1
- package/dist/components/{p-Dqfc6Nvd.js → p-CUDocY23.js} +2 -2
- package/dist/components/{p-Dqfc6Nvd.js.map → p-CUDocY23.js.map} +1 -1
- package/dist/components/p-CX6ZxUQT.js +2 -0
- package/dist/components/p-CX6ZxUQT.js.map +1 -0
- package/dist/components/p-CZNZTcYS.js +2 -0
- package/dist/components/p-CZNZTcYS.js.map +1 -0
- package/dist/components/p-CbCN9ew9.js +2 -0
- package/dist/components/p-CbCN9ew9.js.map +1 -0
- package/dist/components/p-CeXf9-X3.js.map +1 -1
- package/dist/components/p-Cgn-BORA.js +2 -0
- package/dist/components/p-Cgn-BORA.js.map +1 -0
- package/dist/components/{p-mux14tWZ.js → p-Co1rUdOR.js} +2 -2
- package/dist/components/p-Co1rUdOR.js.map +1 -0
- package/dist/components/{p-CGidq1iC.js → p-CuwopElg.js} +2 -2
- package/dist/components/p-CwUXroLs.js +2 -0
- package/dist/components/{p-etg-Uk1u.js.map → p-CwUXroLs.js.map} +1 -1
- package/dist/components/{p-Cn6AfzeF.js → p-CwdRaJER.js} +2 -2
- package/dist/components/p-D6FRqNhN.js +2 -0
- package/dist/components/p-D6FRqNhN.js.map +1 -0
- package/dist/components/{p-ZwRLjD5M.js → p-D8OWhnID.js} +2 -2
- package/dist/components/p-DCyJ3_PL.js +2 -0
- package/dist/components/{p-BZ_e69zx.js.map → p-DCyJ3_PL.js.map} +1 -1
- package/dist/components/{p-C_Ma6Xa-.js → p-DIQiHX0q.js} +2 -2
- package/dist/components/{p-B3CZvMXs.js → p-DJDbskZf.js} +2 -2
- package/dist/components/p-DRdoGSGX.js +2 -0
- package/dist/components/{p-CTGgXIXM.js.map → p-DRdoGSGX.js.map} +1 -1
- package/dist/components/{p-C1gaWjOm.js → p-DSZPO06T.js} +2 -2
- package/dist/components/{p-uADksYMl.js → p-DSmDyI2o.js} +2 -2
- package/dist/components/{p-UY63jmrO.js → p-DVEx-Xg9.js} +2 -2
- package/dist/components/p-DXk1eml1.js +2 -0
- package/dist/components/{p-Dlp1HqgS.js.map → p-DXk1eml1.js.map} +1 -1
- package/dist/components/{p-p0FVyEFa.js → p-DYQa1DVF.js} +2 -2
- package/dist/components/p-DYQa1DVF.js.map +1 -0
- package/dist/components/p-DYsE6HLk.js +2 -0
- package/dist/components/p-DYsE6HLk.js.map +1 -0
- package/dist/components/{p-vfCu7XSc.js → p-DZ58Sg5a.js} +2 -2
- package/dist/components/p-DebLYW7A.js +2 -0
- package/dist/components/p-DebLYW7A.js.map +1 -0
- package/dist/components/p-DhKvqh5G.js +2 -0
- package/dist/components/p-DhKvqh5G.js.map +1 -0
- package/dist/components/{p-DFO5lV_A.js → p-DmSnHVW6.js} +2 -2
- package/dist/components/p-Dnt5xUBD.js +2 -0
- package/dist/components/{p-BR5OC2PX.js.map → p-Dnt5xUBD.js.map} +1 -1
- package/dist/components/p-Doa2blZT.js +2 -0
- package/dist/components/{p-BLuqpHvp.js.map → p-Doa2blZT.js.map} +1 -1
- package/dist/components/{p-DsLXlxt3.js → p-Dyqd-cub.js} +2 -2
- package/dist/components/p-Dyqd-cub.js.map +1 -0
- package/dist/components/p-DzvTC27M.js +2 -0
- package/dist/components/p-DzvTC27M.js.map +1 -0
- package/dist/components/p-JBki_jyY.js +2 -0
- package/dist/components/{p-C0JkLR83.js.map → p-JBki_jyY.js.map} +1 -1
- package/dist/components/p-MOJmB6vX.js +2 -0
- package/dist/components/{p-BzYW1IqO.js.map → p-MOJmB6vX.js.map} +1 -1
- package/dist/components/p-TVkFIMXz.js +2 -0
- package/dist/components/p-TVkFIMXz.js.map +1 -0
- package/dist/components/{p-ER5M085B.js → p-UJMEz8_O.js} +2 -2
- package/dist/components/{p-CR-Jjdcn.js → p-_IqSPt5V.js} +2 -2
- package/dist/components/p-g0jsfEXz.js +2 -0
- package/dist/components/{p-BfF4RZdp.js.map → p-g0jsfEXz.js.map} +1 -1
- package/dist/components/{p-BLSSaVWm.js → p-pp1IQN4Z.js} +2 -2
- package/dist/docs/components.json +2901 -835
- package/dist/framework/angular.d.ts +1 -0
- package/dist/framework/angular.js +1 -0
- package/dist/lib/shell/index.js +1 -1
- package/dist/lib/shell/index.js.map +1 -1
- package/dist/lint/index.js +1 -1
- package/dist/mcp-data/registry/agent-activity.json +2 -2
- package/dist/mcp-data/registry/agent-questionnaire.json +2 -2
- package/dist/mcp-data/registry/agent-response.json +3 -3
- package/dist/mcp-data/registry/agent-source-list.json +2 -2
- package/dist/mcp-data/registry/agent-tool-call.json +2 -2
- package/dist/mcp-data/registry/attachment-list.json +2 -2
- package/dist/mcp-data/registry/avatar.json +2 -2
- package/dist/mcp-data/registry/badge.json +2 -2
- package/dist/mcp-data/registry/banner.json +2 -2
- package/dist/mcp-data/registry/bar-action.json +2 -2
- package/dist/mcp-data/registry/bar-nav.json +5 -5
- package/dist/mcp-data/registry/bar-page-title.json +4 -4
- package/dist/mcp-data/registry/bar-title.json +4 -4
- package/dist/mcp-data/registry/bar-workflow.json +2 -2
- package/dist/mcp-data/registry/breadcrumb.json +2 -2
- package/dist/mcp-data/registry/button-filled.json +2 -2
- package/dist/mcp-data/registry/button-inverted.json +2 -2
- package/dist/mcp-data/registry/button-unfilled.json +9 -9
- package/dist/mcp-data/registry/calendar.json +2 -2
- package/dist/mcp-data/registry/card-action-center.json +2 -2
- package/dist/mcp-data/registry/card-chart.json +2 -2
- package/dist/mcp-data/registry/card-navigation.json +2 -2
- package/dist/mcp-data/registry/card-overview.json +2 -2
- package/dist/mcp-data/registry/card-setting.json +50 -15
- package/dist/mcp-data/registry/card-settings-scope.json +2 -2
- package/dist/mcp-data/registry/chart-legend.json +2 -2
- package/dist/mcp-data/registry/chart.json +2 -2
- package/dist/mcp-data/registry/checkbox-group.json +246 -0
- package/dist/mcp-data/registry/checkbox.json +26 -6
- package/dist/mcp-data/registry/chip.json +2 -2
- package/dist/mcp-data/registry/code-block.json +2 -2
- package/dist/mcp-data/registry/conversation-list-item.json +2 -2
- package/dist/mcp-data/registry/conversation-list-section.json +2 -2
- package/dist/mcp-data/registry/conversation-list.json +2 -2
- package/dist/mcp-data/registry/data-customize.json +3 -3
- package/dist/mcp-data/registry/data-filter.json +2 -2
- package/dist/mcp-data/registry/data-group.json +2 -2
- package/dist/mcp-data/registry/data-preferences.json +2 -2
- package/dist/mcp-data/registry/data-saved-views.json +2 -2
- package/dist/mcp-data/registry/data-search.json +2 -2
- package/dist/mcp-data/registry/data-sort.json +2 -2
- package/dist/mcp-data/registry/data-toolbar.json +2 -2
- package/dist/mcp-data/registry/divider.json +2 -2
- package/dist/mcp-data/registry/empty-state.json +27 -14
- package/dist/mcp-data/registry/field.json +6 -5
- package/dist/mcp-data/registry/filter-menu.json +2 -2
- package/dist/mcp-data/registry/icon.json +2 -2
- package/dist/mcp-data/registry/inline-banner-settings.json +175 -0
- package/dist/mcp-data/registry/input-date.json +2 -2
- package/dist/mcp-data/registry/input-time.json +26 -7
- package/dist/mcp-data/registry/input.json +265 -15
- package/dist/mcp-data/registry/loader.json +2 -2
- package/dist/mcp-data/registry/map-cluster-marker.json +3 -3
- package/dist/mcp-data/registry/map-entity-marker.json +56 -56
- package/dist/mcp-data/registry/markdown.json +2 -2
- package/dist/mcp-data/registry/menu.json +2 -2
- package/dist/mcp-data/registry/message-actions.json +2 -2
- package/dist/mcp-data/registry/message-bubble.json +5 -5
- package/dist/mcp-data/registry/message-composer.json +7 -7
- package/dist/mcp-data/registry/message-scroller.json +2 -2
- package/dist/mcp-data/registry/message.json +3 -3
- package/dist/mcp-data/registry/mobile-bar-nav.json +2 -2
- package/dist/mcp-data/registry/mobile-header.json +2 -2
- package/dist/mcp-data/registry/mobile-section-switcher.json +2 -2
- package/dist/mcp-data/registry/mobile-sheet-nav.json +2 -2
- package/dist/mcp-data/registry/modal.json +2 -2
- package/dist/mcp-data/registry/pagination.json +2 -2
- package/dist/mcp-data/registry/panel-nav.json +4 -4
- package/dist/mcp-data/registry/panel-sub-nav.json +2 -2
- package/dist/mcp-data/registry/panel-tool-header.json +4 -4
- package/dist/mcp-data/registry/panel-tool-search.json +3 -3
- package/dist/mcp-data/registry/panel-tools.json +4 -4
- package/dist/mcp-data/registry/paper-texture.json +2 -2
- package/dist/mcp-data/registry/radio-tile.json +399 -0
- package/dist/mcp-data/registry/radio.json +51 -9
- package/dist/mcp-data/registry/registry.json +954 -80
- package/dist/mcp-data/registry/score.json +2 -2
- package/dist/mcp-data/registry/scroll-overlay.json +2 -2
- package/dist/mcp-data/registry/select.json +2 -2
- package/dist/mcp-data/registry/setting-row-checkbox.json +197 -0
- package/dist/mcp-data/registry/setting-row-radio.json +196 -0
- package/dist/mcp-data/registry/setting-row-toggle.json +233 -0
- package/dist/mcp-data/registry/shell-app.json +4 -4
- package/dist/mcp-data/registry/shell-page.json +2 -2
- package/dist/mcp-data/registry/shell-tools.json +2 -2
- package/dist/mcp-data/registry/skeleton.json +2 -2
- package/dist/mcp-data/registry/slider.json +32 -12
- package/dist/mcp-data/registry/swatch-picker.json +2 -2
- package/dist/mcp-data/registry/switch.json +4 -4
- package/dist/mcp-data/registry/tab-group.json +2 -2
- package/dist/mcp-data/registry/table.json +5 -5
- package/dist/mcp-data/registry/tag.json +2 -2
- package/dist/mcp-data/registry/text.json +2 -2
- package/dist/mcp-data/registry/textarea.json +72 -5
- package/dist/mcp-data/registry/time-picker.json +28 -9
- package/dist/mcp-data/registry/toast.json +2 -2
- package/dist/mcp-data/registry/tooltip-chart.json +2 -2
- package/dist/mcp-data/registry/tooltip.json +2 -2
- package/dist/mcp-data/registry/typing-indicator.json +2 -2
- package/dist/react/components.d.ts +6 -0
- package/dist/react/components.js +6 -0
- package/dist/react/ds-checkbox-group.d.ts +9 -0
- package/dist/react/ds-checkbox-group.js +12 -0
- package/dist/react/ds-inline-banner-settings.d.ts +9 -0
- package/dist/react/ds-inline-banner-settings.js +12 -0
- package/dist/react/ds-input.d.ts +2 -0
- package/dist/react/ds-input.js +2 -0
- package/dist/react/ds-radio-tile.d.ts +12 -0
- package/dist/react/ds-radio-tile.js +12 -0
- package/dist/react/ds-setting-row-checkbox.d.ts +9 -0
- package/dist/react/ds-setting-row-checkbox.js +12 -0
- package/dist/react/ds-setting-row-radio.d.ts +9 -0
- package/dist/react/ds-setting-row-radio.js +12 -0
- package/dist/react/ds-setting-row-toggle.d.ts +12 -0
- package/dist/react/ds-setting-row-toggle.js +12 -0
- package/dist/types/components/BarPageTitle/BarPageTitle.d.ts +2 -0
- package/dist/types/components/BarTitle/bar-title-action-chrome.d.ts +4 -0
- package/dist/types/components/ButtonUnfilled/ButtonUnfilled.d.ts +5 -2
- package/dist/types/components/CardSetting/CardSetting.d.ts +15 -3
- package/dist/types/components/CardSetting/index.d.ts +1 -1
- package/dist/types/components/Checkbox/Checkbox.d.ts +2 -0
- package/dist/types/components/CheckboxGroup/CheckboxGroup.d.ts +20 -0
- package/dist/types/components/EmptyState/EmptyState.d.ts +3 -0
- package/dist/types/components/Field/Field.d.ts +4 -0
- package/dist/types/components/InlineBannerSettings/InlineBannerSettings.d.ts +6 -0
- package/dist/types/components/Input/Input.d.ts +50 -1
- package/dist/types/components/InputTime/InputTime.d.ts +3 -0
- package/dist/types/components/MapEntityMarker/MapEntityMarker.d.ts +5 -5
- package/dist/types/components/Radio/Radio.d.ts +8 -0
- package/dist/types/components/RadioTile/RadioTile.d.ts +40 -0
- package/dist/types/components/RadioTile/index.d.ts +2 -0
- package/dist/types/components/SettingRowCheckbox/SettingRowCheckbox.d.ts +19 -0
- package/dist/types/components/SettingRowRadio/SettingRowRadio.d.ts +19 -0
- package/dist/types/components/SettingRowToggle/SettingRowToggle.d.ts +21 -0
- package/dist/types/components/Slider/Slider.d.ts +8 -1
- package/dist/types/components/Slider/index.d.ts +1 -1
- package/dist/types/components/Switch/Switch.d.ts +7 -0
- package/dist/types/components/Textarea/Textarea.d.ts +12 -0
- package/dist/types/components/TimePicker/TimePicker.d.ts +4 -0
- package/dist/types/components.d.ts +728 -37
- package/dist/types/utils/text-constraints.d.ts +20 -0
- package/dist/vue/components.d.ts +6 -0
- package/dist/vue/components.js +6 -0
- package/dist/vue/ds-card-setting.js +1 -0
- package/dist/vue/ds-checkbox-group.d.ts +3 -0
- package/dist/vue/ds-checkbox-group.js +12 -0
- package/dist/vue/ds-checkbox.js +1 -0
- package/dist/vue/ds-inline-banner-settings.d.ts +3 -0
- package/dist/vue/ds-inline-banner-settings.js +8 -0
- package/dist/vue/ds-input-time.js +1 -0
- package/dist/vue/ds-input.js +17 -0
- package/dist/vue/ds-map-entity-marker.js +2 -2
- package/dist/vue/ds-radio-tile.d.ts +3 -0
- package/dist/vue/ds-radio-tile.js +24 -0
- package/dist/vue/ds-radio.js +2 -0
- package/dist/vue/ds-setting-row-checkbox.d.ts +3 -0
- package/dist/vue/ds-setting-row-checkbox.js +11 -0
- package/dist/vue/ds-setting-row-radio.d.ts +3 -0
- package/dist/vue/ds-setting-row-radio.js +11 -0
- package/dist/vue/ds-setting-row-toggle.d.ts +3 -0
- package/dist/vue/ds-setting-row-toggle.js +15 -0
- package/dist/vue/ds-slider.d.ts +1 -1
- package/dist/vue/ds-slider.js +2 -1
- package/dist/vue/ds-textarea.js +4 -0
- package/dist/vue/ds-time-picker.js +1 -0
- package/package.json +5 -5
- package/dist/components/p-BCnzbfma.js +0 -2
- package/dist/components/p-BCnzbfma.js.map +0 -1
- package/dist/components/p-BJJh-Bf7.js +0 -2
- package/dist/components/p-BLuqpHvp.js +0 -2
- package/dist/components/p-BR5OC2PX.js +0 -2
- package/dist/components/p-BX506yEW.js +0 -2
- package/dist/components/p-BX506yEW.js.map +0 -1
- package/dist/components/p-BZ_e69zx.js +0 -2
- package/dist/components/p-BfF4RZdp.js +0 -2
- package/dist/components/p-Br5e83Fr.js +0 -2
- package/dist/components/p-Br5e83Fr.js.map +0 -1
- package/dist/components/p-Bv9rSkp0.js +0 -2
- package/dist/components/p-Bv9rSkp0.js.map +0 -1
- package/dist/components/p-BzYW1IqO.js +0 -2
- package/dist/components/p-C0JkLR83.js +0 -2
- package/dist/components/p-C6Aavz9h.js +0 -2
- package/dist/components/p-C6Aavz9h.js.map +0 -1
- package/dist/components/p-C6zycbhC.js +0 -2
- package/dist/components/p-C6zycbhC.js.map +0 -1
- package/dist/components/p-CNZ6-kWd.js +0 -2
- package/dist/components/p-CRk0TjQv.js +0 -2
- package/dist/components/p-CTGgXIXM.js +0 -2
- package/dist/components/p-CZ7hxDy_.js +0 -2
- package/dist/components/p-Cc3ZUQlJ.js +0 -2
- package/dist/components/p-Cc3ZUQlJ.js.map +0 -1
- package/dist/components/p-D5HxZrMA.js +0 -2
- package/dist/components/p-D5HxZrMA.js.map +0 -1
- package/dist/components/p-D7K1ZHML.js +0 -2
- package/dist/components/p-D7K1ZHML.js.map +0 -1
- package/dist/components/p-Dlp1HqgS.js +0 -2
- package/dist/components/p-DsLXlxt3.js.map +0 -1
- package/dist/components/p-YrnU2fM7.js +0 -2
- package/dist/components/p-ZYWnJaye.js +0 -2
- package/dist/components/p-ZYWnJaye.js.map +0 -1
- package/dist/components/p-etg-Uk1u.js +0 -2
- package/dist/components/p-lamoJZE4.js +0 -2
- package/dist/components/p-mV4vSjSK.js +0 -2
- package/dist/components/p-mV4vSjSK.js.map +0 -1
- package/dist/components/p-mux14tWZ.js.map +0 -1
- package/dist/components/p-mxZoWfnS.js +0 -2
- package/dist/components/p-mxZoWfnS.js.map +0 -1
- package/dist/components/p-p0FVyEFa.js.map +0 -1
- package/dist/components/p-xtGGIZmU.js +0 -2
- package/dist/components/p-xtGGIZmU.js.map +0 -1
- /package/dist/components/{p-7V1AhetH.js.map → p-B0BQCVkq.js.map} +0 -0
- /package/dist/components/{p-Cu8o2rOz.js.map → p-B39iJO8F.js.map} +0 -0
- /package/dist/components/{p-B6qQaYkB.js.map → p-B9y6azEw.js.map} +0 -0
- /package/dist/components/{p-5SVmAjXY.js.map → p-BERXvOCf.js.map} +0 -0
- /package/dist/components/{p-xhn1cZgU.js.map → p-BFHpU-uU.js.map} +0 -0
- /package/dist/components/{p-CuWPWC3t.js.map → p-BQspV5U7.js.map} +0 -0
- /package/dist/components/{p-BOhefRMt.js.map → p-Bk3poU91.js.map} +0 -0
- /package/dist/components/{p-QWukusRL.js.map → p-BnuNaXR2.js.map} +0 -0
- /package/dist/components/{p-BtnTQp4K.js.map → p-C8V4lkVy.js.map} +0 -0
- /package/dist/components/{p-CGidq1iC.js.map → p-CuwopElg.js.map} +0 -0
- /package/dist/components/{p-Cn6AfzeF.js.map → p-CwdRaJER.js.map} +0 -0
- /package/dist/components/{p-ZwRLjD5M.js.map → p-D8OWhnID.js.map} +0 -0
- /package/dist/components/{p-C_Ma6Xa-.js.map → p-DIQiHX0q.js.map} +0 -0
- /package/dist/components/{p-B3CZvMXs.js.map → p-DJDbskZf.js.map} +0 -0
- /package/dist/components/{p-C1gaWjOm.js.map → p-DSZPO06T.js.map} +0 -0
- /package/dist/components/{p-uADksYMl.js.map → p-DSmDyI2o.js.map} +0 -0
- /package/dist/components/{p-UY63jmrO.js.map → p-DVEx-Xg9.js.map} +0 -0
- /package/dist/components/{p-vfCu7XSc.js.map → p-DZ58Sg5a.js.map} +0 -0
- /package/dist/components/{p-DFO5lV_A.js.map → p-DmSnHVW6.js.map} +0 -0
- /package/dist/components/{p-ER5M085B.js.map → p-UJMEz8_O.js.map} +0 -0
- /package/dist/components/{p-CR-Jjdcn.js.map → p-_IqSPt5V.js.map} +0 -0
- /package/dist/components/{p-BLSSaVWm.js.map → p-pp1IQN4Z.js.map} +0 -0
|
@@ -136,8 +136,8 @@
|
|
|
136
136
|
"complexPropertyNote": "Assign these non-primitive values as JavaScript properties: items.",
|
|
137
137
|
"peerDependencies": {
|
|
138
138
|
"required": [
|
|
139
|
-
"@ds-mo/tokens ^6.
|
|
140
|
-
"@ds-mo/icons ^8.1.
|
|
139
|
+
"@ds-mo/tokens ^6.6.1",
|
|
140
|
+
"@ds-mo/icons ^8.1.1"
|
|
141
141
|
],
|
|
142
142
|
"frameworks": "Custom Elements; React 18/19 wrappers; Vue 3 wrappers; Angular 19-22 standalone adapters."
|
|
143
143
|
}
|
|
@@ -241,8 +241,8 @@
|
|
|
241
241
|
"complexPropertyNote": "Assign these non-primitive values as JavaScript properties: answers, labels, questions.",
|
|
242
242
|
"peerDependencies": {
|
|
243
243
|
"required": [
|
|
244
|
-
"@ds-mo/tokens ^6.
|
|
245
|
-
"@ds-mo/icons ^8.1.
|
|
244
|
+
"@ds-mo/tokens ^6.6.1",
|
|
245
|
+
"@ds-mo/icons ^8.1.1"
|
|
246
246
|
],
|
|
247
247
|
"frameworks": "Custom Elements; React 18/19 wrappers; Vue 3 wrappers; Angular 19-22 standalone adapters."
|
|
248
248
|
}
|
|
@@ -239,8 +239,8 @@
|
|
|
239
239
|
"complexPropertyNote": "Assign these non-primitive values as JavaScript properties: parts.",
|
|
240
240
|
"peerDependencies": {
|
|
241
241
|
"required": [
|
|
242
|
-
"@ds-mo/tokens ^6.
|
|
243
|
-
"@ds-mo/icons ^8.1.
|
|
242
|
+
"@ds-mo/tokens ^6.6.1",
|
|
243
|
+
"@ds-mo/icons ^8.1.1"
|
|
244
244
|
],
|
|
245
245
|
"frameworks": "Custom Elements; React 18/19 wrappers; Vue 3 wrappers; Angular 19-22 standalone adapters."
|
|
246
246
|
}
|
|
@@ -262,7 +262,7 @@
|
|
|
262
262
|
"files": [
|
|
263
263
|
{
|
|
264
264
|
"path": "src/wc/components/AgentResponse/AgentResponse.css",
|
|
265
|
-
"content": ":host {\n display: block;\n width: 100%;\n --ds-prose-text-max-inline-size: var(--dimension-panel-width-lg);\n -webkit-user-select: none;\n user-select: none;\n}\n.agent-response {\n display: grid;\n gap: var(--dimension-space-150);\n min-width: 0;\n width: 100%;\n -webkit-user-select: none;\n user-select: none;\n}\n",
|
|
265
|
+
"content": ":host {\n display: block;\n width: 100%;\n --ds-prose-text-max-inline-size: var(--dimension-panel-width-lg);\n -webkit-user-select: none;\n user-select: none;\n}\n.agent-response {\n display: grid;\n gap: var(--dimension-space-150);\n min-width: 0;\n width: 100%;\n color: var(--color-foreground-secondary);\n -webkit-user-select: none;\n user-select: none;\n}\n",
|
|
266
266
|
"type": "registry:ui"
|
|
267
267
|
},
|
|
268
268
|
{
|
|
@@ -152,8 +152,8 @@
|
|
|
152
152
|
"complexPropertyNote": "Assign these non-primitive values as JavaScript properties: items.",
|
|
153
153
|
"peerDependencies": {
|
|
154
154
|
"required": [
|
|
155
|
-
"@ds-mo/tokens ^6.
|
|
156
|
-
"@ds-mo/icons ^8.1.
|
|
155
|
+
"@ds-mo/tokens ^6.6.1",
|
|
156
|
+
"@ds-mo/icons ^8.1.1"
|
|
157
157
|
],
|
|
158
158
|
"frameworks": "Custom Elements; React 18/19 wrappers; Vue 3 wrappers; Angular 19-22 standalone adapters."
|
|
159
159
|
}
|
|
@@ -232,8 +232,8 @@
|
|
|
232
232
|
"complexPropertyNote": "Assign these non-primitive values as JavaScript properties: input, output.",
|
|
233
233
|
"peerDependencies": {
|
|
234
234
|
"required": [
|
|
235
|
-
"@ds-mo/tokens ^6.
|
|
236
|
-
"@ds-mo/icons ^8.1.
|
|
235
|
+
"@ds-mo/tokens ^6.6.1",
|
|
236
|
+
"@ds-mo/icons ^8.1.1"
|
|
237
237
|
],
|
|
238
238
|
"frameworks": "Custom Elements; React 18/19 wrappers; Vue 3 wrappers; Angular 19-22 standalone adapters."
|
|
239
239
|
}
|
|
@@ -116,8 +116,8 @@
|
|
|
116
116
|
"complexPropertyNote": "Assign these non-primitive values as JavaScript properties: items.",
|
|
117
117
|
"peerDependencies": {
|
|
118
118
|
"required": [
|
|
119
|
-
"@ds-mo/tokens ^6.
|
|
120
|
-
"@ds-mo/icons ^8.1.
|
|
119
|
+
"@ds-mo/tokens ^6.6.1",
|
|
120
|
+
"@ds-mo/icons ^8.1.1"
|
|
121
121
|
],
|
|
122
122
|
"frameworks": "Custom Elements; React 18/19 wrappers; Vue 3 wrappers; Angular 19-22 standalone adapters."
|
|
123
123
|
}
|
|
@@ -168,8 +168,8 @@
|
|
|
168
168
|
},
|
|
169
169
|
"peerDependencies": {
|
|
170
170
|
"required": [
|
|
171
|
-
"@ds-mo/tokens ^6.
|
|
172
|
-
"@ds-mo/icons ^8.1.
|
|
171
|
+
"@ds-mo/tokens ^6.6.1",
|
|
172
|
+
"@ds-mo/icons ^8.1.1"
|
|
173
173
|
],
|
|
174
174
|
"frameworks": "Custom Elements; React 18/19 wrappers; Vue 3 wrappers; Angular 19-22 standalone adapters."
|
|
175
175
|
}
|
|
@@ -291,8 +291,8 @@
|
|
|
291
291
|
},
|
|
292
292
|
"peerDependencies": {
|
|
293
293
|
"required": [
|
|
294
|
-
"@ds-mo/tokens ^6.
|
|
295
|
-
"@ds-mo/icons ^8.1.
|
|
294
|
+
"@ds-mo/tokens ^6.6.1",
|
|
295
|
+
"@ds-mo/icons ^8.1.1"
|
|
296
296
|
],
|
|
297
297
|
"frameworks": "Custom Elements; React 18/19 wrappers; Vue 3 wrappers; Angular 19-22 standalone adapters."
|
|
298
298
|
}
|
|
@@ -334,8 +334,8 @@
|
|
|
334
334
|
},
|
|
335
335
|
"peerDependencies": {
|
|
336
336
|
"required": [
|
|
337
|
-
"@ds-mo/tokens ^6.
|
|
338
|
-
"@ds-mo/icons ^8.1.
|
|
337
|
+
"@ds-mo/tokens ^6.6.1",
|
|
338
|
+
"@ds-mo/icons ^8.1.1"
|
|
339
339
|
],
|
|
340
340
|
"frameworks": "Custom Elements; React 18/19 wrappers; Vue 3 wrappers; Angular 19-22 standalone adapters."
|
|
341
341
|
}
|
|
@@ -236,8 +236,8 @@
|
|
|
236
236
|
},
|
|
237
237
|
"peerDependencies": {
|
|
238
238
|
"required": [
|
|
239
|
-
"@ds-mo/tokens ^6.
|
|
240
|
-
"@ds-mo/icons ^8.1.
|
|
239
|
+
"@ds-mo/tokens ^6.6.1",
|
|
240
|
+
"@ds-mo/icons ^8.1.1"
|
|
241
241
|
],
|
|
242
242
|
"frameworks": "Custom Elements; React 18/19 wrappers; Vue 3 wrappers; Angular 19-22 standalone adapters."
|
|
243
243
|
}
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
}
|
|
109
109
|
],
|
|
110
110
|
"styling": {
|
|
111
|
-
"rationale": "The host participates in
|
|
111
|
+
"rationale": "The host participates in ShellApp-owned layout; ShellApp owns the shared Chrome base and wash while BarNav owns Chrome foreground, border, and interaction recipes.",
|
|
112
112
|
"protected": [],
|
|
113
113
|
"customProperties": []
|
|
114
114
|
}
|
|
@@ -291,8 +291,8 @@
|
|
|
291
291
|
"complexPropertyNote": "Assign these non-primitive values as JavaScript properties: tabs.",
|
|
292
292
|
"peerDependencies": {
|
|
293
293
|
"required": [
|
|
294
|
-
"@ds-mo/tokens ^6.
|
|
295
|
-
"@ds-mo/icons ^8.1.
|
|
294
|
+
"@ds-mo/tokens ^6.6.1",
|
|
295
|
+
"@ds-mo/icons ^8.1.1"
|
|
296
296
|
],
|
|
297
297
|
"frameworks": "Custom Elements; React 18/19 wrappers; Vue 3 wrappers; Angular 19-22 standalone adapters."
|
|
298
298
|
}
|
|
@@ -311,12 +311,12 @@
|
|
|
311
311
|
"files": [
|
|
312
312
|
{
|
|
313
313
|
"path": "src/wc/components/BarNav/BarNav.css",
|
|
314
|
-
"content": "@import '../../utils/radius.css';\n@import '../../utils/control-density.css';\n@import '../../utils/control-parts.css';\n@import '../../utils/chrome-layout.css';\n@import '../../utils/focus-ring.css';\n@import '../../utils/control-inactive.css';\n\n:host {\n display: block;\n}\n\n.bar-nav {\n position: relative;\n height: var(--dimension-size-600);\n border-bottom: var(--dimension-stroke-width-012) solid var(--_bar-nav-border);\n background-color: var(--_bar-nav-bg);\n color: var(--_bar-nav-fg-primary);\n -webkit-user-select: none;\n user-select: none;\n overflow: hidden;\n transition:\n background-color var(--effect-motion-short-3),\n border-color var(--effect-motion-short-3),\n color var(--effect-motion-short-3);\n isolation: isolate;\n /* Default
|
|
314
|
+
"content": "@import '../../utils/radius.css';\n@import '../../utils/control-density.css';\n@import '../../utils/control-parts.css';\n@import '../../utils/chrome-layout.css';\n@import '../../utils/focus-ring.css';\n@import '../../utils/control-inactive.css';\n@import '../../utils/interaction-fill.css';\n\n:host {\n display: block;\n}\n\n.bar-nav {\n position: relative;\n height: var(--dimension-size-600);\n border-bottom: var(--dimension-stroke-width-012) solid var(--_bar-nav-border);\n background-color: var(--_bar-nav-bg);\n color: var(--_bar-nav-fg-primary);\n -webkit-user-select: none;\n user-select: none;\n overflow: hidden;\n transition:\n background-color var(--effect-motion-short-3),\n border-color var(--effect-motion-short-3),\n color var(--effect-motion-short-3);\n isolation: isolate;\n /* Default Chrome — ShellApp owns the shared base surface. */\n --_bar-nav-bg: var(--color-chrome-background-theme);\n --_bar-nav-border: var(--color-chrome-border-tertiary);\n --_bar-nav-fg-primary: var(--color-chrome-foreground-primary);\n --_bar-nav-fg-secondary: var(--color-chrome-foreground-secondary);\n --_bar-nav-hover: var(--color-chrome-interaction-hover);\n --_bar-nav-pressed: var(--color-chrome-interaction-pressed);\n --_bar-nav-focus: var(--color-chrome-interaction-focus);\n --_bar-nav-dot: var(--color-chrome-foreground-theme);\n --ds-interaction-hover: var(--_bar-nav-hover);\n --ds-interaction-pressed: var(--_bar-nav-pressed);\n --ds-focus-ring-color: var(--_bar-nav-focus);\n}\n\n/* Style slots — both route contexts use the shared Chrome token family. */\n.bar-nav--dashboard,\n.bar-nav--settings {\n --_bar-nav-bg: var(--color-chrome-background-theme);\n --_bar-nav-border: var(--color-chrome-border-tertiary);\n --_bar-nav-fg-primary: var(--color-chrome-foreground-primary);\n --_bar-nav-fg-secondary: var(--color-chrome-foreground-secondary);\n --_bar-nav-hover: var(--color-chrome-interaction-hover);\n --_bar-nav-pressed: var(--color-chrome-interaction-pressed);\n --_bar-nav-focus: var(--color-chrome-interaction-focus);\n --_bar-nav-dot: var(--color-chrome-foreground-theme);\n --ds-interaction-hover: var(--_bar-nav-hover);\n --ds-interaction-pressed: var(--_bar-nav-pressed);\n --ds-focus-ring-color: var(--_bar-nav-focus);\n}\n\n/* ShellApp owns the shared base + wash — bar is a transparent frame in every preset. */\n:host-context(ds-shell-app) .bar-nav {\n background-color: transparent;\n}\n\n.bar-nav > :not(.bar-nav__tabs-probe) {\n position: relative;\n z-index: 3;\n}\n\n/* Overflow — keep fitting tabs visible and pin the overflow trigger to the far edge. */\n.bar-nav--tabs-collapsed {\n display: flex;\n gap: var(--dimension-space-100);\n align-items: center;\n}\n\n/* Expanded tabs — consume full header width */\n.bar-nav__left {\n position: relative;\n flex: 1 1 0%;\n min-width: 0;\n width: 0;\n display: flex;\n align-items: center;\n}\n\n.bar-nav__tabs-visible {\n flex: 1;\n min-width: 0;\n width: 100%;\n}\n\n/* Unconstrained width so intrinsic tab row width is measurable while collapsed */\n.bar-nav__tabs-probe {\n position: absolute;\n left: 0;\n top: 0;\n visibility: hidden;\n pointer-events: none;\n overflow: visible;\n width: max-content;\n max-width: none;\n z-index: -1;\n}\n\n.bar-nav__tabs-probe > div {\n width: max-content;\n}\n\n.bar-nav__tab-list {\n display: flex;\n align-items: center;\n gap: var(--dimension-space-050);\n position: relative;\n width: max-content;\n}\n\n.bar-nav__tab {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: var(--ds-control-gap);\n height: var(--ds-control-height);\n min-width: var(--ds-control-height);\n padding: 0 var(--ds-control-padding-inline);\n box-sizing: border-box;\n border: none;\n border-radius: var(--ds-control-radius);\n background-color: transparent;\n color: var(--_bar-nav-fg-secondary);\n cursor: default;\n position: relative;\n flex-shrink: 0;\n -webkit-user-select: none;\n user-select: none;\n transition: color var(--effect-motion-short-2);\n}\n\n.bar-nav__tab::after {\n content: '';\n position: absolute;\n inset: 0;\n border-radius: var(--ds-control-radius);\n background: transparent;\n pointer-events: none;\n cursor: inherit;\n}\n\n@media (hover: hover) and (pointer: fine) {\n .bar-nav__tab:hover::after {\n background: var(--_bar-nav-hover);\n }\n}\n\n.bar-nav__tab:active::after {\n background: var(--_bar-nav-pressed);\n}\n\n.bar-nav__tab--selected {\n color: var(--_bar-nav-fg-primary);\n}\n\n.bar-nav__tab-label {\n display: inline-flex;\n align-items: center;\n white-space: nowrap;\n}\n\n.bar-nav__tab-divider {\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n width: var(--dimension-space-100);\n height: var(--ds-control-height);\n padding-block: var(--ds-control-padding-inline);\n flex-shrink: 0;\n pointer-events: none;\n}\n\n.bar-nav__tab-divider-line {\n width: var(--dimension-stroke-width-012);\n align-self: stretch;\n background-color: var(--_bar-nav-border);\n}\n\n/* In-flow placeholder while measuring overflow — avoids layout jump; hidden from view/accessibility. */\n.bar-nav__tabs-pending {\n flex: 1;\n min-width: 0;\n height: var(--ds-control-height);\n visibility: hidden;\n pointer-events: none;\n}\n\n/* Overflow trigger — compact icon button aligned to the right edge. */\n.bar-nav__overflow-trigger {\n margin-left: auto;\n}\n\n/* Fallback heading when no tabs — matches a single (selected) tab so the area\n name shares the tab label's type token, color, height and horizontal inset.\n Inset = tab button padding (space-075, 6px) + label inset (space-025, 2px).\n Color comes from ds-text color=\"primary\"; beat Text's inline-box display. */\nds-text.bar-nav__heading {\n display: inline-flex;\n align-items: center;\n height: var(--ds-control-height);\n padding-inline: calc(var(--ds-control-padding-inline) + var(--ds-control-label-inset));\n -webkit-user-select: none;\n user-select: none;\n}\n",
|
|
315
315
|
"type": "registry:ui"
|
|
316
316
|
},
|
|
317
317
|
{
|
|
318
318
|
"path": "src/wc/components/BarNav/BarNav.tsx",
|
|
319
|
-
"content": "import {\n Component,\n Prop,\n Event,\n EventEmitter,\n Element,\n Watch,\n State,\n h,\n Host,\n} from '@stencil/core';\nimport type { NavChromeStyle } from '../../shell/nav-chrome';\nimport type { MenuItemData } from '../Menu/menu-types';\nimport { getSelectableTabs, isTabDivider, type TabItemTab } from '../TabGroup/tab-item-utils';\nimport type { BarNavTab } from './bar-nav-types';\nimport { deriveBarNavValueFromUrl, shouldResyncBarNavProps } from './bar-nav-utils';\nimport {\n tabsOverflowContainer,\n tabsToOverflowMenuSections,\n trimTrailingDividers,\n visibleTabCountForWidth,\n} from './bar-nav-tabs-menu-utils';\nimport {\n CHROME_TRANSITION_END,\n CHROME_TRANSITION_START,\n ChromeTransitionGate,\n createRafCoalescer,\n readChromeTransitionSource,\n readChromeTransitionPhase,\n} from '../../shell/chrome-transition';\n\n@Component({\n tag: 'ds-bar-nav',\n styleUrl: 'BarNav.css',\n scoped: true,\n})\nexport class BarNav {\n /** Style slot: `dashboard` or `settings`. Colors match for now. */\n @Prop({ attribute: 'nav-style', reflect: true }) navStyle: NavChromeStyle = 'dashboard';\n\n @Element() el!: HTMLElement;\n\n /**\n * Tab items for the left section.\n * Set via JS property: `el.tabs = [...]`. Replace the array reference to update.\n */\n @Prop() tabs: BarNavTab[] = [];\n\n /** ID of the currently active tab. Overridden when `currentUrl` + `basePath` are set. */\n @Prop({ mutable: true }) value: string = '';\n\n /**\n * Fallback heading shown when no tabs are provided.\n * When tabs are present the heading is hidden.\n */\n @Prop() heading: string | undefined;\n\n /** Section base path (e.g. `/dashboard/safety`). Used with `currentUrl` to derive `value`. */\n @Prop() basePath: string = '';\n\n /** Current route URL. When set with `basePath`, the active tab is derived automatically. */\n @Prop() currentUrl: string = '';\n @Prop() moreTabsLabel: string = 'More tabs';\n\n /** Emitted when the active tab changes. Detail = tab id. */\n @Event() dsTabChange!: EventEmitter<string>;\n\n @State() private resolvedTabs: BarNavTab[] = [];\n @State() private urlDerivedValue: string = '';\n @State() private hideTabsForDetailRoute = false;\n @State() private tabsCollapsed = false;\n @State() private menuOpen = false;\n @State() private menuTriggerActive = false;\n /** When false, defer showing expanded tabs or the collapsed trigger until intrinsic width is measured (avoids a one-frame flash of the full tab row on narrow viewports). */\n @State() private tabLayoutCommitted = false;\n @State() private visibleTabs: BarNavTab[] = [];\n @State() private overflowTabs: BarNavTab[] = [];\n @State() private menuInitialFocusVisible = false;\n @State() private overflowRovingFocused = false;\n @State() private focusedTabId = '';\n\n private static readonly HOST_PROP_SYNC_BUDGET = 8;\n private static readonly INTRINSIC_WIDTH_RETRY_MAX = 3;\n private static readonly TAB_LAYOUT_COMMIT_MAX_FRAMES = 16;\n private static readonly OVERFLOW_HYSTERESIS_PX = 8;\n\n private headerEl: HTMLElement | null = null;\n private triggerEl: (HTMLElement & { setFocus?: () => Promise<void> }) | null = null;\n private menuEl: HTMLDsMenuElement | null = null;\n private visibleTabListEl: HTMLElement | null = null;\n private probeTabListEl: HTMLElement | null = null;\n private resizeObserver: ResizeObserver | null = null;\n private intrinsicWidthRetryCount = 0;\n private tabLayoutPendingFrames = 0;\n private readonly panelNavTransition = new ChromeTransitionGate();\n private readonly panelToolsTransition = new ChromeTransitionGate();\n private readonly overflowCoalescer = createRafCoalescer(() => {\n this.updateTabsCollapsed();\n });\n private chromeTransitionShell: HTMLElement | null = null;\n /** Matches `basePath` once tabs + URL are reconciled for the active section. */\n @State() private committedSection = '';\n /** Section waiting for URL + tabs to catch up after a cross-area navigation. */\n @State() private pendingSection = '';\n\n private get effectiveValue(): string {\n if (this.currentUrl && this.basePath) {\n return this.urlDerivedValue;\n }\n return this.value;\n }\n\n private get renderedSelectableTabs(): TabItemTab[] {\n const tabs = this.hasOverflowTabs ? this.visibleTabs : this.resolvedTabs;\n return getSelectableTabs(tabs);\n }\n\n private get hasOverflowTabs(): boolean {\n return this.tabLayoutCommitted && this.tabsCollapsed && this.overflowTabs.length > 0;\n }\n\n private syncFocusedTabId(preferred: string, tabs: TabItemTab[]) {\n if (tabs.some(tab => tab.id === preferred && !tab.isInactive)) {\n this.focusedTabId = preferred;\n return;\n }\n const first = tabs.find(tab => !tab.isInactive);\n this.focusedTabId = first?.id ?? '';\n }\n\n private digestTabsConfig(tabs: BarNavTab[]): string {\n return tabs.map(t => (isTabDivider(t) ? '|' : t.id)).join(',');\n }\n\n private resetTabOverflowLayout() {\n this.tabLayoutCommitted = false;\n this.tabsCollapsed = false;\n this.menuOpen = false;\n this.menuTriggerActive = false;\n this.menuInitialFocusVisible = false;\n this.intrinsicWidthRetryCount = 0;\n this.tabLayoutPendingFrames = 0;\n this.visibleTabs = [];\n this.overflowTabs = [];\n }\n\n @Watch('tabs')\n @Watch('currentUrl')\n @Watch('basePath')\n onHostPropsChange() {\n this.applyHostProps();\n }\n\n @Watch('value')\n @Watch('urlDerivedValue')\n onSelectionChange() {\n this.syncFocusedTabId(this.effectiveValue, this.renderedSelectableTabs);\n this.syncMenuSections();\n this.scheduleOverflowCheck();\n }\n\n @Watch('menuOpen')\n onMenuOpenChange(open: boolean) {\n if (this.menuEl) {\n this.menuEl.open = open;\n }\n }\n\n @Watch('tabsCollapsed')\n onTabsCollapsedChange(collapsed: boolean, prevCollapsed: boolean | undefined) {\n if (!collapsed) {\n this.menuOpen = false;\n this.menuTriggerActive = false;\n this.menuInitialFocusVisible = false;\n this.menuEl = null;\n }\n this.scheduleOverflowCheck();\n if (collapsed) {\n requestAnimationFrame(() => {\n this.scheduleOverflowCheck();\n });\n }\n if (collapsed || prevCollapsed === undefined || prevCollapsed === collapsed) return;\n requestAnimationFrame(() => this.scheduleOverflowCheck());\n queueMicrotask(() => this.focusVisibleSelectedTab());\n }\n\n componentWillLoad() {\n this.applyHostProps();\n this.syncFocusedTabId(this.effectiveValue, getSelectableTabs(this.resolvedTabs));\n }\n\n componentDidLoad() {\n this.syncHostPropsIfNeeded();\n this.scheduleDeferredHostPropSync();\n this.setupOverflowObserver();\n this.bindChromeTransitionListeners();\n this.scheduleOverflowCheck();\n }\n\n componentDidRender() {\n if (this.chromeOverflowPaused()) {\n this.syncMenuAnchor();\n return;\n }\n this.scheduleOverflowCheck();\n this.syncMenuAnchor();\n }\n\n disconnectedCallback() {\n this.resizeObserver?.disconnect();\n this.resizeObserver = null;\n this.overflowCoalescer.cancel();\n this.unbindChromeTransitionListeners();\n }\n\n private bindChromeTransitionListeners() {\n const shell = this.el.closest<HTMLElement>('ds-shell-app');\n if (!shell) return;\n this.chromeTransitionShell = shell;\n shell.addEventListener(CHROME_TRANSITION_START, this.onChromeTransitionStart);\n shell.addEventListener(CHROME_TRANSITION_END, this.onChromeTransitionEnd);\n }\n\n private unbindChromeTransitionListeners() {\n if (!this.chromeTransitionShell) return;\n this.chromeTransitionShell.removeEventListener(\n CHROME_TRANSITION_START,\n this.onChromeTransitionStart\n );\n this.chromeTransitionShell.removeEventListener(\n CHROME_TRANSITION_END,\n this.onChromeTransitionEnd\n );\n this.chromeTransitionShell = null;\n }\n\n private onChromeTransitionStart = (event: Event) => {\n const source = readChromeTransitionSource(event);\n if (source === 'panel-nav') {\n this.panelNavTransition.enter();\n return;\n }\n if (source === 'panel-tools') {\n const phase = readChromeTransitionPhase(event) ?? 'opening';\n if (phase === 'closing') {\n this.panelToolsTransition.enter();\n }\n }\n };\n\n private chromeOverflowPaused(): boolean {\n return this.panelNavTransition.isActive || this.panelToolsTransition.isActive;\n }\n\n private onChromeTransitionEnd = (event: Event) => {\n const source = readChromeTransitionSource(event);\n if (source === 'panel-nav') {\n this.panelNavTransition.exit();\n if (!this.panelNavTransition.isActive) {\n this.scheduleOverflowCheck();\n }\n return;\n }\n if (source === 'panel-tools') {\n this.panelToolsTransition.exit();\n this.scheduleOverflowCheck();\n }\n };\n\n /** Re-resolve props assigned by the host after componentWillLoad (Angular ngAfterViewInit). */\n private syncHostPropsIfNeeded() {\n if (shouldResyncBarNavProps(this.resolvedTabs, this.tabs)) {\n this.applyHostProps();\n } else if (this.currentUrl && this.basePath) {\n this.syncValueFromUrl();\n }\n }\n\n /** Poll across animation frames — host props may land without triggering @Watch. */\n private scheduleDeferredHostPropSync() {\n let remaining = BarNav.HOST_PROP_SYNC_BUDGET;\n const tick = () => {\n this.syncHostPropsIfNeeded();\n if (--remaining > 0) {\n requestAnimationFrame(tick);\n }\n };\n queueMicrotask(tick);\n }\n\n private setupOverflowObserver() {\n if (typeof ResizeObserver === 'undefined' || !this.headerEl) return;\n this.resizeObserver?.disconnect();\n this.resizeObserver = new ResizeObserver(() => {\n if (this.chromeOverflowPaused()) return;\n this.scheduleOverflowCheck();\n });\n this.resizeObserver.observe(this.headerEl);\n }\n\n private scheduleOverflowCheck() {\n if (this.chromeOverflowPaused()) return;\n this.overflowCoalescer.schedule();\n }\n\n /** Width available for the tab row or collapsed trigger. */\n private getLeftZoneAvailableWidth(): number {\n if (!this.headerEl) return 0;\n\n const headerStyle = getComputedStyle(this.headerEl);\n const horizontalPadding =\n (parseFloat(headerStyle.paddingLeft) || 0) + (parseFloat(headerStyle.paddingRight) || 0);\n\n return Math.max(0, this.headerEl.clientWidth - horizontalPadding);\n }\n\n private getTabsIntrinsicWidth(): number {\n return this.probeTabListEl?.scrollWidth ?? 0;\n }\n\n private getHeaderGap(): number {\n if (!this.headerEl) return 0;\n const style = getComputedStyle(this.headerEl);\n return parseFloat(style.columnGap || style.gap) || 0;\n }\n\n private getOverflowTriggerReserveWidth(): number {\n if (!this.triggerEl) {\n return 40;\n }\n return this.triggerEl.getBoundingClientRect().width + this.getHeaderGap();\n }\n\n private getProbeTabMetrics(): {\n itemWidths: number[];\n itemGap: number;\n listExtraWidth: number;\n } | null {\n const tabList = this.probeTabListEl;\n if (!tabList) return null;\n\n const children = Array.from(tabList.children) as HTMLElement[];\n const itemWidths = children.map(child => child.getBoundingClientRect().width);\n if (itemWidths.length === 0 || itemWidths.some(width => width === 0)) return null;\n\n const style = getComputedStyle(tabList);\n const itemGap = parseFloat(style.columnGap || style.gap) || 0;\n const childrenWidth = itemWidths.reduce((sum, width) => sum + width, 0);\n const gapWidth = itemGap * Math.max(0, itemWidths.length - 1);\n const listExtraWidth = Math.max(0, tabList.scrollWidth - childrenWidth - gapWidth);\n\n return { itemWidths, itemGap, listExtraWidth };\n }\n\n private setOverflowTabLayout(visibleTabs: BarNavTab[], overflowTabs: BarNavTab[]) {\n const nextCollapsed = overflowTabs.length > 0;\n const visibleChanged =\n this.digestTabsConfig(visibleTabs) !== this.digestTabsConfig(this.visibleTabs);\n const overflowChanged =\n this.digestTabsConfig(overflowTabs) !== this.digestTabsConfig(this.overflowTabs);\n\n if (visibleChanged) {\n this.visibleTabs = visibleTabs;\n }\n if (overflowChanged) {\n this.overflowTabs = overflowTabs;\n }\n if (nextCollapsed !== this.tabsCollapsed) {\n this.tabsCollapsed = nextCollapsed;\n if (!nextCollapsed) {\n this.menuOpen = false;\n this.menuTriggerActive = false;\n }\n }\n this.syncFocusedTabId(\n this.effectiveValue,\n getSelectableTabs(nextCollapsed ? visibleTabs : this.resolvedTabs)\n );\n }\n\n private scheduleIntrinsicWidthRetry() {\n if (this.intrinsicWidthRetryCount >= BarNav.INTRINSIC_WIDTH_RETRY_MAX) return;\n this.intrinsicWidthRetryCount++;\n requestAnimationFrame(() => this.scheduleOverflowCheck());\n }\n\n private forceTabLayoutCommit(fallbackCollapsed: boolean) {\n this.intrinsicWidthRetryCount = 0;\n this.tabLayoutPendingFrames = 0;\n this.setOverflowTabLayout(\n fallbackCollapsed ? [] : this.resolvedTabs,\n fallbackCollapsed ? this.resolvedTabs : []\n );\n this.tabLayoutCommitted = true;\n }\n\n private updateTabsCollapsed() {\n if (!this.headerEl || this.resolvedTabs.length === 0 || this.hideTabsForDetailRoute) {\n if (this.tabsCollapsed) {\n this.setOverflowTabLayout([], []);\n }\n this.intrinsicWidthRetryCount = 0;\n this.tabLayoutPendingFrames = 0;\n this.tabLayoutCommitted = true;\n return;\n }\n\n const metrics = this.getProbeTabMetrics();\n const intrinsicWidth = this.getTabsIntrinsicWidth();\n if (!metrics || intrinsicWidth === 0) {\n this.tabLayoutPendingFrames += 1;\n if (this.intrinsicWidthRetryCount >= BarNav.INTRINSIC_WIDTH_RETRY_MAX) {\n this.forceTabLayoutCommit(false);\n } else if (this.tabLayoutPendingFrames >= BarNav.TAB_LAYOUT_COMMIT_MAX_FRAMES) {\n this.forceTabLayoutCommit(false);\n } else {\n this.scheduleIntrinsicWidthRetry();\n }\n return;\n }\n this.intrinsicWidthRetryCount = 0;\n this.tabLayoutPendingFrames = 0;\n\n const shouldCollapse = tabsOverflowContainer(\n intrinsicWidth,\n this.getLeftZoneAvailableWidth(),\n this.tabsCollapsed,\n BarNav.OVERFLOW_HYSTERESIS_PX\n );\n\n if (!shouldCollapse) {\n this.setOverflowTabLayout(this.resolvedTabs, []);\n this.tabLayoutCommitted = true;\n return;\n }\n\n const visibleCount = visibleTabCountForWidth(\n metrics.itemWidths,\n this.getLeftZoneAvailableWidth(),\n this.getOverflowTriggerReserveWidth(),\n metrics.itemGap,\n metrics.listExtraWidth\n );\n const visibleTabs = trimTrailingDividers(this.resolvedTabs.slice(0, visibleCount));\n const overflowTabs = this.resolvedTabs.slice(visibleTabs.length);\n this.setOverflowTabLayout(visibleTabs, overflowTabs);\n this.tabLayoutCommitted = true;\n }\n\n private syncMenuAnchor() {\n if (!this.menuEl || !this.triggerEl || !this.hasOverflowTabs) return;\n this.menuEl.anchor = this.triggerEl;\n this.syncMenuSections();\n }\n\n private handleMenuSelect(e: Event) {\n const detail = (e as CustomEvent<MenuItemData>).detail;\n if (detail?.value !== undefined) {\n this.selectTab(String(detail.value));\n }\n this.menuOpen = false;\n this.menuInitialFocusVisible = false;\n }\n\n private handleMenuClose() {\n this.menuOpen = false;\n this.menuInitialFocusVisible = false;\n }\n\n private handleMenuAfterClose() {\n if (!this.menuOpen) this.menuTriggerActive = false;\n }\n\n /** Batch tabs/basePath/currentUrl updates so URL derivation never runs with a mixed section. */\n private incomingTabs(): BarNavTab[] {\n return this.tabs ?? [];\n }\n\n private applyHostProps() {\n const nextBasePath = this.basePath;\n const sectionChanged =\n nextBasePath !== '' && this.committedSection !== '' && nextBasePath !== this.committedSection;\n\n if (sectionChanged) {\n this.urlDerivedValue = '';\n this.committedSection = '';\n this.pendingSection = nextBasePath;\n this.resolvedTabs = [];\n this.resetTabOverflowLayout();\n return;\n }\n\n if (this.pendingSection) {\n if (!nextBasePath || nextBasePath !== this.pendingSection) {\n return;\n }\n if (!this.currentUrl.startsWith(this.pendingSection)) {\n return;\n }\n const tabs = this.incomingTabs();\n if (tabs.length === 0) {\n return;\n }\n this.pendingSection = '';\n }\n\n const tabs = this.incomingTabs();\n const tabsConfigChanged =\n this.digestTabsConfig(tabs) !== this.digestTabsConfig(this.resolvedTabs);\n\n this.resolvedTabs = tabs;\n this.syncValueFromUrl();\n this.committedSection = nextBasePath;\n if (tabsConfigChanged) {\n this.resetTabOverflowLayout();\n }\n this.scheduleOverflowCheck();\n }\n\n private syncMenuSections() {\n if (!this.menuEl) return;\n this.menuEl.sections = tabsToOverflowMenuSections(this.overflowTabs, this.effectiveValue);\n }\n\n private syncValueFromUrl() {\n const tabs = this.incomingTabs();\n\n if (!this.currentUrl || !this.basePath) {\n this.urlDerivedValue = '';\n this.hideTabsForDetailRoute = false;\n return;\n }\n\n if (!this.currentUrl.startsWith(this.basePath)) {\n this.urlDerivedValue = '';\n this.hideTabsForDetailRoute = false;\n return;\n }\n\n const { value, hideTabs } = deriveBarNavValueFromUrl(this.currentUrl, this.basePath, tabs);\n this.urlDerivedValue = value;\n this.hideTabsForDetailRoute = hideTabs;\n }\n\n private selectTab(id: string) {\n this.value = id;\n this.dsTabChange.emit(id);\n }\n\n /** Move focus to the selected tab in the visible tab group (after expand). */\n private focusVisibleSelectedTab() {\n const tab = this.visibleTabListEl?.querySelector(\n `[data-tab-id=\"${this.effectiveValue}\"]`\n ) as HTMLElement | null;\n tab?.focus({ preventScroll: true });\n }\n\n private focusVisibleTab(id: string) {\n this.focusedTabId = id;\n const tab = this.visibleTabListEl?.querySelector(`[data-tab-id=\"${id}\"]`) as HTMLElement | null;\n tab?.focus({ preventScroll: true });\n }\n\n private focusLastVisibleTab() {\n const last = [...this.renderedSelectableTabs].reverse().find(tab => !tab.isInactive);\n if (last) this.focusVisibleTab(last.id);\n }\n\n private findEnabledVisibleTab(from: number, step: 1 | -1): number | null {\n const tabs = this.renderedSelectableTabs;\n for (let index = from + step; index >= 0 && index < tabs.length; index += step) {\n if (!tabs[index]?.isInactive) return index;\n }\n return null;\n }\n\n private handleTabKeyDown(e: KeyboardEvent) {\n const tabs = this.renderedSelectableTabs;\n if (!tabs.length) return;\n const targetId = (e.target as HTMLElement | null)?.getAttribute('data-tab-id');\n const focusedId = targetId ?? this.focusedTabId;\n\n if (e.key === 'Enter' || e.key === ' ') {\n const focused = tabs.find(tab => tab.id === focusedId);\n if (!focused || focused.isInactive) return;\n e.preventDefault();\n this.selectTab(focused.id);\n return;\n }\n\n const currentIndex = tabs.findIndex(tab => tab.id === focusedId);\n if (currentIndex < 0) return;\n\n let nextIndex: number | null;\n if (e.key === 'ArrowRight') {\n nextIndex = this.findEnabledVisibleTab(currentIndex, 1);\n if (nextIndex === null && this.hasOverflowTabs) {\n e.preventDefault();\n this.overflowRovingFocused = true;\n void this.triggerEl?.setFocus?.();\n return;\n }\n } else if (e.key === 'ArrowLeft') {\n nextIndex = this.findEnabledVisibleTab(currentIndex, -1);\n } else if (e.key === 'Home') {\n nextIndex = tabs.findIndex(tab => !tab.isInactive);\n } else if (e.key === 'End') {\n const reversedIndex = [...tabs].reverse().findIndex(tab => !tab.isInactive);\n nextIndex = reversedIndex < 0 ? null : tabs.length - 1 - reversedIndex;\n } else {\n return;\n }\n\n if (nextIndex === null || nextIndex < 0 || nextIndex === currentIndex) return;\n e.preventDefault();\n this.focusVisibleTab(tabs[nextIndex].id);\n }\n\n private toggleTabMenu(options?: { focusVisible?: boolean }) {\n if (this.menuOpen) {\n this.menuOpen = false;\n this.menuInitialFocusVisible = false;\n return;\n }\n\n if (this.menuEl && this.triggerEl) {\n this.menuEl.anchor = this.triggerEl;\n this.menuEl.minWidth = '';\n this.syncMenuSections();\n }\n\n this.menuInitialFocusVisible = options?.focusVisible ?? false;\n this.menuTriggerActive = true;\n this.menuOpen = true;\n }\n\n private handleOverflowFocus = () => {\n this.overflowRovingFocused = true;\n };\n\n private handleOverflowBlur = () => {\n this.overflowRovingFocused = false;\n };\n\n private handleTriggerKeyDown(e: KeyboardEvent) {\n if (!this.hasOverflowTabs) return;\n\n if (!this.menuOpen) {\n if (e.key === 'ArrowLeft') {\n e.preventDefault();\n this.overflowRovingFocused = false;\n this.focusLastVisibleTab();\n return;\n }\n\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n this.toggleTabMenu({ focusVisible: true });\n }\n return;\n }\n\n if (e.key === 'Escape') {\n e.preventDefault();\n this.menuOpen = false;\n this.menuInitialFocusVisible = false;\n void this.triggerEl?.setFocus?.();\n }\n }\n\n private renderTabList(tabs: BarNavTab[], probe: boolean) {\n return (\n <div\n role=\"tablist\"\n class=\"bar-nav__tab-list\"\n aria-label={this.heading}\n ref={el => {\n if (probe) {\n const next = (el as HTMLElement) ?? null;\n if (next === this.probeTabListEl) return;\n this.probeTabListEl = next;\n if (next) {\n this.intrinsicWidthRetryCount = 0;\n this.tabLayoutPendingFrames = 0;\n this.scheduleOverflowCheck();\n }\n } else {\n this.visibleTabListEl = (el as HTMLElement) ?? null;\n }\n }}\n onKeyDown={probe ? undefined : (e: KeyboardEvent) => this.handleTabKeyDown(e)}\n onFocusin={\n probe\n ? undefined\n : () => {\n this.overflowRovingFocused = false;\n }\n }\n >\n {tabs.map((tab, index) => {\n if (isTabDivider(tab)) {\n return (\n <div class=\"bar-nav__tab-divider\" key={`divider-${index}`} aria-hidden=\"true\">\n <div class=\"bar-nav__tab-divider-line\" />\n </div>\n );\n }\n\n const isSelected = tab.id === this.effectiveValue;\n return (\n <button\n key={tab.id}\n type=\"button\"\n role=\"tab\"\n data-tab-id={tab.id}\n class={{\n 'bar-nav__tab': true,\n 'bar-nav__tab--selected': isSelected,\n 'ds-control--md': true,\n 'ds-focus-ring-inset': true,\n 'ds-control-inactive': !!tab.isInactive,\n }}\n aria-selected={isSelected ? 'true' : 'false'}\n aria-disabled={tab.isInactive ? 'true' : undefined}\n aria-controls={tab.panelId ?? undefined}\n disabled={tab.isInactive}\n tabIndex={\n !probe && !this.overflowRovingFocused && tab.id === this.focusedTabId ? 0 : -1\n }\n onClick={() => !probe && !tab.isInactive && this.selectTab(tab.id)}\n onFocus={() => {\n if (!probe) this.focusedTabId = tab.id;\n }}\n >\n <span\n class={{\n 'bar-nav__tab-label': true,\n 'ds-control-label-box': true,\n 'ds-control-label-dot': !!tab.dot,\n 'bar-nav__tab-label--dot': !!tab.dot,\n }}\n >\n <ds-text as=\"span\" variant=\"text-body-medium\" emphasis={isSelected} color=\"inherit\">\n {tab.label}\n </ds-text>\n {tab.dot && (\n <ds-badge\n class=\"bar-nav__tab-dot ds-control-label-dot__badge\"\n variant=\"dot\"\n hasRing={false}\n label=\"\"\n aria-hidden=\"true\"\n />\n )}\n </span>\n </button>\n );\n })}\n </div>\n );\n }\n\n render() {\n // Section gating only applies when `basePath` is set (SPA section sync).\n // Tabs without a base path must still render — otherwise a single-tab bar\n // (or any non-routed tabs) silently falls through to an empty header.\n const sectionReady = this.basePath === '' || this.committedSection === this.basePath;\n const hasTabs = sectionReady && this.resolvedTabs.length > 0 && !this.hideTabsForDetailRoute;\n const tabGroupKey = this.basePath || 'no-section';\n const renderedTabs = this.hasOverflowTabs ? this.visibleTabs : this.resolvedTabs;\n\n return (\n <Host>\n <header\n class={{\n 'bar-nav': true,\n 'ds-control--md': true,\n 'ds-chrome-row': true,\n 'ds-chrome-space--md': true,\n 'bar-nav--dashboard': this.navStyle === 'dashboard',\n 'bar-nav--settings': this.navStyle === 'settings',\n 'bar-nav--tabs-collapsed': hasTabs && this.hasOverflowTabs,\n }}\n ref={el => {\n this.headerEl = el as HTMLElement;\n if (el && !this.resizeObserver) {\n this.setupOverflowObserver();\n }\n }}\n >\n {hasTabs && (\n <div class=\"bar-nav__tabs-probe\" aria-hidden=\"true\" inert>\n <div key={`probe-${tabGroupKey}`}>{this.renderTabList(this.resolvedTabs, true)}</div>\n </div>\n )}\n\n {hasTabs && this.tabLayoutCommitted && renderedTabs.length > 0 && (\n <div class=\"bar-nav__left\">\n <div key={`visible-${tabGroupKey}`} class=\"bar-nav__tabs-visible\">\n {this.renderTabList(renderedTabs, false)}\n </div>\n </div>\n )}\n\n {hasTabs && !this.tabLayoutCommitted && (\n <div class=\"bar-nav__tabs-pending\" aria-hidden=\"true\" />\n )}\n\n {!hasTabs && this.heading && (\n <ds-text\n class=\"bar-nav__heading\"\n lineTruncation={1}\n as=\"span\"\n variant=\"text-body-medium\"\n emphasis\n color=\"primary\"\n wrap=\"nowrap\"\n >\n {this.heading}\n </ds-text>\n )}\n\n {hasTabs && this.hasOverflowTabs && (\n <ds-button-unfilled\n variant=\"icon\"\n class={{\n 'bar-nav__overflow-trigger': true,\n }}\n icon=\"ChevronDown\"\n activeFill={false}\n hasBorder={false}\n focusTabIndex={this.overflowRovingFocused ? 0 : -1}\n ref={(el?: HTMLDsButtonUnfilledElement) => {\n this.triggerEl = (el as HTMLElement & { setFocus?: () => Promise<void> }) ?? null;\n }}\n haspopup=\"menu\"\n expanded={this.menuOpen}\n surfaceOpen={this.menuTriggerActive}\n aria-label={this.moreTabsLabel}\n onDsClick={() => this.toggleTabMenu({ focusVisible: false })}\n onFocusin={this.handleOverflowFocus}\n onFocusout={this.handleOverflowBlur}\n onKeyDown={(e: KeyboardEvent) => this.handleTriggerKeyDown(e)}\n />\n )}\n </header>\n\n {hasTabs && this.hasOverflowTabs && (\n <ds-menu\n ref={el => {\n this.menuEl = (el as HTMLDsMenuElement) ?? null;\n }}\n open={this.menuOpen}\n sections={tabsToOverflowMenuSections(this.overflowTabs, this.effectiveValue)}\n side=\"bottom\"\n align=\"end\"\n sideOffset=\"calc(var(--dimension-space-100) + var(--dimension-space-050))\"\n initialFocusVisible={this.menuInitialFocusVisible}\n onDsSelect={(e: Event) => this.handleMenuSelect(e)}\n onDsClose={() => this.handleMenuClose()}\n onDsAfterClose={() => this.handleMenuAfterClose()}\n />\n )}\n </Host>\n );\n }\n}\n",
|
|
319
|
+
"content": "import {\n Component,\n Prop,\n Event,\n EventEmitter,\n Element,\n Watch,\n State,\n h,\n Host,\n} from '@stencil/core';\nimport type { NavChromeStyle } from '../../shell/nav-chrome';\nimport type { MenuItemData } from '../Menu/menu-types';\nimport { getSelectableTabs, isTabDivider, type TabItemTab } from '../TabGroup/tab-item-utils';\nimport type { BarNavTab } from './bar-nav-types';\nimport { deriveBarNavValueFromUrl, shouldResyncBarNavProps } from './bar-nav-utils';\nimport {\n tabsOverflowContainer,\n tabsToOverflowMenuSections,\n trimTrailingDividers,\n visibleTabCountForWidth,\n} from './bar-nav-tabs-menu-utils';\nimport {\n CHROME_TRANSITION_END,\n CHROME_TRANSITION_START,\n ChromeTransitionGate,\n createRafCoalescer,\n readChromeTransitionSource,\n readChromeTransitionPhase,\n} from '../../shell/chrome-transition';\n\n@Component({\n tag: 'ds-bar-nav',\n styleUrl: 'BarNav.css',\n scoped: true,\n})\nexport class BarNav {\n /** Style slot: `dashboard` or `settings`. Colors match for now. */\n @Prop({ attribute: 'nav-style', reflect: true }) navStyle: NavChromeStyle = 'dashboard';\n\n @Element() el!: HTMLElement;\n\n /**\n * Tab items for the left section.\n * Set via JS property: `el.tabs = [...]`. Replace the array reference to update.\n */\n @Prop() tabs: BarNavTab[] = [];\n\n /** ID of the currently active tab. Overridden when `currentUrl` + `basePath` are set. */\n @Prop({ mutable: true }) value: string = '';\n\n /**\n * Fallback heading shown when no tabs are provided.\n * When tabs are present the heading is hidden.\n */\n @Prop() heading: string | undefined;\n\n /** Section base path (e.g. `/dashboard/safety`). Used with `currentUrl` to derive `value`. */\n @Prop() basePath: string = '';\n\n /** Current route URL. When set with `basePath`, the active tab is derived automatically. */\n @Prop() currentUrl: string = '';\n @Prop() moreTabsLabel: string = 'More tabs';\n\n /** Emitted when the active tab changes. Detail = tab id. */\n @Event() dsTabChange!: EventEmitter<string>;\n\n @State() private resolvedTabs: BarNavTab[] = [];\n @State() private urlDerivedValue: string = '';\n @State() private hideTabsForDetailRoute = false;\n @State() private tabsCollapsed = false;\n @State() private menuOpen = false;\n @State() private menuTriggerActive = false;\n /** When false, defer showing expanded tabs or the collapsed trigger until intrinsic width is measured (avoids a one-frame flash of the full tab row on narrow viewports). */\n @State() private tabLayoutCommitted = false;\n @State() private visibleTabs: BarNavTab[] = [];\n @State() private overflowTabs: BarNavTab[] = [];\n @State() private menuInitialFocusVisible = false;\n @State() private overflowRovingFocused = false;\n @State() private focusedTabId = '';\n\n private static readonly HOST_PROP_SYNC_BUDGET = 8;\n private static readonly INTRINSIC_WIDTH_RETRY_MAX = 3;\n private static readonly TAB_LAYOUT_COMMIT_MAX_FRAMES = 16;\n private static readonly OVERFLOW_HYSTERESIS_PX = 8;\n\n private headerEl: HTMLElement | null = null;\n private triggerEl: (HTMLElement & { setFocus?: () => Promise<void> }) | null = null;\n private menuEl: HTMLDsMenuElement | null = null;\n private visibleTabListEl: HTMLElement | null = null;\n private probeTabListEl: HTMLElement | null = null;\n private resizeObserver: ResizeObserver | null = null;\n private intrinsicWidthRetryCount = 0;\n private tabLayoutPendingFrames = 0;\n private readonly panelNavTransition = new ChromeTransitionGate();\n private readonly panelToolsTransition = new ChromeTransitionGate();\n private readonly overflowCoalescer = createRafCoalescer(() => {\n this.updateTabsCollapsed();\n });\n private chromeTransitionShell: HTMLElement | null = null;\n /** Matches `basePath` once tabs + URL are reconciled for the active section. */\n @State() private committedSection = '';\n /** Section waiting for URL + tabs to catch up after a cross-area navigation. */\n @State() private pendingSection = '';\n\n private get effectiveValue(): string {\n if (this.currentUrl && this.basePath) {\n return this.urlDerivedValue;\n }\n return this.value;\n }\n\n private get renderedSelectableTabs(): TabItemTab[] {\n const tabs = this.hasOverflowTabs ? this.visibleTabs : this.resolvedTabs;\n return getSelectableTabs(tabs);\n }\n\n private get hasOverflowTabs(): boolean {\n return this.tabLayoutCommitted && this.tabsCollapsed && this.overflowTabs.length > 0;\n }\n\n private syncFocusedTabId(preferred: string, tabs: TabItemTab[]) {\n if (tabs.some(tab => tab.id === preferred && !tab.isInactive)) {\n this.focusedTabId = preferred;\n return;\n }\n const first = tabs.find(tab => !tab.isInactive);\n this.focusedTabId = first?.id ?? '';\n }\n\n private digestTabsConfig(tabs: BarNavTab[]): string {\n return tabs.map(t => (isTabDivider(t) ? '|' : t.id)).join(',');\n }\n\n private resetTabOverflowLayout() {\n this.tabLayoutCommitted = false;\n this.tabsCollapsed = false;\n this.menuOpen = false;\n this.menuTriggerActive = false;\n this.menuInitialFocusVisible = false;\n this.intrinsicWidthRetryCount = 0;\n this.tabLayoutPendingFrames = 0;\n this.visibleTabs = [];\n this.overflowTabs = [];\n }\n\n @Watch('tabs')\n @Watch('currentUrl')\n @Watch('basePath')\n onHostPropsChange() {\n this.applyHostProps();\n }\n\n @Watch('value')\n @Watch('urlDerivedValue')\n onSelectionChange() {\n this.syncFocusedTabId(this.effectiveValue, this.renderedSelectableTabs);\n this.syncMenuSections();\n this.scheduleOverflowCheck();\n }\n\n @Watch('menuOpen')\n onMenuOpenChange(open: boolean) {\n if (this.menuEl) {\n this.menuEl.open = open;\n }\n }\n\n @Watch('tabsCollapsed')\n onTabsCollapsedChange(collapsed: boolean, prevCollapsed: boolean | undefined) {\n if (!collapsed) {\n this.menuOpen = false;\n this.menuTriggerActive = false;\n this.menuInitialFocusVisible = false;\n this.menuEl = null;\n }\n this.scheduleOverflowCheck();\n if (collapsed) {\n requestAnimationFrame(() => {\n this.scheduleOverflowCheck();\n });\n }\n if (collapsed || prevCollapsed === undefined || prevCollapsed === collapsed) return;\n requestAnimationFrame(() => this.scheduleOverflowCheck());\n queueMicrotask(() => this.focusVisibleSelectedTab());\n }\n\n componentWillLoad() {\n this.applyHostProps();\n this.syncFocusedTabId(this.effectiveValue, getSelectableTabs(this.resolvedTabs));\n }\n\n componentDidLoad() {\n this.syncHostPropsIfNeeded();\n this.scheduleDeferredHostPropSync();\n this.setupOverflowObserver();\n this.bindChromeTransitionListeners();\n this.scheduleOverflowCheck();\n }\n\n componentDidRender() {\n if (this.chromeOverflowPaused()) {\n this.syncMenuAnchor();\n return;\n }\n this.scheduleOverflowCheck();\n this.syncMenuAnchor();\n }\n\n disconnectedCallback() {\n this.resizeObserver?.disconnect();\n this.resizeObserver = null;\n this.overflowCoalescer.cancel();\n this.unbindChromeTransitionListeners();\n }\n\n private bindChromeTransitionListeners() {\n const shell = this.el.closest<HTMLElement>('ds-shell-app');\n if (!shell) return;\n this.chromeTransitionShell = shell;\n shell.addEventListener(CHROME_TRANSITION_START, this.onChromeTransitionStart);\n shell.addEventListener(CHROME_TRANSITION_END, this.onChromeTransitionEnd);\n }\n\n private unbindChromeTransitionListeners() {\n if (!this.chromeTransitionShell) return;\n this.chromeTransitionShell.removeEventListener(\n CHROME_TRANSITION_START,\n this.onChromeTransitionStart\n );\n this.chromeTransitionShell.removeEventListener(\n CHROME_TRANSITION_END,\n this.onChromeTransitionEnd\n );\n this.chromeTransitionShell = null;\n }\n\n private onChromeTransitionStart = (event: Event) => {\n const source = readChromeTransitionSource(event);\n if (source === 'panel-nav') {\n this.panelNavTransition.enter();\n return;\n }\n if (source === 'panel-tools') {\n const phase = readChromeTransitionPhase(event) ?? 'opening';\n if (phase === 'closing') {\n this.panelToolsTransition.enter();\n }\n }\n };\n\n private chromeOverflowPaused(): boolean {\n return this.panelNavTransition.isActive || this.panelToolsTransition.isActive;\n }\n\n private onChromeTransitionEnd = (event: Event) => {\n const source = readChromeTransitionSource(event);\n if (source === 'panel-nav') {\n this.panelNavTransition.exit();\n if (!this.panelNavTransition.isActive) {\n this.scheduleOverflowCheck();\n }\n return;\n }\n if (source === 'panel-tools') {\n this.panelToolsTransition.exit();\n this.scheduleOverflowCheck();\n }\n };\n\n /** Re-resolve props assigned by the host after componentWillLoad (Angular ngAfterViewInit). */\n private syncHostPropsIfNeeded() {\n if (shouldResyncBarNavProps(this.resolvedTabs, this.tabs)) {\n this.applyHostProps();\n } else if (this.currentUrl && this.basePath) {\n this.syncValueFromUrl();\n }\n }\n\n /** Poll across animation frames — host props may land without triggering @Watch. */\n private scheduleDeferredHostPropSync() {\n let remaining = BarNav.HOST_PROP_SYNC_BUDGET;\n const tick = () => {\n this.syncHostPropsIfNeeded();\n if (--remaining > 0) {\n requestAnimationFrame(tick);\n }\n };\n queueMicrotask(tick);\n }\n\n private setupOverflowObserver() {\n if (typeof ResizeObserver === 'undefined' || !this.headerEl) return;\n this.resizeObserver?.disconnect();\n this.resizeObserver = new ResizeObserver(() => {\n if (this.chromeOverflowPaused()) return;\n this.scheduleOverflowCheck();\n });\n this.resizeObserver.observe(this.headerEl);\n }\n\n private scheduleOverflowCheck() {\n if (this.chromeOverflowPaused()) return;\n this.overflowCoalescer.schedule();\n }\n\n /** Width available for the tab row or collapsed trigger. */\n private getLeftZoneAvailableWidth(): number {\n if (!this.headerEl) return 0;\n\n const headerStyle = getComputedStyle(this.headerEl);\n const horizontalPadding =\n (parseFloat(headerStyle.paddingLeft) || 0) + (parseFloat(headerStyle.paddingRight) || 0);\n\n return Math.max(0, this.headerEl.clientWidth - horizontalPadding);\n }\n\n private getTabsIntrinsicWidth(): number {\n return this.probeTabListEl?.scrollWidth ?? 0;\n }\n\n private getHeaderGap(): number {\n if (!this.headerEl) return 0;\n const style = getComputedStyle(this.headerEl);\n return parseFloat(style.columnGap || style.gap) || 0;\n }\n\n private getOverflowTriggerReserveWidth(): number {\n if (!this.triggerEl) {\n return 40;\n }\n return this.triggerEl.getBoundingClientRect().width + this.getHeaderGap();\n }\n\n private getProbeTabMetrics(): {\n itemWidths: number[];\n itemGap: number;\n listExtraWidth: number;\n } | null {\n const tabList = this.probeTabListEl;\n if (!tabList) return null;\n\n const children = Array.from(tabList.children) as HTMLElement[];\n const itemWidths = children.map(child => child.getBoundingClientRect().width);\n if (itemWidths.length === 0 || itemWidths.some(width => width === 0)) return null;\n\n const style = getComputedStyle(tabList);\n const itemGap = parseFloat(style.columnGap || style.gap) || 0;\n const childrenWidth = itemWidths.reduce((sum, width) => sum + width, 0);\n const gapWidth = itemGap * Math.max(0, itemWidths.length - 1);\n const listExtraWidth = Math.max(0, tabList.scrollWidth - childrenWidth - gapWidth);\n\n return { itemWidths, itemGap, listExtraWidth };\n }\n\n private setOverflowTabLayout(visibleTabs: BarNavTab[], overflowTabs: BarNavTab[]) {\n const nextCollapsed = overflowTabs.length > 0;\n const visibleChanged =\n this.digestTabsConfig(visibleTabs) !== this.digestTabsConfig(this.visibleTabs);\n const overflowChanged =\n this.digestTabsConfig(overflowTabs) !== this.digestTabsConfig(this.overflowTabs);\n\n if (visibleChanged) {\n this.visibleTabs = visibleTabs;\n }\n if (overflowChanged) {\n this.overflowTabs = overflowTabs;\n }\n if (nextCollapsed !== this.tabsCollapsed) {\n this.tabsCollapsed = nextCollapsed;\n if (!nextCollapsed) {\n this.menuOpen = false;\n this.menuTriggerActive = false;\n }\n }\n this.syncFocusedTabId(\n this.effectiveValue,\n getSelectableTabs(nextCollapsed ? visibleTabs : this.resolvedTabs)\n );\n }\n\n private scheduleIntrinsicWidthRetry() {\n if (this.intrinsicWidthRetryCount >= BarNav.INTRINSIC_WIDTH_RETRY_MAX) return;\n this.intrinsicWidthRetryCount++;\n requestAnimationFrame(() => this.scheduleOverflowCheck());\n }\n\n private forceTabLayoutCommit(fallbackCollapsed: boolean) {\n this.intrinsicWidthRetryCount = 0;\n this.tabLayoutPendingFrames = 0;\n this.setOverflowTabLayout(\n fallbackCollapsed ? [] : this.resolvedTabs,\n fallbackCollapsed ? this.resolvedTabs : []\n );\n this.tabLayoutCommitted = true;\n }\n\n private updateTabsCollapsed() {\n if (!this.headerEl || this.resolvedTabs.length === 0 || this.hideTabsForDetailRoute) {\n if (this.tabsCollapsed) {\n this.setOverflowTabLayout([], []);\n }\n this.intrinsicWidthRetryCount = 0;\n this.tabLayoutPendingFrames = 0;\n this.tabLayoutCommitted = true;\n return;\n }\n\n const metrics = this.getProbeTabMetrics();\n const intrinsicWidth = this.getTabsIntrinsicWidth();\n if (!metrics || intrinsicWidth === 0) {\n this.tabLayoutPendingFrames += 1;\n if (this.intrinsicWidthRetryCount >= BarNav.INTRINSIC_WIDTH_RETRY_MAX) {\n this.forceTabLayoutCommit(false);\n } else if (this.tabLayoutPendingFrames >= BarNav.TAB_LAYOUT_COMMIT_MAX_FRAMES) {\n this.forceTabLayoutCommit(false);\n } else {\n this.scheduleIntrinsicWidthRetry();\n }\n return;\n }\n this.intrinsicWidthRetryCount = 0;\n this.tabLayoutPendingFrames = 0;\n\n const shouldCollapse = tabsOverflowContainer(\n intrinsicWidth,\n this.getLeftZoneAvailableWidth(),\n this.tabsCollapsed,\n BarNav.OVERFLOW_HYSTERESIS_PX\n );\n\n if (!shouldCollapse) {\n this.setOverflowTabLayout(this.resolvedTabs, []);\n this.tabLayoutCommitted = true;\n return;\n }\n\n const visibleCount = visibleTabCountForWidth(\n metrics.itemWidths,\n this.getLeftZoneAvailableWidth(),\n this.getOverflowTriggerReserveWidth(),\n metrics.itemGap,\n metrics.listExtraWidth\n );\n const visibleTabs = trimTrailingDividers(this.resolvedTabs.slice(0, visibleCount));\n const overflowTabs = this.resolvedTabs.slice(visibleTabs.length);\n this.setOverflowTabLayout(visibleTabs, overflowTabs);\n this.tabLayoutCommitted = true;\n }\n\n private syncMenuAnchor() {\n if (!this.menuEl || !this.triggerEl || !this.hasOverflowTabs) return;\n this.menuEl.anchor = this.triggerEl;\n this.syncMenuSections();\n }\n\n private handleMenuSelect(e: Event) {\n const detail = (e as CustomEvent<MenuItemData>).detail;\n if (detail?.value !== undefined) {\n this.selectTab(String(detail.value));\n }\n this.menuOpen = false;\n this.menuInitialFocusVisible = false;\n }\n\n private handleMenuClose() {\n this.menuOpen = false;\n this.menuInitialFocusVisible = false;\n }\n\n private handleMenuAfterClose() {\n if (!this.menuOpen) this.menuTriggerActive = false;\n }\n\n /** Batch tabs/basePath/currentUrl updates so URL derivation never runs with a mixed section. */\n private incomingTabs(): BarNavTab[] {\n return this.tabs ?? [];\n }\n\n private applyHostProps() {\n const nextBasePath = this.basePath;\n const sectionChanged =\n nextBasePath !== '' && this.committedSection !== '' && nextBasePath !== this.committedSection;\n\n if (sectionChanged) {\n this.urlDerivedValue = '';\n this.committedSection = '';\n this.pendingSection = nextBasePath;\n this.resolvedTabs = [];\n this.resetTabOverflowLayout();\n return;\n }\n\n if (this.pendingSection) {\n if (!nextBasePath || nextBasePath !== this.pendingSection) {\n return;\n }\n if (!this.currentUrl.startsWith(this.pendingSection)) {\n return;\n }\n const tabs = this.incomingTabs();\n if (tabs.length === 0) {\n return;\n }\n this.pendingSection = '';\n }\n\n const tabs = this.incomingTabs();\n const tabsConfigChanged =\n this.digestTabsConfig(tabs) !== this.digestTabsConfig(this.resolvedTabs);\n\n this.resolvedTabs = tabs;\n this.syncValueFromUrl();\n this.committedSection = nextBasePath;\n if (tabsConfigChanged) {\n this.resetTabOverflowLayout();\n }\n this.scheduleOverflowCheck();\n }\n\n private syncMenuSections() {\n if (!this.menuEl) return;\n this.menuEl.sections = tabsToOverflowMenuSections(this.overflowTabs, this.effectiveValue);\n }\n\n private syncValueFromUrl() {\n const tabs = this.incomingTabs();\n\n if (!this.currentUrl || !this.basePath) {\n this.urlDerivedValue = '';\n this.hideTabsForDetailRoute = false;\n return;\n }\n\n if (!this.currentUrl.startsWith(this.basePath)) {\n this.urlDerivedValue = '';\n this.hideTabsForDetailRoute = false;\n return;\n }\n\n const { value, hideTabs } = deriveBarNavValueFromUrl(this.currentUrl, this.basePath, tabs);\n this.urlDerivedValue = value;\n this.hideTabsForDetailRoute = hideTabs;\n }\n\n private selectTab(id: string) {\n this.value = id;\n this.dsTabChange.emit(id);\n }\n\n /** Move focus to the selected tab in the visible tab group (after expand). */\n private focusVisibleSelectedTab() {\n const tab = this.visibleTabListEl?.querySelector(\n `[data-tab-id=\"${this.effectiveValue}\"]`\n ) as HTMLElement | null;\n tab?.focus({ preventScroll: true });\n }\n\n private focusVisibleTab(id: string) {\n this.focusedTabId = id;\n const tab = this.visibleTabListEl?.querySelector(`[data-tab-id=\"${id}\"]`) as HTMLElement | null;\n tab?.focus({ preventScroll: true });\n }\n\n private focusLastVisibleTab() {\n const last = [...this.renderedSelectableTabs].reverse().find(tab => !tab.isInactive);\n if (last) this.focusVisibleTab(last.id);\n }\n\n private findEnabledVisibleTab(from: number, step: 1 | -1): number | null {\n const tabs = this.renderedSelectableTabs;\n for (let index = from + step; index >= 0 && index < tabs.length; index += step) {\n if (!tabs[index]?.isInactive) return index;\n }\n return null;\n }\n\n private handleTabKeyDown(e: KeyboardEvent) {\n const tabs = this.renderedSelectableTabs;\n if (!tabs.length) return;\n const targetId = (e.target as HTMLElement | null)?.getAttribute('data-tab-id');\n const focusedId = targetId ?? this.focusedTabId;\n\n if (e.key === 'Enter' || e.key === ' ') {\n const focused = tabs.find(tab => tab.id === focusedId);\n if (!focused || focused.isInactive) return;\n e.preventDefault();\n this.selectTab(focused.id);\n return;\n }\n\n const currentIndex = tabs.findIndex(tab => tab.id === focusedId);\n if (currentIndex < 0) return;\n\n let nextIndex: number | null;\n if (e.key === 'ArrowRight') {\n nextIndex = this.findEnabledVisibleTab(currentIndex, 1);\n if (nextIndex === null && this.hasOverflowTabs) {\n e.preventDefault();\n this.overflowRovingFocused = true;\n void this.triggerEl?.setFocus?.();\n return;\n }\n } else if (e.key === 'ArrowLeft') {\n nextIndex = this.findEnabledVisibleTab(currentIndex, -1);\n } else if (e.key === 'Home') {\n nextIndex = tabs.findIndex(tab => !tab.isInactive);\n } else if (e.key === 'End') {\n const reversedIndex = [...tabs].reverse().findIndex(tab => !tab.isInactive);\n nextIndex = reversedIndex < 0 ? null : tabs.length - 1 - reversedIndex;\n } else {\n return;\n }\n\n if (nextIndex === null || nextIndex < 0 || nextIndex === currentIndex) return;\n e.preventDefault();\n this.focusVisibleTab(tabs[nextIndex].id);\n }\n\n private toggleTabMenu(options?: { focusVisible?: boolean }) {\n if (this.menuOpen) {\n this.menuOpen = false;\n this.menuInitialFocusVisible = false;\n return;\n }\n\n if (this.menuEl && this.triggerEl) {\n this.menuEl.anchor = this.triggerEl;\n this.menuEl.minWidth = '';\n this.syncMenuSections();\n }\n\n this.menuInitialFocusVisible = options?.focusVisible ?? false;\n this.menuTriggerActive = true;\n this.menuOpen = true;\n }\n\n private handleOverflowFocus = () => {\n this.overflowRovingFocused = true;\n };\n\n private handleOverflowBlur = () => {\n this.overflowRovingFocused = false;\n };\n\n private handleTriggerKeyDown(e: KeyboardEvent) {\n if (!this.hasOverflowTabs) return;\n\n if (!this.menuOpen) {\n if (e.key === 'ArrowLeft') {\n e.preventDefault();\n this.overflowRovingFocused = false;\n this.focusLastVisibleTab();\n return;\n }\n\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n this.toggleTabMenu({ focusVisible: true });\n }\n return;\n }\n\n if (e.key === 'Escape') {\n e.preventDefault();\n this.menuOpen = false;\n this.menuInitialFocusVisible = false;\n void this.triggerEl?.setFocus?.();\n }\n }\n\n private renderTabList(tabs: BarNavTab[], probe: boolean) {\n return (\n <div\n role=\"tablist\"\n class=\"bar-nav__tab-list\"\n aria-label={this.heading}\n ref={el => {\n if (probe) {\n const next = (el as HTMLElement) ?? null;\n if (next === this.probeTabListEl) return;\n this.probeTabListEl = next;\n if (next) {\n this.intrinsicWidthRetryCount = 0;\n this.tabLayoutPendingFrames = 0;\n this.scheduleOverflowCheck();\n }\n } else {\n this.visibleTabListEl = (el as HTMLElement) ?? null;\n }\n }}\n onKeyDown={probe ? undefined : (e: KeyboardEvent) => this.handleTabKeyDown(e)}\n onFocusin={\n probe\n ? undefined\n : () => {\n this.overflowRovingFocused = false;\n }\n }\n >\n {tabs.map((tab, index) => {\n if (isTabDivider(tab)) {\n return (\n <div class=\"bar-nav__tab-divider\" key={`divider-${index}`} aria-hidden=\"true\">\n <div class=\"bar-nav__tab-divider-line\" />\n </div>\n );\n }\n\n const isSelected = tab.id === this.effectiveValue;\n return (\n <button\n key={tab.id}\n type=\"button\"\n role=\"tab\"\n data-tab-id={tab.id}\n class={{\n 'bar-nav__tab': true,\n 'bar-nav__tab--selected': isSelected,\n 'ds-control--md': true,\n 'ds-focus-ring-inset': true,\n 'ds-interaction-fill--on-chrome': true,\n 'ds-control-inactive': !!tab.isInactive,\n }}\n aria-selected={isSelected ? 'true' : 'false'}\n aria-disabled={tab.isInactive ? 'true' : undefined}\n aria-controls={tab.panelId ?? undefined}\n disabled={tab.isInactive}\n tabIndex={\n !probe && !this.overflowRovingFocused && tab.id === this.focusedTabId ? 0 : -1\n }\n onClick={() => !probe && !tab.isInactive && this.selectTab(tab.id)}\n onFocus={() => {\n if (!probe) this.focusedTabId = tab.id;\n }}\n >\n <span\n class={{\n 'bar-nav__tab-label': true,\n 'ds-control-label-box': true,\n 'ds-control-label-dot': !!tab.dot,\n 'bar-nav__tab-label--dot': !!tab.dot,\n }}\n >\n <ds-text as=\"span\" variant=\"text-body-medium\" emphasis={isSelected} color=\"inherit\">\n {tab.label}\n </ds-text>\n {tab.dot && (\n <ds-badge\n class=\"bar-nav__tab-dot ds-control-label-dot__badge\"\n variant=\"dot\"\n hasRing={false}\n label=\"\"\n aria-hidden=\"true\"\n style={{ '--_badge-bg': 'var(--_bar-nav-dot)' }}\n />\n )}\n </span>\n </button>\n );\n })}\n </div>\n );\n }\n\n render() {\n // Section gating only applies when `basePath` is set (SPA section sync).\n // Tabs without a base path must still render — otherwise a single-tab bar\n // (or any non-routed tabs) silently falls through to an empty header.\n const sectionReady = this.basePath === '' || this.committedSection === this.basePath;\n const hasTabs = sectionReady && this.resolvedTabs.length > 0 && !this.hideTabsForDetailRoute;\n const tabGroupKey = this.basePath || 'no-section';\n const renderedTabs = this.hasOverflowTabs ? this.visibleTabs : this.resolvedTabs;\n\n return (\n <Host>\n <header\n class={{\n 'bar-nav': true,\n 'ds-control--md': true,\n 'ds-chrome-row': true,\n 'ds-chrome-space--md': true,\n 'ds-interaction-fill--on-chrome': true,\n 'bar-nav--dashboard': this.navStyle === 'dashboard',\n 'bar-nav--settings': this.navStyle === 'settings',\n 'bar-nav--tabs-collapsed': hasTabs && this.hasOverflowTabs,\n }}\n ref={el => {\n this.headerEl = el as HTMLElement;\n if (el && !this.resizeObserver) {\n this.setupOverflowObserver();\n }\n }}\n >\n {hasTabs && (\n <div class=\"bar-nav__tabs-probe\" aria-hidden=\"true\" inert>\n <div key={`probe-${tabGroupKey}`}>{this.renderTabList(this.resolvedTabs, true)}</div>\n </div>\n )}\n\n {hasTabs && this.tabLayoutCommitted && renderedTabs.length > 0 && (\n <div class=\"bar-nav__left\">\n <div key={`visible-${tabGroupKey}`} class=\"bar-nav__tabs-visible\">\n {this.renderTabList(renderedTabs, false)}\n </div>\n </div>\n )}\n\n {hasTabs && !this.tabLayoutCommitted && (\n <div class=\"bar-nav__tabs-pending\" aria-hidden=\"true\" />\n )}\n\n {!hasTabs && this.heading && (\n <ds-text\n class=\"bar-nav__heading\"\n lineTruncation={1}\n as=\"span\"\n variant=\"text-body-medium\"\n emphasis\n color=\"inherit\"\n wrap=\"nowrap\"\n >\n {this.heading}\n </ds-text>\n )}\n\n {hasTabs && this.hasOverflowTabs && (\n <ds-button-unfilled\n variant=\"icon\"\n class={{\n 'bar-nav__overflow-trigger': true,\n }}\n icon=\"ChevronDown\"\n activeFill={false}\n hasBorder={false}\n background=\"chrome\"\n focusTabIndex={this.overflowRovingFocused ? 0 : -1}\n ref={(el?: HTMLDsButtonUnfilledElement) => {\n this.triggerEl = (el as HTMLElement & { setFocus?: () => Promise<void> }) ?? null;\n }}\n haspopup=\"menu\"\n expanded={this.menuOpen}\n surfaceOpen={this.menuTriggerActive}\n aria-label={this.moreTabsLabel}\n onDsClick={() => this.toggleTabMenu({ focusVisible: false })}\n onFocusin={this.handleOverflowFocus}\n onFocusout={this.handleOverflowBlur}\n onKeyDown={(e: KeyboardEvent) => this.handleTriggerKeyDown(e)}\n />\n )}\n </header>\n\n {hasTabs && this.hasOverflowTabs && (\n <ds-menu\n ref={el => {\n this.menuEl = (el as HTMLDsMenuElement) ?? null;\n }}\n open={this.menuOpen}\n sections={tabsToOverflowMenuSections(this.overflowTabs, this.effectiveValue)}\n side=\"bottom\"\n align=\"end\"\n sideOffset=\"calc(var(--dimension-space-100) + var(--dimension-space-050))\"\n initialFocusVisible={this.menuInitialFocusVisible}\n onDsSelect={(e: Event) => this.handleMenuSelect(e)}\n onDsClose={() => this.handleMenuClose()}\n onDsAfterClose={() => this.handleMenuAfterClose()}\n />\n )}\n </Host>\n );\n }\n}\n",
|
|
320
320
|
"type": "registry:ui"
|
|
321
321
|
},
|
|
322
322
|
{
|
|
@@ -421,8 +421,8 @@
|
|
|
421
421
|
"complexPropertyNote": "Assign these non-primitive values as JavaScript properties: actionItems, actions, primaryAction, sections.",
|
|
422
422
|
"peerDependencies": {
|
|
423
423
|
"required": [
|
|
424
|
-
"@ds-mo/tokens ^6.
|
|
425
|
-
"@ds-mo/icons ^8.1.
|
|
424
|
+
"@ds-mo/tokens ^6.6.1",
|
|
425
|
+
"@ds-mo/icons ^8.1.1"
|
|
426
426
|
],
|
|
427
427
|
"frameworks": "Custom Elements; React 18/19 wrappers; Vue 3 wrappers; Angular 19-22 standalone adapters."
|
|
428
428
|
}
|
|
@@ -444,12 +444,12 @@
|
|
|
444
444
|
"files": [
|
|
445
445
|
{
|
|
446
446
|
"path": "src/wc/components/BarPageTitle/BarPageTitle.css",
|
|
447
|
-
"content": "@import '../../utils/radius.css';\n@import '../../utils/control-density.css';\n@import '../../utils/control-parts.css';\n@import '../../utils/chrome-header.css';\n@import '../../utils/focus-ring.css';\n@import '../../utils/interaction-fill.css';\n@import '../../utils/control-inactive.css';\n\n:host {\n display: block;\n min-width: 0;\n box-sizing: border-box;\n background: var(--color-background-secondary);\n --_bar-page-title-fg-primary: var(--color-foreground-primary);\n --_bar-page-title-fg-secondary: var(--color-foreground-secondary);\n --_bar-page-title-hover: var(--color-interaction-hover);\n --_bar-page-title-pressed: var(--color-interaction-pressed);\n --_bar-page-title-focus: var(--color-interaction-focus);\n --_bar-page-title-border: var(--color-border-tertiary);\n --ds-focus-ring-color: var(--_bar-page-title-focus);\n}\n\n:host-context(ds-shell-app:not([gradient-preset='none'])),\n:host-context(ds-shell-app:not([gradient-preset='none'])) .bar-page-title,\n:host-context(ds-shell-app.shell-app--paper-texture),\n:host-context(ds-shell-app.shell-app--paper-texture) .bar-page-title {\n background: transparent;\n}\n\n.bar-page-title {\n position: relative;\n height: var(--dimension-size-600);\n min-width: 0;\n box-sizing: border-box;\n background: var(--color-background-secondary);\n}\n\n.bar-page-title::after {\n content: '';\n position: absolute;\n inset: auto 0 0;\n height: var(--dimension-stroke-width-012);\n background: var(--
|
|
447
|
+
"content": "@import '../../utils/radius.css';\n@import '../../utils/control-density.css';\n@import '../../utils/control-parts.css';\n@import '../../utils/chrome-header.css';\n@import '../../utils/focus-ring.css';\n@import '../../utils/interaction-fill.css';\n@import '../../utils/control-inactive.css';\n\n:host {\n display: block;\n min-width: 0;\n box-sizing: border-box;\n background: var(--color-background-secondary);\n --_bar-page-title-fg-primary: var(--color-foreground-primary);\n --_bar-page-title-fg-secondary: var(--color-foreground-secondary);\n --_bar-page-title-hover: var(--color-interaction-hover);\n --_bar-page-title-pressed: var(--color-interaction-pressed);\n --_bar-page-title-focus: var(--color-interaction-focus);\n --_bar-page-title-border: var(--color-border-tertiary);\n --ds-focus-ring-color: var(--_bar-page-title-focus);\n}\n\n:host([data-shell-bar]) {\n background: transparent;\n color: var(--_bar-page-title-fg-primary);\n --_bar-page-title-fg-primary: var(--color-chrome-foreground-primary);\n --_bar-page-title-fg-secondary: var(--color-chrome-foreground-secondary);\n --_bar-page-title-hover: var(--color-chrome-interaction-hover);\n --_bar-page-title-pressed: var(--color-chrome-interaction-pressed);\n --_bar-page-title-focus: var(--color-chrome-interaction-focus);\n --_bar-page-title-border: var(--color-chrome-border-tertiary);\n --ds-focus-ring-color: var(--_bar-page-title-focus);\n}\n\n:host-context(ds-shell-app:not([gradient-preset='none'])),\n:host-context(ds-shell-app:not([gradient-preset='none'])) .bar-page-title,\n:host-context(ds-shell-app.shell-app--paper-texture),\n:host-context(ds-shell-app.shell-app--paper-texture) .bar-page-title {\n background: transparent;\n}\n\n.bar-page-title {\n position: relative;\n height: var(--dimension-size-600);\n min-width: 0;\n box-sizing: border-box;\n background: var(--color-background-secondary);\n color: var(--_bar-page-title-fg-primary);\n}\n\n:host([data-shell-bar]) .bar-page-title {\n background: transparent;\n}\n\n.bar-page-title::after {\n content: '';\n position: absolute;\n inset: auto 0 0;\n height: var(--dimension-stroke-width-012);\n background: var(--_bar-page-title-border);\n pointer-events: none;\n}\n\n.bar-page-title--divider-hidden::after {\n display: none;\n}\n\n.bar-page-title__inner {\n position: relative;\n z-index: 1;\n flex: 1 1 auto;\n height: 100%;\n min-width: 0;\n padding: 0;\n gap: 0;\n}\n\n.bar-page-title__row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--dimension-space-100);\n height: 100%;\n min-width: 0;\n}\n\n.bar-page-title__title-row {\n display: flex;\n align-items: center;\n gap: var(--dimension-space-100);\n min-width: 0;\n min-height: var(--dimension-size-400);\n flex: 1 1 auto;\n}\n\n.bar-page-title__identity {\n display: flex;\n flex: 0 1 auto;\n align-items: center;\n gap: var(--dimension-space-050);\n min-width: 0;\n height: var(--dimension-size-400);\n}\n\n.bar-page-title__back,\n.bar-page-title__section-chevron {\n flex: 0 0 auto;\n}\n\n.bar-page-title__heading {\n display: inline-flex;\n flex: 1 1 auto;\n align-items: center;\n width: auto;\n min-width: 0;\n height: var(--dimension-size-400);\n padding-inline: calc(var(--ds-control-padding-inline) + var(--ds-control-label-inset));\n box-sizing: border-box;\n user-select: none;\n}\n\n.bar-page-title__divider {\n width: var(--dimension-stroke-width-012);\n height: var(--dimension-size-250);\n flex: 0 0 var(--dimension-stroke-width-012);\n background: var(--_bar-page-title-border);\n}\n\n.bar-page-title__section-selector {\n display: flex;\n flex: 0 1 auto;\n min-width: 0;\n max-width: var(--dimension-panel-width-sm);\n}\n\n.bar-page-title__section-trigger {\n --ds-control-radius: var(--dimension-radius-half);\n\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: var(--ds-control-gap);\n height: var(--ds-control-height);\n min-width: 0;\n max-width: 100%;\n padding-inline: var(--ds-control-padding-inline);\n border: none;\n border-radius: var(--ds-control-radius);\n box-sizing: border-box;\n background: transparent;\n color: var(--color-foreground-secondary);\n cursor: default;\n font-family: inherit;\n user-select: none;\n}\n\n:host([data-shell-bar]) .bar-page-title__section-trigger {\n color: var(--_bar-page-title-fg-primary);\n}\n\n.bar-page-title__section-label {\n min-width: 0;\n padding-inline: var(--ds-control-label-inset);\n}\n\n.bar-page-title__actions {\n display: flex;\n align-items: center;\n gap: var(--dimension-space-100);\n flex: 0 0 auto;\n}\n\n.bar-page-title__probe {\n position: absolute;\n left: 0;\n top: 0;\n visibility: hidden;\n pointer-events: none;\n overflow: visible;\n width: max-content;\n max-width: none;\n z-index: -1;\n}\n\n.bar-page-title__probe-row {\n display: flex;\n align-items: center;\n gap: var(--dimension-space-100);\n width: max-content;\n max-width: none;\n}\n\n.bar-page-title__probe .bar-page-title__identity,\n.bar-page-title__probe .bar-page-title__heading {\n flex: 0 0 auto;\n width: max-content;\n min-width: 0;\n max-width: none;\n}\n\n.bar-page-title__tabs-pending {\n flex: 0 0 auto;\n width: var(--dimension-size-400);\n height: var(--ds-control-height);\n visibility: hidden;\n pointer-events: none;\n}\n\n.bar-page-title__tab-list {\n display: flex;\n align-items: center;\n gap: var(--dimension-space-050);\n position: relative;\n width: max-content;\n flex: 0 0 auto;\n min-width: 0;\n}\n\n.bar-page-title__tab {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: var(--ds-control-gap);\n height: var(--ds-control-height);\n min-width: var(--ds-control-height);\n padding: 0 var(--ds-control-padding-inline);\n box-sizing: border-box;\n border: none;\n border-radius: var(--ds-control-radius);\n background-color: transparent;\n color: var(--_bar-page-title-fg-secondary);\n cursor: default;\n position: relative;\n flex-shrink: 0;\n -webkit-user-select: none;\n user-select: none;\n transition: color var(--effect-motion-short-2);\n}\n\n.bar-page-title__tab::after {\n content: '';\n position: absolute;\n inset: 0;\n border-radius: var(--ds-control-radius);\n background: transparent;\n pointer-events: none;\n cursor: inherit;\n}\n\n@media (hover: hover) and (pointer: fine) {\n .bar-page-title__tab:hover::after {\n background: var(--_bar-page-title-hover);\n }\n}\n\n.bar-page-title__tab:active::after {\n background: var(--_bar-page-title-pressed);\n}\n\n.bar-page-title__tab--selected {\n color: var(--_bar-page-title-fg-primary);\n}\n\n.bar-page-title__tab-label {\n display: inline-flex;\n align-items: center;\n white-space: nowrap;\n}\n\n.bar-page-title__tab-divider {\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n width: var(--dimension-space-100);\n height: var(--ds-control-height);\n padding-block: var(--ds-control-padding-inline);\n flex-shrink: 0;\n pointer-events: none;\n}\n\n.bar-page-title__tab-divider-line {\n width: var(--dimension-stroke-width-012);\n align-self: stretch;\n background-color: var(--_bar-page-title-border);\n}\n",
|
|
448
448
|
"type": "registry:ui"
|
|
449
449
|
},
|
|
450
450
|
{
|
|
451
451
|
"path": "src/wc/components/BarPageTitle/BarPageTitle.tsx",
|
|
452
|
-
"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 {\n CHROME_TRANSITION_END,\n CHROME_TRANSITION_START,\n ChromeTransitionGate,\n createRafCoalescer,\n readChromeTransitionPhase,\n readChromeTransitionSource,\n} from '../../shell/chrome-transition';\nimport type { MenuItemData } from '../Menu/menu-types';\nimport { tabsOverflowContainer } from '../BarNav/bar-nav-tabs-menu-utils';\nimport { getSelectableTabs, isTabDivider, type TabItemTab } from '../TabGroup/tab-item-utils';\nimport {\n availableBarTitleActionMenuIds,\n barTitleActionIdIssues,\n findBarTitleAction,\n overflowBarTitleActionSections,\n resolveBarTitleActionItems,\n visibleBarTitleActions,\n} from '../BarTitle/bar-title-actions';\nimport {\n type FocusableBarTitleButton,\n barTitleActionMenuDomId,\n renderBarTitleActionMenus,\n renderBarTitleActions,\n renderBarTitleBack,\n renderBarTitleOverflowMenu,\n renderBarTitleSectionTrigger,\n restoreBarTitleActionFocus,\n} from '../BarTitle/bar-title-action-chrome';\nimport {\n barTitleSectionMenuSections,\n barTitleSectionTriggerAriaLabel,\n barTitleSectionsDigest,\n barTitleSectionsToTabs,\n effectiveBarTitleSectionValue,\n selectableBarTitleSections,\n selectedBarTitleSectionLabel,\n} from '../BarTitle/bar-title-sections';\nimport type {\n BarTitleActionConfigItem,\n BarTitleActionItem,\n BarTitlePrimaryAction,\n BarTitleSectionItem,\n} from '../BarTitle/bar-title-types';\n\nlet nextBarPageTitleId = 0;\n\n@Component({\n tag: 'ds-bar-page-title',\n styleUrl: 'BarPageTitle.css',\n scoped: true,\n})\nexport class BarPageTitle {\n private static readonly INTRINSIC_WIDTH_RETRY_MAX = 3;\n private static readonly TAB_LAYOUT_COMMIT_MAX_FRAMES = 16;\n private static readonly OVERFLOW_HYSTERESIS_PX = 8;\n\n @Element() el!: HTMLElement;\n\n /** The page's single visible h1. */\n @Prop() heading!: string;\n\n /** Show the leading page-level Back action. */\n @Prop({ attribute: 'show-back' }) showBack: boolean = false;\n\n /** Accessible name for the leading Back action. */\n @Prop() backAriaLabel: string = 'Back';\n\n /** Optional page sections shown as an all-or-nothing tab row, or the compact section button. */\n @Prop() sections: BarTitleSectionItem[] = [];\n\n /** Id of the active page section. */\n @Prop() value: string = '';\n\n /** Accessible name for the page-section tablist and menu. */\n @Prop() sectionsAriaLabel: string = 'Change page section';\n\n /** The one highest-emphasis page action. */\n @Prop() primaryAction: BarTitlePrimaryAction | null = null;\n\n /** Secondary page actions shown in the overflow menu. Dividers create groups. */\n @Prop() actions: BarTitleActionItem[] = [];\n\n /**\n * Ordered page-header actions. When supplied, this replaces the legacy\n * primaryAction/actions presentation while preserving the same dsAction event.\n */\n @Prop() actionItems?: BarTitleActionConfigItem[];\n\n /** Accessible name for the page-actions menu. */\n @Prop() actionsAriaLabel: string = 'More page actions';\n\n /** Draw the compact bottom divider beneath the header. */\n @Prop() showDivider: boolean = true;\n\n /** Override divider visibility for the compact shell-bar presentation. */\n @Prop() showCompactDivider?: boolean;\n\n /** Emitted when the leading Back action is activated. */\n @Event() dsBack!: EventEmitter<MouseEvent>;\n\n /** Emitted with the newly selected page-section id. */\n @Event() dsSectionChange!: EventEmitter<string>;\n\n /** Emitted with the activated primary or overflow action id. */\n @Event() dsAction!: EventEmitter<string>;\n\n @State() private sectionMenuOpen = false;\n @State() private openActionMenuId = '';\n @State() private surfaceActionMenuId = '';\n @State() private sectionSurfaceOpen = false;\n @State() private sectionMenuInitialFocusVisible = false;\n @State() private actionMenuInitialFocusVisible = false;\n @State() private sectionsCollapsed = false;\n @State() private layoutCommitted = false;\n @State() private focusedTabId = '';\n\n private readonly instanceId = nextBarPageTitleId++;\n private readonly sectionMenuTriggerId = `bar-page-title-section-trigger-${this.instanceId}`;\n private readonly sectionMenuId = `bar-page-title-section-menu-${this.instanceId}`;\n private readonly actionMenuTriggerId = `bar-page-title-action-trigger-${this.instanceId}`;\n private readonly actionMenuId = `bar-page-title-action-menu-${this.instanceId}`;\n private sectionTriggerEl: HTMLButtonElement | null = null;\n private actionTriggerEl: FocusableBarTitleButton | null = null;\n private actionTriggerEls = new Map<string, FocusableBarTitleButton>();\n private chromeEl: HTMLElement | null = null;\n private rowEl: HTMLElement | null = null;\n private probeRowEl: HTMLElement | null = null;\n private visibleTabListEl: HTMLElement | null = null;\n private resizeObserver: ResizeObserver | null = null;\n private intrinsicWidthRetryCount = 0;\n private tabLayoutPendingFrames = 0;\n private readonly panelNavTransition = new ChromeTransitionGate();\n private readonly panelToolsTransition = new ChromeTransitionGate();\n private readonly overflowCoalescer = createRafCoalescer(() => {\n this.updateSectionsCollapsed();\n });\n private chromeTransitionShell: HTMLElement | null = null;\n\n componentWillLoad() {\n this.reportActionIdIssues();\n this.syncFocusedTabId(this.effectiveValue, this.selectableTabs);\n }\n\n componentDidLoad() {\n this.setupOverflowObserver();\n this.bindChromeTransitionListeners();\n this.scheduleOverflowCheck();\n }\n\n componentDidRender() {\n if (this.chromeOverflowPaused()) return;\n this.scheduleOverflowCheck();\n }\n\n disconnectedCallback() {\n this.resizeObserver?.disconnect();\n this.resizeObserver = null;\n this.overflowCoalescer.cancel();\n this.unbindChromeTransitionListeners();\n }\n\n @Watch('sections')\n handleSectionsChange(next: BarTitleSectionItem[], prev: BarTitleSectionItem[]) {\n if (!this.hasSectionSelector) {\n this.closeSectionMenu();\n this.sectionSurfaceOpen = false;\n this.sectionsCollapsed = false;\n this.layoutCommitted = true;\n this.intrinsicWidthRetryCount = 0;\n this.tabLayoutPendingFrames = 0;\n return;\n }\n if (barTitleSectionsDigest(next) === barTitleSectionsDigest(prev)) {\n this.syncFocusedTabId(this.effectiveValue, this.selectableTabs);\n return;\n }\n this.resetSectionLayout();\n this.syncFocusedTabId(this.effectiveValue, this.selectableTabs);\n this.scheduleOverflowCheck();\n }\n\n @Watch('value')\n handleValueChange() {\n this.syncFocusedTabId(this.effectiveValue, this.selectableTabs);\n this.scheduleOverflowCheck();\n }\n\n @Watch('heading')\n @Watch('showBack')\n @Watch('primaryAction')\n @Watch('actions')\n @Watch('actionItems')\n handleLayoutInputsChange() {\n this.reportActionIdIssues();\n if (!this.availableActionMenuIds.has(this.openActionMenuId)) this.closeActionMenu();\n if (!this.availableActionMenuIds.has(this.surfaceActionMenuId)) this.surfaceActionMenuId = '';\n this.scheduleOverflowCheck();\n }\n\n private reportActionIdIssues() {\n for (const issue of barTitleActionIdIssues(this.resolvedActionItems)) {\n console.warn(`[ds-bar-page-title] ${issue}`);\n }\n }\n\n private get dividerVisible(): boolean {\n return this.showCompactDivider ?? this.showDivider;\n }\n\n private get selectableSections() {\n return selectableBarTitleSections(this.sections);\n }\n\n private get hasSectionSelector(): boolean {\n return this.selectableSections.length > 1;\n }\n\n private get sectionTabs() {\n return barTitleSectionsToTabs(this.sections);\n }\n\n private get selectableTabs(): TabItemTab[] {\n return getSelectableTabs(this.sectionTabs);\n }\n\n private get effectiveValue(): string {\n return effectiveBarTitleSectionValue(this.sections, this.value);\n }\n\n private get selectedSectionLabel(): string {\n return selectedBarTitleSectionLabel(this.sections, this.value);\n }\n\n private get sectionTriggerAriaLabel(): string {\n return barTitleSectionTriggerAriaLabel(this.sectionsAriaLabel, this.selectedSectionLabel);\n }\n\n private get sectionMenuSections() {\n return barTitleSectionMenuSections(this.sections, this.effectiveValue);\n }\n\n private get resolvedActionItems(): BarTitleActionConfigItem[] {\n return resolveBarTitleActionItems(this.actionItems, this.primaryAction, this.actions);\n }\n\n private get visibleActions(): BarTitleActionConfigItem[] {\n return visibleBarTitleActions(this.resolvedActionItems, 'compact');\n }\n\n private get actionMenuSections() {\n return overflowBarTitleActionSections(this.resolvedActionItems, 'compact');\n }\n\n private get showActionMenuTrigger(): boolean {\n return this.actionMenuSections.length > 0;\n }\n\n private get availableActionMenuIds(): Set<string> {\n return availableBarTitleActionMenuIds(this.visibleActions, this.showActionMenuTrigger);\n }\n\n private get showSectionTabs(): boolean {\n return this.hasSectionSelector && this.layoutCommitted && !this.sectionsCollapsed;\n }\n\n private get showSectionButton(): boolean {\n return this.hasSectionSelector && this.layoutCommitted && this.sectionsCollapsed;\n }\n\n private resetSectionLayout() {\n this.layoutCommitted = false;\n this.sectionsCollapsed = false;\n this.sectionMenuOpen = false;\n this.sectionMenuInitialFocusVisible = false;\n this.intrinsicWidthRetryCount = 0;\n this.tabLayoutPendingFrames = 0;\n }\n\n private bindChromeTransitionListeners() {\n const shell = this.el.closest<HTMLElement>('ds-shell-app');\n if (!shell) return;\n this.chromeTransitionShell = shell;\n shell.addEventListener(CHROME_TRANSITION_START, this.onChromeTransitionStart);\n shell.addEventListener(CHROME_TRANSITION_END, this.onChromeTransitionEnd);\n }\n\n private unbindChromeTransitionListeners() {\n if (!this.chromeTransitionShell) return;\n this.chromeTransitionShell.removeEventListener(\n CHROME_TRANSITION_START,\n this.onChromeTransitionStart\n );\n this.chromeTransitionShell.removeEventListener(\n CHROME_TRANSITION_END,\n this.onChromeTransitionEnd\n );\n this.chromeTransitionShell = null;\n }\n\n private onChromeTransitionStart = (event: Event) => {\n const source = readChromeTransitionSource(event);\n if (source === 'panel-nav') {\n this.panelNavTransition.enter();\n return;\n }\n if (source === 'panel-tools') {\n const phase = readChromeTransitionPhase(event) ?? 'opening';\n if (phase === 'closing') {\n this.panelToolsTransition.enter();\n }\n }\n };\n\n private chromeOverflowPaused(): boolean {\n return this.panelNavTransition.isActive || this.panelToolsTransition.isActive;\n }\n\n private onChromeTransitionEnd = (event: Event) => {\n const source = readChromeTransitionSource(event);\n if (source === 'panel-nav') {\n this.panelNavTransition.exit();\n if (!this.panelNavTransition.isActive) {\n this.scheduleOverflowCheck();\n }\n return;\n }\n if (source === 'panel-tools') {\n this.panelToolsTransition.exit();\n this.scheduleOverflowCheck();\n }\n };\n\n private setupOverflowObserver() {\n if (typeof ResizeObserver === 'undefined' || !this.chromeEl) return;\n this.resizeObserver?.disconnect();\n this.resizeObserver = new ResizeObserver(() => {\n if (this.chromeOverflowPaused()) return;\n this.scheduleOverflowCheck();\n });\n this.resizeObserver.observe(this.chromeEl);\n }\n\n private scheduleOverflowCheck() {\n if (this.chromeOverflowPaused()) return;\n this.overflowCoalescer.schedule();\n }\n\n private scheduleIntrinsicWidthRetry() {\n if (this.intrinsicWidthRetryCount >= BarPageTitle.INTRINSIC_WIDTH_RETRY_MAX) return;\n this.intrinsicWidthRetryCount++;\n requestAnimationFrame(() => this.scheduleOverflowCheck());\n }\n\n private forceTabLayoutCommit(collapsed: boolean) {\n this.intrinsicWidthRetryCount = 0;\n this.tabLayoutPendingFrames = 0;\n const collapsedChanged = this.sectionsCollapsed !== collapsed;\n if (collapsedChanged) this.sectionsCollapsed = collapsed;\n if (!collapsed && collapsedChanged) {\n this.closeSectionMenu();\n this.sectionSurfaceOpen = false;\n }\n this.layoutCommitted = true;\n }\n\n private getAvailableWidth(): number {\n if (!this.rowEl) return 0;\n const rowWidth = this.rowEl.clientWidth;\n const actions = this.rowEl.querySelector<HTMLElement>('.bar-page-title__actions');\n const actionsWidth = actions?.getBoundingClientRect().width ?? 0;\n const style = getComputedStyle(this.rowEl);\n const gap = parseFloat(style.columnGap || style.gap) || 0;\n return Math.max(0, rowWidth - actionsWidth - (actionsWidth > 0 ? gap : 0));\n }\n\n private updateSectionsCollapsed() {\n if (!this.hasSectionSelector) {\n if (this.sectionsCollapsed) this.sectionsCollapsed = false;\n this.intrinsicWidthRetryCount = 0;\n this.tabLayoutPendingFrames = 0;\n this.layoutCommitted = true;\n return;\n }\n\n const probeWidth = this.probeRowEl?.scrollWidth ?? 0;\n const available = this.getAvailableWidth();\n if (!this.probeRowEl || !this.rowEl || probeWidth === 0) {\n if (this.layoutCommitted) {\n this.scheduleIntrinsicWidthRetry();\n return;\n }\n this.tabLayoutPendingFrames += 1;\n if (\n this.intrinsicWidthRetryCount >= BarPageTitle.INTRINSIC_WIDTH_RETRY_MAX ||\n this.tabLayoutPendingFrames >= BarPageTitle.TAB_LAYOUT_COMMIT_MAX_FRAMES\n ) {\n this.forceTabLayoutCommit(false);\n } else {\n this.scheduleIntrinsicWidthRetry();\n }\n return;\n }\n\n this.intrinsicWidthRetryCount = 0;\n this.tabLayoutPendingFrames = 0;\n const shouldCollapse = tabsOverflowContainer(\n probeWidth,\n available,\n this.sectionsCollapsed,\n BarPageTitle.OVERFLOW_HYSTERESIS_PX\n );\n this.forceTabLayoutCommit(shouldCollapse);\n }\n\n private syncFocusedTabId(preferred: string, tabs: TabItemTab[]) {\n if (tabs.some(tab => tab.id === preferred && !tab.isInactive)) {\n this.focusedTabId = preferred;\n return;\n }\n const first = tabs.find(tab => !tab.isInactive);\n this.focusedTabId = first?.id ?? '';\n }\n\n private selectSection(id: string) {\n const selected = this.selectableSections.find(section => section.id === id);\n if (!selected || selected.isInactive) return;\n this.dsSectionChange.emit(id);\n }\n\n private toggleSectionMenu = (event: MouseEvent) => {\n this.sectionMenuInitialFocusVisible = event.detail === 0;\n this.openActionMenuId = '';\n this.sectionMenuOpen = !this.sectionMenuOpen;\n if (this.sectionMenuOpen) this.sectionSurfaceOpen = true;\n };\n\n private closeSectionMenu = () => {\n this.sectionMenuOpen = false;\n };\n\n private handleSectionSelect = (event: CustomEvent<MenuItemData>) => {\n const id = String(event.detail?.value ?? '');\n this.closeSectionMenu();\n this.selectSection(id);\n requestAnimationFrame(() => this.sectionTriggerEl?.focus());\n };\n\n private toggleActionMenu = (id: string, event: MouseEvent) => {\n this.actionMenuInitialFocusVisible = event.detail === 0;\n this.sectionMenuOpen = false;\n this.openActionMenuId = this.openActionMenuId === id ? '' : id;\n if (this.openActionMenuId) this.surfaceActionMenuId = this.openActionMenuId;\n };\n\n private finishActionMenuClose = (event: CustomEvent<void>) => {\n const id = this.surfaceActionMenuId;\n const domId =\n id === '__overflow'\n ? this.actionMenuId\n : barTitleActionMenuDomId('bar-page-title', this.instanceId, this.resolvedActionItems, id);\n if (this.openActionMenuId !== id && (event.target as HTMLElement).id === domId) {\n this.surfaceActionMenuId = '';\n }\n };\n\n private closeActionMenu = () => {\n this.openActionMenuId = '';\n };\n\n private handleActionSelect = (event: CustomEvent<MenuItemData>) => {\n const id = String(event.detail?.value ?? '');\n const action = findBarTitleAction(this.resolvedActionItems, id);\n if (!action || action.isInactive || ('isLoading' in action && action.isLoading)) return;\n const menuId = this.openActionMenuId;\n this.closeActionMenu();\n this.dsAction.emit(id);\n requestAnimationFrame(() => {\n void restoreBarTitleActionFocus({\n menuId,\n overflowTrigger: this.actionTriggerEl,\n actionTriggers: this.actionTriggerEls,\n resolvedActionItems: this.resolvedActionItems,\n });\n });\n };\n\n private focusVisibleTab(id: string) {\n this.focusedTabId = id;\n const tab = this.visibleTabListEl?.querySelector(`[data-tab-id=\"${id}\"]`) as HTMLElement | null;\n tab?.focus({ preventScroll: true });\n }\n\n private findEnabledTab(from: number, step: 1 | -1): number | null {\n const tabs = this.selectableTabs;\n for (let index = from + step; index >= 0 && index < tabs.length; index += step) {\n if (!tabs[index]?.isInactive) return index;\n }\n return null;\n }\n\n private handleTabKeyDown(event: KeyboardEvent) {\n const tabs = this.selectableTabs;\n if (!tabs.length) return;\n const targetId = (event.target as HTMLElement | null)?.getAttribute('data-tab-id');\n const focusedId = targetId ?? this.focusedTabId;\n\n if (event.key === 'Enter' || event.key === ' ') {\n const focused = tabs.find(tab => tab.id === focusedId);\n if (!focused || focused.isInactive) return;\n event.preventDefault();\n this.selectSection(focused.id);\n return;\n }\n\n const currentIndex = tabs.findIndex(tab => tab.id === focusedId);\n if (currentIndex < 0) return;\n\n let nextIndex: number | null;\n if (event.key === 'ArrowRight') {\n nextIndex = this.findEnabledTab(currentIndex, 1);\n } else if (event.key === 'ArrowLeft') {\n nextIndex = this.findEnabledTab(currentIndex, -1);\n } else if (event.key === 'Home') {\n nextIndex = tabs.findIndex(tab => !tab.isInactive);\n } else if (event.key === 'End') {\n const reversedIndex = [...tabs].reverse().findIndex(tab => !tab.isInactive);\n nextIndex = reversedIndex < 0 ? null : tabs.length - 1 - reversedIndex;\n } else {\n return;\n }\n\n if (nextIndex === null || nextIndex < 0 || nextIndex === currentIndex) return;\n event.preventDefault();\n this.focusVisibleTab(tabs[nextIndex].id);\n }\n\n private chromeActionOptions() {\n return {\n classPrefix: 'bar-page-title',\n compact: true,\n visibleActions: this.visibleActions,\n showOverflowTrigger: this.showActionMenuTrigger,\n actionItems: this.actionItems,\n primaryAction: this.primaryAction,\n resolvedActionItems: this.resolvedActionItems,\n instanceId: this.instanceId,\n openActionMenuId: this.openActionMenuId,\n surfaceActionMenuId: this.surfaceActionMenuId,\n actionsAriaLabel: this.actionsAriaLabel,\n actionMenuTriggerId: this.actionMenuTriggerId,\n actionMenuId: this.actionMenuId,\n actionTriggers: this.actionTriggerEls,\n setOverflowTriggerEl: (el: FocusableBarTitleButton | null) => {\n this.actionTriggerEl = el;\n },\n toggleActionMenu: this.toggleActionMenu,\n emitAction: (id: string) => this.dsAction.emit(id),\n };\n }\n\n private renderHeading(probe: boolean) {\n return (\n <ds-text\n class=\"bar-page-title__heading ds-control--md\"\n variant=\"text-title-small\"\n emphasis\n color=\"primary\"\n as={probe ? 'span' : 'h1'}\n wrap={probe ? 'nowrap' : undefined}\n lineTruncation={probe ? 'none' : 1}\n >\n {this.heading}\n </ds-text>\n );\n }\n\n private renderTabList(probe: boolean) {\n return (\n <div\n role={probe ? undefined : 'tablist'}\n class=\"bar-page-title__tab-list\"\n aria-label={probe ? undefined : this.sectionsAriaLabel}\n ref={el => {\n if (!probe) this.visibleTabListEl = (el as HTMLElement) ?? null;\n }}\n onKeyDown={probe ? undefined : (event: KeyboardEvent) => this.handleTabKeyDown(event)}\n >\n {this.sectionTabs.map((tab, index) => {\n if (isTabDivider(tab)) {\n return (\n <div class=\"bar-page-title__tab-divider\" key={`divider-${index}`} aria-hidden=\"true\">\n <div class=\"bar-page-title__tab-divider-line\" />\n </div>\n );\n }\n\n const isSelected = tab.id === this.effectiveValue;\n return (\n <button\n key={tab.id}\n type=\"button\"\n role={probe ? undefined : 'tab'}\n data-tab-id={tab.id}\n class={{\n 'bar-page-title__tab': true,\n 'bar-page-title__tab--selected': isSelected,\n 'ds-control--md': true,\n 'ds-focus-ring-inset': true,\n 'ds-control-inactive': !!tab.isInactive,\n }}\n aria-selected={isSelected ? 'true' : 'false'}\n aria-disabled={tab.isInactive ? 'true' : undefined}\n disabled={tab.isInactive}\n tabIndex={!probe && tab.id === this.focusedTabId ? 0 : -1}\n onClick={() => !probe && this.selectSection(tab.id)}\n onFocus={() => {\n if (!probe) this.focusedTabId = tab.id;\n }}\n >\n <ds-text\n class=\"bar-page-title__tab-label ds-control-label-box\"\n as=\"span\"\n variant=\"text-body-medium\"\n emphasis={isSelected}\n color=\"inherit\"\n >\n {tab.label}\n </ds-text>\n </button>\n );\n })}\n </div>\n );\n }\n\n private renderIdentity(probe: boolean) {\n return (\n <div class=\"bar-page-title__identity\">\n {renderBarTitleBack({\n classPrefix: 'bar-page-title',\n showBack: this.showBack,\n backAriaLabel: this.backAriaLabel,\n onBack: event => this.dsBack.emit(event),\n })}\n {this.renderHeading(probe)}\n </div>\n );\n }\n\n private renderSectionRegion() {\n if (!this.hasSectionSelector) return null;\n if (!this.layoutCommitted) {\n return [\n <div class=\"bar-page-title__divider\" aria-hidden=\"true\" />,\n <div class=\"bar-page-title__tabs-pending\" aria-hidden=\"true\" />,\n ];\n }\n if (this.showSectionTabs) {\n return [\n <div class=\"bar-page-title__divider\" aria-hidden=\"true\" />,\n this.renderTabList(false),\n ];\n }\n return [\n <div class=\"bar-page-title__divider\" aria-hidden=\"true\" />,\n renderBarTitleSectionTrigger({\n classPrefix: 'bar-page-title',\n triggerId: this.sectionMenuTriggerId,\n menuId: this.sectionMenuId,\n open: this.sectionMenuOpen,\n surfaceOpen: this.sectionSurfaceOpen,\n ariaLabel: this.sectionTriggerAriaLabel,\n selectedLabel: this.selectedSectionLabel,\n setTriggerEl: el => {\n this.sectionTriggerEl = el;\n },\n onToggle: this.toggleSectionMenu,\n }),\n ];\n }\n\n render() {\n return (\n <Host>\n <div\n class={{\n 'bar-page-title': true,\n 'bar-page-title--divider-hidden': !this.dividerVisible,\n 'ds-chrome-header': true,\n }}\n ref={el => {\n this.chromeEl = (el as HTMLElement) ?? null;\n if (el && !this.resizeObserver) this.setupOverflowObserver();\n }}\n >\n {this.hasSectionSelector ? (\n <div class=\"bar-page-title__probe\" aria-hidden=\"true\" inert>\n <div\n class=\"bar-page-title__probe-row\"\n ref={el => {\n const next = (el as HTMLElement) ?? null;\n if (next === this.probeRowEl) return;\n this.probeRowEl = next;\n if (next) {\n this.intrinsicWidthRetryCount = 0;\n this.tabLayoutPendingFrames = 0;\n this.scheduleOverflowCheck();\n }\n }}\n >\n {this.renderIdentity(true)}\n <div class=\"bar-page-title__divider\" />\n {this.renderTabList(true)}\n </div>\n </div>\n ) : null}\n\n <div class=\"bar-page-title__inner\">\n <div\n class=\"bar-page-title__row\"\n ref={el => {\n this.rowEl = (el as HTMLElement) ?? null;\n }}\n >\n <div class=\"bar-page-title__title-row\">\n {this.renderIdentity(false)}\n {this.renderSectionRegion()}\n </div>\n {renderBarTitleActions(this.chromeActionOptions())}\n </div>\n </div>\n </div>\n\n {this.showSectionButton ? (\n <ds-menu\n id={this.sectionMenuId}\n class=\"bar-page-title__section-menu\"\n anchorId={this.sectionMenuTriggerId}\n menuLabel={this.sectionsAriaLabel}\n open={this.sectionMenuOpen}\n initialFocusVisible={this.sectionMenuInitialFocusVisible}\n sections={this.sectionMenuSections}\n onDsClose={this.closeSectionMenu}\n onDsAfterClose={() => {\n if (!this.sectionMenuOpen) this.sectionSurfaceOpen = false;\n }}\n onDsSelect={this.handleSectionSelect}\n />\n ) : null}\n\n {renderBarTitleActionMenus({\n classPrefix: 'bar-page-title',\n visibleActions: this.visibleActions,\n instanceId: this.instanceId,\n resolvedActionItems: this.resolvedActionItems,\n openActionMenuId: this.openActionMenuId,\n actionMenuInitialFocusVisible: this.actionMenuInitialFocusVisible,\n overflowTrigger: this.actionTriggerEl,\n actionTriggers: this.actionTriggerEls,\n closeActionMenu: this.closeActionMenu,\n finishActionMenuClose: this.finishActionMenuClose,\n handleActionSelect: this.handleActionSelect,\n })}\n\n {renderBarTitleOverflowMenu({\n classPrefix: 'bar-page-title',\n showOverflowTrigger: this.showActionMenuTrigger,\n actionMenuId: this.actionMenuId,\n actionMenuTriggerId: this.actionMenuTriggerId,\n actionsAriaLabel: this.actionsAriaLabel,\n open: this.openActionMenuId === '__overflow',\n actionMenuInitialFocusVisible: this.actionMenuInitialFocusVisible,\n actionMenuSections: this.actionMenuSections,\n closeActionMenu: this.closeActionMenu,\n finishActionMenuClose: this.finishActionMenuClose,\n handleActionSelect: this.handleActionSelect,\n })}\n </Host>\n );\n }\n}\n",
|
|
452
|
+
"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 {\n CHROME_TRANSITION_END,\n CHROME_TRANSITION_START,\n ChromeTransitionGate,\n createRafCoalescer,\n readChromeTransitionPhase,\n readChromeTransitionSource,\n} from '../../shell/chrome-transition';\nimport type { MenuItemData } from '../Menu/menu-types';\nimport { tabsOverflowContainer } from '../BarNav/bar-nav-tabs-menu-utils';\nimport { getSelectableTabs, isTabDivider, type TabItemTab } from '../TabGroup/tab-item-utils';\nimport {\n availableBarTitleActionMenuIds,\n barTitleActionIdIssues,\n findBarTitleAction,\n overflowBarTitleActionSections,\n resolveBarTitleActionItems,\n visibleBarTitleActions,\n} from '../BarTitle/bar-title-actions';\nimport {\n type FocusableBarTitleButton,\n barTitleActionMenuDomId,\n renderBarTitleActionMenus,\n renderBarTitleActions,\n renderBarTitleBack,\n renderBarTitleOverflowMenu,\n renderBarTitleSectionTrigger,\n restoreBarTitleActionFocus,\n} from '../BarTitle/bar-title-action-chrome';\nimport {\n barTitleSectionMenuSections,\n barTitleSectionTriggerAriaLabel,\n barTitleSectionsDigest,\n barTitleSectionsToTabs,\n effectiveBarTitleSectionValue,\n selectableBarTitleSections,\n selectedBarTitleSectionLabel,\n} from '../BarTitle/bar-title-sections';\nimport type {\n BarTitleActionConfigItem,\n BarTitleActionItem,\n BarTitlePrimaryAction,\n BarTitleSectionItem,\n} from '../BarTitle/bar-title-types';\n\nlet nextBarPageTitleId = 0;\n\n@Component({\n tag: 'ds-bar-page-title',\n styleUrl: 'BarPageTitle.css',\n scoped: true,\n})\nexport class BarPageTitle {\n private static readonly INTRINSIC_WIDTH_RETRY_MAX = 3;\n private static readonly TAB_LAYOUT_COMMIT_MAX_FRAMES = 16;\n private static readonly OVERFLOW_HYSTERESIS_PX = 8;\n\n @Element() el!: HTMLElement;\n\n /** The page's single visible h1. */\n @Prop() heading!: string;\n\n /** Show the leading page-level Back action. */\n @Prop({ attribute: 'show-back' }) showBack: boolean = false;\n\n /** Accessible name for the leading Back action. */\n @Prop() backAriaLabel: string = 'Back';\n\n /** Optional page sections shown as an all-or-nothing tab row, or the compact section button. */\n @Prop() sections: BarTitleSectionItem[] = [];\n\n /** Id of the active page section. */\n @Prop() value: string = '';\n\n /** Accessible name for the page-section tablist and menu. */\n @Prop() sectionsAriaLabel: string = 'Change page section';\n\n /** The one highest-emphasis page action. */\n @Prop() primaryAction: BarTitlePrimaryAction | null = null;\n\n /** Secondary page actions shown in the overflow menu. Dividers create groups. */\n @Prop() actions: BarTitleActionItem[] = [];\n\n /**\n * Ordered page-header actions. When supplied, this replaces the legacy\n * primaryAction/actions presentation while preserving the same dsAction event.\n */\n @Prop() actionItems?: BarTitleActionConfigItem[];\n\n /** Accessible name for the page-actions menu. */\n @Prop() actionsAriaLabel: string = 'More page actions';\n\n /** Draw the compact bottom divider beneath the header. */\n @Prop() showDivider: boolean = true;\n\n /** Override divider visibility for the compact shell-bar presentation. */\n @Prop() showCompactDivider?: boolean;\n\n /** Emitted when the leading Back action is activated. */\n @Event() dsBack!: EventEmitter<MouseEvent>;\n\n /** Emitted with the newly selected page-section id. */\n @Event() dsSectionChange!: EventEmitter<string>;\n\n /** Emitted with the activated primary or overflow action id. */\n @Event() dsAction!: EventEmitter<string>;\n\n @State() private sectionMenuOpen = false;\n @State() private openActionMenuId = '';\n @State() private surfaceActionMenuId = '';\n @State() private sectionSurfaceOpen = false;\n @State() private sectionMenuInitialFocusVisible = false;\n @State() private actionMenuInitialFocusVisible = false;\n @State() private sectionsCollapsed = false;\n @State() private layoutCommitted = false;\n @State() private focusedTabId = '';\n\n private readonly instanceId = nextBarPageTitleId++;\n private readonly sectionMenuTriggerId = `bar-page-title-section-trigger-${this.instanceId}`;\n private readonly sectionMenuId = `bar-page-title-section-menu-${this.instanceId}`;\n private readonly actionMenuTriggerId = `bar-page-title-action-trigger-${this.instanceId}`;\n private readonly actionMenuId = `bar-page-title-action-menu-${this.instanceId}`;\n private sectionTriggerEl: HTMLButtonElement | null = null;\n private actionTriggerEl: FocusableBarTitleButton | null = null;\n private actionTriggerEls = new Map<string, FocusableBarTitleButton>();\n private chromeEl: HTMLElement | null = null;\n private rowEl: HTMLElement | null = null;\n private probeRowEl: HTMLElement | null = null;\n private visibleTabListEl: HTMLElement | null = null;\n private resizeObserver: ResizeObserver | null = null;\n private intrinsicWidthRetryCount = 0;\n private tabLayoutPendingFrames = 0;\n private readonly panelNavTransition = new ChromeTransitionGate();\n private readonly panelToolsTransition = new ChromeTransitionGate();\n private readonly overflowCoalescer = createRafCoalescer(() => {\n this.updateSectionsCollapsed();\n });\n private chromeTransitionShell: HTMLElement | null = null;\n\n componentWillLoad() {\n this.reportActionIdIssues();\n this.syncFocusedTabId(this.effectiveValue, this.selectableTabs);\n }\n\n componentDidLoad() {\n this.setupOverflowObserver();\n this.bindChromeTransitionListeners();\n this.scheduleOverflowCheck();\n }\n\n componentDidRender() {\n if (this.chromeOverflowPaused()) return;\n this.scheduleOverflowCheck();\n }\n\n disconnectedCallback() {\n this.resizeObserver?.disconnect();\n this.resizeObserver = null;\n this.overflowCoalescer.cancel();\n this.unbindChromeTransitionListeners();\n }\n\n @Watch('sections')\n handleSectionsChange(next: BarTitleSectionItem[], prev: BarTitleSectionItem[]) {\n if (!this.hasSectionSelector) {\n this.closeSectionMenu();\n this.sectionSurfaceOpen = false;\n this.sectionsCollapsed = false;\n this.layoutCommitted = true;\n this.intrinsicWidthRetryCount = 0;\n this.tabLayoutPendingFrames = 0;\n return;\n }\n if (barTitleSectionsDigest(next) === barTitleSectionsDigest(prev)) {\n this.syncFocusedTabId(this.effectiveValue, this.selectableTabs);\n return;\n }\n this.resetSectionLayout();\n this.syncFocusedTabId(this.effectiveValue, this.selectableTabs);\n this.scheduleOverflowCheck();\n }\n\n @Watch('value')\n handleValueChange() {\n this.syncFocusedTabId(this.effectiveValue, this.selectableTabs);\n this.scheduleOverflowCheck();\n }\n\n @Watch('heading')\n @Watch('showBack')\n @Watch('primaryAction')\n @Watch('actions')\n @Watch('actionItems')\n handleLayoutInputsChange() {\n this.reportActionIdIssues();\n if (!this.availableActionMenuIds.has(this.openActionMenuId)) this.closeActionMenu();\n if (!this.availableActionMenuIds.has(this.surfaceActionMenuId)) this.surfaceActionMenuId = '';\n this.scheduleOverflowCheck();\n }\n\n private reportActionIdIssues() {\n for (const issue of barTitleActionIdIssues(this.resolvedActionItems)) {\n console.warn(`[ds-bar-page-title] ${issue}`);\n }\n }\n\n private get dividerVisible(): boolean {\n return this.showCompactDivider ?? this.showDivider;\n }\n\n private get usesChromeTokens(): boolean {\n return this.el.hasAttribute('data-shell-bar');\n }\n\n private get shellBarButtonBackground(): 'chrome' | undefined {\n return this.usesChromeTokens ? 'chrome' : undefined;\n }\n\n private get selectableSections() {\n return selectableBarTitleSections(this.sections);\n }\n\n private get hasSectionSelector(): boolean {\n return this.selectableSections.length > 1;\n }\n\n private get sectionTabs() {\n return barTitleSectionsToTabs(this.sections);\n }\n\n private get selectableTabs(): TabItemTab[] {\n return getSelectableTabs(this.sectionTabs);\n }\n\n private get effectiveValue(): string {\n return effectiveBarTitleSectionValue(this.sections, this.value);\n }\n\n private get selectedSectionLabel(): string {\n return selectedBarTitleSectionLabel(this.sections, this.value);\n }\n\n private get sectionTriggerAriaLabel(): string {\n return barTitleSectionTriggerAriaLabel(this.sectionsAriaLabel, this.selectedSectionLabel);\n }\n\n private get sectionMenuSections() {\n return barTitleSectionMenuSections(this.sections, this.effectiveValue);\n }\n\n private get resolvedActionItems(): BarTitleActionConfigItem[] {\n return resolveBarTitleActionItems(this.actionItems, this.primaryAction, this.actions);\n }\n\n private get visibleActions(): BarTitleActionConfigItem[] {\n return visibleBarTitleActions(this.resolvedActionItems, 'compact');\n }\n\n private get actionMenuSections() {\n return overflowBarTitleActionSections(this.resolvedActionItems, 'compact');\n }\n\n private get showActionMenuTrigger(): boolean {\n return this.actionMenuSections.length > 0;\n }\n\n private get availableActionMenuIds(): Set<string> {\n return availableBarTitleActionMenuIds(this.visibleActions, this.showActionMenuTrigger);\n }\n\n private get showSectionTabs(): boolean {\n return this.hasSectionSelector && this.layoutCommitted && !this.sectionsCollapsed;\n }\n\n private get showSectionButton(): boolean {\n return this.hasSectionSelector && this.layoutCommitted && this.sectionsCollapsed;\n }\n\n private resetSectionLayout() {\n this.layoutCommitted = false;\n this.sectionsCollapsed = false;\n this.sectionMenuOpen = false;\n this.sectionMenuInitialFocusVisible = false;\n this.intrinsicWidthRetryCount = 0;\n this.tabLayoutPendingFrames = 0;\n }\n\n private bindChromeTransitionListeners() {\n const shell = this.el.closest<HTMLElement>('ds-shell-app');\n if (!shell) return;\n this.chromeTransitionShell = shell;\n shell.addEventListener(CHROME_TRANSITION_START, this.onChromeTransitionStart);\n shell.addEventListener(CHROME_TRANSITION_END, this.onChromeTransitionEnd);\n }\n\n private unbindChromeTransitionListeners() {\n if (!this.chromeTransitionShell) return;\n this.chromeTransitionShell.removeEventListener(\n CHROME_TRANSITION_START,\n this.onChromeTransitionStart\n );\n this.chromeTransitionShell.removeEventListener(\n CHROME_TRANSITION_END,\n this.onChromeTransitionEnd\n );\n this.chromeTransitionShell = null;\n }\n\n private onChromeTransitionStart = (event: Event) => {\n const source = readChromeTransitionSource(event);\n if (source === 'panel-nav') {\n this.panelNavTransition.enter();\n return;\n }\n if (source === 'panel-tools') {\n const phase = readChromeTransitionPhase(event) ?? 'opening';\n if (phase === 'closing') {\n this.panelToolsTransition.enter();\n }\n }\n };\n\n private chromeOverflowPaused(): boolean {\n return this.panelNavTransition.isActive || this.panelToolsTransition.isActive;\n }\n\n private onChromeTransitionEnd = (event: Event) => {\n const source = readChromeTransitionSource(event);\n if (source === 'panel-nav') {\n this.panelNavTransition.exit();\n if (!this.panelNavTransition.isActive) {\n this.scheduleOverflowCheck();\n }\n return;\n }\n if (source === 'panel-tools') {\n this.panelToolsTransition.exit();\n this.scheduleOverflowCheck();\n }\n };\n\n private setupOverflowObserver() {\n if (typeof ResizeObserver === 'undefined' || !this.chromeEl) return;\n this.resizeObserver?.disconnect();\n this.resizeObserver = new ResizeObserver(() => {\n if (this.chromeOverflowPaused()) return;\n this.scheduleOverflowCheck();\n });\n this.resizeObserver.observe(this.chromeEl);\n }\n\n private scheduleOverflowCheck() {\n if (this.chromeOverflowPaused()) return;\n this.overflowCoalescer.schedule();\n }\n\n private scheduleIntrinsicWidthRetry() {\n if (this.intrinsicWidthRetryCount >= BarPageTitle.INTRINSIC_WIDTH_RETRY_MAX) return;\n this.intrinsicWidthRetryCount++;\n requestAnimationFrame(() => this.scheduleOverflowCheck());\n }\n\n private forceTabLayoutCommit(collapsed: boolean) {\n this.intrinsicWidthRetryCount = 0;\n this.tabLayoutPendingFrames = 0;\n const collapsedChanged = this.sectionsCollapsed !== collapsed;\n if (collapsedChanged) this.sectionsCollapsed = collapsed;\n if (!collapsed && collapsedChanged) {\n this.closeSectionMenu();\n this.sectionSurfaceOpen = false;\n }\n this.layoutCommitted = true;\n }\n\n private getAvailableWidth(): number {\n if (!this.rowEl) return 0;\n const rowWidth = this.rowEl.clientWidth;\n const actions = this.rowEl.querySelector<HTMLElement>('.bar-page-title__actions');\n const actionsWidth = actions?.getBoundingClientRect().width ?? 0;\n const style = getComputedStyle(this.rowEl);\n const gap = parseFloat(style.columnGap || style.gap) || 0;\n return Math.max(0, rowWidth - actionsWidth - (actionsWidth > 0 ? gap : 0));\n }\n\n private updateSectionsCollapsed() {\n if (!this.hasSectionSelector) {\n if (this.sectionsCollapsed) this.sectionsCollapsed = false;\n this.intrinsicWidthRetryCount = 0;\n this.tabLayoutPendingFrames = 0;\n this.layoutCommitted = true;\n return;\n }\n\n const probeWidth = this.probeRowEl?.scrollWidth ?? 0;\n const available = this.getAvailableWidth();\n if (!this.probeRowEl || !this.rowEl || probeWidth === 0) {\n if (this.layoutCommitted) {\n this.scheduleIntrinsicWidthRetry();\n return;\n }\n this.tabLayoutPendingFrames += 1;\n if (\n this.intrinsicWidthRetryCount >= BarPageTitle.INTRINSIC_WIDTH_RETRY_MAX ||\n this.tabLayoutPendingFrames >= BarPageTitle.TAB_LAYOUT_COMMIT_MAX_FRAMES\n ) {\n this.forceTabLayoutCommit(false);\n } else {\n this.scheduleIntrinsicWidthRetry();\n }\n return;\n }\n\n this.intrinsicWidthRetryCount = 0;\n this.tabLayoutPendingFrames = 0;\n const shouldCollapse = tabsOverflowContainer(\n probeWidth,\n available,\n this.sectionsCollapsed,\n BarPageTitle.OVERFLOW_HYSTERESIS_PX\n );\n this.forceTabLayoutCommit(shouldCollapse);\n }\n\n private syncFocusedTabId(preferred: string, tabs: TabItemTab[]) {\n if (tabs.some(tab => tab.id === preferred && !tab.isInactive)) {\n this.focusedTabId = preferred;\n return;\n }\n const first = tabs.find(tab => !tab.isInactive);\n this.focusedTabId = first?.id ?? '';\n }\n\n private selectSection(id: string) {\n const selected = this.selectableSections.find(section => section.id === id);\n if (!selected || selected.isInactive) return;\n this.dsSectionChange.emit(id);\n }\n\n private toggleSectionMenu = (event: MouseEvent) => {\n this.sectionMenuInitialFocusVisible = event.detail === 0;\n this.openActionMenuId = '';\n this.sectionMenuOpen = !this.sectionMenuOpen;\n if (this.sectionMenuOpen) this.sectionSurfaceOpen = true;\n };\n\n private closeSectionMenu = () => {\n this.sectionMenuOpen = false;\n };\n\n private handleSectionSelect = (event: CustomEvent<MenuItemData>) => {\n const id = String(event.detail?.value ?? '');\n this.closeSectionMenu();\n this.selectSection(id);\n requestAnimationFrame(() => this.sectionTriggerEl?.focus());\n };\n\n private toggleActionMenu = (id: string, event: MouseEvent) => {\n this.actionMenuInitialFocusVisible = event.detail === 0;\n this.sectionMenuOpen = false;\n this.openActionMenuId = this.openActionMenuId === id ? '' : id;\n if (this.openActionMenuId) this.surfaceActionMenuId = this.openActionMenuId;\n };\n\n private finishActionMenuClose = (event: CustomEvent<void>) => {\n const id = this.surfaceActionMenuId;\n const domId =\n id === '__overflow'\n ? this.actionMenuId\n : barTitleActionMenuDomId('bar-page-title', this.instanceId, this.resolvedActionItems, id);\n if (this.openActionMenuId !== id && (event.target as HTMLElement).id === domId) {\n this.surfaceActionMenuId = '';\n }\n };\n\n private closeActionMenu = () => {\n this.openActionMenuId = '';\n };\n\n private handleActionSelect = (event: CustomEvent<MenuItemData>) => {\n const id = String(event.detail?.value ?? '');\n const action = findBarTitleAction(this.resolvedActionItems, id);\n if (!action || action.isInactive || ('isLoading' in action && action.isLoading)) return;\n const menuId = this.openActionMenuId;\n this.closeActionMenu();\n this.dsAction.emit(id);\n requestAnimationFrame(() => {\n void restoreBarTitleActionFocus({\n menuId,\n overflowTrigger: this.actionTriggerEl,\n actionTriggers: this.actionTriggerEls,\n resolvedActionItems: this.resolvedActionItems,\n });\n });\n };\n\n private focusVisibleTab(id: string) {\n this.focusedTabId = id;\n const tab = this.visibleTabListEl?.querySelector(`[data-tab-id=\"${id}\"]`) as HTMLElement | null;\n tab?.focus({ preventScroll: true });\n }\n\n private findEnabledTab(from: number, step: 1 | -1): number | null {\n const tabs = this.selectableTabs;\n for (let index = from + step; index >= 0 && index < tabs.length; index += step) {\n if (!tabs[index]?.isInactive) return index;\n }\n return null;\n }\n\n private handleTabKeyDown(event: KeyboardEvent) {\n const tabs = this.selectableTabs;\n if (!tabs.length) return;\n const targetId = (event.target as HTMLElement | null)?.getAttribute('data-tab-id');\n const focusedId = targetId ?? this.focusedTabId;\n\n if (event.key === 'Enter' || event.key === ' ') {\n const focused = tabs.find(tab => tab.id === focusedId);\n if (!focused || focused.isInactive) return;\n event.preventDefault();\n this.selectSection(focused.id);\n return;\n }\n\n const currentIndex = tabs.findIndex(tab => tab.id === focusedId);\n if (currentIndex < 0) return;\n\n let nextIndex: number | null;\n if (event.key === 'ArrowRight') {\n nextIndex = this.findEnabledTab(currentIndex, 1);\n } else if (event.key === 'ArrowLeft') {\n nextIndex = this.findEnabledTab(currentIndex, -1);\n } else if (event.key === 'Home') {\n nextIndex = tabs.findIndex(tab => !tab.isInactive);\n } else if (event.key === 'End') {\n const reversedIndex = [...tabs].reverse().findIndex(tab => !tab.isInactive);\n nextIndex = reversedIndex < 0 ? null : tabs.length - 1 - reversedIndex;\n } else {\n return;\n }\n\n if (nextIndex === null || nextIndex < 0 || nextIndex === currentIndex) return;\n event.preventDefault();\n this.focusVisibleTab(tabs[nextIndex].id);\n }\n\n private chromeActionOptions() {\n return {\n classPrefix: 'bar-page-title',\n compact: true,\n visibleActions: this.visibleActions,\n showOverflowTrigger: this.showActionMenuTrigger,\n actionItems: this.actionItems,\n primaryAction: this.primaryAction,\n resolvedActionItems: this.resolvedActionItems,\n instanceId: this.instanceId,\n openActionMenuId: this.openActionMenuId,\n surfaceActionMenuId: this.surfaceActionMenuId,\n actionsAriaLabel: this.actionsAriaLabel,\n actionMenuTriggerId: this.actionMenuTriggerId,\n actionMenuId: this.actionMenuId,\n actionTriggers: this.actionTriggerEls,\n buttonBackground: this.shellBarButtonBackground,\n setOverflowTriggerEl: (el: FocusableBarTitleButton | null) => {\n this.actionTriggerEl = el;\n },\n toggleActionMenu: this.toggleActionMenu,\n emitAction: (id: string) => this.dsAction.emit(id),\n };\n }\n\n private renderHeading(probe: boolean) {\n return (\n <ds-text\n class=\"bar-page-title__heading ds-control--md\"\n variant=\"text-title-small\"\n emphasis\n color=\"inherit\"\n as={probe ? 'span' : 'h1'}\n wrap={probe ? 'nowrap' : undefined}\n lineTruncation={probe ? 'none' : 1}\n >\n {this.heading}\n </ds-text>\n );\n }\n\n private renderTabList(probe: boolean) {\n return (\n <div\n role={probe ? undefined : 'tablist'}\n class=\"bar-page-title__tab-list\"\n aria-label={probe ? undefined : this.sectionsAriaLabel}\n ref={el => {\n if (!probe) this.visibleTabListEl = (el as HTMLElement) ?? null;\n }}\n onKeyDown={probe ? undefined : (event: KeyboardEvent) => this.handleTabKeyDown(event)}\n >\n {this.sectionTabs.map((tab, index) => {\n if (isTabDivider(tab)) {\n return (\n <div class=\"bar-page-title__tab-divider\" key={`divider-${index}`} aria-hidden=\"true\">\n <div class=\"bar-page-title__tab-divider-line\" />\n </div>\n );\n }\n\n const isSelected = tab.id === this.effectiveValue;\n return (\n <button\n key={tab.id}\n type=\"button\"\n role={probe ? undefined : 'tab'}\n data-tab-id={tab.id}\n class={{\n 'bar-page-title__tab': true,\n 'bar-page-title__tab--selected': isSelected,\n 'ds-control--md': true,\n 'ds-focus-ring-inset': true,\n 'ds-control-inactive': !!tab.isInactive,\n 'ds-interaction-fill--on-chrome': this.usesChromeTokens,\n }}\n aria-selected={isSelected ? 'true' : 'false'}\n aria-disabled={tab.isInactive ? 'true' : undefined}\n disabled={tab.isInactive}\n tabIndex={!probe && tab.id === this.focusedTabId ? 0 : -1}\n onClick={() => !probe && this.selectSection(tab.id)}\n onFocus={() => {\n if (!probe) this.focusedTabId = tab.id;\n }}\n >\n <ds-text\n class=\"bar-page-title__tab-label ds-control-label-box\"\n as=\"span\"\n variant=\"text-body-medium\"\n emphasis={isSelected}\n color=\"inherit\"\n >\n {tab.label}\n </ds-text>\n </button>\n );\n })}\n </div>\n );\n }\n\n private renderIdentity(probe: boolean) {\n return (\n <div class=\"bar-page-title__identity\">\n {renderBarTitleBack({\n classPrefix: 'bar-page-title',\n showBack: this.showBack,\n backAriaLabel: this.backAriaLabel,\n background: this.shellBarButtonBackground,\n onBack: event => this.dsBack.emit(event),\n })}\n {this.renderHeading(probe)}\n </div>\n );\n }\n\n private renderSectionRegion() {\n if (!this.hasSectionSelector) return null;\n if (!this.layoutCommitted) {\n return [\n <div class=\"bar-page-title__divider\" aria-hidden=\"true\" />,\n <div class=\"bar-page-title__tabs-pending\" aria-hidden=\"true\" />,\n ];\n }\n if (this.showSectionTabs) {\n return [\n <div class=\"bar-page-title__divider\" aria-hidden=\"true\" />,\n this.renderTabList(false),\n ];\n }\n return [\n <div class=\"bar-page-title__divider\" aria-hidden=\"true\" />,\n renderBarTitleSectionTrigger({\n classPrefix: 'bar-page-title',\n triggerId: this.sectionMenuTriggerId,\n menuId: this.sectionMenuId,\n open: this.sectionMenuOpen,\n surfaceOpen: this.sectionSurfaceOpen,\n ariaLabel: this.sectionTriggerAriaLabel,\n selectedLabel: this.selectedSectionLabel,\n background: this.shellBarButtonBackground,\n labelColor: this.usesChromeTokens ? 'inherit' : undefined,\n setTriggerEl: el => {\n this.sectionTriggerEl = el;\n },\n onToggle: this.toggleSectionMenu,\n }),\n ];\n }\n\n render() {\n return (\n <Host>\n <div\n class={{\n 'bar-page-title': true,\n 'bar-page-title--divider-hidden': !this.dividerVisible,\n 'ds-chrome-header': true,\n }}\n ref={el => {\n this.chromeEl = (el as HTMLElement) ?? null;\n if (el && !this.resizeObserver) this.setupOverflowObserver();\n }}\n >\n {this.hasSectionSelector ? (\n <div class=\"bar-page-title__probe\" aria-hidden=\"true\" inert>\n <div\n class=\"bar-page-title__probe-row\"\n ref={el => {\n const next = (el as HTMLElement) ?? null;\n if (next === this.probeRowEl) return;\n this.probeRowEl = next;\n if (next) {\n this.intrinsicWidthRetryCount = 0;\n this.tabLayoutPendingFrames = 0;\n this.scheduleOverflowCheck();\n }\n }}\n >\n {this.renderIdentity(true)}\n <div class=\"bar-page-title__divider\" />\n {this.renderTabList(true)}\n </div>\n </div>\n ) : null}\n\n <div class=\"bar-page-title__inner\">\n <div\n class=\"bar-page-title__row\"\n ref={el => {\n this.rowEl = (el as HTMLElement) ?? null;\n }}\n >\n <div class=\"bar-page-title__title-row\">\n {this.renderIdentity(false)}\n {this.renderSectionRegion()}\n </div>\n {renderBarTitleActions(this.chromeActionOptions())}\n </div>\n </div>\n </div>\n\n {this.showSectionButton ? (\n <ds-menu\n id={this.sectionMenuId}\n class=\"bar-page-title__section-menu\"\n anchorId={this.sectionMenuTriggerId}\n menuLabel={this.sectionsAriaLabel}\n open={this.sectionMenuOpen}\n initialFocusVisible={this.sectionMenuInitialFocusVisible}\n sections={this.sectionMenuSections}\n onDsClose={this.closeSectionMenu}\n onDsAfterClose={() => {\n if (!this.sectionMenuOpen) this.sectionSurfaceOpen = false;\n }}\n onDsSelect={this.handleSectionSelect}\n />\n ) : null}\n\n {renderBarTitleActionMenus({\n classPrefix: 'bar-page-title',\n visibleActions: this.visibleActions,\n instanceId: this.instanceId,\n resolvedActionItems: this.resolvedActionItems,\n openActionMenuId: this.openActionMenuId,\n actionMenuInitialFocusVisible: this.actionMenuInitialFocusVisible,\n overflowTrigger: this.actionTriggerEl,\n actionTriggers: this.actionTriggerEls,\n closeActionMenu: this.closeActionMenu,\n finishActionMenuClose: this.finishActionMenuClose,\n handleActionSelect: this.handleActionSelect,\n })}\n\n {renderBarTitleOverflowMenu({\n classPrefix: 'bar-page-title',\n showOverflowTrigger: this.showActionMenuTrigger,\n actionMenuId: this.actionMenuId,\n actionMenuTriggerId: this.actionMenuTriggerId,\n actionsAriaLabel: this.actionsAriaLabel,\n open: this.openActionMenuId === '__overflow',\n actionMenuInitialFocusVisible: this.actionMenuInitialFocusVisible,\n actionMenuSections: this.actionMenuSections,\n closeActionMenu: this.closeActionMenu,\n finishActionMenuClose: this.finishActionMenuClose,\n handleActionSelect: this.handleActionSelect,\n })}\n </Host>\n );\n }\n}\n",
|
|
453
453
|
"type": "registry:ui"
|
|
454
454
|
}
|
|
455
455
|
]
|