@reliability-design/web 1.0.6 → 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/rel-accordion.ts +4 -0
- package/dist/components/rel-alert/rel-alert.ts +83 -13
- package/dist/components/rel-avatar/rel-avatar.ts +3 -2
- package/dist/components/rel-badge/rel-badge.ts +6 -2
- package/dist/components/rel-button/rel-button.ts +64 -8
- package/dist/components/rel-calendar/rel-calendar.ts +3 -3
- package/dist/components/rel-carousel/rel-carousel.ts +10 -11
- package/dist/components/rel-checkbox/rel-checkbox.ts +33 -2
- package/dist/components/rel-chip/rel-chip.ts +63 -5
- package/dist/components/rel-divider/rel-divider.ts +9 -0
- package/dist/components/rel-drawer/rel-drawer-footer.ts +29 -0
- package/dist/components/rel-drawer/rel-drawer.ts +17 -26
- package/dist/components/rel-menu/rel-menu.ts +53 -21
- package/dist/components/rel-menubar/rel-menubar.ts +52 -23
- 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-pagination/rel-pagination.ts +11 -6
- package/dist/components/rel-popover/rel-popover.ts +16 -13
- package/dist/components/rel-radio/rel-radio.ts +18 -1
- package/dist/components/rel-resizable/rel-resizable-handle.ts +4 -8
- package/dist/components/rel-select/rel-select.ts +14 -0
- package/dist/components/rel-sheet/rel-sheet.ts +7 -6
- package/dist/components/rel-sidebar/rel-sidebar.ts +13 -5
- package/dist/components/rel-slider/rel-slider.ts +25 -2
- package/dist/components/rel-snackbar/rel-snackbar.ts +46 -16
- package/dist/components/rel-stepper/rel-stepper.ts +32 -21
- package/dist/components/rel-switch/rel-switch.ts +19 -6
- package/dist/components/rel-tab/rel-tab.ts +49 -15
- 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 +20 -20
- package/dist/components/rel-toast/rel-toast.ts +31 -10
- 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 +278 -289
- package/dist/index.d.ts +278 -289
- package/dist/index.js +4498 -5727
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4535 -5756
- package/dist/index.mjs.map +1 -1
- package/dist/styles/vars.css +346 -294
- package/dist/{vars-ITL2K3KO.css → vars-TBB4BMSD.css} +346 -294
- package/package.json +2 -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,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,10 +7,23 @@ 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 {
|
|
@@ -83,15 +96,15 @@ export class RelTab extends LitElement {
|
|
|
83
96
|
display: inline-flex;
|
|
84
97
|
justify-content: center;
|
|
85
98
|
align-items: center;
|
|
86
|
-
background: var(--rel-
|
|
87
|
-
color:
|
|
88
|
-
border-radius: 50
|
|
89
|
-
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);
|
|
90
103
|
font-weight: 600;
|
|
91
|
-
min-width: 16px;
|
|
104
|
+
min-width: var(--rel-tab-badge-min-width, 16px);
|
|
92
105
|
text-align: center;
|
|
93
|
-
height: 16px;
|
|
94
|
-
padding: 2px;
|
|
106
|
+
height: var(--rel-tab-badge-height, 16px);
|
|
107
|
+
padding: var(--rel-spacing-space-3xs, 2px);
|
|
95
108
|
}
|
|
96
109
|
|
|
97
110
|
/* Tab content */
|
|
@@ -100,11 +113,29 @@ export class RelTab extends LitElement {
|
|
|
100
113
|
}
|
|
101
114
|
`;
|
|
102
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
|
+
|
|
103
134
|
private selectTab(index: number) {
|
|
104
|
-
if (this.
|
|
135
|
+
if (this._effectiveTabs[index]?.disabled) return;
|
|
105
136
|
this.activeIndex = index;
|
|
106
137
|
this.dispatchEvent(
|
|
107
|
-
new CustomEvent<number>("tab-change", {
|
|
138
|
+
new CustomEvent<number>("rel-tab-change", {
|
|
108
139
|
detail: index,
|
|
109
140
|
bubbles: true,
|
|
110
141
|
composed: true,
|
|
@@ -114,7 +145,7 @@ export class RelTab extends LitElement {
|
|
|
114
145
|
|
|
115
146
|
private onKeyDown(event: KeyboardEvent, index: number) {
|
|
116
147
|
if (event.key === "Enter" || event.key === " ") {
|
|
117
|
-
if (this.
|
|
148
|
+
if (this._effectiveTabs[index]?.disabled) return;
|
|
118
149
|
event.preventDefault();
|
|
119
150
|
this.selectTab(index);
|
|
120
151
|
return;
|
|
@@ -123,10 +154,11 @@ export class RelTab extends LitElement {
|
|
|
123
154
|
if (event.key === "ArrowRight" || event.key === "ArrowLeft") {
|
|
124
155
|
event.preventDefault();
|
|
125
156
|
const dir = event.key === "ArrowRight" ? 1 : -1;
|
|
157
|
+
const tabs = this._effectiveTabs;
|
|
126
158
|
let next = index;
|
|
127
|
-
for (let i = 0; i <
|
|
128
|
-
next = (next + dir +
|
|
129
|
-
if (!
|
|
159
|
+
for (let i = 0; i < tabs.length; i++) {
|
|
160
|
+
next = (next + dir + tabs.length) % tabs.length;
|
|
161
|
+
if (!tabs[next]?.disabled) break;
|
|
130
162
|
}
|
|
131
163
|
this.selectTab(next);
|
|
132
164
|
this.updateComplete.then(() => {
|
|
@@ -137,9 +169,11 @@ export class RelTab extends LitElement {
|
|
|
137
169
|
}
|
|
138
170
|
|
|
139
171
|
render() {
|
|
172
|
+
const tabs = this._effectiveTabs;
|
|
140
173
|
return html`
|
|
174
|
+
<slot name="items" style="display:none;" @slotchange="${this._onSlotChange}"></slot>
|
|
141
175
|
<div class="tabs-wrapper" role="tablist">
|
|
142
|
-
${
|
|
176
|
+
${tabs.map(
|
|
143
177
|
(tab, i) => html`
|
|
144
178
|
<div
|
|
145
179
|
class="tab ${i === this.activeIndex
|
|
@@ -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">
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LitElement, html, css } from "lit";
|
|
2
2
|
import { customElement, property, state } from "lit/decorators.js";
|
|
3
3
|
|
|
4
|
-
export type TextFieldState = "default" | "
|
|
4
|
+
export type TextFieldState = "default" | "error" | "disabled";
|
|
5
5
|
export type TextFieldSize = "small" | "medium" | "large";
|
|
6
6
|
|
|
7
7
|
@customElement("rel-textfield")
|
|
@@ -16,7 +16,9 @@ export class RelTextfield extends LitElement {
|
|
|
16
16
|
@property({ type: String }) state: TextFieldState = "default";
|
|
17
17
|
@property({ type: String }) size: TextFieldSize = "medium";
|
|
18
18
|
|
|
19
|
-
@state() private internalState:
|
|
19
|
+
@state() private internalState: "default" | "focused" = "default";
|
|
20
|
+
|
|
21
|
+
private uniqueId = `textfield-${Math.random().toString(36).slice(2)}`;
|
|
20
22
|
|
|
21
23
|
static styles = css`
|
|
22
24
|
:host {
|
|
@@ -61,7 +63,7 @@ export class RelTextfield extends LitElement {
|
|
|
61
63
|
border: none;
|
|
62
64
|
outline: none;
|
|
63
65
|
font-size: var(--rel-fontSizes-md, 14px);
|
|
64
|
-
padding:
|
|
66
|
+
padding: var(--rel-spacing-space-xs, 8px) var(--rel-spacing-space-sm, 12px);
|
|
65
67
|
background: transparent;
|
|
66
68
|
font-family: var(--rel-fontFamilies-primary, sans-serif);
|
|
67
69
|
color: var(--rel-text-primary, #333);
|
|
@@ -88,27 +90,27 @@ export class RelTextfield extends LitElement {
|
|
|
88
90
|
}
|
|
89
91
|
|
|
90
92
|
.textfield-wrapper.small .textfield-input {
|
|
91
|
-
padding:
|
|
92
|
-
font-size:
|
|
93
|
+
padding: var(--rel-spacing-space-xs, 8px) var(--rel-spacing-space-sm, 12px);
|
|
94
|
+
font-size: var(--rel-fontSizes-sm, 12px);
|
|
93
95
|
}
|
|
94
96
|
|
|
95
97
|
.textfield-wrapper.medium .textfield-input {
|
|
96
|
-
padding:
|
|
97
|
-
font-size:
|
|
98
|
+
padding: var(--rel-spacing-space-sm, 12px) var(--rel-spacing-space-md, 16px);
|
|
99
|
+
font-size: var(--rel-fontSizes-md, 14px);
|
|
98
100
|
}
|
|
99
101
|
|
|
100
102
|
.textfield-wrapper.large .textfield-input {
|
|
101
|
-
padding:
|
|
102
|
-
font-size:
|
|
103
|
+
padding: var(--rel-spacing-space-md, 16px) var(--rel-spacing-space-md, 16px);
|
|
104
|
+
font-size: var(--rel-fontSizes-lg, 20px);
|
|
103
105
|
}
|
|
104
106
|
|
|
105
107
|
/* Adjust padding when icons are present */
|
|
106
108
|
.textfield-wrapper .textfield-input.has-left-icon {
|
|
107
|
-
padding-left:
|
|
109
|
+
padding-left: var(--rel-spacing-space-2xl, 32px);
|
|
108
110
|
}
|
|
109
111
|
|
|
110
112
|
.textfield-wrapper .textfield-input.has-right-icon {
|
|
111
|
-
padding-right:
|
|
113
|
+
padding-right: var(--rel-spacing-space-2xl, 32px);
|
|
112
114
|
}
|
|
113
115
|
|
|
114
116
|
/* States */
|
|
@@ -150,12 +152,8 @@ export class RelTextfield extends LitElement {
|
|
|
150
152
|
}
|
|
151
153
|
`;
|
|
152
154
|
|
|
153
|
-
private get currentState(): TextFieldState {
|
|
154
|
-
return this.state !== "default" ? this.state : this.internalState;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
155
|
private handleFocus() {
|
|
158
|
-
if (this.state !== "disabled"
|
|
156
|
+
if (this.state !== "disabled") {
|
|
159
157
|
this.internalState = "focused";
|
|
160
158
|
}
|
|
161
159
|
}
|
|
@@ -170,7 +168,7 @@ export class RelTextfield extends LitElement {
|
|
|
170
168
|
const input = e.target as HTMLInputElement;
|
|
171
169
|
this.value = input.value;
|
|
172
170
|
this.dispatchEvent(
|
|
173
|
-
new CustomEvent<string>("
|
|
171
|
+
new CustomEvent<string>("rel-change", {
|
|
174
172
|
detail: this.value,
|
|
175
173
|
bubbles: true,
|
|
176
174
|
composed: true,
|
|
@@ -182,8 +180,9 @@ export class RelTextfield extends LitElement {
|
|
|
182
180
|
const wrapperClasses = [
|
|
183
181
|
"textfield-wrapper",
|
|
184
182
|
this.size,
|
|
185
|
-
this.
|
|
186
|
-
|
|
183
|
+
this.state,
|
|
184
|
+
this.internalState === "focused" ? "focused" : "",
|
|
185
|
+
].filter(Boolean).join(" ");
|
|
187
186
|
|
|
188
187
|
const inputClasses = [
|
|
189
188
|
"textfield-input",
|
|
@@ -196,7 +195,7 @@ export class RelTextfield extends LitElement {
|
|
|
196
195
|
return html`
|
|
197
196
|
<div class="${wrapperClasses}">
|
|
198
197
|
${this.label
|
|
199
|
-
? html`<label class="textfield-label">${this.label}</label>`
|
|
198
|
+
? html`<label class="textfield-label" for="${this.uniqueId}">${this.label}</label>`
|
|
200
199
|
: ""}
|
|
201
200
|
|
|
202
201
|
<div
|
|
@@ -210,6 +209,7 @@ export class RelTextfield extends LitElement {
|
|
|
210
209
|
|
|
211
210
|
<input
|
|
212
211
|
type="${this.type}"
|
|
212
|
+
id="${this.uniqueId}"
|
|
213
213
|
class="${inputClasses}"
|
|
214
214
|
placeholder="${this.placeholder}"
|
|
215
215
|
.value="${this.value}"
|
|
@@ -9,9 +9,10 @@ export class RelToast extends LitElement {
|
|
|
9
9
|
@property({ type: String }) type: ToastType = "default";
|
|
10
10
|
@property({ type: String }) actionLabel?: string;
|
|
11
11
|
@property({ type: Number }) duration: number = 4000;
|
|
12
|
+
@property({ type: Boolean, reflect: true }) show = false;
|
|
12
13
|
|
|
13
14
|
@state() private visible: boolean = false;
|
|
14
|
-
private
|
|
15
|
+
private _dismissTimer: ReturnType<typeof setTimeout> | null = null;
|
|
15
16
|
|
|
16
17
|
static styles = css`
|
|
17
18
|
:host {
|
|
@@ -23,7 +24,7 @@ export class RelToast extends LitElement {
|
|
|
23
24
|
justify-content: center;
|
|
24
25
|
width: 100%;
|
|
25
26
|
pointer-events: none;
|
|
26
|
-
z-index:
|
|
27
|
+
z-index: var(--rel-z-toast, 9000);
|
|
27
28
|
font-family: var(--rel-fontFamilies-primary);
|
|
28
29
|
}
|
|
29
30
|
|
|
@@ -119,25 +120,45 @@ export class RelToast extends LitElement {
|
|
|
119
120
|
}
|
|
120
121
|
`;
|
|
121
122
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
123
|
+
willUpdate(changed: Map<string, unknown>) {
|
|
124
|
+
if (!changed.has('show')) return;
|
|
125
|
+
if (this.show) {
|
|
126
|
+
this.visible = true;
|
|
127
|
+
if (this._dismissTimer) clearTimeout(this._dismissTimer);
|
|
128
|
+
if (this.duration > 0) {
|
|
129
|
+
this._dismissTimer = setTimeout(() => this.close(), this.duration);
|
|
130
|
+
}
|
|
131
|
+
} else {
|
|
132
|
+
this.visible = false;
|
|
133
|
+
if (this._dismissTimer) {
|
|
134
|
+
clearTimeout(this._dismissTimer);
|
|
135
|
+
this._dismissTimer = null;
|
|
136
|
+
}
|
|
127
137
|
}
|
|
128
138
|
}
|
|
129
139
|
|
|
140
|
+
disconnectedCallback() {
|
|
141
|
+
super.disconnectedCallback();
|
|
142
|
+
if (this._dismissTimer) clearTimeout(this._dismissTimer);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
open() {
|
|
146
|
+
this.show = true;
|
|
147
|
+
}
|
|
148
|
+
|
|
130
149
|
close() {
|
|
150
|
+
this.show = false;
|
|
131
151
|
this.visible = false;
|
|
152
|
+
if (this._dismissTimer) {
|
|
153
|
+
clearTimeout(this._dismissTimer);
|
|
154
|
+
this._dismissTimer = null;
|
|
155
|
+
}
|
|
132
156
|
this.dispatchEvent(
|
|
133
157
|
new CustomEvent("dismissed", {
|
|
134
158
|
bubbles: true,
|
|
135
159
|
composed: true,
|
|
136
160
|
})
|
|
137
161
|
);
|
|
138
|
-
if (this.timeoutId) {
|
|
139
|
-
clearTimeout(this.timeoutId);
|
|
140
|
-
}
|
|
141
162
|
}
|
|
142
163
|
|
|
143
164
|
private handleActionClick(event: Event) {
|