@reliability-design/web 1.0.3 → 1.1.1
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/README.md +132 -0
- package/dist/components/rel-accordion/rel-accordion.ts +47 -16
- package/dist/components/rel-alert/README.md +141 -0
- package/dist/components/rel-alert/rel-alert.ts +101 -20
- package/dist/components/rel-avatar/README.md +119 -0
- package/dist/components/rel-avatar/rel-avatar.ts +3 -2
- package/dist/components/rel-badge/README.md +86 -0
- package/dist/components/rel-badge/rel-badge.ts +11 -7
- package/dist/components/rel-breadcrumb/README.md +102 -0
- package/dist/components/rel-breadcrumb/rel-breadcrumb.ts +12 -6
- package/dist/components/rel-button/README.md +130 -0
- package/dist/components/rel-button/rel-button.ts +64 -8
- package/dist/components/rel-calendar/README.md +109 -0
- package/dist/components/rel-calendar/index.ts +1 -0
- package/dist/components/rel-calendar/rel-calendar.ts +467 -0
- package/dist/components/rel-card/README.md +94 -0
- package/dist/components/rel-card/rel-card.ts +12 -3
- package/dist/components/rel-cardmedia/README.md +127 -0
- package/dist/components/rel-cardmedia/rel-cardmedia.ts +14 -4
- package/dist/components/rel-carousel/README.md +166 -0
- package/dist/components/rel-carousel/index.ts +1 -0
- package/dist/components/rel-carousel/rel-carousel.ts +468 -0
- package/dist/components/rel-chart/README.md +286 -0
- package/dist/components/rel-chart/index.ts +1 -0
- package/dist/components/rel-chart/rel-chart.ts +736 -0
- package/dist/components/rel-checkbox/README.md +77 -0
- package/dist/components/rel-checkbox/rel-checkbox.ts +51 -12
- package/dist/components/rel-chip/README.md +114 -0
- package/dist/components/rel-chip/rel-chip.ts +83 -9
- package/dist/components/rel-container/README.md +99 -0
- package/dist/components/rel-date-picker/README.md +253 -0
- package/dist/components/rel-date-picker/index.ts +1 -0
- package/dist/components/rel-date-picker/rel-date-picker.ts +916 -0
- package/dist/components/rel-divider/README.md +100 -0
- package/dist/components/rel-divider/rel-divider.ts +9 -0
- package/dist/components/rel-drawer/README.md +200 -0
- package/dist/components/rel-drawer/index.ts +1 -0
- package/dist/components/rel-drawer/rel-drawer-footer.ts +29 -0
- package/dist/components/rel-drawer/rel-drawer.ts +612 -0
- package/dist/components/rel-kbd/README.md +151 -0
- package/dist/components/rel-kbd/rel-kbd.ts +118 -0
- package/dist/components/rel-layout/README.md +88 -0
- package/dist/components/rel-menu/README.md +151 -0
- package/dist/components/rel-menu/rel-menu.ts +64 -24
- package/dist/components/rel-menubar/README.md +329 -0
- package/dist/components/rel-menubar/index.ts +2 -0
- package/dist/components/rel-menubar/rel-menubar-menu.ts +16 -0
- package/dist/components/rel-menubar/rel-menubar.ts +605 -0
- package/dist/components/rel-nav-menu/README.md +289 -0
- package/dist/components/rel-nav-menu/index.ts +3 -0
- package/dist/components/rel-nav-menu/rel-nav-menu-item.ts +240 -0
- package/dist/components/rel-nav-menu/rel-nav-menu-panel.ts +53 -0
- package/dist/components/rel-nav-menu/rel-nav-menu.ts +227 -0
- package/dist/components/rel-navbar/README.md +126 -0
- package/dist/components/rel-navbar/rel-navbar.ts +104 -0
- package/dist/components/rel-otp/README.md +440 -0
- package/dist/components/rel-otp/index.ts +1 -0
- package/dist/components/rel-otp/rel-otp.ts +504 -0
- package/dist/components/rel-pagination/README.md +410 -0
- package/dist/components/rel-pagination/index.ts +1 -0
- package/dist/components/rel-pagination/rel-pagination.ts +381 -0
- package/dist/components/rel-popover/README.md +568 -0
- package/dist/components/rel-popover/index.ts +2 -0
- package/dist/components/rel-popover/rel-popover-content.ts +55 -0
- package/dist/components/rel-popover/rel-popover.ts +330 -0
- package/dist/components/rel-progress/README.md +110 -0
- package/dist/components/rel-progress/rel-progress.ts +32 -5
- package/dist/components/rel-radio/README.md +120 -0
- package/dist/components/rel-radio/rel-radio.ts +31 -6
- package/dist/components/rel-resizable/README.md +140 -0
- package/dist/components/rel-resizable/index.ts +3 -0
- package/dist/components/rel-resizable/rel-resizable-group.ts +374 -0
- package/dist/components/rel-resizable/rel-resizable-handle.ts +145 -0
- package/dist/components/rel-resizable/rel-resizable-panel.ts +47 -0
- package/dist/components/rel-segmented-button/README.md +141 -0
- package/dist/components/rel-segmented-button/rel-segmented-button.ts +18 -13
- package/dist/components/rel-select/README.md +107 -0
- package/dist/components/rel-select/rel-select.ts +28 -14
- package/dist/components/rel-sheet/README.md +224 -0
- package/dist/components/rel-sheet/rel-sheet.ts +684 -0
- package/dist/components/rel-sidebar/README.md +209 -0
- package/dist/components/rel-sidebar/rel-sidebar.ts +1166 -0
- package/dist/components/rel-slider/README.md +135 -0
- package/dist/components/rel-slider/rel-slider.ts +44 -9
- package/dist/components/rel-snackbar/README.md +134 -0
- package/dist/components/rel-snackbar/rel-snackbar.ts +109 -14
- package/dist/components/rel-stepper/README.md +160 -0
- package/dist/components/rel-stepper/rel-stepper.ts +38 -27
- package/dist/components/rel-switch/README.md +102 -0
- package/dist/components/rel-switch/rel-switch.ts +34 -12
- package/dist/components/rel-tab/README.md +163 -0
- package/dist/components/rel-tab/rel-tab.ts +79 -23
- package/dist/components/rel-table/README.md +178 -0
- package/dist/components/rel-table/rel-table-body.ts +21 -0
- package/dist/components/rel-table/rel-table-caption.ts +27 -0
- package/dist/components/rel-table/rel-table-cell.ts +42 -0
- package/dist/components/rel-table/rel-table-footer.ts +23 -0
- package/dist/components/rel-table/rel-table-head.ts +45 -0
- package/dist/components/rel-table/rel-table-header.ts +21 -0
- package/dist/components/rel-table/rel-table-row.ts +36 -0
- package/dist/components/rel-table/rel-table.ts +53 -0
- package/dist/components/rel-textfield/README.md +90 -0
- package/dist/components/rel-textfield/rel-textfield.ts +55 -39
- package/dist/components/rel-toast/README.md +148 -0
- package/dist/components/rel-toast/rel-toast.ts +63 -24
- package/dist/components/rel-tooltip/README.md +103 -0
- package/dist/components/rel-tooltip/rel-tooltip.ts +123 -80
- package/dist/components/rel-topbar/rel-topbar-actions.ts +23 -0
- package/dist/components/rel-topbar/rel-topbar-brand.ts +46 -0
- package/dist/components/rel-topbar/rel-topbar-dropdown-item.ts +33 -0
- package/dist/components/rel-topbar/rel-topbar-dropdown.ts +28 -0
- package/dist/components/rel-topbar/rel-topbar-item.ts +315 -0
- package/dist/components/rel-topbar/rel-topbar-mobile-panel.ts +23 -0
- package/dist/components/rel-topbar/rel-topbar-profile.ts +248 -0
- package/dist/components/rel-topbar/rel-topbar-utilities.ts +23 -0
- package/dist/components/rel-topbar/rel-topbar.ts +329 -0
- package/dist/index.d.mts +831 -7
- package/dist/index.d.ts +831 -7
- package/dist/index.js +9500 -1564
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9240 -1344
- package/dist/index.mjs.map +1 -1
- package/dist/styles/vars.css +187 -25
- package/dist/vars-TBB4BMSD.css +346 -0
- package/package.json +2 -1
- package/dist/vars-6ZIUPIU4.css +0 -184
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# rel-tooltip
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
A simple tooltip component that displays contextual text on hover. Supports above/below positioning and optional tail (arrow pointer). Uses CSS opacity transitions for smooth fade-in/out effects. Content is provided via a `<slot>` for flexible trigger elements.
|
|
5
|
+
|
|
6
|
+
## Usage
|
|
7
|
+
```html
|
|
8
|
+
<!-- Basic tooltip (above) -->
|
|
9
|
+
<rel-tooltip text="This is a helpful tooltip">
|
|
10
|
+
<button>Hover me</button>
|
|
11
|
+
</rel-tooltip>
|
|
12
|
+
|
|
13
|
+
<!-- Tooltip positioned below -->
|
|
14
|
+
<rel-tooltip text="Information appears below" position="below">
|
|
15
|
+
<span>Hover for info</span>
|
|
16
|
+
</rel-tooltip>
|
|
17
|
+
|
|
18
|
+
<!-- With tail/arrow -->
|
|
19
|
+
<rel-tooltip text="Tooltip with pointer" position="above" showTail>
|
|
20
|
+
<button>Hover me</button>
|
|
21
|
+
</rel-tooltip>
|
|
22
|
+
|
|
23
|
+
<!-- Tooltip on icon -->
|
|
24
|
+
<rel-tooltip text="Edit item" showTail>
|
|
25
|
+
<img src="edit-icon.svg" alt="Edit">
|
|
26
|
+
</rel-tooltip>
|
|
27
|
+
|
|
28
|
+
<!-- Multiple elements in trigger -->
|
|
29
|
+
<rel-tooltip text="Profile options" position="below">
|
|
30
|
+
<div class="user-avatar">
|
|
31
|
+
<img src="avatar.jpg" alt="User">
|
|
32
|
+
<span>John Doe</span>
|
|
33
|
+
</div>
|
|
34
|
+
</rel-tooltip>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## API
|
|
38
|
+
|
|
39
|
+
### Attributes/Properties
|
|
40
|
+
| Name | Type | Default | Description |
|
|
41
|
+
|------|------|---------|-------------|
|
|
42
|
+
| `text` | `string` | `""` | Tooltip text content |
|
|
43
|
+
| `position` | `"above" \| "below"` | `"above"` | Vertical position relative to trigger |
|
|
44
|
+
| `showTail` | `boolean` | `false` | Whether to show the arrow/pointer |
|
|
45
|
+
|
|
46
|
+
## Events
|
|
47
|
+
None.
|
|
48
|
+
|
|
49
|
+
## Slots
|
|
50
|
+
| Slot | Description |
|
|
51
|
+
|------|-------------|
|
|
52
|
+
| (default) | Trigger element(s) that activate the tooltip on hover |
|
|
53
|
+
|
|
54
|
+
## CSS Parts
|
|
55
|
+
None exposed.
|
|
56
|
+
|
|
57
|
+
## Tokens / CSS Variables
|
|
58
|
+
|
|
59
|
+
### Semantic Tokens
|
|
60
|
+
- `--rel-fontFamilies-primary` - Font family
|
|
61
|
+
- `--rel-fontSizes-sm` - Font size
|
|
62
|
+
|
|
63
|
+
### Spacing Tokens
|
|
64
|
+
- `--rel-spacing-space-xs` - Vertical padding
|
|
65
|
+
- `--rel-spacing-space-sm` - Horizontal padding
|
|
66
|
+
|
|
67
|
+
### Color Tokens
|
|
68
|
+
- `--rel-surface-toast` - Background color (dark gray)
|
|
69
|
+
- `--rel-colors-white` - Text color
|
|
70
|
+
|
|
71
|
+
### Border Tokens
|
|
72
|
+
- `--rel-borders-radius-border-radius-200` - Border radius
|
|
73
|
+
|
|
74
|
+
## Accessibility
|
|
75
|
+
- Uses `role="tooltip"` on the tooltip bubble
|
|
76
|
+
- `aria-hidden="true"` on tooltip (content is supplemental, not critical)
|
|
77
|
+
- Tooltip does not receive focus (purely decorative on hover)
|
|
78
|
+
- For critical information, consider alternative patterns (e.g., visible labels or expandable sections)
|
|
79
|
+
|
|
80
|
+
### Keyboard Interactions
|
|
81
|
+
- No keyboard interactions (hover-only)
|
|
82
|
+
- For keyboard accessibility, ensure slotted content is focusable and consider showing tooltip on focus
|
|
83
|
+
|
|
84
|
+
### Focus Behavior
|
|
85
|
+
- Tooltip activation is hover-only by default
|
|
86
|
+
- Does not interfere with focus on slotted content
|
|
87
|
+
|
|
88
|
+
## Notes / Edge Cases
|
|
89
|
+
- The tooltip appears on `:host(:hover)` via CSS `opacity: 1` transition
|
|
90
|
+
- By default, tooltip has `opacity: 0` and `pointer-events: none`
|
|
91
|
+
- **Position "above"**: tooltip is positioned at `bottom: calc(100% + 8px)` (8px gap above trigger)
|
|
92
|
+
- **Position "below"**: tooltip is positioned at `top: calc(100% + 8px)` (8px gap below trigger)
|
|
93
|
+
- The tooltip uses `left: 50%` and `transform: translateX(-50%)` for horizontal centering
|
|
94
|
+
- `white-space: nowrap` prevents text wrapping (tooltip width adjusts to content)
|
|
95
|
+
- **Tail/arrow** is a CSS triangle created with transparent borders:
|
|
96
|
+
- Above pointer: 6px border-top, positioned at `bottom: -6px`
|
|
97
|
+
- Below pointer: 6px border-bottom, positioned at `top: -6px`
|
|
98
|
+
- Tail uses `left: 50%` and `transform: translateX(-50%)` for centering
|
|
99
|
+
- The tooltip has `z-index: 1000` to appear above most content
|
|
100
|
+
- The tooltip is `position: absolute` relative to `:host` (which is `position: relative`)
|
|
101
|
+
- `:host` is `display: inline-block` to size to slotted content
|
|
102
|
+
- Transition duration is `0.2s ease` for opacity changes
|
|
103
|
+
- For very long tooltip text, consider wrapping or alternative UI patterns (max-width not set by default)
|
|
@@ -1,80 +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 }) showTail: boolean =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import { customElement } from "lit/decorators.js";
|
|
3
|
+
|
|
4
|
+
@customElement("rel-topbar-actions")
|
|
5
|
+
export class RelTopbarActions extends LitElement {
|
|
6
|
+
static styles = css`
|
|
7
|
+
.actions {
|
|
8
|
+
display: inline-flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
gap: var(--rel-spacing-space-xs, 8px);
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
render() {
|
|
15
|
+
return html`<div class="actions"><slot></slot></div>`;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare global {
|
|
20
|
+
interface HTMLElementTagNameMap {
|
|
21
|
+
"rel-topbar-actions": RelTopbarActions;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import { customElement, property } from "lit/decorators.js";
|
|
3
|
+
|
|
4
|
+
@customElement("rel-topbar-brand")
|
|
5
|
+
export class RelTopbarBrand extends LitElement {
|
|
6
|
+
@property({ type: String }) src: string = "";
|
|
7
|
+
@property({ type: String }) href: string = "/";
|
|
8
|
+
@property({ type: String }) label: string = "";
|
|
9
|
+
|
|
10
|
+
static styles = css`
|
|
11
|
+
:host {
|
|
12
|
+
display: inline-flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
a {
|
|
17
|
+
display: inline-flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
gap: var(--rel-spacing-space-xs);
|
|
20
|
+
text-decoration: none;
|
|
21
|
+
color: var(--rel-color-text-primary);
|
|
22
|
+
font-weight: var(--rel-fontWeights-semibold);
|
|
23
|
+
font-size: var(--rel-fontSizes-md);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
img {
|
|
27
|
+
display: block;
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
30
|
+
|
|
31
|
+
render() {
|
|
32
|
+
return html`
|
|
33
|
+
<a href="${this.href}" aria-label="${this.label || "Home"}">
|
|
34
|
+
${this.src
|
|
35
|
+
? html`<img src="${this.src}" alt="${this.label}" />`
|
|
36
|
+
: html`<slot>${this.label}</slot>`}
|
|
37
|
+
</a>
|
|
38
|
+
`;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
declare global {
|
|
43
|
+
interface HTMLElementTagNameMap {
|
|
44
|
+
"rel-topbar-brand": RelTopbarBrand;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import { customElement, property } from "lit/decorators.js";
|
|
3
|
+
|
|
4
|
+
@customElement("rel-topbar-dropdown-item")
|
|
5
|
+
export class RelTopbarDropdownItem extends LitElement {
|
|
6
|
+
@property({ type: String }) label: string = "";
|
|
7
|
+
@property({ type: String }) href: string = "#";
|
|
8
|
+
|
|
9
|
+
static styles = css`
|
|
10
|
+
.dropdown-item {
|
|
11
|
+
display: block;
|
|
12
|
+
padding: var(--rel-spacing-space-xs) var(--rel-spacing-space-md);
|
|
13
|
+
color: var(--rel-color-text-primary);
|
|
14
|
+
text-decoration: none;
|
|
15
|
+
font-size: var(--rel-fontSizes-md);
|
|
16
|
+
font-family: var(--rel-fontFamilies-primary, sans-serif);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.dropdown-item:hover {
|
|
20
|
+
background: var(--rel-color-bg-hover);
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
render() {
|
|
25
|
+
return html`<a href="${this.href}" class="dropdown-item">${this.label}</a>`;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare global {
|
|
30
|
+
interface HTMLElementTagNameMap {
|
|
31
|
+
"rel-topbar-dropdown-item": RelTopbarDropdownItem;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import { customElement } from "lit/decorators.js";
|
|
3
|
+
|
|
4
|
+
@customElement("rel-topbar-dropdown")
|
|
5
|
+
export class RelTopbarDropdown extends LitElement {
|
|
6
|
+
static styles = css`
|
|
7
|
+
.dropdown {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
min-width: 160px;
|
|
11
|
+
background: var(--rel-color-bg-primary);
|
|
12
|
+
border: 1px solid var(--rel-color-border-default);
|
|
13
|
+
border-radius: var(--rel-borders-radius-border-radius-200);
|
|
14
|
+
box-shadow: var(--rel-shadow-200);
|
|
15
|
+
padding: var(--rel-spacing-space-2xs) 0;
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
|
|
19
|
+
render() {
|
|
20
|
+
return html`<div class="dropdown"><slot></slot></div>`;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare global {
|
|
25
|
+
interface HTMLElementTagNameMap {
|
|
26
|
+
"rel-topbar-dropdown": RelTopbarDropdown;
|
|
27
|
+
}
|
|
28
|
+
}
|