You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_combobox.scss 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  1. /**
  2. * Outputs the selectors and properties for the ComboBox component.
  3. *
  4. * @param {string} $primary-stylename (v-filterselect) - the primary style name for the selectors
  5. * @param {bool} $include-additional-styles - should the mixin output all the different style variations of the component
  6. *
  7. * @group combobox
  8. */
  9. @mixin valo-combobox ($primary-stylename: v-filterselect, $include-additional-styles: contains($v-included-additional-styles, combobox)) {
  10. .#{$primary-stylename} {
  11. position: relative;
  12. width: $v-default-field-width;
  13. @include valo-combobox-style;
  14. white-space: nowrap;
  15. .v-icon {
  16. position: absolute;
  17. pointer-events: none;
  18. }
  19. .v-icon.FontAwesome {
  20. margin-left: 0px;
  21. }
  22. }
  23. .#{$primary-stylename}-error {
  24. .#{$primary-stylename}-input {
  25. @include valo-textfield-error-style;
  26. }
  27. .#{$primary-stylename}-button {
  28. color: $v-error-indicator-color;
  29. border-color: $v-error-indicator-color;
  30. }
  31. }
  32. .#{$primary-stylename}-error-info {
  33. .#{$primary-stylename}-input {
  34. @include valo-textfield-error-level-info-style;
  35. }
  36. .#{$primary-stylename}-button {
  37. color: $v-error-indicator-level-info-color;
  38. border-color: $v-error-indicator-level-info-color;
  39. }
  40. }
  41. .#{$primary-stylename}-error-warning {
  42. .#{$primary-stylename}-input {
  43. @include valo-textfield-error-level-warning-style;
  44. }
  45. .#{$primary-stylename}-button {
  46. color: $v-error-indicator-level-warning-color;
  47. border-color: $v-error-indicator-level-warning-color;
  48. }
  49. }
  50. .#{$primary-stylename}-error-error {
  51. .#{$primary-stylename}-input {
  52. @include valo-textfield-error-level-error-style;
  53. }
  54. .#{$primary-stylename}-button {
  55. color: $v-error-indicator-level-error-color;
  56. border-color: $v-error-indicator-level-error-color;
  57. }
  58. }
  59. .#{$primary-stylename}-error-critical {
  60. .#{$primary-stylename}-input {
  61. @include valo-textfield-error-level-critical-style;
  62. }
  63. .#{$primary-stylename}-button {
  64. color: $v-error-indicator-level-critical-color;
  65. border-color: $v-error-indicator-level-critical-color;
  66. }
  67. }
  68. .#{$primary-stylename}-error-system {
  69. .#{$primary-stylename}-input {
  70. @include valo-textfield-error-level-system-style;
  71. }
  72. .#{$primary-stylename}-button {
  73. color: $v-error-indicator-level-system-color;
  74. border-color: $v-error-indicator-level-system-color;
  75. }
  76. }
  77. .#{$primary-stylename}-suggestpopup {
  78. @include valo-combobox-popup-style;
  79. }
  80. .#{$primary-stylename}-no-input {
  81. @include valo-combobox-no-input-style;
  82. }
  83. @if $include-additional-styles {
  84. .#{$primary-stylename}-borderless {
  85. .#{$primary-stylename}-input {
  86. @include valo-textfield-borderless-style;
  87. }
  88. .#{$primary-stylename}-button {
  89. border: none;
  90. color: inherit;
  91. @include opacity(.5);
  92. }
  93. &.#{$primary-stylename}-prompt .#{$primary-stylename}-input {
  94. @include valo-textfield-prompt-style(transparent);
  95. }
  96. }
  97. .#{$primary-stylename}-align-right input {
  98. text-align: right;
  99. }
  100. .#{$primary-stylename}-align-center input {
  101. text-align: center;
  102. }
  103. .#{$primary-stylename}-tiny {
  104. @include valo-combobox-style($unit-size: $v-unit-size--tiny, $bevel: null, $shadow: null, $gradient: null, $border: null, $border-radius: null, $background-color: null, $states: normal);
  105. font-size: $v-font-size--tiny;
  106. }
  107. .#{$primary-stylename}-compact,
  108. .#{$primary-stylename}-small {
  109. @include valo-combobox-style($unit-size: $v-unit-size--small, $bevel: null, $shadow: null, $gradient: null, $border: null, $border-radius: null, $background-color: null, $states: normal);
  110. }
  111. .#{$primary-stylename}-small {
  112. font-size: $v-font-size--small;
  113. }
  114. .#{$primary-stylename}-large {
  115. @include valo-combobox-style($unit-size: $v-unit-size--large, $bevel: null, $shadow: null, $gradient: null, $border: null, $border-radius: null, $background-color: null, $states: normal);
  116. font-size: $v-font-size--large;
  117. }
  118. .#{$primary-stylename}-huge {
  119. @include valo-combobox-style($unit-size: $v-unit-size--huge, $bevel: null, $shadow: null, $gradient: null, $border: null, $border-radius: null, $background-color: null, $states: normal);
  120. font-size: $v-font-size--huge;
  121. }
  122. }
  123. }
  124. /**
  125. * Outputs the styles for a combobox variant.
  126. *
  127. * @param {size} $unit-size ($v-unit-size) - The sizing of the combobox, which corresponds its height
  128. * @param {color} $font-color (null) - The font color of the combobox. Computed from the $background-color by default.
  129. * @param {number} $font-weight (max(400, $v-font-weight)) - The font weight of the combobox
  130. * @param {size} $font-size (null) - The font size of the combobox. Inherited from the parent by default.
  131. * @param {color} $background-color ($v-textfield-background-color) - The background color of the combobox
  132. * @param {list} $border ($v-textfield-border) - The border of the combobox
  133. * @param {size} $border-radius ($v-textfield-border-radius) - The border-radius of the combobox
  134. * @param {list} $gradient (none) - Valo specific gradient value. See the documentation for $v-gradient.
  135. * @param {list} $bevel ($v-textfield-bevel) - Box-shadow value according to $v-bevel documentation
  136. * @param {list} $shadow ($v-textfield-shadow) - Box-shadow value according to $v-shadow documentation
  137. * @param {list} $states (normal focus disabled) - The combobox states for which to output corresponding styles
  138. *
  139. * @group combobox
  140. */
  141. @mixin valo-combobox-style (
  142. $unit-size: $v-unit-size,
  143. $font-color: null,
  144. $font-weight: max(400, $v-font-weight),
  145. $font-size: null,
  146. $background-color: $v-textfield-background-color,
  147. $border: $v-textfield-border,
  148. $border-radius: $v-textfield-border-radius,
  149. $gradient: none,
  150. $bevel: $v-textfield-bevel,
  151. $shadow: $v-textfield-shadow,
  152. $states: normal focus disabled
  153. ) {
  154. height: $unit-size;
  155. border-radius: $border-radius;
  156. [class*="input"] {
  157. @include valo-combobox-input-style(
  158. $unit-size: $unit-size,
  159. $gradient: $gradient,
  160. $bevel: $bevel,
  161. $shadow: $shadow,
  162. $border: $border,
  163. $border-radius: $border-radius,
  164. $background-color: $background-color,
  165. $font-color: $font-color,
  166. $font-size: $font-size,
  167. $font-weight: $font-weight,
  168. $states: $states);
  169. }
  170. .v-icon + [class*="input"] {
  171. padding-left: $unit-size;
  172. }
  173. img.v-icon {
  174. $padding-width: ceil($unit-size/6);
  175. max-height: $unit-size;
  176. @if $border-radius {
  177. $padding-width: $padding-width + ceil($border-radius/3);
  178. }
  179. margin-left: $padding-width;
  180. }
  181. span.v-icon {
  182. color: valo-font-color($background-color);
  183. width: $unit-size;
  184. line-height: 1;
  185. padding-top: .12em;
  186. $padding-width: ceil($unit-size/6);
  187. @if $border-radius {
  188. $padding-width: $padding-width + ceil($border-radius/3);
  189. }
  190. margin-left: $padding-width;
  191. }
  192. &[class*="prompt"] > [class*="input"] {
  193. @include valo-textfield-prompt-style($background-color);
  194. }
  195. [class$="button"] {
  196. @include valo-combobox-button-style($unit-size: $unit-size, $bevel: $bevel, $background-color: $background-color, $border-radius: $border-radius, $border: $border);
  197. }
  198. &.v-disabled {
  199. @include opacity($v-textfield-disabled-opacity);
  200. & [class$="button"] {
  201. cursor: default;
  202. pointer-events: none;
  203. &:active:after {
  204. display: none;
  205. }
  206. }
  207. }
  208. &.v-readonly {
  209. [class*="input"] {
  210. @include valo-textfield-readonly-style;
  211. }
  212. [class$="button"] {
  213. cursor: default;
  214. pointer-events: none;
  215. &:active:after {
  216. display: none;
  217. }
  218. }
  219. &.borderless {
  220. [class*="input"] {
  221. @include valo-textfield-borderless-style;
  222. }
  223. }
  224. }
  225. }
  226. /**
  227. * Outputs the styles for a combobox variant input element.
  228. *
  229. * @param {size} $unit-size ($v-unit-size) - The sizing of the input (affects the padding only, width and height are 100%)
  230. * @param {size | list} $padding (null) - The padding of the input. Computed from other parameters by default.
  231. * @param {color} $font-color (null) - The font color of the input. Computed from the $background-color by default.
  232. * @param {number} $font-weight (null) - The font weight of the input. Inherited from the parent by default.
  233. * @param {size} $font-size (null) - The font size of the combobox. Inherited from the parent by default.
  234. * @param {color} $background-color ($v-textfield-background-color) - The background color of the input
  235. * @param {list} $border ($v-textfield-border) - The border of the input
  236. * @param {size} $border-radius ($v-textfield-border-radius) - The border-radius of the input
  237. * @param {list} $gradient (none) - Valo specific gradient value. See the documentation for $v-gradient.
  238. * @param {list} $bevel ($v-textfield-bevel) - Box-shadow value according to $v-bevel documentation
  239. * @param {list} $shadow ($v-textfield-shadow) - Box-shadow value according to $v-shadow documentation
  240. * @param {list} $states (normal focus disabled) - The combobox states for which to output corresponding styles
  241. *
  242. * @group combobox
  243. */
  244. @mixin valo-combobox-input-style (
  245. $unit-size: $v-unit-size,
  246. $padding: null,
  247. $font-color: null,
  248. $font-weight: null,
  249. $font-size: null,
  250. $background-color: $v-textfield-background-color,
  251. $border: $v-textfield-border,
  252. $border-radius: $v-textfield-border-radius,
  253. $gradient: none,
  254. $bevel: $v-bevel,
  255. $shadow: $v-shadow,
  256. $states: normal focus disabled
  257. ) {
  258. box-sizing: border-box;
  259. @include valo-textfield-style($unit-size: $unit-size,
  260. $padding: $padding,
  261. $font-color: $font-color,
  262. $font-weight: $font-weight,
  263. $font-size: $font-size,
  264. $background-color: $background-color,
  265. $border: $border,
  266. $border-radius: $border-radius,
  267. $gradient: $gradient,
  268. $bevel: $bevel,
  269. $shadow: $shadow,
  270. $states: $states);
  271. width: 100% !important; // Need to override calculated inline style which is sometimes added
  272. height: 100%;
  273. padding-right: round($unit-size * 1) + 1;
  274. border-radius: inherit;
  275. }
  276. /**
  277. * Outputs the styles for a combobox variant button element.
  278. *
  279. * @param {size} $unit-size ($v-unit-size) - The sizing of the button, which corresponds its width.
  280. * @param {list} $bevel ($v-textfield-bevel) - Box-shadow value according to $v-bevel documentation
  281. * @param {color} $background-color ($v-textfield-background-color) - The background color of the input, which affects the font color of the button
  282. * @param {size} $border-radius ($v-textfield-border-radius) - The border-radius of the input, which affects the border-radius of the button
  283. * @param {list} $border ($v-textfield-border) - The border of the input, which affects the border of the button
  284. *
  285. * @group combobox
  286. */
  287. @mixin valo-combobox-button-style ($unit-size: $v-unit-size, $bevel: $v-bevel, $background-color: $v-textfield-background-color, $border-radius: $v-border-radius, $border: $v-textfield-border) {
  288. $border-width: first-number($border) or 0;
  289. @include valo-tappable;
  290. position: absolute;
  291. width: $unit-size;
  292. @if $border and $border != none {
  293. top: $border-width;
  294. right: $border-width;
  295. bottom: $border-width;
  296. }
  297. @if type-of($background-color) == color {
  298. @if $border {
  299. border-left: valo-border($color: $background-color, $border: $v-textfield-border, $strength: 0.5);
  300. }
  301. color: mix($background-color, valo-font-color($background-color));
  302. }
  303. @if $v-border-radius > 0 {
  304. $br: $v-border-radius - $border-width;
  305. border-radius: 0 $br $br 0;
  306. }
  307. &:before {
  308. @include valo-combobox-button-icon-style;
  309. @if $v-animations-enabled {
  310. @include transition(color 140ms);
  311. }
  312. position: absolute;
  313. width: $unit-size;
  314. text-align: center;
  315. top: 50%;
  316. line-height: 1;
  317. margin-top: -.47em;
  318. }
  319. @if $v-hover-styles-enabled and type-of($background-color) == color {
  320. &:hover:before {
  321. color: valo-font-color($background-color);
  322. }
  323. }
  324. &:active:after {
  325. content: "";
  326. position: absolute;
  327. top: 0;
  328. right: 0;
  329. bottom: 0;
  330. left: 0;
  331. border-radius: inherit;
  332. @if type-of($background-color) == color {
  333. @include valo-button-active-style($background-color);
  334. }
  335. }
  336. }
  337. /**
  338. * Outputs the font icon styles for the combobox drop down button.
  339. *
  340. * @group combobox
  341. */
  342. @mixin valo-combobox-button-icon-style {
  343. font-family: ThemeIcons;
  344. content: "\f078";
  345. }
  346. /**
  347. * Outputs the styles for a combobox popup.
  348. *
  349. * @group combobox
  350. */
  351. @mixin valo-combobox-popup-style {
  352. @if $v-animations-enabled {
  353. @if $v-overlay-animate-in {
  354. &[class*="animate-in"] {
  355. @include animation($v-overlay-animate-in);
  356. }
  357. }
  358. // No animate-out since that will currently prevent the dropdown from
  359. // closing when the user selects an item
  360. }
  361. [class$="suggestmenu"] {
  362. @include valo-selection-overlay-style($animate-in: false, $animate-out: false);
  363. box-sizing: content-box;
  364. position: relative;
  365. z-index: 1;
  366. display: block;
  367. }
  368. margin-top: ceil($v-unit-size/8) !important;
  369. table, tbody, tr, td {
  370. display: block;
  371. width: 100%;
  372. overflow-y: hidden;
  373. // float & clear needs to be set so that IE 8 & 9 displays the elements as block
  374. float: left;
  375. clear: both;
  376. }
  377. .gwt-MenuItem {
  378. @include valo-selection-item-style;
  379. height: $v-selection-item-height;
  380. box-sizing: border-box;
  381. text-overflow: ellipsis;
  382. overflow-x: hidden;
  383. }
  384. .gwt-MenuItem-selected {
  385. @include valo-selection-item-selected-style;
  386. }
  387. [class$="status"] {
  388. position: absolute;
  389. right: $v-border-radius;
  390. $bg: scale-color($v-background-color, $lightness: -15%);
  391. background: transparentize($bg, .1);
  392. color: valo-font-color($bg);
  393. border-radius: 0 0 $v-border-radius $v-border-radius;
  394. height: ceil($v-unit-size*0.6);
  395. bottom: -(ceil($v-unit-size*0.6));
  396. font-size: ceil($v-font-size*0.73);
  397. line-height: ceil($v-unit-size*0.6);
  398. padding: 0 ceil($v-unit-size/7);
  399. cursor: default;
  400. pointer-events: none;
  401. @if $v-animations-enabled {
  402. @include animation(valo-animate-in-slide-down 200ms 80ms backwards);
  403. }
  404. > * {
  405. color: valo-font-color($bg);
  406. text-decoration: none;
  407. }
  408. }
  409. div[class*="page"] {
  410. position: absolute;
  411. z-index: 3;
  412. right: 0;
  413. @include opacity(.2);
  414. cursor: pointer;
  415. @include transition( all 200ms );
  416. width: ceil($v-unit-size/1.5);
  417. height: ceil($v-unit-size/1.5);
  418. line-height: ceil($v-unit-size/1.5);
  419. text-align: center;
  420. font-family: ThemeIcons;
  421. @include transform( scale(.8) );
  422. color: valo-font-color($v-background-color);
  423. &:after {
  424. // Extend click target when hovering over (popup width might change between pages)
  425. content: "";
  426. position: absolute;
  427. display: block;
  428. border-radius: 50%;
  429. }
  430. &:hover {
  431. @include opacity(1);
  432. background: rgba($v-background-color, .5);
  433. &:after {
  434. top: -10px;
  435. bottom: -10px;
  436. left: -20px;
  437. right: -20px;
  438. }
  439. }
  440. span {
  441. // Hide text
  442. display: none;
  443. }
  444. }
  445. &:hover div[class*="page"] {
  446. @include transform( scale(1) );
  447. }
  448. div[class*="prev"] {
  449. top: 0;
  450. @include transform-origin( 100% 0% );
  451. border-radius: 0 $v-border-radius 0 $v-border-radius;
  452. &:before {
  453. content: "\f0d8";
  454. }
  455. }
  456. div[class*="next"] {
  457. bottom: 0;
  458. @include transform-origin( 100% 100% );
  459. border-radius: $v-border-radius 0 $v-border-radius 0;
  460. &:before {
  461. content: "\f0d7";
  462. }
  463. }
  464. div[class*="-off"] {
  465. display: none;
  466. }
  467. }
  468. /**
  469. *
  470. *
  471. *
  472. * @group combobox
  473. */
  474. @mixin valo-combobox-no-input-style {
  475. cursor: pointer;
  476. text-shadow: valo-text-shadow();
  477. @if $v-border-radius != $v-textfield-border-radius {
  478. border-radius: $v-border-radius;
  479. }
  480. [class*="input"] {
  481. @include user-select(none);
  482. @include valo-gradient;
  483. cursor: inherit;
  484. @include box-shadow(valo-bevel-and-shadow($bevel: $v-bevel, $shadow: $v-shadow, $gradient: $v-gradient));
  485. @include valo-border-with-gradient($border: $v-border, $color: $v-background-color, $gradient: $v-gradient);
  486. text-shadow: inherit;
  487. text-overflow: ellipsis;
  488. border-radius: inherit;
  489. &:focus {
  490. @include valo-textfield-focus-style($bevel: $v-bevel, $shadow: $v-shadow, $gradient: $v-gradient, $background-color: $v-background-color);
  491. }
  492. }
  493. [class$="button"] {
  494. border-left: none !important;
  495. }
  496. &:hover [class$="button"]:before {
  497. color: inherit;
  498. }
  499. }