action.css 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  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. :host {
  68. /* Base ":host" styles for the component */
  69. box-sizing: border-box;
  70. background-color: var(--calcite-ui-foreground-1);
  71. color: var(--calcite-ui-text-2);
  72. font-size: var(--calcite-font-size--1);
  73. }
  74. :host * {
  75. box-sizing: border-box;
  76. }
  77. :root {
  78. --calcite-popper-transition: var(--calcite-animation-timing);
  79. }
  80. :host([hidden]) {
  81. display: none;
  82. }
  83. :host {
  84. display: flex;
  85. background-color: transparent;
  86. }
  87. :host([disabled]) {
  88. pointer-events: none;
  89. cursor: default;
  90. -webkit-user-select: none;
  91. user-select: none;
  92. opacity: var(--calcite-ui-opacity-disabled);
  93. }
  94. :host([disabled]) ::slotted([calcite-hydrated][disabled]),
  95. :host([disabled]) [calcite-hydrated][disabled] {
  96. /* prevent opacity stacking */
  97. opacity: 1;
  98. }
  99. .button {
  100. position: relative;
  101. margin: 0px;
  102. display: flex;
  103. width: auto;
  104. cursor: pointer;
  105. align-items: center;
  106. justify-content: flex-start;
  107. border-style: none;
  108. background-color: var(--calcite-ui-foreground-1);
  109. fill: var(--calcite-ui-text-3);
  110. font-family: var(--calcite-sans-family);
  111. font-size: var(--calcite-font-size--2);
  112. line-height: 1rem;
  113. font-weight: var(--calcite-font-weight-medium);
  114. color: var(--calcite-ui-text-3);
  115. outline-offset: 0;
  116. outline-color: transparent;
  117. transition: outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;
  118. text-align: unset;
  119. flex: 1 0 auto;
  120. }
  121. .button:hover {
  122. background-color: var(--calcite-ui-foreground-2);
  123. fill: var(--calcite-ui-text-1);
  124. color: var(--calcite-ui-text-1);
  125. }
  126. .button:focus {
  127. background-color: var(--calcite-ui-foreground-2);
  128. fill: var(--calcite-ui-text-1);
  129. color: var(--calcite-ui-text-1);
  130. outline: 2px solid var(--calcite-ui-brand);
  131. outline-offset: -2px;
  132. }
  133. .button:active {
  134. background-color: var(--calcite-ui-foreground-3);
  135. }
  136. .button .icon-container {
  137. pointer-events: none;
  138. margin: 0px;
  139. display: flex;
  140. align-items: center;
  141. justify-content: center;
  142. min-width: 1rem;
  143. min-height: 1rem;
  144. }
  145. .button .text-container {
  146. margin: 0px;
  147. width: 0px;
  148. overflow: hidden;
  149. text-overflow: ellipsis;
  150. white-space: nowrap;
  151. line-height: 1rem;
  152. opacity: 0;
  153. transition-property: opacity;
  154. transition-duration: 150ms;
  155. transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  156. transition-property: margin;
  157. transition-property: width;
  158. }
  159. .button .text-container--visible {
  160. width: auto;
  161. flex: 1 1 auto;
  162. opacity: 1;
  163. }
  164. :host([scale=s]) .button {
  165. padding: 0.5rem;
  166. font-size: var(--calcite-font-size--2);
  167. line-height: 1rem;
  168. font-weight: var(--calcite-font-weight-normal);
  169. }
  170. :host([scale=s]) .button--text-visible .icon-container {
  171. margin-inline-end: 0.5rem;
  172. }
  173. :host([scale=m]) .button {
  174. padding: 1rem;
  175. font-size: var(--calcite-font-size--1);
  176. line-height: 1rem;
  177. font-weight: var(--calcite-font-weight-normal);
  178. }
  179. :host([scale=m]) .button--text-visible .icon-container {
  180. margin-inline-end: 0.75rem;
  181. }
  182. :host([scale=l]) .button {
  183. padding: 1.25rem;
  184. font-size: var(--calcite-font-size-0);
  185. line-height: 1.25rem;
  186. font-weight: var(--calcite-font-weight-normal);
  187. }
  188. :host([scale=l]) .button--text-visible .icon-container {
  189. margin-inline-end: 1rem;
  190. }
  191. :host([alignment=center]) .button {
  192. justify-content: center;
  193. }
  194. :host([alignment=end]) .button {
  195. justify-content: flex-end;
  196. }
  197. :host([alignment=center]) .button .text-container--visible, :host([alignment=end]) .button .text-container--visible {
  198. flex: 0 1 auto;
  199. }
  200. :host([scale=s][compact]) .button, :host([scale=m][compact]) .button, :host([scale=l][compact]) .button {
  201. padding-left: 0px;
  202. padding-right: 0px;
  203. }
  204. .slot-container {
  205. display: flex;
  206. }
  207. .slot-container--hidden {
  208. display: none;
  209. }
  210. .button--text-visible {
  211. width: 100%;
  212. }
  213. :host([active]) .button, :host([active]) .button:hover, :host([active]) .button:focus, :host([active][loading]) .button {
  214. background-color: var(--calcite-ui-foreground-3);
  215. fill: var(--calcite-ui-text-1);
  216. color: var(--calcite-ui-text-1);
  217. }
  218. :host([active]) .button:active {
  219. background-color: var(--calcite-ui-foreground-1);
  220. }
  221. :host([appearance=clear]) .button {
  222. background-color: transparent;
  223. transition-property: box-shadow;
  224. transition-duration: 150ms;
  225. transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  226. }
  227. :host([appearance=clear]) .button:hover, :host([appearance=clear]) .button:focus {
  228. background-color: transparent;
  229. box-shadow: 0 0 0 2px var(--calcite-ui-border-1) inset;
  230. }
  231. :host([active][appearance=clear]) .button, :host([active][appearance=clear]) .button:hover, :host([active][appearance=clear]) .button:focus {
  232. background-color: var(--calcite-ui-foreground-3);
  233. fill: var(--calcite-ui-text-1);
  234. color: var(--calcite-ui-text-1);
  235. }
  236. :host([appearance=clear][loading]) .button, :host([appearance=clear][disabled]) .button {
  237. background-color: transparent;
  238. }
  239. :host([loading]) .button, :host([loading]) .button:hover, :host([loading]) .button:focus {
  240. background-color: var(--calcite-ui-foreground-1);
  241. }
  242. :host([loading]) .button .text-container, :host([loading]) .button:hover .text-container, :host([loading]) .button:focus .text-container {
  243. opacity: var(--calcite-ui-opacity-disabled);
  244. }
  245. :host([loading]) calcite-loader[inline] {
  246. margin-right: 0px;
  247. color: var(--calcite-ui-text-3);
  248. }
  249. :host([disabled]) .button, :host([disabled]) .button:hover, :host([disabled]) .button:focus {
  250. cursor: default;
  251. background-color: var(--calcite-ui-foreground-1);
  252. opacity: var(--calcite-ui-opacity-disabled);
  253. }
  254. :host([disabled][active]) .button, :host([disabled][active]) .button:hover, :host([disabled][active]) .button:focus {
  255. background-color: var(--calcite-ui-foreground-3);
  256. opacity: var(--calcite-ui-opacity-disabled);
  257. }
  258. :host([indicator]) .button::after {
  259. content: "";
  260. position: absolute;
  261. z-index: 10;
  262. height: 0.5rem;
  263. width: 0.5rem;
  264. border-radius: 9999px;
  265. border-width: 2px;
  266. background-color: var(--calcite-ui-brand);
  267. border-color: var(--calcite-ui-foreground-1);
  268. inset-block-end: 0.75rem;
  269. inset-inline-end: 0.75rem;
  270. }
  271. :host([indicator]) .button--text-visible::after {
  272. inset-block-end: auto;
  273. }
  274. :host([indicator]) .button--text-visible .text-container--visible {
  275. margin-inline-end: 1rem;
  276. }
  277. :host([indicator]) .button:hover::after,
  278. :host([indicator]) .button:focus::after {
  279. border-color: var(--calcite-ui-foreground-1);
  280. }
  281. :host([indicator][scale=s]) .button::after {
  282. inset-block-end: 0.25rem;
  283. inset-inline-end: 0.25rem;
  284. }
  285. :host([indicator][scale=s]) .button--text-visible::after {
  286. inset-block-end: auto;
  287. inset-inline-end: 0.5rem;
  288. }
  289. :host([indicator][active]) .button::after {
  290. border-color: var(--calcite-ui-foreground-3);
  291. }