media-library.pcss.css

Same filename in other branches
  1. 9 core/themes/claro/css/theme/media-library.pcss.css
  2. 10 core/themes/claro/css/theme/media-library.pcss.css
  3. 11.x core/themes/claro/css/theme/media-library.pcss.css

media-library.pcss.css

Styling for Media Library.

File

core/themes/claro/css/theme/media-library.pcss.css

View source
  1. /**
  2. * @file media-library.pcss.css
  3. * Styling for Media Library.
  4. */
  5. .media-library-wrapper {
  6. display: flex;
  7. margin: -1em;
  8. }
  9. /**
  10. * @todo Reuse or build on vertical tabs styling for the media library menu.
  11. * https://www.drupal.org/project/drupal/issues/3023767
  12. */
  13. .media-library-menu {
  14. display: block;
  15. width: 600px;
  16. max-width: 20%;
  17. margin: 0; /* LTR */
  18. padding: 0;
  19. border-bottom: 1px solid #ccc;
  20. background-color: #e6e5e1;
  21. line-height: 1;
  22. }
  23. [dir="rtl"] .media-library-menu {
  24. margin: 0;
  25. }
  26. /**
  27. * @todo Use a class instead of the li element.
  28. * https://www.drupal.org/project/drupal/issues/3029227
  29. */
  30. .media-library-menu li {
  31. display: block;
  32. padding: 0;
  33. list-style: none;
  34. }
  35. .media-library-menu__link {
  36. position: relative;
  37. display: block;
  38. box-sizing: border-box;
  39. padding: 15px;
  40. text-decoration: none;
  41. border-bottom: 1px solid #b3b2ad;
  42. background-color: #f2f2f0;
  43. text-shadow: 0 1px hsla(0, 0%, 100%, 0.6);
  44. }
  45. .media-library-menu__link:active,
  46. .media-library-menu__link:hover,
  47. .media-library-menu__link:focus {
  48. background: #fcfcfa;
  49. text-shadow: none;
  50. }
  51. .media-library-menu__link:focus,
  52. .media-library-menu__link:active {
  53. outline: none;
  54. }
  55. .media-library-menu__link.active {
  56. z-index: 1;
  57. margin-right: -1px; /* LTR */
  58. color: #000;
  59. border-right: 1px solid #fcfcfa; /* LTR */
  60. border-bottom: 1px solid #b3b2ad;
  61. background-color: #fff;
  62. box-shadow: 0 5px 5px -5px hsla(0, 0%, 0%, 0.3);
  63. }
  64. [dir="rtl"] .media-library-menu__link.active {
  65. margin-right: 0;
  66. margin-left: -1px;
  67. border-right: 0;
  68. border-left: 1px solid #fcfcfa;
  69. }
  70. .media-library-content {
  71. width: 100%;
  72. padding: 1em;
  73. border-left: 1px solid #b3b2ad; /* LTR */
  74. outline: none;
  75. }
  76. [dir="rtl"] .media-library-content {
  77. border-right: 1px solid #b3b2ad;
  78. border-left: 0;
  79. }
  80. /* Generic media add form styles. */
  81. .media-library-add-form--without-input .form-item {
  82. margin: 0 0 1em;
  83. }
  84. /**
  85. * Remove outline from added media list.
  86. *
  87. * The added media list receives focus after adding new media, but since it is
  88. * not an interactive element, it does not need an outline.
  89. */
  90. .media-library-add-form__added-media {
  91. margin: 0;
  92. padding: 0;
  93. outline: none;
  94. }
  95. .media-library-add-form__input-wrapper {
  96. padding: 16px;
  97. border: 1px solid #bfbfbf;
  98. border-radius: 2px;
  99. background: #fcfcfa;
  100. }
  101. /* Style the media add upload form. */
  102. .media-library-add-form--upload.media-library-add-form--without-input .form-item-upload {
  103. margin-bottom: 0;
  104. }
  105. .media-library-add-form .file-upload-help {
  106. margin: 8px 0 0;
  107. }
  108. /* Style the media add oEmbed form. */
  109. .media-library-add-form--oembed .media-library-add-form__input-wrapper {
  110. display: flex;
  111. }
  112. @media screen and (max-width: 37.5em) {
  113. .media-library-add-form--oembed .media-library-add-form__input-wrapper {
  114. display: block;
  115. }
  116. }
  117. .media-library-add-form--oembed.media-library-add-form--without-input .form-item-url {
  118. margin-bottom: 0;
  119. }
  120. .media-library-add-form-oembed-url {
  121. width: 100%;
  122. }
  123. /**
  124. * @todo Remove .button when styles are moved to the seven theme in
  125. * https://www.drupal.org/project/drupal/issues/2980769
  126. */
  127. .button.media-library-add-form-oembed-submit {
  128. align-self: center;
  129. }
  130. /* Media add form selection styles. */
  131. .media-library-add-form__selected-media {
  132. margin-top: 1em;
  133. }
  134. /* Change to padding to account for the negative margin for flex grid. */
  135. .media-library-add-form__selected-media .details-wrapper {
  136. padding: 0 10px 1em 10px;
  137. }
  138. .media-library-add-form__selected-media .media-library-item .field--name-thumbnail img {
  139. height: 100px;
  140. }
  141. /* Generic media library view styles. */
  142. .media-library-select-all {
  143. flex-basis: 100%;
  144. width: 100%;
  145. margin: 10px 8px;
  146. }
  147. .media-library-select-all input {
  148. margin-right: 10px;
  149. }
  150. [dir="rtl"] .media-library-select-all input {
  151. margin-left: 10px;
  152. }
  153. .media-library-views-form,
  154. .media-library-selection,
  155. .media-library-add-form__selected-media .details-wrapper,
  156. .media-library-views-form__bulk_form,
  157. .media-library-view .form--inline {
  158. display: flex;
  159. flex-wrap: wrap;
  160. }
  161. .media-library-views-form > .form-actions {
  162. flex-basis: 100%;
  163. }
  164. .media-library-views-form__header {
  165. flex-basis: 100%;
  166. }
  167. .media-library-views-form__header .form-item {
  168. margin-right: 8px; /* @TODO RTL? */
  169. }
  170. .media-library-views-form__rows {
  171. display: flex;
  172. flex-wrap: wrap;
  173. flex-basis: 100%;
  174. margin: 0 -8px;
  175. }
  176. /**
  177. * Override the table display of the visually hidden labels.
  178. *
  179. * The width, height and overflow properties in the styles for the
  180. * .visually-hidden class do not work correctly if the element has a table
  181. * display.
  182. */
  183. .media-library-item label {
  184. display: inline-block;
  185. }
  186. /* Media library widget view styles. */
  187. .media-library-wrapper .media-library-view {
  188. position: relative;
  189. display: flex;
  190. flex-wrap: wrap;
  191. justify-content: space-between;
  192. }
  193. .media-library-wrapper .view-header {
  194. align-self: flex-end;
  195. margin: 1em 0;
  196. text-align: right; /* LTR */
  197. }
  198. [dir="rtl"] .media-library-wrapper .view-header {
  199. text-align: left;
  200. }
  201. .media-library-wrapper .media-library-view .view-filters,
  202. .media-library-wrapper .media-library-view .view-content {
  203. flex: 0 0 100%;
  204. }
  205. .media-library-wrapper .views-display-link {
  206. margin: 0;
  207. padding-left: 22px; /* LTR */
  208. color: #333;
  209. font-size: 15px;
  210. line-height: 16px;
  211. }
  212. [dir="rtl"] .media-library-wrapper .views-display-link {
  213. padding-right: 22px;
  214. padding-left: 0;
  215. }
  216. .media-library-wrapper .views-display-link.is-active {
  217. font-weight: bold;
  218. }
  219. .media-library-wrapper .views-display-link-widget {
  220. margin-right: 15px;
  221. background: url(../../../../misc/icons/333333/grid.svg) left 0 no-repeat; /* LTR */
  222. }
  223. [dir="rtl"] .media-library-wrapper .views-display-link-widget {
  224. background-position: right 0;
  225. }
  226. .media-library-wrapper .views-display-link-widget_table {
  227. background: url(../../../../misc/icons/333333/table.svg) left 0 no-repeat; /* LTR */
  228. }
  229. [dir="rtl"] .media-library-wrapper .views-display-link-widget_table {
  230. background-position: right 0;
  231. }
  232. /**
  233. * Style the media library grid items.
  234. */
  235. .media-library-item {
  236. position: relative;
  237. }
  238. /**
  239. * The media library item container receives screen reader focus when items are
  240. * removed. Since it is not an interactive element, it does not need an
  241. * outline.
  242. */
  243. .media-library-item--grid {
  244. justify-content: center;
  245. box-sizing: border-box;
  246. width: 50%;
  247. padding: 8px;
  248. vertical-align: top;
  249. outline: none;
  250. background: #fff;
  251. }
  252. .media-library-item--grid:before {
  253. position: absolute;
  254. top: 7px;
  255. left: 7px;
  256. width: calc(100% - 16px);
  257. height: calc(100% - 16px);
  258. content: "";
  259. transition: border-color 0.2s, color 0.2s, background 0.2s;
  260. pointer-events: none;
  261. border: 1px solid #dbdbdb;
  262. }
  263. /* Media library widget weight field styles. */
  264. .media-library-item--grid .form-item {
  265. margin: 0.75em;
  266. }
  267. /* The selected items in the add form should be shown a bit smaller. */
  268. .media-library-add-form__selected-media .media-library-item--small {
  269. width: 33.3%;
  270. }
  271. .media-library-widget-modal .ui-dialog-buttonpane {
  272. display: flex;
  273. align-items: center;
  274. }
  275. .media-library-widget-modal .ui-dialog-buttonpane .form-actions {
  276. flex: 1;
  277. }
  278. /**
  279. * By default, the dialog is too narrow to be usable.
  280. * @see Drupal.ckeditor.openDialog()
  281. */
  282. .ui-dialog--narrow.media-library-widget-modal {
  283. max-width: 75%;
  284. }
  285. @media screen and (min-width: 45em) {
  286. .media-library-item--grid {
  287. width: 33.3%;
  288. }
  289. /* Change the width for the modal and widget since there is less space. */
  290. .media-library-widget-modal .media-library-item--grid,
  291. .media-library-selection .media-library-item--grid {
  292. width: 50%;
  293. }
  294. /* The selected items in the add form should be shown a bit smaller. */
  295. .media-library-add-form__selected-media .media-library-item--small {
  296. width: 25%;
  297. }
  298. }
  299. @media screen and (min-width: 60em) {
  300. .media-library-item--grid {
  301. width: 25%;
  302. }
  303. /* Change the width for the modal and widget since there is less space. */
  304. .media-library-widget-modal .media-library-item--grid,
  305. .media-library-selection .media-library-item--grid {
  306. width: 33.3%;
  307. }
  308. /* The selected items in the add form should be shown a bit smaller. */
  309. .media-library-add-form__selected-media .media-library-item--small {
  310. width: 16.6%;
  311. }
  312. }
  313. @media screen and (min-width: 77em) {
  314. .media-library-item--grid {
  315. width: 16.6%;
  316. }
  317. /* Change the width for the modal and widget since there is less space. */
  318. .media-library-widget-modal .media-library-item--grid,
  319. .media-library-selection .media-library-item--grid {
  320. width: 25%;
  321. }
  322. /* The selected items in the add form should be shown a bit smaller. */
  323. .media-library-add-form__selected-media .media-library-item--small {
  324. width: 16.6%;
  325. }
  326. }
  327. .media-library-item--grid .field--name-thumbnail {
  328. overflow: hidden;
  329. text-align: center;
  330. background-color: #ebebeb;
  331. }
  332. .media-library-item--grid .field--name-thumbnail img {
  333. height: 180px;
  334. object-fit: contain;
  335. object-position: center center;
  336. }
  337. .media-library-item--grid.is-hover:before,
  338. .media-library-item--grid.checked:before,
  339. .media-library-item--grid.is-focus:before {
  340. top: 5px;
  341. left: 5px;
  342. border-width: 3px;
  343. border-color: #40b6ff;
  344. border-radius: 3px;
  345. }
  346. .media-library-item--grid.checked:before {
  347. border-color: #0076c0;
  348. }
  349. .media-library-item__click-to-select-checkbox {
  350. position: absolute;
  351. z-index: 1;
  352. top: 16px;
  353. left: 16px; /* LTR */
  354. display: block;
  355. }
  356. [dir="rtl"] .media-library-item__click-to-select-checkbox {
  357. right: 16px;
  358. left: auto;
  359. }
  360. .media-library-item__click-to-select-checkbox input {
  361. width: 20px;
  362. height: 20px;
  363. }
  364. .media-library-item__click-to-select-checkbox .form-item {
  365. margin: 0;
  366. }
  367. .media-library-item__click-to-select-trigger {
  368. overflow: hidden;
  369. height: 100%;
  370. cursor: pointer;
  371. }
  372. /* Media library item table styles. */
  373. .media-library-item--table img {
  374. max-width: 100px;
  375. height: auto;
  376. }
  377. /* Media library entity view display styles. */
  378. .media-library-item__preview {
  379. padding-bottom: 34px;
  380. cursor: move;
  381. }
  382. .media-library-item__status {
  383. position: absolute;
  384. top: 40px;
  385. left: 5px; /* LTR */
  386. padding: 5px 10px;
  387. pointer-events: none;
  388. color: #e4e4e4;
  389. background: #666;
  390. font-size: 12px;
  391. font-style: italic;
  392. }
  393. [dir="rtl"] .media-library-item__status {
  394. right: 5px;
  395. left: auto;
  396. }
  397. .media-library-item__attributes {
  398. position: absolute;
  399. bottom: 0;
  400. display: block;
  401. overflow: hidden;
  402. max-width: calc(100% - 10px);
  403. max-height: calc(100% - 50px);
  404. padding: 5px;
  405. background: white;
  406. }
  407. .media-library-item__name {
  408. font-size: 14px;
  409. }
  410. .media-library-item__name {
  411. display: block;
  412. overflow: hidden;
  413. margin: 2px;
  414. white-space: nowrap;
  415. text-overflow: ellipsis;
  416. }
  417. .media-library-item__attributes:hover .media-library-item__name,
  418. .media-library-item--grid.is-focus .media-library-item__name,
  419. .media-library-item--grid.checked .media-library-item__name {
  420. white-space: normal;
  421. }
  422. .media-library-item__type {
  423. color: #696969;
  424. font-size: 12px;
  425. }
  426. .media-library-item--disabled {
  427. pointer-events: none;
  428. opacity: 0.5;
  429. }
  430. /* Media library widget styles. */
  431. .media-library-widget {
  432. position: relative;
  433. }
  434. /**
  435. * @todo Change to .media-library-open-button when styles are moved to the
  436. * seven theme in https://www.drupal.org/project/drupal/issues/2980769
  437. */
  438. .button.media-library-open-button {
  439. margin-bottom: 1em;
  440. margin-left: 0; /* LTR */
  441. }
  442. [dir="rtl"] .button.media-library-open-button {
  443. margin-right: 0;
  444. margin-left: 1em;
  445. }
  446. .media-library-widget__toggle-weight {
  447. position: absolute;
  448. top: 5px;
  449. right: 5px; /* LTR */
  450. }
  451. [dir="rtl"] .media-library-widget__toggle-weight {
  452. right: auto;
  453. left: 5px;
  454. }
  455. /* Add negative margin for flex grid. */
  456. .media-library-selection {
  457. margin: 1em -8px;
  458. }
  459. /**
  460. * Media library widget edit and delete button styles.
  461. *
  462. * We have to override the .button styles since buttons make heavy use of
  463. * background and border property changes.
  464. */
  465. .media-library-item__edit,
  466. .media-library-item__edit:hover,
  467. .media-library-item__edit:focus,
  468. .media-library-item__remove,
  469. .media-library-item__remove:hover,
  470. .media-library-item__remove:focus,
  471. .media-library-item__remove.button,
  472. .media-library-item__remove.button:first-child,
  473. .media-library-item__remove.button:disabled,
  474. .media-library-item__remove.button:disabled:active,
  475. .media-library-item__remove.button:hover,
  476. .media-library-item__remove.button:focus {
  477. position: absolute;
  478. z-index: 1;
  479. top: 10px;
  480. overflow: hidden;
  481. width: 21px;
  482. height: 21px;
  483. margin: 5px;
  484. padding: 0;
  485. transition: 0.2s border-color;
  486. color: transparent;
  487. border: 2px solid #ccc;
  488. border-radius: 20px;
  489. background-size: 13px;
  490. text-shadow: none;
  491. font-size: 0;
  492. }
  493. .media-library-item__edit {
  494. right: 40px; /* LTR */
  495. }
  496. [dir="rtl"] .media-library-item__edit {
  497. right: auto;
  498. left: 40px;
  499. }
  500. .media-library-item__remove {
  501. right: 10px; /* LTR */
  502. }
  503. [dir="rtl"] .media-library-item__remove {
  504. right: auto;
  505. left: 10px;
  506. }
  507. .media-library-item__edit {
  508. background: url("../../../../misc/icons/787878/pencil.svg") #fff center no-repeat;
  509. background-size: 13px;
  510. }
  511. .media-library-item__remove,
  512. .media-library-item__remove.button,
  513. .media-library-item__remove.button:first-child,
  514. .media-library-item__remove.button:disabled,
  515. .media-library-item__remove.button:disabled:active,
  516. .media-library-item__remove.button:hover,
  517. .media-library-item__remove.button:focus {
  518. background: url("../../../../misc/icons/787878/ex.svg") #fff center no-repeat;
  519. background-size: 13px;
  520. }
  521. .media-library-item__edit:hover,
  522. .media-library-item__edit:focus,
  523. .media-library-item__remove:hover,
  524. .media-library-item__remove:focus,
  525. .media-library-item__remove.button:hover,
  526. .media-library-item__remove.button:focus,
  527. .media-library-item__remove.button:disabled:active {
  528. border-color: #40b6ff;
  529. }
  530. /**
  531. * Style the added media item container.
  532. *
  533. * The added media container receives screen reader focus since it has the role
  534. * 'listitem'. Since it is not an interactive element, it does not need an
  535. * outline.
  536. */
  537. .media-library-add-form__media {
  538. position: relative;
  539. display: flex;
  540. padding: 1em 0;
  541. border-bottom: 1px solid #c0c0c0;
  542. outline: none;
  543. }
  544. /* Do not show the top padding for the first item. */
  545. .media-library-add-form__media:first-child {
  546. padding-top: 0;
  547. }
  548. /**
  549. * Change the position of the remove button for the first item.
  550. *
  551. * The first item doesn't have a top padding, change the location of the remove
  552. * button as well.
  553. */
  554. .media-library-add-form__media:first-child .media-library-add-form__remove-button[type="submit"] {
  555. top: 5px;
  556. }
  557. /* Do not show the bottom border and padding for the last item. */
  558. .media-library-add-form__media:last-child {
  559. padding-bottom: 0;
  560. border-bottom: 0;
  561. }
  562. .media-library-add-form__preview {
  563. display: flex;
  564. align-items: center;
  565. justify-content: center;
  566. width: 220px;
  567. margin-right: 20px; /* LTR */
  568. background: #ebebeb;
  569. }
  570. [dir="rtl"] .media-library-add-form__preview {
  571. margin-right: 0;
  572. margin-left: 20px;
  573. }
  574. .media-library-add-form__fields {
  575. flex-grow: 1;
  576. }
  577. /**
  578. * @todo Remove [type="submit"] when styles are moved to the seven theme in
  579. * https://www.drupal.org/project/drupal/issues/2980769
  580. */
  581. .media-library-add-form__remove-button[type="submit"] {
  582. position: absolute;
  583. top: 25px;
  584. right: 6px;
  585. margin-right: 0;
  586. }
  587. [dir="rtl"] .media-library-add-form__remove-button[type="submit"] {
  588. right: auto;
  589. left: 13px;
  590. margin-left: 0;
  591. }
  592. /* @todo Remove in https://www.drupal.org/project/drupal/issues/3064914 */
  593. .views-live-preview .media-library-view div.views-row + div.views-row {
  594. margin-top: 0;
  595. }

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.