@ds-mo/ui 1.0.2 → 1.2.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 +0 -1
- 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-card.js.map +1 -1
- package/dist/components/ds-checkbox.js +1 -1
- package/dist/components/ds-divider.js +1 -1
- package/dist/components/ds-divider.js.map +1 -1
- package/dist/components/ds-empty-state.js +1 -1
- package/dist/components/ds-empty-state.js.map +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-header.js.map +1 -1
- package/dist/components/ds-icon.js +1 -1
- package/dist/components/ds-input.js +1 -1
- package/dist/components/ds-menu.js +1 -1
- package/dist/components/ds-panel-nav.js +1 -1
- package/dist/components/ds-select.js +1 -1
- package/dist/components/ds-slider.js +1 -1
- package/dist/components/{ds-label-wrap.d.ts → ds-tab-group-nav.d.ts} +4 -4
- package/dist/components/ds-tab-group-nav.js +2 -0
- package/dist/components/ds-tab-group-nav.js.map +1 -0
- package/dist/components/ds-tab-group.js +1 -1
- package/dist/components/ds-tab-group.js.map +1 -1
- package/dist/components/ds-table.js +1 -1
- package/dist/components/ds-table.js.map +1 -1
- package/dist/components/ds-tag.js +1 -1
- package/dist/components/ds-text.js +1 -1
- package/dist/components/ds-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/p-BQq26pt9.js +2 -0
- package/dist/components/p-BQq26pt9.js.map +1 -0
- package/dist/components/{p-DouEVPmi.js → p-CE5zeV1w.js} +2 -2
- package/dist/components/{p-D3CwGoIu.js → p-COsKOwZR.js} +2 -2
- package/dist/components/p-CQQe6VNo.js +2 -0
- package/dist/components/p-CQQe6VNo.js.map +1 -0
- package/dist/components/p-Cj00JkJb.js +2 -0
- package/dist/components/p-Cj00JkJb.js.map +1 -0
- package/dist/components/p-CpbnmEu1.js +2 -0
- package/dist/components/p-CpbnmEu1.js.map +1 -0
- package/dist/components/{p-BvxKLqNx.js → p-H89PzqGU.js} +2 -2
- package/dist/components/{p-BYe8Rfdg.js → p-Vwlmhl4E.js} +2 -2
- package/dist/types/.stencil/BarNav/BarNav.d.ts +7 -2
- package/dist/types/.stencil/BarNav/bar-nav-dom-utils.d.ts +1 -2
- package/dist/types/.stencil/Divider/Divider.d.ts +14 -0
- package/dist/types/.stencil/TabGroupNav/TabGroupNav.d.ts +27 -0
- package/dist/types/.stencil/Text/Text.d.ts +2 -0
- package/dist/types/components.d.ts +125 -63
- package/package.json +37 -7
- package/src/angular/index.ts +1 -1
- package/src/angular/proxies.ts +32 -27
- package/src/react/components.ts +45 -0
- package/src/react/ds-accordion.ts +27 -0
- package/src/react/ds-badge.ts +26 -0
- package/src/react/ds-banner.ts +27 -0
- package/src/react/ds-bar-nav-action.ts +27 -0
- package/src/react/ds-bar-nav.ts +33 -0
- package/src/react/ds-breadcrumb.ts +27 -0
- package/src/react/ds-button-group.ts +27 -0
- package/src/react/ds-button.ts +35 -0
- package/src/react/ds-card.ts +26 -0
- package/src/react/ds-checkbox.ts +27 -0
- package/src/react/ds-divider.ts +26 -0
- package/src/react/ds-empty-state.ts +26 -0
- package/src/react/ds-fade.ts +26 -0
- package/src/react/ds-field.ts +26 -0
- package/src/react/ds-header.ts +26 -0
- package/src/react/ds-icon.ts +26 -0
- package/src/react/ds-input.ts +33 -0
- package/src/react/ds-loader.ts +26 -0
- package/src/react/ds-menu.ts +33 -0
- package/src/react/ds-modal.ts +27 -0
- package/src/react/ds-pagination.ts +27 -0
- package/src/react/ds-panel-nav.ts +37 -0
- package/src/react/ds-radio-group.ts +27 -0
- package/src/react/ds-scrollbar.ts +26 -0
- package/src/react/ds-select.ts +27 -0
- package/src/react/ds-sidebar.ts +33 -0
- package/src/react/ds-skeleton.ts +26 -0
- package/src/react/ds-slider.ts +27 -0
- package/src/react/ds-surface.ts +26 -0
- package/src/react/ds-tab-group-nav.ts +27 -0
- package/src/react/ds-tab-group.ts +27 -0
- package/src/react/ds-table.ts +35 -0
- package/src/react/ds-tag.ts +35 -0
- package/src/react/ds-text.ts +26 -0
- package/src/react/ds-toast-provider.ts +26 -0
- package/src/react/ds-toggle-button-group.ts +27 -0
- package/src/react/ds-toggle-button.ts +27 -0
- package/src/react/ds-toggle.ts +27 -0
- package/src/react/ds-tooltip.ts +26 -0
- package/src/wc/components/Accordion/Accordion.tsx +144 -0
- package/src/wc/components/Badge/Badge.tsx +34 -0
- package/src/wc/components/Badge/index.ts +1 -0
- package/src/wc/components/Banner/Banner.tsx +148 -0
- package/src/wc/components/BarNav/BarNav.tsx +605 -0
- package/src/wc/components/BarNav/bar-nav-dom-utils.ts +23 -0
- package/src/wc/components/BarNav/bar-nav-tabs-menu-utils.ts +59 -0
- package/src/wc/components/BarNav/bar-nav-utils.ts +76 -0
- package/src/wc/components/BarNav/index.ts +1 -0
- package/src/wc/components/BarNavAction/BarNavAction.tsx +67 -0
- package/src/wc/components/BarNavAction/index.ts +1 -0
- package/src/wc/components/Breadcrumb/Breadcrumb.tsx +61 -0
- package/src/wc/components/Button/Button.tsx +158 -0
- package/src/wc/components/Button/index.ts +1 -0
- package/src/wc/components/ButtonGroup/ButtonGroup.tsx +110 -0
- package/src/wc/components/Card/Card.tsx +26 -0
- package/src/wc/components/Checkbox/Checkbox.tsx +60 -0
- package/src/wc/components/Checkbox/index.ts +1 -0
- package/src/wc/components/Divider/Divider.tsx +107 -0
- package/src/wc/components/Divider/index.ts +2 -0
- package/src/wc/components/EmptyState/EmptyState.tsx +32 -0
- package/src/wc/components/Fade/Fade.tsx +32 -0
- package/src/wc/components/Fade/index.ts +1 -0
- package/src/wc/components/Field/Field.tsx +28 -0
- package/src/wc/components/Header/Header.tsx +33 -0
- package/src/wc/components/Icon/Icon.tsx +112 -0
- package/src/wc/components/Icon/flag-icon-catalog.ts +68 -0
- package/src/wc/components/Icon/index.ts +1 -0
- package/src/wc/components/Icon/system-icon-catalog.ts +798 -0
- package/src/wc/components/Input/Input.tsx +100 -0
- package/src/wc/components/Input/index.ts +1 -0
- package/src/wc/components/Loader/Loader.tsx +47 -0
- package/src/wc/components/Loader/index.ts +1 -0
- package/src/wc/components/Menu/Menu.tsx +340 -0
- package/src/wc/components/Modal/Modal.tsx +197 -0
- package/src/wc/components/Pagination/Pagination.tsx +97 -0
- package/src/wc/components/PanelNav/PanelNav.tsx +666 -0
- package/src/wc/components/PanelNav/index.ts +7 -0
- package/src/wc/components/PanelNav/panel-nav-utils.ts +124 -0
- package/src/wc/components/RadioGroup/RadioGroup.tsx +128 -0
- package/src/wc/components/RadioGroup/index.ts +1 -0
- package/src/wc/components/Scrollbar/Scrollbar.tsx +189 -0
- package/src/wc/components/Select/Select.tsx +195 -0
- package/src/wc/components/Sidebar/Sidebar.tsx +245 -0
- package/src/wc/components/Skeleton/Skeleton.tsx +64 -0
- package/src/wc/components/Skeleton/index.ts +1 -0
- package/src/wc/components/Slider/Slider.tsx +68 -0
- package/src/wc/components/Slider/index.ts +1 -0
- package/src/wc/components/Surface/Surface.tsx +81 -0
- package/src/wc/components/TabGroup/TabGroup.tsx +188 -0
- package/src/wc/components/TabGroup/tab-item-utils.ts +24 -0
- package/src/wc/components/TabGroupNav/TabGroupNav.tsx +188 -0
- package/src/wc/components/Table/Table.tsx +268 -0
- package/src/wc/components/Tag/Tag.tsx +135 -0
- package/src/wc/components/Tag/index.ts +1 -0
- package/src/wc/components/Text/Text.tsx +103 -0
- package/src/wc/components/Text/index.ts +1 -0
- package/src/wc/components/Toast/Toast.tsx +174 -0
- package/src/wc/components/Toast/toast-service.ts +60 -0
- package/src/wc/components/Toggle/Toggle.tsx +43 -0
- package/src/wc/components/Toggle/index.ts +1 -0
- package/src/wc/components/ToggleButton/ToggleButton.tsx +120 -0
- package/src/wc/components/ToggleButtonGroup/ToggleButtonGroup.tsx +118 -0
- package/src/wc/components/Tooltip/Tooltip.tsx +196 -0
- package/src/wc/components.d.ts +3022 -0
- package/dist/components/ds-label-wrap.js +0 -2
- package/dist/components/ds-label-wrap.js.map +0 -1
- package/dist/components/p-C4p1fG67.js +0 -2
- package/dist/components/p-C4p1fG67.js.map +0 -1
- package/dist/components/p-DV8pmt1m.js +0 -2
- package/dist/components/p-DV8pmt1m.js.map +0 -1
- package/dist/components/p-STnE_bmQ.js +0 -2
- package/dist/components/p-STnE_bmQ.js.map +0 -1
- package/dist/types/.stencil/LabelWrap/LabelWrap.d.ts +0 -15
- /package/dist/components/{p-DouEVPmi.js.map → p-CE5zeV1w.js.map} +0 -0
- /package/dist/components/{p-D3CwGoIu.js.map → p-COsKOwZR.js.map} +0 -0
- /package/dist/components/{p-BvxKLqNx.js.map → p-H89PzqGU.js.map} +0 -0
- /package/dist/components/{p-BYe8Rfdg.js.map → p-Vwlmhl4E.js.map} +0 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { Component, Prop, State, Event, EventEmitter, Watch, h, Host } from '@stencil/core';
|
|
2
|
+
|
|
3
|
+
export type BannerIntent =
|
|
4
|
+
| 'brand' | 'positive' | 'negative' | 'warning' | 'caution'
|
|
5
|
+
| 'ai' | 'neutral' | 'walkthrough' | 'guide';
|
|
6
|
+
|
|
7
|
+
export type BannerContrast = 'faint' | 'medium' | 'bold' | 'strong';
|
|
8
|
+
|
|
9
|
+
const FADE_OUT_MS = 200;
|
|
10
|
+
const AUTO_DISMISS_MS = 4000;
|
|
11
|
+
|
|
12
|
+
@Component({
|
|
13
|
+
tag: 'ds-banner',
|
|
14
|
+
styleUrl: 'Banner.css',
|
|
15
|
+
scoped: true,
|
|
16
|
+
})
|
|
17
|
+
export class Banner {
|
|
18
|
+
@Prop() intent: BannerIntent = 'neutral';
|
|
19
|
+
@Prop() contrast: BannerContrast = 'medium';
|
|
20
|
+
@Prop() message: string = '';
|
|
21
|
+
/** Renders the diagonal-stripe accent bar above the body. */
|
|
22
|
+
@Prop() header: boolean = false;
|
|
23
|
+
/** Renders at a fixed position (centered top) and auto-dismisses after 4 s. */
|
|
24
|
+
@Prop() floating: boolean = false;
|
|
25
|
+
@Prop() showDismiss: boolean = false;
|
|
26
|
+
@Prop() dismissLabel: string = 'Dismiss';
|
|
27
|
+
|
|
28
|
+
@State() private closing: boolean = false;
|
|
29
|
+
|
|
30
|
+
@Event() dsDismiss!: EventEmitter<void>;
|
|
31
|
+
|
|
32
|
+
private dismissTimer: ReturnType<typeof setTimeout> | null = null;
|
|
33
|
+
private closeTimer: ReturnType<typeof setTimeout> | null = null;
|
|
34
|
+
|
|
35
|
+
componentDidLoad() {
|
|
36
|
+
if (this.floating && this.message) this.scheduleDismiss();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@Watch('message')
|
|
40
|
+
onMessageChange(newVal: string) {
|
|
41
|
+
if (this.floating && newVal) {
|
|
42
|
+
this.closing = false;
|
|
43
|
+
this.scheduleDismiss();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
disconnectedCallback() {
|
|
48
|
+
this.clearTimers();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
private clearTimers() {
|
|
52
|
+
if (this.dismissTimer) { clearTimeout(this.dismissTimer); this.dismissTimer = null; }
|
|
53
|
+
if (this.closeTimer) { clearTimeout(this.closeTimer); this.closeTimer = null; }
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
private scheduleDismiss() {
|
|
57
|
+
this.clearTimers();
|
|
58
|
+
this.dismissTimer = setTimeout(() => {
|
|
59
|
+
this.dismissTimer = null;
|
|
60
|
+
this.beginClose();
|
|
61
|
+
}, AUTO_DISMISS_MS);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
private beginClose() {
|
|
65
|
+
this.clearTimers();
|
|
66
|
+
if (this.floating) {
|
|
67
|
+
this.closing = true;
|
|
68
|
+
this.closeTimer = setTimeout(() => {
|
|
69
|
+
this.closing = false;
|
|
70
|
+
this.closeTimer = null;
|
|
71
|
+
this.dsDismiss.emit();
|
|
72
|
+
}, FADE_OUT_MS);
|
|
73
|
+
} else {
|
|
74
|
+
this.dsDismiss.emit();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
private getContentColor(): string {
|
|
79
|
+
if (this.contrast === 'bold') return 'var(--color-foreground-on-bold-background-primary)';
|
|
80
|
+
const c = this.contrast === 'faint' ? 'bold' : this.contrast === 'medium' ? 'strong' : 'medium';
|
|
81
|
+
return `var(--color-foreground-${c}-${this.intent})`;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
private getBg(): string {
|
|
85
|
+
return `var(--color-background-${this.contrast}-${this.intent})`;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private getElevation(): string {
|
|
89
|
+
return this.floating
|
|
90
|
+
? 'var(--effect-elevation-elevated-floating, var(--effect-elevation-floating))'
|
|
91
|
+
: 'var(--effect-elevation-elevated)';
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
render() {
|
|
95
|
+
const contentColor = this.getContentColor();
|
|
96
|
+
const isAssertive = this.intent === 'negative';
|
|
97
|
+
|
|
98
|
+
const bannerEl = (
|
|
99
|
+
<div
|
|
100
|
+
class={{ 'banner-wrapper': true }}
|
|
101
|
+
style={{ '--banner-content': contentColor } as { [key: string]: string }}
|
|
102
|
+
role={isAssertive ? 'alert' : 'status'}
|
|
103
|
+
aria-live={isAssertive ? undefined : 'polite'}
|
|
104
|
+
>
|
|
105
|
+
<div
|
|
106
|
+
class="banner-surface"
|
|
107
|
+
style={{
|
|
108
|
+
backgroundColor: this.getBg(),
|
|
109
|
+
boxShadow: this.getElevation(),
|
|
110
|
+
}}
|
|
111
|
+
>
|
|
112
|
+
{this.header && (
|
|
113
|
+
<div class="banner-header-surface">
|
|
114
|
+
<div class="banner-header" />
|
|
115
|
+
</div>
|
|
116
|
+
)}
|
|
117
|
+
<div class="banner-body">
|
|
118
|
+
<span class="text-body-medium banner-message">{this.message}</span>
|
|
119
|
+
{this.showDismiss && (
|
|
120
|
+
<button
|
|
121
|
+
type="button"
|
|
122
|
+
class="banner-dismiss"
|
|
123
|
+
onClick={() => this.beginClose()}
|
|
124
|
+
aria-label={this.dismissLabel}
|
|
125
|
+
>
|
|
126
|
+
×
|
|
127
|
+
</button>
|
|
128
|
+
)}
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
if (this.floating) {
|
|
135
|
+
return (
|
|
136
|
+
<Host style={{ display: 'contents' }}>
|
|
137
|
+
<div class="floating-position" style={{ zIndex: '9998' }}>
|
|
138
|
+
<div class={{ 'floating-toast': true, 'floating-toast--closing': this.closing }}>
|
|
139
|
+
{bannerEl}
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
142
|
+
</Host>
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return <Host style={{ display: 'contents' }}>{bannerEl}</Host>;
|
|
147
|
+
}
|
|
148
|
+
}
|