button.css 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /*
  2. * Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  4. */
  5. @import "../../../mixins/_focus.css";
  6. @import "../../../mixins/_shadow.css";
  7. @import "../../../mixins/_disabled.css";
  8. @import "../../../mixins/_rounded.css";
  9. @import "../../mixins/_button.css";
  10. @import "@ckeditor/ckeditor5-ui/theme/mixins/_dir.css";
  11. .ck.ck-button,
  12. a.ck.ck-button {
  13. @mixin ck-button-colors --ck-color-button-default;
  14. @mixin ck-rounded-corners;
  15. white-space: nowrap;
  16. cursor: default;
  17. vertical-align: middle;
  18. padding: var(--ck-spacing-tiny);
  19. text-align: center;
  20. /* A very important piece of styling. Go to variable declaration to learn more. */
  21. min-width: var(--ck-ui-component-min-height);
  22. min-height: var(--ck-ui-component-min-height);
  23. /* Normalize the height of the line. Removing this will break consistent height
  24. among text and text-less buttons (with icons). */
  25. line-height: 1;
  26. /* Enable font size inheritance, which allows fluid UI scaling. */
  27. font-size: inherit;
  28. /* Avoid flickering when the foucs border shows up. */
  29. border: 1px solid transparent;
  30. /* Apply some smooth transition to the box-shadow and border. */
  31. transition: box-shadow .2s ease-in-out, border .2s ease-in-out;
  32. /* https://github.com/ckeditor/ckeditor5-theme-lark/issues/189 */
  33. -webkit-appearance: none;
  34. &:active,
  35. &:focus {
  36. @mixin ck-focus-ring;
  37. @mixin ck-box-shadow var(--ck-focus-outer-shadow);
  38. }
  39. /* Allow icon coloring using the text "color" property. */
  40. & .ck-button__icon {
  41. & use,
  42. & use * {
  43. color: inherit;
  44. }
  45. }
  46. & .ck-button__label {
  47. /* Enable font size inheritance, which allows fluid UI scaling. */
  48. font-size: inherit;
  49. font-weight: inherit;
  50. color: inherit;
  51. cursor: inherit;
  52. /* Must be consistent with .ck-icon's vertical align. Otherwise, buttons with and
  53. without labels (but with icons) have different sizes in Chrome */
  54. vertical-align: middle;
  55. @mixin ck-dir ltr {
  56. text-align: left;
  57. }
  58. @mixin ck-dir rtl {
  59. text-align: right;
  60. }
  61. }
  62. & .ck-button__keystroke {
  63. color: inherit;
  64. @mixin ck-dir ltr {
  65. margin-left: var(--ck-spacing-large);
  66. }
  67. @mixin ck-dir rtl {
  68. margin-right: var(--ck-spacing-large);
  69. }
  70. font-weight: bold;
  71. opacity: .7;
  72. }
  73. /* https://github.com/ckeditor/ckeditor5-theme-lark/issues/70 */
  74. &.ck-disabled {
  75. &:active,
  76. &:focus {
  77. /* The disabled button should have a slightly less visible shadow when focused. */
  78. @mixin ck-box-shadow var(--ck-focus-disabled-outer-shadow);
  79. }
  80. & .ck-button__icon {
  81. @mixin ck-disabled;
  82. }
  83. /* https://github.com/ckeditor/ckeditor5-theme-lark/issues/98 */
  84. & .ck-button__label {
  85. @mixin ck-disabled;
  86. }
  87. & .ck-button__keystroke {
  88. opacity: .3;
  89. }
  90. }
  91. &.ck-button_with-text {
  92. padding: var(--ck-spacing-tiny) var(--ck-spacing-standard);
  93. /* stylelint-disable-next-line no-descending-specificity */
  94. & .ck-button__icon {
  95. @mixin ck-dir ltr {
  96. margin-left: calc(-1 * var(--ck-spacing-small));
  97. margin-right: var(--ck-spacing-small);
  98. }
  99. @mixin ck-dir rtl {
  100. margin-right: calc(-1 * var(--ck-spacing-small));
  101. margin-left: var(--ck-spacing-small);
  102. }
  103. }
  104. }
  105. &.ck-button_with-keystroke {
  106. /* stylelint-disable-next-line no-descending-specificity */
  107. & .ck-button__label {
  108. flex-grow: 1;
  109. }
  110. }
  111. /* A style of the button which is currently on, e.g. its feature is active. */
  112. &.ck-on {
  113. @mixin ck-button-colors --ck-color-button-on;
  114. }
  115. &.ck-button-save {
  116. color: var(--ck-color-button-save);
  117. }
  118. &.ck-button-cancel {
  119. color: var(--ck-color-button-cancel);
  120. }
  121. }
  122. /* A style of the button which handles the primary action. */
  123. .ck.ck-button-action,
  124. a.ck.ck-button-action {
  125. @mixin ck-button-colors --ck-color-button-action;
  126. color: var(--ck-color-button-action-text);
  127. }
  128. .ck.ck-button-bold,
  129. a.ck.ck-button-bold {
  130. font-weight: bold;
  131. }