@ds-mo/ui 1.3.0 → 1.5.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/.build-stamp +1 -0
- package/dist/components/ds-app-shell.d.ts +11 -0
- package/dist/components/ds-app-shell.js +2 -0
- package/dist/components/ds-app-shell.js.map +1 -0
- package/dist/components/ds-bar-nav-action.js +1 -1
- package/dist/components/ds-bar-nav.js +1 -1
- package/dist/components/ds-bar-nav.js.map +1 -1
- package/dist/components/ds-breadcrumb.js +1 -1
- package/dist/components/ds-button-group.js +1 -1
- package/dist/components/ds-button.js +1 -1
- package/dist/components/ds-card.js +1 -1
- package/dist/components/ds-checkbox.js +1 -1
- package/dist/components/ds-chip.js +1 -1
- package/dist/components/ds-divider.js +1 -1
- package/dist/components/ds-empty-state.js +1 -1
- package/dist/components/ds-fade.js +1 -1
- package/dist/components/ds-field.js +1 -1
- package/dist/components/ds-header.js +1 -1
- package/dist/components/ds-icon.js +1 -1
- package/dist/components/ds-input.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-nav.js.map +1 -1
- package/dist/components/ds-radio-group.js +1 -1
- package/dist/components/ds-radio-group.js.map +1 -1
- package/dist/components/ds-scrollbar.js +1 -1
- package/dist/components/ds-select.js +1 -1
- package/dist/components/ds-slider.js +1 -1
- package/dist/components/ds-surface.js +1 -1
- package/dist/components/ds-tab-group-nav.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-toast-provider.js +1 -1
- package/dist/components/ds-toggle-button-group.js +1 -1
- package/dist/components/ds-toggle-button.js +1 -1
- package/dist/components/ds-toggle.js +1 -1
- package/dist/components/ds-tooltip.js +1 -1
- package/dist/components/index.d.ts +3 -4
- package/dist/components/index.js +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/{p-COsKOwZR.js → p--YDw8Q4o.js} +2 -2
- package/dist/components/{p-OT-Q-NxH.js → p-C9za7IDu.js} +2 -2
- package/dist/components/p-DceSoh5V.js +2 -0
- package/dist/components/p-DceSoh5V.js.map +1 -0
- package/dist/components/{p-DrDrPeVV.js → p-DqBCQRRd.js} +2 -2
- package/dist/components/p-DznbYg1m.js +2 -0
- package/dist/components/p-DznbYg1m.js.map +1 -0
- package/dist/components/{p-qfvbc9w-.js → p-_LI2ymhS.js} +2 -2
- package/dist/components/p-_LI2ymhS.js.map +1 -0
- package/dist/components/{p-U1A-rprN.js → p-uMN1Ppw2.js} +2 -2
- package/dist/components/{p-X1N_ggsY.js → p-vW9EMP8s.js} +2 -2
- package/dist/types/components/AppShell/AppShell.d.ts +25 -0
- package/dist/types/{.stencil → components}/BarNav/BarNav.d.ts +6 -17
- package/dist/types/components/BarNav/bar-nav-types.d.ts +14 -0
- package/dist/types/{.stencil → components}/BarNav/bar-nav-utils.d.ts +1 -1
- package/dist/types/components/BarNav/index.d.ts +3 -0
- package/dist/types/{.stencil → components}/BarNavAction/BarNavAction.d.ts +1 -1
- package/dist/types/{.stencil → components}/PanelNav/PanelNav.d.ts +11 -26
- package/dist/types/components/PanelNav/index.d.ts +4 -0
- package/dist/types/components/PanelNav/panel-nav-types.d.ts +20 -0
- package/dist/types/components/PanelNav/panel-nav-utils.d.ts +26 -0
- package/dist/types/{.stencil → components}/TabGroupNav/TabGroupNav.d.ts +1 -1
- package/dist/types/components.d.ts +78 -28
- package/dist/types/nav/index.d.ts +7 -0
- package/dist/types/nav/nav-chrome.d.ts +14 -0
- package/dist/types/nav/shell-gradient.d.ts +25 -0
- package/dist/types/nav/shell-view-transition.d.ts +21 -0
- package/package.json +9 -4
- package/src/angular/index.ts +1 -0
- package/src/angular/proxies.ts +27 -4
- package/src/react/components.ts +1 -0
- package/src/react/ds-app-shell.ts +26 -0
- package/src/wc/components/AppShell/AppShell.tsx +180 -0
- package/src/wc/components/BarNav/BarNav.tsx +18 -26
- package/src/wc/components/BarNav/bar-nav-types.ts +15 -0
- package/src/wc/components/BarNav/bar-nav-utils.ts +1 -1
- package/src/wc/components/BarNav/index.ts +2 -1
- package/src/wc/components/BarNavAction/BarNavAction.tsx +2 -1
- package/src/wc/components/PanelNav/PanelNav.tsx +46 -90
- package/src/wc/components/PanelNav/index.ts +9 -4
- package/src/wc/components/PanelNav/panel-nav-types.ts +22 -0
- package/src/wc/components/PanelNav/panel-nav-utils.ts +32 -64
- package/src/wc/components/TabGroupNav/TabGroupNav.tsx +8 -2
- package/src/wc/components.d.ts +78 -28
- package/src/wc/nav/index.ts +33 -0
- package/src/wc/nav/nav-chrome.ts +45 -0
- package/src/wc/nav/shell-gradient.ts +44 -0
- package/src/wc/nav/shell-view-transition.ts +102 -0
- package/dist/components/p-DOtcc9UU.js +0 -2
- package/dist/components/p-DOtcc9UU.js.map +0 -1
- package/dist/components/p-qfvbc9w-.js.map +0 -1
- package/dist/types/.stencil/BarNav/index.d.ts +0 -2
- package/dist/types/.stencil/PanelNav/index.d.ts +0 -3
- package/dist/types/.stencil/PanelNav/panel-nav-utils.d.ts +0 -27
- /package/dist/components/{p-COsKOwZR.js.map → p--YDw8Q4o.js.map} +0 -0
- /package/dist/components/{p-OT-Q-NxH.js.map → p-C9za7IDu.js.map} +0 -0
- /package/dist/components/{p-DrDrPeVV.js.map → p-DqBCQRRd.js.map} +0 -0
- /package/dist/components/{p-U1A-rprN.js.map → p-uMN1Ppw2.js.map} +0 -0
- /package/dist/components/{p-X1N_ggsY.js.map → p-vW9EMP8s.js.map} +0 -0
- /package/dist/types/{.stencil → components}/Accordion/Accordion.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Badge/Badge.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Badge/index.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Banner/Banner.d.ts +0 -0
- /package/dist/types/{.stencil → components}/BarNav/bar-nav-dom-utils.d.ts +0 -0
- /package/dist/types/{.stencil → components}/BarNav/bar-nav-tabs-menu-utils.d.ts +0 -0
- /package/dist/types/{.stencil → components}/BarNavAction/index.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Breadcrumb/Breadcrumb.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Button/Button.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Button/index.d.ts +0 -0
- /package/dist/types/{.stencil → components}/ButtonGroup/ButtonGroup.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Card/Card.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Checkbox/Checkbox.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Checkbox/index.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Chip/Chip.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Chip/index.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Divider/Divider.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Divider/index.d.ts +0 -0
- /package/dist/types/{.stencil → components}/EmptyState/EmptyState.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Fade/Fade.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Fade/index.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Field/Field.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Header/Header.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Icon/Icon.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Icon/flag-icon-catalog.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Icon/index.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Icon/system-icon-catalog.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Input/Input.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Input/index.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Loader/Loader.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Loader/index.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Menu/Menu.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Modal/Modal.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Pagination/Pagination.d.ts +0 -0
- /package/dist/types/{.stencil → components}/RadioGroup/RadioGroup.d.ts +0 -0
- /package/dist/types/{.stencil → components}/RadioGroup/index.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Scrollbar/Scrollbar.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Select/Select.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Sidebar/Sidebar.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Skeleton/Skeleton.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Skeleton/index.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Slider/Slider.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Slider/index.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Surface/Surface.d.ts +0 -0
- /package/dist/types/{.stencil → components}/TabGroup/TabGroup.d.ts +0 -0
- /package/dist/types/{.stencil → components}/TabGroup/tab-item-utils.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Table/Table.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Tag/Tag.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Tag/index.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Text/Text.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Text/index.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Toast/Toast.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Toast/toast-service.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Toggle/Toggle.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Toggle/index.d.ts +0 -0
- /package/dist/types/{.stencil → components}/ToggleButton/ToggleButton.d.ts +0 -0
- /package/dist/types/{.stencil → components}/ToggleButtonGroup/ToggleButtonGroup.d.ts +0 -0
- /package/dist/types/{.stencil → components}/Tooltip/Tooltip.d.ts +0 -0
package/src/angular/proxies.ts
CHANGED
|
@@ -35,6 +35,29 @@ export declare interface DsAccordion extends Components.DsAccordion {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
|
|
38
|
+
@ProxyCmp({
|
|
39
|
+
inputs: ['gradient', 'gradientSrc', 'navStyle']
|
|
40
|
+
})
|
|
41
|
+
@Component({
|
|
42
|
+
selector: 'ds-app-shell',
|
|
43
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
44
|
+
template: '<ng-content></ng-content>',
|
|
45
|
+
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
|
|
46
|
+
inputs: ['gradient', 'gradientSrc', 'navStyle'],
|
|
47
|
+
standalone: false
|
|
48
|
+
})
|
|
49
|
+
export class DsAppShell {
|
|
50
|
+
protected el: HTMLDsAppShellElement;
|
|
51
|
+
constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) {
|
|
52
|
+
c.detach();
|
|
53
|
+
this.el = r.nativeElement;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
export declare interface DsAppShell extends Components.DsAppShell {}
|
|
59
|
+
|
|
60
|
+
|
|
38
61
|
@ProxyCmp({
|
|
39
62
|
inputs: ['background', 'count', 'isSelected', 'label', 'max', 'surface', 'variant']
|
|
40
63
|
})
|
|
@@ -87,14 +110,14 @@ export declare interface DsBanner extends Components.DsBanner {
|
|
|
87
110
|
|
|
88
111
|
|
|
89
112
|
@ProxyCmp({
|
|
90
|
-
inputs: ['actions', 'actionsJson', '
|
|
113
|
+
inputs: ['actions', 'actionsJson', 'basePath', 'currentUrl', 'heading', 'navStyle', 'tabs', 'tabsJson', 'value']
|
|
91
114
|
})
|
|
92
115
|
@Component({
|
|
93
116
|
selector: 'ds-bar-nav',
|
|
94
117
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
95
118
|
template: '<ng-content></ng-content>',
|
|
96
119
|
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
|
|
97
|
-
inputs: ['actions', 'actionsJson', '
|
|
120
|
+
inputs: ['actions', 'actionsJson', 'basePath', 'currentUrl', 'heading', 'navStyle', 'tabs', 'tabsJson', 'value'],
|
|
98
121
|
outputs: ['dsTabChange', 'dsActionChange'],
|
|
99
122
|
standalone: false
|
|
100
123
|
})
|
|
@@ -619,14 +642,14 @@ export declare interface DsPagination extends Components.DsPagination {
|
|
|
619
642
|
|
|
620
643
|
|
|
621
644
|
@ProxyCmp({
|
|
622
|
-
inputs: ['activeId', 'breakpoint', 'collapsed', 'currentUrl', 'disableViewTransition', 'groups', 'routerMode', 'storageKey', 'userInitial', 'userName'
|
|
645
|
+
inputs: ['activeId', 'breakpoint', 'collapsed', 'currentUrl', 'disableViewTransition', 'groups', 'navStyle', 'routerMode', 'storageKey', 'userInitial', 'userName']
|
|
623
646
|
})
|
|
624
647
|
@Component({
|
|
625
648
|
selector: 'ds-panel-nav',
|
|
626
649
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
627
650
|
template: '<ng-content></ng-content>',
|
|
628
651
|
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
|
|
629
|
-
inputs: ['activeId', 'breakpoint', 'collapsed', 'currentUrl', 'disableViewTransition', 'groups', 'routerMode', 'storageKey', 'userInitial', 'userName'
|
|
652
|
+
inputs: ['activeId', 'breakpoint', 'collapsed', 'currentUrl', 'disableViewTransition', 'groups', 'navStyle', 'routerMode', 'storageKey', 'userInitial', 'userName'],
|
|
630
653
|
outputs: ['dsNavSelect', 'dsNavToggle', 'dsNavFooterAction', 'dsNavUserAction'],
|
|
631
654
|
standalone: false
|
|
632
655
|
})
|
package/src/react/components.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
/* eslint-disable */
|
|
7
7
|
export { DsAccordion } from "./ds-accordion.js";
|
|
8
|
+
export { DsAppShell } from "./ds-app-shell.js";
|
|
8
9
|
export { DsBadge } from "./ds-badge.js";
|
|
9
10
|
export { DsBanner } from "./ds-banner.js";
|
|
10
11
|
export { DsBarNavAction } from "./ds-bar-nav-action.js";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This file was automatically generated by the Stencil React Output Target.
|
|
5
|
+
* Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/* eslint-disable */
|
|
9
|
+
|
|
10
|
+
import type { StencilReactComponent } from '@stencil/react-output-target/runtime';
|
|
11
|
+
import { createComponent } from '@stencil/react-output-target/runtime';
|
|
12
|
+
import React from 'react';
|
|
13
|
+
|
|
14
|
+
import type { Components } from "@ds-mo/ui/dist/components";
|
|
15
|
+
import { DsAppShell as DsAppShellElement, defineCustomElement as defineDsAppShell } from "@ds-mo/ui/dist/components/ds-app-shell.js";
|
|
16
|
+
|
|
17
|
+
export type DsAppShellEvents = NonNullable<unknown>;
|
|
18
|
+
|
|
19
|
+
export const DsAppShell: StencilReactComponent<DsAppShellElement, DsAppShellEvents, Components.DsAppShell> = /*@__PURE__*/ createComponent<DsAppShellElement, DsAppShellEvents, Components.DsAppShell>({
|
|
20
|
+
tagName: 'ds-app-shell',
|
|
21
|
+
elementClass: DsAppShellElement,
|
|
22
|
+
// @ts-ignore - ignore potential React type mismatches between the Stencil Output Target and your project.
|
|
23
|
+
react: React,
|
|
24
|
+
events: {} as DsAppShellEvents,
|
|
25
|
+
defineCustomElement: defineDsAppShell
|
|
26
|
+
});
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { Component, Prop, Element, Watch, h, Host } from '@stencil/core';
|
|
2
|
+
import type { NavChromeStyle } from '../../nav/nav-chrome';
|
|
3
|
+
import {
|
|
4
|
+
SHELL_GRADIENT_IMAGE_VAR,
|
|
5
|
+
SHELL_GRADIENT_OPACITY,
|
|
6
|
+
SHELL_GRADIENT_OPACITY_VAR,
|
|
7
|
+
SHELL_GRADIENT_POSITION_BAR_VAR,
|
|
8
|
+
SHELL_GRADIENT_POSITION_PANEL_VAR,
|
|
9
|
+
SHELL_GRADIENT_SIZE_VAR,
|
|
10
|
+
shellGradientImageForStyle,
|
|
11
|
+
shellGradientPositionBar,
|
|
12
|
+
shellGradientPositionPanel,
|
|
13
|
+
shellGradientSize,
|
|
14
|
+
} from '../../nav/shell-gradient';
|
|
15
|
+
|
|
16
|
+
@Component({
|
|
17
|
+
tag: 'ds-app-shell',
|
|
18
|
+
styleUrl: 'AppShell.css',
|
|
19
|
+
scoped: true,
|
|
20
|
+
})
|
|
21
|
+
export class AppShell {
|
|
22
|
+
/** Chrome style propagated to slotted `ds-panel-nav` and `ds-bar-nav`. */
|
|
23
|
+
@Prop({ attribute: 'nav-style', reflect: true }) navStyle: NavChromeStyle = 'navigation';
|
|
24
|
+
|
|
25
|
+
/** When `true`, paints the shared L-shaped radial wash on panel + bar backgrounds. */
|
|
26
|
+
@Prop({ reflect: true }) gradient: boolean = false;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Optional custom gradient for `background-image` (e.g. SVG URL).
|
|
30
|
+
* When set, overrides the built-in radial wash.
|
|
31
|
+
*/
|
|
32
|
+
@Prop() gradientSrc: string = '';
|
|
33
|
+
|
|
34
|
+
@Element() el!: HTMLElement;
|
|
35
|
+
|
|
36
|
+
private resizeObserver: ResizeObserver | null = null;
|
|
37
|
+
|
|
38
|
+
componentDidLoad() {
|
|
39
|
+
this.syncSlottedNavStyle();
|
|
40
|
+
this.connectMetricsObserver();
|
|
41
|
+
this.scheduleGradientVars();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
private scheduleGradientVars() {
|
|
45
|
+
this.updateGradientVars();
|
|
46
|
+
requestAnimationFrame(() => this.updateGradientVars());
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
disconnectedCallback() {
|
|
50
|
+
this.resizeObserver?.disconnect();
|
|
51
|
+
this.resizeObserver = null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@Watch('navStyle')
|
|
55
|
+
@Watch('gradient')
|
|
56
|
+
@Watch('gradientSrc')
|
|
57
|
+
onShellPropsChange() {
|
|
58
|
+
this.syncSlottedNavStyle();
|
|
59
|
+
this.scheduleGradientVars();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private connectMetricsObserver() {
|
|
63
|
+
this.resizeObserver = new ResizeObserver(() => this.scheduleGradientVars());
|
|
64
|
+
this.resizeObserver.observe(this.el);
|
|
65
|
+
const panelWrap = this.el.querySelector('.app-shell__panel');
|
|
66
|
+
const barWrap = this.el.querySelector('.app-shell__bar');
|
|
67
|
+
if (panelWrap) this.resizeObserver.observe(panelWrap);
|
|
68
|
+
if (barWrap) this.resizeObserver.observe(barWrap);
|
|
69
|
+
this.scheduleGradientVars();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private applyGradientVars(target: HTMLElement, vars: Record<string, string | null>) {
|
|
73
|
+
const style = target.style;
|
|
74
|
+
for (const [name, value] of Object.entries(vars)) {
|
|
75
|
+
if (value === null) style.removeProperty(name);
|
|
76
|
+
else style.setProperty(name, value);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
private clearGradientVars(targets: HTMLElement[]) {
|
|
81
|
+
const keys = [
|
|
82
|
+
SHELL_GRADIENT_IMAGE_VAR,
|
|
83
|
+
SHELL_GRADIENT_SIZE_VAR,
|
|
84
|
+
SHELL_GRADIENT_POSITION_PANEL_VAR,
|
|
85
|
+
SHELL_GRADIENT_POSITION_BAR_VAR,
|
|
86
|
+
SHELL_GRADIENT_OPACITY_VAR,
|
|
87
|
+
];
|
|
88
|
+
for (const target of targets) {
|
|
89
|
+
for (const key of keys) target.style.removeProperty(key);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
private syncSlottedNavStyle() {
|
|
94
|
+
const panel = this.el.querySelector('ds-panel-nav') as (HTMLElement & { navStyle: NavChromeStyle }) | null;
|
|
95
|
+
const bar = this.el.querySelector('ds-bar-nav') as (HTMLElement & { navStyle: NavChromeStyle }) | null;
|
|
96
|
+
if (panel) {
|
|
97
|
+
panel.setAttribute('nav-style', this.navStyle);
|
|
98
|
+
panel.navStyle = this.navStyle;
|
|
99
|
+
}
|
|
100
|
+
if (bar) {
|
|
101
|
+
bar.setAttribute('nav-style', this.navStyle);
|
|
102
|
+
bar.navStyle = this.navStyle;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
private updateGradientVars() {
|
|
107
|
+
const panel = this.el.querySelector('ds-panel-nav') as HTMLElement | null;
|
|
108
|
+
const bar = this.el.querySelector('ds-bar-nav') as HTMLElement | null;
|
|
109
|
+
const targets = [this.el, panel, bar].filter((el): el is HTMLElement => el !== null);
|
|
110
|
+
|
|
111
|
+
if (!this.gradient) {
|
|
112
|
+
this.clearGradientVars(targets);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const image = this.gradientSrc.trim()
|
|
117
|
+
? `url(${this.gradientSrc.trim()})`
|
|
118
|
+
: shellGradientImageForStyle(this.navStyle);
|
|
119
|
+
|
|
120
|
+
const shellRect = this.el.getBoundingClientRect();
|
|
121
|
+
const panelWrap = this.el.querySelector('.app-shell__panel') as HTMLElement | null;
|
|
122
|
+
const panelWidth = panelWrap?.getBoundingClientRect().width ?? 0;
|
|
123
|
+
|
|
124
|
+
const size = shellGradientSize({
|
|
125
|
+
width: shellRect.width,
|
|
126
|
+
height: shellRect.height,
|
|
127
|
+
panelWidth,
|
|
128
|
+
});
|
|
129
|
+
const panelPosition = shellGradientPositionPanel();
|
|
130
|
+
const barPosition = shellGradientPositionBar(panelWidth);
|
|
131
|
+
const opacity = SHELL_GRADIENT_OPACITY;
|
|
132
|
+
|
|
133
|
+
for (const target of targets) {
|
|
134
|
+
if (target === this.el) {
|
|
135
|
+
this.applyGradientVars(target, {
|
|
136
|
+
[SHELL_GRADIENT_IMAGE_VAR]: image,
|
|
137
|
+
[SHELL_GRADIENT_SIZE_VAR]: size,
|
|
138
|
+
[SHELL_GRADIENT_POSITION_PANEL_VAR]: panelPosition,
|
|
139
|
+
[SHELL_GRADIENT_POSITION_BAR_VAR]: barPosition,
|
|
140
|
+
[SHELL_GRADIENT_OPACITY_VAR]: opacity,
|
|
141
|
+
});
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const isBar = target.tagName.toLowerCase() === 'ds-bar-nav';
|
|
146
|
+
this.applyGradientVars(target, {
|
|
147
|
+
[SHELL_GRADIENT_IMAGE_VAR]: image,
|
|
148
|
+
[SHELL_GRADIENT_SIZE_VAR]: size,
|
|
149
|
+
[SHELL_GRADIENT_OPACITY_VAR]: opacity,
|
|
150
|
+
[SHELL_GRADIENT_POSITION_PANEL_VAR]: isBar ? null : panelPosition,
|
|
151
|
+
[SHELL_GRADIENT_POSITION_BAR_VAR]: isBar ? barPosition : null,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
render() {
|
|
157
|
+
const shellCls: Record<string, boolean> = {
|
|
158
|
+
'app-shell': true,
|
|
159
|
+
'app-shell--gradient': this.gradient,
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
return (
|
|
163
|
+
<Host class={shellCls}>
|
|
164
|
+
<div class="app-shell__row">
|
|
165
|
+
<div class="app-shell__panel">
|
|
166
|
+
<slot name="panel" />
|
|
167
|
+
</div>
|
|
168
|
+
<div class="app-shell__main">
|
|
169
|
+
<div class="app-shell__bar">
|
|
170
|
+
<slot name="bar" />
|
|
171
|
+
</div>
|
|
172
|
+
<div class="app-shell__content">
|
|
173
|
+
<slot />
|
|
174
|
+
</div>
|
|
175
|
+
</div>
|
|
176
|
+
</div>
|
|
177
|
+
</Host>
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
@@ -10,7 +10,9 @@ import {
|
|
|
10
10
|
} from '@stencil/core';
|
|
11
11
|
import type { MenuItemData } from '../Menu/Menu';
|
|
12
12
|
import type { BarNavActionBackground } from '../BarNavAction/BarNavAction';
|
|
13
|
-
import type {
|
|
13
|
+
import type { NavChromeStyle } from '../../nav/nav-chrome';
|
|
14
|
+
import { SHELL_BAR_NAV_VT_NAME } from '../../nav/shell-view-transition';
|
|
15
|
+
import type { BarNavActionItem, BarNavTab } from './bar-nav-types';
|
|
14
16
|
import {
|
|
15
17
|
deriveBarNavValueFromUrl,
|
|
16
18
|
parseJsonArrayProp,
|
|
@@ -28,23 +30,6 @@ import {
|
|
|
28
30
|
tabsToMenuSections,
|
|
29
31
|
} from './bar-nav-tabs-menu-utils';
|
|
30
32
|
|
|
31
|
-
export type BarNavBackground = 'primary' | 'secondary' | 'transparent' | 'translucent';
|
|
32
|
-
|
|
33
|
-
/** Same shape as `TabItem` — supports `{ type: 'divider' }` between tab groups. */
|
|
34
|
-
export type BarNavTab = TabItem;
|
|
35
|
-
|
|
36
|
-
export interface BarNavActionItem {
|
|
37
|
-
id: string;
|
|
38
|
-
/** Icon name for <ds-icon>. */
|
|
39
|
-
icon: string;
|
|
40
|
-
/** Whether this action button is currently pressed/active. */
|
|
41
|
-
selected?: boolean;
|
|
42
|
-
/** Show a notification dot. */
|
|
43
|
-
dot?: boolean;
|
|
44
|
-
inactive?: boolean;
|
|
45
|
-
ariaLabel?: string;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
33
|
@Component({
|
|
49
34
|
tag: 'ds-bar-nav',
|
|
50
35
|
styleUrl: 'BarNav.css',
|
|
@@ -78,8 +63,9 @@ export class BarNav {
|
|
|
78
63
|
*/
|
|
79
64
|
@Prop() heading: string | undefined;
|
|
80
65
|
|
|
81
|
-
/**
|
|
82
|
-
|
|
66
|
+
/** Chrome style: `navigation` = navigation tokens, `default` = app tokens.
|
|
67
|
+
* Property: `navStyle`. HTML attribute: `nav-style`. */
|
|
68
|
+
@Prop({ attribute: 'nav-style', reflect: true }) navStyle: NavChromeStyle = 'default';
|
|
83
69
|
|
|
84
70
|
/** Section base path (e.g. `/dashboard/safety`). Used with `currentUrl` to derive `value`. */
|
|
85
71
|
@Prop() basePath: string = '';
|
|
@@ -455,20 +441,24 @@ export class BarNav {
|
|
|
455
441
|
}
|
|
456
442
|
}
|
|
457
443
|
|
|
444
|
+
private get tabSurface(): BarNavActionBackground | undefined {
|
|
445
|
+
return this.navStyle === 'navigation' ? 'navigation' : undefined;
|
|
446
|
+
}
|
|
447
|
+
|
|
458
448
|
render() {
|
|
459
449
|
const hasTabs = this.resolvedTabs.length > 0 && !this.hideTabsForDetailRoute;
|
|
460
|
-
|
|
461
|
-
const bgToActionBg: Partial<Record<BarNavBackground, BarNavActionBackground>> = {};
|
|
462
|
-
const actionBg: BarNavActionBackground | undefined = bgToActionBg[this.background];
|
|
450
|
+
const tabSurface = this.tabSurface;
|
|
463
451
|
|
|
464
452
|
return (
|
|
465
453
|
<Host>
|
|
466
454
|
<header
|
|
467
455
|
class={{
|
|
468
456
|
'bar-nav': true,
|
|
469
|
-
|
|
457
|
+
'bar-nav--navigation': this.navStyle === 'navigation',
|
|
458
|
+
'bar-nav--default': this.navStyle === 'default',
|
|
470
459
|
'bar-nav--tabs-collapsed': hasTabs && this.tabsCollapsed,
|
|
471
460
|
}}
|
|
461
|
+
style={{ viewTransitionName: SHELL_BAR_NAV_VT_NAME }}
|
|
472
462
|
ref={el => {
|
|
473
463
|
this.headerEl = el as HTMLElement;
|
|
474
464
|
if (el && !this.resizeObserver) {
|
|
@@ -488,6 +478,7 @@ export class BarNav {
|
|
|
488
478
|
}}
|
|
489
479
|
tabs={this.resolvedTabs}
|
|
490
480
|
value={this.effectiveValue}
|
|
481
|
+
background={tabSurface}
|
|
491
482
|
/>
|
|
492
483
|
</div>
|
|
493
484
|
)}
|
|
@@ -501,6 +492,7 @@ export class BarNav {
|
|
|
501
492
|
}}
|
|
502
493
|
tabs={this.resolvedTabs}
|
|
503
494
|
value={this.effectiveValue}
|
|
495
|
+
background={tabSurface}
|
|
504
496
|
onDsChange={(e: Event) => this.handleTabChange(e)}
|
|
505
497
|
/>
|
|
506
498
|
</div>
|
|
@@ -554,7 +546,7 @@ export class BarNav {
|
|
|
554
546
|
<ds-badge
|
|
555
547
|
class="bar-nav__tab-trigger-dot"
|
|
556
548
|
variant="dot"
|
|
557
|
-
background="var(--
|
|
549
|
+
background="var(--_bar-nav-bg)"
|
|
558
550
|
label=""
|
|
559
551
|
aria-hidden="true"
|
|
560
552
|
/>
|
|
@@ -583,7 +575,7 @@ export class BarNav {
|
|
|
583
575
|
dot={action.dot ?? false}
|
|
584
576
|
inactive={action.inactive}
|
|
585
577
|
aria-label={action.ariaLabel ?? action.id}
|
|
586
|
-
background={
|
|
578
|
+
background={tabSurface}
|
|
587
579
|
onDsChange={(e: Event) => this.handleActionChange(action.id, e)}
|
|
588
580
|
/>
|
|
589
581
|
))}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TabItem } from '../TabGroup/tab-item-utils';
|
|
2
|
+
|
|
3
|
+
export type BarNavTab = TabItem;
|
|
4
|
+
|
|
5
|
+
export interface BarNavActionItem {
|
|
6
|
+
id: string;
|
|
7
|
+
/** Icon name for <ds-icon>. */
|
|
8
|
+
icon: string;
|
|
9
|
+
/** Whether this action button is currently pressed/active. */
|
|
10
|
+
selected?: boolean;
|
|
11
|
+
/** Show a notification dot. */
|
|
12
|
+
dot?: boolean;
|
|
13
|
+
inactive?: boolean;
|
|
14
|
+
ariaLabel?: string;
|
|
15
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getSelectableTabs } from '../TabGroup/tab-item-utils';
|
|
2
|
-
import type { BarNavActionItem, BarNavTab } from './
|
|
2
|
+
import type { BarNavActionItem, BarNavTab } from './bar-nav-types';
|
|
3
3
|
|
|
4
4
|
export interface BarNavUrlState {
|
|
5
5
|
/** Tab id derived from the URL, or empty when none applies. */
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type { BarNavTab, BarNavActionItem } from './bar-nav-types';
|
|
2
|
+
export type { NavChromeStyle } from '../../nav/nav-chrome';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component, Prop, Event, EventEmitter, h, Host } from '@stencil/core';
|
|
2
2
|
|
|
3
|
-
export type BarNavActionBackground = 'faint' | 'medium' | 'bold' | 'strong' | 'always-dark';
|
|
3
|
+
export type BarNavActionBackground = 'faint' | 'medium' | 'bold' | 'strong' | 'always-dark' | 'navigation';
|
|
4
4
|
|
|
5
5
|
@Component({
|
|
6
6
|
tag: 'ds-bar-nav-action',
|
|
@@ -44,6 +44,7 @@ export class BarNavAction {
|
|
|
44
44
|
onBold: bg === 'bold',
|
|
45
45
|
onStrong: bg === 'strong',
|
|
46
46
|
onAlwaysDark: bg === 'always-dark',
|
|
47
|
+
onNavigation: bg === 'navigation',
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
return (
|