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

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