@ds-mo/ui 12.2.0 → 12.3.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/README.md +8 -2
- package/dist/.build-stamp +1 -1
- package/dist/agent-patterns.json +6 -6
- package/dist/agent.json +530 -25
- package/dist/angular/ds-bar-title.d.ts +7 -1
- package/dist/angular/ds-bar-title.js +7 -4
- package/dist/angular/ds-breadcrumb.d.ts +19 -0
- package/dist/angular/ds-breadcrumb.js +42 -0
- package/dist/angular/ds-card-data-viz-bar.d.ts +18 -0
- package/dist/angular/ds-card-data-viz-bar.js +42 -0
- package/dist/angular/ds-card-data-viz-line.d.ts +18 -0
- package/dist/angular/ds-card-data-viz-line.js +42 -0
- package/dist/angular/ds-chart-bar-stacked.d.ts +12 -0
- package/dist/angular/ds-chart-bar-stacked.js +38 -0
- package/dist/angular/ds-chart-legend.d.ts +1 -1
- package/dist/angular/ds-chart-legend.js +3 -3
- package/dist/angular/ds-shell-page.d.ts +1 -1
- package/dist/angular/ds-shell-page.js +3 -3
- package/dist/angular/index.d.ts +1 -1
- package/dist/angular/index.js +4 -0
- package/dist/angular/proxies.d.ts +4 -0
- package/dist/angular/proxies.js +4 -0
- package/dist/components/ds-agent-activity.js +1 -1
- package/dist/components/ds-agent-response.js +1 -1
- package/dist/components/ds-agent-source-list.js +1 -1
- package/dist/components/ds-agent-tool-call.js +1 -1
- package/dist/components/ds-attachment-list.js +1 -1
- package/dist/components/ds-badge.js +1 -1
- package/dist/components/ds-bar-nav.js +1 -1
- package/dist/components/ds-bar-title.js +1 -1
- package/dist/components/ds-bar-title.js.map +1 -1
- package/dist/components/ds-bar-workflow.js +1 -1
- package/dist/components/ds-breadcrumb.d.ts +11 -0
- package/dist/components/ds-breadcrumb.js +2 -0
- package/dist/components/ds-breadcrumb.js.map +1 -0
- package/dist/components/ds-button-filled.js +1 -1
- package/dist/components/ds-button-unfilled.js +1 -1
- package/dist/components/ds-card-data-viz-bar.d.ts +11 -0
- package/dist/components/ds-card-data-viz-bar.js +2 -0
- package/dist/components/ds-card-data-viz-bar.js.map +1 -0
- package/dist/components/ds-card-data-viz-donut.js +1 -1
- package/dist/components/ds-card-data-viz-donut.js.map +1 -1
- package/dist/components/ds-card-data-viz-line.d.ts +11 -0
- package/dist/components/ds-card-data-viz-line.js +2 -0
- package/dist/components/ds-card-data-viz-line.js.map +1 -0
- package/dist/components/ds-card-setting.js +1 -1
- package/dist/components/ds-card-setting.js.map +1 -1
- package/dist/components/ds-card-shell-data-viz.js +1 -1
- package/dist/components/ds-chart-bar-stacked.d.ts +11 -0
- package/dist/components/ds-chart-bar-stacked.js +2 -0
- package/dist/components/ds-chart-bar-stacked.js.map +1 -0
- package/dist/components/ds-chart-bar.js +1 -1
- package/dist/components/ds-chart-bar.js.map +1 -1
- package/dist/components/ds-chart-donut.js +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-line.js +1 -1
- package/dist/components/ds-chart-line.js.map +1 -1
- package/dist/components/ds-checkbox.js +1 -1
- package/dist/components/ds-chip.js +1 -1
- package/dist/components/ds-code-block.js +1 -1
- package/dist/components/ds-conversation-list-item.js +1 -1
- package/dist/components/ds-conversation-list-item.js.map +1 -1
- package/dist/components/ds-conversation-list-section.js +1 -1
- package/dist/components/ds-conversation-list.js +1 -1
- package/dist/components/ds-divider.js +1 -1
- package/dist/components/ds-empty-state.js +1 -1
- package/dist/components/ds-field.js +1 -1
- package/dist/components/ds-input.js +1 -1
- package/dist/components/ds-markdown.js +1 -1
- package/dist/components/ds-menu.js +1 -1
- package/dist/components/ds-message-bubble.js +1 -1
- package/dist/components/ds-message-bubble.js.map +1 -1
- package/dist/components/ds-message-composer.js +1 -1
- package/dist/components/ds-message-scroller.js +1 -1
- package/dist/components/ds-message-scroller.js.map +1 -1
- package/dist/components/ds-message.js +1 -1
- package/dist/components/ds-modal.js +1 -1
- package/dist/components/ds-panel-nav.js +1 -1
- package/dist/components/ds-panel-sub-nav.js +1 -1
- package/dist/components/ds-panel-tool-header.js +1 -1
- package/dist/components/ds-panel-tool-search.js +1 -1
- package/dist/components/ds-panel-tools.js +1 -1
- package/dist/components/ds-radio.js +1 -1
- package/dist/components/ds-scroll-overlay.js +1 -1
- package/dist/components/ds-scroll-overlay.js.map +1 -1
- package/dist/components/ds-select-multi.js +1 -1
- package/dist/components/ds-select-multi.js.map +1 -1
- package/dist/components/ds-select.js +1 -1
- package/dist/components/ds-select.js.map +1 -1
- package/dist/components/ds-shell-app.js +1 -1
- package/dist/components/ds-shell-app.js.map +1 -1
- package/dist/components/ds-shell-gradient-picker.js +1 -1
- package/dist/components/ds-shell-gradient-swatch.js +1 -1
- package/dist/components/ds-shell-page.js +1 -1
- package/dist/components/ds-shell-page.js.map +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-tag.js +1 -1
- package/dist/components/ds-text.js +1 -1
- package/dist/components/ds-toast.js +1 -1
- package/dist/components/ds-tooltip-data-viz.js +1 -1
- package/dist/components/ds-tooltip.js +1 -1
- package/dist/components/ds-typing-indicator.js +1 -1
- package/dist/components/ds-typing-indicator.js.map +1 -1
- package/dist/components/{p-DcGpdIlT.js → p-9dQQSgwT.js} +2 -2
- package/dist/components/p-B3rbhRAk.js +2 -0
- package/dist/components/p-B3rbhRAk.js.map +1 -0
- package/dist/components/{p-BWUTr_XN.js → p-BJMRBHKW.js} +2 -2
- package/dist/components/p-BJMRBHKW.js.map +1 -0
- package/dist/components/p-BVV_rlIP.js +2 -0
- package/dist/components/p-BVV_rlIP.js.map +1 -0
- package/dist/components/{p-GMDGgtY8.js → p-BhxwpOH8.js} +2 -2
- package/dist/components/{p-2W-ZjZCR.js → p-Bi_bxbih.js} +2 -2
- package/dist/components/{p-CG5EX4NW.js → p-BtEjlcB9.js} +2 -2
- package/dist/components/{p-C0_8K4y7.js → p-BwGnhInj.js} +2 -2
- package/dist/components/p-BwGnhInj.js.map +1 -0
- package/dist/components/p-C0NPJ0h2.js +2 -0
- package/dist/components/{p-BpA9uYKX.js.map → p-C0NPJ0h2.js.map} +1 -1
- package/dist/components/{p-D6jK2Hyi.js → p-C7bZ-jiU.js} +2 -2
- package/dist/components/p-CH3w-P2H.js +2 -0
- package/dist/components/p-CH3w-P2H.js.map +1 -0
- package/dist/components/{p-DOCKtrS4.js → p-CH6cNXXF.js} +2 -2
- package/dist/components/p-CWlh7HAg.js +2 -0
- package/dist/components/{p-8OOCLGph.js.map → p-CWlh7HAg.js.map} +1 -1
- package/dist/components/{p-BE_CDJeL.js → p-CY19gMiz.js} +2 -2
- package/dist/components/p-C_ewSXTT.js +2 -0
- package/dist/components/p-C_ewSXTT.js.map +1 -0
- package/dist/components/{p-CHkI3oIS.js → p-Ce52yVXF.js} +2 -2
- package/dist/components/{p-xY3TjBF5.js → p-CoYFJD-w.js} +2 -2
- package/dist/components/{p-DBi1bmOL.js → p-Cuw2Lo2g.js} +2 -2
- package/dist/components/{p-BRLDJmkh.js → p-D-xttdpn.js} +2 -2
- package/dist/components/{p-CCHqsF_H.js → p-D3DYxbC5.js} +2 -2
- package/dist/components/{p-Cxpl-rzP.js → p-DC7yOUQx.js} +2 -2
- package/dist/components/{p-CNffejay.js → p-DSa0Hnd3.js} +2 -2
- package/dist/components/p-DXewjzkM.js +2 -0
- package/dist/components/p-DXewjzkM.js.map +1 -0
- package/dist/components/{p-DyGB97Oy.js → p-DYqReipj.js} +2 -2
- package/dist/components/{p-ky1msbJ8.js → p-DjPZxzIG.js} +2 -2
- package/dist/components/{p-ky1msbJ8.js.map → p-DjPZxzIG.js.map} +1 -1
- package/dist/components/p-J6xK6Ihq.js +2 -0
- package/dist/components/p-jCWtxthA.js +2 -0
- package/dist/components/{p-XgIQ3oI_.js.map → p-jCWtxthA.js.map} +1 -1
- package/dist/docs/components.json +956 -145
- package/dist/lib/utils/index.js +3 -1
- package/dist/lib/utils/index.js.map +2 -2
- package/dist/mcp/cli.js +142 -18
- package/dist/mcp-data/registry/agent-source-list.json +1 -1
- package/dist/mcp-data/registry/bar-title.json +68 -14
- package/dist/mcp-data/registry/breadcrumb.json +205 -0
- package/dist/mcp-data/registry/card-data-viz-bar.json +212 -0
- package/dist/mcp-data/registry/card-data-viz-line.json +206 -0
- package/dist/mcp-data/registry/card-shell-data-viz.json +7 -0
- package/dist/mcp-data/registry/chart-bar-stacked.json +225 -0
- package/dist/mcp-data/registry/chart-bar.json +9 -2
- package/dist/mcp-data/registry/chart-legend.json +29 -3
- package/dist/mcp-data/registry/chart-line.json +4 -2
- package/dist/mcp-data/registry/conversation-list-item.json +2 -2
- package/dist/mcp-data/registry/message-scroller.json +4 -2
- package/dist/mcp-data/registry/message.json +3 -2
- package/dist/mcp-data/registry/registry.json +541 -24
- package/dist/mcp-data/registry/shell-page.json +31 -13
- package/dist/mcp-data/registry/text.json +1 -1
- package/dist/mcp-data/registry/typing-indicator.json +7 -7
- package/dist/react/components.d.ts +4 -0
- package/dist/react/components.js +4 -0
- package/dist/react/ds-bar-title.d.ts +2 -1
- package/dist/react/ds-bar-title.js +1 -0
- package/dist/react/ds-breadcrumb.d.ts +12 -0
- package/dist/react/ds-breadcrumb.js +12 -0
- package/dist/react/ds-card-data-viz-bar.d.ts +12 -0
- package/dist/react/ds-card-data-viz-bar.js +12 -0
- package/dist/react/ds-card-data-viz-line.d.ts +12 -0
- package/dist/react/ds-card-data-viz-line.js +12 -0
- package/dist/react/ds-chart-bar-stacked.d.ts +9 -0
- package/dist/react/ds-chart-bar-stacked.js +12 -0
- package/dist/styles/prose.css +1 -0
- package/dist/types/components/BarTitle/BarTitle.d.ts +13 -1
- package/dist/types/components/Breadcrumb/Breadcrumb.d.ts +31 -0
- package/dist/types/components/Breadcrumb/breadcrumb-types.d.ts +17 -0
- package/dist/types/components/CardDataVizBar/CardDataVizBar.d.ts +24 -0
- package/dist/types/components/CardDataVizBar/index.d.ts +2 -0
- package/dist/types/components/CardDataVizLine/CardDataVizLine.d.ts +24 -0
- package/dist/types/components/CardDataVizLine/index.d.ts +2 -0
- package/dist/types/components/ChartBarStacked/ChartBarStacked.d.ts +15 -0
- package/dist/types/components/ChartBarStacked/index.d.ts +3 -0
- package/dist/types/components/ChartLegend/ChartLegend.d.ts +3 -0
- package/dist/types/components/ShellPage/ShellPage.d.ts +19 -7
- package/dist/types/components/ShellPage/shell-page-responsive.d.ts +0 -8
- package/dist/types/components/TypingIndicator/TypingIndicator.d.ts +1 -1
- package/dist/types/components.d.ts +339 -10
- package/package.json +1 -1
- package/dist/components/p-8OOCLGph.js +0 -2
- package/dist/components/p-B8CubPgQ.js +0 -2
- package/dist/components/p-BWUTr_XN.js.map +0 -1
- package/dist/components/p-BpA9uYKX.js +0 -2
- package/dist/components/p-C0_8K4y7.js.map +0 -1
- package/dist/components/p-CA3kLO7K.js +0 -2
- package/dist/components/p-CA3kLO7K.js.map +0 -1
- package/dist/components/p-CzBnvtcz.js +0 -2
- package/dist/components/p-CzBnvtcz.js.map +0 -1
- package/dist/components/p-XgIQ3oI_.js +0 -2
- /package/dist/components/{p-DcGpdIlT.js.map → p-9dQQSgwT.js.map} +0 -0
- /package/dist/components/{p-GMDGgtY8.js.map → p-BhxwpOH8.js.map} +0 -0
- /package/dist/components/{p-2W-ZjZCR.js.map → p-Bi_bxbih.js.map} +0 -0
- /package/dist/components/{p-CG5EX4NW.js.map → p-BtEjlcB9.js.map} +0 -0
- /package/dist/components/{p-D6jK2Hyi.js.map → p-C7bZ-jiU.js.map} +0 -0
- /package/dist/components/{p-DOCKtrS4.js.map → p-CH6cNXXF.js.map} +0 -0
- /package/dist/components/{p-BE_CDJeL.js.map → p-CY19gMiz.js.map} +0 -0
- /package/dist/components/{p-CHkI3oIS.js.map → p-Ce52yVXF.js.map} +0 -0
- /package/dist/components/{p-xY3TjBF5.js.map → p-CoYFJD-w.js.map} +0 -0
- /package/dist/components/{p-DBi1bmOL.js.map → p-Cuw2Lo2g.js.map} +0 -0
- /package/dist/components/{p-BRLDJmkh.js.map → p-D-xttdpn.js.map} +0 -0
- /package/dist/components/{p-CCHqsF_H.js.map → p-D3DYxbC5.js.map} +0 -0
- /package/dist/components/{p-Cxpl-rzP.js.map → p-DC7yOUQx.js.map} +0 -0
- /package/dist/components/{p-CNffejay.js.map → p-DSa0Hnd3.js.map} +0 -0
- /package/dist/components/{p-DyGB97Oy.js.map → p-DYqReipj.js.map} +0 -0
- /package/dist/components/{p-B8CubPgQ.js.map → p-J6xK6Ihq.js.map} +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "bar-title",
|
|
4
4
|
"title": "BarTitle",
|
|
5
|
-
"description": "Page-level title chrome with optional route
|
|
5
|
+
"description": "Page-level title chrome with an optional expanded route breadcrumb, compact Back action, supporting description, inline active-section menu, one primary action, grouped overflow actions, and explicit expanded, compact, or constrained variants.",
|
|
6
6
|
"type": "registry:ui",
|
|
7
7
|
"meta": {
|
|
8
8
|
"library": "@ds-mo/ui",
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
"intent": {
|
|
14
14
|
"audience": "general",
|
|
15
15
|
"status": "stable",
|
|
16
|
-
"summary": "Page-level title chrome with optional route
|
|
16
|
+
"summary": "Page-level title chrome with an optional expanded route breadcrumb, compact Back action, supporting description, inline active-section menu, one primary action, grouped overflow actions, and explicit expanded, compact, or constrained variants.",
|
|
17
17
|
"useWhen": [
|
|
18
18
|
"A top-level page needs one h1 above its content.",
|
|
19
19
|
"A list or detail page has multiple route-level sections that belong in the inline active-section menu.",
|
|
20
|
-
"A detail page needs a page-level Back action.",
|
|
20
|
+
"A detail page needs route ancestors in expanded presentation and a page-level Back action in compact chrome.",
|
|
21
21
|
"A page needs one primary action plus optional secondary or destructive overflow commands."
|
|
22
22
|
],
|
|
23
23
|
"avoidWhen": [
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"component:ds-shell-page",
|
|
49
49
|
"component:ds-button-filled",
|
|
50
50
|
"component:ds-button-unfilled",
|
|
51
|
+
"component:ds-breadcrumb",
|
|
51
52
|
"component:ds-menu",
|
|
52
53
|
"component:ds-text"
|
|
53
54
|
],
|
|
@@ -56,7 +57,8 @@
|
|
|
56
57
|
],
|
|
57
58
|
"accessibility": [
|
|
58
59
|
"Provide one concise heading; BarTitle renders exactly one h1 and changes only its visual recipe between variants.",
|
|
59
|
-
"Give Back a destination-specific accessible name such as Back to Drivers
|
|
60
|
+
"Give compact Back a destination-specific accessible name such as Back to Drivers and handle dsBack in the route owner.",
|
|
61
|
+
"Provide ordered breadcrumb items for deeper expanded paths and handle dsBreadcrumbSelect when native href navigation is not used; backLabel remains the single-parent expanded fallback.",
|
|
60
62
|
"Keep value synchronized with the current child route; dsSectionChange returns the selected section id.",
|
|
61
63
|
"Section and overflow triggers expose menu relationships and restore focus after selection or dismissal.",
|
|
62
64
|
"Use one filled primary action in the page decision area and mark destructive overflow actions explicitly."
|
|
@@ -65,7 +67,8 @@
|
|
|
65
67
|
"Omitting Back, sections, primaryAction, and actions produces the top-level title-only header.",
|
|
66
68
|
"Two or more selectable sections add the inline section trigger; one section does not render a redundant menu.",
|
|
67
69
|
"Dividers in sections or actions create separate Menu groups without becoming selectable rows.",
|
|
68
|
-
"
|
|
70
|
+
"The overflow trigger uses its bordered treatment whenever the primary action is visible beside it; overflow-only and auto-collapsed-primary presentations keep the trigger borderless.",
|
|
71
|
+
"expanded renders the larger heading, optional description, inset divider, and a full-width caption breadcrumb row above the title. The breadcrumb begins after 32px top padding; the following title and right-side actions share one top alignment. Compact renders 48px chrome with the existing icon Back action; constrained uses compact chrome and moves an auto-collapse primary action into overflow.",
|
|
69
72
|
"primaryAction collapse defaults to auto. Use never for exceptional actions whose hierarchy must remain visible in constrained layouts."
|
|
70
73
|
],
|
|
71
74
|
"responsiveBehavior": [
|
|
@@ -76,15 +79,15 @@
|
|
|
76
79
|
],
|
|
77
80
|
"frameworkCaveats": {
|
|
78
81
|
"customElements": [
|
|
79
|
-
"Assign sections, primaryAction, and actions as JavaScript properties and replace array or object identities when controlled state changes.",
|
|
80
|
-
"Handle dsBack
|
|
82
|
+
"Assign breadcrumbs, sections, primaryAction, and actions as JavaScript properties and replace array or object identities when controlled state changes.",
|
|
83
|
+
"Handle dsBack for compact navigation and dsBreadcrumbSelect for application-owned expanded breadcrumb navigation, update value after dsSectionChange, and execute product commands from dsAction."
|
|
81
84
|
],
|
|
82
85
|
"react": [
|
|
83
|
-
"Pass
|
|
86
|
+
"Pass breadcrumb, section, and action arrays directly to DsBarTitle and keep value controlled from route state.",
|
|
84
87
|
"Place DsBarTitle in DsShellPage with slot=header when automatic page behavior is required."
|
|
85
88
|
],
|
|
86
89
|
"angular": [
|
|
87
|
-
"Bind complex values on the standalone DsBarTitle adapter and handle
|
|
90
|
+
"Bind complex values on the standalone DsBarTitle adapter and handle Back, breadcrumb, section, and action intent events in the route shell.",
|
|
88
91
|
"Place ds-bar-title in ds-shell-page with slot=header; do not render router-outlet inside BarTitle."
|
|
89
92
|
]
|
|
90
93
|
},
|
|
@@ -138,7 +141,24 @@
|
|
|
138
141
|
"default": "'Back'",
|
|
139
142
|
"required": false,
|
|
140
143
|
"mutable": false,
|
|
141
|
-
"description": "Visible parent-page label used by the expanded
|
|
144
|
+
"description": "Visible parent-page label used by the expanded breadcrumb when breadcrumbs is empty."
|
|
145
|
+
},
|
|
146
|
+
"breadcrumbAriaLabel": {
|
|
147
|
+
"type": "string",
|
|
148
|
+
"resolvedType": "string",
|
|
149
|
+
"attribute": "breadcrumb-aria-label",
|
|
150
|
+
"default": "'Breadcrumb'",
|
|
151
|
+
"required": false,
|
|
152
|
+
"mutable": false,
|
|
153
|
+
"description": "Accessible name for the expanded breadcrumb navigation landmark."
|
|
154
|
+
},
|
|
155
|
+
"breadcrumbs": {
|
|
156
|
+
"type": "BreadcrumbItem[]",
|
|
157
|
+
"resolvedType": "BreadcrumbItem[]",
|
|
158
|
+
"default": "[]",
|
|
159
|
+
"required": false,
|
|
160
|
+
"mutable": false,
|
|
161
|
+
"description": "Optional expanded ancestor path. Compact variants continue to use the Back action."
|
|
142
162
|
},
|
|
143
163
|
"description": {
|
|
144
164
|
"type": "string",
|
|
@@ -227,6 +247,14 @@
|
|
|
227
247
|
"composed": true,
|
|
228
248
|
"description": "Emitted when the leading Back action is activated."
|
|
229
249
|
},
|
|
250
|
+
{
|
|
251
|
+
"name": "dsBreadcrumbSelect",
|
|
252
|
+
"detail": "BreadcrumbSelectDetail",
|
|
253
|
+
"bubbles": true,
|
|
254
|
+
"cancelable": true,
|
|
255
|
+
"composed": true,
|
|
256
|
+
"description": "Emitted when an authored expanded breadcrumb item is activated."
|
|
257
|
+
},
|
|
230
258
|
{
|
|
231
259
|
"name": "dsSectionChange",
|
|
232
260
|
"detail": "string",
|
|
@@ -273,7 +301,24 @@
|
|
|
273
301
|
"default": "'Back'",
|
|
274
302
|
"required": false,
|
|
275
303
|
"mutable": false,
|
|
276
|
-
"description": "Visible parent-page label used by the expanded
|
|
304
|
+
"description": "Visible parent-page label used by the expanded breadcrumb when breadcrumbs is empty."
|
|
305
|
+
},
|
|
306
|
+
"breadcrumbAriaLabel": {
|
|
307
|
+
"type": "string",
|
|
308
|
+
"resolvedType": "string",
|
|
309
|
+
"attribute": "breadcrumb-aria-label",
|
|
310
|
+
"default": "'Breadcrumb'",
|
|
311
|
+
"required": false,
|
|
312
|
+
"mutable": false,
|
|
313
|
+
"description": "Accessible name for the expanded breadcrumb navigation landmark."
|
|
314
|
+
},
|
|
315
|
+
"breadcrumbs": {
|
|
316
|
+
"type": "BreadcrumbItem[]",
|
|
317
|
+
"resolvedType": "BreadcrumbItem[]",
|
|
318
|
+
"default": "[]",
|
|
319
|
+
"required": false,
|
|
320
|
+
"mutable": false,
|
|
321
|
+
"description": "Optional expanded ancestor path. Compact variants continue to use the Back action."
|
|
277
322
|
},
|
|
278
323
|
"description": {
|
|
279
324
|
"type": "string",
|
|
@@ -362,6 +407,14 @@
|
|
|
362
407
|
"composed": true,
|
|
363
408
|
"description": "Emitted when the leading Back action is activated."
|
|
364
409
|
},
|
|
410
|
+
{
|
|
411
|
+
"name": "dsBreadcrumbSelect",
|
|
412
|
+
"detail": "BreadcrumbSelectDetail",
|
|
413
|
+
"bubbles": true,
|
|
414
|
+
"cancelable": true,
|
|
415
|
+
"composed": true,
|
|
416
|
+
"description": "Emitted when an authored expanded breadcrumb item is activated."
|
|
417
|
+
},
|
|
365
418
|
{
|
|
366
419
|
"name": "dsSectionChange",
|
|
367
420
|
"detail": "string",
|
|
@@ -393,7 +446,7 @@
|
|
|
393
446
|
"import": "import { DsBarTitle } from '@ds-mo/ui/angular/ds-bar-title';",
|
|
394
447
|
"example": "<ds-bar-title></ds-bar-title>"
|
|
395
448
|
},
|
|
396
|
-
"complexPropertyNote": "Assign these non-primitive values as JavaScript properties: actions, primaryAction, sections.",
|
|
449
|
+
"complexPropertyNote": "Assign these non-primitive values as JavaScript properties: actions, breadcrumbs, primaryAction, sections.",
|
|
397
450
|
"peerDependencies": {
|
|
398
451
|
"required": [
|
|
399
452
|
"@ds-mo/tokens ^3.1.1",
|
|
@@ -409,6 +462,7 @@
|
|
|
409
462
|
"@ds-mo/icons"
|
|
410
463
|
],
|
|
411
464
|
"registryDependencies": [
|
|
465
|
+
"breadcrumb",
|
|
412
466
|
"button-filled",
|
|
413
467
|
"button-unfilled",
|
|
414
468
|
"icon",
|
|
@@ -419,12 +473,12 @@
|
|
|
419
473
|
"files": [
|
|
420
474
|
{
|
|
421
475
|
"path": "src/wc/components/BarTitle/BarTitle.css",
|
|
422
|
-
"content": "@import '../../utils/control-density.css';\n@import '../../utils/focus-ring.css';\n@import '../../utils/interaction-fill.css';\n\n:host {\n display: block;\n min-width: 0;\n box-sizing: border-box;\n background: var(--color-background-primary);\n}\n\n:host([data-shell-page-syncing]) {\n visibility: hidden;\n}\n\n.bar-title {\n position: relative;\n min-width: 0;\n padding: 0;\n box-sizing: border-box;\n background: var(--color-background-primary);\n}\n\n.bar-title::after {\n content: '';\n position: absolute;\n inset: auto var(--dimension-space-400) 0;\n height: var(--dimension-stroke-width-012);\n background: var(--color-border-tertiary);\n pointer-events: none;\n}\n\n.bar-title__inner {\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: stretch;\n gap: var(--dimension-space-100);\n padding: var(--dimension-space-400);\n box-sizing: border-box;\n}\n\n.bar-title__row {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n gap: var(--dimension-space-100);\n min-height: var(--dimension-size-400);\n min-width: 0;\n}\n\n:host(.bar-title-host--expanded) .bar-title__row {\n gap: var(--dimension-space-400);\n}\n\n.bar-title__leading {\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n gap: var(--dimension-space-
|
|
476
|
+
"content": "@import '../../utils/control-density.css';\n@import '../../utils/focus-ring.css';\n@import '../../utils/interaction-fill.css';\n\n:host {\n display: block;\n min-width: 0;\n box-sizing: border-box;\n background: var(--color-background-primary);\n}\n\n:host([data-shell-page-syncing]) {\n visibility: hidden;\n}\n\n.bar-title {\n position: relative;\n min-width: 0;\n padding: 0;\n box-sizing: border-box;\n background: var(--color-background-primary);\n}\n\n.bar-title::after {\n content: '';\n position: absolute;\n inset: auto var(--dimension-space-400) 0;\n height: var(--dimension-stroke-width-012);\n background: var(--color-border-tertiary);\n pointer-events: none;\n}\n\n.bar-title__inner {\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: stretch;\n gap: var(--dimension-space-100);\n padding: var(--dimension-space-400);\n box-sizing: border-box;\n}\n\n.bar-title__row {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n gap: var(--dimension-space-100);\n min-height: var(--dimension-size-400);\n min-width: 0;\n}\n\n:host(.bar-title-host--expanded) .bar-title__row {\n gap: var(--dimension-space-400);\n}\n\n.bar-title__leading {\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n gap: var(--dimension-space-100);\n min-width: 0;\n}\n\n.bar-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}\n\n.bar-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}\n\n.bar-title__back,\n.bar-title__section-chevron {\n flex: 0 0 auto;\n}\n\n.bar-title__breadcrumb {\n display: block;\n width: 100%;\n min-width: 0;\n}\n\n.bar-title__heading {\n display: block;\n width: auto;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n user-select: none;\n}\n\n.bar-title__divider {\n width: var(--dimension-stroke-width-012);\n height: var(--dimension-size-250);\n margin-inline-start: var(--dimension-space-100);\n flex: 0 0 var(--dimension-stroke-width-012);\n background: var(--color-border-tertiary);\n}\n\n.bar-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-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: pointer;\n font-family: inherit;\n user-select: none;\n transition: color var(--effect-motion-short-2);\n}\n\n.bar-title__section-trigger--expanded {\n color: var(--color-foreground-primary);\n}\n\n.bar-title__section-trigger--expanded::after,\n.bar-title__section-trigger--expanded:hover::after {\n background: var(--ds-interaction-pressed);\n}\n\n.bar-title__section-label {\n min-width: 0;\n padding-inline: var(--ds-control-label-inset);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.bar-title__actions {\n display: flex;\n align-items: center;\n gap: var(--dimension-space-100);\n flex: 0 0 auto;\n}\n\n.bar-title__description {\n display: block;\n min-width: 0;\n max-width: 100%;\n}\n\n:host(.bar-title-host--compact) .bar-title {\n height: var(--dimension-size-600);\n padding: var(--dimension-space-100);\n}\n\n:host(.bar-title-host--compact) .bar-title::after {\n inset-inline: 0;\n}\n\n:host(.bar-title-host--compact) .bar-title__inner {\n height: 100%;\n padding: 0;\n gap: 0;\n}\n\n:host(.bar-title-host--compact) .bar-title__row {\n height: 100%;\n align-items: center;\n}\n\n:host(.bar-title-host--compact) .bar-title__identity {\n height: var(--dimension-size-400);\n}\n\n:host(.bar-title-host--compact) .bar-title__divider {\n margin-inline-start: 0;\n}\n\n:host(.bar-title-host--compact) .bar-title__heading {\n display: inline-flex;\n flex: 1 1 auto;\n align-items: center;\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}\n\n@media (prefers-reduced-motion: reduce) {\n .bar-title__section-trigger {\n transition: none;\n }\n}\n",
|
|
423
477
|
"type": "registry:ui"
|
|
424
478
|
},
|
|
425
479
|
{
|
|
426
480
|
"path": "src/wc/components/BarTitle/BarTitle.tsx",
|
|
427
|
-
"content": "import { Component, Event, EventEmitter, h, Host, Prop, State, Watch } from '@stencil/core';\nimport type { MenuItemData, MenuSection } from '../Menu/menu-types';\nimport {\n isBarTitleDivider,\n type BarTitleAction,\n type BarTitleActionItem,\n type BarTitlePrimaryAction,\n type BarTitleSection,\n type BarTitleSectionItem,\n type BarTitleVariant,\n} from './bar-title-types';\n\nlet nextBarTitleId = 0;\n\ntype FocusableButton = HTMLElement & { setFocus?: () => Promise<void> };\n\n@Component({\n tag: 'ds-bar-title',\n styleUrl: 'BarTitle.css',\n scoped: true,\n})\nexport class BarTitle {\n /** The page's single visible h1. */\n @Prop() heading!: string;\n\n /** Optional supporting copy shown in the expanded presentation. */\n @Prop() description: 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 /** Visible parent-page label used by the expanded Back breadcrumb. */\n @Prop() backLabel: string = 'Back';\n\n /** Optional page sections exposed through the active-section menu. */\n @Prop() sections: BarTitleSectionItem[] = [];\n\n /** Id of the active page section. */\n @Prop() value: string = '';\n\n /** Accessible name for the page-section 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 /** Accessible name for the page-actions menu. */\n @Prop() actionsAriaLabel: string = 'More page actions';\n\n /** Explicit visual/capacity variant. ShellPage owns automatic selection. */\n @Prop() variant: BarTitleVariant = 'expanded';\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 actionMenuOpen = false;\n @State() private sectionMenuInitialFocusVisible = false;\n @State() private actionMenuInitialFocusVisible = false;\n\n private readonly instanceId = nextBarTitleId++;\n private readonly sectionMenuTriggerId = `bar-title-section-trigger-${this.instanceId}`;\n private readonly sectionMenuId = `bar-title-section-menu-${this.instanceId}`;\n private readonly actionMenuTriggerId = `bar-title-action-trigger-${this.instanceId}`;\n private readonly actionMenuId = `bar-title-action-menu-${this.instanceId}`;\n private sectionTriggerEl: HTMLButtonElement | null = null;\n private actionTriggerEl: FocusableButton | null = null;\n\n @Watch('sections')\n handleSectionsChange() {\n if (!this.hasSectionSelector) this.closeSectionMenu();\n }\n\n @Watch('actions')\n @Watch('primaryAction')\n handleActionsChange() {\n if (!this.showActionMenuTrigger) this.closeActionMenu();\n }\n\n private get compact(): boolean {\n return this.variant !== 'expanded';\n }\n\n /** Tooltip copy is fixed and generic; backAriaLabel/actionsAriaLabel stay page-specific. */\n private get backTooltipLabel(): string {\n return 'Go back';\n }\n\n private get primaryCollapsed(): boolean {\n return (\n this.variant === 'constrained' &&\n this.primaryAction !== null &&\n (this.primaryAction.collapse ?? 'auto') === 'auto'\n );\n }\n\n private get selectableSections(): BarTitleSection[] {\n return this.sections.filter((item): item is BarTitleSection => !isBarTitleDivider(item));\n }\n\n private get hasSectionSelector(): boolean {\n return this.selectableSections.length > 1;\n }\n\n private get effectiveValue(): string {\n return this.selectableSections.some(section => section.id === this.value)\n ? this.value\n : (this.selectableSections[0]?.id ?? '');\n }\n\n private get selectedSectionLabel(): string {\n return this.selectableSections.find(section => section.id === this.effectiveValue)?.label ?? '';\n }\n\n private get sectionTriggerAriaLabel(): string {\n return `${this.sectionsAriaLabel}. Current section: ${this.selectedSectionLabel}`;\n }\n\n private groupsFromItems<T extends BarTitleSection | BarTitleAction>(\n source: Array<T | { type: 'divider' }>,\n map: (item: T) => MenuItemData\n ): MenuSection[] {\n const groups: MenuSection[] = [];\n let items: MenuItemData[] = [];\n const commit = () => {\n if (items.length > 0) groups.push({ items });\n items = [];\n };\n\n for (const item of source) {\n if (isBarTitleDivider(item)) {\n commit();\n } else {\n items.push(map(item));\n }\n }\n commit();\n return groups;\n }\n\n private get sectionMenuSections(): MenuSection[] {\n return this.groupsFromItems(this.sections, section => ({\n label: section.label,\n value: section.id,\n isSelected: section.id === this.effectiveValue,\n isInactive: section.isInactive,\n }));\n }\n\n private get selectableActions(): BarTitleAction[] {\n return this.actions.filter((item): item is BarTitleAction => !isBarTitleDivider(item));\n }\n\n private get showActionMenuTrigger(): boolean {\n return (\n this.selectableActions.length > 0 || (this.primaryCollapsed && this.primaryAction !== null)\n );\n }\n\n private actionMenuItem(action: BarTitleAction | BarTitlePrimaryAction): MenuItemData {\n const primary = action as BarTitlePrimaryAction;\n return {\n label: action.label,\n value: action.id,\n isInactive: action.isInactive || primary.isLoading,\n isDestructive: action.isDestructive || primary.intent === 'negative',\n };\n }\n\n private get actionMenuSections(): MenuSection[] {\n const groups = this.groupsFromItems(this.actions, action => this.actionMenuItem(action));\n if (!this.primaryCollapsed || !this.primaryAction) return groups;\n return [{ items: [this.actionMenuItem(this.primaryAction)] }, ...groups];\n }\n\n private toggleSectionMenu = (event: MouseEvent) => {\n this.sectionMenuInitialFocusVisible = event.detail === 0;\n this.actionMenuOpen = false;\n this.sectionMenuOpen = !this.sectionMenuOpen;\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 const selected = this.selectableSections.find(section => section.id === id);\n if (!selected || selected.isInactive) return;\n this.closeSectionMenu();\n this.dsSectionChange.emit(id);\n requestAnimationFrame(() => this.sectionTriggerEl?.focus());\n };\n\n private toggleActionMenu = (event: MouseEvent) => {\n this.actionMenuInitialFocusVisible = event.detail === 0;\n this.sectionMenuOpen = false;\n this.actionMenuOpen = !this.actionMenuOpen;\n };\n\n private closeActionMenu = () => {\n this.actionMenuOpen = false;\n };\n\n private handleActionSelect = (event: CustomEvent<MenuItemData>) => {\n const id = String(event.detail?.value ?? '');\n const primaryMatches = this.primaryCollapsed && this.primaryAction?.id === id;\n const action = this.selectableActions.find(candidate => candidate.id === id);\n if (!primaryMatches && !action) return;\n if (\n (primaryMatches && (this.primaryAction?.isInactive || this.primaryAction?.isLoading)) ||\n action?.isInactive\n ) {\n return;\n }\n this.closeActionMenu();\n this.dsAction.emit(id);\n requestAnimationFrame(() => void this.actionTriggerEl?.setFocus?.());\n };\n\n private renderSectionSelector() {\n if (!this.hasSectionSelector) return null;\n return [\n <div class=\"bar-title__divider\" aria-hidden=\"true\" />,\n <div class=\"bar-title__section-selector\">\n <button\n ref={el => {\n this.sectionTriggerEl = el ?? null;\n }}\n id={this.sectionMenuTriggerId}\n class={{\n 'bar-title__section-trigger': true,\n 'bar-title__section-trigger--expanded': this.sectionMenuOpen,\n 'ds-control--md': true,\n 'ds-focus-ring-inset': true,\n 'ds-interaction-fill': true,\n }}\n type=\"button\"\n aria-haspopup=\"menu\"\n aria-controls={this.sectionMenuId}\n aria-expanded={String(this.sectionMenuOpen)}\n aria-label={this.sectionTriggerAriaLabel}\n onClick={this.toggleSectionMenu}\n >\n <ds-text\n class=\"bar-title__section-label ds-interaction-fill__content\"\n as=\"span\"\n variant=\"text-body-medium\"\n emphasis\n color=\"primary\"\n >\n {this.selectedSectionLabel}\n </ds-text>\n <ds-icon\n class=\"bar-title__section-chevron ds-interaction-fill__content\"\n name=\"ChevronUpDown\"\n size=\"md\"\n color=\"inherit\"\n aria-hidden=\"true\"\n />\n </button>\n </div>,\n ];\n }\n\n private renderActions() {\n const primary = this.primaryAction;\n if (!primary && !this.showActionMenuTrigger) return null;\n\n return (\n <div class=\"bar-title__actions\">\n {primary && !this.primaryCollapsed ? (\n <ds-button-filled\n class=\"bar-title__primary-action\"\n variant={primary.icon ? 'icon-label' : 'label'}\n icon={primary.icon ?? ''}\n label={primary.label}\n intent={primary.intent ?? 'brand'}\n contrast={primary.contrast ?? 'bold'}\n size=\"md\"\n type={primary.type ?? 'button'}\n isInactive={primary.isInactive}\n isLoading={primary.isLoading}\n onDsClick={() => this.dsAction.emit(primary.id)}\n />\n ) : null}\n {this.showActionMenuTrigger ? (\n <ds-tooltip label=\"Page options\" side=\"bottom\" size=\"sm\">\n <ds-button-unfilled\n ref={el => {\n this.actionTriggerEl = el ?? null;\n }}\n id={this.actionMenuTriggerId}\n class=\"bar-title__more-actions\"\n variant=\"icon\"\n icon=\"Ellipses\"\n aria-label={this.actionsAriaLabel}\n size=\"md\"\n activeFill={!this.compact}\n hasBorder={!this.compact && !this.primaryCollapsed}\n haspopup=\"menu\"\n controls={this.actionMenuId}\n expanded={this.actionMenuOpen}\n onDsClick={(event: CustomEvent<MouseEvent>) => this.toggleActionMenu(event.detail)}\n />\n </ds-tooltip>\n ) : null}\n </div>\n );\n }\n\n private renderBack(compact: boolean) {\n if (!this.showBack) return null;\n\n if (!compact) {\n return (\n <div class=\"bar-title__breadcrumb\">\n <ds-button-unfilled\n class=\"bar-title__breadcrumb-back\"\n variant=\"icon-label\"\n icon=\"ChevronLeft\"\n label={this.backLabel}\n aria-label={this.backAriaLabel}\n size=\"xs\"\n hasBorder={false}\n onDsClick={(event: CustomEvent<MouseEvent>) => this.dsBack.emit(event.detail)}\n />\n </div>\n );\n }\n\n return (\n <ds-tooltip label={this.backTooltipLabel} side=\"bottom\" size=\"sm\">\n <ds-button-unfilled\n class=\"bar-title__back\"\n variant=\"icon\"\n icon=\"ChevronLeft\"\n aria-label={this.backAriaLabel}\n size=\"md\"\n activeFill={false}\n hasBorder={false}\n onDsClick={(event: CustomEvent<MouseEvent>) => this.dsBack.emit(event.detail)}\n />\n </ds-tooltip>\n );\n }\n\n render() {\n const compact = this.compact;\n return (\n <Host\n class={{\n 'bar-title-host--compact': compact,\n 'bar-title-host--expanded': this.variant === 'expanded',\n 'bar-title-host--constrained': this.variant === 'constrained',\n 'bar-title-host--has-description': !!this.description,\n 'bar-title-host--has-back': this.showBack,\n }}\n >\n <div class=\"bar-title\">\n <div class=\"bar-title__inner\">\n <div class=\"bar-title__row\">\n <div class=\"bar-title__leading\">\n {!compact ? this.renderBack(false) : null}\n <div class=\"bar-title__title-row\">\n <div class=\"bar-title__identity\">\n {compact ? this.renderBack(true) : null}\n <ds-text\n class=\"bar-title__heading ds-control--md\"\n variant={compact ? 'text-title-small' : 'text-title-medium'}\n emphasis\n color=\"primary\"\n as=\"h1\"\n lineTruncation={1}\n >\n {this.heading}\n </ds-text>\n </div>\n {this.renderSectionSelector()}\n </div>\n {this.description && !compact ? (\n <ds-text\n class=\"bar-title__description\"\n variant=\"text-body-small\"\n color=\"secondary\"\n lineTruncation={2}\n wrap=\"wrap\"\n as=\"p\"\n >\n {this.description}\n </ds-text>\n ) : null}\n </div>\n {this.renderActions()}\n </div>\n </div>\n </div>\n\n {this.hasSectionSelector ? (\n <ds-menu\n id={this.sectionMenuId}\n class=\"bar-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 onDsSelect={this.handleSectionSelect}\n />\n ) : null}\n\n {this.showActionMenuTrigger ? (\n <ds-menu\n id={this.actionMenuId}\n class=\"bar-title__action-menu\"\n anchorId={this.actionMenuTriggerId}\n align=\"end\"\n menuLabel={this.actionsAriaLabel}\n open={this.actionMenuOpen}\n initialFocusVisible={this.actionMenuInitialFocusVisible}\n sections={this.actionMenuSections}\n onDsClose={this.closeActionMenu}\n onDsSelect={this.handleActionSelect}\n />\n ) : null}\n </Host>\n );\n }\n}\n",
|
|
481
|
+
"content": "import {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport type { BreadcrumbItem, BreadcrumbSelectDetail } from '../Breadcrumb/breadcrumb-types';\nimport type { MenuItemData, MenuSection } from '../Menu/menu-types';\nimport {\n isBarTitleDivider,\n type BarTitleAction,\n type BarTitleActionItem,\n type BarTitlePrimaryAction,\n type BarTitleSection,\n type BarTitleSectionItem,\n type BarTitleVariant,\n} from './bar-title-types';\n\nlet nextBarTitleId = 0;\n\ntype FocusableButton = HTMLElement & { setFocus?: () => Promise<void> };\n\n@Component({\n tag: 'ds-bar-title',\n styleUrl: 'BarTitle.css',\n scoped: true,\n})\nexport class BarTitle {\n @Element() el!: HTMLElement;\n\n /** The page's single visible h1. */\n @Prop() heading!: string;\n\n /** Optional supporting copy shown in the expanded presentation. */\n @Prop() description: 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 /** Visible parent-page label used by the expanded breadcrumb when breadcrumbs is empty. */\n @Prop() backLabel: string = 'Back';\n\n /** Optional expanded ancestor path. Compact variants continue to use the Back action. */\n @Prop() breadcrumbs: BreadcrumbItem[] = [];\n\n /** Accessible name for the expanded breadcrumb navigation landmark. */\n @Prop() breadcrumbAriaLabel: string = 'Breadcrumb';\n\n /** Optional page sections exposed through the active-section menu. */\n @Prop() sections: BarTitleSectionItem[] = [];\n\n /** Id of the active page section. */\n @Prop() value: string = '';\n\n /** Accessible name for the page-section 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 /** Accessible name for the page-actions menu. */\n @Prop() actionsAriaLabel: string = 'More page actions';\n\n /** Explicit visual/capacity variant. ShellPage owns automatic selection. */\n @Prop() variant: BarTitleVariant = 'expanded';\n\n /** Emitted when the leading Back action is activated. */\n @Event() dsBack!: EventEmitter<MouseEvent>;\n\n /** Emitted when an authored expanded breadcrumb item is activated. */\n @Event({ cancelable: true }) dsBreadcrumbSelect!: EventEmitter<BreadcrumbSelectDetail>;\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 actionMenuOpen = false;\n @State() private sectionMenuInitialFocusVisible = false;\n @State() private actionMenuInitialFocusVisible = false;\n\n private readonly instanceId = nextBarTitleId++;\n private readonly sectionMenuTriggerId = `bar-title-section-trigger-${this.instanceId}`;\n private readonly sectionMenuId = `bar-title-section-menu-${this.instanceId}`;\n private readonly actionMenuTriggerId = `bar-title-action-trigger-${this.instanceId}`;\n private readonly actionMenuId = `bar-title-action-menu-${this.instanceId}`;\n private sectionTriggerEl: HTMLButtonElement | null = null;\n private actionTriggerEl: FocusableButton | null = null;\n\n componentWillLoad() {\n if (this.el.closest('ds-shell-page')) {\n this.el.setAttribute('data-shell-page-syncing', '');\n }\n }\n\n @Watch('sections')\n handleSectionsChange() {\n if (!this.hasSectionSelector) this.closeSectionMenu();\n }\n\n @Watch('actions')\n @Watch('primaryAction')\n handleActionsChange() {\n if (!this.showActionMenuTrigger) this.closeActionMenu();\n }\n\n private get compact(): boolean {\n return this.variant !== 'expanded';\n }\n\n private get expandedBreadcrumbItems(): BreadcrumbItem[] {\n if (this.breadcrumbs.length > 0) return this.breadcrumbs;\n if (!this.showBack) return [];\n return [\n {\n id: 'back',\n label: this.backLabel,\n ariaLabel: this.backAriaLabel,\n },\n ];\n }\n\n /** Tooltip copy is fixed and generic; backAriaLabel/actionsAriaLabel stay page-specific. */\n private get backTooltipLabel(): string {\n return 'Go back';\n }\n\n private get primaryCollapsed(): boolean {\n return (\n this.variant === 'constrained' &&\n this.primaryAction !== null &&\n (this.primaryAction.collapse ?? 'auto') === 'auto'\n );\n }\n\n private get selectableSections(): BarTitleSection[] {\n return this.sections.filter((item): item is BarTitleSection => !isBarTitleDivider(item));\n }\n\n private get hasSectionSelector(): boolean {\n return this.selectableSections.length > 1;\n }\n\n private get effectiveValue(): string {\n return this.selectableSections.some(section => section.id === this.value)\n ? this.value\n : (this.selectableSections[0]?.id ?? '');\n }\n\n private get selectedSectionLabel(): string {\n return this.selectableSections.find(section => section.id === this.effectiveValue)?.label ?? '';\n }\n\n private get sectionTriggerAriaLabel(): string {\n return `${this.sectionsAriaLabel}. Current section: ${this.selectedSectionLabel}`;\n }\n\n private groupsFromItems<T extends BarTitleSection | BarTitleAction>(\n source: Array<T | { type: 'divider' }>,\n map: (item: T) => MenuItemData\n ): MenuSection[] {\n const groups: MenuSection[] = [];\n let items: MenuItemData[] = [];\n const commit = () => {\n if (items.length > 0) groups.push({ items });\n items = [];\n };\n\n for (const item of source) {\n if (isBarTitleDivider(item)) {\n commit();\n } else {\n items.push(map(item));\n }\n }\n commit();\n return groups;\n }\n\n private get sectionMenuSections(): MenuSection[] {\n return this.groupsFromItems(this.sections, section => ({\n label: section.label,\n value: section.id,\n isSelected: section.id === this.effectiveValue,\n isInactive: section.isInactive,\n }));\n }\n\n private get selectableActions(): BarTitleAction[] {\n return this.actions.filter((item): item is BarTitleAction => !isBarTitleDivider(item));\n }\n\n private get showActionMenuTrigger(): boolean {\n return (\n this.selectableActions.length > 0 || (this.primaryCollapsed && this.primaryAction !== null)\n );\n }\n\n private actionMenuItem(action: BarTitleAction | BarTitlePrimaryAction): MenuItemData {\n const primary = action as BarTitlePrimaryAction;\n return {\n label: action.label,\n value: action.id,\n isInactive: action.isInactive || primary.isLoading,\n isDestructive: action.isDestructive || primary.intent === 'negative',\n };\n }\n\n private get actionMenuSections(): MenuSection[] {\n const groups = this.groupsFromItems(this.actions, action => this.actionMenuItem(action));\n if (!this.primaryCollapsed || !this.primaryAction) return groups;\n return [{ items: [this.actionMenuItem(this.primaryAction)] }, ...groups];\n }\n\n private toggleSectionMenu = (event: MouseEvent) => {\n this.sectionMenuInitialFocusVisible = event.detail === 0;\n this.actionMenuOpen = false;\n this.sectionMenuOpen = !this.sectionMenuOpen;\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 const selected = this.selectableSections.find(section => section.id === id);\n if (!selected || selected.isInactive) return;\n this.closeSectionMenu();\n this.dsSectionChange.emit(id);\n requestAnimationFrame(() => this.sectionTriggerEl?.focus());\n };\n\n private toggleActionMenu = (event: MouseEvent) => {\n this.actionMenuInitialFocusVisible = event.detail === 0;\n this.sectionMenuOpen = false;\n this.actionMenuOpen = !this.actionMenuOpen;\n };\n\n private closeActionMenu = () => {\n this.actionMenuOpen = false;\n };\n\n private handleActionSelect = (event: CustomEvent<MenuItemData>) => {\n const id = String(event.detail?.value ?? '');\n const primaryMatches = this.primaryCollapsed && this.primaryAction?.id === id;\n const action = this.selectableActions.find(candidate => candidate.id === id);\n if (!primaryMatches && !action) return;\n if (\n (primaryMatches && (this.primaryAction?.isInactive || this.primaryAction?.isLoading)) ||\n action?.isInactive\n ) {\n return;\n }\n this.closeActionMenu();\n this.dsAction.emit(id);\n requestAnimationFrame(() => void this.actionTriggerEl?.setFocus?.());\n };\n\n private renderSectionSelector() {\n if (!this.hasSectionSelector) return null;\n return [\n <div class=\"bar-title__divider\" aria-hidden=\"true\" />,\n <div class=\"bar-title__section-selector\">\n <button\n ref={el => {\n this.sectionTriggerEl = el ?? null;\n }}\n id={this.sectionMenuTriggerId}\n class={{\n 'bar-title__section-trigger': true,\n 'bar-title__section-trigger--expanded': this.sectionMenuOpen,\n 'ds-control--md': true,\n 'ds-focus-ring-inset': true,\n 'ds-interaction-fill': true,\n }}\n type=\"button\"\n aria-haspopup=\"menu\"\n aria-controls={this.sectionMenuId}\n aria-expanded={String(this.sectionMenuOpen)}\n aria-label={this.sectionTriggerAriaLabel}\n onClick={this.toggleSectionMenu}\n >\n <ds-text\n class=\"bar-title__section-label ds-interaction-fill__content\"\n as=\"span\"\n variant=\"text-body-medium\"\n emphasis\n color=\"primary\"\n >\n {this.selectedSectionLabel}\n </ds-text>\n <ds-icon\n class=\"bar-title__section-chevron ds-interaction-fill__content\"\n name=\"ChevronUpDown\"\n size=\"md\"\n color=\"inherit\"\n aria-hidden=\"true\"\n />\n </button>\n </div>,\n ];\n }\n\n private renderActions() {\n const primary = this.primaryAction;\n if (!primary && !this.showActionMenuTrigger) return null;\n\n return (\n <div class=\"bar-title__actions\">\n {primary && !this.primaryCollapsed ? (\n <ds-button-filled\n class=\"bar-title__primary-action\"\n variant={primary.icon ? 'icon-label' : 'label'}\n icon={primary.icon ?? ''}\n label={primary.label}\n intent={primary.intent ?? 'brand'}\n contrast={primary.contrast ?? 'bold'}\n size=\"md\"\n type={primary.type ?? 'button'}\n isInactive={primary.isInactive}\n isLoading={primary.isLoading}\n onDsClick={() => this.dsAction.emit(primary.id)}\n />\n ) : null}\n {this.showActionMenuTrigger ? (\n <ds-tooltip label=\"Page options\" side=\"bottom\" size=\"sm\">\n <ds-button-unfilled\n ref={el => {\n this.actionTriggerEl = el ?? null;\n }}\n id={this.actionMenuTriggerId}\n class=\"bar-title__more-actions\"\n variant=\"icon\"\n icon=\"Ellipses\"\n aria-label={this.actionsAriaLabel}\n size=\"md\"\n activeFill={!this.compact}\n hasBorder={primary !== null && !this.primaryCollapsed}\n haspopup=\"menu\"\n controls={this.actionMenuId}\n expanded={this.actionMenuOpen}\n onDsClick={(event: CustomEvent<MouseEvent>) => this.toggleActionMenu(event.detail)}\n />\n </ds-tooltip>\n ) : null}\n </div>\n );\n }\n\n private handleBreadcrumbSelect = (event: CustomEvent<BreadcrumbSelectDetail>) => {\n if (this.breadcrumbs.length === 0) {\n this.dsBack.emit(event.detail.originalEvent);\n return;\n }\n const forwarded = this.dsBreadcrumbSelect.emit(event.detail);\n if (forwarded.defaultPrevented) event.preventDefault();\n };\n\n private renderBreadcrumb() {\n const items = this.expandedBreadcrumbItems;\n if (items.length === 0) return null;\n return (\n <ds-breadcrumb\n class=\"bar-title__breadcrumb\"\n items={items}\n ariaLabel={this.breadcrumbAriaLabel}\n onDsSelect={this.handleBreadcrumbSelect}\n />\n );\n }\n\n private renderBack() {\n if (!this.showBack) return null;\n return (\n <ds-tooltip label={this.backTooltipLabel} side=\"bottom\" size=\"sm\">\n <ds-button-unfilled\n class=\"bar-title__back\"\n variant=\"icon\"\n icon=\"ChevronLeft\"\n aria-label={this.backAriaLabel}\n size=\"md\"\n activeFill={false}\n hasBorder={false}\n onDsClick={(event: CustomEvent<MouseEvent>) => this.dsBack.emit(event.detail)}\n />\n </ds-tooltip>\n );\n }\n\n render() {\n const compact = this.compact;\n return (\n <Host\n class={{\n 'bar-title-host--compact': compact,\n 'bar-title-host--expanded': this.variant === 'expanded',\n 'bar-title-host--constrained': this.variant === 'constrained',\n 'bar-title-host--has-description': !!this.description,\n 'bar-title-host--has-back': this.showBack,\n 'bar-title-host--has-breadcrumb': !compact && this.expandedBreadcrumbItems.length > 0,\n }}\n >\n <div class=\"bar-title\">\n <div class=\"bar-title__inner\">\n {!compact ? this.renderBreadcrumb() : null}\n <div class=\"bar-title__row\">\n <div class=\"bar-title__leading\">\n <div class=\"bar-title__title-row\" data-shell-page-header-anchor>\n <div class=\"bar-title__identity\">\n {compact ? this.renderBack() : null}\n <ds-text\n class=\"bar-title__heading ds-control--md\"\n variant={compact ? 'text-title-small' : 'text-title-medium'}\n emphasis\n color=\"primary\"\n as=\"h1\"\n lineTruncation={1}\n >\n {this.heading}\n </ds-text>\n </div>\n {this.renderSectionSelector()}\n </div>\n {this.description && !compact ? (\n <ds-text\n class=\"bar-title__description\"\n variant=\"text-body-small\"\n color=\"secondary\"\n lineTruncation={2}\n wrap=\"wrap\"\n as=\"p\"\n >\n {this.description}\n </ds-text>\n ) : null}\n </div>\n {this.renderActions()}\n </div>\n </div>\n </div>\n\n {this.hasSectionSelector ? (\n <ds-menu\n id={this.sectionMenuId}\n class=\"bar-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 onDsSelect={this.handleSectionSelect}\n />\n ) : null}\n\n {this.showActionMenuTrigger ? (\n <ds-menu\n id={this.actionMenuId}\n class=\"bar-title__action-menu\"\n anchorId={this.actionMenuTriggerId}\n align=\"end\"\n menuLabel={this.actionsAriaLabel}\n open={this.actionMenuOpen}\n initialFocusVisible={this.actionMenuInitialFocusVisible}\n sections={this.actionMenuSections}\n onDsClose={this.closeActionMenu}\n onDsSelect={this.handleActionSelect}\n />\n ) : null}\n </Host>\n );\n }\n}\n",
|
|
428
482
|
"type": "registry:ui"
|
|
429
483
|
},
|
|
430
484
|
{
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "breadcrumb",
|
|
4
|
+
"title": "Breadcrumb",
|
|
5
|
+
"description": "Compact hierarchical page navigation with native links or application-owned selection, optional current-page semantics, and slash separators.",
|
|
6
|
+
"type": "registry:ui",
|
|
7
|
+
"meta": {
|
|
8
|
+
"library": "@ds-mo/ui",
|
|
9
|
+
"distribution": "npm",
|
|
10
|
+
"storybook": "https://zainadeel.github.io/compomo/?path=/story/breadcrumb",
|
|
11
|
+
"source": "src/wc/components/Breadcrumb/Breadcrumb.tsx",
|
|
12
|
+
"intentStatus": "complete",
|
|
13
|
+
"intent": {
|
|
14
|
+
"audience": "general",
|
|
15
|
+
"status": "stable",
|
|
16
|
+
"summary": "Compact hierarchical page navigation with native links or application-owned selection, optional current-page semantics, and slash separators.",
|
|
17
|
+
"useWhen": [
|
|
18
|
+
"A page needs to expose its hierarchical ancestors above the current page title.",
|
|
19
|
+
"Users need to move directly to a broader page in the current route hierarchy.",
|
|
20
|
+
"BarTitle expanded presentation needs an ancestor path instead of a directional Back button."
|
|
21
|
+
],
|
|
22
|
+
"avoidWhen": [
|
|
23
|
+
"The navigation represents primary application destinations; use PanelNav or BarNav.",
|
|
24
|
+
"The choices switch peer views within the current page; use TabGroup or the BarTitle section selector.",
|
|
25
|
+
"Only a directional return command is needed in compact chrome; use the owning header's Back action.",
|
|
26
|
+
"The path would repeat the same current-page label already communicated by a nearby h1 without adding useful ancestors."
|
|
27
|
+
],
|
|
28
|
+
"alternatives": [
|
|
29
|
+
{
|
|
30
|
+
"when": "The title and breadcrumb belong to responsive page chrome with page-level actions.",
|
|
31
|
+
"component": "component:ds-bar-title",
|
|
32
|
+
"reason": "BarTitle composes Breadcrumb in expanded mode and preserves compact Back behavior."
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"when": "A small set of peer content views should remain directly selectable.",
|
|
36
|
+
"component": "component:ds-tab-group",
|
|
37
|
+
"reason": "TabGroup communicates peer selection rather than route ancestry."
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"commonlyComposedWith": [
|
|
41
|
+
"component:ds-bar-title",
|
|
42
|
+
"component:ds-text",
|
|
43
|
+
"component:ds-shell-page"
|
|
44
|
+
],
|
|
45
|
+
"accessibility": [
|
|
46
|
+
"The component renders a named navigation landmark containing an ordered list.",
|
|
47
|
+
"Provide href for native navigation or handle dsSelect when the application router owns navigation.",
|
|
48
|
+
"Mark at most one item current; it renders without interaction and exposes aria-current=page.",
|
|
49
|
+
"Visible caption labels use secondary foreground and slash separators are decorative and hidden from assistive technology.",
|
|
50
|
+
"Every interactive item remains keyboard reachable and receives the shared focus ring."
|
|
51
|
+
],
|
|
52
|
+
"states": [
|
|
53
|
+
"Items with href render native anchors; items without href render buttons and emit the same dsSelect detail.",
|
|
54
|
+
"Preventing dsSelect cancels native anchor navigation.",
|
|
55
|
+
"A current item is static text and never emits selection.",
|
|
56
|
+
"Links have no resting underline and add a quaternary-foreground solid underline on hover; focus remains communicated by the shared focus ring."
|
|
57
|
+
],
|
|
58
|
+
"responsiveBehavior": [
|
|
59
|
+
"The path stays on one caption line and truncates long labels within the available width.",
|
|
60
|
+
"Width is protected newest-to-oldest: the oldest ancestor collapses to a literal ellipsis before the next ancestor yields width, and the current location truncates only after every ancestor reaches its minimum.",
|
|
61
|
+
"A fully collapsed item keeps its complete label available to assistive technology while rendering only the literal ellipsis visually.",
|
|
62
|
+
"Separators remain visible while labels yield width."
|
|
63
|
+
],
|
|
64
|
+
"frameworkCaveats": {
|
|
65
|
+
"customElements": [
|
|
66
|
+
"Assign items as a JavaScript property and replace its array identity when the route changes.",
|
|
67
|
+
"Use relative or absolute href values for native navigation; omit href when the host router handles dsSelect."
|
|
68
|
+
],
|
|
69
|
+
"react": [
|
|
70
|
+
"Pass items to DsBreadcrumb and handle onDsSelect when navigation is application-owned."
|
|
71
|
+
],
|
|
72
|
+
"angular": [
|
|
73
|
+
"Bind items on the standalone DsBreadcrumb adapter and handle dsSelect when navigation is application-owned."
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
"references": [
|
|
77
|
+
{
|
|
78
|
+
"label": "Storybook examples",
|
|
79
|
+
"path": "src/wc/components/Breadcrumb/Breadcrumb.stories.ts"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"label": "Expanded page-header composition",
|
|
83
|
+
"path": "src/wc/components/BarTitle/BarTitle.tsx"
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
"api": {
|
|
88
|
+
"props": {
|
|
89
|
+
"ariaLabel": {
|
|
90
|
+
"type": "string",
|
|
91
|
+
"resolvedType": "string",
|
|
92
|
+
"attribute": "aria-label",
|
|
93
|
+
"default": "'Breadcrumb'",
|
|
94
|
+
"required": false,
|
|
95
|
+
"mutable": false,
|
|
96
|
+
"description": "Accessible name for the breadcrumb navigation landmark."
|
|
97
|
+
},
|
|
98
|
+
"items": {
|
|
99
|
+
"type": "BreadcrumbItem[]",
|
|
100
|
+
"resolvedType": "BreadcrumbItem[]",
|
|
101
|
+
"default": "[]",
|
|
102
|
+
"required": false,
|
|
103
|
+
"mutable": false,
|
|
104
|
+
"description": "Ordered path from the broadest ancestor to the nearest page."
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"events": [
|
|
108
|
+
{
|
|
109
|
+
"name": "dsSelect",
|
|
110
|
+
"detail": "BreadcrumbSelectDetail",
|
|
111
|
+
"bubbles": true,
|
|
112
|
+
"cancelable": true,
|
|
113
|
+
"composed": true,
|
|
114
|
+
"description": "Emitted when an interactive breadcrumb item is activated. Prevent to cancel native navigation."
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
"methods": [],
|
|
118
|
+
"slots": []
|
|
119
|
+
},
|
|
120
|
+
"props": {
|
|
121
|
+
"ariaLabel": {
|
|
122
|
+
"type": "string",
|
|
123
|
+
"resolvedType": "string",
|
|
124
|
+
"attribute": "aria-label",
|
|
125
|
+
"default": "'Breadcrumb'",
|
|
126
|
+
"required": false,
|
|
127
|
+
"mutable": false,
|
|
128
|
+
"description": "Accessible name for the breadcrumb navigation landmark."
|
|
129
|
+
},
|
|
130
|
+
"items": {
|
|
131
|
+
"type": "BreadcrumbItem[]",
|
|
132
|
+
"resolvedType": "BreadcrumbItem[]",
|
|
133
|
+
"default": "[]",
|
|
134
|
+
"required": false,
|
|
135
|
+
"mutable": false,
|
|
136
|
+
"description": "Ordered path from the broadest ancestor to the nearest page."
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
"events": [
|
|
140
|
+
{
|
|
141
|
+
"name": "dsSelect",
|
|
142
|
+
"detail": "BreadcrumbSelectDetail",
|
|
143
|
+
"bubbles": true,
|
|
144
|
+
"cancelable": true,
|
|
145
|
+
"composed": true,
|
|
146
|
+
"description": "Emitted when an interactive breadcrumb item is activated. Prevent to cancel native navigation."
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
"methods": [],
|
|
150
|
+
"slots": [],
|
|
151
|
+
"exports": {
|
|
152
|
+
"customElement": "ds-breadcrumb",
|
|
153
|
+
"react": "DsBreadcrumb",
|
|
154
|
+
"angular": "DsBreadcrumb"
|
|
155
|
+
},
|
|
156
|
+
"consumption": {
|
|
157
|
+
"install": "npm install @ds-mo/ui @ds-mo/tokens @ds-mo/icons",
|
|
158
|
+
"cssSetup": "import '@ds-mo/tokens';\nimport '@ds-mo/tokens/reset';\nimport '@ds-mo/tokens/globals';",
|
|
159
|
+
"customElements": {
|
|
160
|
+
"import": "import '@ds-mo/ui/dist/components/ds-breadcrumb.js';",
|
|
161
|
+
"example": "<ds-breadcrumb></ds-breadcrumb>"
|
|
162
|
+
},
|
|
163
|
+
"react": {
|
|
164
|
+
"import": "import { DsBreadcrumb } from '@ds-mo/ui/react';",
|
|
165
|
+
"example": "<DsBreadcrumb />"
|
|
166
|
+
},
|
|
167
|
+
"angular": {
|
|
168
|
+
"import": "import { DsBreadcrumb } from '@ds-mo/ui/angular/ds-breadcrumb';",
|
|
169
|
+
"example": "<ds-breadcrumb></ds-breadcrumb>"
|
|
170
|
+
},
|
|
171
|
+
"complexPropertyNote": "Assign these non-primitive values as JavaScript properties: items.",
|
|
172
|
+
"peerDependencies": {
|
|
173
|
+
"required": [
|
|
174
|
+
"@ds-mo/tokens ^3.1.1",
|
|
175
|
+
"@ds-mo/icons ^6.4.0"
|
|
176
|
+
],
|
|
177
|
+
"frameworks": "Custom Elements; React 18/19 wrappers; Angular 19-22 standalone adapters."
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
"dependencies": [
|
|
182
|
+
"@ds-mo/ui",
|
|
183
|
+
"@ds-mo/tokens"
|
|
184
|
+
],
|
|
185
|
+
"registryDependencies": [
|
|
186
|
+
"text"
|
|
187
|
+
],
|
|
188
|
+
"files": [
|
|
189
|
+
{
|
|
190
|
+
"path": "src/wc/components/Breadcrumb/Breadcrumb.css",
|
|
191
|
+
"content": "@import '../../utils/focus-ring.css';\n\n:host {\n position: relative;\n display: block;\n min-width: 0;\n box-sizing: border-box;\n}\n\n.breadcrumb {\n inline-size: 100%;\n min-width: 0;\n}\n\n.breadcrumb__list {\n display: flex;\n align-items: center;\n box-sizing: border-box;\n inline-size: 100%;\n min-width: 0;\n margin: 0;\n padding: 0;\n overflow: hidden;\n list-style: none;\n}\n\n.breadcrumb__item {\n display: flex;\n flex: 0 0 auto;\n align-items: center;\n min-width: 0;\n}\n\n.breadcrumb__separator {\n flex: 0 0 auto;\n margin-inline: var(--dimension-space-050);\n user-select: none;\n}\n\n.breadcrumb__link,\n.breadcrumb__current {\n display: inline-flex;\n flex: 0 0 auto;\n min-width: 0;\n overflow: hidden;\n padding: 0;\n border: 0;\n border-radius: var(--dimension-radius-025);\n background: transparent;\n color: var(--color-foreground-secondary);\n font: inherit;\n text-decoration: none;\n}\n\n.breadcrumb__link {\n cursor: pointer;\n}\n\n.breadcrumb__link:hover .breadcrumb__label {\n text-decoration: underline;\n text-decoration-color: var(--color-foreground-quaternary);\n text-underline-offset: var(--dimension-space-025);\n text-decoration-thickness: var(--dimension-stroke-width-012);\n}\n\n.breadcrumb__label {\n display: inline-block;\n inline-size: var(--breadcrumb-label-width, auto);\n min-width: 0;\n}\n\n.breadcrumb__measurements {\n position: absolute;\n inset: 0 auto auto 0;\n visibility: hidden;\n pointer-events: none;\n white-space: nowrap;\n}\n\n.breadcrumb__measurement {\n display: inline-block;\n inline-size: max-content;\n max-inline-size: none;\n}\n\n.breadcrumb__accessible-label {\n position: absolute;\n /* stylelint-disable declaration-property-value-disallowed-list -- classic visually-hidden clip pattern */\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n /* stylelint-enable declaration-property-value-disallowed-list */\n}\n",
|
|
192
|
+
"type": "registry:ui"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"path": "src/wc/components/Breadcrumb/Breadcrumb.tsx",
|
|
196
|
+
"content": "import { Component, Event, EventEmitter, h, Host, Prop, State, Watch } from '@stencil/core';\nimport type { BreadcrumbItem, BreadcrumbSelectDetail } from './breadcrumb-types';\n\n@Component({\n tag: 'ds-breadcrumb',\n styleUrl: 'Breadcrumb.css',\n scoped: true,\n})\nexport class Breadcrumb {\n /** Ordered path from the broadest ancestor to the nearest page. */\n @Prop() items: BreadcrumbItem[] = [];\n\n /** Accessible name for the breadcrumb navigation landmark. */\n @Prop() ariaLabel: string = 'Breadcrumb';\n\n /** Emitted when an interactive breadcrumb item is activated. Prevent to cancel native navigation. */\n @Event({ cancelable: true }) dsSelect!: EventEmitter<BreadcrumbSelectDetail>;\n\n @State() private labelWidths: number[] = [];\n @State() private collapsedLabels: boolean[] = [];\n\n private navElement?: HTMLElement;\n private listElement?: HTMLOListElement;\n private measurementElements: HTMLElement[] = [];\n private separatorElements: HTMLElement[] = [];\n private ellipsisMeasurement?: HTMLElement;\n private resizeObserver?: ResizeObserver;\n private observedElement?: HTMLElement;\n private measurementFrame?: number;\n\n componentDidLoad() {\n this.observeContainer();\n this.scheduleMeasurement();\n void document.fonts?.ready.then(() => this.scheduleMeasurement());\n }\n\n componentDidRender() {\n this.observeContainer();\n this.scheduleMeasurement();\n }\n\n disconnectedCallback() {\n this.resizeObserver?.disconnect();\n this.observedElement = undefined;\n if (this.measurementFrame !== undefined) cancelAnimationFrame(this.measurementFrame);\n }\n\n @Watch('items')\n handleItemsChange() {\n this.labelWidths = [];\n this.collapsedLabels = [];\n this.scheduleMeasurement();\n }\n\n private observeContainer() {\n if (!this.navElement || this.observedElement === this.navElement) return;\n this.resizeObserver ??= new ResizeObserver(() => this.scheduleMeasurement());\n this.resizeObserver.disconnect();\n this.resizeObserver.observe(this.navElement);\n this.observedElement = this.navElement;\n }\n\n private scheduleMeasurement() {\n if (this.measurementFrame !== undefined) return;\n this.measurementFrame = requestAnimationFrame(() => {\n this.measurementFrame = undefined;\n this.measureLabels();\n });\n }\n\n private measureLabels() {\n if (\n !this.navElement ||\n !this.listElement ||\n !this.ellipsisMeasurement ||\n this.items.length === 0\n ) return;\n\n const naturalWidths = this.items.map(\n (_, index) => this.measurementElements[index]?.getBoundingClientRect().width ?? 0\n );\n const ellipsisWidth = this.ellipsisMeasurement.getBoundingClientRect().width;\n if (naturalWidths.some(width => width === 0) || ellipsisWidth === 0) return;\n\n const separatorWidth = this.separatorElements.reduce((total, separator) => {\n const styles = getComputedStyle(separator);\n return (\n total +\n separator.getBoundingClientRect().width +\n Number.parseFloat(styles.marginInlineStart) +\n Number.parseFloat(styles.marginInlineEnd)\n );\n }, 0);\n const availableWidth = Math.max(0, this.navElement.clientWidth - separatorWidth);\n const minimumWidths = naturalWidths.map(width => Math.min(width, ellipsisWidth));\n const nextWidths = [...minimumWidths];\n let remainingWidth = Math.max(\n 0,\n availableWidth - minimumWidths.reduce((total, width) => total + width, 0)\n );\n\n // Protect the current/newest location. Extra width is granted newest-to-oldest,\n // so ancestors collapse in path order as the available space decreases.\n for (let index = naturalWidths.length - 1; index >= 0 && remainingWidth > 0; index -= 1) {\n const extraWidth = Math.min(\n remainingWidth,\n naturalWidths[index] - minimumWidths[index]\n );\n nextWidths[index] += extraWidth;\n remainingWidth -= extraWidth;\n }\n\n const widthsChanged =\n nextWidths.length !== this.labelWidths.length ||\n nextWidths.some(\n (width, index) => Math.abs(width - (this.labelWidths[index] ?? 0)) > 0.25\n );\n const nextCollapsedLabels = nextWidths.map(\n (width, index) =>\n naturalWidths[index] > minimumWidths[index] &&\n Math.abs(width - minimumWidths[index]) <= 0.25\n );\n const collapsedLabelsChanged =\n nextCollapsedLabels.length !== this.collapsedLabels.length ||\n nextCollapsedLabels.some(\n (isCollapsed, index) => isCollapsed !== this.collapsedLabels[index]\n );\n if (widthsChanged) this.labelWidths = nextWidths;\n if (collapsedLabelsChanged) this.collapsedLabels = nextCollapsedLabels;\n }\n\n private handleSelect(item: BreadcrumbItem, originalEvent: MouseEvent) {\n const event = this.dsSelect.emit({ item, originalEvent });\n if (event.defaultPrevented) originalEvent.preventDefault();\n }\n\n private renderItem(item: BreadcrumbItem, index: number) {\n const allocatedWidth = this.labelWidths[index];\n const isCollapsed = this.collapsedLabels[index] ?? false;\n const label = (\n [\n <ds-text\n class=\"breadcrumb__label\"\n as=\"span\"\n variant=\"text-caption\"\n color=\"inherit\"\n lineTruncation={isCollapsed ? 'none' : 1}\n aria-hidden={isCollapsed ? 'true' : undefined}\n style={\n allocatedWidth === undefined\n ? undefined\n : { '--breadcrumb-label-width': `${allocatedWidth}px` }\n }\n >\n {isCollapsed ? '…' : item.label}\n </ds-text>,\n isCollapsed ? <span class=\"breadcrumb__accessible-label\">{item.label}</span> : null,\n ]\n );\n\n if (item.isCurrent) {\n return (\n <span class=\"breadcrumb__current\" aria-current=\"page\" aria-label={item.ariaLabel}>\n {label}\n </span>\n );\n }\n\n if (item.href) {\n return (\n <a\n class=\"breadcrumb__link ds-focus-ring\"\n href={item.href}\n aria-label={item.ariaLabel}\n onClick={(event: MouseEvent) => this.handleSelect(item, event)}\n >\n {label}\n </a>\n );\n }\n\n return (\n <button\n class=\"breadcrumb__link ds-focus-ring\"\n type=\"button\"\n aria-label={item.ariaLabel}\n onClick={(event: MouseEvent) => this.handleSelect(item, event)}\n >\n {label}\n </button>\n );\n }\n\n render() {\n if (this.items.length === 0) return null;\n\n this.measurementElements = [];\n this.separatorElements = [];\n\n return (\n <Host>\n <nav\n class=\"breadcrumb\"\n aria-label={this.ariaLabel}\n ref={element => {\n this.navElement = element;\n }}\n >\n <div class=\"breadcrumb__measurements\" aria-hidden=\"true\">\n {this.items.map((item, index) => (\n <ds-text\n class=\"breadcrumb__measurement\"\n as=\"span\"\n variant=\"text-caption\"\n color=\"inherit\"\n ref={element => {\n if (element) this.measurementElements[index] = element;\n }}\n >\n {item.label}\n </ds-text>\n ))}\n <ds-text\n class=\"breadcrumb__measurement\"\n as=\"span\"\n variant=\"text-caption\"\n color=\"inherit\"\n ref={element => {\n this.ellipsisMeasurement = element;\n }}\n >\n …\n </ds-text>\n </div>\n <ol\n class=\"breadcrumb__list\"\n ref={element => {\n this.listElement = element;\n }}\n >\n {this.items.map((item, index) => (\n <li class=\"breadcrumb__item\" key={item.id}>\n {index > 0 ? (\n <ds-text\n class=\"breadcrumb__separator\"\n as=\"span\"\n variant=\"text-caption\"\n color=\"tertiary\"\n aria-hidden=\"true\"\n ref={element => {\n if (element) this.separatorElements[index - 1] = element;\n }}\n >\n /\n </ds-text>\n ) : null}\n {this.renderItem(item, index)}\n </li>\n ))}\n </ol>\n </nav>\n </Host>\n );\n }\n}\n",
|
|
197
|
+
"type": "registry:ui"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"path": "src/wc/components/Breadcrumb/breadcrumb-types.ts",
|
|
201
|
+
"content": "export interface BreadcrumbItem {\n /** Stable value returned from dsSelect. */\n id: string;\n /** Visible caption label. */\n label: string;\n /** Optional accessible name when the visible label is not destination-specific enough. */\n ariaLabel?: string;\n /** Native destination. Omit when the route owner handles dsSelect. */\n href?: string;\n /** Marks this item as the current page and removes its interaction. */\n isCurrent?: boolean;\n}\n\nexport interface BreadcrumbSelectDetail {\n item: BreadcrumbItem;\n originalEvent: MouseEvent;\n}\n",
|
|
202
|
+
"type": "registry:ui"
|
|
203
|
+
}
|
|
204
|
+
]
|
|
205
|
+
}
|