@reliability-design/web 1.0.2 → 1.0.3
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 +27 -22
- package/dist/components/rel-alert/rel-alert.ts +98 -66
- package/dist/components/rel-avatar/rel-avatar.ts +8 -15
- package/dist/components/rel-badge/rel-badge.ts +23 -16
- package/dist/components/rel-breadcrumb/rel-breadcrumb.ts +12 -12
- package/dist/components/rel-button/rel-button.ts +39 -59
- package/dist/components/rel-card/rel-card.ts +11 -10
- package/dist/components/rel-cardmedia/rel-cardmedia.ts +11 -17
- package/dist/components/rel-checkbox/rel-checkbox.ts +18 -35
- package/dist/components/rel-chip/rel-chip.ts +37 -128
- package/dist/components/rel-container/rel-container.ts +1 -6
- package/dist/components/rel-divider/rel-divider.ts +37 -37
- package/dist/components/rel-layout/rel-layout.ts +12 -14
- package/dist/components/rel-progress/rel-progress.ts +26 -15
- package/dist/components/rel-radio/rel-radio.ts +32 -72
- package/dist/components/rel-snackbar/rel-snackbar.ts +6 -0
- package/dist/components/rel-stepper/rel-stepper.ts +23 -2
- package/dist/components/rel-switch/rel-switch.ts +7 -5
- package/dist/components/rel-tab/rel-tab.ts +10 -8
- package/dist/components/rel-textfield/rel-textfield.ts +2 -2
- package/dist/index.d.mts +11 -7
- package/dist/index.d.ts +11 -7
- package/dist/index.js +367 -475
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +383 -489
- package/dist/index.mjs.map +1 -1
- package/dist/vars-6ZIUPIU4.css +184 -0
- package/package.json +2 -2
- package/dist/components/rel-accordion/rel-accordion.stories.ts +0 -313
- package/dist/components/rel-alert/rel-alert.stories.ts +0 -412
- package/dist/components/rel-avatar/rel-avatar.stories.ts +0 -327
- package/dist/components/rel-badge/rel-badge.stories.ts +0 -350
- package/dist/components/rel-breadcrumb/rel-breadcrumb.stories.ts +0 -306
- package/dist/components/rel-button/rel-button.stories.ts +0 -356
- package/dist/components/rel-card/rel-card.stories.ts +0 -299
- package/dist/components/rel-cardmedia/rel-cardmedia.stories.ts +0 -368
- package/dist/components/rel-checkbox/rel-checkbox.stories.ts +0 -414
- package/dist/components/rel-chip/rel-chip.stories.ts +0 -552
- package/dist/components/rel-container/rel-container.stories.ts +0 -239
- package/dist/components/rel-divider/rel-divider.stories.ts +0 -229
- package/dist/components/rel-layout/rel-layout.stories.ts +0 -713
- package/dist/components/rel-menu/rel-menu.stories.ts +0 -910
- package/dist/components/rel-progress/rel-progress.stories.ts +0 -817
- package/dist/components/rel-radio/rel-radio.stories.ts +0 -1048
- package/dist/components/rel-segmented-button/rel-segmented-button.stories.ts +0 -1079
- package/dist/components/rel-select/rel-select.stories.ts +0 -1201
- package/dist/components/rel-slider/rel-slider.stories.ts +0 -730
- package/dist/components/rel-snackbar/rel-snackbar.stories.ts +0 -808
- package/dist/components/rel-stepper/rel-stepper.stories.ts +0 -752
- package/dist/components/rel-switch/rel-switch.stories.ts +0 -441
- package/dist/components/rel-tab/rel-tab.stories.ts +0 -492
- package/dist/components/rel-textfield/rel-textfield.stories.ts +0 -710
- package/dist/components/rel-toast/rel-toast.stories.ts +0 -394
- package/dist/components/rel-tooltip/rel-tooltip.stories.ts +0 -364
|
@@ -4,9 +4,7 @@ import { customElement, property } from "lit/decorators.js";
|
|
|
4
4
|
@customElement("rel-container")
|
|
5
5
|
export class RelContainer extends LitElement {
|
|
6
6
|
@property({ type: String }) padding: "sm" | "md" | "lg" = "md";
|
|
7
|
-
|
|
8
|
-
@property({ type: Boolean }) shadow: boolean = false;
|
|
9
|
-
|
|
7
|
+
@property({ type: Boolean }) shadow = false;
|
|
10
8
|
@property({ type: String }) background: "light" | "white" | "none" = "white";
|
|
11
9
|
|
|
12
10
|
static styles = css`
|
|
@@ -23,7 +21,6 @@ export class RelContainer extends LitElement {
|
|
|
23
21
|
box-sizing: border-box;
|
|
24
22
|
}
|
|
25
23
|
|
|
26
|
-
/* Background Variants */
|
|
27
24
|
.bg-white {
|
|
28
25
|
background-color: var(--rel-colors-white);
|
|
29
26
|
}
|
|
@@ -36,7 +33,6 @@ export class RelContainer extends LitElement {
|
|
|
36
33
|
background: transparent;
|
|
37
34
|
}
|
|
38
35
|
|
|
39
|
-
/* Padding Variants */
|
|
40
36
|
.padding-sm {
|
|
41
37
|
padding: var(--rel-spacing-space-xs);
|
|
42
38
|
}
|
|
@@ -49,7 +45,6 @@ export class RelContainer extends LitElement {
|
|
|
49
45
|
padding: var(--rel-spacing-space-2xl);
|
|
50
46
|
}
|
|
51
47
|
|
|
52
|
-
/* Shadow */
|
|
53
48
|
.shadow {
|
|
54
49
|
box-shadow: var(--rel-shadows-shadow-300);
|
|
55
50
|
}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { LitElement, html, css } from "lit";
|
|
2
|
-
import { customElement, property } from "lit/decorators.js";
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import { customElement, property } from "lit/decorators.js";
|
|
3
3
|
|
|
4
|
-
@customElement("rel-divider")
|
|
5
|
-
export class RelDivider extends LitElement {
|
|
6
|
-
|
|
4
|
+
@customElement("rel-divider")
|
|
5
|
+
export class RelDivider extends LitElement {
|
|
6
|
+
@property({ type: String }) orientation: "horizontal" | "vertical" = "horizontal";
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
static styles = css`
|
|
9
|
+
:host {
|
|
10
|
+
display: block;
|
|
11
|
+
}
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
.rel-divider {
|
|
14
|
+
position: relative;
|
|
15
|
+
display: flex;
|
|
16
|
+
background: transparent;
|
|
17
|
+
font-family: var(--rel-fontFamilies-primary);
|
|
18
|
+
color: var(--rel-colors-gray-primary);
|
|
19
|
+
}
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
/* Horizontal */
|
|
22
|
+
.rel-divider.horizontal {
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: var(--rel-borders-width-stroke-100);
|
|
25
|
+
background-color: var(--rel-colors-gray-border);
|
|
26
|
+
margin: var(--rel-spacing-space-md) 0;
|
|
27
|
+
}
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
`;
|
|
38
|
-
|
|
39
|
-
render() {
|
|
40
|
-
return html`
|
|
41
|
-
<div class="rel-divider ${this.orientation}" role="separator"></div>
|
|
29
|
+
/* Vertical */
|
|
30
|
+
.rel-divider.vertical {
|
|
31
|
+
width: var(--rel-borders-width-stroke-100);
|
|
32
|
+
background-color: var(--rel-colors-gray-border);
|
|
33
|
+
margin: 0 var(--rel-spacing-space-md);
|
|
34
|
+
align-self: stretch;
|
|
35
|
+
height: 100%;
|
|
36
|
+
}
|
|
42
37
|
`;
|
|
38
|
+
|
|
39
|
+
render() {
|
|
40
|
+
return html`
|
|
41
|
+
<div class="rel-divider ${this.orientation}" role="separator"></div>
|
|
42
|
+
`;
|
|
43
|
+
}
|
|
43
44
|
}
|
|
44
|
-
}
|
|
@@ -3,11 +3,12 @@ import { customElement, property } from "lit/decorators.js";
|
|
|
3
3
|
|
|
4
4
|
@customElement("rel-layout")
|
|
5
5
|
export class RelLayout extends LitElement {
|
|
6
|
-
@property({ type: String }) gap
|
|
6
|
+
@property({ type: String }) gap = "1rem";
|
|
7
7
|
|
|
8
|
-
@property({ type: Number }) columns
|
|
8
|
+
@property({ type: Number }) columns = 4;
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
// 🔥 IMPORTANT: reflect so CSS selectors work
|
|
11
|
+
@property({ type: Boolean, reflect: true }) responsive = true;
|
|
11
12
|
|
|
12
13
|
static styles = css`
|
|
13
14
|
:host {
|
|
@@ -21,11 +22,7 @@ export class RelLayout extends LitElement {
|
|
|
21
22
|
font-family: var(--rel-fontFamilies-primary);
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
/* Responsive breakpoints
|
|
25
|
-
:host([responsive]) .layout-grid {
|
|
26
|
-
/* Default: use columns property */
|
|
27
|
-
}
|
|
28
|
-
|
|
25
|
+
/* Responsive breakpoints — only when attribute exists */
|
|
29
26
|
@media (max-width: 1024px) {
|
|
30
27
|
:host([responsive]) .layout-grid {
|
|
31
28
|
grid-template-columns: repeat(3, 1fr) !important;
|
|
@@ -46,13 +43,14 @@ export class RelLayout extends LitElement {
|
|
|
46
43
|
`;
|
|
47
44
|
|
|
48
45
|
render() {
|
|
49
|
-
const gridStyle = `
|
|
50
|
-
gap: ${this.gap};
|
|
51
|
-
grid-template-columns: repeat(${this.columns}, 1fr);
|
|
52
|
-
`;
|
|
53
|
-
|
|
54
46
|
return html`
|
|
55
|
-
<div
|
|
47
|
+
<div
|
|
48
|
+
class="layout-grid"
|
|
49
|
+
style="
|
|
50
|
+
gap: ${this.gap};
|
|
51
|
+
grid-template-columns: repeat(${this.columns}, 1fr);
|
|
52
|
+
"
|
|
53
|
+
>
|
|
56
54
|
<slot></slot>
|
|
57
55
|
</div>
|
|
58
56
|
`;
|
|
@@ -9,9 +9,11 @@ export type ProgressMode =
|
|
|
9
9
|
|
|
10
10
|
@customElement("rel-progress")
|
|
11
11
|
export class RelProgress extends LitElement {
|
|
12
|
-
@property({ type: String
|
|
12
|
+
@property({ type: String, reflect: true })
|
|
13
|
+
mode: ProgressMode = "linear-determinate";
|
|
13
14
|
|
|
14
|
-
@property({ type: Number })
|
|
15
|
+
@property({ type: Number })
|
|
16
|
+
value = 0;
|
|
15
17
|
|
|
16
18
|
private radius = 15.9155;
|
|
17
19
|
private circumference = 2 * Math.PI * this.radius;
|
|
@@ -26,7 +28,7 @@ export class RelProgress extends LitElement {
|
|
|
26
28
|
display: inline-block;
|
|
27
29
|
}
|
|
28
30
|
|
|
29
|
-
/* Linear
|
|
31
|
+
/* Linear */
|
|
30
32
|
.linear-track {
|
|
31
33
|
background: var(--rel-colors-gray-border);
|
|
32
34
|
border-radius: var(--rel-borders-radius-border-radius-200);
|
|
@@ -58,7 +60,7 @@ export class RelProgress extends LitElement {
|
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
62
|
|
|
61
|
-
/* Circular
|
|
63
|
+
/* Circular */
|
|
62
64
|
.circular {
|
|
63
65
|
display: inline-block;
|
|
64
66
|
width: 48px;
|
|
@@ -83,11 +85,9 @@ export class RelProgress extends LitElement {
|
|
|
83
85
|
stroke-width: 3;
|
|
84
86
|
stroke-linecap: round;
|
|
85
87
|
transition: stroke-dashoffset 0.35s;
|
|
86
|
-
transform: rotate(0deg);
|
|
87
|
-
transform-origin: center;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
/*
|
|
90
|
+
/* Spinner */
|
|
91
91
|
.spinner {
|
|
92
92
|
animation: rotate 2s linear infinite;
|
|
93
93
|
}
|
|
@@ -120,10 +120,14 @@ export class RelProgress extends LitElement {
|
|
|
120
120
|
}
|
|
121
121
|
`;
|
|
122
122
|
|
|
123
|
+
private get safeValue() {
|
|
124
|
+
return Math.min(100, Math.max(0, this.value));
|
|
125
|
+
}
|
|
126
|
+
|
|
123
127
|
private renderLinearDeterminate() {
|
|
124
128
|
return html`
|
|
125
129
|
<div class="linear-track">
|
|
126
|
-
<div class="linear-bar" style="width: ${this.
|
|
130
|
+
<div class="linear-bar" style="width: ${this.safeValue}%"></div>
|
|
127
131
|
</div>
|
|
128
132
|
`;
|
|
129
133
|
}
|
|
@@ -137,19 +141,21 @@ export class RelProgress extends LitElement {
|
|
|
137
141
|
}
|
|
138
142
|
|
|
139
143
|
private renderCircularDeterminate() {
|
|
140
|
-
const offset =
|
|
144
|
+
const offset =
|
|
145
|
+
this.circumference - (this.safeValue / 100) * this.circumference;
|
|
141
146
|
|
|
142
147
|
return html`
|
|
143
148
|
<div class="circular">
|
|
144
149
|
<svg viewBox="0 0 36 36" class="circular-svg">
|
|
145
|
-
<circle class="circular-bg" cx="18" cy="18" r="
|
|
150
|
+
<circle class="circular-bg" cx="18" cy="18" r="${this.radius}" />
|
|
146
151
|
<circle
|
|
147
152
|
class="circular-progress"
|
|
148
153
|
cx="18"
|
|
149
154
|
cy="18"
|
|
150
|
-
r="
|
|
155
|
+
r="${this.radius}"
|
|
151
156
|
stroke-dasharray="${this.circumference}"
|
|
152
|
-
stroke-dashoffset="${offset}"
|
|
157
|
+
stroke-dashoffset="${offset}"
|
|
158
|
+
/>
|
|
153
159
|
</svg>
|
|
154
160
|
</div>
|
|
155
161
|
`;
|
|
@@ -159,7 +165,14 @@ export class RelProgress extends LitElement {
|
|
|
159
165
|
return html`
|
|
160
166
|
<div class="circular">
|
|
161
167
|
<svg viewBox="0 0 50 50" class="spinner">
|
|
162
|
-
<circle
|
|
168
|
+
<circle
|
|
169
|
+
class="spinner-path"
|
|
170
|
+
cx="25"
|
|
171
|
+
cy="25"
|
|
172
|
+
r="20"
|
|
173
|
+
fill="none"
|
|
174
|
+
stroke-width="4"
|
|
175
|
+
/>
|
|
163
176
|
</svg>
|
|
164
177
|
</div>
|
|
165
178
|
`;
|
|
@@ -167,8 +180,6 @@ export class RelProgress extends LitElement {
|
|
|
167
180
|
|
|
168
181
|
render() {
|
|
169
182
|
switch (this.mode) {
|
|
170
|
-
case "linear-determinate":
|
|
171
|
-
return this.renderLinearDeterminate();
|
|
172
183
|
case "linear-indeterminate":
|
|
173
184
|
return this.renderLinearIndeterminate();
|
|
174
185
|
case "circular-determinate":
|
|
@@ -13,9 +13,13 @@ export interface RadioOption {
|
|
|
13
13
|
export class RelRadio extends LitElement {
|
|
14
14
|
@property({ type: Array }) options: RadioOption[] = [];
|
|
15
15
|
|
|
16
|
-
@property({ type: String }) name
|
|
16
|
+
@property({ type: String }) name = "radio-group";
|
|
17
17
|
|
|
18
|
-
@property({ type: String
|
|
18
|
+
@property({ type: String, reflect: true })
|
|
19
|
+
selectedValue: string | null = null;
|
|
20
|
+
|
|
21
|
+
@property({ type: Boolean })
|
|
22
|
+
disabled = false;
|
|
19
23
|
|
|
20
24
|
static styles = css`
|
|
21
25
|
:host {
|
|
@@ -32,10 +36,13 @@ export class RelRadio extends LitElement {
|
|
|
32
36
|
.rel-radio-option {
|
|
33
37
|
display: flex;
|
|
34
38
|
flex-direction: column;
|
|
35
|
-
align-items: flex-start;
|
|
36
39
|
gap: var(--rel-spacing-space-3xs);
|
|
37
40
|
cursor: pointer;
|
|
38
|
-
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.rel-radio-option.disabled {
|
|
44
|
+
opacity: 0.6;
|
|
45
|
+
cursor: not-allowed !important;
|
|
39
46
|
}
|
|
40
47
|
|
|
41
48
|
.radio-main {
|
|
@@ -44,7 +51,7 @@ export class RelRadio extends LitElement {
|
|
|
44
51
|
gap: var(--rel-spacing-space-2xs);
|
|
45
52
|
}
|
|
46
53
|
|
|
47
|
-
|
|
54
|
+
input {
|
|
48
55
|
position: absolute;
|
|
49
56
|
opacity: 0;
|
|
50
57
|
pointer-events: none;
|
|
@@ -55,98 +62,55 @@ export class RelRadio extends LitElement {
|
|
|
55
62
|
height: 20px;
|
|
56
63
|
border: 2px solid var(--rel-colors-black);
|
|
57
64
|
border-radius: 50%;
|
|
58
|
-
display: inline-block;
|
|
59
65
|
position: relative;
|
|
60
|
-
flex-shrink: 0;
|
|
61
|
-
transition: all 0.2s ease-in-out;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.rel-radio-option input:focus + .radio-custom {
|
|
65
|
-
outline: var(--rel-borders-width-stroke-200) solid var(--rel-colors-black);
|
|
66
|
-
outline-offset: var(--rel-spacing-space-3xs);
|
|
67
66
|
}
|
|
68
67
|
|
|
69
|
-
|
|
68
|
+
input:checked + .radio-custom::after {
|
|
70
69
|
content: "";
|
|
71
70
|
position: absolute;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
width: 10px;
|
|
75
|
-
height: 10px;
|
|
76
|
-
background-color: var(--rel-colors-black);
|
|
71
|
+
inset: 4px;
|
|
72
|
+
background: var(--rel-colors-black);
|
|
77
73
|
border-radius: 50%;
|
|
78
|
-
transform: translate(-50%, -50%);
|
|
79
74
|
}
|
|
80
75
|
|
|
81
|
-
/* Error state */
|
|
82
|
-
.rel-radio-option.error .radio-custom {
|
|
83
|
-
border-color: var(--rel-colors-red-secondary);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.rel-radio-option.error input:checked + .radio-custom::after {
|
|
87
|
-
background-color: var(--rel-colors-red-secondary);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.rel-radio-option.error .radio-label,
|
|
91
|
-
.rel-radio-option.error .radio-supporting {
|
|
92
|
-
color: var(--rel-colors-red-secondary);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.rel-radio-option.error input:focus + .radio-custom {
|
|
96
|
-
outline: var(--rel-borders-width-stroke-200) solid var(--rel-colors-red-secondary);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/* Disabled state */
|
|
100
|
-
.rel-radio-option.disabled {
|
|
101
|
-
opacity: 0.6;
|
|
102
|
-
cursor: not-allowed !important;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.rel-radio-option.disabled .radio-label,
|
|
106
|
-
.rel-radio-option.disabled .radio-supporting {
|
|
107
|
-
cursor: not-allowed !important;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/* Text styles */
|
|
111
76
|
.radio-label {
|
|
112
77
|
font-size: var(--rel-fontSizes-sm);
|
|
113
78
|
font-weight: var(--rel-fontWeights-medium);
|
|
114
|
-
color: var(--rel-colors-gray-heading);
|
|
115
|
-
line-height: var(--rel-lineHeights-sm);
|
|
116
79
|
}
|
|
117
80
|
|
|
118
81
|
.radio-supporting {
|
|
119
82
|
font-size: var(--rel-fontSizes-xs);
|
|
120
|
-
color: var(--rel-colors-gray-placeholder);
|
|
121
83
|
margin-left: 28px;
|
|
122
|
-
line-height: var(--rel-lineHeights-xs);
|
|
123
84
|
}
|
|
124
85
|
|
|
125
|
-
.radio-
|
|
126
|
-
color: var(--rel-colors-red-secondary);
|
|
86
|
+
.error .radio-custom {
|
|
87
|
+
border-color: var(--rel-colors-red-secondary);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.error input:checked + .radio-custom::after {
|
|
91
|
+
background: var(--rel-colors-red-secondary);
|
|
127
92
|
}
|
|
128
93
|
`;
|
|
129
94
|
|
|
130
95
|
private onChange(value: string) {
|
|
96
|
+
if (this.disabled) return;
|
|
97
|
+
|
|
131
98
|
this.selectedValue = value;
|
|
132
99
|
this.dispatchEvent(
|
|
133
100
|
new CustomEvent("changed", {
|
|
134
|
-
detail: { value },
|
|
135
101
|
bubbles: true,
|
|
136
102
|
composed: true,
|
|
137
103
|
})
|
|
138
104
|
);
|
|
139
105
|
}
|
|
140
106
|
|
|
141
|
-
private isChecked(value: string): boolean {
|
|
142
|
-
return this.selectedValue === value;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
107
|
private renderOption(option: RadioOption) {
|
|
146
|
-
const isChecked = this.
|
|
108
|
+
const isChecked = this.selectedValue === option.value;
|
|
109
|
+
const isDisabled = this.disabled || option.disabled;
|
|
110
|
+
|
|
147
111
|
const classes = [
|
|
148
112
|
"rel-radio-option",
|
|
149
|
-
|
|
113
|
+
isDisabled ? "disabled" : "",
|
|
150
114
|
option.error ? "error" : "",
|
|
151
115
|
]
|
|
152
116
|
.filter(Boolean)
|
|
@@ -158,20 +122,16 @@ export class RelRadio extends LitElement {
|
|
|
158
122
|
<input
|
|
159
123
|
type="radio"
|
|
160
124
|
name="${this.name}"
|
|
161
|
-
.value="${option.value}"
|
|
162
125
|
.checked="${isChecked}"
|
|
163
|
-
?disabled="${
|
|
164
|
-
@change="${() =>
|
|
126
|
+
?disabled="${isDisabled}"
|
|
127
|
+
@change="${() => this.onChange(option.value)}"
|
|
128
|
+
/>
|
|
165
129
|
<span class="radio-custom"></span>
|
|
166
130
|
<span class="radio-label">${option.label}</span>
|
|
167
131
|
</div>
|
|
168
132
|
|
|
169
133
|
${option.supportingText
|
|
170
|
-
? html
|
|
171
|
-
<div class="radio-supporting ${option.error ? "error-text" : ""}">
|
|
172
|
-
${option.supportingText}
|
|
173
|
-
</div>
|
|
174
|
-
`
|
|
134
|
+
? html`<div class="radio-supporting">${option.supportingText}</div>`
|
|
175
135
|
: ""}
|
|
176
136
|
</label>
|
|
177
137
|
`;
|
|
@@ -180,7 +140,7 @@ export class RelRadio extends LitElement {
|
|
|
180
140
|
render() {
|
|
181
141
|
return html`
|
|
182
142
|
<div class="rel-radio-group">
|
|
183
|
-
${this.options.map((
|
|
143
|
+
${this.options.map((o) => this.renderOption(o))}
|
|
184
144
|
</div>
|
|
185
145
|
`;
|
|
186
146
|
}
|
|
@@ -137,6 +137,12 @@ export class RelSnackbar extends LitElement {
|
|
|
137
137
|
this.setAutoDismiss();
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
updated(changed: Map<string, unknown>) {
|
|
141
|
+
if (changed.has("duration") || changed.has("longerAction")) {
|
|
142
|
+
this.setAutoDismiss();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
140
146
|
disconnectedCallback() {
|
|
141
147
|
super.disconnectedCallback();
|
|
142
148
|
this.clearTimeout();
|
|
@@ -226,7 +226,10 @@ export class RelStepper extends LitElement {
|
|
|
226
226
|
display: none;
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
-
.rel-stepper.vertical.text-right
|
|
229
|
+
.rel-stepper.vertical.text-right
|
|
230
|
+
.rel-step:last-child
|
|
231
|
+
.indicator-wrapper
|
|
232
|
+
.connector {
|
|
230
233
|
display: none;
|
|
231
234
|
}
|
|
232
235
|
|
|
@@ -331,6 +334,21 @@ export class RelStepper extends LitElement {
|
|
|
331
334
|
return classes.join(" ");
|
|
332
335
|
}
|
|
333
336
|
|
|
337
|
+
private onStepClick(step: Step, index: number) {
|
|
338
|
+
if (step.status === "disabled") return;
|
|
339
|
+
|
|
340
|
+
this.dispatchEvent(
|
|
341
|
+
new CustomEvent("step-change", {
|
|
342
|
+
detail: {
|
|
343
|
+
index,
|
|
344
|
+
step,
|
|
345
|
+
},
|
|
346
|
+
bubbles: true,
|
|
347
|
+
composed: true,
|
|
348
|
+
})
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
|
|
334
352
|
private renderIndicator(step: Step, index: number) {
|
|
335
353
|
if (step.status === "done") {
|
|
336
354
|
return html`
|
|
@@ -369,7 +387,10 @@ export class RelStepper extends LitElement {
|
|
|
369
387
|
<div class="${stepperClasses}">
|
|
370
388
|
${this.steps.map(
|
|
371
389
|
(step, idx) => html`
|
|
372
|
-
<div
|
|
390
|
+
<div
|
|
391
|
+
class="${this.getStepClasses(step)}"
|
|
392
|
+
@click="${() => this.onStepClick(step, idx)}"
|
|
393
|
+
>
|
|
373
394
|
${isVertical && isTextRight
|
|
374
395
|
? html`
|
|
375
396
|
<!-- Indicator with connector below -->
|
|
@@ -102,12 +102,14 @@ export class RelSwitch extends LitElement {
|
|
|
102
102
|
}
|
|
103
103
|
`;
|
|
104
104
|
|
|
105
|
-
private toggle() {
|
|
105
|
+
private toggle(ev: Event) {
|
|
106
106
|
if (this.disabled) return;
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
|
|
108
|
+
const input = ev.target as HTMLInputElement;
|
|
109
|
+
this.checked = input.checked;
|
|
110
|
+
|
|
109
111
|
this.dispatchEvent(
|
|
110
|
-
new CustomEvent("changed", {
|
|
112
|
+
new CustomEvent<boolean>("changed", {
|
|
111
113
|
detail: this.checked,
|
|
112
114
|
bubbles: true,
|
|
113
115
|
composed: true,
|
|
@@ -148,7 +150,7 @@ export class RelSwitch extends LitElement {
|
|
|
148
150
|
type="checkbox"
|
|
149
151
|
?disabled=${this.disabled}
|
|
150
152
|
.checked=${this.checked}
|
|
151
|
-
@change=${this.toggle}
|
|
153
|
+
@change=${(e: Event) => this.toggle(e)}
|
|
152
154
|
@focus=${this.handleFocus}
|
|
153
155
|
@blur=${this.handleBlur}
|
|
154
156
|
@mousedown=${this.handleMouseDown}
|
|
@@ -10,7 +10,7 @@ export interface TabItem {
|
|
|
10
10
|
@customElement("rel-tab")
|
|
11
11
|
export class RelTab extends LitElement {
|
|
12
12
|
@property({ type: Array }) tabs: TabItem[] = [];
|
|
13
|
-
@property({ type: Number }) activeIndex
|
|
13
|
+
@property({ type: Number, reflect: true }) activeIndex = 0;
|
|
14
14
|
|
|
15
15
|
static styles = css`
|
|
16
16
|
:host {
|
|
@@ -98,8 +98,8 @@ export class RelTab extends LitElement {
|
|
|
98
98
|
if (this.tabs[index]?.disabled) return;
|
|
99
99
|
this.activeIndex = index;
|
|
100
100
|
this.dispatchEvent(
|
|
101
|
-
new CustomEvent("tab-change", {
|
|
102
|
-
detail:
|
|
101
|
+
new CustomEvent<number>("tab-change", {
|
|
102
|
+
detail: index,
|
|
103
103
|
bubbles: true,
|
|
104
104
|
composed: true,
|
|
105
105
|
})
|
|
@@ -116,15 +116,17 @@ export class RelTab extends LitElement {
|
|
|
116
116
|
|
|
117
117
|
render() {
|
|
118
118
|
return html`
|
|
119
|
-
<div class="tabs-wrapper">
|
|
119
|
+
<div class="tabs-wrapper" role="tablist">
|
|
120
120
|
${this.tabs.map(
|
|
121
121
|
(tab, i) => html`
|
|
122
122
|
<div
|
|
123
|
-
class="tab ${i === this.activeIndex
|
|
124
|
-
? "
|
|
125
|
-
: ""}"
|
|
123
|
+
class="tab ${i === this.activeIndex
|
|
124
|
+
? "active"
|
|
125
|
+
: ""} ${tab.disabled ? "disabled" : ""}"
|
|
126
126
|
role="tab"
|
|
127
|
-
|
|
127
|
+
aria-selected="${i === this.activeIndex}"
|
|
128
|
+
aria-disabled="${tab.disabled ?? false}"
|
|
129
|
+
tabindex="${tab.disabled ? -1 : i === this.activeIndex ? 0 : -1}"
|
|
128
130
|
@click="${() => this.selectTab(i)}"
|
|
129
131
|
@keydown="${(e: KeyboardEvent) => this.onKeyDown(e, i)}"
|
|
130
132
|
>
|
|
@@ -154,8 +154,8 @@ export class RelTextfield extends LitElement {
|
|
|
154
154
|
const input = e.target as HTMLInputElement;
|
|
155
155
|
this.value = input.value;
|
|
156
156
|
this.dispatchEvent(
|
|
157
|
-
new CustomEvent("input-change", {
|
|
158
|
-
detail:
|
|
157
|
+
new CustomEvent<string>("input-change", {
|
|
158
|
+
detail: this.value,
|
|
159
159
|
bubbles: true,
|
|
160
160
|
composed: true,
|
|
161
161
|
})
|
package/dist/index.d.mts
CHANGED
|
@@ -20,9 +20,9 @@ declare class RelAlert extends LitElement {
|
|
|
20
20
|
dismissible: boolean;
|
|
21
21
|
dismissed: boolean;
|
|
22
22
|
static styles: lit.CSSResult;
|
|
23
|
-
private get iconSvg();
|
|
24
23
|
private dismissAlert;
|
|
25
|
-
|
|
24
|
+
private get iconSvg();
|
|
25
|
+
render(): lit_html.TemplateResult<1>;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
declare class RelAvatar extends LitElement {
|
|
@@ -62,6 +62,7 @@ declare class RelButton extends LitElement {
|
|
|
62
62
|
disabled: boolean;
|
|
63
63
|
static styles: lit.CSSResult;
|
|
64
64
|
private get classes();
|
|
65
|
+
private handleClick;
|
|
65
66
|
render(): lit_html.TemplateResult<1>;
|
|
66
67
|
}
|
|
67
68
|
|
|
@@ -99,12 +100,12 @@ declare class RelChip extends LitElement {
|
|
|
99
100
|
avatar?: string;
|
|
100
101
|
removable: boolean;
|
|
101
102
|
outline: boolean;
|
|
102
|
-
|
|
103
|
+
/** IMPORTANT: reflected so CSS + Angular can see it */
|
|
104
|
+
removed: boolean;
|
|
103
105
|
static styles: lit.CSSResult;
|
|
104
106
|
private get classes();
|
|
105
107
|
private handleRemove;
|
|
106
|
-
|
|
107
|
-
render(): lit_html.TemplateResult<1> | null;
|
|
108
|
+
render(): lit_html.TemplateResult<1>;
|
|
108
109
|
private renderIcon;
|
|
109
110
|
}
|
|
110
111
|
|
|
@@ -165,6 +166,7 @@ declare class RelProgress extends LitElement {
|
|
|
165
166
|
private radius;
|
|
166
167
|
private circumference;
|
|
167
168
|
static styles: lit.CSSResult;
|
|
169
|
+
private get safeValue();
|
|
168
170
|
private renderLinearDeterminate;
|
|
169
171
|
private renderLinearIndeterminate;
|
|
170
172
|
private renderCircularDeterminate;
|
|
@@ -183,9 +185,9 @@ declare class RelRadio extends LitElement {
|
|
|
183
185
|
options: RadioOption[];
|
|
184
186
|
name: string;
|
|
185
187
|
selectedValue: string | null;
|
|
188
|
+
disabled: boolean;
|
|
186
189
|
static styles: lit.CSSResult;
|
|
187
190
|
private onChange;
|
|
188
|
-
private isChecked;
|
|
189
191
|
private renderOption;
|
|
190
192
|
render(): lit_html.TemplateResult<1>;
|
|
191
193
|
}
|
|
@@ -266,6 +268,7 @@ declare class RelSnackbar extends LitElement {
|
|
|
266
268
|
private timeout;
|
|
267
269
|
static styles: lit.CSSResult;
|
|
268
270
|
connectedCallback(): void;
|
|
271
|
+
updated(changed: Map<string, unknown>): void;
|
|
269
272
|
disconnectedCallback(): void;
|
|
270
273
|
private setAutoDismiss;
|
|
271
274
|
private clearTimeout;
|
|
@@ -292,6 +295,7 @@ declare class RelStepper extends LitElement {
|
|
|
292
295
|
private isProgress;
|
|
293
296
|
private isDisabled;
|
|
294
297
|
private getStepClasses;
|
|
298
|
+
private onStepClick;
|
|
295
299
|
private renderIndicator;
|
|
296
300
|
render(): lit_html.TemplateResult<1>;
|
|
297
301
|
}
|
|
@@ -369,4 +373,4 @@ declare class RelTooltip extends LitElement {
|
|
|
369
373
|
render(): lit_html.TemplateResult<1>;
|
|
370
374
|
}
|
|
371
375
|
|
|
372
|
-
export { type MenuItem, type MenuType, type Orientation, type ProgressMode, type RadioOption, RelAccordion, RelAlert, RelAvatar, RelBadge, RelBreadcrumbs, RelButton, RelCard, RelCardMedia, RelCheckbox, RelChip, RelContainer, RelDivider, RelLayout, RelMenu, RelProgress, RelRadio, RelSegmentedButton, RelSelect, RelSlider, RelSnackbar, RelStepper, RelSwitch, RelTab, RelTextfield, RelToast, RelTooltip, type SegmentAlign, type SegmentOption, type SegmentSize, type SelectBorder, type SelectSize, type SelectState, type SliderType, type SnackbarLines, type Step, type StepStatus, type StepperSize, type TabItem, type TextAlign, type TextFieldSize, type TextFieldState, type ToastType, type TooltipPosition, type TrackStyle };
|
|
376
|
+
export { type BreadcrumbItem, type MenuItem, type MenuType, type Orientation, type ProgressMode, type RadioOption, RelAccordion, RelAlert, RelAvatar, RelBadge, RelBreadcrumbs, RelButton, RelCard, RelCardMedia, RelCheckbox, RelChip, RelContainer, RelDivider, RelLayout, RelMenu, RelProgress, RelRadio, RelSegmentedButton, RelSelect, RelSlider, RelSnackbar, RelStepper, RelSwitch, RelTab, RelTextfield, RelToast, RelTooltip, type SegmentAlign, type SegmentOption, type SegmentSize, type SelectBorder, type SelectSize, type SelectState, type SliderType, type SnackbarLines, type Step, type StepStatus, type StepperSize, type TabItem, type TextAlign, type TextFieldSize, type TextFieldState, type ToastType, type TooltipPosition, type TrackStyle };
|