Text.scss 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  1. /**
  2. * @class Ext.field.Text
  3. */
  4. /**
  5. * @var {color}
  6. * Text Field input color
  7. */
  8. $textfield-input-color: dynamic($color);
  9. /**
  10. * @var {color}
  11. * Text Field input color when focused
  12. */
  13. $textfield-focused-input-color: dynamic(null);
  14. /**
  15. * @var {color}
  16. * Text Field input color when invalid
  17. */
  18. $textfield-invalid-input-color: dynamic(null);
  19. /**
  20. * @var {color}
  21. * Text Field input color when disabled
  22. */
  23. $textfield-disabled-input-color: dynamic(null);
  24. /**
  25. * @var {number/list}
  26. * Text Field input border width
  27. */
  28. $textfield-input-border-width: dynamic(1px);
  29. /**
  30. * @var {string/list}
  31. * Text Field input border style
  32. */
  33. $textfield-input-border-style: dynamic(solid);
  34. /**
  35. * @var {string/list}
  36. * Text Field input border style when focused
  37. */
  38. $textfield-focused-input-border-style: dynamic(null);
  39. /**
  40. * @var {string/list}
  41. * Text Field input border style when invalid
  42. */
  43. $textfield-invalid-input-border-style: dynamic(null);
  44. //# fashion replaces $field-border-color
  45. /**
  46. * @var {color/list}
  47. * Text Field input border color
  48. */
  49. $textfield-input-border-color: dynamic($neutral-color);
  50. /**
  51. * @var {string/list}
  52. * Text Field input border color when focused
  53. */
  54. $textfield-focused-input-border-color: dynamic(mix(#fff, #157fcc, 15%));
  55. /**
  56. * @var {string/list}
  57. * Text Field input border color when invalid
  58. */
  59. $textfield-invalid-input-border-color: dynamic($alert-color);
  60. /**
  61. * @var {string/list}
  62. * Text Field input border color when disabled
  63. */
  64. $textfield-disabled-input-border-color: dynamic(null);
  65. /**
  66. * @var {number}
  67. * Text field input underline width
  68. */
  69. $textfield-input-underline-width: dynamic(null);
  70. /**
  71. * @var {number}
  72. * Text field input underline width when focused
  73. */
  74. $textfield-focused-input-underline-width: dynamic(null);
  75. /**
  76. * @var {number}
  77. * Text field input underline width when invalid
  78. */
  79. $textfield-invalid-input-underline-width: dynamic(null);
  80. /**
  81. * @var {color}
  82. * Text field input underline color
  83. */
  84. $textfield-input-underline-color: dynamic(null);
  85. /**
  86. * @var {color}
  87. * Text field input underline color when focused
  88. */
  89. $textfield-focused-input-underline-color: dynamic(null);
  90. /**
  91. * @var {color}
  92. * Text field input underline color when invalid
  93. */
  94. $textfield-invalid-input-underline-color: dynamic(null);
  95. /**
  96. * @var {color}
  97. * Text Field input background-color
  98. */
  99. $textfield-input-background-color: dynamic($background-color);
  100. /**
  101. * @var {color}
  102. * Text Field input background-color when focused
  103. */
  104. $textfield-focused-input-background-color: dynamic(null);
  105. /**
  106. * @var {color}
  107. * Text Field input background-color when invalid
  108. */
  109. $textfield-invalid-input-background-color: dynamic(null);
  110. /**
  111. * @var {color}
  112. * Text Field input background-color when disabled
  113. */
  114. $textfield-disabled-input-background-color: dynamic(null);
  115. /**
  116. * @var {number/list}
  117. * Text Field input padding
  118. */
  119. $textfield-input-padding: dynamic(3px 6px 2px);
  120. /**
  121. * @var {number/list}
  122. * Text Field input padding in the {@link Global_CSS#$enable-big big} sizing scheme
  123. */
  124. $textfield-input-padding-big: dynamic(5px 6px);
  125. /**
  126. * @var {string/number}
  127. * Text Field input font-weight
  128. */
  129. $textfield-input-font-weight: dynamic($font-weight-normal);
  130. /**
  131. * @var {number}
  132. * Text Field input font-size
  133. */
  134. $textfield-input-font-size: dynamic($font-size);
  135. /**
  136. * @var {number}
  137. * Text Field input font-size in the {@link Global_CSS#$enable-big big} sizing scheme
  138. */
  139. $textfield-input-font-size-big: dynamic($font-size-big);
  140. /**
  141. * @var {number}
  142. * Text Field input line-height
  143. */
  144. $textfield-input-line-height: dynamic(17px);
  145. /**
  146. * @var {number}
  147. * Text Field input line-height in the {@link Global_CSS#$enable-big big} sizing scheme
  148. */
  149. $textfield-input-line-height-big: dynamic(20px);
  150. /**
  151. * @var {string}
  152. * Text Field input font-family
  153. */
  154. $textfield-input-font-family: dynamic($font-family);
  155. /**
  156. * @var {color}
  157. * Text Field {@link #placeholder} color
  158. */
  159. $textfield-placeholder-color: dynamic($neutral-medium-dark-color);
  160. /**
  161. * @var {color}
  162. * Text Field {@link #placeholder} color when focused
  163. */
  164. $textfield-focused-placeholder-color: dynamic(null);
  165. /**
  166. * @var {color}
  167. * Text Field {@link #placeholder} color when invalid
  168. */
  169. $textfield-invalid-placeholder-color: dynamic(null);
  170. /**
  171. * @var {color}
  172. * Text Field {@link #placeholder} color when disabled
  173. */
  174. $textfield-disabled-placeholder-color: dynamic(null);
  175. /**
  176. * @var {number}
  177. * Text Field body width
  178. */
  179. $textfield-body-width: dynamic(170px);
  180. /**
  181. * @var {number}
  182. * Text Field body width in the {@link Global_CSS#$enable-big big} sizing scheme
  183. */
  184. $textfield-body-width-big: dynamic(200px);
  185. /**
  186. * @var {map}
  187. * Parameters for the "celleditor" textfield UI.
  188. * Set to `null` to eliminate the UI from the CSS output.
  189. */
  190. $textfield-celleditor-ui: dynamic((
  191. input-padding:
  192. top($gridcell-padding or 0) - top($textfield-input-border-width or 0)
  193. right($gridcell-padding or 0) - right($textfield-input-border-width or 0)
  194. bottom($gridcell-padding or 0) - bottom($textfield-input-border-width or 0)
  195. left($gridcell-padding or 0) - left($textfield-input-border-width or 0),
  196. input-padding-big:
  197. top($gridcell-padding-big or 0) - top($textfield-input-border-width or 0)
  198. right($gridcell-padding-big or 0) - right($textfield-input-border-width or 0)
  199. bottom($gridcell-padding-big or 0) - bottom($textfield-input-border-width or 0)
  200. left($gridcell-padding-big or 0) - left($textfield-input-border-width or 0),
  201. input-line-height: $gridcell-line-height,
  202. input-line-height-big: $gridcell-line-height-big,
  203. input-font-size: $gridcell-font-size,
  204. input-font-size-big: $gridcell-font-size-big
  205. ));
  206. /**
  207. * @var {number}
  208. * The duration for the focus {@link #animateUnderline underline animation}
  209. */
  210. $textfield-animate-underline-duration: dynamic(.45s);
  211. /**
  212. * @var {map}
  213. * Parameters for the "alt" textfield UI.
  214. * Set to `null` to eliminate the UI from the CSS output.
  215. */
  216. $textfield-alt-ui: dynamic((
  217. input-background-color: rgba(255, 255, 255, .2),
  218. focused-input-background-color: rgba(255, 255, 255, .15),
  219. input-color: rgba(255, 255, 255, .6),
  220. focused-input-color: rgba(255, 255, 255, .6),
  221. input-padding: 7px 7px 7px 0,
  222. input-padding-big: 7px 7px 7px 0,
  223. input-border-width: 0,
  224. placeholder-color: rgba(255, 255, 255, .6),
  225. focused-placeholder-color: rgb(255, 255, 255),
  226. border-radius: 3px
  227. ));
  228. /**
  229. * @var {map}
  230. * Parameters for the "faded" textfield UI.
  231. * Set to `null` to eliminate the UI from the CSS output.
  232. */
  233. $textfield-faded-ui: dynamic((
  234. input-background-color: rgba(0, 0, 0, .1),
  235. focused-input-background-color: rgba(0, 0, 0, .15),
  236. input-color: rgba(0, 0, 0, .4),
  237. focused-input-color: rgba(0, 0, 0, .4),
  238. input-padding: 7px 7px 7px 0,
  239. input-padding-big: 7px 7px 7px 0,
  240. input-border-width: 0,
  241. placeholder-color: rgba(0, 0, 0, .4),
  242. focused-placeholder-color: #333,
  243. border-radius: 3px
  244. ));
  245. /**
  246. * @var {map}
  247. * Parameters for the "solo" textfield UI.
  248. * Set to `null` to eliminate the UI from the CSS output.
  249. */
  250. $textfield-solo-ui: dynamic((
  251. input-background-color: #FFFFFF,
  252. input-color: rgba(0, 0, 0, .4),
  253. focused-input-color: rgba(0, 0, 0, .4),
  254. input-padding: 10px 10px 10px 0,
  255. input-padding-big: 10px 10px 10px 0,
  256. input-border-width: 0,
  257. placeholder-color: rgba(0, 0, 0, .4),
  258. border-radius: 3px
  259. ));
  260. /**
  261. * Creates a visual theme for a Text Field
  262. *
  263. * @param {string} $ui
  264. * The name of the UI being created. Can not included spaces or special punctuation
  265. * (used in CSS class names).
  266. *
  267. * @param {String} [$xtype=textfield] (protected) The {@link Ext.Class#xtype} to use
  268. * in CSS selectors. For use by UI mixins of derived classes.
  269. *
  270. * @param {color} $background-color
  271. * Text Field input background color
  272. *
  273. * @param {color} $focused-background-color
  274. * Focused Text Field background color
  275. *
  276. * @param {color} $invalid-background-color
  277. * Invalid Text Field background color
  278. *
  279. * @param {color} $disabled-background-color
  280. * Disabled Text Field background color
  281. *
  282. * @param {Number} $disabled-opacity
  283. * Text Field disabled opacity
  284. *
  285. * @param {Number} $required-indicator-font-weight
  286. * Required indicator font weight
  287. *
  288. * @param {Number} $required-indicator-font-size
  289. * Required indicator font size
  290. *
  291. * @param {Number} $required-indicator-line-height
  292. * Required indicator line height
  293. *
  294. * @param {String} $required-indicator-font-family
  295. * Required indicator font family
  296. *
  297. * @param {String} $required-indicator-margin
  298. * Required indicator margin
  299. *
  300. * @param {String} $required-indicator-margin-big
  301. * Required indicator margin in the {@link Global_CSS#$enable-big big} sizing scheme
  302. *
  303. * @param {color} $input-color
  304. * Text field input color
  305. *
  306. * @param {color} $focused-input-color
  307. * Text Field input color when focused
  308. *
  309. * @param {color} $invalid-input-color
  310. * Text Field input color when invalid
  311. *
  312. * @param {color} $disabled-input-color
  313. * Text Field input color when disabled
  314. *
  315. * @param {number/list} $input-border-width
  316. * Text Field input border width
  317. *
  318. * @param {string/list} $input-border-style
  319. * Text Field input border style
  320. *
  321. * @param {string/list} $focused-input-border-style
  322. * Text Field input border style when focused
  323. *
  324. * @param {string/list} $invalid-input-border-style
  325. * Text Field input border style when invalid
  326. *
  327. * @param {color/list} $input-border-color
  328. * Text Field input border color
  329. *
  330. * @param {string/list} $focused-input-border-color
  331. * Text Field input border color when focused
  332. *
  333. * @param {string/list} $invalid-input-border-color
  334. * Text Field input border color when invalid
  335. *
  336. * @param {string/list} $disabled-input-border-color
  337. * Text Field input border color when disabled
  338. *
  339. * @param {number} $input-underline-width
  340. * Text field input underline width
  341. *
  342. * @param {number} $focused-input-underline-width
  343. * Text field input underline width when focused
  344. *
  345. * @param {number} $invalid-input-underline-width
  346. * Text field input underline width when invalid
  347. *
  348. * @param {color} $input-underline-color
  349. * Text field input underline color
  350. *
  351. * @param {color} $focused-input-underline-color
  352. * Text field input underline color when focused
  353. *
  354. * @param {color} $invalid-input-underline-color
  355. * Text field input underline color when invalid
  356. *
  357. * @param {color} $input-background-color
  358. * Text Field input background-color
  359. *
  360. * @param {color} $focused-input-background-color
  361. * Text Field input background-color when focused
  362. *
  363. * @param {color} $invalid-input-background-color
  364. * Text Field input background-color when invalid
  365. *
  366. * @param {color} $disabled-input-background-color
  367. * Text Field input background-color when disabled
  368. *
  369. * @param {color} $input-padding
  370. * Text Field input padding
  371. *
  372. * @param {color} $input-padding-big
  373. * Text Field input padding in the {@link Global_CSS#$enable-big big} sizing scheme
  374. *
  375. * @param {string/number} $input-font-weight
  376. * Text Field input font-weight
  377. *
  378. * @param {number} $input-font-size
  379. * Text Field input font-size
  380. *
  381. * @param {number} $input-font-size-big
  382. * Text Field input font-size in the {@link Global_CSS#$enable-big big} sizing scheme
  383. *
  384. * @param {number} $input-line-height
  385. * Text Field input line-height
  386. *
  387. * @param {number} $input-line-height-big
  388. * Text Field input line-height in the {@link Global_CSS#$enable-big big} sizing scheme
  389. *
  390. * @param {string} $input-font-family
  391. * Text Field input font-family
  392. *
  393. * @param {color} $placeholder-color
  394. * Text Field {@link #placeholder} color
  395. *
  396. * @param {color} $focused-placeholder-color
  397. * Text Field {@link #placeholder} color when focused
  398. *
  399. * @param {color} $invalid-placeholder-color
  400. * Text Field {@link #placeholder} color when invalid
  401. *
  402. * @param {color} $disabled-placeholder-color
  403. * Text Field {@link #placeholder} color when disabled
  404. *
  405. * @param {number} $border-radius
  406. * The border radius of the text field
  407. *
  408. * @param {number} $body-width
  409. * Text Field body width
  410. *
  411. * @param {number} $body-width-big
  412. * Text Field body width in the {@link Global_CSS#$enable-big big} sizing scheme
  413. *
  414. * @param {number} $animate-underline-duration
  415. * The duration, in seconds, for the focus {@link #animateUnderline underline animation}
  416. */
  417. @mixin textfield-ui(
  418. $ui: null,
  419. $xtype: textfield,
  420. $background-color: null,
  421. $focused-background-color: null,
  422. $invalid-background-color: null,
  423. $disabled-background-color: null,
  424. $disabled-opacity: null,
  425. $required-indicator-font-weight: null,
  426. $required-indicator-font-size: null,
  427. $required-indicator-line-height: null,
  428. $required-indicator-font-family: null,
  429. $required-indicator-margin: null,
  430. $required-indicator-margin-big: null,
  431. $input-color: null,
  432. $focused-input-color: null,
  433. $invalid-input-color: null,
  434. $disabled-input-color: null,
  435. $input-border-width: null,
  436. $input-border-style: null,
  437. $focused-input-border-style: null,
  438. $invalid-input-border-style: null,
  439. $input-border-color: null,
  440. $focused-input-border-color: null,
  441. $invalid-input-border-color: null,
  442. $disabled-input-border-color: null,
  443. $input-underline-width: null,
  444. $focused-input-underline-width: null,
  445. $invalid-input-underline-width: null,
  446. $input-underline-color: null,
  447. $focused-input-underline-color: null,
  448. $invalid-input-underline-color: null,
  449. $input-background-color: null,
  450. $focused-input-background-color: null,
  451. $invalid-input-background-color: null,
  452. $disabled-input-background-color: null,
  453. $input-padding: null,
  454. $input-padding-big: null,
  455. $input-font-weight: null,
  456. $input-font-size: null,
  457. $input-font-size-big: null,
  458. $input-line-height: null,
  459. $input-line-height-big: null,
  460. $input-font-family: null,
  461. $placeholder-color: null,
  462. $focused-placeholder-color: null,
  463. $invalid-placeholder-color: null,
  464. $disabled-placeholder-color: null,
  465. $border-radius: null,
  466. $body-width: null,
  467. $body-width-big: null,
  468. $animate-underline-duration: null
  469. ) {
  470. $ui-suffix: ui-suffix($ui);
  471. .#{$prefix}#{$xtype}#{$ui-suffix} {
  472. background-color: $background-color;
  473. @include border-radius($border-radius);
  474. .#{$prefix}body-wrap-el {
  475. width: $body-width;
  476. @if $enable-big {
  477. .#{$prefix}big & {
  478. width: $body-width-big;
  479. }
  480. }
  481. }
  482. // keep the background-color, color and border rules at the x-input-wrap-el
  483. // level to make triggers visually inside the text field input.
  484. .#{$prefix}input-wrap-el {
  485. @include border($input-border-width, $input-border-style, $input-border-color);
  486. background-color: $input-background-color;
  487. color: $input-color;
  488. }
  489. .#{$prefix}input-el {
  490. @include font($input-font-weight, $input-font-size, $input-line-height, $input-font-family);
  491. @include padding($input-padding);
  492. // IE11 does not respect line-height on input elements. To workaround the issue
  493. // we use content-box model and set min-height in addition to line-height
  494. min-height: $input-line-height;
  495. @if $enable-big {
  496. .#{$prefix}big & {
  497. padding: $input-padding-big;
  498. font-size: $input-font-size-big;
  499. line-height: $input-line-height-big;
  500. }
  501. }
  502. // when using vendor prefixes, the selectors need to be separated into their own
  503. // rule for each prefix because when encountering an unsupported vendor prefix,
  504. // CSS parsing engines will consider the entire rule invalid.
  505. &::-webkit-input-placeholder {
  506. color: $placeholder-color;
  507. }
  508. &::-moz-placeholder {
  509. color: $placeholder-color;
  510. }
  511. &:-ms-input-placeholder {
  512. color: $placeholder-color;
  513. }
  514. }
  515. .#{$prefix}underline-el {
  516. height: $input-underline-width;
  517. background-color: $input-underline-color;
  518. }
  519. &.#{$prefix}animate-underline .#{$prefix}underline-el:before {
  520. transition: transform $animate-underline-duration cubic-bezier(0.23, 1, 0.32, 1);
  521. }
  522. &.#{$prefix}focused {
  523. background-color: $focused-background-color;
  524. .#{$prefix}underline-el:before {
  525. height: $focused-input-underline-width;
  526. background-color: $focused-input-underline-color;
  527. }
  528. .#{$prefix}input-wrap-el {
  529. border-style: $focused-input-border-style;
  530. border-color: $focused-input-border-color;
  531. background-color: $focused-input-background-color;
  532. color: $focused-input-color;
  533. }
  534. .#{$prefix}input-el {
  535. // when using vendor prefixes, the selectors need to be separated into their own
  536. // rule for each prefix because when encountering an unsupported vendor prefix,
  537. // CSS parsing engines will consider the entire rule invalid.
  538. &::-webkit-input-placeholder {
  539. color: $focused-placeholder-color;
  540. }
  541. &::-moz-placeholder {
  542. color: $focused-placeholder-color;
  543. }
  544. &:-ms-input-placeholder {
  545. color: $focused-placeholder-color;
  546. }
  547. }
  548. }
  549. &.#{$prefix}invalid {
  550. background-color: $invalid-background-color;
  551. .#{$prefix}underline-el:after {
  552. height: $invalid-input-underline-width;
  553. background-color: $invalid-input-underline-color;
  554. }
  555. .#{$prefix}input-wrap-el {
  556. border-style: $invalid-input-border-style;
  557. border-color: $invalid-input-border-color;
  558. background-color: $invalid-input-background-color;
  559. color: $invalid-input-color;
  560. }
  561. .#{$prefix}input-el {
  562. // when using vendor prefixes, the selectors need to be separated into their own
  563. // rule for each prefix because when encountering an unsupported vendor prefix,
  564. // CSS parsing engines will consider the entire rule invalid.
  565. &::-webkit-input-placeholder {
  566. color: $invalid-placeholder-color;
  567. }
  568. &::-moz-placeholder {
  569. color: $invalid-placeholder-color;
  570. }
  571. &:-ms-input-placeholder {
  572. color: $invalid-placeholder-color;
  573. }
  574. }
  575. }
  576. &.#{$prefix}disabled {
  577. background-color: $disabled-background-color;
  578. .#{$prefix}input-wrap-el {
  579. background-color: $disabled-input-background-color;
  580. border-color: $disabled-input-border-color;
  581. color: $disabled-input-color;
  582. }
  583. .#{$prefix}input-el {
  584. // when using vendor prefixes, the selectors need to be separated into their own
  585. // rule for each prefix because when encountering an unsupported vendor prefix,
  586. // CSS parsing engines will consider the entire rule invalid.
  587. &::-webkit-input-placeholder {
  588. color: $disabled-placeholder-color;
  589. }
  590. &::-moz-placeholder {
  591. color: $disabled-placeholder-color;
  592. }
  593. &:-ms-input-placeholder {
  594. color: $disabled-placeholder-color;
  595. }
  596. }
  597. }
  598. }
  599. }