dropdown.css 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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. /**
  74. * CSS Custom Properties
  75. *
  76. * These properties can be overridden using the component's tag as selector.
  77. *
  78. * @prop --calcite-dropdown-width: the width of the dropdown wrapper
  79. */
  80. :host {
  81. display: inline-flex;
  82. flex: 0 1 auto;
  83. }
  84. :host([disabled]) {
  85. pointer-events: none;
  86. cursor: default;
  87. -webkit-user-select: none;
  88. user-select: none;
  89. opacity: var(--calcite-ui-opacity-disabled);
  90. }
  91. :host([disabled]) ::slotted([calcite-hydrated][disabled]),
  92. :host([disabled]) [calcite-hydrated][disabled] {
  93. /* prevent opacity stacking */
  94. opacity: 1;
  95. }
  96. :host .calcite-dropdown-wrapper {
  97. display: block;
  98. position: absolute;
  99. z-index: 900;
  100. transform: scale(0);
  101. visibility: hidden;
  102. pointer-events: none;
  103. }
  104. .calcite-dropdown-wrapper .calcite-popper-anim {
  105. position: relative;
  106. z-index: 1;
  107. transition: var(--calcite-popper-transition);
  108. visibility: hidden;
  109. transition-property: transform, visibility, opacity;
  110. opacity: 0;
  111. box-shadow: 0 0 16px 0 rgba(0, 0, 0, 0.16);
  112. border-radius: 0.25rem;
  113. }
  114. .calcite-dropdown-wrapper[data-popper-placement^=bottom] .calcite-popper-anim {
  115. transform: translateY(-5px);
  116. }
  117. .calcite-dropdown-wrapper[data-popper-placement^=top] .calcite-popper-anim {
  118. transform: translateY(5px);
  119. }
  120. .calcite-dropdown-wrapper[data-popper-placement^=left] .calcite-popper-anim {
  121. transform: translateX(5px);
  122. }
  123. .calcite-dropdown-wrapper[data-popper-placement^=right] .calcite-popper-anim {
  124. transform: translateX(-5px);
  125. }
  126. .calcite-dropdown-wrapper[data-popper-placement] .calcite-popper-anim--active {
  127. opacity: 1;
  128. visibility: visible;
  129. transform: translate(0);
  130. }
  131. :host([active]) .calcite-dropdown-wrapper {
  132. pointer-events: initial;
  133. visibility: visible;
  134. }
  135. :host .calcite-dropdown-content {
  136. width: auto;
  137. overflow-y: auto;
  138. overflow-x: hidden;
  139. background-color: var(--calcite-ui-foreground-1);
  140. max-height: 90vh;
  141. width: var(--calcite-dropdown-width);
  142. }
  143. .calcite-dropdown-trigger-container {
  144. position: relative;
  145. display: flex;
  146. flex: 1 1 auto;
  147. }
  148. :host([width=s]) {
  149. --calcite-dropdown-width: 12rem;
  150. }
  151. :host([width=m]) {
  152. --calcite-dropdown-width: 14rem;
  153. }
  154. :host([width=l]) {
  155. --calcite-dropdown-width: 16rem;
  156. }