@reliability-design/web 1.0.6 → 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/dist/components/rel-accordion/rel-accordion.ts +20 -31
- package/dist/components/rel-alert/rel-alert.ts +81 -11
- package/dist/components/rel-avatar/rel-avatar.ts +6 -3
- package/dist/components/rel-badge/rel-badge.ts +8 -3
- package/dist/components/rel-breadcrumb/rel-breadcrumb.ts +6 -6
- package/dist/components/rel-button/rel-button.ts +118 -16
- package/dist/components/rel-calendar/rel-calendar.ts +16 -9
- 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 -469
- package/dist/components/rel-checkbox/rel-checkbox.ts +98 -15
- package/dist/components/rel-chip/rel-chip.ts +291 -186
- 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 +12 -3
- package/dist/components/rel-drawer/rel-drawer-footer.ts +27 -0
- package/dist/components/rel-drawer/rel-drawer.ts +57 -113
- 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 -327
- 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 +602 -576
- package/dist/components/rel-nav-menu/rel-nav-menu-item.ts +240 -143
- package/dist/components/rel-nav-menu/rel-nav-menu.ts +227 -331
- package/dist/components/rel-navbar/rel-navbar.ts +13 -0
- package/dist/components/rel-otp/rel-otp.ts +22 -25
- package/dist/components/rel-pagination/rel-pagination.ts +112 -63
- package/dist/components/rel-popover/rel-popover-content.ts +6 -5
- package/dist/components/rel-popover/rel-popover.ts +42 -20
- package/dist/components/rel-progress/rel-progress.ts +10 -9
- package/dist/components/rel-radio/rel-radio.ts +228 -155
- package/dist/components/rel-range-picker/rel-range-picker.css +349 -0
- package/dist/components/rel-range-picker/rel-range-picker.ts +1079 -0
- package/dist/components/rel-resizable/rel-resizable-handle.ts +12 -15
- package/dist/components/rel-segmented-button/rel-segmented-button.ts +41 -20
- package/dist/components/rel-select/rel-select.ts +112 -27
- package/dist/components/rel-sheet/rel-sheet.ts +362 -683
- package/dist/components/rel-sidebar/rel-sidebar.ts +13 -5
- package/dist/components/rel-slider/rel-slider.ts +74 -29
- package/dist/components/rel-snackbar/rel-snackbar.ts +67 -37
- package/dist/components/rel-stepper/rel-stepper.ts +43 -31
- package/dist/components/rel-switch/rel-switch.ts +26 -12
- package/dist/components/rel-tab/rel-tab.ts +57 -37
- package/dist/components/rel-table/rel-table-body.ts +5 -0
- package/dist/components/rel-table/rel-table-caption.ts +6 -1
- package/dist/components/rel-table/rel-table-cell.ts +42 -49
- package/dist/components/rel-table/rel-table-footer.ts +5 -0
- package/dist/components/rel-table/rel-table-head.ts +13 -1
- package/dist/components/rel-table/rel-table-header.ts +5 -0
- package/dist/components/rel-table/rel-table-row.ts +7 -3
- package/dist/components/rel-table/rel-table.ts +8 -2
- package/dist/components/rel-textfield/rel-textfield.ts +153 -44
- package/dist/components/rel-toast/rel-toast.ts +56 -22
- package/dist/components/rel-tooltip/rel-tooltip.ts +52 -9
- package/dist/components/rel-topbar/rel-topbar-actions.ts +24 -0
- package/dist/components/rel-topbar/rel-topbar-brand.ts +47 -0
- package/dist/components/rel-topbar/rel-topbar-dropdown-item.ts +63 -0
- package/dist/components/rel-topbar/rel-topbar-dropdown.ts +28 -0
- package/dist/components/rel-topbar/rel-topbar-item.ts +320 -0
- package/dist/components/rel-topbar/rel-topbar-mobile-panel.ts +24 -0
- package/dist/components/rel-topbar/rel-topbar-profile.ts +222 -0
- package/dist/components/rel-topbar/rel-topbar-utilities.ts +24 -0
- package/dist/components/rel-topbar/rel-topbar.ts +438 -0
- package/dist/index.d.mts +375 -411
- package/dist/index.d.ts +375 -411
- package/dist/index.js +7587 -7980
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7647 -8023
- 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 +79 -27
- package/dist/{vars-ITL2K3KO.css → vars-I2PC74XD.css} +79 -27
- package/dist/vars-v2-VMGWTFJZ.css +525 -0
- package/package.json +3 -1
- package/dist/components/rel-quote-page/README.md +0 -166
- package/dist/components/rel-quote-page/rel-quote-page.ts +0 -816
|
@@ -1,5 +1,6 @@
|
|
|
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
|
export type StepStatus = "done" | "progress" | "disabled";
|
|
5
6
|
export type TextAlign = "right" | "below";
|
|
@@ -126,16 +127,16 @@ export class RelStepper extends LitElement {
|
|
|
126
127
|
display: flex;
|
|
127
128
|
align-items: center;
|
|
128
129
|
justify-content: center;
|
|
129
|
-
width: 22px;
|
|
130
|
-
height: 22px;
|
|
131
|
-
border: 2px solid var(--rel-
|
|
132
|
-
background: var(--rel-
|
|
130
|
+
width: var(--rel-stepper-indicator-size, 22px);
|
|
131
|
+
height: var(--rel-stepper-indicator-size, 22px);
|
|
132
|
+
border: 2px solid var(--rel-color-border-default);
|
|
133
|
+
background: var(--rel-color-bg-primary);
|
|
133
134
|
border-radius: 50%;
|
|
134
135
|
font-size: var(--rel-fontSizes-sm);
|
|
135
136
|
font-weight: var(--rel-fontWeights-medium);
|
|
136
137
|
position: relative;
|
|
137
138
|
z-index: 2;
|
|
138
|
-
transition:
|
|
139
|
+
transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
|
|
139
140
|
flex-shrink: 0;
|
|
140
141
|
}
|
|
141
142
|
|
|
@@ -151,7 +152,7 @@ export class RelStepper extends LitElement {
|
|
|
151
152
|
.step-label {
|
|
152
153
|
white-space: nowrap;
|
|
153
154
|
font-size: var(--rel-fontSizes-sm);
|
|
154
|
-
color: var(--rel-text-primary
|
|
155
|
+
color: var(--rel-color-text-primary);
|
|
155
156
|
}
|
|
156
157
|
|
|
157
158
|
/* Horizontal text-below specific */
|
|
@@ -187,7 +188,7 @@ export class RelStepper extends LitElement {
|
|
|
187
188
|
********************************************/
|
|
188
189
|
.connector {
|
|
189
190
|
position: absolute;
|
|
190
|
-
background: var(--rel-
|
|
191
|
+
background: var(--rel-color-border-default);
|
|
191
192
|
z-index: 1;
|
|
192
193
|
}
|
|
193
194
|
|
|
@@ -198,7 +199,7 @@ export class RelStepper extends LitElement {
|
|
|
198
199
|
transform: translateY(-50%);
|
|
199
200
|
height: 2px;
|
|
200
201
|
position: absolute;
|
|
201
|
-
background: var(--rel-
|
|
202
|
+
background: var(--rel-color-border-default);
|
|
202
203
|
}
|
|
203
204
|
|
|
204
205
|
.rel-stepper.horizontal .rel-step:last-child .connector {
|
|
@@ -237,43 +238,54 @@ export class RelStepper extends LitElement {
|
|
|
237
238
|
* Step States
|
|
238
239
|
********************************************/
|
|
239
240
|
.rel-step.done .indicator {
|
|
240
|
-
background: var(--rel-
|
|
241
|
-
border-color: var(--rel-
|
|
242
|
-
color: var(--rel-
|
|
241
|
+
background: var(--rel-color-text-heading);
|
|
242
|
+
border-color: var(--rel-color-text-heading);
|
|
243
|
+
color: var(--rel-color-text-inverse);
|
|
243
244
|
}
|
|
244
245
|
|
|
245
246
|
.rel-step.progress .indicator {
|
|
246
|
-
border-color: var(--rel-
|
|
247
|
-
|
|
248
|
-
|
|
247
|
+
border-color: var(--rel-color-text-heading);
|
|
248
|
+
background: var(--rel-color-bg-primary);
|
|
249
|
+
color: var(--rel-color-text-heading);
|
|
249
250
|
}
|
|
250
251
|
|
|
251
252
|
.rel-step.disabled .indicator {
|
|
252
|
-
background: var(--rel-
|
|
253
|
-
border-color: var(--rel-
|
|
254
|
-
color: var(--rel-text-disabled
|
|
253
|
+
background: var(--rel-color-bg-secondary);
|
|
254
|
+
border-color: var(--rel-color-border-default);
|
|
255
|
+
color: var(--rel-color-text-disabled);
|
|
255
256
|
}
|
|
256
257
|
|
|
257
258
|
.rel-step.done .connector {
|
|
258
|
-
background: var(--rel-
|
|
259
|
+
background: var(--rel-color-text-heading);
|
|
259
260
|
}
|
|
260
261
|
|
|
261
262
|
.rel-step.progress .connector {
|
|
262
|
-
background: var(--rel-
|
|
263
|
+
background: var(--rel-color-text-heading);
|
|
263
264
|
}
|
|
264
265
|
|
|
265
266
|
.rel-step.done .step-label {
|
|
266
|
-
color: var(--rel-
|
|
267
|
+
color: var(--rel-color-text-heading);
|
|
267
268
|
font-weight: var(--rel-fontWeights-semibold);
|
|
268
269
|
}
|
|
269
270
|
|
|
270
271
|
.rel-step.progress .step-label {
|
|
271
|
-
color: var(--rel-
|
|
272
|
+
color: var(--rel-color-text-heading);
|
|
272
273
|
font-weight: var(--rel-fontWeights-semibold);
|
|
273
274
|
}
|
|
274
275
|
|
|
275
276
|
.rel-step.disabled .step-label {
|
|
276
|
-
color: var(--rel-text-disabled
|
|
277
|
+
color: var(--rel-color-text-disabled);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/* Dark mode: ensure progress/done indicator and labels stay readable */
|
|
281
|
+
:host-context(:root[data-theme="dark"]) .rel-step.progress .step-label,
|
|
282
|
+
:host-context(.dark) .rel-step.progress .step-label {
|
|
283
|
+
color: var(--rel-color-text-primary);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
:host-context(:root[data-theme="dark"]) .rel-step.progress .indicator,
|
|
287
|
+
:host-context(.dark) .rel-step.progress .indicator {
|
|
288
|
+
color: #ffffff;
|
|
277
289
|
}
|
|
278
290
|
|
|
279
291
|
/********************************************
|
|
@@ -281,36 +293,36 @@ export class RelStepper extends LitElement {
|
|
|
281
293
|
********************************************/
|
|
282
294
|
/* Horizontal */
|
|
283
295
|
.rel-stepper.large.horizontal {
|
|
284
|
-
gap: 86px;
|
|
296
|
+
gap: var(--rel-stepper-connector-length-lg, 86px);
|
|
285
297
|
}
|
|
286
298
|
|
|
287
299
|
.rel-stepper.small.horizontal {
|
|
288
|
-
gap: 60px;
|
|
300
|
+
gap: var(--rel-stepper-connector-length-md, 60px);
|
|
289
301
|
}
|
|
290
302
|
|
|
291
303
|
.rel-stepper.large.horizontal .connector {
|
|
292
|
-
width: 86px;
|
|
304
|
+
width: var(--rel-stepper-connector-length-lg, 86px);
|
|
293
305
|
}
|
|
294
306
|
|
|
295
307
|
.rel-stepper.small.horizontal .connector {
|
|
296
|
-
width: 60px;
|
|
308
|
+
width: var(--rel-stepper-connector-length-md, 60px);
|
|
297
309
|
}
|
|
298
310
|
|
|
299
311
|
/* Vertical */
|
|
300
312
|
.rel-stepper.large.vertical .connector {
|
|
301
|
-
height: 86px;
|
|
313
|
+
height: var(--rel-stepper-connector-length-lg, 86px);
|
|
302
314
|
}
|
|
303
315
|
|
|
304
316
|
.rel-stepper.large.vertical {
|
|
305
|
-
gap: 86px;
|
|
317
|
+
gap: var(--rel-stepper-connector-length-lg, 86px);
|
|
306
318
|
}
|
|
307
319
|
|
|
308
320
|
.rel-stepper.small.vertical .connector {
|
|
309
|
-
height: 42px;
|
|
321
|
+
height: var(--rel-stepper-connector-length-sm, 42px);
|
|
310
322
|
}
|
|
311
323
|
|
|
312
324
|
.rel-stepper.small.vertical {
|
|
313
|
-
gap: 42px;
|
|
325
|
+
gap: var(--rel-stepper-connector-length-sm, 42px);
|
|
314
326
|
}
|
|
315
327
|
`;
|
|
316
328
|
|
|
@@ -338,7 +350,7 @@ export class RelStepper extends LitElement {
|
|
|
338
350
|
if (step.status === "disabled") return;
|
|
339
351
|
|
|
340
352
|
this.dispatchEvent(
|
|
341
|
-
new CustomEvent("step-change", {
|
|
353
|
+
new CustomEvent("rel-step-change", {
|
|
342
354
|
detail: {
|
|
343
355
|
index,
|
|
344
356
|
step,
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
import { LitElement, html, css } from "lit";
|
|
2
2
|
import { customElement, property, state } from "lit/decorators.js";
|
|
3
|
+
import "../../styles/vars-v2.css";
|
|
3
4
|
|
|
4
5
|
@customElement("rel-switch")
|
|
5
6
|
export class RelSwitch extends LitElement {
|
|
6
7
|
@property({ type: Boolean }) checked = false;
|
|
7
8
|
@property({ type: Boolean }) disabled = false;
|
|
9
|
+
@property({ type: String }) value = "";
|
|
10
|
+
|
|
11
|
+
private _onChange: (value: boolean) => void = () => {};
|
|
12
|
+
private _onTouched: () => void = () => {};
|
|
8
13
|
|
|
9
14
|
@state() private isFocused = false;
|
|
10
15
|
@state() private isPressed = false;
|
|
11
16
|
|
|
12
17
|
static styles = css`
|
|
13
18
|
:host {
|
|
14
|
-
--switch-track: var(--rel-text-placeholder);
|
|
15
|
-
--switch-knob-on: var(--rel-
|
|
16
|
-
--switch-knob-off: var(--rel-
|
|
17
|
-
--switch-halo: var(--rel-border-default);
|
|
18
|
-
--switch-disabled: var(--rel-text-disabled);
|
|
19
|
+
--switch-track: var(--rel-color-text-placeholder);
|
|
20
|
+
--switch-knob-on: var(--rel-color-text-primary);
|
|
21
|
+
--switch-knob-off: var(--rel-color-bg-primary);
|
|
22
|
+
--switch-halo: var(--rel-color-border-default);
|
|
23
|
+
--switch-disabled: var(--rel-color-text-disabled);
|
|
19
24
|
display: inline-block;
|
|
20
25
|
}
|
|
21
26
|
|
|
@@ -23,8 +28,8 @@ export class RelSwitch extends LitElement {
|
|
|
23
28
|
.switch-wrapper {
|
|
24
29
|
position: relative;
|
|
25
30
|
display: inline-block;
|
|
26
|
-
width: 42px;
|
|
27
|
-
height: 22px;
|
|
31
|
+
width: var(--rel-switch-track-width, 42px);
|
|
32
|
+
height: var(--rel-switch-track-height, 22px);
|
|
28
33
|
cursor: pointer;
|
|
29
34
|
}
|
|
30
35
|
|
|
@@ -60,8 +65,8 @@ export class RelSwitch extends LitElement {
|
|
|
60
65
|
top: 50%;
|
|
61
66
|
left: -2px;
|
|
62
67
|
transform: translateY(-50%);
|
|
63
|
-
height: 18px;
|
|
64
|
-
width: 18px;
|
|
68
|
+
height: var(--rel-switch-thumb-size, 18px);
|
|
69
|
+
width: var(--rel-switch-thumb-size, 18px);
|
|
65
70
|
background-color: var(--switch-knob-off);
|
|
66
71
|
border-radius: 50%;
|
|
67
72
|
transition: transform 0.25s ease, background-color 0.25s ease,
|
|
@@ -77,7 +82,7 @@ export class RelSwitch extends LitElement {
|
|
|
77
82
|
|
|
78
83
|
/* Hover */
|
|
79
84
|
.switch-wrapper:hover:not(.switch-disabled) .switch-slider {
|
|
80
|
-
background-color: var(--rel-text-
|
|
85
|
+
background-color: var(--rel-color-text-placeholder);
|
|
81
86
|
}
|
|
82
87
|
|
|
83
88
|
/* Focus halo */
|
|
@@ -116,14 +121,22 @@ export class RelSwitch extends LitElement {
|
|
|
116
121
|
this.checked = input.checked;
|
|
117
122
|
|
|
118
123
|
this.dispatchEvent(
|
|
119
|
-
new CustomEvent
|
|
120
|
-
detail:
|
|
124
|
+
new CustomEvent("rel-change", {
|
|
125
|
+
detail: {
|
|
126
|
+
checked: this.checked,
|
|
127
|
+
value: this.value,
|
|
128
|
+
},
|
|
121
129
|
bubbles: true,
|
|
122
130
|
composed: true,
|
|
123
131
|
})
|
|
124
132
|
);
|
|
133
|
+
this._onChange(this.checked);
|
|
125
134
|
}
|
|
126
135
|
|
|
136
|
+
registerOnChange(fn: (value: boolean) => void): void { this._onChange = fn; }
|
|
137
|
+
registerOnTouched(fn: () => void): void { this._onTouched = fn; }
|
|
138
|
+
writeValue(checked: boolean): void { this.checked = checked; }
|
|
139
|
+
|
|
127
140
|
private handleFocus() {
|
|
128
141
|
this.isFocused = true;
|
|
129
142
|
}
|
|
@@ -131,6 +144,7 @@ export class RelSwitch extends LitElement {
|
|
|
131
144
|
private handleBlur() {
|
|
132
145
|
this.isFocused = false;
|
|
133
146
|
this.isPressed = false;
|
|
147
|
+
this._onTouched();
|
|
134
148
|
}
|
|
135
149
|
|
|
136
150
|
private handleMouseDown() {
|
|
@@ -1,5 +1,7 @@
|
|
|
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
|
+
import "../../styles/vars-v2.css";
|
|
4
|
+
import "../rel-badge/rel-badge";
|
|
3
5
|
|
|
4
6
|
export interface TabItem {
|
|
5
7
|
label: string;
|
|
@@ -7,47 +9,60 @@ export interface TabItem {
|
|
|
7
9
|
disabled?: boolean;
|
|
8
10
|
}
|
|
9
11
|
|
|
12
|
+
@customElement("rel-tab-item")
|
|
13
|
+
export class RelTabItem extends LitElement {
|
|
14
|
+
@property({ type: String }) label: string = "";
|
|
15
|
+
@property({ type: String }) value: string = "";
|
|
16
|
+
@property({ type: Number }) badge: number = 0;
|
|
17
|
+
@property({ type: Boolean }) disabled: boolean = false;
|
|
18
|
+
|
|
19
|
+
render() {
|
|
20
|
+
return html``;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
10
24
|
@customElement("rel-tab")
|
|
11
25
|
export class RelTab extends LitElement {
|
|
12
26
|
@property({ type: Array }) tabs: TabItem[] = [];
|
|
13
27
|
@property({ type: Number, reflect: true }) activeIndex = 0;
|
|
28
|
+
@state() private _tabItems: RelTabItem[] = [];
|
|
14
29
|
|
|
15
30
|
static styles = css`
|
|
16
31
|
:host {
|
|
17
32
|
--tab-active-color: var(--rel-colors-green-primary);
|
|
18
|
-
--tab-text-default: var(--rel-text-primary);
|
|
19
|
-
--tab-text-disabled: var(--rel-text-disabled);
|
|
20
|
-
--tab-text-hover: var(--rel-text-heading);
|
|
33
|
+
--tab-text-default: var(--rel-color-text-primary);
|
|
34
|
+
--tab-text-disabled: var(--rel-color-text-disabled);
|
|
35
|
+
--tab-text-hover: var(--rel-color-text-heading);
|
|
21
36
|
--tab-underline-height: 3px;
|
|
22
|
-
--tab-hover-color: var(--rel-
|
|
37
|
+
--tab-hover-color: var(--rel-color-bg-tertiary);
|
|
23
38
|
display: block;
|
|
24
39
|
font-family: var(--rel-fontFamilies-primary);
|
|
25
40
|
}
|
|
26
41
|
|
|
27
42
|
.tabs-wrapper {
|
|
28
43
|
display: flex;
|
|
29
|
-
border-bottom: 1px solid var(--rel-border-tab
|
|
30
|
-
font-family: var(--rel-fontFamilies-primary
|
|
44
|
+
border-bottom: 1px solid var(--rel-border-tab);
|
|
45
|
+
font-family: var(--rel-fontFamilies-primary);
|
|
31
46
|
user-select: none;
|
|
32
47
|
}
|
|
33
48
|
|
|
34
49
|
.tab {
|
|
35
50
|
position: relative;
|
|
36
|
-
padding: var(--rel-spacing-space-sm
|
|
51
|
+
padding: var(--rel-spacing-space-sm) var(--rel-spacing-space-md);
|
|
37
52
|
cursor: pointer;
|
|
38
53
|
color: var(--tab-text-default);
|
|
39
|
-
font-size: var(--rel-fontSizes-md
|
|
40
|
-
font-weight: var(--rel-fontWeights-medium
|
|
54
|
+
font-size: var(--rel-fontSizes-md);
|
|
55
|
+
font-weight: var(--rel-fontWeights-medium);
|
|
41
56
|
transition: color 0.2s ease;
|
|
42
57
|
display: flex;
|
|
43
58
|
align-items: center;
|
|
44
|
-
gap: var(--rel-spacing-space-2xs
|
|
59
|
+
gap: var(--rel-spacing-space-2xs);
|
|
45
60
|
}
|
|
46
61
|
|
|
47
62
|
.tab:focus-visible {
|
|
48
|
-
outline: 2px solid var(--rel-border-
|
|
63
|
+
outline: 2px solid var(--rel-color-border-focus);
|
|
49
64
|
outline-offset: -2px;
|
|
50
|
-
border-radius: var(--rel-borders-radius-border-radius-100
|
|
65
|
+
border-radius: var(--rel-borders-radius-border-radius-100);
|
|
51
66
|
}
|
|
52
67
|
|
|
53
68
|
.tab:hover:not(.disabled) .tab-label {
|
|
@@ -78,33 +93,35 @@ export class RelTab extends LitElement {
|
|
|
78
93
|
background-color: var(--tab-hover-color);
|
|
79
94
|
}
|
|
80
95
|
|
|
81
|
-
/* Badge */
|
|
82
|
-
.tab-badge {
|
|
83
|
-
display: inline-flex;
|
|
84
|
-
justify-content: center;
|
|
85
|
-
align-items: center;
|
|
86
|
-
background: var(--rel-colors-red-primary);
|
|
87
|
-
color: var(--rel-colors-white);
|
|
88
|
-
border-radius: 50%;
|
|
89
|
-
font-size: 11px;
|
|
90
|
-
font-weight: 600;
|
|
91
|
-
min-width: 16px;
|
|
92
|
-
text-align: center;
|
|
93
|
-
height: 16px;
|
|
94
|
-
padding: 2px;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
96
|
/* Tab content */
|
|
98
97
|
.tab-content {
|
|
99
98
|
padding: 1rem 0;
|
|
100
99
|
}
|
|
101
100
|
`;
|
|
102
101
|
|
|
102
|
+
private _onSlotChange(e: Event) {
|
|
103
|
+
const slot = e.target as HTMLSlotElement;
|
|
104
|
+
this._tabItems = slot
|
|
105
|
+
.assignedElements()
|
|
106
|
+
.filter((el): el is RelTabItem => el instanceof RelTabItem);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
private get _effectiveTabs(): Array<{ label: string; badge?: number; disabled?: boolean }> {
|
|
110
|
+
if (this._tabItems.length > 0) {
|
|
111
|
+
return this._tabItems.map((item) => ({
|
|
112
|
+
label: item.label,
|
|
113
|
+
badge: item.badge || 0,
|
|
114
|
+
disabled: item.disabled,
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
return this.tabs;
|
|
118
|
+
}
|
|
119
|
+
|
|
103
120
|
private selectTab(index: number) {
|
|
104
|
-
if (this.
|
|
121
|
+
if (this._effectiveTabs[index]?.disabled) return;
|
|
105
122
|
this.activeIndex = index;
|
|
106
123
|
this.dispatchEvent(
|
|
107
|
-
new CustomEvent<number>("tab-change", {
|
|
124
|
+
new CustomEvent<number>("rel-tab-change", {
|
|
108
125
|
detail: index,
|
|
109
126
|
bubbles: true,
|
|
110
127
|
composed: true,
|
|
@@ -114,7 +131,7 @@ export class RelTab extends LitElement {
|
|
|
114
131
|
|
|
115
132
|
private onKeyDown(event: KeyboardEvent, index: number) {
|
|
116
133
|
if (event.key === "Enter" || event.key === " ") {
|
|
117
|
-
if (this.
|
|
134
|
+
if (this._effectiveTabs[index]?.disabled) return;
|
|
118
135
|
event.preventDefault();
|
|
119
136
|
this.selectTab(index);
|
|
120
137
|
return;
|
|
@@ -123,10 +140,11 @@ export class RelTab extends LitElement {
|
|
|
123
140
|
if (event.key === "ArrowRight" || event.key === "ArrowLeft") {
|
|
124
141
|
event.preventDefault();
|
|
125
142
|
const dir = event.key === "ArrowRight" ? 1 : -1;
|
|
143
|
+
const tabs = this._effectiveTabs;
|
|
126
144
|
let next = index;
|
|
127
|
-
for (let i = 0; i <
|
|
128
|
-
next = (next + dir +
|
|
129
|
-
if (!
|
|
145
|
+
for (let i = 0; i < tabs.length; i++) {
|
|
146
|
+
next = (next + dir + tabs.length) % tabs.length;
|
|
147
|
+
if (!tabs[next]?.disabled) break;
|
|
130
148
|
}
|
|
131
149
|
this.selectTab(next);
|
|
132
150
|
this.updateComplete.then(() => {
|
|
@@ -137,9 +155,11 @@ export class RelTab extends LitElement {
|
|
|
137
155
|
}
|
|
138
156
|
|
|
139
157
|
render() {
|
|
158
|
+
const tabs = this._effectiveTabs;
|
|
140
159
|
return html`
|
|
160
|
+
<slot name="items" style="display:none;" @slotchange="${this._onSlotChange}"></slot>
|
|
141
161
|
<div class="tabs-wrapper" role="tablist">
|
|
142
|
-
${
|
|
162
|
+
${tabs.map(
|
|
143
163
|
(tab, i) => html`
|
|
144
164
|
<div
|
|
145
165
|
class="tab ${i === this.activeIndex
|
|
@@ -154,7 +174,7 @@ export class RelTab extends LitElement {
|
|
|
154
174
|
>
|
|
155
175
|
<span class="tab-label">${tab.label}</span>
|
|
156
176
|
${tab.badge
|
|
157
|
-
? html`<
|
|
177
|
+
? html`<rel-badge number="${tab.badge}" variant="number" size="sm"></rel-badge>`
|
|
158
178
|
: ""}
|
|
159
179
|
<span class="tab-underline"></span>
|
|
160
180
|
</div>
|
|
@@ -12,10 +12,15 @@ export class RelTableCaption extends LitElement {
|
|
|
12
12
|
padding-top: var(--rel-spacing-space-sm);
|
|
13
13
|
font-size: var(--rel-fontSizes-sm);
|
|
14
14
|
color: var(--rel-colors-gray-placeholder);
|
|
15
|
-
text-align:
|
|
15
|
+
text-align: left;
|
|
16
16
|
}
|
|
17
17
|
`;
|
|
18
18
|
|
|
19
|
+
connectedCallback() {
|
|
20
|
+
super.connectedCallback();
|
|
21
|
+
this.setAttribute("role", "caption");
|
|
22
|
+
}
|
|
23
|
+
|
|
19
24
|
render() {
|
|
20
25
|
return html`<slot></slot>`;
|
|
21
26
|
}
|
|
@@ -1,49 +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:
|
|
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
|
-
super.connectedCallback();
|
|
44
|
-
// Set colspan attribute on the host element for table layout
|
|
45
|
-
if (this.colspan) {
|
|
46
|
-
this.setAttribute("colspan", this.colspan.toString());
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
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
|
+
}
|
|
@@ -15,7 +15,13 @@ export class RelTableHead extends LitElement {
|
|
|
15
15
|
font-size: var(--rel-fontSizes-sm);
|
|
16
16
|
color: var(--rel-colors-gray-placeholder);
|
|
17
17
|
vertical-align: middle;
|
|
18
|
-
height: 48px;
|
|
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;
|
|
19
25
|
}
|
|
20
26
|
|
|
21
27
|
:host([align="center"]) {
|
|
@@ -27,6 +33,12 @@ export class RelTableHead extends LitElement {
|
|
|
27
33
|
}
|
|
28
34
|
`;
|
|
29
35
|
|
|
36
|
+
connectedCallback() {
|
|
37
|
+
super.connectedCallback();
|
|
38
|
+
this.setAttribute("role", "columnheader");
|
|
39
|
+
this.setAttribute("scope", "col");
|
|
40
|
+
}
|
|
41
|
+
|
|
30
42
|
render() {
|
|
31
43
|
return html`<slot></slot>`;
|
|
32
44
|
}
|
|
@@ -9,7 +9,6 @@ export class RelTableRow extends LitElement {
|
|
|
9
9
|
:host {
|
|
10
10
|
display: table-row;
|
|
11
11
|
font-family: var(--rel-fontFamilies-primary);
|
|
12
|
-
border-bottom: var(--rel-borders-width-stroke-100) solid var(--rel-colors-gray-border);
|
|
13
12
|
transition: background-color 0.15s ease;
|
|
14
13
|
}
|
|
15
14
|
|
|
@@ -18,14 +17,19 @@ export class RelTableRow extends LitElement {
|
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
:host([selected]) {
|
|
21
|
-
background-color: var(--rel-
|
|
20
|
+
background-color: var(--rel-color-bg-selected);
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
:host([selected]:hover) {
|
|
25
|
-
background-color: var(--rel-
|
|
24
|
+
background-color: var(--rel-color-bg-hover);
|
|
26
25
|
}
|
|
27
26
|
`;
|
|
28
27
|
|
|
28
|
+
connectedCallback() {
|
|
29
|
+
super.connectedCallback();
|
|
30
|
+
this.setAttribute("role", "row");
|
|
31
|
+
}
|
|
32
|
+
|
|
29
33
|
render() {
|
|
30
34
|
return html`<slot></slot>`;
|
|
31
35
|
}
|
|
@@ -20,9 +20,10 @@ export class RelTable extends LitElement {
|
|
|
20
20
|
overflow-x: auto;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
:host([bordered])
|
|
24
|
-
border: var(--rel-borders-width-stroke-100) solid var(--rel-
|
|
23
|
+
:host([bordered]) {
|
|
24
|
+
border: var(--rel-borders-width-stroke-100) solid var(--rel-color-border-default);
|
|
25
25
|
border-radius: var(--rel-borders-radius-border-radius-200);
|
|
26
|
+
overflow: hidden;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
table {
|
|
@@ -35,6 +36,11 @@ export class RelTable extends LitElement {
|
|
|
35
36
|
}
|
|
36
37
|
`;
|
|
37
38
|
|
|
39
|
+
connectedCallback() {
|
|
40
|
+
super.connectedCallback();
|
|
41
|
+
this.setAttribute("role", "table");
|
|
42
|
+
}
|
|
43
|
+
|
|
38
44
|
render() {
|
|
39
45
|
return html`
|
|
40
46
|
<div class="table-wrapper">
|