@reliability-design/web 1.2.0 → 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.
@@ -41,16 +41,15 @@ export class RelRadio extends LitElement {
41
41
  .rel-radio-group {
42
42
  display: flex;
43
43
  flex-direction: column;
44
+ align-items: flex-start;
44
45
  gap: var(--rel-spacing-space-xs);
45
46
  }
46
47
 
47
48
  .rel-radio-option {
48
- display: flex;
49
+ display: inline-flex;
49
50
  flex-direction: column;
50
51
  gap: var(--rel-spacing-space-3xs);
51
52
  cursor: pointer;
52
- padding: 4px 6px;
53
- margin: -4px -6px;
54
53
  }
55
54
 
56
55
  .rel-radio-option.disabled {
@@ -58,10 +57,6 @@ export class RelRadio extends LitElement {
58
57
  cursor: not-allowed !important;
59
58
  }
60
59
 
61
- .rel-radio-option:not(.disabled):hover {
62
- background: var(--rel-color-bg-hover, #f5f5f5);
63
- }
64
-
65
60
  .rel-radio-option:not(.disabled):hover .radio-custom {
66
61
  border-color: #525252;
67
62
  }
@@ -75,8 +70,8 @@ export class RelRadio extends LitElement {
75
70
  }
76
71
 
77
72
  .rel-radio-option:focus-within:has(input:focus-visible) {
78
- outline: 1px solid #000000;
79
- outline-offset: 0;
73
+ outline: 1.5px solid #000000;
74
+ outline-offset: 1px;
80
75
  }
81
76
 
82
77
  .radio-main {
@@ -109,15 +104,15 @@ export class RelRadio extends LitElement {
109
104
  }
110
105
 
111
106
  .radio-label {
112
- font-size: var(--rel-fontSizes-sm);
107
+ font-size: var(--rel-fontSizes-md, 16px);
113
108
  font-weight: var(--rel-fontWeights-medium);
114
109
  color: var(--rel-color-text-primary);
115
110
  }
116
111
 
117
112
  .radio-supporting {
118
- font-size: var(--rel-fontSizes-xs);
113
+ font-size: var(--rel-fontSizes-sm, 12px);
119
114
  margin-left: 28px;
120
- color: var(--rel-color-text-placeholder);
115
+ color: #7D7D7D;
121
116
  }
122
117
 
123
118
  /* Error state — unchecked only */
@@ -135,7 +130,7 @@ export class RelRadio extends LitElement {
135
130
 
136
131
  /* Error message below group */
137
132
  .error-message {
138
- font-size: var(--rel-fontSizes-xs, 10px);
133
+ font-size: var(--rel-fontSizes-sm, 12px);
139
134
  color: #CE3131;
140
135
  margin-top: var(--rel-spacing-space-2xs, 4px);
141
136
  }
@@ -158,7 +153,8 @@ export class RelRadio extends LitElement {
158
153
 
159
154
  :host-context([data-theme="dark"]) .rel-radio-option:focus-within:has(input:focus-visible),
160
155
  :host-context(.dark) .rel-radio-option:focus-within:has(input:focus-visible) {
161
- outline-color: var(--rel-color-text-primary, #F5F5F5);
156
+ outline: 1.5px solid var(--rel-color-text-primary, #F5F5F5);
157
+ outline-offset: 1px;
162
158
  }
163
159
  `;
164
160
 
@@ -180,10 +176,14 @@ export class RelRadio extends LitElement {
180
176
  registerOnTouched(fn: () => void): void { this._onTouched = fn; }
181
177
  writeValue(value: string): void { this.checked = value === this.value; }
182
178
 
179
+ private get hasSelection(): boolean {
180
+ return this.selectedValue !== null && this.selectedValue !== "";
181
+ }
182
+
183
183
  private renderOption(option: RadioOption) {
184
184
  const isChecked = this.selectedValue === option.value;
185
185
  const isDisabled = this.disabled || option.disabled;
186
- const isErrorActive = this.error && !isChecked;
186
+ const isErrorActive = this.error && !this.hasSelection;
187
187
 
188
188
  const classes = [
189
189
  "rel-radio-option",
@@ -220,7 +220,7 @@ export class RelRadio extends LitElement {
220
220
  <div class="rel-radio-group">
221
221
  ${this.options.map((o) => this.renderOption(o))}
222
222
  </div>
223
- ${this.error && this.errorMessage
223
+ ${this.error && this.errorMessage && !this.hasSelection
224
224
  ? html`<div class="error-message">${this.errorMessage}</div>`
225
225
  : ""}
226
226
  `;