@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LitElement, html, css } from "lit";
|
|
2
|
-
import { customElement, property } from "lit/decorators.js";
|
|
2
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
3
3
|
|
|
4
4
|
export interface TabItem {
|
|
5
5
|
label: string;
|
|
@@ -7,41 +7,60 @@ export interface TabItem {
|
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
@customElement("rel-tab-item")
|
|
11
|
+
export class RelTabItem extends LitElement {
|
|
12
|
+
@property({ type: String }) label: string = "";
|
|
13
|
+
@property({ type: String }) value: string = "";
|
|
14
|
+
@property({ type: Number }) badge: number = 0;
|
|
15
|
+
@property({ type: Boolean }) disabled: boolean = false;
|
|
16
|
+
|
|
17
|
+
render() {
|
|
18
|
+
return html``;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
10
22
|
@customElement("rel-tab")
|
|
11
23
|
export class RelTab extends LitElement {
|
|
12
24
|
@property({ type: Array }) tabs: TabItem[] = [];
|
|
13
25
|
@property({ type: Number, reflect: true }) activeIndex = 0;
|
|
26
|
+
@state() private _tabItems: RelTabItem[] = [];
|
|
14
27
|
|
|
15
28
|
static styles = css`
|
|
16
29
|
:host {
|
|
17
|
-
--tab-active-color:
|
|
18
|
-
--tab-text-default:
|
|
19
|
-
--tab-text-disabled:
|
|
20
|
-
--tab-text-hover:
|
|
30
|
+
--tab-active-color: var(--rel-colors-green-primary);
|
|
31
|
+
--tab-text-default: var(--rel-text-primary);
|
|
32
|
+
--tab-text-disabled: var(--rel-text-disabled);
|
|
33
|
+
--tab-text-hover: var(--rel-text-heading);
|
|
21
34
|
--tab-underline-height: 3px;
|
|
22
|
-
--tab-hover-color:
|
|
35
|
+
--tab-hover-color: var(--rel-surface-surface);
|
|
23
36
|
display: block;
|
|
24
37
|
font-family: var(--rel-fontFamilies-primary);
|
|
25
38
|
}
|
|
26
39
|
|
|
27
40
|
.tabs-wrapper {
|
|
28
41
|
display: flex;
|
|
29
|
-
border-bottom: 1px solid #
|
|
30
|
-
font-family: var(--rel-fontFamilies-primary);
|
|
42
|
+
border-bottom: 1px solid var(--rel-border-tab, #c4c4c4);
|
|
43
|
+
font-family: var(--rel-fontFamilies-primary, sans-serif);
|
|
31
44
|
user-select: none;
|
|
32
45
|
}
|
|
33
46
|
|
|
34
47
|
.tab {
|
|
35
48
|
position: relative;
|
|
36
|
-
padding:
|
|
49
|
+
padding: var(--rel-spacing-space-sm, 12px) var(--rel-spacing-space-md, 16px);
|
|
37
50
|
cursor: pointer;
|
|
38
51
|
color: var(--tab-text-default);
|
|
39
|
-
font-size:
|
|
40
|
-
font-weight: 500;
|
|
52
|
+
font-size: var(--rel-fontSizes-md, 14px);
|
|
53
|
+
font-weight: var(--rel-fontWeights-medium, 500);
|
|
41
54
|
transition: color 0.2s ease;
|
|
42
55
|
display: flex;
|
|
43
56
|
align-items: center;
|
|
44
|
-
gap:
|
|
57
|
+
gap: var(--rel-spacing-space-2xs, 4px);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.tab:focus-visible {
|
|
61
|
+
outline: 2px solid var(--rel-border-info, #0091ea);
|
|
62
|
+
outline-offset: -2px;
|
|
63
|
+
border-radius: var(--rel-borders-radius-border-radius-100, 2px);
|
|
45
64
|
}
|
|
46
65
|
|
|
47
66
|
.tab:hover:not(.disabled) .tab-label {
|
|
@@ -77,15 +96,15 @@ export class RelTab extends LitElement {
|
|
|
77
96
|
display: inline-flex;
|
|
78
97
|
justify-content: center;
|
|
79
98
|
align-items: center;
|
|
80
|
-
background:
|
|
81
|
-
color: #
|
|
82
|
-
border-radius: 50
|
|
83
|
-
font-size:
|
|
99
|
+
background: var(--rel-color-brand);
|
|
100
|
+
color: #000000;
|
|
101
|
+
border-radius: var(--rel-tab-badge-radius, 50%);
|
|
102
|
+
font-size: var(--rel-fontSizes-xs);
|
|
84
103
|
font-weight: 600;
|
|
85
|
-
min-width: 16px;
|
|
104
|
+
min-width: var(--rel-tab-badge-min-width, 16px);
|
|
86
105
|
text-align: center;
|
|
87
|
-
height: 16px;
|
|
88
|
-
padding: 2px;
|
|
106
|
+
height: var(--rel-tab-badge-height, 16px);
|
|
107
|
+
padding: var(--rel-spacing-space-3xs, 2px);
|
|
89
108
|
}
|
|
90
109
|
|
|
91
110
|
/* Tab content */
|
|
@@ -94,11 +113,29 @@ export class RelTab extends LitElement {
|
|
|
94
113
|
}
|
|
95
114
|
`;
|
|
96
115
|
|
|
116
|
+
private _onSlotChange(e: Event) {
|
|
117
|
+
const slot = e.target as HTMLSlotElement;
|
|
118
|
+
this._tabItems = slot
|
|
119
|
+
.assignedElements()
|
|
120
|
+
.filter((el): el is RelTabItem => el instanceof RelTabItem);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
private get _effectiveTabs(): Array<{ label: string; badge?: number; disabled?: boolean }> {
|
|
124
|
+
if (this._tabItems.length > 0) {
|
|
125
|
+
return this._tabItems.map((item) => ({
|
|
126
|
+
label: item.label,
|
|
127
|
+
badge: item.badge || 0,
|
|
128
|
+
disabled: item.disabled,
|
|
129
|
+
}));
|
|
130
|
+
}
|
|
131
|
+
return this.tabs;
|
|
132
|
+
}
|
|
133
|
+
|
|
97
134
|
private selectTab(index: number) {
|
|
98
|
-
if (this.
|
|
135
|
+
if (this._effectiveTabs[index]?.disabled) return;
|
|
99
136
|
this.activeIndex = index;
|
|
100
137
|
this.dispatchEvent(
|
|
101
|
-
new CustomEvent<number>("tab-change", {
|
|
138
|
+
new CustomEvent<number>("rel-tab-change", {
|
|
102
139
|
detail: index,
|
|
103
140
|
bubbles: true,
|
|
104
141
|
composed: true,
|
|
@@ -107,17 +144,36 @@ export class RelTab extends LitElement {
|
|
|
107
144
|
}
|
|
108
145
|
|
|
109
146
|
private onKeyDown(event: KeyboardEvent, index: number) {
|
|
110
|
-
if (this.tabs[index]?.disabled) return;
|
|
111
147
|
if (event.key === "Enter" || event.key === " ") {
|
|
148
|
+
if (this._effectiveTabs[index]?.disabled) return;
|
|
112
149
|
event.preventDefault();
|
|
113
150
|
this.selectTab(index);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (event.key === "ArrowRight" || event.key === "ArrowLeft") {
|
|
155
|
+
event.preventDefault();
|
|
156
|
+
const dir = event.key === "ArrowRight" ? 1 : -1;
|
|
157
|
+
const tabs = this._effectiveTabs;
|
|
158
|
+
let next = index;
|
|
159
|
+
for (let i = 0; i < tabs.length; i++) {
|
|
160
|
+
next = (next + dir + tabs.length) % tabs.length;
|
|
161
|
+
if (!tabs[next]?.disabled) break;
|
|
162
|
+
}
|
|
163
|
+
this.selectTab(next);
|
|
164
|
+
this.updateComplete.then(() => {
|
|
165
|
+
const tabEls = this.shadowRoot?.querySelectorAll("[role=tab]");
|
|
166
|
+
(tabEls?.[next] as HTMLElement)?.focus();
|
|
167
|
+
});
|
|
114
168
|
}
|
|
115
169
|
}
|
|
116
170
|
|
|
117
171
|
render() {
|
|
172
|
+
const tabs = this._effectiveTabs;
|
|
118
173
|
return html`
|
|
174
|
+
<slot name="items" style="display:none;" @slotchange="${this._onSlotChange}"></slot>
|
|
119
175
|
<div class="tabs-wrapper" role="tablist">
|
|
120
|
-
${
|
|
176
|
+
${tabs.map(
|
|
121
177
|
(tab, i) => html`
|
|
122
178
|
<div
|
|
123
179
|
class="tab ${i === this.activeIndex
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# rel-table
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
A simple table wrapper component providing optional border and compact mode styling. Uses slots to accept standard HTML table content (thead, tbody, tfoot). Features horizontal scrolling for overflow and semantic table structure.
|
|
5
|
+
|
|
6
|
+
## Usage
|
|
7
|
+
```html
|
|
8
|
+
<!-- Basic table -->
|
|
9
|
+
<rel-table>
|
|
10
|
+
<thead>
|
|
11
|
+
<tr>
|
|
12
|
+
<th>Name</th>
|
|
13
|
+
<th>Email</th>
|
|
14
|
+
<th>Role</th>
|
|
15
|
+
</tr>
|
|
16
|
+
</thead>
|
|
17
|
+
<tbody>
|
|
18
|
+
<tr>
|
|
19
|
+
<td>John Doe</td>
|
|
20
|
+
<td>john@example.com</td>
|
|
21
|
+
<td>Admin</td>
|
|
22
|
+
</tr>
|
|
23
|
+
<tr>
|
|
24
|
+
<td>Jane Smith</td>
|
|
25
|
+
<td>jane@example.com</td>
|
|
26
|
+
<td>User</td>
|
|
27
|
+
</tr>
|
|
28
|
+
</tbody>
|
|
29
|
+
</rel-table>
|
|
30
|
+
|
|
31
|
+
<!-- Bordered table -->
|
|
32
|
+
<rel-table bordered>
|
|
33
|
+
<thead>
|
|
34
|
+
<tr>
|
|
35
|
+
<th>Product</th>
|
|
36
|
+
<th>Price</th>
|
|
37
|
+
<th>Quantity</th>
|
|
38
|
+
</tr>
|
|
39
|
+
</thead>
|
|
40
|
+
<tbody>
|
|
41
|
+
<tr>
|
|
42
|
+
<td>Widget</td>
|
|
43
|
+
<td>$10.00</td>
|
|
44
|
+
<td>5</td>
|
|
45
|
+
</tr>
|
|
46
|
+
<tr>
|
|
47
|
+
<td>Gadget</td>
|
|
48
|
+
<td>$25.00</td>
|
|
49
|
+
<td>2</td>
|
|
50
|
+
</tr>
|
|
51
|
+
</tbody>
|
|
52
|
+
</rel-table>
|
|
53
|
+
|
|
54
|
+
<!-- Compact table -->
|
|
55
|
+
<rel-table compact>
|
|
56
|
+
<thead>
|
|
57
|
+
<tr>
|
|
58
|
+
<th>ID</th>
|
|
59
|
+
<th>Status</th>
|
|
60
|
+
</tr>
|
|
61
|
+
</thead>
|
|
62
|
+
<tbody>
|
|
63
|
+
<tr>
|
|
64
|
+
<td>001</td>
|
|
65
|
+
<td>Active</td>
|
|
66
|
+
</tr>
|
|
67
|
+
<tr>
|
|
68
|
+
<td>002</td>
|
|
69
|
+
<td>Pending</td>
|
|
70
|
+
</tr>
|
|
71
|
+
</tbody>
|
|
72
|
+
</rel-table>
|
|
73
|
+
|
|
74
|
+
<!-- Bordered and compact -->
|
|
75
|
+
<rel-table bordered compact>
|
|
76
|
+
<thead>
|
|
77
|
+
<tr>
|
|
78
|
+
<th>Date</th>
|
|
79
|
+
<th>Event</th>
|
|
80
|
+
</tr>
|
|
81
|
+
</thead>
|
|
82
|
+
<tbody>
|
|
83
|
+
<tr>
|
|
84
|
+
<td>2024-01-15</td>
|
|
85
|
+
<td>Launch</td>
|
|
86
|
+
</tr>
|
|
87
|
+
<tr>
|
|
88
|
+
<td>2024-02-20</td>
|
|
89
|
+
<td>Update</td>
|
|
90
|
+
</tr>
|
|
91
|
+
</tbody>
|
|
92
|
+
</rel-table>
|
|
93
|
+
|
|
94
|
+
<!-- Responsive table with horizontal scroll -->
|
|
95
|
+
<rel-table bordered>
|
|
96
|
+
<thead>
|
|
97
|
+
<tr>
|
|
98
|
+
<th>Column 1</th>
|
|
99
|
+
<th>Column 2</th>
|
|
100
|
+
<th>Column 3</th>
|
|
101
|
+
<th>Column 4</th>
|
|
102
|
+
<th>Column 5</th>
|
|
103
|
+
<th>Column 6</th>
|
|
104
|
+
<th>Column 7</th>
|
|
105
|
+
<th>Column 8</th>
|
|
106
|
+
</tr>
|
|
107
|
+
</thead>
|
|
108
|
+
<tbody>
|
|
109
|
+
<tr>
|
|
110
|
+
<td>Data 1</td>
|
|
111
|
+
<td>Data 2</td>
|
|
112
|
+
<td>Data 3</td>
|
|
113
|
+
<td>Data 4</td>
|
|
114
|
+
<td>Data 5</td>
|
|
115
|
+
<td>Data 6</td>
|
|
116
|
+
<td>Data 7</td>
|
|
117
|
+
<td>Data 8</td>
|
|
118
|
+
</tr>
|
|
119
|
+
</tbody>
|
|
120
|
+
</rel-table>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## API
|
|
124
|
+
|
|
125
|
+
### Attributes/Properties
|
|
126
|
+
| Name | Type | Default | Description |
|
|
127
|
+
|------|------|---------|-------------|
|
|
128
|
+
| `bordered` (reflected) | `boolean` | `false` | Adds border and border-radius to the table wrapper |
|
|
129
|
+
| `compact` (reflected) | `boolean` | `false` | Applies compact spacing (currently defined but not styled in component) |
|
|
130
|
+
|
|
131
|
+
## Events
|
|
132
|
+
None.
|
|
133
|
+
|
|
134
|
+
## Slots
|
|
135
|
+
| Slot | Description |
|
|
136
|
+
|------|-------------|
|
|
137
|
+
| (default) | Standard HTML table content (`<thead>`, `<tbody>`, `<tfoot>`, `<tr>`, `<th>`, `<td>`, etc.) |
|
|
138
|
+
|
|
139
|
+
## CSS Parts
|
|
140
|
+
None exposed.
|
|
141
|
+
|
|
142
|
+
## Tokens / CSS Variables
|
|
143
|
+
|
|
144
|
+
### Semantic Tokens
|
|
145
|
+
- `--rel-fontFamilies-primary` - Font family
|
|
146
|
+
- `--rel-fontSizes-md` - Table font size
|
|
147
|
+
|
|
148
|
+
### Color Tokens
|
|
149
|
+
- `--rel-colors-gray-primary` - Table text color
|
|
150
|
+
- `--rel-colors-gray-border` - Border color (when bordered is true)
|
|
151
|
+
|
|
152
|
+
### Border Tokens
|
|
153
|
+
- `--rel-borders-width-stroke-100` - Border width
|
|
154
|
+
- `--rel-borders-radius-border-radius-200` - Table wrapper border radius
|
|
155
|
+
|
|
156
|
+
## Accessibility
|
|
157
|
+
- Uses semantic native `<table>` element for proper screen reader support
|
|
158
|
+
- Ensure slotted table content includes proper `<thead>`, `<th>`, and `scope` attributes
|
|
159
|
+
- `caption-side: bottom` allows captions to be read after table content
|
|
160
|
+
|
|
161
|
+
### Keyboard Interactions
|
|
162
|
+
- Standard browser table navigation
|
|
163
|
+
- Focusable elements within cells can be tabbed to
|
|
164
|
+
|
|
165
|
+
### Focus Behavior
|
|
166
|
+
- No specific focus handling (standard table behavior)
|
|
167
|
+
|
|
168
|
+
## Notes / Edge Cases
|
|
169
|
+
- The component wraps the table in a `.table-wrapper` div with `overflow-x: auto` for horizontal scrolling
|
|
170
|
+
- The inner `<table>` element uses `border-collapse: collapse` for standard table rendering
|
|
171
|
+
- **bordered mode**: Applies a border with `--rel-borders-width-stroke-100` and rounded corners to the wrapper
|
|
172
|
+
- The `bordered` and `compact` attributes are reflected in HTML (appear as actual attributes when set)
|
|
173
|
+
- **compact mode**: Currently reflected but no styling is applied in the component (may be intended for future use or external styling)
|
|
174
|
+
- The table is `width: 100%` by default
|
|
175
|
+
- The component is `display: block` and takes full width of its container
|
|
176
|
+
- The table uses `caption-side: bottom` for any `<caption>` elements
|
|
177
|
+
- You must provide your own cell padding, row styling, and hover effects via global CSS or inline styles
|
|
178
|
+
- The component provides minimal structural styling; most table appearance is controlled by the browser and your custom CSS
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import { customElement } from "lit/decorators.js";
|
|
3
|
+
|
|
4
|
+
@customElement("rel-table-body")
|
|
5
|
+
export class RelTableBody extends LitElement {
|
|
6
|
+
static styles = css`
|
|
7
|
+
:host {
|
|
8
|
+
display: table-row-group;
|
|
9
|
+
font-family: var(--rel-fontFamilies-primary);
|
|
10
|
+
}
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
connectedCallback() {
|
|
14
|
+
super.connectedCallback();
|
|
15
|
+
this.setAttribute("role", "rowgroup");
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
render() {
|
|
19
|
+
return html`<slot></slot>`;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import { customElement } from "lit/decorators.js";
|
|
3
|
+
|
|
4
|
+
@customElement("rel-table-caption")
|
|
5
|
+
export class RelTableCaption extends LitElement {
|
|
6
|
+
static styles = css`
|
|
7
|
+
:host {
|
|
8
|
+
display: table-caption;
|
|
9
|
+
caption-side: bottom;
|
|
10
|
+
font-family: var(--rel-fontFamilies-primary);
|
|
11
|
+
margin-top: var(--rel-spacing-space-md);
|
|
12
|
+
padding-top: var(--rel-spacing-space-sm);
|
|
13
|
+
font-size: var(--rel-fontSizes-sm);
|
|
14
|
+
color: var(--rel-colors-gray-placeholder);
|
|
15
|
+
text-align: left;
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
|
|
19
|
+
connectedCallback() {
|
|
20
|
+
super.connectedCallback();
|
|
21
|
+
this.setAttribute("role", "caption");
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
render() {
|
|
25
|
+
return html`<slot></slot>`;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import { customElement, property } from "lit/decorators.js";
|
|
3
|
+
|
|
4
|
+
@customElement("rel-table-cell")
|
|
5
|
+
export class RelTableCell extends LitElement {
|
|
6
|
+
@property({ type: String, reflect: true }) align: "left" | "center" | "right" = "left";
|
|
7
|
+
@property({ type: Number, reflect: true }) colspan?: number;
|
|
8
|
+
|
|
9
|
+
static styles = css`
|
|
10
|
+
:host {
|
|
11
|
+
display: contents;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
td {
|
|
15
|
+
border-right: 1px solid var(--rel-colors-gray-border, #e0e0e0);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
:host(:last-child) td {
|
|
19
|
+
border-right: none;
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
render() {
|
|
24
|
+
return html`
|
|
25
|
+
<td
|
|
26
|
+
role="cell"
|
|
27
|
+
colspan="${this.colspan ?? 1}"
|
|
28
|
+
style="
|
|
29
|
+
text-align: ${this.align};
|
|
30
|
+
font-family: var(--rel-fontFamilies-primary);
|
|
31
|
+
padding: var(--rel-spacing-space-sm) var(--rel-spacing-space-md);
|
|
32
|
+
font-size: var(--rel-fontSizes-md);
|
|
33
|
+
color: var(--rel-colors-gray-primary);
|
|
34
|
+
vertical-align: middle;
|
|
35
|
+
border-bottom: 1px solid var(--rel-colors-gray-border, #e0e0e0);
|
|
36
|
+
"
|
|
37
|
+
>
|
|
38
|
+
<slot></slot>
|
|
39
|
+
</td>
|
|
40
|
+
`;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import { customElement } from "lit/decorators.js";
|
|
3
|
+
|
|
4
|
+
@customElement("rel-table-footer")
|
|
5
|
+
export class RelTableFooter extends LitElement {
|
|
6
|
+
static styles = css`
|
|
7
|
+
:host {
|
|
8
|
+
display: table-footer-group;
|
|
9
|
+
font-family: var(--rel-fontFamilies-primary);
|
|
10
|
+
font-weight: var(--rel-fontWeights-medium, 500);
|
|
11
|
+
background-color: var(--rel-colors-gray-light);
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
connectedCallback() {
|
|
16
|
+
super.connectedCallback();
|
|
17
|
+
this.setAttribute("role", "rowgroup");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
render() {
|
|
21
|
+
return html`<slot></slot>`;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import { customElement, property } from "lit/decorators.js";
|
|
3
|
+
|
|
4
|
+
@customElement("rel-table-head")
|
|
5
|
+
export class RelTableHead extends LitElement {
|
|
6
|
+
@property({ type: String, reflect: true }) align: "left" | "center" | "right" = "left";
|
|
7
|
+
|
|
8
|
+
static styles = css`
|
|
9
|
+
:host {
|
|
10
|
+
display: table-cell;
|
|
11
|
+
font-family: var(--rel-fontFamilies-primary);
|
|
12
|
+
padding: var(--rel-spacing-space-sm) var(--rel-spacing-space-md);
|
|
13
|
+
text-align: left;
|
|
14
|
+
font-weight: var(--rel-fontWeights-medium, 500);
|
|
15
|
+
font-size: var(--rel-fontSizes-sm);
|
|
16
|
+
color: var(--rel-colors-gray-placeholder);
|
|
17
|
+
vertical-align: middle;
|
|
18
|
+
height: var(--rel-table-head-height, 48px);
|
|
19
|
+
border-bottom: 1px solid var(--rel-colors-gray-divider, #bdbdbd);
|
|
20
|
+
border-right: 1px solid var(--rel-colors-gray-border, #e0e0e0);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
:host(:last-child) {
|
|
24
|
+
border-right: none;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
:host([align="center"]) {
|
|
28
|
+
text-align: center;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
:host([align="right"]) {
|
|
32
|
+
text-align: right;
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
connectedCallback() {
|
|
37
|
+
super.connectedCallback();
|
|
38
|
+
this.setAttribute("role", "columnheader");
|
|
39
|
+
this.setAttribute("scope", "col");
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
render() {
|
|
43
|
+
return html`<slot></slot>`;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import { customElement } from "lit/decorators.js";
|
|
3
|
+
|
|
4
|
+
@customElement("rel-table-header")
|
|
5
|
+
export class RelTableHeader extends LitElement {
|
|
6
|
+
static styles = css`
|
|
7
|
+
:host {
|
|
8
|
+
display: table-header-group;
|
|
9
|
+
font-family: var(--rel-fontFamilies-primary);
|
|
10
|
+
}
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
connectedCallback() {
|
|
14
|
+
super.connectedCallback();
|
|
15
|
+
this.setAttribute("role", "rowgroup");
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
render() {
|
|
19
|
+
return html`<slot></slot>`;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import { customElement, property } from "lit/decorators.js";
|
|
3
|
+
|
|
4
|
+
@customElement("rel-table-row")
|
|
5
|
+
export class RelTableRow extends LitElement {
|
|
6
|
+
@property({ type: Boolean, reflect: true }) selected = false;
|
|
7
|
+
|
|
8
|
+
static styles = css`
|
|
9
|
+
:host {
|
|
10
|
+
display: table-row;
|
|
11
|
+
font-family: var(--rel-fontFamilies-primary);
|
|
12
|
+
transition: background-color 0.15s ease;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
:host(:hover) {
|
|
16
|
+
background-color: var(--rel-colors-gray-light);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
:host([selected]) {
|
|
20
|
+
background-color: var(--rel-color-bg-selected);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
:host([selected]:hover) {
|
|
24
|
+
background-color: var(--rel-color-bg-hover);
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
27
|
+
|
|
28
|
+
connectedCallback() {
|
|
29
|
+
super.connectedCallback();
|
|
30
|
+
this.setAttribute("role", "row");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
render() {
|
|
34
|
+
return html`<slot></slot>`;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import { customElement, property } from "lit/decorators.js";
|
|
3
|
+
|
|
4
|
+
@customElement("rel-table")
|
|
5
|
+
export class RelTable extends LitElement {
|
|
6
|
+
@property({ type: Boolean, reflect: true }) bordered = false;
|
|
7
|
+
@property({ type: Boolean, reflect: true }) compact = false;
|
|
8
|
+
|
|
9
|
+
static styles = css`
|
|
10
|
+
:host {
|
|
11
|
+
display: block;
|
|
12
|
+
font-family: var(--rel-fontFamilies-primary);
|
|
13
|
+
position: relative;
|
|
14
|
+
width: 100%;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.table-wrapper {
|
|
18
|
+
position: relative;
|
|
19
|
+
width: 100%;
|
|
20
|
+
overflow-x: auto;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
:host([bordered]) {
|
|
24
|
+
border: var(--rel-borders-width-stroke-100) solid var(--rel-color-border-default);
|
|
25
|
+
border-radius: var(--rel-borders-radius-border-radius-200);
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
table {
|
|
30
|
+
width: 100%;
|
|
31
|
+
caption-side: bottom;
|
|
32
|
+
border-collapse: collapse;
|
|
33
|
+
font-size: var(--rel-fontSizes-md);
|
|
34
|
+
color: var(--rel-colors-gray-primary);
|
|
35
|
+
font-family: var(--rel-fontFamilies-primary);
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
connectedCallback() {
|
|
40
|
+
super.connectedCallback();
|
|
41
|
+
this.setAttribute("role", "table");
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
render() {
|
|
45
|
+
return html`
|
|
46
|
+
<div class="table-wrapper">
|
|
47
|
+
<table>
|
|
48
|
+
<slot></slot>
|
|
49
|
+
</table>
|
|
50
|
+
</div>
|
|
51
|
+
`;
|
|
52
|
+
}
|
|
53
|
+
}
|