tree-item.css 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  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. max-width: 100%;
  76. cursor: pointer;
  77. color: var(--calcite-ui-text-3);
  78. outline: 2px solid transparent;
  79. outline-offset: 2px;
  80. }
  81. :host([scale=s]) {
  82. font-size: var(--calcite-font-size--2);
  83. line-height: 1rem;
  84. }
  85. :host([scale=s]) .node-container {
  86. --calcite-tree-padding-y: 0.25rem;
  87. }
  88. :host([scale=s]) .node-container .checkbox,
  89. :host([scale=s]) .node-container .chevron,
  90. :host([scale=s]) .node-container .checkmark,
  91. :host([scale=s]) .node-container .bullet-point {
  92. margin-inline: 0.25rem;
  93. }
  94. :host([scale=m]) {
  95. font-size: var(--calcite-font-size--1);
  96. line-height: 1rem;
  97. }
  98. :host([scale=m]) .node-container {
  99. --calcite-tree-padding-y: 0.5rem;
  100. }
  101. :host([scale=m]) .node-container .checkbox,
  102. :host([scale=m]) .node-container .chevron,
  103. :host([scale=m]) .node-container .checkmark,
  104. :host([scale=m]) .node-container .bullet-point {
  105. margin-inline: 0.5rem;
  106. }
  107. :host([scale=l]) {
  108. font-size: var(--calcite-font-size-0);
  109. line-height: 1.25rem;
  110. }
  111. :host([scale=l]) .node-container {
  112. --calcite-tree-padding-y: 0.75rem;
  113. }
  114. :host([scale=l]) .node-container .checkbox,
  115. :host([scale=l]) .node-container .chevron,
  116. :host([scale=l]) .node-container .checkmark,
  117. :host([scale=l]) .node-container .bullet-point {
  118. margin-inline: 0.75rem;
  119. }
  120. :host([lines]) .children-container:after {
  121. position: absolute;
  122. top: 0px;
  123. width: 1px;
  124. transition-property: color, background-color, border-color, fill, stroke, -webkit-text-decoration-color;
  125. transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
  126. transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, -webkit-text-decoration-color;
  127. transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  128. transition-duration: 150ms;
  129. transition-property: all;
  130. transition-duration: var(--calcite-animation-timing);
  131. transition-timing-function: ease-in-out;
  132. transition-delay: 0s;
  133. height: 96%;
  134. content: "";
  135. background-color: var(--calcite-ui-border-2);
  136. z-index: -1;
  137. }
  138. :host(:not([lines])) .node-container:after {
  139. display: none;
  140. }
  141. ::slotted(*) {
  142. min-width: 0px;
  143. max-width: 100%;
  144. overflow-wrap: break-word;
  145. color: inherit;
  146. text-decoration: none !important;
  147. }
  148. ::slotted(*):hover {
  149. text-decoration: none !important;
  150. }
  151. ::slotted(a) {
  152. width: 100%;
  153. -webkit-text-decoration-line: none;
  154. text-decoration-line: none;
  155. }
  156. :host {
  157. outline-offset: 0;
  158. outline-color: transparent;
  159. transition: outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;
  160. }
  161. :host(:focus) {
  162. outline: 2px solid var(--calcite-ui-brand);
  163. outline-offset: -2px;
  164. }
  165. .checkbox {
  166. outline: 2px solid transparent;
  167. outline-offset: 2px;
  168. line-height: 0;
  169. }
  170. .checkbox-label {
  171. pointer-events: none;
  172. display: flex;
  173. align-items: center;
  174. }
  175. .children-container {
  176. position: relative;
  177. height: 0px;
  178. overflow: hidden;
  179. margin-inline-start: 1.25rem;
  180. transform: scaleY(0);
  181. opacity: 0;
  182. transition: var(--calcite-animation-timing) cubic-bezier(0.215, 0.44, 0.42, 0.88), opacity var(--calcite-animation-timing) cubic-bezier(0.215, 0.44, 0.42, 0.88), all var(--calcite-animation-timing) ease-in-out;
  183. transform-origin: top;
  184. }
  185. :host([expanded]) > .children-container {
  186. transform: scaleY(1);
  187. opacity: 1;
  188. height: auto;
  189. }
  190. .node-container {
  191. position: relative;
  192. display: flex;
  193. align-items: center;
  194. padding: var(--calcite-tree-padding-y) 0;
  195. }
  196. .node-container .checkmark, .node-container .bullet-point {
  197. opacity: 0;
  198. transition-property: all;
  199. transition-duration: var(--calcite-animation-timing);
  200. transition-timing-function: ease-in-out;
  201. transition-delay: 0s;
  202. color: var(--calcite-ui-border-1);
  203. }
  204. .node-container:hover .checkmark, .node-container:hover .bullet-point, :host([selected]) .node-container:hover .checkmark, :host([selected]) .node-container:hover .bullet-point, :host(:focus) .node-container .checkmark, :host(:focus) .node-container .bullet-point {
  205. opacity: 1;
  206. }
  207. :host([selected]) > .node-container, :host([selected]) > .node-container:hover {
  208. font-weight: var(--calcite-font-weight-medium);
  209. color: var(--calcite-ui-text-1);
  210. }
  211. :host([selected]) > .node-container .bullet-point, :host([selected]) > .node-container .checkmark, :host([selected]) > .node-container:hover .bullet-point, :host([selected]) > .node-container:hover .checkmark {
  212. opacity: 1;
  213. color: var(--calcite-ui-brand);
  214. }
  215. :host(:not([has-children])):host([scale=s]) > .node-container[data-selection-mode=ancestors] .checkbox {
  216. padding-inline-start: 1.25rem;
  217. }
  218. :host(:not([has-children])):host([scale=m]) > .node-container[data-selection-mode=ancestors] .checkbox {
  219. padding-inline-start: 1.5rem;
  220. }
  221. :host(:not([has-children])):host([scale=l]) > .node-container[data-selection-mode=ancestors] .checkbox {
  222. padding-inline-start: 1.75rem;
  223. }
  224. :host([has-children]) > .node-container[data-selection-mode=ancestors] .checkbox {
  225. margin-inline-start: 0;
  226. }
  227. :host([has-children]) > .node-container .bullet-point, :host([has-children]) > .node-container .checkmark {
  228. display: none;
  229. }
  230. :host([has-children][expanded]:not([selected])) > .node-container ::slotted(*) {
  231. font-weight: var(--calcite-font-weight-medium);
  232. color: var(--calcite-ui-text-1);
  233. }
  234. :host([has-children][selected]) > .node-container[data-selection-mode=children], :host([has-children][selected]) > .node-container[data-selection-mode=multi-children] {
  235. color: var(--calcite-ui-brand);
  236. }
  237. .chevron {
  238. position: relative;
  239. align-self: center;
  240. color: var(--calcite-ui-text-3);
  241. transition-property: all;
  242. transition-duration: var(--calcite-animation-timing);
  243. transition-timing-function: ease-in-out;
  244. transition-delay: 0s;
  245. flex: 0 0 auto;
  246. transform: rotate(0deg);
  247. }
  248. .calcite--rtl .chevron {
  249. transform: rotate(180deg);
  250. }
  251. :host([expanded]) > .node-container > .chevron {
  252. transform: rotate(90deg);
  253. }
  254. :host([selected]) .checkmark,
  255. :host([selected]) .bullet-point {
  256. color: var(--calcite-ui-brand);
  257. }