select.css 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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. :host {
  73. /* Component spacing variables */
  74. --calcite-icon-size: 1rem;
  75. --calcite-spacing-eighth: 0.125rem;
  76. --calcite-spacing-quarter: 0.25rem;
  77. --calcite-spacing-half: 0.5rem;
  78. --calcite-spacing-three-quarters: 0.75rem;
  79. --calcite-spacing: 1rem;
  80. --calcite-spacing-plus-quarter: 1.25rem;
  81. --calcite-spacing-plus-half: 1.5rem;
  82. --calcite-spacing-double: 2rem;
  83. --calcite-menu-min-width: 10rem;
  84. --calcite-header-min-height: 3rem;
  85. --calcite-footer-min-height: 3rem;
  86. }
  87. :root {
  88. --calcite-floating-ui-transition: var(--calcite-animation-timing);
  89. }
  90. :host([hidden]) {
  91. display: none;
  92. }
  93. :host([disabled]) {
  94. pointer-events: none;
  95. cursor: default;
  96. -webkit-user-select: none;
  97. user-select: none;
  98. opacity: var(--calcite-ui-opacity-disabled);
  99. }
  100. /**
  101. * CSS Custom Properties
  102. *
  103. * These properties can be overridden using the component's tag as selector.
  104. *
  105. * @prop --calcite-select-font-size: The font size of items in the component.
  106. * @prop --calcite-select-spacing: The padding around the selected option text.
  107. */
  108. :host {
  109. position: relative;
  110. display: flex;
  111. align-items: stretch;
  112. inline-size: var(--select-width);
  113. }
  114. :host([disabled]) ::slotted([calcite-hydrated][disabled]),
  115. :host([disabled]) [calcite-hydrated][disabled] {
  116. /* prevent opacity stacking */
  117. opacity: 1;
  118. }
  119. :host([scale=s]) {
  120. block-size: 1.5rem;
  121. --calcite-select-font-size: var(--calcite-font-size--2);
  122. --calcite-select-spacing-inline: 0.5rem 2rem;
  123. }
  124. :host([scale=s]) .icon-container {
  125. padding-inline: 0.5rem;
  126. }
  127. :host([scale=m]) {
  128. block-size: 2rem;
  129. --calcite-select-font-size: var(--calcite-font-size--1);
  130. --calcite-select-spacing-inline: 0.75rem 2.5rem;
  131. }
  132. :host([scale=m]) .icon-container {
  133. padding-inline: 0.75rem;
  134. }
  135. :host([scale=l]) {
  136. block-size: 44px;
  137. --calcite-select-font-size: var(--calcite-font-size-0);
  138. --calcite-select-spacing-inline: 1rem 3rem;
  139. }
  140. :host([scale=l]) .icon-container {
  141. padding-inline: 1rem;
  142. }
  143. :host([width=auto]) {
  144. inline-size: auto;
  145. }
  146. :host([width=half]) {
  147. inline-size: 50%;
  148. }
  149. :host([width=full]) {
  150. inline-size: 100%;
  151. }
  152. .select {
  153. margin: 0px;
  154. box-sizing: border-box;
  155. inline-size: 100%;
  156. cursor: pointer;
  157. -webkit-appearance: none;
  158. appearance: none;
  159. overflow: hidden;
  160. text-overflow: ellipsis;
  161. white-space: nowrap;
  162. border-radius: 0px;
  163. border-width: 1px;
  164. border-style: solid;
  165. border-color: var(--calcite-ui-border-input);
  166. background-color: var(--calcite-ui-foreground-1);
  167. font-family: inherit;
  168. color: var(--calcite-ui-text-2);
  169. outline-color: transparent;
  170. font-size: var(--calcite-select-font-size);
  171. padding-inline: var(--calcite-select-spacing-inline);
  172. border-inline-end-width: 0px;
  173. }
  174. .select:focus {
  175. outline: 2px solid var(--calcite-ui-brand);
  176. outline-offset: -2px;
  177. }
  178. .select:hover {
  179. background-color: var(--calcite-ui-foreground-2);
  180. }
  181. select:disabled {
  182. border-color: var(--calcite-ui-border-input);
  183. --tw-bg-opacity: 1;
  184. }
  185. .icon-container {
  186. pointer-events: none;
  187. position: absolute;
  188. inset-block: 0px;
  189. display: flex;
  190. align-items: center;
  191. border-width: 0px;
  192. border-style: solid;
  193. border-color: var(--calcite-ui-border-input);
  194. background-color: transparent;
  195. color: var(--calcite-ui-text-2);
  196. inset-inline-end: 0px;
  197. border-inline-width: 0px 1px;
  198. }
  199. .select:focus ~ .icon-container {
  200. border-color: transparent;
  201. }
  202. ::slotted(input[slot=hidden-form-input]) {
  203. margin: 0 !important;
  204. opacity: 0 !important;
  205. outline: none !important;
  206. padding: 0 !important;
  207. position: absolute !important;
  208. inset: 0 !important;
  209. transform: none !important;
  210. -webkit-appearance: none !important;
  211. z-index: -1 !important;
  212. }