@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.
Files changed (54) hide show
  1. package/dist/components/rel-accordion/rel-accordion.ts +27 -22
  2. package/dist/components/rel-alert/rel-alert.ts +98 -66
  3. package/dist/components/rel-avatar/rel-avatar.ts +8 -15
  4. package/dist/components/rel-badge/rel-badge.ts +23 -16
  5. package/dist/components/rel-breadcrumb/rel-breadcrumb.ts +12 -12
  6. package/dist/components/rel-button/rel-button.ts +39 -59
  7. package/dist/components/rel-card/rel-card.ts +11 -10
  8. package/dist/components/rel-cardmedia/rel-cardmedia.ts +11 -17
  9. package/dist/components/rel-checkbox/rel-checkbox.ts +18 -35
  10. package/dist/components/rel-chip/rel-chip.ts +37 -128
  11. package/dist/components/rel-container/rel-container.ts +1 -6
  12. package/dist/components/rel-divider/rel-divider.ts +37 -37
  13. package/dist/components/rel-layout/rel-layout.ts +12 -14
  14. package/dist/components/rel-progress/rel-progress.ts +26 -15
  15. package/dist/components/rel-radio/rel-radio.ts +32 -72
  16. package/dist/components/rel-snackbar/rel-snackbar.ts +6 -0
  17. package/dist/components/rel-stepper/rel-stepper.ts +23 -2
  18. package/dist/components/rel-switch/rel-switch.ts +7 -5
  19. package/dist/components/rel-tab/rel-tab.ts +10 -8
  20. package/dist/components/rel-textfield/rel-textfield.ts +2 -2
  21. package/dist/index.d.mts +11 -7
  22. package/dist/index.d.ts +11 -7
  23. package/dist/index.js +367 -475
  24. package/dist/index.js.map +1 -1
  25. package/dist/index.mjs +383 -489
  26. package/dist/index.mjs.map +1 -1
  27. package/dist/vars-6ZIUPIU4.css +184 -0
  28. package/package.json +2 -2
  29. package/dist/components/rel-accordion/rel-accordion.stories.ts +0 -313
  30. package/dist/components/rel-alert/rel-alert.stories.ts +0 -412
  31. package/dist/components/rel-avatar/rel-avatar.stories.ts +0 -327
  32. package/dist/components/rel-badge/rel-badge.stories.ts +0 -350
  33. package/dist/components/rel-breadcrumb/rel-breadcrumb.stories.ts +0 -306
  34. package/dist/components/rel-button/rel-button.stories.ts +0 -356
  35. package/dist/components/rel-card/rel-card.stories.ts +0 -299
  36. package/dist/components/rel-cardmedia/rel-cardmedia.stories.ts +0 -368
  37. package/dist/components/rel-checkbox/rel-checkbox.stories.ts +0 -414
  38. package/dist/components/rel-chip/rel-chip.stories.ts +0 -552
  39. package/dist/components/rel-container/rel-container.stories.ts +0 -239
  40. package/dist/components/rel-divider/rel-divider.stories.ts +0 -229
  41. package/dist/components/rel-layout/rel-layout.stories.ts +0 -713
  42. package/dist/components/rel-menu/rel-menu.stories.ts +0 -910
  43. package/dist/components/rel-progress/rel-progress.stories.ts +0 -817
  44. package/dist/components/rel-radio/rel-radio.stories.ts +0 -1048
  45. package/dist/components/rel-segmented-button/rel-segmented-button.stories.ts +0 -1079
  46. package/dist/components/rel-select/rel-select.stories.ts +0 -1201
  47. package/dist/components/rel-slider/rel-slider.stories.ts +0 -730
  48. package/dist/components/rel-snackbar/rel-snackbar.stories.ts +0 -808
  49. package/dist/components/rel-stepper/rel-stepper.stories.ts +0 -752
  50. package/dist/components/rel-switch/rel-switch.stories.ts +0 -441
  51. package/dist/components/rel-tab/rel-tab.stories.ts +0 -492
  52. package/dist/components/rel-textfield/rel-textfield.stories.ts +0 -710
  53. package/dist/components/rel-toast/rel-toast.stories.ts +0 -394
  54. package/dist/components/rel-tooltip/rel-tooltip.stories.ts +0 -364
@@ -3,23 +3,19 @@ import { customElement, property } from "lit/decorators.js";
3
3
 
4
4
  @customElement("rel-button")
5
5
  export class RelButton extends LitElement {
6
- @property({ type: String }) variant:
7
- | "default"
8
- | "primary"
9
- | "secondary"
10
- | "text"
11
- | "link"
12
- | "icon" = "default";
13
-
14
- @property({ type: String }) tone: "default" | "critical" | "success" =
6
+ @property({ type: String })
7
+ variant: "default" | "primary" | "secondary" | "text" | "link" | "icon" =
15
8
  "default";
16
9
 
17
- @property({ type: String }) size: "small" | "medium" | "large" = "medium";
10
+ @property({ type: String })
11
+ tone: "default" | "critical" | "success" = "default";
18
12
 
19
- @property({ type: String }) border:
20
- | "corner-radius"
21
- | "small-corner-radius"
22
- | "no-corner-radius" = "corner-radius";
13
+ @property({ type: String })
14
+ size: "small" | "medium" | "large" = "medium";
15
+
16
+ @property({ type: String })
17
+ border: "corner-radius" | "small-corner-radius" | "no-corner-radius" =
18
+ "corner-radius";
23
19
 
24
20
  @property({ type: Boolean, reflect: true }) disabled = false;
25
21
 
@@ -41,9 +37,7 @@ export class RelButton extends LitElement {
41
37
  outline: none;
42
38
  }
43
39
 
44
- /* -------------------------
45
- SIZES (Figma)
46
- -------------------------- */
40
+ /* Sizes */
47
41
  .size-small {
48
42
  height: 32px;
49
43
  padding: 0 var(--rel-spacing-space-md);
@@ -62,9 +56,7 @@ export class RelButton extends LitElement {
62
56
  font-size: var(--rel-fontSizes-lg);
63
57
  }
64
58
 
65
- /* -------------------------
66
- BORDER RADII (Tokens)
67
- -------------------------- */
59
+ /* Borders */
68
60
  .border-corner-radius {
69
61
  border-radius: var(--rel-borders-radius-border-radius-500);
70
62
  }
@@ -77,24 +69,15 @@ export class RelButton extends LitElement {
77
69
  border-radius: var(--rel-borders-radius-border-radius-0);
78
70
  }
79
71
 
80
- /* -------------------------
81
- DISABLED STATE
82
- -------------------------- */
83
- :host([disabled]) button,
84
- button:disabled {
72
+ /* Disabled */
73
+ :host([disabled]) button {
85
74
  cursor: not-allowed;
86
75
  background-color: var(--rel-colors-gray-border) !important;
87
76
  color: var(--rel-colors-gray-disabled-text) !important;
88
- border-color: var(--rel-colors-gray-border) !important;
89
- opacity: 1;
90
77
  pointer-events: none;
91
78
  }
92
79
 
93
- /* -------------------------
94
- VARIANTS & TONES
95
- -------------------------- */
96
-
97
- /* DEFAULT */
80
+ /* Variants & tones (unchanged) */
98
81
  .btn-default.tone-default {
99
82
  background: var(--rel-colors-gray-primary);
100
83
  color: var(--rel-colors-white);
@@ -108,7 +91,6 @@ export class RelButton extends LitElement {
108
91
  color: var(--rel-colors-white);
109
92
  }
110
93
 
111
- /* PRIMARY */
112
94
  .btn-primary.tone-default {
113
95
  background: var(--rel-colors-green-primary);
114
96
  color: var(--rel-colors-black);
@@ -122,27 +104,23 @@ export class RelButton extends LitElement {
122
104
  color: var(--rel-colors-white);
123
105
  }
124
106
 
125
- /* SECONDARY */
126
107
  .btn-secondary {
127
108
  background: var(--rel-colors-white);
128
109
  border: 1px solid var(--rel-colors-black);
129
110
  color: var(--rel-colors-black);
130
111
  }
131
112
 
132
- /* TEXT */
133
113
  .btn-text {
134
114
  background: transparent;
135
115
  color: var(--rel-colors-black);
136
116
  }
137
117
 
138
- /* LINK */
139
118
  .btn-link {
140
119
  background: transparent;
141
120
  color: var(--rel-colors-blue-primary);
142
121
  text-decoration: underline;
143
122
  }
144
123
 
145
- /* ICON */
146
124
  .btn-icon {
147
125
  width: 40px;
148
126
  height: 40px;
@@ -152,32 +130,14 @@ export class RelButton extends LitElement {
152
130
  color: var(--rel-colors-black);
153
131
  }
154
132
 
155
- /* -------------------------
156
- STATES: Hover / Active
157
- -------------------------- */
158
- button:hover:not(.btn-disabled) {
133
+ button:hover:not(:disabled) {
159
134
  filter: brightness(0.92);
160
135
  }
161
136
 
162
- button:active:not(.btn-disabled) {
137
+ button:active:not(:disabled) {
163
138
  transform: scale(0.97);
164
139
  }
165
140
 
166
- /* TEXT BUTTON — hover border */
167
- .btn-text:not(.btn-disabled):hover {
168
- border: 1px solid var(--rel-colors-black);
169
- text-decoration: none;
170
- }
171
-
172
- /* LINK BUTTON — hover border */
173
- .btn-link:not(.btn-disabled):hover {
174
- border: 1px solid var(--rel-colors-blue-primary);
175
- text-decoration: underline;
176
- }
177
-
178
- /* -------------------------
179
- FOCUS RING
180
- -------------------------- */
181
141
  button:focus-visible {
182
142
  outline: 2px solid var(--rel-colors-blue-primary);
183
143
  outline-offset: 2px;
@@ -190,13 +150,33 @@ export class RelButton extends LitElement {
190
150
  `tone-${this.tone}`,
191
151
  `size-${this.size}`,
192
152
  `border-${this.border}`,
193
- this.disabled ? "btn-disabled" : "",
194
153
  ].join(" ");
195
154
  }
196
155
 
156
+ private handleClick(e: MouseEvent) {
157
+ if (this.disabled) {
158
+ e.preventDefault();
159
+ e.stopImmediatePropagation();
160
+ return;
161
+ }
162
+
163
+ // Re-emit click from host (Angular-friendly)
164
+ this.dispatchEvent(
165
+ new MouseEvent("click", {
166
+ bubbles: true,
167
+ composed: true,
168
+ })
169
+ );
170
+ }
171
+
197
172
  render() {
198
173
  return html`
199
- <button class="${this.classes}" ?disabled=${this.disabled}>
174
+ <button
175
+ class="${this.classes}"
176
+ ?disabled=${this.disabled}
177
+ @click=${this.handleClick}
178
+ aria-disabled=${this.disabled}
179
+ >
200
180
  <slot></slot>
201
181
  </button>
202
182
  `;
@@ -6,28 +6,29 @@ export class RelCard extends LitElement {
6
6
  static styles = css`
7
7
  :host {
8
8
  display: block;
9
+ font-family: var(--rel-fontFamilies-primary);
9
10
  }
10
11
 
11
12
  .card {
12
- background-color: var(--rel-colors-white, #ffffff);
13
- border-radius: var(--rel-borderRadius-lg, 12px);
14
- padding: var(--rel-spacing-space-md, 16px);
15
-
16
- box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.3),
17
- 0px 6px 10px 4px rgba(0, 0, 0, 0.15);
13
+ background-color: var(--rel-colors-white);
14
+ border-radius: var(--rel-borders-radius-border-radius-300);
15
+ padding: var(--rel-spacing-space-md);
18
16
 
19
- font-family: var(--rel-fontFamilies-primary);
17
+ box-shadow: var(--rel-shadows-shadow-200);
20
18
  transition: transform 0.2s ease, box-shadow 0.2s ease;
21
19
  }
22
20
 
23
21
  .card:hover {
24
22
  transform: translateY(-3px);
25
- box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.35),
26
- 0px 8px 14px 4px rgba(0, 0, 0, 0.2);
23
+ box-shadow: var(--rel-shadows-shadow-300);
27
24
  }
28
25
  `;
29
26
 
30
27
  render() {
31
- return html` <div class="card"><slot></slot></div> `;
28
+ return html`
29
+ <div class="card">
30
+ <slot></slot>
31
+ </div>
32
+ `;
32
33
  }
33
34
  }
@@ -15,20 +15,16 @@ export class RelCardMedia extends LitElement {
15
15
  }
16
16
 
17
17
  .card-media {
18
- background-color: var(--rel-colors-white, #ffffff);
19
- border-radius: var(--rel-borderRadius-lg, 12px);
18
+ background-color: var(--rel-colors-white);
19
+ border-radius: var(--rel-borders-radius-border-radius-300);
20
20
  overflow: hidden;
21
-
22
- box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.3),
23
- 0px 8px 12px 6px rgba(0, 0, 0, 0.15);
24
-
21
+ box-shadow: var(--rel-shadows-shadow-200);
25
22
  transition: transform 0.2s ease, box-shadow 0.2s ease;
26
23
  }
27
24
 
28
25
  .card-media:hover {
29
26
  transform: translateY(-4px);
30
- box-shadow: 0px 6px 10px rgba(0, 0, 0, 0.35),
31
- 0px 10px 16px 6px rgba(0, 0, 0, 0.2);
27
+ box-shadow: var(--rel-shadows-shadow-300);
32
28
  }
33
29
 
34
30
  .card-image img {
@@ -39,20 +35,20 @@ export class RelCardMedia extends LitElement {
39
35
  }
40
36
 
41
37
  .card-content {
42
- padding: var(--rel-spacing-space-md, 16px);
38
+ padding: var(--rel-spacing-space-md);
43
39
  }
44
40
 
45
41
  .card-content h3 {
46
42
  margin: 0 0 4px 0;
47
- font-size: var(--rel-fontSizes-md, 16px);
48
- font-weight: var(--rel-fontWeights-semibold, 600);
49
- color: var(--rel-colors-gray-heading, #2b2b2b);
43
+ font-size: var(--rel-fontSizes-md);
44
+ font-weight: var(--rel-fontWeights-semibold);
45
+ color: var(--rel-colors-gray-heading);
50
46
  }
51
47
 
52
48
  .card-content p {
53
49
  margin: 0 0 8px 0;
54
- font-size: var(--rel-fontSizes-sm, 14px);
55
- color: var(--rel-colors-gray-text, #555);
50
+ font-size: var(--rel-fontSizes-sm);
51
+ color: var(--rel-colors-gray-text);
56
52
  }
57
53
  `;
58
54
 
@@ -62,7 +58,7 @@ export class RelCardMedia extends LitElement {
62
58
  ${this.imageSrc
63
59
  ? html`
64
60
  <div class="card-image">
65
- <img src="${this.imageSrc}" alt="${this.imageAlt}" />
61
+ <img src=${this.imageSrc} alt=${this.imageAlt} />
66
62
  </div>
67
63
  `
68
64
  : null}
@@ -70,8 +66,6 @@ export class RelCardMedia extends LitElement {
70
66
  <div class="card-content">
71
67
  ${this.title ? html`<h3>${this.title}</h3>` : null}
72
68
  ${this.subtitle ? html`<p>${this.subtitle}</p>` : null}
73
-
74
- <!-- Slot for extra content such as buttons, descriptions, etc -->
75
69
  <slot></slot>
76
70
  </div>
77
71
  </div>
@@ -48,55 +48,43 @@ export class RelCheckbox extends LitElement {
48
48
  transition: all 0.2s;
49
49
  }
50
50
 
51
- /* ICONS FIXED SIZE */
52
51
  svg {
53
52
  width: 12px;
54
53
  height: 12px;
55
54
  display: none;
56
- pointer-events: none;
57
55
  }
58
56
 
59
- /* CHECKED */
60
- .checked .box {
57
+ .checked .box,
58
+ .indeterminate .box {
61
59
  background: var(--rel-colors-gray-heading);
62
60
  border-color: var(--rel-colors-gray-heading);
63
61
  }
62
+
64
63
  .checked .check-icon {
65
64
  display: block;
66
65
  }
67
66
 
68
- /* INDETERMINATE */
69
- .indeterminate .box {
70
- background: var(--rel-colors-gray-heading);
71
- border-color: var(--rel-colors-gray-heading);
72
- }
73
67
  .indeterminate .indeterminate-icon {
74
68
  display: block;
75
69
  }
76
70
 
77
- /* ERROR */
78
71
  .error .box {
79
72
  border-color: var(--rel-colors-red-primary);
80
73
  }
74
+
81
75
  .error.checked .box,
82
76
  .error.indeterminate .box {
83
77
  background: var(--rel-colors-red-primary);
84
78
  border-color: var(--rel-colors-red-primary);
85
79
  }
86
- .error .label,
87
- .error .text {
88
- color: var(--rel-colors-red-primary);
89
- }
90
80
 
91
- /* DISABLED */
92
81
  .disabled {
93
82
  opacity: 0.55;
94
- cursor: not-allowed !important;
83
+ cursor: not-allowed;
95
84
  }
96
85
 
97
86
  .label {
98
87
  font-size: var(--rel-fontSizes-md);
99
- color: var(--rel-colors-gray-heading);
100
88
  font-weight: var(--rel-fontWeights-medium);
101
89
  }
102
90
 
@@ -104,12 +92,6 @@ export class RelCheckbox extends LitElement {
104
92
  font-size: var(--rel-fontSizes-sm);
105
93
  color: var(--rel-colors-gray-text);
106
94
  }
107
-
108
- /* Focus ring */
109
- input:focus-visible + .box {
110
- outline: 2px solid var(--rel-colors-blue-primary);
111
- outline-offset: 2px;
112
- }
113
95
  `;
114
96
 
115
97
  private toggle() {
@@ -119,34 +101,35 @@ export class RelCheckbox extends LitElement {
119
101
  else if (this.status === "checked") this.status = "indeterminate";
120
102
  else this.status = "unchecked";
121
103
 
122
- this.dispatchEvent(new CustomEvent("changed", { detail: this.status }));
104
+ this.dispatchEvent(
105
+ new CustomEvent("change", {
106
+ detail: {
107
+ checked: this.status === "checked",
108
+ indeterminate: this.status === "indeterminate",
109
+ },
110
+ bubbles: true,
111
+ composed: true,
112
+ })
113
+ );
123
114
  }
124
115
 
125
116
  render() {
126
- const className = `
127
- wrapper
128
- ${this.state}
129
- ${this.status}
130
- `;
131
-
132
117
  return html`
133
- <div class="${className}">
118
+ <div class="wrapper ${this.state} ${this.status}">
134
119
  <label class="row">
135
120
  <input
136
121
  type="checkbox"
137
- @change=${this.toggle}
122
+ @click=${this.toggle}
138
123
  ?disabled=${this.state === "disabled"}
139
124
  />
140
125
 
141
126
  <span class="box">
142
- <!-- CHECK ICON -->
143
127
  <svg class="check-icon" viewBox="0 0 18 14" fill="white">
144
128
  <path
145
- d="M6.44479 14L0.5 7.36383L1.9862 5.70478L6.44479 10.6819L16.0138 0L17.5 1.65904L6.44479 14Z"
129
+ d="M6.44 14L0.5 7.36l1.49-1.66L6.44 10.68 16.01 0 17.5 1.66z"
146
130
  />
147
131
  </svg>
148
132
 
149
- <!-- INDETERMINATE ICON -->
150
133
  <svg class="indeterminate-icon" viewBox="0 0 16 2" fill="white">
151
134
  <rect width="16" height="2" />
152
135
  </svg>
@@ -1,23 +1,22 @@
1
1
  import { LitElement, html, css } from "lit";
2
- import { customElement, property, state } from "lit/decorators.js";
2
+ import { customElement, property } from "lit/decorators.js";
3
3
 
4
4
  @customElement("rel-chip")
5
5
  export class RelChip extends LitElement {
6
- @property({ type: String }) label: string = "Label";
6
+ @property({ type: String }) label = "Label";
7
7
 
8
- @property({ type: String }) tone: "default" | "blue" | "yellow" | "red" | "green" = "default";
8
+ @property({ type: String })
9
+ tone: "default" | "blue" | "yellow" | "red" | "green" = "default";
9
10
 
10
11
  @property({ type: String }) leadingIcon?: string;
11
-
12
12
  @property({ type: String }) trailingIcon?: string;
13
-
14
13
  @property({ type: String }) avatar?: string;
15
14
 
16
- @property({ type: Boolean }) removable: boolean = false;
15
+ @property({ type: Boolean }) removable = false;
16
+ @property({ type: Boolean }) outline = false;
17
17
 
18
- @property({ type: Boolean }) outline: boolean = false;
19
-
20
- @state() private removed: boolean = false;
18
+ /** IMPORTANT: reflected so CSS + Angular can see it */
19
+ @property({ type: Boolean, reflect: true }) removed = false;
21
20
 
22
21
  static styles = css`
23
22
  :host {
@@ -38,123 +37,55 @@ export class RelChip extends LitElement {
38
37
  padding: var(--rel-spacing-space-2xs) var(--rel-spacing-space-sm);
39
38
  gap: var(--rel-spacing-space-2xs);
40
39
  cursor: pointer;
41
- transition: all 0.2s ease-in-out;
42
40
  border: var(--rel-borders-width-stroke-100) solid transparent;
43
41
  user-select: none;
44
42
  white-space: nowrap;
43
+ background: transparent;
45
44
  }
46
45
 
47
46
  .chip:hover {
48
47
  filter: brightness(0.92);
49
- transform: translateY(-1px);
50
48
  box-shadow: var(--rel-shadows-shadow-100);
51
49
  }
52
50
 
53
- .chip:focus:not(:focus-visible) {
54
- outline: none;
55
- }
56
-
57
- .chip:active {
58
- transform: scale(0.97) translateY(0);
59
- box-shadow: none;
60
- filter: brightness(0.88);
61
- }
62
-
63
- /* Tone Variants - Filled */
51
+ /* TONES */
64
52
  .chip-default {
65
53
  background: var(--rel-colors-gray-border);
66
54
  color: var(--rel-colors-black);
67
55
  }
68
56
 
69
- .chip-default:focus {
70
- outline: var(--rel-borders-width-stroke-200) solid var(--rel-colors-gray-primary);
71
- outline-offset: var(--rel-spacing-space-3xs);
72
- }
73
-
74
57
  .chip-blue {
75
58
  background: var(--rel-colors-blue-tertiary);
76
59
  color: var(--rel-colors-white);
77
60
  }
78
61
 
79
- .chip-blue:focus {
80
- outline: var(--rel-borders-width-stroke-200) solid var(--rel-colors-blue-tertiary);
81
- outline-offset: var(--rel-spacing-space-3xs);
82
- }
83
-
84
62
  .chip-yellow {
85
63
  background: var(--rel-colors-yellow-pending);
86
64
  color: var(--rel-colors-black);
87
65
  }
88
66
 
89
- .chip-yellow:focus {
90
- outline: var(--rel-borders-width-stroke-200) solid var(--rel-colors-yellow-pending);
91
- outline-offset: var(--rel-spacing-space-3xs);
92
- }
93
-
94
67
  .chip-red {
95
68
  background: var(--rel-colors-red-secondary);
96
69
  color: var(--rel-colors-white);
97
70
  }
98
71
 
99
- .chip-red:focus {
100
- outline: var(--rel-borders-width-stroke-200) solid var(--rel-colors-red-secondary);
101
- outline-offset: var(--rel-spacing-space-3xs);
102
- }
103
-
104
72
  .chip-green {
105
73
  background: var(--rel-colors-green-success);
106
74
  color: var(--rel-colors-white);
107
75
  }
108
76
 
109
- .chip-green:focus {
110
- outline: var(--rel-borders-width-stroke-200) solid var(--rel-colors-green-success);
111
- outline-offset: var(--rel-spacing-space-3xs);
112
- }
113
-
114
- /* Outline Variants */
115
- .chip-outline.chip-default {
116
- background: transparent;
117
- border-color: var(--rel-colors-gray-border);
118
- color: var(--rel-colors-black);
119
- }
120
-
121
- .chip-outline.chip-blue {
122
- background: transparent;
123
- border-color: var(--rel-colors-blue-tertiary);
124
- color: var(--rel-colors-blue-tertiary);
125
- }
126
-
127
- .chip-outline.chip-yellow {
128
- background: transparent;
129
- border-color: var(--rel-colors-yellow-pending);
130
- color: var(--rel-colors-yellow-pending);
131
- }
132
-
133
- .chip-outline.chip-red {
77
+ /* OUTLINE */
78
+ .chip-outline {
134
79
  background: transparent;
135
- border-color: var(--rel-colors-red-secondary);
136
- color: var(--rel-colors-red-secondary);
137
- }
138
-
139
- .chip-outline.chip-green {
140
- background: transparent;
141
- border-color: var(--rel-colors-green-success);
142
- color: var(--rel-colors-green-success);
143
80
  }
144
81
 
145
82
  .chip-avatar {
146
83
  width: 20px;
147
84
  height: 20px;
148
- border-radius: var(--rel-borders-radius-border-radius-500);
85
+ border-radius: 50%;
149
86
  object-fit: cover;
150
87
  }
151
88
 
152
- .chip-icon {
153
- display: flex;
154
- align-items: center;
155
- line-height: 0;
156
- }
157
-
158
89
  .chip-icon ::slotted(svg),
159
90
  .chip-icon svg {
160
91
  width: 16px;
@@ -162,24 +93,14 @@ export class RelChip extends LitElement {
162
93
  fill: currentColor;
163
94
  }
164
95
 
165
- .chip-label {
166
- line-height: var(--rel-lineHeights-md);
167
- }
168
-
169
96
  .chip-remove {
170
- background: transparent;
171
- border: none;
172
- color: inherit;
173
- font-size: var(--rel-fontSizes-md);
174
- cursor: pointer;
175
- display: flex;
176
- align-items: center;
177
- padding: 0;
178
97
  margin-left: var(--rel-spacing-space-3xs);
98
+ cursor: pointer;
99
+ opacity: 0.7;
179
100
  }
180
101
 
181
102
  .chip-remove:hover {
182
- opacity: 0.6;
103
+ opacity: 1;
183
104
  }
184
105
  `;
185
106
 
@@ -194,6 +115,7 @@ export class RelChip extends LitElement {
194
115
  private handleRemove(event: Event) {
195
116
  event.stopPropagation();
196
117
  this.removed = true;
118
+
197
119
  this.dispatchEvent(
198
120
  new CustomEvent("removed", {
199
121
  bubbles: true,
@@ -202,60 +124,47 @@ export class RelChip extends LitElement {
202
124
  );
203
125
  }
204
126
 
205
- private handleKeyDown(event: KeyboardEvent) {
206
- if (!this.removable) return;
207
-
208
- if (event.key === "Backspace" || event.key === "Delete") {
209
- event.preventDefault();
210
- this.handleRemove(event);
211
- }
212
- }
213
-
214
127
  render() {
215
- if (this.removed) {
216
- return null;
217
- }
218
-
219
128
  return html`
220
- <button
129
+ <span
221
130
  class="${this.classes}"
222
- type="button"
223
131
  role="button"
224
- aria-label="${this.label}"
225
- @keydown=${this.handleKeyDown}
226
132
  tabindex="0"
133
+ aria-label="${this.label}"
227
134
  >
228
135
  ${this.avatar
229
- ? html`<img src="${this.avatar}" alt="avatar" class="chip-avatar" />`
230
- : ""}
136
+ ? html`<img src=${this.avatar} alt="" class="chip-avatar" />`
137
+ : null}
231
138
  ${this.leadingIcon
232
- ? html`<span class="chip-icon leading">
233
- <slot name="leading-icon">${this.renderIcon(this.leadingIcon)}</slot>
139
+ ? html`<span class="chip-icon">
140
+ ${this.renderIcon(this.leadingIcon)}
234
141
  </span>`
235
- : ""}
142
+ : null}
143
+
236
144
  <span class="chip-label">${this.label}</span>
145
+
237
146
  ${this.trailingIcon
238
- ? html`<span class="chip-icon trailing">
239
- <slot name="trailing-icon">${this.renderIcon(this.trailingIcon)}</slot>
147
+ ? html`<span class="chip-icon">
148
+ ${this.renderIcon(this.trailingIcon)}
240
149
  </span>`
241
- : ""}
150
+ : null}
242
151
  ${this.removable
243
- ? html`<button
244
- type="button"
152
+ ? html`<span
245
153
  class="chip-remove"
246
- @click=${this.handleRemove}
154
+ role="button"
247
155
  aria-label="Remove chip"
156
+ @click=${this.handleRemove}
248
157
  >
249
- 
250
- </button>`
251
- : ""}
252
- </button>
158
+ ✕
159
+ </span>`
160
+ : null}
161
+ </span>
253
162
  `;
254
163
  }
255
164
 
256
165
  private renderIcon(iconString: string) {
257
166
  const template = document.createElement("template");
258
167
  template.innerHTML = iconString.trim();
259
- return html`${template.content.cloneNode(true)}`;
168
+ return template.content.cloneNode(true);
260
169
  }
261
170
  }