181 lines
4.8 KiB
CSS
181 lines
4.8 KiB
CSS
/*
|
|
Copyright 2019 Adobe. All rights reserved.
|
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License. You may obtain a copy
|
|
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software distributed under
|
|
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
governing permissions and limitations under the License.
|
|
*/
|
|
|
|
@import "../vars/css/scales/spectrum-medium.css";
|
|
@import "../vars/css/scales/spectrum-large.css";
|
|
@import "../vars/css/components/spectrum-radio.css";
|
|
|
|
.spectrum-Radio {
|
|
@remapvars {
|
|
find: /--spectrum-radio-m(.*)/;
|
|
filter: color;
|
|
replace: --spectrum-radio$1;
|
|
}
|
|
|
|
--spectrum-radio-radius: calc(var(--spectrum-radio-circle-diameter) / 2);
|
|
--spectrum-radio-border-width-checked: calc(
|
|
calc(var(--spectrum-radio-circle-diameter) / 2) -
|
|
calc(var(--spectrum-radio-circle-dot-size) / 2)
|
|
);
|
|
|
|
--spectrum-radio-labelbelow-label-margin: var(
|
|
--spectrum-global-dimension-size-50
|
|
)
|
|
0 0 0;
|
|
--spectrum-radio-labelbelow-height: auto;
|
|
|
|
/* Hardcoded for wrapping study.
|
|
Will be a DNA token in https://jira.corp.adobe.com/browse/SDS-4466 */
|
|
--spectrum-radio-label-margin-top: var(--spectrum-global-dimension-size-75);
|
|
|
|
/* Fix for inconsistent line-height between browsers that would push the label 1px below the intended baseline */
|
|
/* more info: https://stackoverflow.com/questions/47700568/css-fonts-render-differently-in-firefox-and-chrome */
|
|
--spectrum-radio-label-line-height: 1.49;
|
|
}
|
|
|
|
.spectrum-Radio {
|
|
display: inline-flex;
|
|
align-items: flex-start;
|
|
|
|
position: relative;
|
|
|
|
min-block-size: var(--spectrum-radio-height);
|
|
max-inline-size: 100%;
|
|
|
|
vertical-align: top;
|
|
}
|
|
|
|
.spectrum-Radio-input {
|
|
/* Change the font styles in all browsers for input. */
|
|
font-family: inherit;
|
|
font-size: 100%;
|
|
line-height: 1.15;
|
|
|
|
/* Remove the margin for input in Firefox and Safari. */
|
|
margin: 0;
|
|
|
|
/* Show the overflow for input in Edge. */
|
|
overflow: visible;
|
|
|
|
/* Add the correct box sizing for [type="radio"] in IE 10-. */
|
|
box-sizing: border-box;
|
|
|
|
/* Remove the padding for [type="radio"] in IE 10-. */
|
|
padding: 0;
|
|
|
|
position: absolute;
|
|
inline-size: 100%;
|
|
block-size: 100%;
|
|
|
|
opacity: 0.0001;
|
|
z-index: 1;
|
|
|
|
cursor: pointer;
|
|
|
|
&:disabled {
|
|
cursor: default;
|
|
}
|
|
|
|
&:checked + .spectrum-Radio-button {
|
|
&:before {
|
|
border-width: var(--spectrum-radio-border-width-checked);
|
|
}
|
|
}
|
|
|
|
&:focus-ring {
|
|
+ .spectrum-Radio-button {
|
|
&:after {
|
|
margin: calc(var(--spectrum-alias-focus-ring-gap) * -1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.spectrum-Radio-label {
|
|
text-align: start;
|
|
margin-inline-start: var(--spectrum-radio-text-gap);
|
|
/* Hardcoded as no good way to calculate this */
|
|
margin-block-start: var(--spectrum-radio-label-margin-top);
|
|
|
|
font-size: var(--spectrum-radio-text-size);
|
|
font-weight: var(--spectrum-radio-text-font-weight);
|
|
font-style: var(--spectrum-radio-text-font-style);
|
|
line-height: var(--spectrum-radio-text-line-height);
|
|
|
|
transition: color var(--spectrum-global-animation-duration-100) ease-in-out;
|
|
}
|
|
|
|
.spectrum-Radio-button {
|
|
position: relative;
|
|
box-sizing: border-box;
|
|
inline-size: var(--spectrum-radio-circle-diameter);
|
|
block-size: var(--spectrum-radio-circle-diameter);
|
|
|
|
/* Fix vertical alignment when not wrapping since we're flex-start */
|
|
margin: calc(
|
|
(var(--spectrum-radio-height) - var(--spectrum-radio-circle-diameter)) / 2
|
|
)
|
|
0;
|
|
|
|
flex-grow: 0;
|
|
flex-shrink: 0;
|
|
&:before {
|
|
display: block;
|
|
z-index: 0;
|
|
content: "";
|
|
box-sizing: border-box;
|
|
position: absolute;
|
|
|
|
width: var(--spectrum-radio-circle-diameter);
|
|
height: var(--spectrum-radio-circle-diameter);
|
|
|
|
border-radius: var(--spectrum-radio-radius);
|
|
border-width: var(--spectrum-radio-circle-border-size);
|
|
border-style: solid;
|
|
|
|
transition: border var(--spectrum-global-animation-duration-100) ease-in-out,
|
|
box-shadow var(--spectrum-global-animation-duration-100) ease-in-out;
|
|
}
|
|
|
|
&:after {
|
|
border-radius: 100%;
|
|
content: "";
|
|
display: block;
|
|
position: absolute;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
top: 0;
|
|
margin: var(--spectrum-alias-focus-ring-gap);
|
|
|
|
transition: opacity var(--spectrum-global-animation-duration-100) ease-out,
|
|
margin var(--spectrum-global-animation-duration-100) ease-out;
|
|
}
|
|
}
|
|
|
|
.spectrum-Radio--labelBelow {
|
|
display: inline-flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
block-size: var(--spectrum-radio-labelbelow-height);
|
|
|
|
.spectrum-Radio-button {
|
|
flex-shrink: 0;
|
|
|
|
margin: 0;
|
|
}
|
|
|
|
.spectrum-Radio-label {
|
|
margin: var(--spectrum-radio-labelbelow-label-margin);
|
|
}
|
|
}
|