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.

_tabsheet.scss 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. /**
  2. * Should the tabsheet content changes be animated.
  3. *
  4. * @group tabsheet
  5. */
  6. $v-tabsheet-content-animation-enabled: $v-animations-enabled !default;
  7. /**
  8. * Outputs the global selectors and properties for the TabSheet component - styles which are
  9. * considered mandatory for the component to work properly.
  10. *
  11. * @param {string} $primary-stylename (v-tabsheet) - the primary style name for the selectors
  12. *
  13. * @group tabsheet
  14. */
  15. @mixin valo-tabsheet-global ($primary-stylename: v-tabsheet) {
  16. .#{$primary-stylename}-hidetabs > .#{$primary-stylename}-tabcontainer,
  17. .#{$primary-stylename}-spacertd,
  18. .v-disabled .#{$primary-stylename}-scroller,
  19. .#{$primary-stylename} .v-disabled .#{$primary-stylename}-caption-close {
  20. display: none;
  21. }
  22. .#{$primary-stylename} {
  23. overflow: visible !important;
  24. position: relative;
  25. }
  26. .#{$primary-stylename}-tabcontainer {
  27. table,
  28. tbody,
  29. tr {
  30. display: inline-block;
  31. border-spacing: 0;
  32. border-collapse: collapse;
  33. vertical-align: top;
  34. }
  35. td {
  36. display: inline-block;
  37. padding: 0;
  38. }
  39. }
  40. .#{$primary-stylename}-tabs {
  41. white-space: nowrap;
  42. @include box-sizing(border-box);
  43. }
  44. .#{$primary-stylename}-content {
  45. position: relative;
  46. > div > .v-scrollable {
  47. @include valo-panel-adjust-content-margins;
  48. }
  49. }
  50. }
  51. /**
  52. * Outputs the selectors and properties for the TabSheet component.
  53. *
  54. * @param {string} $primary-stylename (v-tabsheet) - the primary style name for the selectors
  55. * @param {bool} $include-additional-styles - should the mixin output all the different style variations of the component
  56. *
  57. * @group tabsheet
  58. */
  59. @mixin valo-tabsheet ($primary-stylename: v-tabsheet, $include-additional-styles: contains($v-included-additional-styles, tabsheet)) {
  60. .#{$primary-stylename} {
  61. &:not(.v-has-width) {
  62. width: auto !important;
  63. }
  64. }
  65. .#{$primary-stylename}-spacertd {
  66. display: none !important;
  67. }
  68. .#{$primary-stylename}-tabcontainer {
  69. @include valo-tabsheet-tabcontainer-style($primary-stylename);
  70. }
  71. .#{$primary-stylename}-tabitemcell {
  72. @include valo-tabsheet-tabitemcell-style($primary-stylename);
  73. }
  74. .#{$primary-stylename}-scroller {
  75. @include valo-tabsheet-scroller-style($primary-stylename);
  76. }
  77. @if $v-tabsheet-content-animation-enabled {
  78. .#{$primary-stylename}-tabsheetpanel > .v-scrollable > .v-widget {
  79. @include valo-animate-in-fade(300ms);
  80. }
  81. $spinner-size: round($v-unit-size/2);
  82. $spinner-size: $spinner-size + $spinner-size % 2;
  83. .#{$primary-stylename}-deco {
  84. @include valo-spinner($size: $spinner-size);
  85. display: none;
  86. position: absolute;
  87. z-index: 1;
  88. bottom: 50%;
  89. margin-bottom: round($v-unit-size/-2) - $spinner-size/2;
  90. left: 50%;
  91. margin-left: $spinner-size/-2;
  92. }
  93. .#{$primary-stylename}-loading .#{$primary-stylename}-deco {
  94. display: block;
  95. }
  96. }
  97. @if $include-additional-styles {
  98. .#{$primary-stylename}-equal-width-tabs {
  99. @include valo-tabsheet-equal-width-tabs-style($flex: false);
  100. }
  101. .#{$primary-stylename}-framed {
  102. @include valo-tabsheet-framed-style;
  103. }
  104. .#{$primary-stylename}-centered-tabs {
  105. @include valo-tabsheet-align-tabs-style($align: center);
  106. }
  107. .#{$primary-stylename}-right-aligned-tabs {
  108. @include valo-tabsheet-align-tabs-style($align: right);
  109. }
  110. .#{$primary-stylename}-padded-tabbar {
  111. @include valo-tabsheet-padded-tabbar-style;
  112. }
  113. .#{$primary-stylename}-icons-on-top {
  114. @include valo-tabsheet-icons-on-top-style;
  115. }
  116. .#{$primary-stylename}-compact-tabbar {
  117. > .#{$primary-stylename}-tabcontainer-compact-tabbar .v-caption {
  118. line-height: 1.8;
  119. }
  120. }
  121. .#{$primary-stylename}-only-selected-closable {
  122. @include valo-tabsheet-only-selected-closable-style;
  123. }
  124. }
  125. }
  126. /**
  127. * Outputs the styles for the tabcontainer element of a tabsheet.
  128. *
  129. * @group tabsheet
  130. */
  131. @mixin valo-tabsheet-tabcontainer-style ($primary-stylename: v-tabsheet) {
  132. position: relative;
  133. @include box-sizing(border-box);
  134. &:before {
  135. content: "";
  136. position: absolute;
  137. height: 0;
  138. // iOS panics with background color, creating black line artifacts
  139. border-top: max(1px, first-number($v-border)) solid first-color(valo-border($color: $v-app-background-color, $strength: 0.5));
  140. bottom: 0;
  141. left: 0;
  142. right: 0;
  143. }
  144. .#{$primary-stylename}-tabs {
  145. position: relative;
  146. }
  147. }
  148. /**
  149. * Outputs the styles for the tabitemcell element of a tabsheet.
  150. *
  151. * @group tabsheet
  152. */
  153. @mixin valo-tabsheet-tabitemcell-style ($primary-stylename: v-tabsheet) {
  154. vertical-align: bottom;
  155. .#{$primary-stylename}-tabitem {
  156. line-height: 0;
  157. overflow: hidden;
  158. }
  159. .v-caption {
  160. margin-left: round($v-unit-size/2);
  161. padding: 0 round($v-unit-size/10);
  162. @include box-sizing(border-box);
  163. cursor: pointer;
  164. text-align: center;
  165. line-height: $v-unit-size;
  166. font-size: round($v-font-size * 0.95);
  167. font-weight: $v-font-weight;
  168. color: valo-font-color($v-app-background-color, 0.58);
  169. width: auto !important;
  170. overflow: hidden;
  171. text-overflow: ellipsis;
  172. border-bottom: max(1px, first-number($v-border))*2 solid transparent;
  173. position: relative;
  174. @if $v-animations-enabled {
  175. @include transition(border-bottom 200ms, color 200ms);
  176. }
  177. .v-captiontext {
  178. display: inline;
  179. }
  180. .v-icon + .v-captiontext {
  181. margin-left: round($v-unit-size/4);
  182. }
  183. &:hover {
  184. color: $v-selection-color;
  185. }
  186. &.v-disabled {
  187. @include opacity($v-disabled-opacity);
  188. cursor: default;
  189. color: inherit !important;
  190. }
  191. }
  192. &:first-child .v-caption,
  193. &[aria-hidden="true"] + td .v-caption {
  194. margin-left: 0;
  195. }
  196. &:focus {
  197. outline: none;
  198. .v-caption {
  199. color: $v-selection-color;
  200. }
  201. }
  202. .#{$primary-stylename}-tabitem-selected .v-caption.v-caption {
  203. border-bottom-color: $v-selection-color;
  204. color: $v-selection-color;
  205. }
  206. .v-caption-closable {
  207. padding-right: round($v-unit-size/10) + round($v-font-size * 1.1);
  208. }
  209. &.icons-on-top .v-caption-closable {
  210. padding-right: round($v-unit-size/10);
  211. }
  212. .#{$primary-stylename}-caption-close {
  213. position: absolute;
  214. right: 0;
  215. top: 50%;
  216. margin: round($v-font-size / -2) 0 0;
  217. font-size: round($v-font-size * 1.1);
  218. line-height: round($v-font-size * 1.1);
  219. width: round($v-font-size * 1.1);
  220. text-align: center;
  221. border-radius: round($v-border-radius/2);
  222. color: valo-font-color($v-app-background-color, 0.4);
  223. &:hover {
  224. background: rgba(#000, .03);
  225. color: $v-selection-color;
  226. }
  227. &:active {
  228. background: $v-selection-color;
  229. color: valo-font-color($v-selection-color);
  230. }
  231. }
  232. }
  233. /**
  234. * Outputs the styles for the tab scroller element of a tabsheet.
  235. *
  236. * @group tabsheet
  237. */
  238. @mixin valo-tabsheet-scroller-style ($primary-stylename: v-tabsheet) {
  239. $border-color: first-color(valo-border($strength: 0.5));
  240. position: absolute;
  241. top: 0;
  242. right: 0;
  243. bottom: 0;
  244. padding-left: round($v-unit-size/2);
  245. @include linear-gradient(to left, $v-background-color 70%, rgba($v-background-color, 0) 100%, $fallback: transparent);
  246. pointer-events: none;
  247. &:after {
  248. content: "";
  249. height: first-number($v-border);
  250. position: absolute;
  251. bottom: 0;
  252. left: 0;
  253. right: 0;
  254. display: block;
  255. @include linear-gradient(to left, $border-color 70%, rgba($border-color, 0) 100%, $fallback: transparent);
  256. }
  257. .v-ie8 &,
  258. .v-ie9 & {
  259. background-color: $v-background-color;
  260. &:after {
  261. background-color: $border-color;
  262. }
  263. }
  264. button {
  265. @include appearance(none);
  266. border: none;
  267. background: transparent;
  268. font: inherit;
  269. color: inherit;
  270. height: 100%;
  271. margin: 0;
  272. padding: 0 round($v-unit-size/4);
  273. outline: none;
  274. cursor: pointer;
  275. pointer-events: auto;
  276. @include opacity(.5);
  277. &:hover {
  278. @include opacity(1);
  279. color: $v-selection-color;
  280. }
  281. &:active {
  282. @include opacity(.7);
  283. color: $v-selection-color;
  284. }
  285. &::-moz-focus-inner {
  286. padding: 0;
  287. border: 0
  288. }
  289. }
  290. [class*="Next"] {
  291. padding-left: round($v-unit-size/8);
  292. &:before {
  293. @include valo-tabsheet-scroller-next-icon-style;
  294. }
  295. }
  296. [class*="Prev"] {
  297. padding-right: round($v-unit-size/8);
  298. &:before {
  299. @include valo-tabsheet-scroller-prev-icon-style;
  300. }
  301. }
  302. [class*="disabled"] {
  303. cursor: default;
  304. color: inherit !important;
  305. @include opacity(.1, true);
  306. }
  307. }
  308. /**
  309. * Outputs the font icon styles for the previous button element of a tabsheet scroller.
  310. *
  311. * @group tabsheet
  312. */
  313. @mixin valo-tabsheet-scroller-prev-icon-style {
  314. font-family: ThemeIcons;
  315. content: "\f053";
  316. }
  317. /**
  318. * Outputs the font icon styles for the next button element of a tabsheet scroller.
  319. *
  320. * @group tabsheet
  321. */
  322. @mixin valo-tabsheet-scroller-next-icon-style {
  323. font-family: ThemeIcons;
  324. content: "\f054";
  325. }
  326. /**
  327. * Outputs the styles for the framed tabsheet style.
  328. *
  329. * @param {string} $primary-stylename (v-tabsheet) - The primary style name for the selectors
  330. * @param {bool} $frame-inactive-tabs (true) - Should inactive tabs be framed as well (the active tab is always framed with this style)
  331. * @param {bool} $outer-frame (true) - Should the frame contain the whole tabsheet (i.e. tabbar and tab content). If false, works like a "borderless" style.
  332. * @param {size} $tab-spacing ($v-unit-size/10) - The spacing between tabs
  333. *
  334. * @group tabsheet
  335. */
  336. @mixin valo-tabsheet-framed-style ($primary-stylename: v-tabsheet, $frame-inactive-tabs: true, $outer-frame: true, $tab-spacing: round($v-unit-size/10)) {
  337. > .#{$primary-stylename}-tabcontainer {
  338. .v-caption {
  339. margin-left: $tab-spacing or first-number($v-border) * -1;
  340. padding: 0 $v-layout-spacing-horizontal;
  341. background-color: $v-app-background-color;
  342. border: first-number($v-border) solid transparent;
  343. line-height: $v-unit-size - first-number($v-border);
  344. border-radius: $v-border-radius $v-border-radius 0 0;
  345. font-weight: $v-font-weight + 100;
  346. @if $v-animations-enabled {
  347. @include transition(background-color 160ms);
  348. }
  349. &:hover {
  350. background-color: darken($v-app-background-color, 3%);
  351. border-bottom-color: first-color(valo-border($color: $v-app-background-color, $strength: 0.5));
  352. }
  353. &.v-disabled:hover {
  354. background-color: $v-app-background-color;
  355. }
  356. }
  357. .v-caption-closable {
  358. padding-right: $v-layout-spacing-horizontal + round($v-font-size * 1.1);
  359. }
  360. .#{$primary-stylename}-caption-close {
  361. top: round($v-font-size/4);
  362. right: round($v-font-size/4);
  363. margin-top: 0;
  364. }
  365. td:first-child .v-caption,
  366. [aria-hidden="true"] + td .v-caption {
  367. margin-left: 0;
  368. }
  369. @if $frame-inactive-tabs {
  370. .#{$primary-stylename}-tabitem .v-caption {
  371. border-color: first-color(valo-border($color: $v-app-background-color, $strength: 0.5));
  372. }
  373. }
  374. .#{$primary-stylename}-tabitem-selected .v-caption {
  375. background: $v-panel-background-color;
  376. border-color: first-color(valo-border($color: $v-app-background-color, $strength: 0.5));
  377. border-bottom: none;
  378. padding-bottom: first-number($v-border);
  379. }
  380. }
  381. > .#{$primary-stylename}-content {
  382. // iOS panics with black line artifacts,
  383. // moving the background color to an inner element fixes it
  384. > div {
  385. background: $v-panel-background-color;
  386. }
  387. @if $outer-frame {
  388. border: valo-border($color: $v-app-background-color, $strength: 0.5);
  389. border-top: none;
  390. }
  391. }
  392. &.padded-tabbar {
  393. > .#{$primary-stylename}-tabcontainer {
  394. @if $outer-frame {
  395. border: valo-border($color: $v-app-background-color, $strength: 0.5);
  396. border-bottom: none;
  397. }
  398. background: $v-background-color;
  399. padding-top: round($v-unit-size/6);
  400. }
  401. }
  402. &.icons-on-top {
  403. > .#{$primary-stylename}-tabcontainer .#{$primary-stylename}-tabitem-selected .v-caption {
  404. padding-bottom: round($v-unit-size/6) + first-number($v-border);
  405. }
  406. }
  407. }
  408. /**
  409. * Outputs the styles for a tabsheet where the tabs are aligned to the position specified by the parameter in the tabbar.
  410. *
  411. * @param {string} $primary-stylename (v-tabsheet) - The primary style name for the selectors
  412. * @param {string} $align (center) - The alignment of the tabs inside the tabbar. Possible values: left, right, center.
  413. *
  414. * @group tabsheet
  415. */
  416. @mixin valo-tabsheet-align-tabs-style ($primary-stylename: v-tabsheet, $align: center) {
  417. > .#{$primary-stylename}-tabcontainer {
  418. text-align: $align;
  419. }
  420. }
  421. /**
  422. * Outputs the styles for a tabsheet where all tabs in the tabbar have equal width and span the entire width of the tabbar.
  423. *
  424. * @param {string} $primary-stylename (v-tabsheet) - The primary style name for the selectors
  425. * @param {bool} $flex (false) - Should the size of the tabs be proportional to their content, i.e. should the available space in the tabbar be distributed to the tabs in relation to their content sizes.
  426. *
  427. * @group tabsheet
  428. */
  429. @mixin valo-tabsheet-equal-width-tabs-style ($primary-stylename: v-tabsheet, $flex: false) {
  430. > .#{$primary-stylename}-tabcontainer {
  431. table,
  432. tbody,
  433. tr {
  434. width: 100%;
  435. }
  436. tr {
  437. display: table;
  438. @if $flex == false {
  439. table-layout: fixed;
  440. }
  441. }
  442. td {
  443. display: table-cell;
  444. }
  445. .v-caption {
  446. margin: 0;
  447. display: block;
  448. }
  449. }
  450. }
  451. /**
  452. * Outputs the styles for a tabsheet where the icons of individual tabs are on top of the tab captions.
  453. *
  454. * @param {string} $primary-stylename (v-tabsheet) - The primary style name for the selectors
  455. *
  456. * @group tabsheet
  457. */
  458. @mixin valo-tabsheet-icons-on-top-style ($primary-stylename: v-tabsheet) {
  459. > .#{$primary-stylename}-tabcontainer {
  460. .v-caption {
  461. padding-top: round($v-unit-size/6);
  462. padding-bottom: round($v-unit-size/6);
  463. line-height: 1.2;
  464. }
  465. .v-icon {
  466. display: block;
  467. + .v-captiontext.v-captiontext {
  468. margin-left: 0;
  469. }
  470. }
  471. .v-caption-closable {
  472. padding-right: $v-layout-spacing-horizontal;
  473. }
  474. .#{$primary-stylename}-caption-close {
  475. top: round($v-font-size/4);
  476. margin-top: 0;
  477. }
  478. }
  479. }
  480. /**
  481. * Outputs the styles for a tabsheet where only the selected tab has the close button visible.
  482. * Note that the other tabs can still be closed programmatically.
  483. *
  484. * @param {string} $primary-stylename (v-tabsheet) - The primary style name for the selectors
  485. *
  486. * @group tabsheet
  487. */
  488. @mixin valo-tabsheet-only-selected-closable-style ($primary-stylename: v-tabsheet) {
  489. > .#{$primary-stylename}-tabcontainer .#{$primary-stylename}-caption-close {
  490. visibility: hidden;
  491. }
  492. > .#{$primary-stylename}-tabcontainer .#{$primary-stylename}-tabitem-selected .#{$primary-stylename}-caption-close {
  493. visibility: visible;
  494. }
  495. }
  496. /**
  497. * Outputs the styles for a tabsheet where the tabbar has increased padding to separate the tabs
  498. * inside it from their surrounding container.
  499. *
  500. * @param {string} $primary-stylename (v-tabsheet) - The primary style name for the selectors
  501. *
  502. * @group tabsheet
  503. */
  504. @mixin valo-tabsheet-padded-tabbar-style ($primary-stylename: v-tabsheet) {
  505. > .#{$primary-stylename}-tabcontainer .#{$primary-stylename}-tabs {
  506. padding: 0 round($v-unit-size/4);
  507. }
  508. }