action.css 8.6 KB

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