@reown/appkit-ui
Version:
The full stack toolkit to build onchain app UX.
166 lines (143 loc) • 5.27 kB
JavaScript
import { css } from '../../utils/ThemeHelperUtil.js';
export default css `
:host {
display: flex;
align-items: center;
justify-content: center;
}
label {
position: relative;
display: inline-block;
user-select: none;
transition:
background-color ${({ durations }) => durations['lg']}
${({ easings }) => easings['ease-out-power-2']},
color ${({ durations }) => durations['lg']} ${({ easings }) => easings['ease-out-power-2']},
border ${({ durations }) => durations['lg']} ${({ easings }) => easings['ease-out-power-2']},
box-shadow ${({ durations }) => durations['lg']}
${({ easings }) => easings['ease-out-power-2']},
width ${({ durations }) => durations['lg']} ${({ easings }) => easings['ease-out-power-2']},
height ${({ durations }) => durations['lg']} ${({ easings }) => easings['ease-out-power-2']},
transform ${({ durations }) => durations['lg']}
${({ easings }) => easings['ease-out-power-2']},
opacity ${({ durations }) => durations['lg']} ${({ easings }) => easings['ease-out-power-2']};
will-change: background-color, color, border, box-shadow, width, height, transform, opacity;
}
input {
width: 0;
height: 0;
opacity: 0;
}
span {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: ${({ colors }) => colors.neutrals300};
border-radius: ${({ borderRadius }) => borderRadius.round};
border: 1px solid transparent;
will-change: border;
transition:
background-color ${({ durations }) => durations['lg']}
${({ easings }) => easings['ease-out-power-2']},
color ${({ durations }) => durations['lg']} ${({ easings }) => easings['ease-out-power-2']},
border ${({ durations }) => durations['lg']} ${({ easings }) => easings['ease-out-power-2']},
box-shadow ${({ durations }) => durations['lg']}
${({ easings }) => easings['ease-out-power-2']},
width ${({ durations }) => durations['lg']} ${({ easings }) => easings['ease-out-power-2']},
height ${({ durations }) => durations['lg']} ${({ easings }) => easings['ease-out-power-2']},
transform ${({ durations }) => durations['lg']}
${({ easings }) => easings['ease-out-power-2']},
opacity ${({ durations }) => durations['lg']} ${({ easings }) => easings['ease-out-power-2']};
will-change: background-color, color, border, box-shadow, width, height, transform, opacity;
}
span:before {
content: '';
position: absolute;
background-color: ${({ colors }) => colors.white};
border-radius: 50%;
}
/* -- Sizes --------------------------------------------------------- */
label[data-size='lg'] {
width: 48px;
height: 32px;
}
label[data-size='md'] {
width: 40px;
height: 28px;
}
label[data-size='sm'] {
width: 32px;
height: 22px;
}
label[data-size='lg'] > span:before {
height: 24px;
width: 24px;
left: 4px;
top: 3px;
}
label[data-size='md'] > span:before {
height: 20px;
width: 20px;
left: 4px;
top: 3px;
}
label[data-size='sm'] > span:before {
height: 16px;
width: 16px;
left: 3px;
top: 2px;
}
/* -- Focus states --------------------------------------------------- */
input:focus-visible:not(:checked) + span,
input:focus:not(:checked) + span {
border: 1px solid ${({ tokens }) => tokens.core.iconAccentPrimary};
background-color: ${({ tokens }) => tokens.theme.textTertiary};
box-shadow: 0px 0px 0px 4px rgba(9, 136, 240, 0.2);
}
input:focus-visible:checked + span,
input:focus:checked + span {
border: 1px solid ${({ tokens }) => tokens.core.iconAccentPrimary};
box-shadow: 0px 0px 0px 4px rgba(9, 136, 240, 0.2);
}
/* -- Checked states --------------------------------------------------- */
input:checked + span {
background-color: ${({ tokens }) => tokens.core.iconAccentPrimary};
}
label[data-size='lg'] > input:checked + span:before {
transform: translateX(calc(100% - 9px));
}
label[data-size='md'] > input:checked + span:before {
transform: translateX(calc(100% - 9px));
}
label[data-size='sm'] > input:checked + span:before {
transform: translateX(calc(100% - 7px));
}
/* -- Hover states ------------------------------------------------------- */
label:hover > input:not(:checked):not(:disabled) + span {
background-color: ${({ colors }) => colors.neutrals400};
}
label:hover > input:checked:not(:disabled) + span {
background-color: ${({ colors }) => colors.accent080};
}
/* -- Disabled state --------------------------------------------------- */
label:has(input:disabled) {
pointer-events: none;
user-select: none;
}
input:not(:checked):disabled + span {
background-color: ${({ colors }) => colors.neutrals700};
}
input:checked:disabled + span {
background-color: ${({ colors }) => colors.neutrals700};
}
input:not(:checked):disabled + span::before {
background-color: ${({ colors }) => colors.neutrals400};
}
input:checked:disabled + span::before {
background-color: ${({ tokens }) => tokens.theme.textTertiary};
}
`;
//# sourceMappingURL=styles.js.map