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.

_menubar.scss 8.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. /**
  2. *
  3. *
  4. * @param {string} $primary-stylename (v-menubar) -
  5. * @param {bool} $include-additional-styles -
  6. *
  7. * @group menubar
  8. */
  9. @mixin valo-menubar ($primary-stylename: v-menubar, $include-additional-styles: contains($v-included-additional-styles, menubar)) {
  10. .#{$primary-stylename} {
  11. @include valo-button-static-style($states: normal focus disabled, $vertical-centering: false);
  12. @include valo-menubar-style;
  13. }
  14. .#{$primary-stylename}:active:after {
  15. background: transparent;
  16. }
  17. .#{$primary-stylename} > .#{$primary-stylename}-menuitem {
  18. @include valo-menubar-menuitem-style;
  19. }
  20. .#{$primary-stylename} > .#{$primary-stylename}-menuitem-checked {
  21. @include valo-menubar-menuitem-checked-style;
  22. }
  23. .v-disabled > .#{$primary-stylename}-menuitem,
  24. .#{$primary-stylename} > .#{$primary-stylename}-menuitem-disabled {
  25. cursor: default;
  26. &:before {
  27. display: none;
  28. }
  29. }
  30. .#{$primary-stylename}-menuitem-disabled {
  31. @include opacity($v-disabled-opacity);
  32. }
  33. .#{$primary-stylename} > .#{$primary-stylename}-menuitem-selected {
  34. @include valo-button-style($states: normal, $background-color: $v-selection-color, $border-radius: 0, $shadow: null, $unit-size: null, $font-weight: null);
  35. border-top-width: 0;
  36. border-left-width: 0;
  37. border-bottom-width: 0;
  38. z-index: 2;
  39. &:hover:before {
  40. background: none;
  41. }
  42. }
  43. .#{$primary-stylename} .#{$primary-stylename}-submenu-indicator {
  44. display: none;
  45. + .#{$primary-stylename}-menuitem-caption:after {
  46. font-family: ThemeIcons;
  47. content: "\f078";
  48. font-size: 0.7em;
  49. vertical-align: .15em;
  50. margin: 0 -.2em 0 .5em;
  51. // IE filters are not supported on pseudo elements
  52. opacity: .5;
  53. }
  54. + .#{$primary-stylename}-menuitem-caption:empty:after {
  55. margin-left: -.2em;
  56. }
  57. }
  58. .#{$primary-stylename}-popup {
  59. @include valo-menubar-popup-style($primary-stylename);
  60. }
  61. @if $include-additional-styles {
  62. .#{$primary-stylename}-small {
  63. @include valo-menubar-style($background-color: null, $unit-size: $v-unit-size--small);
  64. font-size: $v-font-size--small;
  65. }
  66. .#{$primary-stylename}-borderless {
  67. @include valo-menubar-borderless-style;
  68. }
  69. }
  70. }
  71. /**
  72. *
  73. *
  74. * @param {string} $primary-stylename (v-menubar) -
  75. * @param {color} $background-color ($v-background-color) -
  76. * @param {size} $unit-size ($v-unit-size) -
  77. *
  78. * @group menubar
  79. */
  80. @mixin valo-menubar-style ($primary-stylename: v-menubar, $background-color: $v-background-color, $unit-size: $v-unit-size) {
  81. @include valo-button-style($states: normal focus, $cursor: default, $background-color: $background-color, $unit-size: $unit-size);
  82. padding: 0;
  83. text-align: left;
  84. @if $unit-size {
  85. line-height: $unit-size - first-number($v-border) * 2;
  86. > .#{$primary-stylename}-menuitem {
  87. padding: 0 round($unit-size/2.6);
  88. &[class*="-icon-only"] {
  89. width: $unit-size;
  90. }
  91. }
  92. }
  93. }
  94. /**
  95. *
  96. *
  97. *
  98. * @group menubar
  99. */
  100. @mixin valo-menubar-menuitem-style {
  101. $border-width: first-number($v-border);
  102. position: relative;
  103. z-index: 1;
  104. display: inline-block;
  105. @include box-sizing(border-box);
  106. @include valo-button-style($states: normal, $border-radius: 0, $shadow: null, $font-color: inherit, $cursor: pointer);
  107. background: transparent;
  108. @include box-shadow(none);
  109. border-width: 0 $border-width 0 0;
  110. border-color: inherit;
  111. height: 100%;
  112. line-height: inherit;
  113. vertical-align: top;
  114. text-align: center;
  115. @if $border-width == 0 {
  116. margin-right: 1px;
  117. }
  118. $br: max(0, $v-border-radius - $border-width);
  119. &:first-child {
  120. border-left-width: 0;
  121. @if $v-border-radius > 0 {
  122. border-radius: $br 0 0 $br;
  123. }
  124. }
  125. &:last-child {
  126. @if $v-border-radius > 0 {
  127. border-radius: 0 $br $br 0;
  128. }
  129. border-right-width: 0;
  130. }
  131. &:first-child:last-child {
  132. @if $v-border-radius > 0 {
  133. border-radius: $br;
  134. }
  135. }
  136. &:before {
  137. content: "";
  138. position: absolute;
  139. top: 0;
  140. right: 0;
  141. bottom: 0;
  142. left: 0;
  143. border-radius: inherit;
  144. }
  145. @if $v-hover-styles-enabled {
  146. &:hover {
  147. // IE needs some nudging to show the :before element
  148. zoom: 1;
  149. &:before {
  150. @include valo-button-hover-style;
  151. border: none;
  152. }
  153. }
  154. }
  155. &:active:before {
  156. @include valo-button-active-style;
  157. }
  158. $margin-width: ceil($v-unit-size/2.4/5);
  159. .v-icon {
  160. margin: 0 $margin-width 0 #{-$margin-width};
  161. cursor: inherit;
  162. }
  163. &[class*="-icon-only"] {
  164. width: $v-unit-size;
  165. padding: 0;
  166. .v-icon {
  167. margin: 0;
  168. }
  169. }
  170. }
  171. /**
  172. *
  173. *
  174. * @param {string} $primary-stylename (v-menubar) -
  175. *
  176. * @group menubar
  177. */
  178. @mixin valo-menubar-popup-style ($primary-stylename: v-menubar) {
  179. @include valo-selection-overlay-style;
  180. margin: ceil($v-unit-size/8) 0 0 1px !important;
  181. .#{$primary-stylename}-submenu {
  182. outline: none;
  183. }
  184. .#{$primary-stylename}-menuitem {
  185. display: block;
  186. @include valo-selection-item-style;
  187. padding-left: $v-selection-item-height + round($v-selection-item-padding-horizontal/2); // Make room for checkable icon
  188. padding-right: $v-unit-size;
  189. position: relative;
  190. }
  191. .#{$primary-stylename}-submenu-indicator {
  192. display: none;
  193. + .#{$primary-stylename}-menuitem-caption:after {
  194. position: absolute;
  195. right: $v-selection-item-padding-horizontal;
  196. @include valo-menubar-submenu-indicator-style;
  197. }
  198. }
  199. .#{$primary-stylename}-menuitem-selected {
  200. @include valo-selection-item-selected-style;
  201. }
  202. .#{$primary-stylename}-separator {
  203. display: block;
  204. margin: $v-selection-overlay-padding-vertical 0;
  205. height: 0;
  206. overflow: hidden;
  207. border-bottom: valo-border($color: $v-overlay-background-color, $strength: 0.5);
  208. @if first-number($v-border) == 0 {
  209. border-bottom-width: 1px;
  210. }
  211. }
  212. [class*="checked"] .#{$primary-stylename}-menuitem-caption:before {
  213. @include valo-menubar-checked-icon-style;
  214. position: absolute;
  215. left: $v-selection-item-padding-horizontal;
  216. }
  217. [class*="unchecked"] .#{$primary-stylename}-menuitem-caption:before {
  218. content: "";
  219. }
  220. [class*="disabled"] {
  221. cursor: default;
  222. }
  223. }
  224. /**
  225. *
  226. *
  227. *
  228. * @group menubar
  229. */
  230. @mixin valo-menubar-submenu-indicator-style {
  231. font-family: ThemeIcons;
  232. content: "\f054";
  233. line-height: $v-selection-item-height + 2px;
  234. }
  235. /**
  236. *
  237. *
  238. *
  239. * @group menubar
  240. */
  241. @mixin valo-menubar-checked-icon-style {
  242. content: "\f00c";
  243. font-family: ThemeIcons;
  244. }
  245. /**
  246. *
  247. *
  248. * @param {list} $background-color -
  249. *
  250. * @group menubar
  251. */
  252. @mixin valo-menubar-menuitem-checked-style ($background-color: if(color-luminance($v-background-color) < 10, scale-color($v-background-color, $lightness: 10%, $saturation: -5%), scale-color($v-background-color, $lightness: -5%, $saturation: -5%))) {
  253. $grad: valo-gradient-style($v-gradient) valo-gradient-opacity($v-gradient)/4;
  254. @include box-shadow(none);
  255. @include valo-gradient($color: $background-color, $gradient: $grad, $direction: to top);
  256. color: valo-font-color($background-color, 0.9);
  257. }
  258. /**
  259. *
  260. *
  261. * @param {string} $primary-stylename (v-menubar) -
  262. *
  263. * @group menubar
  264. */
  265. @mixin valo-menubar-menuitem-checked ($background-color, $primary-stylename: v-menubar) {
  266. .#{$primary-stylename}-menuitem-checked {
  267. @include valo-menubar-menuitem-checked-style($background-color: $background-color);
  268. }
  269. }
  270. /**
  271. *
  272. *
  273. * @param {string} $primary-stylename (v-menubar) -
  274. *
  275. * @group menubar
  276. */
  277. @mixin valo-menubar-borderless-style ($primary-stylename: v-menubar) {
  278. border: none;
  279. border-radius: 0;
  280. padding: first-number($v-border);
  281. @include box-shadow(none);
  282. text-shadow: none;
  283. background: transparent;
  284. color: inherit;
  285. &:focus:after {
  286. display: none;
  287. }
  288. .#{$primary-stylename}-menuitem {
  289. @include box-shadow(none);
  290. border: none;
  291. margin-right: max(1px, first-number($v-border));
  292. border-radius: $v-border-radius;
  293. color: $v-selection-color;
  294. padding: 0 round($v-unit-size/3);
  295. @if $v-animations-enabled {
  296. @include transition(color 140ms);
  297. }
  298. &:first-child,
  299. &:last-child,
  300. &:first-child:last-child {
  301. border-radius: $v-border-radius;
  302. }
  303. &:before {
  304. content: none;
  305. }
  306. &:hover {
  307. color: lighten($v-selection-color, 10%);
  308. }
  309. &:active {
  310. color: inherit;
  311. }
  312. }
  313. .#{$primary-stylename}-menuitem-checked,
  314. .#{$primary-stylename}-menuitem-checked:first-child {
  315. border: valo-border();
  316. color: $v-selection-color;
  317. .#{$primary-stylename}-menuitem-caption {
  318. position: relative;
  319. top: first-number($v-border)*-1;
  320. }
  321. }
  322. .#{$primary-stylename}-menuitem-selected {
  323. $font-color: valo-font-color($v-selection-color, 0.9);
  324. color: $font-color;
  325. text-shadow: valo-text-shadow($background-color: $v-selection-color, $font-color: $font-color);
  326. &:hover {
  327. color: $font-color;
  328. }
  329. }
  330. .#{$primary-stylename}-menuitem-disabled,
  331. .#{$primary-stylename}-menuitem-disabled:hover {
  332. color: inherit;
  333. }
  334. }