|
2 | 2 | .eds-radio { |
3 | 3 | --_radio-icon-color: var(--eds-color-bg-fill-emphasis-default); |
4 | 4 | --_radio-hover-color: var(--eds-color-bg-fill-muted-default); |
| 5 | + --_radio-icon-size: var(--eds-sizing-icon-lg); |
| 6 | + /* Touch target: 36px spacious, 28px comfortable */ |
| 7 | + --_radio-touch-target: 2.25rem; |
5 | 8 | cursor: pointer; |
6 | 9 | position: relative; |
7 | 10 | box-sizing: border-box; |
8 | 11 | } |
9 | 12 |
|
| 13 | + [data-density='comfortable'] .eds-radio { |
| 14 | + --_radio-touch-target: 1.75rem; |
| 15 | + } |
| 16 | + |
10 | 17 | .eds-radio--standalone { |
11 | 18 | display: inline-flex; |
12 | 19 | align-items: center; |
13 | 20 | justify-content: center; |
14 | 21 | position: relative; |
15 | | - padding: 0.375rem; /* 6px for spacious: 24px icon + 12px = 36px */ |
| 22 | + /* Padding calculated from touch target and icon size */ |
| 23 | + padding: calc((var(--_radio-touch-target) - var(--_radio-icon-size)) / 2); |
16 | 24 | } |
17 | 25 |
|
18 | 26 | .eds-field.eds-radio { |
19 | | - /* Gap compensates for icon-wrapper negative margin (-4.8px) */ |
20 | | - gap: 0.925rem; |
| 27 | + /* |
| 28 | + * Gap must compensate for icon-wrapper negative margin (-4.8px inline). |
| 29 | + * This negative margin matches Figma's icon container padding for optical alignment. |
| 30 | + * Compensation: 4.8px (margin) + 2px (visual balance) ≈ 6.8px (0.425rem) |
| 31 | + */ |
| 32 | + --_radio-gap-compensation: 0.425rem; |
| 33 | + gap: calc( |
| 34 | + var(--eds-generic-gap-horizontal) + var(--_radio-gap-compensation) |
| 35 | + ); |
21 | 36 | padding-inline: var(--eds-selectable-space-horizontal); |
22 | 37 | padding-block: var(--eds-selectable-space-vertical); |
23 | 38 | width: auto; |
|
89 | 104 | outline: none; |
90 | 105 | } |
91 | 106 |
|
92 | | - .eds-radio:has(.eds-radio__input:focus-visible)::after { |
93 | | - content: ''; |
94 | | - position: absolute; |
95 | | - inset: -2px; |
96 | | - border: 1px solid var(--eds-color-border-focus); |
97 | | - border-radius: 6px; |
98 | | - pointer-events: none; |
| 107 | + .eds-radio:has(.eds-radio__input:focus-visible) { |
| 108 | + outline: var(--eds-sizing-stroke-thin) solid var(--eds-color-border-focus); |
| 109 | + outline-offset: var(--eds-sizing-stroke-thick); |
| 110 | + border-radius: var(--eds-spacing-border-radius-rounded); |
99 | 111 | } |
100 | 112 |
|
101 | | - .eds-radio--standalone:has(.eds-radio__input:focus-visible)::after { |
| 113 | + .eds-radio--standalone:has(.eds-radio__input:focus-visible) { |
102 | 114 | border-radius: var(--eds-spacing-border-radius-pill); |
103 | 115 | } |
104 | 116 |
|
105 | 117 | .eds-radio__icon { |
106 | | - position: relative; |
107 | 118 | pointer-events: none; |
108 | 119 | fill: var(--_radio-icon-color); |
109 | 120 | flex-shrink: 0; |
|
138 | 149 | color: var(--eds-color-border-neutral-medium); |
139 | 150 | cursor: not-allowed; |
140 | 151 | } |
141 | | - |
142 | | - .eds-field.eds-radio[data-color-appearance='accent'] { |
143 | | - --_eds-field-helper-color: var(--eds-color-text-neutral-subtle); |
144 | | - } |
145 | | - |
146 | | - /* Comfortable density for standalone radio */ |
147 | | - /* Icon is 20px in comfortable (--eds-sizing-icon-lg: 1.25rem) */ |
148 | | - [data-density='comfortable'] .eds-radio--standalone { |
149 | | - padding: 0.25rem; /* 4px: 20px icon + 8px = 28px */ |
150 | | - } |
151 | 152 | } |
0 commit comments