todolist.css 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. :root {
  6. --ck-todo-list-checkmark-size: 16px;
  7. }
  8. .ck-content .todo-list {
  9. list-style: none;
  10. & li {
  11. margin-bottom: 5px;
  12. & .todo-list {
  13. margin-top: 5px;
  14. }
  15. }
  16. & .todo-list__label {
  17. & > input {
  18. -webkit-appearance: none;
  19. display: inline-block;
  20. position: relative;
  21. width: var(--ck-todo-list-checkmark-size);
  22. height: var(--ck-todo-list-checkmark-size);
  23. vertical-align: middle;
  24. /* Needed on iOS */
  25. border: 0;
  26. /* LTR styles */
  27. left: -25px;
  28. margin-right: -15px;
  29. right: 0;
  30. margin-left: 0;
  31. &::before {
  32. display: block;
  33. position: absolute;
  34. box-sizing: border-box;
  35. content: '';
  36. width: 100%;
  37. height: 100%;
  38. border: 1px solid hsl(0, 0%, 20%);
  39. border-radius: 2px;
  40. transition: 250ms ease-in-out box-shadow, 250ms ease-in-out background, 250ms ease-in-out border;
  41. }
  42. &::after {
  43. display: block;
  44. position: absolute;
  45. box-sizing: content-box;
  46. pointer-events: none;
  47. content: '';
  48. /* Calculate tick position, size and border-width proportional to the checkmark size. */
  49. left: calc( var(--ck-todo-list-checkmark-size) / 3 );
  50. top: calc( var(--ck-todo-list-checkmark-size) / 5.3 );
  51. width: calc( var(--ck-todo-list-checkmark-size) / 5.3 );
  52. height: calc( var(--ck-todo-list-checkmark-size) / 2.6 );
  53. border-style: solid;
  54. border-color: transparent;
  55. border-width: 0 calc( var(--ck-todo-list-checkmark-size) / 8 ) calc( var(--ck-todo-list-checkmark-size) / 8 ) 0;
  56. transform: rotate(45deg);
  57. }
  58. &[checked] {
  59. &::before {
  60. background: hsl(126, 64%, 41%);
  61. border-color: hsl(126, 64%, 41%);
  62. }
  63. &::after {
  64. border-color: hsl(0, 0%, 100%);
  65. }
  66. }
  67. }
  68. & .todo-list__label__description {
  69. vertical-align: middle;
  70. }
  71. }
  72. }
  73. /* RTL styles */
  74. [dir="rtl"] .todo-list .todo-list__label > input {
  75. left: 0;
  76. margin-right: 0;
  77. right: -25px;
  78. margin-left: -15px;
  79. }
  80. /*
  81. * To-do list should be interactive only during the editing
  82. * (https://github.com/ckeditor/ckeditor5/issues/2090).
  83. */
  84. .ck-editor__editable .todo-list .todo-list__label > input {
  85. cursor: pointer;
  86. &:hover::before {
  87. box-shadow: 0 0 0 5px hsla(0, 0%, 0%, 0.1);
  88. }
  89. }