radio-button.css 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. /* mixins & extensions */
  2. @keyframes in {
  3. 0% {
  4. opacity: 0;
  5. }
  6. 100% {
  7. opacity: 1;
  8. }
  9. }
  10. @keyframes in-down {
  11. 0% {
  12. opacity: 0;
  13. transform: translate3D(0, -5px, 0);
  14. }
  15. 100% {
  16. opacity: 1;
  17. transform: translate3D(0, 0, 0);
  18. }
  19. }
  20. @keyframes in-up {
  21. 0% {
  22. opacity: 0;
  23. transform: translate3D(0, 5px, 0);
  24. }
  25. 100% {
  26. opacity: 1;
  27. transform: translate3D(0, 0, 0);
  28. }
  29. }
  30. @keyframes in-scale {
  31. 0% {
  32. opacity: 0;
  33. transform: scale3D(0.95, 0.95, 1);
  34. }
  35. 100% {
  36. opacity: 1;
  37. transform: scale3D(1, 1, 1);
  38. }
  39. }
  40. :root {
  41. --calcite-animation-timing: calc(150ms * var(--calcite-internal-duration-factor));
  42. --calcite-internal-duration-factor: var(--calcite-duration-factor, 1);
  43. --calcite-internal-animation-timing-fast: calc(100ms * var(--calcite-internal-duration-factor));
  44. --calcite-internal-animation-timing-medium: calc(200ms * var(--calcite-internal-duration-factor));
  45. --calcite-internal-animation-timing-slow: calc(300ms * var(--calcite-internal-duration-factor));
  46. }
  47. .calcite-animate {
  48. opacity: 0;
  49. animation-fill-mode: both;
  50. animation-duration: var(--calcite-animation-timing);
  51. }
  52. .calcite-animate__in {
  53. animation-name: in;
  54. }
  55. .calcite-animate__in-down {
  56. animation-name: in-down;
  57. }
  58. .calcite-animate__in-up {
  59. animation-name: in-up;
  60. }
  61. .calcite-animate__in-scale {
  62. animation-name: in-scale;
  63. }
  64. /**
  65. * Currently only used in Checkbox.
  66. */
  67. :root {
  68. --calcite-popper-transition: var(--calcite-animation-timing);
  69. }
  70. :host([hidden]) {
  71. display: none;
  72. }
  73. :host {
  74. display: block;
  75. cursor: pointer;
  76. }
  77. :host .container {
  78. position: relative;
  79. outline: 2px solid transparent;
  80. outline-offset: 2px;
  81. }
  82. :host .radio {
  83. cursor: pointer;
  84. border-radius: 9999px;
  85. background-color: var(--calcite-ui-foreground-1);
  86. transition-property: all;
  87. transition-duration: 150ms;
  88. transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  89. box-shadow: inset 0 0 0 1px var(--calcite-ui-border-input);
  90. }
  91. :host([hovered]) .radio,
  92. :host(:not([checked])[focused]:not([disabled])) .radio {
  93. box-shadow: inset 0 0 0 2px var(--calcite-ui-brand);
  94. }
  95. :host([disabled]) {
  96. pointer-events: none;
  97. cursor: default;
  98. -webkit-user-select: none;
  99. user-select: none;
  100. opacity: var(--calcite-ui-opacity-disabled);
  101. }
  102. :host([disabled]) .radio {
  103. cursor: default;
  104. opacity: var(--calcite-ui-opacity-disabled);
  105. }
  106. :host([disabled]) ::slotted([calcite-hydrated][disabled]),
  107. :host([disabled]) [calcite-hydrated][disabled] {
  108. /* prevent opacity stacking */
  109. opacity: 1;
  110. }
  111. :host([hovered][disabled]) .radio {
  112. box-shadow: inset 0 0 0 1px var(--calcite-ui-border-input);
  113. }
  114. :host([scale=s]) {
  115. --calcite-radio-size: var(--calcite-font-size--2);
  116. }
  117. :host([scale=m]) {
  118. --calcite-radio-size: var(--calcite-font-size--1);
  119. }
  120. :host([scale=l]) {
  121. --calcite-radio-size: var(--calcite-font-size-0);
  122. }
  123. .radio {
  124. height: var(--calcite-radio-size);
  125. max-width: var(--calcite-radio-size);
  126. min-width: var(--calcite-radio-size);
  127. }
  128. :host([scale=s][checked]) .radio,
  129. :host([hovered][scale=s][checked][disabled]) .radio {
  130. box-shadow: inset 0 0 0 4px var(--calcite-ui-brand);
  131. }
  132. :host([scale=s][focused][checked]:not([disabled])) .radio {
  133. box-shadow: inset 0 0 0 4px var(--calcite-ui-brand), 0 0 0 2px var(--calcite-ui-foreground-1), 0 0 0 4px var(--calcite-ui-brand);
  134. }
  135. :host([scale=m][checked]) .radio,
  136. :host([hovered][scale=m][checked][disabled]) .radio {
  137. box-shadow: inset 0 0 0 5px var(--calcite-ui-brand);
  138. }
  139. :host([scale=m][focused][checked]:not([disabled])) .radio {
  140. box-shadow: inset 0 0 0 5px var(--calcite-ui-brand), 0 0 0 2px var(--calcite-ui-foreground-1), 0 0 0 4px var(--calcite-ui-brand);
  141. }
  142. :host([scale=l][checked]) .radio,
  143. :host([hovered][scale=l][checked][disabled]) .radio {
  144. box-shadow: inset 0 0 0 6px var(--calcite-ui-brand);
  145. }
  146. :host([scale=l][focused][checked]:not([disabled])) .radio {
  147. box-shadow: inset 0 0 0 6px var(--calcite-ui-brand), 0 0 0 2px var(--calcite-ui-foreground-1), 0 0 0 4px var(--calcite-ui-brand);
  148. }
  149. @media (forced-colors: active) {
  150. :host([checked]) .radio::after,
  151. :host([checked][disabled]) .radio::after {
  152. content: "";
  153. width: var(--calcite-radio-size);
  154. height: var(--calcite-radio-size);
  155. background-color: windowText;
  156. display: block;
  157. }
  158. }
  159. ::slotted(input[slot=hidden-form-input]) {
  160. bottom: 0 !important;
  161. left: 0 !important;
  162. margin: 0 !important;
  163. opacity: 0 !important;
  164. outline: none !important;
  165. padding: 0 !important;
  166. position: absolute !important;
  167. right: 0 !important;
  168. top: 0 !important;
  169. transform: none !important;
  170. -webkit-appearance: none !important;
  171. z-index: -1 !important;
  172. }