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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  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. }
  220. }
  221. /**
  222. * Outputs the styles for a combobox variant input element.
  223. *
  224. * @param {size} $unit-size ($v-unit-size) - The sizing of the input (affects the padding only, width and height are 100%)
  225. * @param {size | list} $padding (null) - The padding of the input. Computed from other parameters by default.
  226. * @param {color} $font-color (null) - The font color of the input. Computed from the $background-color by default.
  227. * @param {number} $font-weight (null) - The font weight of the input. Inherited from the parent by default.
  228. * @param {size} $font-size (null) - The font size of the combobox. Inherited from the parent by default.
  229. * @param {color} $background-color ($v-textfield-background-color) - The background color of the input
  230. * @param {list} $border ($v-textfield-border) - The border of the input
  231. * @param {size} $border-radius ($v-textfield-border-radius) - The border-radius of the input
  232. * @param {list} $gradient (none) - Valo specific gradient value. See the documentation for $v-gradient.
  233. * @param {list} $bevel ($v-textfield-bevel) - Box-shadow value according to $v-bevel documentation
  234. * @param {list} $shadow ($v-textfield-shadow) - Box-shadow value according to $v-shadow documentation
  235. * @param {list} $states (normal focus disabled) - The combobox states for which to output corresponding styles
  236. *
  237. * @group combobox
  238. */
  239. @mixin valo-combobox-input-style (
  240. $unit-size: $v-unit-size,
  241. $padding: null,
  242. $font-color: null,
  243. $font-weight: null,
  244. $font-size: null,
  245. $background-color: $v-textfield-background-color,
  246. $border: $v-textfield-border,
  247. $border-radius: $v-textfield-border-radius,
  248. $gradient: none,
  249. $bevel: $v-bevel,
  250. $shadow: $v-shadow,
  251. $states: normal focus disabled
  252. ) {
  253. box-sizing: border-box;
  254. @include valo-textfield-style($unit-size: $unit-size,
  255. $padding: $padding,
  256. $font-color: $font-color,
  257. $font-weight: $font-weight,
  258. $font-size: $font-size,
  259. $background-color: $background-color,
  260. $border: $border,
  261. $border-radius: $border-radius,
  262. $gradient: $gradient,
  263. $bevel: $bevel,
  264. $shadow: $shadow,
  265. $states: $states);
  266. width: 100% !important; // Need to override calculated inline style which is sometimes added
  267. height: 100%;
  268. padding-right: round($unit-size * 1) + 1;
  269. border-radius: inherit;
  270. }
  271. /**
  272. * Outputs the styles for a combobox variant button element.
  273. *
  274. * @param {size} $unit-size ($v-unit-size) - The sizing of the button, which corresponds its width.
  275. * @param {list} $bevel ($v-textfield-bevel) - Box-shadow value according to $v-bevel documentation
  276. * @param {color} $background-color ($v-textfield-background-color) - The background color of the input, which affects the font color of the button
  277. * @param {size} $border-radius ($v-textfield-border-radius) - The border-radius of the input, which affects the border-radius of the button
  278. * @param {list} $border ($v-textfield-border) - The border of the input, which affects the border of the button
  279. *
  280. * @group combobox
  281. */
  282. @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) {
  283. $border-width: first-number($border) or 0;
  284. @include valo-tappable;
  285. position: absolute;
  286. width: $unit-size;
  287. @if $border and $border != none {
  288. top: $border-width;
  289. right: $border-width;
  290. bottom: $border-width;
  291. }
  292. @if type-of($background-color) == color {
  293. @if $border {
  294. border-left: valo-border($color: $background-color, $border: $v-textfield-border, $strength: 0.5);
  295. }
  296. color: mix($background-color, valo-font-color($background-color));
  297. }
  298. @if $v-border-radius > 0 {
  299. $br: $v-border-radius - $border-width;
  300. border-radius: 0 $br $br 0;
  301. }
  302. &:before {
  303. @include valo-combobox-button-icon-style;
  304. @if $v-animations-enabled {
  305. @include transition(color 140ms);
  306. }
  307. position: absolute;
  308. width: $unit-size;
  309. text-align: center;
  310. top: 50%;
  311. line-height: 1;
  312. margin-top: -.47em;
  313. }
  314. @if $v-hover-styles-enabled and type-of($background-color) == color {
  315. &:hover:before {
  316. color: valo-font-color($background-color);
  317. }
  318. }
  319. &:active:after {
  320. content: "";
  321. position: absolute;
  322. top: 0;
  323. right: 0;
  324. bottom: 0;
  325. left: 0;
  326. border-radius: inherit;
  327. @if type-of($background-color) == color {
  328. @include valo-button-active-style($background-color);
  329. }
  330. }
  331. }
  332. /**
  333. * Outputs the font icon styles for the combobox drop down button.
  334. *
  335. * @group combobox
  336. */
  337. @mixin valo-combobox-button-icon-style {
  338. font-family: ThemeIcons;
  339. content: "\f078";
  340. }
  341. /**
  342. * Outputs the styles for a combobox popup.
  343. *
  344. * @group combobox
  345. */
  346. @mixin valo-combobox-popup-style {
  347. @if $v-animations-enabled {
  348. @if $v-overlay-animate-in {
  349. &[class*="animate-in"] {
  350. @include animation($v-overlay-animate-in);
  351. }
  352. }
  353. // No animate-out since that will currently prevent the dropdown from
  354. // closing when the user selects an item
  355. }
  356. [class$="suggestmenu"] {
  357. @include valo-selection-overlay-style($animate-in: false, $animate-out: false);
  358. box-sizing: content-box;
  359. position: relative;
  360. z-index: 1;
  361. display: block;
  362. }
  363. margin-top: ceil($v-unit-size/8) !important;
  364. table, tbody, tr, td {
  365. display: block;
  366. width: 100%;
  367. overflow-y: hidden;
  368. // float & clear needs to be set so that IE 8 & 9 displays the elements as block
  369. float: left;
  370. clear: both;
  371. }
  372. .gwt-MenuItem {
  373. @include valo-selection-item-style;
  374. height: $v-selection-item-height;
  375. box-sizing: border-box;
  376. text-overflow: ellipsis;
  377. overflow-x: hidden;
  378. }
  379. .gwt-MenuItem-selected {
  380. @include valo-selection-item-selected-style;
  381. }
  382. [class$="status"] {
  383. position: absolute;
  384. right: $v-border-radius;
  385. $bg: scale-color($v-background-color, $lightness: -15%);
  386. background: transparentize($bg, .1);
  387. color: valo-font-color($bg);
  388. border-radius: 0 0 $v-border-radius $v-border-radius;
  389. height: ceil($v-unit-size*0.6);
  390. bottom: -(ceil($v-unit-size*0.6));
  391. font-size: ceil($v-font-size*0.73);
  392. line-height: ceil($v-unit-size*0.6);
  393. padding: 0 ceil($v-unit-size/7);
  394. cursor: default;
  395. pointer-events: none;
  396. @if $v-animations-enabled {
  397. @include animation(valo-animate-in-slide-down 200ms 80ms backwards);
  398. }
  399. > * {
  400. color: valo-font-color($bg);
  401. text-decoration: none;
  402. }
  403. }
  404. div[class*="page"] {
  405. position: absolute;
  406. z-index: 3;
  407. right: 0;
  408. @include opacity(.2);
  409. cursor: pointer;
  410. @include transition( all 200ms );
  411. width: ceil($v-unit-size/1.5);
  412. height: ceil($v-unit-size/1.5);
  413. line-height: ceil($v-unit-size/1.5);
  414. text-align: center;
  415. font-family: ThemeIcons;
  416. @include transform( scale(.8) );
  417. color: valo-font-color($v-background-color);
  418. &:after {
  419. // Extend click target when hovering over (popup width might change between pages)
  420. content: "";
  421. position: absolute;
  422. display: block;
  423. border-radius: 50%;
  424. }
  425. &:hover {
  426. @include opacity(1);
  427. background: rgba($v-background-color, .5);
  428. &:after {
  429. top: -10px;
  430. bottom: -10px;
  431. left: -20px;
  432. right: -20px;
  433. }
  434. }
  435. span {
  436. // Hide text
  437. display: none;
  438. }
  439. }
  440. &:hover div[class*="page"] {
  441. @include transform( scale(1) );
  442. }
  443. div[class*="prev"] {
  444. top: 0;
  445. @include transform-origin( 100% 0% );
  446. border-radius: 0 $v-border-radius 0 $v-border-radius;
  447. &:before {
  448. content: "\f0d8";
  449. }
  450. }
  451. div[class*="next"] {
  452. bottom: 0;
  453. @include transform-origin( 100% 100% );
  454. border-radius: $v-border-radius 0 $v-border-radius 0;
  455. &:before {
  456. content: "\f0d7";
  457. }
  458. }
  459. div[class*="-off"] {
  460. display: none;
  461. }
  462. }
  463. /**
  464. *
  465. *
  466. *
  467. * @group combobox
  468. */
  469. @mixin valo-combobox-no-input-style {
  470. cursor: pointer;
  471. text-shadow: valo-text-shadow();
  472. @if $v-border-radius != $v-textfield-border-radius {
  473. border-radius: $v-border-radius;
  474. }
  475. [class*="input"] {
  476. @include user-select(none);
  477. @include valo-gradient;
  478. cursor: inherit;
  479. @include box-shadow(valo-bevel-and-shadow($bevel: $v-bevel, $shadow: $v-shadow, $gradient: $v-gradient));
  480. @include valo-border-with-gradient($border: $v-border, $color: $v-background-color, $gradient: $v-gradient);
  481. text-shadow: inherit;
  482. text-overflow: ellipsis;
  483. border-radius: inherit;
  484. &:focus {
  485. @include valo-textfield-focus-style($bevel: $v-bevel, $shadow: $v-shadow, $gradient: $v-gradient, $background-color: $v-background-color);
  486. }
  487. }
  488. [class$="button"] {
  489. border-left: none !important;
  490. }
  491. &:hover [class$="button"]:before {
  492. color: inherit;
  493. }
  494. }