input.css 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  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. }
  76. :host([scale=s]) input, :host([scale=s]) .prefix, :host([scale=s]) .suffix {
  77. height: 1.5rem;
  78. padding: 0.5rem;
  79. font-size: var(--calcite-font-size--2);
  80. line-height: 1rem;
  81. }
  82. :host([scale=s]) textarea {
  83. height: 1.5rem;
  84. min-height: 1.5rem;
  85. }
  86. :host([scale=s]) .number-button-wrapper, :host([scale=s]) .action-wrapper calcite-button, :host([scale=s]) .action-wrapper calcite-button button {
  87. height: 1.5rem;
  88. }
  89. :host([scale=s]) input[type=file] {
  90. height: 1.5rem;
  91. }
  92. :host([scale=s]) .clear-button {
  93. min-height: 1.5rem;
  94. min-width: 1.5rem;
  95. }
  96. :host([scale=s]) textarea {
  97. height: auto;
  98. padding-top: 0.25rem;
  99. padding-bottom: 0.25rem;
  100. padding-left: 0.5rem;
  101. padding-right: 0.5rem;
  102. font-size: var(--calcite-font-size--2);
  103. line-height: 1rem;
  104. }
  105. :host([scale=m]) input, :host([scale=m]) .prefix, :host([scale=m]) .suffix {
  106. height: 2rem;
  107. padding: 0.75rem;
  108. font-size: var(--calcite-font-size--1);
  109. line-height: 1rem;
  110. }
  111. :host([scale=m]) textarea {
  112. min-height: 2rem;
  113. }
  114. :host([scale=m]) .number-button-wrapper, :host([scale=m]) .action-wrapper calcite-button, :host([scale=m]) .action-wrapper calcite-button button {
  115. height: 2rem;
  116. }
  117. :host([scale=m]) input[type=file] {
  118. height: 2rem;
  119. }
  120. :host([scale=m]) .clear-button {
  121. min-height: 2rem;
  122. min-width: 2rem;
  123. }
  124. :host([scale=m]) textarea {
  125. height: auto;
  126. padding-top: 0.5rem;
  127. padding-bottom: 0.5rem;
  128. padding-left: 0.75rem;
  129. padding-right: 0.75rem;
  130. font-size: var(--calcite-font-size--1);
  131. line-height: 1rem;
  132. }
  133. :host([scale=l]) input, :host([scale=l]) .prefix, :host([scale=l]) .suffix {
  134. height: 2.75rem;
  135. padding: 1rem;
  136. font-size: var(--calcite-font-size-0);
  137. line-height: 1.25rem;
  138. }
  139. :host([scale=l]) textarea {
  140. min-height: 2.75rem;
  141. }
  142. :host([scale=l]) .number-button-wrapper, :host([scale=l]) .action-wrapper calcite-button, :host([scale=l]) .action-wrapper calcite-button button {
  143. height: 2.75rem;
  144. }
  145. :host([scale=l]) input[type=file] {
  146. height: 2.75rem;
  147. }
  148. :host([scale=l]) .clear-button {
  149. min-height: 2.75rem;
  150. min-width: 2.75rem;
  151. }
  152. :host([scale=l]) textarea {
  153. height: auto;
  154. padding-top: 0.75rem;
  155. padding-bottom: 0.75rem;
  156. padding-left: 1rem;
  157. padding-right: 1rem;
  158. font-size: var(--calcite-font-size-0);
  159. line-height: 1.25rem;
  160. }
  161. :host([disabled]) {
  162. pointer-events: none;
  163. cursor: default;
  164. -webkit-user-select: none;
  165. user-select: none;
  166. opacity: var(--calcite-ui-opacity-disabled);
  167. }
  168. :host([disabled]) textarea {
  169. resize: none;
  170. }
  171. :host([disabled]) ::slotted([calcite-hydrated][disabled]),
  172. :host([disabled]) [calcite-hydrated][disabled] {
  173. /* prevent opacity stacking */
  174. opacity: 1;
  175. }
  176. :host textarea,
  177. :host input {
  178. transition: var(--calcite-animation-timing), height 0s;
  179. -webkit-appearance: none;
  180. position: relative;
  181. margin: 0px;
  182. box-sizing: border-box;
  183. display: flex;
  184. max-height: 100%;
  185. width: 100%;
  186. max-width: 100%;
  187. flex: 1 1 0%;
  188. border-radius: 0px;
  189. background-color: var(--calcite-ui-foreground-1);
  190. font-family: inherit;
  191. font-weight: var(--calcite-font-weight-normal);
  192. color: var(--calcite-ui-text-1);
  193. }
  194. :host input[type=search]::-webkit-search-decoration {
  195. -webkit-appearance: none;
  196. }
  197. :host input, :host textarea {
  198. border-width: 1px;
  199. border-style: solid;
  200. border-color: var(--calcite-ui-border-input);
  201. color: var(--calcite-ui-text-1);
  202. }
  203. :host input::placeholder, :host input:-ms-input-placeholder, :host input::-ms-input-placeholder, :host textarea::placeholder, :host textarea:-ms-input-placeholder, :host textarea::-ms-input-placeholder {
  204. font-weight: var(--calcite-font-weight-normal);
  205. color: var(--calcite-ui-text-3);
  206. }
  207. :host input:focus, :host textarea:focus {
  208. border-color: var(--calcite-ui-brand);
  209. color: var(--calcite-ui-text-1);
  210. }
  211. :host input[readonly], :host textarea[readonly] {
  212. background-color: var(--calcite-ui-background);
  213. font-weight: var(--calcite-font-weight-medium);
  214. }
  215. :host input[readonly]:focus, :host textarea[readonly]:focus {
  216. color: var(--calcite-ui-text-1);
  217. }
  218. :host calcite-icon {
  219. color: var(--calcite-ui-text-3);
  220. }
  221. :host textarea, :host input {
  222. outline-offset: 0;
  223. outline-color: transparent;
  224. transition: outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;
  225. }
  226. :host textarea:focus, :host input:focus {
  227. outline: 2px solid var(--calcite-ui-brand);
  228. outline-offset: -2px;
  229. }
  230. :host([status=invalid]) input, :host([status=invalid]) textarea {
  231. border-color: var(--calcite-ui-danger);
  232. }
  233. :host([status=invalid]) input:focus, :host([status=invalid]) textarea:focus {
  234. outline: 2px solid var(--calcite-ui-danger);
  235. outline-offset: -2px;
  236. }
  237. :host([scale=s]) .icon {
  238. inset-inline-start: 0.5rem;
  239. }
  240. :host([scale=m]) .icon {
  241. inset-inline-start: 0.75rem;
  242. }
  243. :host([scale=l]) .icon {
  244. inset-inline-start: 1rem;
  245. }
  246. :host([icon][scale=s]) input {
  247. padding-inline-start: 2rem;
  248. }
  249. :host([icon][scale=m]) input {
  250. padding-inline-start: 2.5rem;
  251. }
  252. :host([icon][scale=l]) input {
  253. padding-inline-start: 3rem;
  254. }
  255. .element-wrapper {
  256. position: relative;
  257. order: 3;
  258. display: inline-flex;
  259. flex: 1 1 0%;
  260. align-items: center;
  261. }
  262. .icon {
  263. pointer-events: none;
  264. position: absolute;
  265. z-index: 10;
  266. display: block;
  267. transition-property: all;
  268. transition-duration: var(--calcite-animation-timing);
  269. transition-timing-function: ease-in-out;
  270. transition-delay: 0s;
  271. }
  272. input[type=text]::-ms-clear, input[type=text]::-ms-reveal {
  273. display: none;
  274. height: 0px;
  275. width: 0px;
  276. }
  277. input[type=search]::-webkit-search-decoration, input[type=search]::-webkit-search-cancel-button, input[type=search]::-webkit-search-results-button, input[type=search]::-webkit-search-results-decoration, input[type=date]::-webkit-clear-button, input[type=time]::-webkit-clear-button {
  278. display: none;
  279. }
  280. .clear-button {
  281. pointer-events: initial;
  282. order: 4;
  283. margin: 0px;
  284. box-sizing: border-box;
  285. display: flex;
  286. min-height: 100%;
  287. cursor: pointer;
  288. align-items: center;
  289. justify-content: center;
  290. align-self: stretch;
  291. border-width: 1px;
  292. border-style: solid;
  293. border-color: var(--calcite-ui-border-input);
  294. background-color: var(--calcite-ui-foreground-1);
  295. outline-offset: 0;
  296. outline-color: transparent;
  297. transition: outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;
  298. border-inline-start-width: 0px;
  299. }
  300. .clear-button:hover {
  301. background-color: var(--calcite-ui-foreground-2);
  302. transition-property: all;
  303. transition-duration: var(--calcite-animation-timing);
  304. transition-timing-function: ease-in-out;
  305. transition-delay: 0s;
  306. }
  307. .clear-button:hover calcite-icon {
  308. color: var(--calcite-ui-text-1);
  309. transition-property: all;
  310. transition-duration: var(--calcite-animation-timing);
  311. transition-timing-function: ease-in-out;
  312. transition-delay: 0s;
  313. }
  314. .clear-button:active {
  315. background-color: var(--calcite-ui-foreground-3);
  316. }
  317. .clear-button:active calcite-icon {
  318. color: var(--calcite-ui-text-1);
  319. }
  320. .clear-button:focus {
  321. outline: 2px solid var(--calcite-ui-brand);
  322. outline-offset: -2px;
  323. }
  324. .clear-button:disabled {
  325. opacity: var(--calcite-ui-opacity-disabled);
  326. }
  327. .loader {
  328. top: 1px;
  329. left: 1px;
  330. right: 1px;
  331. pointer-events: none;
  332. position: absolute;
  333. display: block;
  334. }
  335. .action-wrapper {
  336. order: 7;
  337. display: flex;
  338. }
  339. .prefix, .suffix {
  340. box-sizing: border-box;
  341. display: flex;
  342. height: auto;
  343. min-height: 100%;
  344. -webkit-user-select: none;
  345. user-select: none;
  346. align-content: center;
  347. align-items: center;
  348. overflow-wrap: break-word;
  349. border-width: 1px;
  350. border-style: solid;
  351. border-color: var(--calcite-ui-border-input);
  352. background-color: var(--calcite-ui-background);
  353. font-weight: var(--calcite-font-weight-medium);
  354. line-height: 1;
  355. color: var(--calcite-ui-text-2);
  356. }
  357. .prefix {
  358. order: 2;
  359. border-inline-end-width: 0px;
  360. }
  361. .suffix {
  362. order: 5;
  363. border-inline-start-width: 0px;
  364. }
  365. :host([alignment=start]) textarea, :host([alignment=start]) input {
  366. text-align: start;
  367. }
  368. :host([alignment=end]) textarea, :host([alignment=end]) input {
  369. text-align: end;
  370. }
  371. :host input[type=number] {
  372. -moz-appearance: textfield;
  373. }
  374. :host input[type=number]::-webkit-inner-spin-button, :host input[type=number]::-webkit-outer-spin-button {
  375. -webkit-appearance: none;
  376. -moz-appearance: textfield;
  377. margin: 0px;
  378. }
  379. .number-button-wrapper {
  380. pointer-events: none;
  381. order: 6;
  382. box-sizing: border-box;
  383. display: flex;
  384. flex-direction: column;
  385. transition-property: all;
  386. transition-duration: var(--calcite-animation-timing);
  387. transition-timing-function: ease-in-out;
  388. transition-delay: 0s;
  389. }
  390. :host([number-button-type=vertical]) .wrapper {
  391. flex-direction: row;
  392. display: flex;
  393. }
  394. :host([number-button-type=vertical]) input, :host([number-button-type=vertical]) textarea {
  395. order: 2;
  396. }
  397. :host([number-button-type=horizontal]) .calcite--rtl .number-button-item[data-adjustment=down] calcite-icon {
  398. transform: rotate(-90deg);
  399. }
  400. :host([number-button-type=horizontal]) .calcite--rtl .number-button-item[data-adjustment=up] calcite-icon {
  401. transform: rotate(-90deg);
  402. }
  403. .number-button-item.number-button-item--horizontal[data-adjustment=down], .number-button-item.number-button-item--horizontal[data-adjustment=up] {
  404. order: 1;
  405. max-height: 100%;
  406. min-height: 100%;
  407. align-self: stretch;
  408. }
  409. .number-button-item.number-button-item--horizontal[data-adjustment=down] calcite-icon, .number-button-item.number-button-item--horizontal[data-adjustment=up] calcite-icon {
  410. transform: rotate(90deg);
  411. }
  412. .number-button-item.number-button-item--horizontal[data-adjustment=down] {
  413. border-width: 1px;
  414. border-style: solid;
  415. border-color: var(--calcite-ui-border-input);
  416. border-inline-end-width: 0px;
  417. }
  418. .number-button-item.number-button-item--horizontal[data-adjustment=down]:hover {
  419. background-color: var(--calcite-ui-foreground-2);
  420. }
  421. .number-button-item.number-button-item--horizontal[data-adjustment=down]:hover calcite-icon {
  422. color: var(--calcite-ui-text-1);
  423. }
  424. .number-button-item.number-button-item--horizontal[data-adjustment=up] {
  425. order: 5;
  426. }
  427. .number-button-item.number-button-item--horizontal[data-adjustment=up]:hover {
  428. background-color: var(--calcite-ui-foreground-2);
  429. }
  430. .number-button-item.number-button-item--horizontal[data-adjustment=up]:hover calcite-icon {
  431. color: var(--calcite-ui-text-1);
  432. }
  433. :host([number-button-type=vertical]) .number-button-item[data-adjustment=down]:hover {
  434. background-color: var(--calcite-ui-foreground-2);
  435. }
  436. :host([number-button-type=vertical]) .number-button-item[data-adjustment=down]:hover calcite-icon {
  437. color: var(--calcite-ui-text-1);
  438. }
  439. :host([number-button-type=vertical]) .number-button-item[data-adjustment=up]:hover {
  440. background-color: var(--calcite-ui-foreground-2);
  441. }
  442. :host([number-button-type=vertical]) .number-button-item[data-adjustment=up]:hover calcite-icon {
  443. color: var(--calcite-ui-text-1);
  444. }
  445. :host([number-button-type=vertical]) .number-button-item[data-adjustment=down] {
  446. border-top-width: 0px;
  447. }
  448. .number-button-item {
  449. max-height: 50%;
  450. min-height: 50%;
  451. pointer-events: initial;
  452. margin: 0px;
  453. box-sizing: border-box;
  454. display: flex;
  455. cursor: pointer;
  456. align-items: center;
  457. align-self: center;
  458. border-width: 1px;
  459. border-style: solid;
  460. border-color: var(--calcite-ui-border-input);
  461. background-color: var(--calcite-ui-foreground-1);
  462. padding-top: 0px;
  463. padding-bottom: 0px;
  464. padding-left: 0.5rem;
  465. padding-right: 0.5rem;
  466. transition-property: all;
  467. transition-duration: var(--calcite-animation-timing);
  468. transition-timing-function: ease-in-out;
  469. transition-delay: 0s;
  470. border-inline-start-width: 0px;
  471. }
  472. .number-button-item calcite-icon {
  473. pointer-events: none;
  474. transition-property: all;
  475. transition-duration: var(--calcite-animation-timing);
  476. transition-timing-function: ease-in-out;
  477. transition-delay: 0s;
  478. }
  479. .number-button-item:focus {
  480. background-color: var(--calcite-ui-foreground-2);
  481. }
  482. .number-button-item:focus calcite-icon {
  483. color: var(--calcite-ui-text-1);
  484. }
  485. .number-button-item:active {
  486. background-color: var(--calcite-ui-foreground-3);
  487. }
  488. .wrapper {
  489. position: relative;
  490. display: flex;
  491. flex-direction: row;
  492. align-items: center;
  493. }
  494. :host input::-webkit-calendar-picker-indicator {
  495. display: none;
  496. }
  497. :host input[type=date]::-webkit-input-placeholder {
  498. visibility: hidden !important;
  499. }
  500. :host textarea::-webkit-resizer {
  501. position: absolute;
  502. bottom: 0px;
  503. box-sizing: border-box;
  504. padding-top: 0px;
  505. padding-bottom: 0px;
  506. padding-left: 0.25rem;
  507. padding-right: 0.25rem;
  508. inset-inline-end: 0;
  509. }
  510. .resize-icon-wrapper {
  511. bottom: 2px;
  512. inset-inline-end: 2px;
  513. pointer-events: none;
  514. position: absolute;
  515. z-index: 10;
  516. height: 0.75rem;
  517. width: 0.75rem;
  518. background-color: var(--calcite-ui-foreground-1);
  519. color: var(--calcite-ui-text-3);
  520. }
  521. .resize-icon-wrapper calcite-icon {
  522. bottom: 0.25rem;
  523. inset-inline-end: 0.25rem;
  524. transform: rotate(-45deg);
  525. }
  526. .calcite--rtl .resize-icon-wrapper calcite-icon {
  527. transform: rotate(45deg);
  528. }
  529. :host([type=color]) input {
  530. padding: 0.25rem;
  531. }
  532. :host([type=file]) input {
  533. cursor: pointer;
  534. border-width: 1px;
  535. border-style: dashed;
  536. border-color: var(--calcite-ui-border-input);
  537. background-color: var(--calcite-ui-foreground-1);
  538. text-align: center;
  539. }
  540. :host([type=file][scale=s]) input {
  541. padding-top: 1px;
  542. padding-bottom: 1px;
  543. padding-left: 0.5rem;
  544. padding-right: 0.5rem;
  545. }
  546. :host([type=file][scale=m]) input {
  547. padding-top: 0.25rem;
  548. padding-bottom: 0.25rem;
  549. padding-left: 0.75rem;
  550. padding-right: 0.75rem;
  551. }
  552. :host([type=file][scale=l]) input {
  553. padding-top: 0.5rem;
  554. padding-bottom: 0.5rem;
  555. padding-left: 1rem;
  556. padding-right: 1rem;
  557. }
  558. :host(.no-bottom-border) input {
  559. border-bottom-width: 0px;
  560. }
  561. :host(.border-top-color-one) input {
  562. border-top-color: var(--calcite-ui-border-1);
  563. }
  564. :host .inline-child {
  565. background-color: transparent;
  566. transition-property: all;
  567. transition-duration: var(--calcite-animation-timing);
  568. transition-timing-function: ease-in-out;
  569. transition-delay: 0s;
  570. }
  571. :host .inline-child .editing-enabled {
  572. background-color: inherit;
  573. }
  574. :host .inline-child:not(.editing-enabled) {
  575. display: flex;
  576. cursor: pointer;
  577. border-color: transparent;
  578. padding-inline-start: 0;
  579. }
  580. ::slotted(input[slot=hidden-form-input]) {
  581. bottom: 0 !important;
  582. left: 0 !important;
  583. margin: 0 !important;
  584. opacity: 0 !important;
  585. outline: none !important;
  586. padding: 0 !important;
  587. position: absolute !important;
  588. right: 0 !important;
  589. top: 0 !important;
  590. transform: none !important;
  591. -webkit-appearance: none !important;
  592. z-index: -1 !important;
  593. }