combobox.css 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  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-combobox-input-height: the height of the combobox input
  79. */
  80. :host {
  81. position: relative;
  82. display: block;
  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([scale=s]) {
  97. font-size: var(--calcite-font-size--2);
  98. --calcite-combobox-item-spacing-unit-l: 0.5rem;
  99. --calcite-combobox-item-spacing-unit-s: 0.25rem;
  100. --calcite-combobox-input-height: 1.5rem;
  101. }
  102. :host([scale=m]) {
  103. font-size: var(--calcite-font-size--1);
  104. --calcite-combobox-item-spacing-unit-l: 0.75rem;
  105. --calcite-combobox-item-spacing-unit-s: 0.5rem;
  106. --calcite-combobox-input-height: 2rem;
  107. }
  108. :host([scale=l]) {
  109. font-size: var(--calcite-font-size-0);
  110. --calcite-combobox-item-spacing-unit-l: 1rem;
  111. --calcite-combobox-item-spacing-unit-s: 0.75rem;
  112. --calcite-combobox-input-height: 2.75rem;
  113. }
  114. .wrapper {
  115. display: flex;
  116. background-color: var(--calcite-ui-foreground-1);
  117. color: var(--calcite-ui-text-1);
  118. outline-offset: 0;
  119. outline-color: transparent;
  120. transition: outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;
  121. box-shadow: inset 0 0 0 1px var(--calcite-ui-border-input);
  122. padding: calc(var(--calcite-combobox-item-spacing-unit-s) / 4) var(--calcite-combobox-item-spacing-unit-l);
  123. }
  124. :host(:focus-within) .wrapper, .wrapper--active {
  125. outline: 2px solid var(--calcite-ui-brand);
  126. outline-offset: -2px;
  127. }
  128. .wrapper--single {
  129. padding: 0 var(--calcite-combobox-item-spacing-unit-l);
  130. cursor: pointer;
  131. flex-wrap: nowrap;
  132. }
  133. .grid-input {
  134. display: flex;
  135. flex-grow: 1;
  136. flex-wrap: wrap;
  137. align-items: center;
  138. overflow: hidden;
  139. text-overflow: ellipsis;
  140. white-space: nowrap;
  141. padding: 0px;
  142. }
  143. .input {
  144. flex-grow: 1;
  145. -webkit-appearance: none;
  146. appearance: none;
  147. border-style: none;
  148. background-color: transparent;
  149. padding: 0px;
  150. font-family: inherit;
  151. color: var(--calcite-ui-text-1);
  152. font-size: inherit;
  153. height: var(--calcite-combobox-input-height);
  154. line-height: var(--calcite-combobox-input-height);
  155. min-width: 120px;
  156. margin-bottom: var(--calcite-combobox-item-spacing-unit-s);
  157. }
  158. .input:focus {
  159. outline: 2px solid transparent;
  160. outline-offset: 2px;
  161. }
  162. .input--transparent {
  163. opacity: 0;
  164. }
  165. .input--single {
  166. margin-bottom: 0px;
  167. margin-top: 0px;
  168. padding: 0px;
  169. }
  170. .wrapper--active .input-single {
  171. cursor: text;
  172. }
  173. .input--hidden {
  174. pointer-events: none;
  175. width: 0px;
  176. min-width: 0px;
  177. opacity: 0;
  178. }
  179. .input--icon {
  180. padding: 0 var(--calcite-combobox-item-spacing-unit-l);
  181. }
  182. .input-wrap {
  183. display: flex;
  184. flex-grow: 1;
  185. }
  186. .input-wrap--single {
  187. flex: 1 1 0%;
  188. overflow: hidden;
  189. }
  190. .label {
  191. pointer-events: none;
  192. display: flex;
  193. max-width: 100%;
  194. flex: 1 1 auto;
  195. overflow: hidden;
  196. text-overflow: ellipsis;
  197. white-space: nowrap;
  198. padding: 0px;
  199. font-weight: var(--calcite-font-weight-normal);
  200. height: var(--calcite-combobox-input-height);
  201. line-height: var(--calcite-combobox-input-height);
  202. }
  203. .label--spaced {
  204. padding-top: 0px;
  205. padding-bottom: 0px;
  206. padding-left: var(--calcite-combobox-item-spacing-unit-l);
  207. padding-right: var(--calcite-combobox-item-spacing-unit-l);
  208. }
  209. .icon-end, .icon-start {
  210. display: flex;
  211. width: 1rem;
  212. cursor: pointer;
  213. align-items: center;
  214. }
  215. .icon-end {
  216. flex: none;
  217. }
  218. .popper-container {
  219. width: 100%;
  220. display: block;
  221. position: absolute;
  222. z-index: 900;
  223. transform: scale(0);
  224. visibility: hidden;
  225. pointer-events: none;
  226. }
  227. .popper-container .calcite-popper-anim {
  228. position: relative;
  229. z-index: 1;
  230. transition: var(--calcite-popper-transition);
  231. visibility: hidden;
  232. transition-property: transform, visibility, opacity;
  233. opacity: 0;
  234. box-shadow: 0 0 16px 0 rgba(0, 0, 0, 0.16);
  235. border-radius: 0.25rem;
  236. }
  237. .popper-container[data-popper-placement^=bottom] .calcite-popper-anim {
  238. transform: translateY(-5px);
  239. }
  240. .popper-container[data-popper-placement^=top] .calcite-popper-anim {
  241. transform: translateY(5px);
  242. }
  243. .popper-container[data-popper-placement^=left] .calcite-popper-anim {
  244. transform: translateX(5px);
  245. }
  246. .popper-container[data-popper-placement^=right] .calcite-popper-anim {
  247. transform: translateX(-5px);
  248. }
  249. .popper-container[data-popper-placement] .calcite-popper-anim--active {
  250. opacity: 1;
  251. visibility: visible;
  252. transform: translate(0);
  253. }
  254. .popper-container--active {
  255. pointer-events: initial;
  256. visibility: visible;
  257. }
  258. .screen-readers-only {
  259. position: absolute;
  260. width: 1px;
  261. height: 1px;
  262. padding: 0;
  263. margin: -1px;
  264. overflow: hidden;
  265. clip: rect(0, 0, 0, 0);
  266. white-space: nowrap;
  267. border-width: 0;
  268. }
  269. .list-container {
  270. max-height: 100vh;
  271. overflow-y: auto;
  272. background-color: var(--calcite-ui-foreground-1);
  273. width: var(--calcite-dropdown-width);
  274. }
  275. .list {
  276. margin: 0px;
  277. display: block;
  278. padding: 0px;
  279. }
  280. .list--hide {
  281. height: 0px;
  282. overflow: hidden;
  283. }
  284. .chip {
  285. margin-block: calc(var(--calcite-combobox-item-spacing-unit-s) / 4);
  286. margin-inline: 0 var(--calcite-combobox-item-spacing-unit-s);
  287. max-width: 100%;
  288. }
  289. .chip--active {
  290. background-color: var(--calcite-ui-foreground-3);
  291. }
  292. .item {
  293. display: block;
  294. }
  295. ::slotted(input[slot=hidden-form-input]) {
  296. bottom: 0 !important;
  297. left: 0 !important;
  298. margin: 0 !important;
  299. opacity: 0 !important;
  300. outline: none !important;
  301. padding: 0 !important;
  302. position: absolute !important;
  303. right: 0 !important;
  304. top: 0 !important;
  305. transform: none !important;
  306. -webkit-appearance: none !important;
  307. z-index: -1 !important;
  308. }