@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
|
@@ -10,6 +10,17 @@ export class RelCheckbox extends LitElement {
|
|
|
10
10
|
@property({ type: String }) supportingtext = "";
|
|
11
11
|
@property({ type: String }) state: CheckboxState = "default";
|
|
12
12
|
@property({ type: String }) status: CheckboxStatus = "unchecked";
|
|
13
|
+
@property({ type: String }) value = "";
|
|
14
|
+
|
|
15
|
+
get checked(): boolean {
|
|
16
|
+
return this.status === "checked";
|
|
17
|
+
}
|
|
18
|
+
set checked(val: boolean) {
|
|
19
|
+
this.status = val ? "checked" : "unchecked";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
private _onChange: (value: boolean) => void = () => {};
|
|
23
|
+
private _onTouched: () => void = () => {};
|
|
13
24
|
|
|
14
25
|
static styles = css`
|
|
15
26
|
:host {
|
|
@@ -36,12 +47,13 @@ export class RelCheckbox extends LitElement {
|
|
|
36
47
|
pointer-events: none;
|
|
37
48
|
}
|
|
38
49
|
|
|
50
|
+
/* Unchecked — transparent fill, gray border */
|
|
39
51
|
.box {
|
|
40
52
|
width: 18px;
|
|
41
53
|
height: 18px;
|
|
42
54
|
border-radius: 4px;
|
|
43
|
-
border: 2px solid var(--rel-text-
|
|
44
|
-
background:
|
|
55
|
+
border: 2px solid var(--rel-gray-text-primary);
|
|
56
|
+
background: transparent;
|
|
45
57
|
display: flex;
|
|
46
58
|
align-items: center;
|
|
47
59
|
justify-content: center;
|
|
@@ -50,7 +62,7 @@ export class RelCheckbox extends LitElement {
|
|
|
50
62
|
}
|
|
51
63
|
|
|
52
64
|
input:focus-visible + .box {
|
|
53
|
-
outline: 2px solid var(--rel-border-
|
|
65
|
+
outline: 2px solid var(--rel-color-border-focus);
|
|
54
66
|
outline-offset: 2px;
|
|
55
67
|
}
|
|
56
68
|
|
|
@@ -60,28 +72,41 @@ export class RelCheckbox extends LitElement {
|
|
|
60
72
|
display: none;
|
|
61
73
|
}
|
|
62
74
|
|
|
63
|
-
|
|
64
|
-
.
|
|
65
|
-
background: var(--rel-text-
|
|
66
|
-
border-color: var(--rel-text-
|
|
75
|
+
/* Checked — filled box, transparent checkmark (bg shows through) */
|
|
76
|
+
.checked .box {
|
|
77
|
+
background: var(--rel-gray-text-primary);
|
|
78
|
+
border-color: var(--rel-gray-text-primary);
|
|
67
79
|
}
|
|
68
80
|
|
|
69
81
|
.checked .check-icon {
|
|
70
82
|
display: block;
|
|
83
|
+
fill: #ffffff;
|
|
71
84
|
}
|
|
72
85
|
|
|
86
|
+
/* Indeterminate — transparent fill, dash inherits border color */
|
|
73
87
|
.indeterminate .indeterminate-icon {
|
|
74
88
|
display: block;
|
|
89
|
+
fill: var(--rel-gray-text-primary);
|
|
75
90
|
}
|
|
76
91
|
|
|
92
|
+
/* Error unchecked — transparent fill, error border */
|
|
77
93
|
.error .box {
|
|
78
|
-
border-color: var(--rel-
|
|
94
|
+
border-color: var(--rel-error-surface-default);
|
|
79
95
|
}
|
|
80
96
|
|
|
81
|
-
|
|
82
|
-
.error.
|
|
83
|
-
background: var(--rel-
|
|
84
|
-
border-color: var(--rel-
|
|
97
|
+
/* Error checked — error fill, transparent checkmark */
|
|
98
|
+
.error.checked .box {
|
|
99
|
+
background: var(--rel-error-surface-default);
|
|
100
|
+
border-color: var(--rel-error-surface-default);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.error.checked .check-icon {
|
|
104
|
+
fill: #ffffff;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* Error indeterminate — transparent fill, dash is error color */
|
|
108
|
+
.error.indeterminate .indeterminate-icon {
|
|
109
|
+
fill: var(--rel-error-surface-default);
|
|
85
110
|
}
|
|
86
111
|
|
|
87
112
|
.disabled {
|
|
@@ -89,10 +114,62 @@ export class RelCheckbox extends LitElement {
|
|
|
89
114
|
cursor: not-allowed;
|
|
90
115
|
}
|
|
91
116
|
|
|
117
|
+
:host([state="disabled"]) {
|
|
118
|
+
cursor: not-allowed;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
:host([state="disabled"]) * {
|
|
122
|
+
pointer-events: none;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.disabled .label,
|
|
126
|
+
.disabled .text {
|
|
127
|
+
color: var(--rel-color-text-disabled);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* Dark mode — tokens auto-flip via vars-v2, declared explicitly for clarity */
|
|
131
|
+
:host-context([data-theme="dark"]) .box {
|
|
132
|
+
border-color: var(--rel-gray-text-primary);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
:host-context([data-theme="dark"]) .checked .box {
|
|
136
|
+
background: var(--rel-gray-text-primary);
|
|
137
|
+
border-color: var(--rel-gray-text-primary);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
:host-context([data-theme="dark"]) .checked .check-icon {
|
|
141
|
+
fill: var(--rel-color-bg-primary);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
:host-context([data-theme="dark"]) .indeterminate .indeterminate-icon {
|
|
145
|
+
fill: var(--rel-gray-text-primary);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
:host-context([data-theme="dark"]) .error .box {
|
|
149
|
+
border-color: var(--rel-error-surface-default);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
:host-context([data-theme="dark"]) .error.checked .box {
|
|
153
|
+
background: var(--rel-error-surface-default);
|
|
154
|
+
border-color: var(--rel-error-surface-default);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
:host-context([data-theme="dark"]) .error.checked .check-icon {
|
|
158
|
+
fill: var(--rel-color-bg-primary);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
:host-context([data-theme="dark"]) .error.indeterminate .indeterminate-icon {
|
|
162
|
+
fill: var(--rel-error-surface-default);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
:host-context([data-theme="dark"]) .label {
|
|
166
|
+
color: var(--rel-gray-text-primary);
|
|
167
|
+
}
|
|
168
|
+
|
|
92
169
|
.label {
|
|
93
170
|
font-size: var(--rel-fontSizes-md, 14px);
|
|
94
171
|
font-weight: var(--rel-fontWeights-medium, 500);
|
|
95
|
-
color: var(--rel-text-primary
|
|
172
|
+
color: var(--rel-gray-text-primary);
|
|
96
173
|
}
|
|
97
174
|
|
|
98
175
|
.text {
|
|
@@ -110,17 +187,22 @@ export class RelCheckbox extends LitElement {
|
|
|
110
187
|
else this.status = "unchecked";
|
|
111
188
|
|
|
112
189
|
this.dispatchEvent(
|
|
113
|
-
new CustomEvent("change", {
|
|
190
|
+
new CustomEvent("rel-change", {
|
|
114
191
|
detail: {
|
|
115
192
|
checked: this.status === "checked",
|
|
116
|
-
|
|
193
|
+
value: this.value,
|
|
117
194
|
},
|
|
118
195
|
bubbles: true,
|
|
119
196
|
composed: true,
|
|
120
197
|
})
|
|
121
198
|
);
|
|
199
|
+
this._onChange(this.checked);
|
|
122
200
|
}
|
|
123
201
|
|
|
202
|
+
registerOnChange(fn: (value: boolean) => void): void { this._onChange = fn; }
|
|
203
|
+
registerOnTouched(fn: () => void): void { this._onTouched = fn; }
|
|
204
|
+
writeValue(checked: boolean): void { this.checked = checked; }
|
|
205
|
+
|
|
124
206
|
render() {
|
|
125
207
|
return html`
|
|
126
208
|
<div class="wrapper ${this.state} ${this.status}">
|
|
@@ -128,6 +210,7 @@ export class RelCheckbox extends LitElement {
|
|
|
128
210
|
<input
|
|
129
211
|
type="checkbox"
|
|
130
212
|
@click=${this.toggle}
|
|
213
|
+
@blur=${() => this._onTouched()}
|
|
131
214
|
?disabled=${this.state === "disabled"}
|
|
132
215
|
/>
|
|
133
216
|
|
|
@@ -1,186 +1,291 @@
|
|
|
1
|
-
import { LitElement, html, css } from "lit";
|
|
2
|
-
import { customElement, property } from "lit/decorators.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
@property({ type: String })
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
@property({ type:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
display:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
border: var(--rel-borders-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
.chip-
|
|
84
|
-
background:
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import { customElement, property } from "lit/decorators.js";
|
|
3
|
+
import "../rel-avatar/rel-avatar.js";
|
|
4
|
+
|
|
5
|
+
@customElement("rel-chip")
|
|
6
|
+
export class RelChip extends LitElement {
|
|
7
|
+
@property({ type: String }) label = "Label";
|
|
8
|
+
|
|
9
|
+
// "yellow" renamed to "orange" — existing serialized "yellow" values will fall through to chip-yellow class (no match) and render unstyled
|
|
10
|
+
@property({ type: String })
|
|
11
|
+
tone: "default" | "blue" | "orange" | "red" | "green" = "default";
|
|
12
|
+
|
|
13
|
+
@property({ type: String }) leadingIcon?: string;
|
|
14
|
+
@property({ type: String }) trailingIcon?: string;
|
|
15
|
+
/** Initials text for the avatar (e.g. "JD"). Mutually exclusive with leadingIcon. */
|
|
16
|
+
@property({ type: String }) avatar?: string;
|
|
17
|
+
|
|
18
|
+
@property({ type: Boolean }) removable = false;
|
|
19
|
+
|
|
20
|
+
/** IMPORTANT: reflected so CSS + Angular can see it */
|
|
21
|
+
@property({ type: Boolean, reflect: true }) removed = false;
|
|
22
|
+
|
|
23
|
+
static styles = css`
|
|
24
|
+
:host {
|
|
25
|
+
display: inline-flex;
|
|
26
|
+
width: auto;
|
|
27
|
+
flex: 0 0 auto;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
:host([removed]) {
|
|
31
|
+
display: none;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.chip {
|
|
35
|
+
display: inline-flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
font-family: var(--rel-fontFamilies-primary);
|
|
38
|
+
font-size: var(--rel-fontSizes-md);
|
|
39
|
+
font-weight: var(--rel-fontWeights-medium);
|
|
40
|
+
border-radius: var(--rel-borders-radius-border-radius-100);
|
|
41
|
+
padding: var(--rel-spacing-space-2xs) var(--rel-spacing-space-xs);
|
|
42
|
+
gap: var(--rel-spacing-space-2xs);
|
|
43
|
+
cursor: pointer;
|
|
44
|
+
border: var(--rel-borders-width-stroke-100) solid transparent;
|
|
45
|
+
user-select: none;
|
|
46
|
+
white-space: nowrap;
|
|
47
|
+
background: transparent;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.chip:hover {
|
|
51
|
+
filter: brightness(0.88);
|
|
52
|
+
box-shadow: var(--rel-shadows-shadow-100);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.chip:focus-visible {
|
|
56
|
+
outline: 2px solid var(--rel-color-border-focus);
|
|
57
|
+
outline-offset: 2px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.chip:active {
|
|
61
|
+
filter: brightness(0.80);
|
|
62
|
+
box-shadow: var(--rel-shadows-shadow-200);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* TONES — light (default) */
|
|
66
|
+
/* NOTE: #717171 has no exact vars-v2 token; nearest candidates are
|
|
67
|
+
--rel-colors-gray-toast-bg (#404040) and --rel-colors-gray-divider (#BDBDBD) */
|
|
68
|
+
.chip-default {
|
|
69
|
+
background: #717171;
|
|
70
|
+
color: var(--rel-colors-white);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.chip-blue {
|
|
74
|
+
background: var(--rel-colors-blue-tertiary);
|
|
75
|
+
color: var(--rel-colors-white);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.chip-orange {
|
|
79
|
+
background: var(--rel-colors-yellow-pending);
|
|
80
|
+
color: var(--rel-colors-white);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.chip-red {
|
|
84
|
+
background: var(--rel-colors-red-primary);
|
|
85
|
+
color: var(--rel-colors-white);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.chip-green {
|
|
89
|
+
background: var(--rel-colors-green-tertiary);
|
|
90
|
+
color: var(--rel-colors-white);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* AVATAR — light mode (all tones)
|
|
94
|
+
rel-avatar uses background-color: var(--rel-colors-gray-disabled-text).
|
|
95
|
+
Overriding that custom property here pins avatar bg to white across all tones.
|
|
96
|
+
NOTE: rel-avatar hardcodes color: #ffffff — text color (#000000) cannot be
|
|
97
|
+
overridden from outside the shadow DOM without ::part() or a custom property
|
|
98
|
+
in rel-avatar itself. */
|
|
99
|
+
.chip rel-avatar {
|
|
100
|
+
display: inline-flex;
|
|
101
|
+
width: 20px !important;
|
|
102
|
+
height: 20px !important;
|
|
103
|
+
flex-shrink: 0;
|
|
104
|
+
font-size: 10px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.chip-default rel-avatar,
|
|
108
|
+
.chip-blue rel-avatar,
|
|
109
|
+
.chip-orange rel-avatar,
|
|
110
|
+
.chip-red rel-avatar,
|
|
111
|
+
.chip-green rel-avatar {
|
|
112
|
+
--rel-colors-gray-disabled-text: #ffffff;
|
|
113
|
+
--rel-avatar-color: #000000;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.chip-icon {
|
|
117
|
+
display: inline-flex;
|
|
118
|
+
align-items: center;
|
|
119
|
+
justify-content: center;
|
|
120
|
+
width: 16px;
|
|
121
|
+
height: 16px;
|
|
122
|
+
flex-shrink: 0;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.chip-icon * {
|
|
126
|
+
width: 100%;
|
|
127
|
+
height: 100%;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.chip-icon ::slotted(svg),
|
|
131
|
+
.chip-icon svg {
|
|
132
|
+
width: 16px;
|
|
133
|
+
height: 16px;
|
|
134
|
+
fill: currentColor;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.chip-remove {
|
|
138
|
+
margin-left: var(--rel-spacing-space-3xs);
|
|
139
|
+
cursor: pointer;
|
|
140
|
+
opacity: 0.7;
|
|
141
|
+
background: none;
|
|
142
|
+
border: none;
|
|
143
|
+
color: inherit;
|
|
144
|
+
font: inherit;
|
|
145
|
+
padding: 0;
|
|
146
|
+
line-height: 1;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.chip-remove:hover {
|
|
150
|
+
opacity: 1;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.chip-remove:focus-visible {
|
|
154
|
+
outline: 2px solid var(--rel-colors-white);
|
|
155
|
+
outline-offset: 1px;
|
|
156
|
+
border-radius: 2px;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/* DARK THEME */
|
|
160
|
+
/* NOTE: #717171 (chip-default dark color) has no exact vars-v2 token */
|
|
161
|
+
/* NOTE: #FFFBF5 (chip-orange dark bg) has no exact vars-v2 token;
|
|
162
|
+
nearest is --rel-colors-gray-light (#FAFAFA) */
|
|
163
|
+
|
|
164
|
+
/* Reinforce layout — external dark-mode stylesheets can override display/width on the host */
|
|
165
|
+
:host-context([data-theme="dark"]) .chip {
|
|
166
|
+
display: inline-flex;
|
|
167
|
+
width: auto;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
:host-context([data-theme="dark"]) .chip-default {
|
|
171
|
+
/* --rel-colors-gray-screen-bg flips to #262626 in dark — hardcoded to preserve #EEEEEE */
|
|
172
|
+
background: #EEEEEE;
|
|
173
|
+
color: #717171;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
:host-context([data-theme="dark"]) .chip-blue {
|
|
177
|
+
/* --rel-colors-blue-bg flips to #0f1e2c in dark mode — hardcoded to preserve #E1F2FF */
|
|
178
|
+
background: #E1F2FF;
|
|
179
|
+
color: var(--rel-colors-blue-tertiary);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
:host-context([data-theme="dark"]) .chip-orange {
|
|
183
|
+
background: #FFFBF5;
|
|
184
|
+
color: var(--rel-colors-yellow-pending);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
:host-context([data-theme="dark"]) .chip-red {
|
|
188
|
+
background: var(--rel-colors-red-light);
|
|
189
|
+
color: var(--rel-colors-red-primary);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
:host-context([data-theme="dark"]) .chip-green {
|
|
193
|
+
background: var(--rel-colors-green-bg-light);
|
|
194
|
+
color: var(--rel-colors-green-tertiary);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/* AVATAR — dark mode (per tone: bg = light fill color, text = white) */
|
|
198
|
+
:host-context([data-theme="dark"]) .chip-default rel-avatar {
|
|
199
|
+
--rel-colors-gray-disabled-text: #717171;
|
|
200
|
+
--rel-avatar-color: #ffffff;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
:host-context([data-theme="dark"]) .chip-blue rel-avatar {
|
|
204
|
+
--rel-colors-gray-disabled-text: #0059F4;
|
|
205
|
+
--rel-avatar-color: #ffffff;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
:host-context([data-theme="dark"]) .chip-orange rel-avatar {
|
|
209
|
+
--rel-colors-gray-disabled-text: #FFBF43;
|
|
210
|
+
--rel-avatar-color: #ffffff;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
:host-context([data-theme="dark"]) .chip-red rel-avatar {
|
|
214
|
+
--rel-colors-gray-disabled-text: #CC0000;
|
|
215
|
+
--rel-avatar-color: #ffffff;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
:host-context([data-theme="dark"]) .chip-green rel-avatar {
|
|
219
|
+
--rel-colors-gray-disabled-text: #00A86B;
|
|
220
|
+
--rel-avatar-color: #ffffff;
|
|
221
|
+
}
|
|
222
|
+
`;
|
|
223
|
+
|
|
224
|
+
private get classes() {
|
|
225
|
+
return ["chip", `chip-${this.tone}`].join(" ");
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
private handleRemove(event: Event) {
|
|
229
|
+
event.stopPropagation();
|
|
230
|
+
this.removed = true;
|
|
231
|
+
|
|
232
|
+
this.dispatchEvent(
|
|
233
|
+
new CustomEvent("removed", {
|
|
234
|
+
bubbles: true,
|
|
235
|
+
composed: true,
|
|
236
|
+
})
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
render() {
|
|
241
|
+
const showAvatar = !!this.avatar;
|
|
242
|
+
const showLeadingIcon = !showAvatar && !!this.leadingIcon;
|
|
243
|
+
|
|
244
|
+
if (this.avatar && this.leadingIcon) {
|
|
245
|
+
console.warn(
|
|
246
|
+
"[rel-chip] leadingIcon and avatar are mutually exclusive. avatar takes precedence."
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
return html`
|
|
251
|
+
<span
|
|
252
|
+
class="${this.classes}"
|
|
253
|
+
role="button"
|
|
254
|
+
tabindex="0"
|
|
255
|
+
aria-label="${this.label}"
|
|
256
|
+
>
|
|
257
|
+
${showAvatar
|
|
258
|
+
? html`<rel-avatar type="text" text=${this.avatar} size="xs"></rel-avatar>`
|
|
259
|
+
: null}
|
|
260
|
+
${showLeadingIcon
|
|
261
|
+
? html`<span class="chip-icon">
|
|
262
|
+
${this.renderIcon(this.leadingIcon!)}
|
|
263
|
+
</span>`
|
|
264
|
+
: null}
|
|
265
|
+
|
|
266
|
+
<span class="chip-label">${this.label}</span>
|
|
267
|
+
|
|
268
|
+
${this.trailingIcon
|
|
269
|
+
? html`<span class="chip-icon">
|
|
270
|
+
${this.renderIcon(this.trailingIcon)}
|
|
271
|
+
</span>`
|
|
272
|
+
: null}
|
|
273
|
+
${this.removable
|
|
274
|
+
? html`<button
|
|
275
|
+
class="chip-remove"
|
|
276
|
+
aria-label="Remove ${this.label}"
|
|
277
|
+
@click=${this.handleRemove}
|
|
278
|
+
>
|
|
279
|
+
✕
|
|
280
|
+
</button>`
|
|
281
|
+
: null}
|
|
282
|
+
</span>
|
|
283
|
+
`;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
private renderIcon(iconString: string) {
|
|
287
|
+
const template = document.createElement("template");
|
|
288
|
+
template.innerHTML = iconString.trim();
|
|
289
|
+
return template.content.cloneNode(true);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
@@ -22,11 +22,11 @@ export class RelContainer extends LitElement {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
.bg-white {
|
|
25
|
-
background-color: var(--rel-
|
|
25
|
+
background-color: var(--rel-color-bg-primary);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
.bg-light {
|
|
29
|
-
background-color: var(--rel-
|
|
29
|
+
background-color: var(--rel-color-bg-secondary);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
.bg-none {
|