@reliability-design/web 1.1.1 → 1.3.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.
Files changed (69) hide show
  1. package/dist/components/rel-accordion/rel-accordion.ts +289 -150
  2. package/dist/components/rel-alert/rel-alert.ts +34 -34
  3. package/dist/components/rel-avatar/README.md +15 -4
  4. package/dist/components/rel-avatar/rel-avatar.ts +138 -94
  5. package/dist/components/rel-badge/README.md +7 -0
  6. package/dist/components/rel-badge/rel-badge.ts +39 -2
  7. package/dist/components/rel-breadcrumb/rel-breadcrumb.ts +6 -6
  8. package/dist/components/rel-button/rel-button.ts +96 -28
  9. package/dist/components/rel-calendar/rel-calendar.ts +15 -8
  10. package/dist/components/rel-card/rel-card.ts +9 -17
  11. package/dist/components/rel-cardmedia/rel-cardmedia.ts +20 -23
  12. package/dist/components/rel-carousel/rel-carousel.ts +596 -468
  13. package/dist/components/rel-checkbox/rel-checkbox.ts +68 -16
  14. package/dist/components/rel-chip/README.md +7 -0
  15. package/dist/components/rel-chip/rel-chip.ts +411 -244
  16. package/dist/components/rel-container/rel-container.ts +2 -2
  17. package/dist/components/rel-date-picker/rel-date-picker.ts +23 -19
  18. package/dist/components/rel-divider/rel-divider.ts +3 -3
  19. package/dist/components/rel-drawer/rel-drawer-footer.ts +0 -2
  20. package/dist/components/rel-drawer/rel-drawer.ts +46 -90
  21. package/dist/components/rel-kbd/rel-kbd.ts +94 -118
  22. package/dist/components/rel-layout/rel-layout.ts +49 -58
  23. package/dist/components/rel-menu/rel-menu.ts +359 -359
  24. package/dist/components/rel-menubar/rel-menubar-menu.css +3 -0
  25. package/dist/components/rel-menubar/rel-menubar-menu.ts +2 -1
  26. package/dist/components/rel-menubar/rel-menubar.ts +603 -605
  27. package/dist/components/rel-otp/rel-otp.ts +22 -25
  28. package/dist/components/rel-pagination/rel-pagination.ts +442 -381
  29. package/dist/components/rel-popover/rel-popover-content.ts +6 -5
  30. package/dist/components/rel-popover/rel-popover.ts +26 -7
  31. package/dist/components/rel-progress/rel-progress.ts +10 -9
  32. package/dist/components/rel-radio/rel-radio.ts +228 -172
  33. package/dist/components/rel-range-picker/rel-range-picker.css +349 -0
  34. package/dist/components/rel-range-picker/rel-range-picker.ts +1080 -0
  35. package/dist/components/rel-resizable/rel-resizable-handle.ts +8 -7
  36. package/dist/components/rel-segmented-button/rel-segmented-button.ts +41 -20
  37. package/dist/components/rel-select/README.md +34 -28
  38. package/dist/components/rel-select/rel-select.ts +1015 -275
  39. package/dist/components/rel-sheet/rel-sheet.ts +365 -684
  40. package/dist/components/rel-skeleton/rel-skeleton.ts +139 -0
  41. package/dist/components/rel-slider/rel-slider.ts +49 -27
  42. package/dist/components/rel-snackbar/rel-snackbar.ts +28 -28
  43. package/dist/components/rel-stepper/rel-stepper.ts +11 -10
  44. package/dist/components/rel-switch/rel-switch.ts +7 -6
  45. package/dist/components/rel-tab/rel-tab.ts +15 -29
  46. package/dist/components/rel-textfield/rel-textfield.ts +192 -35
  47. package/dist/components/rel-toast/rel-toast.ts +21 -13
  48. package/dist/components/rel-tooltip/rel-tooltip.ts +123 -123
  49. package/dist/components/rel-topbar/rel-topbar-actions.ts +1 -0
  50. package/dist/components/rel-topbar/rel-topbar-brand.ts +1 -0
  51. package/dist/components/rel-topbar/rel-topbar-dropdown-item.ts +32 -2
  52. package/dist/components/rel-topbar/rel-topbar-dropdown.ts +1 -1
  53. package/dist/components/rel-topbar/rel-topbar-item.ts +15 -10
  54. package/dist/components/rel-topbar/rel-topbar-mobile-panel.ts +1 -0
  55. package/dist/components/rel-topbar/rel-topbar-profile.ts +30 -56
  56. package/dist/components/rel-topbar/rel-topbar-utilities.ts +1 -0
  57. package/dist/components/rel-topbar/rel-topbar.ts +137 -28
  58. package/dist/index.d.mts +310 -193
  59. package/dist/index.d.ts +310 -193
  60. package/dist/index.js +5562 -3526
  61. package/dist/index.js.map +1 -1
  62. package/dist/index.mjs +5328 -3284
  63. package/dist/index.mjs.map +1 -1
  64. package/dist/rel-menubar-menu-BEEQDAXW.css +3 -0
  65. package/dist/styles/vars-v2.css +525 -0
  66. package/dist/styles/vars.css +346 -346
  67. package/dist/{vars-TBB4BMSD.css → vars-I2PC74XD.css} +346 -346
  68. package/dist/vars-v2-VMGWTFJZ.css +525 -0
  69. package/package.json +2 -1
@@ -1,244 +1,411 @@
1
- import { LitElement, html, css } from "lit";
2
- import { customElement, property } from "lit/decorators.js";
3
-
4
- @customElement("rel-chip")
5
- export class RelChip extends LitElement {
6
- @property({ type: String }) label = "Label";
7
-
8
- @property({ type: String })
9
- tone: "default" | "blue" | "yellow" | "red" | "green" = "default";
10
-
11
- @property({ type: String }) leadingIcon?: string;
12
- @property({ type: String }) trailingIcon?: string;
13
- @property({ type: String }) avatar?: string;
14
-
15
- @property({ type: Boolean }) removable = false;
16
- @property({ type: Boolean }) outline = false;
17
-
18
- /** IMPORTANT: reflected so CSS + Angular can see it */
19
- @property({ type: Boolean, reflect: true }) removed = false;
20
-
21
- static styles = css`
22
- :host {
23
- display: inline-block;
24
- }
25
-
26
- :host([removed]) {
27
- display: none;
28
- }
29
-
30
- .chip {
31
- display: inline-flex;
32
- align-items: center;
33
- font-family: var(--rel-fontFamilies-primary);
34
- font-size: var(--rel-fontSizes-md);
35
- font-weight: var(--rel-fontWeights-medium);
36
- border-radius: var(--rel-borders-radius-border-radius-500);
37
- padding: var(--rel-spacing-space-2xs) var(--rel-spacing-space-sm);
38
- gap: var(--rel-spacing-space-2xs);
39
- cursor: pointer;
40
- border: var(--rel-borders-width-stroke-100) solid transparent;
41
- user-select: none;
42
- white-space: nowrap;
43
- background: transparent;
44
- }
45
-
46
- .chip:hover {
47
- filter: brightness(0.92);
48
- box-shadow: var(--rel-shadows-shadow-100);
49
- }
50
-
51
- .chip:focus-visible {
52
- outline: 2px solid var(--rel-colors-blue-primary, #0091ea);
53
- outline-offset: 2px;
54
- }
55
-
56
- /* TONES */
57
- .chip-default {
58
- background: var(--rel-colors-gray-border);
59
- color: #000000;
60
- }
61
-
62
- .chip-blue {
63
- background: var(--rel-colors-blue-tertiary);
64
- color: #ffffff;
65
- }
66
-
67
- .chip-yellow {
68
- background: var(--rel-colors-yellow-pending);
69
- color: #000000;
70
- }
71
-
72
- .chip-red {
73
- background: var(--rel-colors-red-secondary);
74
- color: #ffffff;
75
- }
76
-
77
- .chip-green {
78
- background: var(--rel-colors-green-success);
79
- color: #ffffff;
80
- }
81
-
82
- /* OUTLINE */
83
- .chip-outline {
84
- background: transparent;
85
- border-color: var(--rel-color-border-default);
86
- }
87
-
88
- .chip-blue.chip-outline {
89
- color: #000000;
90
- background: transparent;
91
- border-color: #0059F4;
92
- }
93
-
94
- .chip-red.chip-outline {
95
- color: #9C1E33;
96
- background: transparent;
97
- border-color: #9C1E33;
98
- }
99
-
100
- .chip-green.chip-outline {
101
- color: #00A86B;
102
- background: transparent;
103
- border-color: #00A86B;
104
- }
105
-
106
- .chip-yellow.chip-outline {
107
- color: #92400E;
108
- background: transparent;
109
- border-color: #F2915C;
110
- }
111
-
112
- .chip-avatar {
113
- width: 20px;
114
- height: 20px;
115
- border-radius: 50%;
116
- object-fit: cover;
117
- }
118
-
119
- .chip-icon {
120
- display: inline-flex;
121
- align-items: center;
122
- justify-content: center;
123
- width: 14px;
124
- height: 14px;
125
- flex-shrink: 0;
126
- }
127
-
128
- .chip-icon * {
129
- width: 100%;
130
- height: 100%;
131
- }
132
-
133
- .chip-icon ::slotted(svg),
134
- .chip-icon svg {
135
- width: 16px;
136
- height: 16px;
137
- fill: currentColor;
138
- }
139
-
140
- .chip-remove {
141
- margin-left: var(--rel-spacing-space-3xs);
142
- cursor: pointer;
143
- opacity: 0.7;
144
- background: none;
145
- border: none;
146
- color: inherit;
147
- font: inherit;
148
- padding: 0;
149
- line-height: 1;
150
- }
151
-
152
- .chip-remove:hover {
153
- opacity: 1;
154
- }
155
-
156
- .chip-remove:focus-visible {
157
- outline: 2px solid var(--rel-colors-white, #fff);
158
- outline-offset: 1px;
159
- border-radius: 2px;
160
- }
161
-
162
- /* Dark mode overrides */
163
- :host-context([data-theme="dark"]) .chip-default,
164
- :host-context(.dark) .chip-default {
165
- color: #ffffff;
166
- background: var(--rel-color-bg-secondary);
167
- }
168
-
169
- :host-context([data-theme="dark"]) .chip-default.chip-outline,
170
- :host-context(.dark) .chip-default.chip-outline {
171
- color: #ffffff;
172
- border-color: #ffffff;
173
- }
174
-
175
- :host-context([data-theme="dark"]) .chip-outline,
176
- :host-context(.dark) .chip-outline {
177
- color: #ffffff;
178
- border-color: currentColor;
179
- }
180
- `;
181
-
182
- private get classes() {
183
- return [
184
- "chip",
185
- `chip-${this.tone}`,
186
- this.outline ? "chip-outline" : "",
187
- ].join(" ");
188
- }
189
-
190
- private handleRemove(event: Event) {
191
- event.stopPropagation();
192
- this.removed = true;
193
-
194
- this.dispatchEvent(
195
- new CustomEvent("removed", {
196
- bubbles: true,
197
- composed: true,
198
- })
199
- );
200
- }
201
-
202
- render() {
203
- return html`
204
- <span
205
- class="${this.classes}"
206
- role="button"
207
- tabindex="0"
208
- aria-label="${this.label}"
209
- >
210
- ${this.avatar
211
- ? html`<img src=${this.avatar} alt="" class="chip-avatar" />`
212
- : null}
213
- ${this.leadingIcon
214
- ? html`<span class="chip-icon">
215
- ${this.renderIcon(this.leadingIcon)}
216
- </span>`
217
- : null}
218
-
219
- <span class="chip-label">${this.label}</span>
220
-
221
- ${this.trailingIcon
222
- ? html`<span class="chip-icon">
223
- ${this.renderIcon(this.trailingIcon)}
224
- </span>`
225
- : null}
226
- ${this.removable
227
- ? html`<button
228
- class="chip-remove"
229
- aria-label="Remove ${this.label}"
230
- @click=${this.handleRemove}
231
- >
232
- ✕
233
- </button>`
234
- : null}
235
- </span>
236
- `;
237
- }
238
-
239
- private renderIcon(iconString: string) {
240
- const template = document.createElement("template");
241
- template.innerHTML = iconString.trim();
242
- return template.content.cloneNode(true);
243
- }
244
- }
1
+ import { LitElement, html, css } from "lit";
2
+ import { customElement, property, state } from "lit/decorators.js";
3
+ import "../rel-avatar/rel-avatar.js";
4
+ import "@reliability-design/icons/rel-icon";
5
+
6
+ export type ChipTone = "neutral" | "danger" | "warning" | "success" | "info";
7
+ export type ChipVariant = "fill" | "subtle";
8
+ export type ChipSize = "sm" | "md" | "lg";
9
+ export type ChipBorder = "default" | "rounded";
10
+
11
+ @customElement("rel-chip")
12
+ export class RelChip extends LitElement {
13
+ // The actually-focusable element is the inner <span tabindex="0">, not the
14
+ // host. Without delegatesFocus, calling host.focus() (e.g. from a parent
15
+ // component, or a "focus this" demo button) is a no-op since the host
16
+ // itself carries no tabindex — only real Tab-key traversal would still
17
+ // reach the inner span, because that walks the flattened DOM regardless.
18
+ static override shadowRootOptions: ShadowRootInit = {
19
+ ...LitElement.shadowRootOptions,
20
+ delegatesFocus: true,
21
+ };
22
+
23
+ @property({ type: String }) label = "Label";
24
+
25
+ @property({ type: String, reflect: true }) tone: ChipTone = "neutral";
26
+
27
+ @property({ type: String, reflect: true }) variant: ChipVariant = "fill";
28
+
29
+ @property({ type: String, reflect: true }) size: ChipSize = "md";
30
+
31
+ @property({ type: String, reflect: true }) border: ChipBorder = "default";
32
+
33
+ /** Icon name from the generated icon dictionary (e.g. "settings") — rendered via <rel-icon>. */
34
+ @property({ type: String, attribute: "leading-icon" }) leadingIcon?: string;
35
+ @property({ type: String, attribute: "trailing-icon" }) trailingIcon?: string;
36
+ /** Initials text for the avatar (e.g. "JD"). Mutually exclusive with leadingIcon. */
37
+ @property({ type: String }) avatar?: string;
38
+
39
+ @property({ type: Boolean }) removable = false;
40
+
41
+ /** IMPORTANT: reflected so CSS + Angular can see it */
42
+ @property({ type: Boolean, reflect: true }) removed = false;
43
+
44
+ /** Opt-in native drag-and-drop — reflects the Figma "Dragged" state automatically during a real drag gesture. */
45
+ // Explicit attribute mapping — Lit's default attribute name for a camelCase
46
+ // property is the name fully lowercased (no hyphens), so without this it'd
47
+ // only respond to draggablechip="", not draggable-chip.
48
+ @property({ type: Boolean, attribute: "draggable-chip" }) draggableChip = false;
49
+
50
+ /** Reflected so CSS can target the Figma "Dragged" visual state. Driven automatically by dragstart/dragend when draggableChip is set. */
51
+ @state() private dragging = false;
52
+
53
+ static styles = css`
54
+ :host {
55
+ display: inline-flex;
56
+ width: auto;
57
+ flex: 0 0 auto;
58
+ }
59
+
60
+ :host([removed]) {
61
+ display: none;
62
+ }
63
+
64
+ .chip {
65
+ display: inline-flex;
66
+ align-items: center;
67
+ box-sizing: border-box;
68
+ font-family: var(--rel-fontFamilies-primary);
69
+ font-weight: 500;
70
+ letter-spacing: -0.6px;
71
+ gap: 8px;
72
+ cursor: pointer;
73
+ user-select: none;
74
+ white-space: nowrap;
75
+ outline: none;
76
+ background: transparent;
77
+ transition: background-color 0.15s ease;
78
+ }
79
+
80
+ /* ── Size ── */
81
+ :host([size="lg"]) .chip {
82
+ height: 32px;
83
+ padding: 4px 8px;
84
+ font-size: 16px;
85
+ line-height: 24px;
86
+ }
87
+
88
+ :host([size="md"]) .chip {
89
+ height: 28px;
90
+ padding: 4px 8px;
91
+ font-size: 14px;
92
+ line-height: 22px;
93
+ }
94
+
95
+ :host([size="sm"]) .chip {
96
+ height: 24px;
97
+ padding: 4px 8px;
98
+ font-size: 12px;
99
+ line-height: 20px;
100
+ }
101
+
102
+ /* ── Border / shape — "Rounded" also widens horizontal padding to 12px,
103
+ consistent across all three sizes per the Figma spec. ── */
104
+ :host([border="default"]) .chip {
105
+ border-radius: 4px;
106
+ }
107
+
108
+ :host([border="rounded"]) .chip {
109
+ border-radius: 1000px;
110
+ padding-left: 12px;
111
+ padding-right: 12px;
112
+ }
113
+
114
+ /* ── Tone x Variant — Default/Default state colors ── */
115
+ :host([tone="neutral"][variant="fill"]) .chip {
116
+ background: #0b0b0b;
117
+ color: #ffffff;
118
+ }
119
+ :host([tone="neutral"][variant="subtle"]) .chip {
120
+ background: #f5f5f5;
121
+ color: #0b0b0b;
122
+ }
123
+ :host([tone="danger"][variant="fill"]) .chip {
124
+ background: #f83b3b;
125
+ color: #ffffff;
126
+ }
127
+ :host([tone="danger"][variant="subtle"]) .chip {
128
+ background: #fff1f1;
129
+ color: #ce3131;
130
+ }
131
+ :host([tone="warning"][variant="fill"]) .chip {
132
+ background: #ffcb66;
133
+ color: #0b0b0b;
134
+ }
135
+ :host([tone="warning"][variant="subtle"]) .chip {
136
+ background: #ffefd1;
137
+ color: #713f12;
138
+ }
139
+ :host([tone="success"][variant="fill"]) .chip {
140
+ background: #00a86b;
141
+ color: #ffffff;
142
+ }
143
+ :host([tone="success"][variant="subtle"]) .chip {
144
+ background: #edf8f4;
145
+ color: #008655;
146
+ }
147
+ :host([tone="info"][variant="fill"]) .chip {
148
+ background: #0091ea;
149
+ color: #ffffff;
150
+ }
151
+ :host([tone="info"][variant="subtle"]) .chip {
152
+ background: #eff7ff;
153
+ color: #00528d;
154
+ }
155
+
156
+ /* ── Hover / Dragged — Figma only specs explicit color shifts for the
157
+ "neutral" tone; the other four tones have no hover/dragged sample to
158
+ match, so a generic brightness dim covers them instead of leaving
159
+ hover completely inert. Flagged in the handoff notes. ── */
160
+ :host([tone="neutral"][variant="fill"]) .chip:hover {
161
+ background: #363636;
162
+ }
163
+ :host([tone="neutral"][variant="fill"]) .chip:active,
164
+ :host([tone="neutral"][variant="fill"][dragging]) .chip {
165
+ background: #404040;
166
+ }
167
+ :host([tone="neutral"][variant="subtle"]) .chip:active,
168
+ :host([tone="neutral"][variant="subtle"][dragging]) .chip {
169
+ background: #e5e5e5;
170
+ }
171
+
172
+ :host(:not([tone="neutral"])) .chip:hover {
173
+ filter: brightness(0.96);
174
+ }
175
+ :host(:not([tone="neutral"])) .chip:active,
176
+ :host(:not([tone="neutral"])[dragging]) .chip {
177
+ filter: brightness(0.92);
178
+ }
179
+
180
+ :host([dragging]) .chip {
181
+ cursor: grabbing;
182
+ }
183
+
184
+ /* ── Focused — 1.5px outline, drawn outside (matches Figma's
185
+ strokeAlign:OUTSIDE) so it never affects layout. Same color
186
+ regardless of tone, per spec. OUTSIDE alignment means the stroke
187
+ sits flush against the shape's edge with zero gap, extending
188
+ outward by strokeWeight — outline-offset must be 0, not a positive
189
+ gap (a positive offset was the bug: it drew a visible gap that
190
+ doesn't exist in Figma). ── */
191
+ .chip:focus-visible {
192
+ outline: 1.5px solid var(--rel-chip-focus-ring, #0b0b0b);
193
+ outline-offset: 0;
194
+ }
195
+
196
+ /* ── Icons ── */
197
+ /* rel-icon renders its SVG inside its own shadow root, so sizing has to
198
+ go through --rel-icon-size (a custom property — pierces shadow
199
+ boundaries) rather than a ".chip-icon svg" selector, which can never
200
+ reach across shadow DOM. */
201
+ .chip-icon {
202
+ flex-shrink: 0;
203
+ }
204
+
205
+ :host([size="lg"]) .chip-icon {
206
+ --rel-icon-size: 16px;
207
+ }
208
+
209
+ :host([size="md"]) .chip-icon {
210
+ --rel-icon-size: 14px;
211
+ }
212
+
213
+ :host([size="sm"]) .chip-icon {
214
+ --rel-icon-size: 12px;
215
+ }
216
+
217
+ /* ── Avatar — not shown in the Figma sample. rel-avatar sizes its inner
218
+ .avatar div directly from its own "size" prop (fixed presets only —
219
+ no --rel-avatar-size custom property escape hatch like rel-icon has),
220
+ so a host-level width/height override here would only resize the
221
+ empty outer wrapper, not the actual painted circle. "xs" (20px) is
222
+ rel-avatar's smallest preset; used uniformly across all three chip
223
+ sizes since there's nothing smaller to ask for. ── */
224
+ .chip rel-avatar {
225
+ display: inline-flex;
226
+ flex-shrink: 0;
227
+ }
228
+
229
+ :host([variant="fill"]) .chip rel-avatar {
230
+ --rel-avatar-bg-fill: rgba(255, 255, 255, 0.25);
231
+ --rel-avatar-color-fill: #ffffff;
232
+ }
233
+
234
+ :host([variant="subtle"]) .chip rel-avatar {
235
+ --rel-avatar-bg-fill: rgba(11, 11, 11, 0.12);
236
+ --rel-avatar-color-fill: currentColor;
237
+ }
238
+
239
+ /* ── Remove (close) button ── */
240
+ .chip-remove {
241
+ display: inline-flex;
242
+ align-items: center;
243
+ justify-content: center;
244
+ flex-shrink: 0;
245
+ cursor: pointer;
246
+ opacity: 0.7;
247
+ background: none;
248
+ border: none;
249
+ color: inherit;
250
+ font: inherit;
251
+ padding: 0;
252
+ line-height: 1;
253
+ }
254
+
255
+ .chip-remove:hover {
256
+ opacity: 1;
257
+ }
258
+
259
+ .chip-remove:focus-visible {
260
+ outline: 1.5px solid currentColor;
261
+ outline-offset: 1px;
262
+ border-radius: 2px;
263
+ }
264
+
265
+ :host([size="lg"]) .chip-remove {
266
+ --rel-icon-size: 16px;
267
+ }
268
+ :host([size="md"]) .chip-remove {
269
+ --rel-icon-size: 14px;
270
+ }
271
+ :host([size="sm"]) .chip-remove {
272
+ --rel-icon-size: 12px;
273
+ }
274
+
275
+ /* ── Dark mode — Figma had no dark-mode sample for this new component
276
+ set. Fill stays unchanged (the saturated tones already read fine on
277
+ dark surfaces); Subtle gets a dark-tinted background, following the
278
+ same invert pattern used elsewhere in this design system. Flagged in
279
+ the handoff notes — adjust if exact values exist.
280
+ No [data-theme="dark"] :host(...) fallback here — :host() can never
281
+ be preceded by a combinator, so that form is invalid and silently
282
+ matches nothing (the exact bug hit and fixed multiple times in
283
+ rel-avatar/rel-select earlier this session). :host-context() alone
284
+ has universal modern browser support, so no fallback is needed. ── */
285
+ :host-context([data-theme="dark"])[tone="neutral"][variant="subtle"] .chip {
286
+ background: #333333;
287
+ color: #f5f5f5;
288
+ }
289
+
290
+ :host-context([data-theme="dark"])[tone="danger"][variant="subtle"] .chip {
291
+ background: #3d1414;
292
+ color: #ff8080;
293
+ }
294
+
295
+ :host-context([data-theme="dark"])[tone="warning"][variant="subtle"] .chip {
296
+ background: #3d2e0a;
297
+ color: #ffd980;
298
+ }
299
+
300
+ :host-context([data-theme="dark"])[tone="success"][variant="subtle"] .chip {
301
+ background: #0d2e22;
302
+ color: #4ddba3;
303
+ }
304
+
305
+ :host-context([data-theme="dark"])[tone="info"][variant="subtle"] .chip {
306
+ background: #0a2e45;
307
+ color: #66c2ff;
308
+ }
309
+
310
+ :host-context([data-theme="dark"])[tone="neutral"][variant="fill"] .chip {
311
+ background: #f5f5f5;
312
+ color: #0b0b0b;
313
+ }
314
+
315
+ :host-context([data-theme="dark"]) .chip-remove:focus-visible {
316
+ outline-color: currentColor;
317
+ }
318
+ `;
319
+
320
+ private get classes() {
321
+ return "chip";
322
+ }
323
+
324
+ private handleRemove(event: Event) {
325
+ event.stopPropagation();
326
+ this.removed = true;
327
+
328
+ this.dispatchEvent(
329
+ new CustomEvent("removed", {
330
+ bubbles: true,
331
+ composed: true,
332
+ })
333
+ );
334
+ }
335
+
336
+ private onDragStart = (e: DragEvent) => {
337
+ if (!this.draggableChip) return;
338
+ this.dragging = true;
339
+ e.dataTransfer?.setData("text/plain", this.label);
340
+ };
341
+
342
+ private onDragEnd = () => {
343
+ this.dragging = false;
344
+ };
345
+
346
+ protected updated(changed: Map<string, unknown>) {
347
+ if (changed.has("draggableChip")) {
348
+ if (this.draggableChip) {
349
+ this.setAttribute("draggable", "true");
350
+ this.addEventListener("dragstart", this.onDragStart);
351
+ this.addEventListener("dragend", this.onDragEnd);
352
+ } else {
353
+ this.removeAttribute("draggable");
354
+ this.removeEventListener("dragstart", this.onDragStart);
355
+ this.removeEventListener("dragend", this.onDragEnd);
356
+ this.dragging = false;
357
+ }
358
+ }
359
+ if (changed.has("dragging")) {
360
+ this.toggleAttribute("dragging", this.dragging);
361
+ }
362
+ }
363
+
364
+ render() {
365
+ const showAvatar = !!this.avatar;
366
+ const showLeadingIcon = !showAvatar && !!this.leadingIcon;
367
+
368
+ if (this.avatar && this.leadingIcon) {
369
+ console.warn(
370
+ "[rel-chip] leadingIcon and avatar are mutually exclusive. avatar takes precedence."
371
+ );
372
+ }
373
+
374
+ return html`
375
+ <span
376
+ class="${this.classes}"
377
+ role="button"
378
+ tabindex="0"
379
+ aria-label="${this.label}"
380
+ >
381
+ ${showAvatar
382
+ ? html`<rel-avatar type="text" text=${this.avatar} size="xs"></rel-avatar>`
383
+ : null}
384
+ ${showLeadingIcon
385
+ ? html`<rel-icon class="chip-icon" name="${this.leadingIcon}"></rel-icon>`
386
+ : null}
387
+
388
+ <span class="chip-label">${this.label}</span>
389
+
390
+ ${this.trailingIcon
391
+ ? html`<rel-icon class="chip-icon" name="${this.trailingIcon}"></rel-icon>`
392
+ : null}
393
+ ${this.removable
394
+ ? html`<button
395
+ class="chip-remove"
396
+ aria-label="Remove ${this.label}"
397
+ @click=${this.handleRemove}
398
+ >
399
+ <rel-icon name="close"></rel-icon>
400
+ </button>`
401
+ : null}
402
+ </span>
403
+ `;
404
+ }
405
+ }
406
+
407
+ declare global {
408
+ interface HTMLElementTagNameMap {
409
+ "rel-chip": RelChip;
410
+ }
411
+ }
@@ -22,11 +22,11 @@ export class RelContainer extends LitElement {
22
22
  }
23
23
 
24
24
  .bg-white {
25
- background-color: var(--rel-colors-white);
25
+ background-color: var(--rel-color-bg-primary);
26
26
  }
27
27
 
28
28
  .bg-light {
29
- background-color: var(--rel-colors-gray-light);
29
+ background-color: var(--rel-color-bg-secondary);
30
30
  }
31
31
 
32
32
  .bg-none {