@reliability-design/web 1.1.1 → 1.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/dist/components/rel-accordion/rel-accordion.ts +289 -150
- package/dist/components/rel-alert/rel-alert.ts +34 -34
- package/dist/components/rel-avatar/README.md +15 -4
- package/dist/components/rel-avatar/rel-avatar.ts +138 -94
- package/dist/components/rel-badge/README.md +7 -0
- package/dist/components/rel-badge/rel-badge.ts +39 -2
- package/dist/components/rel-breadcrumb/rel-breadcrumb.ts +6 -6
- package/dist/components/rel-button/rel-button.ts +96 -28
- package/dist/components/rel-calendar/rel-calendar.ts +15 -8
- package/dist/components/rel-card/rel-card.ts +9 -17
- package/dist/components/rel-cardmedia/rel-cardmedia.ts +20 -23
- package/dist/components/rel-carousel/rel-carousel.ts +596 -468
- package/dist/components/rel-checkbox/rel-checkbox.ts +68 -16
- package/dist/components/rel-chip/README.md +7 -0
- package/dist/components/rel-chip/rel-chip.ts +411 -244
- package/dist/components/rel-container/rel-container.ts +2 -2
- package/dist/components/rel-date-picker/rel-date-picker.ts +23 -19
- package/dist/components/rel-divider/rel-divider.ts +3 -3
- package/dist/components/rel-drawer/rel-drawer-footer.ts +0 -2
- package/dist/components/rel-drawer/rel-drawer.ts +46 -90
- package/dist/components/rel-kbd/rel-kbd.ts +94 -118
- package/dist/components/rel-layout/rel-layout.ts +49 -58
- package/dist/components/rel-menu/rel-menu.ts +359 -359
- package/dist/components/rel-menubar/rel-menubar-menu.css +3 -0
- package/dist/components/rel-menubar/rel-menubar-menu.ts +2 -1
- package/dist/components/rel-menubar/rel-menubar.ts +603 -605
- package/dist/components/rel-otp/rel-otp.ts +22 -25
- package/dist/components/rel-pagination/rel-pagination.ts +442 -381
- package/dist/components/rel-popover/rel-popover-content.ts +6 -5
- package/dist/components/rel-popover/rel-popover.ts +26 -7
- package/dist/components/rel-progress/rel-progress.ts +10 -9
- package/dist/components/rel-radio/rel-radio.ts +228 -172
- package/dist/components/rel-range-picker/rel-range-picker.css +349 -0
- package/dist/components/rel-range-picker/rel-range-picker.ts +1080 -0
- package/dist/components/rel-resizable/rel-resizable-handle.ts +8 -7
- package/dist/components/rel-segmented-button/rel-segmented-button.ts +41 -20
- package/dist/components/rel-select/README.md +34 -28
- package/dist/components/rel-select/rel-select.ts +1015 -275
- package/dist/components/rel-sheet/rel-sheet.ts +365 -684
- package/dist/components/rel-skeleton/rel-skeleton.ts +139 -0
- package/dist/components/rel-slider/rel-slider.ts +49 -27
- package/dist/components/rel-snackbar/rel-snackbar.ts +28 -28
- package/dist/components/rel-stepper/rel-stepper.ts +11 -10
- package/dist/components/rel-switch/rel-switch.ts +7 -6
- package/dist/components/rel-tab/rel-tab.ts +15 -29
- package/dist/components/rel-textfield/rel-textfield.ts +192 -35
- package/dist/components/rel-toast/rel-toast.ts +21 -13
- package/dist/components/rel-tooltip/rel-tooltip.ts +123 -123
- package/dist/components/rel-topbar/rel-topbar-actions.ts +1 -0
- package/dist/components/rel-topbar/rel-topbar-brand.ts +1 -0
- package/dist/components/rel-topbar/rel-topbar-dropdown-item.ts +32 -2
- package/dist/components/rel-topbar/rel-topbar-dropdown.ts +1 -1
- package/dist/components/rel-topbar/rel-topbar-item.ts +15 -10
- package/dist/components/rel-topbar/rel-topbar-mobile-panel.ts +1 -0
- package/dist/components/rel-topbar/rel-topbar-profile.ts +30 -56
- package/dist/components/rel-topbar/rel-topbar-utilities.ts +1 -0
- package/dist/components/rel-topbar/rel-topbar.ts +137 -28
- package/dist/index.d.mts +310 -193
- package/dist/index.d.ts +310 -193
- package/dist/index.js +5562 -3526
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5328 -3284
- package/dist/index.mjs.map +1 -1
- package/dist/rel-menubar-menu-BEEQDAXW.css +3 -0
- package/dist/styles/vars-v2.css +525 -0
- package/dist/styles/vars.css +346 -346
- package/dist/{vars-TBB4BMSD.css → vars-I2PC74XD.css} +346 -346
- package/dist/vars-v2-VMGWTFJZ.css +525 -0
- package/package.json +2 -1
|
@@ -1,123 +1,123 @@
|
|
|
1
|
-
import { LitElement, html, css } from "lit";
|
|
2
|
-
import { customElement, property } from "lit/decorators.js";
|
|
3
|
-
|
|
4
|
-
export type TooltipPosition = "above" | "below";
|
|
5
|
-
|
|
6
|
-
@customElement("rel-tooltip")
|
|
7
|
-
export class RelTooltip extends LitElement {
|
|
8
|
-
@property({ type: String }) text: string = "";
|
|
9
|
-
@property({ type: String }) position: TooltipPosition = "above";
|
|
10
|
-
@property({ type: Boolean, attribute: "show-tail" }) showTail: boolean =
|
|
11
|
-
false;
|
|
12
|
-
|
|
13
|
-
// Stable id so aria-describedby can reference the bubble across renders.
|
|
14
|
-
private uniqueId = Math.random().toString(36).slice(2);
|
|
15
|
-
|
|
16
|
-
static styles = css`
|
|
17
|
-
:host {
|
|
18
|
-
display: inline-block;
|
|
19
|
-
position: relative;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/* Tooltip container */
|
|
23
|
-
.tooltip-bubble {
|
|
24
|
-
position: absolute;
|
|
25
|
-
left: 50%;
|
|
26
|
-
transform: translateX(-50%);
|
|
27
|
-
background-color: #1a1a1a;
|
|
28
|
-
color: #ffffff;
|
|
29
|
-
padding: var(--rel-spacing-space-xs, 8px)
|
|
30
|
-
var(--rel-spacing-space-sm, 12px);
|
|
31
|
-
border-radius: var(--rel-borders-radius-border-radius-200, 8px);
|
|
32
|
-
font-size: var(--rel-fontSizes-sm, 12px);
|
|
33
|
-
font-family: var(--rel-fontFamilies-primary, sans-serif);
|
|
34
|
-
white-space: nowrap;
|
|
35
|
-
z-index: 1000;
|
|
36
|
-
opacity: 0;
|
|
37
|
-
pointer-events: none;
|
|
38
|
-
transition: opacity 0.2s ease;
|
|
39
|
-
overflow: visible;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
:host(:hover) .tooltip-bubble,
|
|
43
|
-
:host(:focus-within) .tooltip-bubble {
|
|
44
|
-
opacity: 1;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/* Positioning */
|
|
48
|
-
.tooltip-bubble.above {
|
|
49
|
-
bottom: calc(100% + 8px);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.tooltip-bubble.below {
|
|
53
|
-
top: calc(100% + 8px);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/* Tail/Arrow */
|
|
57
|
-
.tooltip-tail {
|
|
58
|
-
position: absolute;
|
|
59
|
-
left: 50%;
|
|
60
|
-
transform: translateX(-50%);
|
|
61
|
-
width: 0;
|
|
62
|
-
height: 0;
|
|
63
|
-
border-left: 6px solid transparent;
|
|
64
|
-
border-right: 6px solid transparent;
|
|
65
|
-
display: block;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.tooltip-bubble.above .tooltip-tail {
|
|
69
|
-
bottom: -6px;
|
|
70
|
-
border-top: 6px solid #1a1a1a;
|
|
71
|
-
border-bottom: none;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.tooltip-bubble.below .tooltip-tail {
|
|
75
|
-
top: -6px;
|
|
76
|
-
border-bottom: 6px solid #1a1a1a;
|
|
77
|
-
border-top: none;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
:host-context([data-theme="dark"]) .tooltip-bubble,
|
|
81
|
-
:host-context(.dark) .tooltip-bubble {
|
|
82
|
-
background-color: #ffffff;
|
|
83
|
-
color: #000000;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
:host-context([data-theme="dark"]) .tooltip-bubble.above .tooltip-tail,
|
|
87
|
-
:host-context(.dark) .tooltip-bubble.above .tooltip-tail {
|
|
88
|
-
border-top-color: #ffffff;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
:host-context([data-theme="dark"]) .tooltip-bubble.below .tooltip-tail,
|
|
92
|
-
:host-context(.dark) .tooltip-bubble.below .tooltip-tail {
|
|
93
|
-
border-bottom-color: #ffffff;
|
|
94
|
-
}
|
|
95
|
-
`;
|
|
96
|
-
|
|
97
|
-
firstUpdated() {
|
|
98
|
-
this.linkTrigger();
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
private linkTrigger() {
|
|
102
|
-
const slot = this.shadowRoot?.querySelector("slot");
|
|
103
|
-
if (!slot) return;
|
|
104
|
-
const trigger = slot.assignedElements()[0];
|
|
105
|
-
if (trigger) {
|
|
106
|
-
trigger.setAttribute("aria-describedby", `tooltip-${this.uniqueId}`);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
render() {
|
|
111
|
-
return html`
|
|
112
|
-
<slot @slotchange="${this.linkTrigger}"></slot>
|
|
113
|
-
<div
|
|
114
|
-
class="tooltip-bubble ${this.position}"
|
|
115
|
-
id="tooltip-${this.uniqueId}"
|
|
116
|
-
role="tooltip"
|
|
117
|
-
>
|
|
118
|
-
${this.text}
|
|
119
|
-
${this.showTail ? html`<span class="tooltip-tail"></span>` : ""}
|
|
120
|
-
</div>
|
|
121
|
-
`;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import { customElement, property } from "lit/decorators.js";
|
|
3
|
+
|
|
4
|
+
export type TooltipPosition = "above" | "below";
|
|
5
|
+
|
|
6
|
+
@customElement("rel-tooltip")
|
|
7
|
+
export class RelTooltip extends LitElement {
|
|
8
|
+
@property({ type: String }) text: string = "";
|
|
9
|
+
@property({ type: String }) position: TooltipPosition = "above";
|
|
10
|
+
@property({ type: Boolean, attribute: "show-tail" }) showTail: boolean =
|
|
11
|
+
false;
|
|
12
|
+
|
|
13
|
+
// Stable id so aria-describedby can reference the bubble across renders.
|
|
14
|
+
private uniqueId = Math.random().toString(36).slice(2);
|
|
15
|
+
|
|
16
|
+
static styles = css`
|
|
17
|
+
:host {
|
|
18
|
+
display: inline-block;
|
|
19
|
+
position: relative;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Tooltip container */
|
|
23
|
+
.tooltip-bubble {
|
|
24
|
+
position: absolute;
|
|
25
|
+
left: 50%;
|
|
26
|
+
transform: translateX(-50%);
|
|
27
|
+
background-color: #1a1a1a;
|
|
28
|
+
color: #ffffff;
|
|
29
|
+
padding: var(--rel-spacing-space-xs, 8px)
|
|
30
|
+
var(--rel-spacing-space-sm, 12px);
|
|
31
|
+
border-radius: var(--rel-borders-radius-border-radius-200, 8px);
|
|
32
|
+
font-size: var(--rel-fontSizes-sm, 12px);
|
|
33
|
+
font-family: var(--rel-fontFamilies-primary, sans-serif);
|
|
34
|
+
white-space: nowrap;
|
|
35
|
+
z-index: 1000;
|
|
36
|
+
opacity: 0;
|
|
37
|
+
pointer-events: none;
|
|
38
|
+
transition: opacity 0.2s ease;
|
|
39
|
+
overflow: visible;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
:host(:hover) .tooltip-bubble,
|
|
43
|
+
:host(:focus-within) .tooltip-bubble {
|
|
44
|
+
opacity: 1;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* Positioning */
|
|
48
|
+
.tooltip-bubble.above {
|
|
49
|
+
bottom: calc(100% + 8px);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.tooltip-bubble.below {
|
|
53
|
+
top: calc(100% + 8px);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* Tail/Arrow */
|
|
57
|
+
.tooltip-tail {
|
|
58
|
+
position: absolute;
|
|
59
|
+
left: 50%;
|
|
60
|
+
transform: translateX(-50%);
|
|
61
|
+
width: 0;
|
|
62
|
+
height: 0;
|
|
63
|
+
border-left: 6px solid transparent;
|
|
64
|
+
border-right: 6px solid transparent;
|
|
65
|
+
display: block;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.tooltip-bubble.above .tooltip-tail {
|
|
69
|
+
bottom: -6px;
|
|
70
|
+
border-top: 6px solid #1a1a1a;
|
|
71
|
+
border-bottom: none;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.tooltip-bubble.below .tooltip-tail {
|
|
75
|
+
top: -6px;
|
|
76
|
+
border-bottom: 6px solid #1a1a1a;
|
|
77
|
+
border-top: none;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
:host-context([data-theme="dark"]) .tooltip-bubble,
|
|
81
|
+
:host-context(.dark) .tooltip-bubble {
|
|
82
|
+
background-color: #ffffff;
|
|
83
|
+
color: #000000;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
:host-context([data-theme="dark"]) .tooltip-bubble.above .tooltip-tail,
|
|
87
|
+
:host-context(.dark) .tooltip-bubble.above .tooltip-tail {
|
|
88
|
+
border-top-color: #ffffff;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
:host-context([data-theme="dark"]) .tooltip-bubble.below .tooltip-tail,
|
|
92
|
+
:host-context(.dark) .tooltip-bubble.below .tooltip-tail {
|
|
93
|
+
border-bottom-color: #ffffff;
|
|
94
|
+
}
|
|
95
|
+
`;
|
|
96
|
+
|
|
97
|
+
firstUpdated() {
|
|
98
|
+
this.linkTrigger();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
private linkTrigger() {
|
|
102
|
+
const slot = this.shadowRoot?.querySelector("slot");
|
|
103
|
+
if (!slot) return;
|
|
104
|
+
const trigger = slot.assignedElements()[0];
|
|
105
|
+
if (trigger) {
|
|
106
|
+
trigger.setAttribute("aria-describedby", `tooltip-${this.uniqueId}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
render() {
|
|
111
|
+
return html`
|
|
112
|
+
<slot @slotchange="${this.linkTrigger}"></slot>
|
|
113
|
+
<div
|
|
114
|
+
class="tooltip-bubble ${this.position}"
|
|
115
|
+
id="tooltip-${this.uniqueId}"
|
|
116
|
+
role="tooltip"
|
|
117
|
+
>
|
|
118
|
+
${this.text}
|
|
119
|
+
${this.showTail ? html`<span class="tooltip-tail"></span>` : ""}
|
|
120
|
+
</div>
|
|
121
|
+
`;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { LitElement, html, css } from "lit";
|
|
2
2
|
import { customElement, property } from "lit/decorators.js";
|
|
3
|
+
import "../../styles/vars-v2.css";
|
|
3
4
|
|
|
4
5
|
@customElement("rel-topbar-dropdown-item")
|
|
5
6
|
export class RelTopbarDropdownItem extends LitElement {
|
|
6
7
|
@property({ type: String }) label: string = "";
|
|
7
8
|
@property({ type: String }) href: string = "#";
|
|
9
|
+
@property({ type: Boolean, reflect: true }) active = false;
|
|
8
10
|
|
|
9
11
|
static styles = css`
|
|
10
12
|
.dropdown-item {
|
|
11
13
|
display: block;
|
|
12
|
-
padding: var(--rel-spacing-space-xs) var(--rel-spacing-space-md);
|
|
14
|
+
padding: var(--rel-spacing-space-xs, 8px) var(--rel-spacing-space-md, 16px);
|
|
13
15
|
color: var(--rel-color-text-primary);
|
|
14
16
|
text-decoration: none;
|
|
15
17
|
font-size: var(--rel-fontSizes-md);
|
|
@@ -18,11 +20,39 @@ export class RelTopbarDropdownItem extends LitElement {
|
|
|
18
20
|
|
|
19
21
|
.dropdown-item:hover {
|
|
20
22
|
background: var(--rel-color-bg-hover);
|
|
23
|
+
border-radius: 0;
|
|
21
24
|
}
|
|
25
|
+
|
|
26
|
+
:host([active]) .dropdown-item {
|
|
27
|
+
color: var(--rel-topbar-item-active-color, var(--rel-colors-green-tertiary, #00a86b));
|
|
28
|
+
font-weight: var(--rel-fontWeights-semibold, 600);
|
|
29
|
+
}
|
|
30
|
+
|
|
22
31
|
`;
|
|
23
32
|
|
|
33
|
+
private _handleClick(e: MouseEvent) {
|
|
34
|
+
if (this.hasAttribute("disabled")) {
|
|
35
|
+
e.preventDefault();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
e.preventDefault();
|
|
39
|
+
this.dispatchEvent(new CustomEvent("rel-select", {
|
|
40
|
+
detail: { value: this.href, label: this.label },
|
|
41
|
+
bubbles: true,
|
|
42
|
+
composed: true,
|
|
43
|
+
}));
|
|
44
|
+
this.dispatchEvent(new CustomEvent("rel-nav-select", {
|
|
45
|
+
detail: { value: this.href, label: this.label },
|
|
46
|
+
bubbles: true,
|
|
47
|
+
composed: true,
|
|
48
|
+
}));
|
|
49
|
+
this.active = true;
|
|
50
|
+
const siblings = this.parentElement?.querySelectorAll("rel-topbar-dropdown-item");
|
|
51
|
+
siblings?.forEach(s => { if (s !== this) (s as any).active = false; });
|
|
52
|
+
}
|
|
53
|
+
|
|
24
54
|
render() {
|
|
25
|
-
return html`<a href="${this.href}" class="dropdown-item">${this.label}</a>`;
|
|
55
|
+
return html`<a href="${this.href}" class="dropdown-item" @click=${this._handleClick}>${this.label}</a>`;
|
|
26
56
|
}
|
|
27
57
|
}
|
|
28
58
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LitElement, html, css } from "lit";
|
|
2
2
|
import { customElement } from "lit/decorators.js";
|
|
3
|
+
import "../../styles/vars-v2.css";
|
|
3
4
|
|
|
4
5
|
@customElement("rel-topbar-dropdown")
|
|
5
6
|
export class RelTopbarDropdown extends LitElement {
|
|
@@ -9,7 +10,6 @@ export class RelTopbarDropdown extends LitElement {
|
|
|
9
10
|
flex-direction: column;
|
|
10
11
|
min-width: 160px;
|
|
11
12
|
background: var(--rel-color-bg-primary);
|
|
12
|
-
border: 1px solid var(--rel-color-border-default);
|
|
13
13
|
border-radius: var(--rel-borders-radius-border-radius-200);
|
|
14
14
|
box-shadow: var(--rel-shadow-200);
|
|
15
15
|
padding: var(--rel-spacing-space-2xs) 0;
|
|
@@ -2,6 +2,8 @@ import { LitElement, html, css } from "lit";
|
|
|
2
2
|
import { customElement, property, state } from "lit/decorators.js";
|
|
3
3
|
import "./rel-topbar-dropdown";
|
|
4
4
|
import "./rel-topbar-dropdown-item";
|
|
5
|
+
import "../../styles/vars-v2.css";
|
|
6
|
+
import "@reliability-design/icons/rel-icon";
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* `rel-topbar-item` — A navigation item within rel-topbar.
|
|
@@ -57,6 +59,10 @@ export class RelTopbarItem extends LitElement {
|
|
|
57
59
|
font-family: var(--rel-fontFamilies-primary, Poppins, sans-serif);
|
|
58
60
|
}
|
|
59
61
|
|
|
62
|
+
:host([hidden]) {
|
|
63
|
+
display: none !important;
|
|
64
|
+
}
|
|
65
|
+
|
|
60
66
|
/* ─── Trigger (shared for <a> and <button>) ─────────────────────── */
|
|
61
67
|
.trigger {
|
|
62
68
|
display: inline-flex;
|
|
@@ -113,6 +119,10 @@ export class RelTopbarItem extends LitElement {
|
|
|
113
119
|
}
|
|
114
120
|
|
|
115
121
|
/* Disabled */
|
|
122
|
+
:host([disabled]) {
|
|
123
|
+
cursor: not-allowed;
|
|
124
|
+
}
|
|
125
|
+
|
|
116
126
|
:host([disabled]) .trigger {
|
|
117
127
|
opacity: 0.45;
|
|
118
128
|
cursor: not-allowed;
|
|
@@ -149,8 +159,8 @@ export class RelTopbarItem extends LitElement {
|
|
|
149
159
|
top: calc(100% + 6px);
|
|
150
160
|
left: 0;
|
|
151
161
|
min-width: 200px;
|
|
152
|
-
background: var(--rel-
|
|
153
|
-
border: var(--rel-borders-width-stroke-100, 1px) solid var(--rel-border-default
|
|
162
|
+
background: var(--rel-color-bg-primary);
|
|
163
|
+
border: var(--rel-borders-width-stroke-100, 1px) solid var(--rel-color-border-default);
|
|
154
164
|
border-radius: var(--rel-borders-radius-border-radius-200, 8px);
|
|
155
165
|
box-shadow: var(--rel-shadows-shadow-300);
|
|
156
166
|
padding: var(--rel-spacing-space-2xs, 4px);
|
|
@@ -263,7 +273,9 @@ export class RelTopbarItem extends LitElement {
|
|
|
263
273
|
<slot>${this.label ?? ""}</slot>
|
|
264
274
|
<span class="suffix"><slot name="suffix"></slot></span>
|
|
265
275
|
${showChevron
|
|
266
|
-
? html`<span class="chevron" aria-hidden="true"
|
|
276
|
+
? html`<span class="chevron" aria-hidden="true">
|
|
277
|
+
<rel-icon name="chevron-down" size="sm"></rel-icon>
|
|
278
|
+
</span>`
|
|
267
279
|
: null}
|
|
268
280
|
`;
|
|
269
281
|
|
|
@@ -306,10 +318,3 @@ export class RelTopbarItem extends LitElement {
|
|
|
306
318
|
}
|
|
307
319
|
}
|
|
308
320
|
|
|
309
|
-
function _iconChevron() {
|
|
310
|
-
return html`
|
|
311
|
-
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" aria-hidden="true" focusable="false">
|
|
312
|
-
<path d="M3 5L7 9L11 5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
313
|
-
</svg>
|
|
314
|
-
`;
|
|
315
|
-
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { LitElement, html, css } from "lit";
|
|
2
2
|
import { customElement, property } from "lit/decorators.js";
|
|
3
|
+
import "../../styles/vars-v2.css";
|
|
4
|
+
import "../rel-avatar/rel-avatar.js";
|
|
3
5
|
|
|
4
6
|
export type TopbarProfileType = "avatar" | "carrier";
|
|
5
7
|
export type TopbarRewardTier = "gold" | "silver" | "platinum" | "bronze" | "regular";
|
|
@@ -37,7 +39,7 @@ export class RelTopbarProfile extends LitElement {
|
|
|
37
39
|
--_avatar-size: 36px;
|
|
38
40
|
--_avatar-size-sm: 28px;
|
|
39
41
|
--_avatar-bg: var(--rel-colors-green-primary, #00f49c);
|
|
40
|
-
--_avatar-color: var(--rel-
|
|
42
|
+
--_avatar-color: var(--rel-color-text-primary);
|
|
41
43
|
|
|
42
44
|
/* Reward tier colours (reference existing token palette) */
|
|
43
45
|
--rel-topbar-reward-gold: var(--rel-colors-gold, #d6ba00);
|
|
@@ -49,7 +51,7 @@ export class RelTopbarProfile extends LitElement {
|
|
|
49
51
|
--rel-topbar-reward-bronze: var(--rel-colors-bronze, #7d5300);
|
|
50
52
|
--rel-topbar-reward-bronze-bg: var(--rel-colors-bronze-secondary, #e2dac7);
|
|
51
53
|
--rel-topbar-reward-regular: var(--rel-colors-gray-divider, #bdbdbd);
|
|
52
|
-
--rel-topbar-reward-regular-bg: var(--rel-
|
|
54
|
+
--rel-topbar-reward-regular-bg: var(--rel-color-bg-secondary);
|
|
53
55
|
|
|
54
56
|
display: inline-flex;
|
|
55
57
|
align-items: center;
|
|
@@ -58,27 +60,6 @@ export class RelTopbarProfile extends LitElement {
|
|
|
58
60
|
cursor: pointer;
|
|
59
61
|
}
|
|
60
62
|
|
|
61
|
-
/* ─── Avatar circle ─────────────────────────────────────────────── */
|
|
62
|
-
.avatar {
|
|
63
|
-
width: var(--_avatar-size);
|
|
64
|
-
height: var(--_avatar-size);
|
|
65
|
-
border-radius: var(--_profile-radius);
|
|
66
|
-
background: var(--_avatar-bg);
|
|
67
|
-
color: var(--_avatar-color);
|
|
68
|
-
display: flex;
|
|
69
|
-
align-items: center;
|
|
70
|
-
justify-content: center;
|
|
71
|
-
font-size: var(--rel-fontSizes-sm, 12px);
|
|
72
|
-
font-weight: var(--rel-fontWeights-semibold, 600);
|
|
73
|
-
flex-shrink: 0;
|
|
74
|
-
user-select: none;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
:host([compact]) .avatar {
|
|
78
|
-
width: var(--_avatar-size-sm);
|
|
79
|
-
height: var(--_avatar-size-sm);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
63
|
/* ─── Name / subtitle stack ─────────────────────────────────────── */
|
|
83
64
|
.text-stack {
|
|
84
65
|
display: flex;
|
|
@@ -94,7 +75,7 @@ export class RelTopbarProfile extends LitElement {
|
|
|
94
75
|
.name {
|
|
95
76
|
font-size: var(--rel-fontSizes-md, 14px);
|
|
96
77
|
font-weight: var(--rel-fontWeights-medium, 500);
|
|
97
|
-
color: var(--rel-text-primary
|
|
78
|
+
color: var(--rel-color-text-primary);
|
|
98
79
|
line-height: var(--rel-lineHeights-md, 20px);
|
|
99
80
|
white-space: nowrap;
|
|
100
81
|
overflow: hidden;
|
|
@@ -104,7 +85,7 @@ export class RelTopbarProfile extends LitElement {
|
|
|
104
85
|
.subtitle {
|
|
105
86
|
font-size: var(--rel-fontSizes-sm, 12px);
|
|
106
87
|
font-weight: var(--rel-fontWeights-regular, 400);
|
|
107
|
-
color: var(--rel-text-placeholder
|
|
88
|
+
color: var(--rel-color-text-placeholder);
|
|
108
89
|
line-height: var(--rel-lineHeights-sm, 18px);
|
|
109
90
|
white-space: nowrap;
|
|
110
91
|
overflow: hidden;
|
|
@@ -126,56 +107,30 @@ export class RelTopbarProfile extends LitElement {
|
|
|
126
107
|
}
|
|
127
108
|
|
|
128
109
|
/* Gold */
|
|
129
|
-
:host([reward="gold"]) .avatar {
|
|
130
|
-
background: var(--rel-topbar-reward-gold-bg);
|
|
131
|
-
color: var(--rel-topbar-reward-gold);
|
|
132
|
-
border: 1.5px solid var(--rel-topbar-reward-gold);
|
|
133
|
-
}
|
|
134
110
|
:host([reward="gold"]) .reward-badge {
|
|
135
111
|
background: var(--rel-topbar-reward-gold-bg);
|
|
136
112
|
color: var(--rel-topbar-reward-gold);
|
|
137
113
|
}
|
|
138
114
|
|
|
139
115
|
/* Silver */
|
|
140
|
-
:host([reward="silver"]) .avatar {
|
|
141
|
-
background: var(--rel-topbar-reward-silver-bg);
|
|
142
|
-
color: var(--rel-colors-gray-primary, #333);
|
|
143
|
-
border: 1.5px solid var(--rel-topbar-reward-silver);
|
|
144
|
-
}
|
|
145
116
|
:host([reward="silver"]) .reward-badge {
|
|
146
117
|
background: var(--rel-topbar-reward-silver-bg);
|
|
147
118
|
color: var(--rel-colors-gray-primary, #333);
|
|
148
119
|
}
|
|
149
120
|
|
|
150
121
|
/* Platinum */
|
|
151
|
-
:host([reward="platinum"]) .avatar {
|
|
152
|
-
background: var(--rel-topbar-reward-platinum-bg);
|
|
153
|
-
color: var(--rel-topbar-reward-platinum);
|
|
154
|
-
border: 1.5px solid var(--rel-topbar-reward-platinum);
|
|
155
|
-
}
|
|
156
122
|
:host([reward="platinum"]) .reward-badge {
|
|
157
123
|
background: var(--rel-topbar-reward-platinum-bg);
|
|
158
124
|
color: var(--rel-topbar-reward-platinum);
|
|
159
125
|
}
|
|
160
126
|
|
|
161
127
|
/* Bronze */
|
|
162
|
-
:host([reward="bronze"]) .avatar {
|
|
163
|
-
background: var(--rel-topbar-reward-bronze-bg);
|
|
164
|
-
color: var(--rel-topbar-reward-bronze);
|
|
165
|
-
border: 1.5px solid var(--rel-topbar-reward-bronze);
|
|
166
|
-
}
|
|
167
128
|
:host([reward="bronze"]) .reward-badge {
|
|
168
129
|
background: var(--rel-topbar-reward-bronze-bg);
|
|
169
130
|
color: var(--rel-topbar-reward-bronze);
|
|
170
131
|
}
|
|
171
132
|
|
|
172
133
|
/* Regular */
|
|
173
|
-
:host([reward="regular"]) .avatar,
|
|
174
|
-
:host(:not([reward])) .avatar {
|
|
175
|
-
background: var(--rel-topbar-reward-regular-bg);
|
|
176
|
-
color: var(--rel-colors-gray-primary, #333);
|
|
177
|
-
border: 1.5px solid var(--rel-topbar-reward-regular);
|
|
178
|
-
}
|
|
179
134
|
:host([reward="regular"]) .reward-badge {
|
|
180
135
|
background: var(--rel-topbar-reward-regular-bg);
|
|
181
136
|
color: var(--rel-colors-gray-primary, #333);
|
|
@@ -189,7 +144,7 @@ export class RelTopbarProfile extends LitElement {
|
|
|
189
144
|
padding: var(--rel-spacing-space-2xs, 4px) var(--rel-spacing-space-xs, 8px);
|
|
190
145
|
border-radius: var(--rel-borders-radius-border-radius-200, 8px);
|
|
191
146
|
background: var(--rel-surface-secondary, #fafafa);
|
|
192
|
-
border: var(--rel-borders-width-stroke-100, 1px) solid var(--rel-border-default
|
|
147
|
+
border: var(--rel-borders-width-stroke-100, 1px) solid var(--rel-color-border-default);
|
|
193
148
|
}
|
|
194
149
|
|
|
195
150
|
:host([compact]) .carrier-tile {
|
|
@@ -217,9 +172,12 @@ export class RelTopbarProfile extends LitElement {
|
|
|
217
172
|
|
|
218
173
|
private _renderAvatar() {
|
|
219
174
|
return html`
|
|
220
|
-
<
|
|
221
|
-
|
|
222
|
-
|
|
175
|
+
<rel-avatar
|
|
176
|
+
type="text"
|
|
177
|
+
text=${this.initials ?? ""}
|
|
178
|
+
size=${this.compact ? "xs" : "sm"}
|
|
179
|
+
bg=${this._avatarBg()}
|
|
180
|
+
></rel-avatar>
|
|
223
181
|
${!this.compact && (this.name || this.subtitle)
|
|
224
182
|
? html`
|
|
225
183
|
<div class="text-stack">
|
|
@@ -231,12 +189,28 @@ export class RelTopbarProfile extends LitElement {
|
|
|
231
189
|
`;
|
|
232
190
|
}
|
|
233
191
|
|
|
192
|
+
private _avatarBg(): string {
|
|
193
|
+
const map: Record<string, string> = {
|
|
194
|
+
gold: "var(--rel-colors-gold)",
|
|
195
|
+
platinum: "var(--rel-colors-platinum)",
|
|
196
|
+
silver: "var(--rel-colors-silver)",
|
|
197
|
+
bronze: "var(--rel-colors-bronze)",
|
|
198
|
+
regular: "var(--rel-colors-green-primary)",
|
|
199
|
+
};
|
|
200
|
+
return map[this.reward] ?? "var(--rel-colors-green-primary)";
|
|
201
|
+
}
|
|
202
|
+
|
|
234
203
|
private _renderCarrier() {
|
|
235
204
|
const rewardLabel = this.reward.charAt(0).toUpperCase() + this.reward.slice(1);
|
|
236
205
|
|
|
237
206
|
return html`
|
|
238
207
|
<div class="carrier-tile" role="img" aria-label="${this.name ?? "Profile"} – ${rewardLabel} member">
|
|
239
|
-
<
|
|
208
|
+
<rel-avatar
|
|
209
|
+
type="text"
|
|
210
|
+
text=${this.initials ?? ""}
|
|
211
|
+
size="sm"
|
|
212
|
+
bg=${this._avatarBg()}
|
|
213
|
+
></rel-avatar>
|
|
240
214
|
<div class="carrier-meta">
|
|
241
215
|
${this.name ? html`<span class="name">${this.name}</span>` : null}
|
|
242
216
|
<span class="reward-badge">${rewardLabel}</span>
|