tree-item.css 7.8 KB

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