index-pure.less 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  1. @import '../../style/themes/index';
  2. @import '../../style/mixins/index';
  3. @upload-prefix-cls: ~'@{ant-prefix}-upload';
  4. @upload-item: ~'@{ant-prefix}-upload-list-item';
  5. @upload-picture-card-size: 104px;
  6. @upload-picture-card-border-style: @border-style-base;
  7. .@{upload-prefix-cls} {
  8. .reset-component();
  9. outline: 0;
  10. p {
  11. margin: 0;
  12. }
  13. &-btn {
  14. display: block;
  15. width: 100%;
  16. outline: none;
  17. }
  18. input[type='file'] {
  19. cursor: pointer;
  20. }
  21. &&-select {
  22. display: inline-block;
  23. }
  24. &&-disabled {
  25. cursor: not-allowed;
  26. }
  27. &&-select-picture-card {
  28. width: @upload-picture-card-size;
  29. height: @upload-picture-card-size;
  30. margin-right: 8px;
  31. margin-bottom: 8px;
  32. text-align: center;
  33. vertical-align: top;
  34. background-color: @background-color-light;
  35. border: @border-width-base dashed @border-color-base;
  36. border-radius: @border-radius-base;
  37. cursor: pointer;
  38. transition: border-color 0.3s;
  39. > .@{upload-prefix-cls} {
  40. display: flex;
  41. align-items: center;
  42. justify-content: center;
  43. height: 100%;
  44. text-align: center;
  45. }
  46. &:hover {
  47. border-color: @primary-color;
  48. .@{upload-prefix-cls}-disabled& {
  49. border-color: @border-color-base;
  50. }
  51. }
  52. }
  53. &&-drag {
  54. position: relative;
  55. width: 100%;
  56. height: 100%;
  57. text-align: center;
  58. background: @background-color-light;
  59. border: @border-width-base dashed @border-color-base;
  60. border-radius: @border-radius-base;
  61. cursor: pointer;
  62. transition: border-color 0.3s;
  63. .@{upload-prefix-cls} {
  64. padding: @padding-md 0;
  65. }
  66. &.@{upload-prefix-cls}-drag-hover:not(.@{upload-prefix-cls}-disabled) {
  67. border-color: @primary-7;
  68. }
  69. &.@{upload-prefix-cls}-disabled {
  70. cursor: not-allowed;
  71. }
  72. .@{upload-prefix-cls}-btn {
  73. display: table;
  74. height: 100%;
  75. }
  76. .@{upload-prefix-cls}-drag-container {
  77. display: table-cell;
  78. vertical-align: middle;
  79. }
  80. &:not(.@{upload-prefix-cls}-disabled):hover {
  81. border-color: @primary-5;
  82. }
  83. p.@{upload-prefix-cls}-drag-icon {
  84. .@{iconfont-css-prefix} {
  85. color: @primary-5;
  86. font-size: 48px;
  87. }
  88. margin-bottom: 20px;
  89. }
  90. p.@{upload-prefix-cls}-text {
  91. margin: 0 0 4px;
  92. color: @heading-color;
  93. font-size: @font-size-lg;
  94. }
  95. p.@{upload-prefix-cls}-hint {
  96. color: @text-color-secondary;
  97. font-size: @font-size-base;
  98. }
  99. .@{iconfont-css-prefix}-plus {
  100. color: @disabled-color;
  101. font-size: 30px;
  102. transition: all 0.3s;
  103. &:hover {
  104. color: @text-color-secondary;
  105. }
  106. }
  107. &:hover .@{iconfont-css-prefix}-plus {
  108. color: @text-color-secondary;
  109. }
  110. }
  111. &-picture-card-wrapper {
  112. .clearfix();
  113. display: inline-block;
  114. width: 100%;
  115. }
  116. }
  117. .@{upload-prefix-cls}-list {
  118. .reset-component();
  119. .clearfix();
  120. line-height: @line-height-base;
  121. // ============================ Item ============================
  122. &-item {
  123. position: relative;
  124. height: @line-height-base * @font-size-base;
  125. margin-top: @margin-xs;
  126. font-size: @font-size-base;
  127. &-name {
  128. display: inline-block;
  129. width: 100%;
  130. padding-left: @font-size-base + 8px;
  131. overflow: hidden;
  132. line-height: @line-height-base;
  133. white-space: nowrap;
  134. text-overflow: ellipsis;
  135. }
  136. &-card-actions {
  137. position: absolute;
  138. right: 0;
  139. &-btn {
  140. opacity: 0;
  141. }
  142. &-btn.@{ant-prefix}-btn-sm {
  143. height: 20px;
  144. line-height: 1;
  145. }
  146. &.picture {
  147. top: 22px;
  148. line-height: 0;
  149. }
  150. &-btn:focus,
  151. &.picture &-btn {
  152. opacity: 1;
  153. }
  154. .@{iconfont-css-prefix} {
  155. color: @upload-actions-color;
  156. }
  157. }
  158. &-info {
  159. height: 100%;
  160. padding: 0 4px;
  161. transition: background-color 0.3s;
  162. > span {
  163. display: block;
  164. width: 100%;
  165. height: 100%;
  166. }
  167. .@{iconfont-css-prefix}-loading,
  168. .@{upload-prefix-cls}-text-icon {
  169. .@{iconfont-css-prefix} {
  170. position: absolute;
  171. top: (@font-size-base / 2) - 2px;
  172. color: @text-color-secondary;
  173. font-size: @font-size-base;
  174. }
  175. }
  176. }
  177. .@{iconfont-css-prefix}-close {
  178. position: absolute;
  179. top: 6px;
  180. right: 4px;
  181. color: @text-color-secondary;
  182. font-size: 10px;
  183. line-height: 0;
  184. cursor: pointer;
  185. opacity: 0;
  186. transition: all 0.3s;
  187. &:hover {
  188. color: @text-color;
  189. }
  190. }
  191. &:hover &-info {
  192. background-color: @item-hover-bg;
  193. }
  194. &:hover .@{iconfont-css-prefix}-close {
  195. opacity: 1;
  196. }
  197. &:hover &-card-actions-btn {
  198. opacity: 1;
  199. }
  200. &-error,
  201. &-error .@{upload-prefix-cls}-text-icon > .@{iconfont-css-prefix},
  202. &-error &-name {
  203. color: @error-color;
  204. }
  205. &-error &-card-actions {
  206. .@{iconfont-css-prefix} {
  207. color: @error-color;
  208. }
  209. &-btn {
  210. opacity: 1;
  211. }
  212. }
  213. &-progress {
  214. position: absolute;
  215. bottom: -12px;
  216. width: 100%;
  217. padding-left: @font-size-base + 12px;
  218. font-size: @font-size-base;
  219. line-height: 0;
  220. }
  221. }
  222. // =================== Picture & Picture Card ===================
  223. &-picture,
  224. &-picture-card {
  225. .@{upload-item} {
  226. position: relative;
  227. height: 66px;
  228. padding: @padding-xs;
  229. border: @border-width-base @upload-picture-card-border-style @border-color-base;
  230. border-radius: @border-radius-base;
  231. &:hover {
  232. background: transparent;
  233. }
  234. &-error {
  235. border-color: @error-color;
  236. }
  237. }
  238. .@{upload-item}-info {
  239. padding: 0;
  240. }
  241. .@{upload-item}:hover .@{upload-item}-info {
  242. background: transparent;
  243. }
  244. .@{upload-item}-uploading {
  245. border-style: dashed;
  246. }
  247. .@{upload-item}-thumbnail {
  248. width: 48px;
  249. height: 48px;
  250. line-height: 60px;
  251. text-align: center;
  252. opacity: 0.8;
  253. .@{iconfont-css-prefix} {
  254. font-size: 26px;
  255. }
  256. }
  257. // Adjust the color of the error icon : https://github.com/ant-design/ant-design/pull/24160
  258. .@{upload-item}-error .@{upload-item}-thumbnail {
  259. .@{iconfont-css-prefix} {
  260. svg path {
  261. &[fill='#e6f7ff'] {
  262. fill: @error-color-deprecated-bg;
  263. }
  264. &[fill='#1890ff'] {
  265. fill: @error-color;
  266. }
  267. }
  268. }
  269. }
  270. .@{upload-item}-icon {
  271. position: absolute;
  272. top: 50%;
  273. left: 50%;
  274. font-size: 26px;
  275. transform: translate(-50%, -50%);
  276. .@{iconfont-css-prefix} {
  277. font-size: 26px;
  278. }
  279. }
  280. .@{upload-item}-image {
  281. max-width: 100%;
  282. }
  283. .@{upload-item}-thumbnail img {
  284. display: block;
  285. width: 48px;
  286. height: 48px;
  287. overflow: hidden;
  288. }
  289. .@{upload-item}-name {
  290. display: inline-block;
  291. box-sizing: border-box;
  292. max-width: 100%;
  293. margin: 0 0 0 8px;
  294. padding-right: 8px;
  295. padding-left: 48px;
  296. overflow: hidden;
  297. line-height: 44px;
  298. white-space: nowrap;
  299. text-overflow: ellipsis;
  300. transition: all 0.3s;
  301. }
  302. .@{upload-item}-uploading .@{upload-item}-name {
  303. margin-bottom: 12px;
  304. }
  305. .@{upload-item}-progress {
  306. bottom: 14px;
  307. width: ~'calc(100% - 24px)';
  308. margin-top: 0;
  309. padding-left: 56px;
  310. }
  311. .@{iconfont-css-prefix}-close {
  312. position: absolute;
  313. top: 8px;
  314. right: 8px;
  315. line-height: 1;
  316. opacity: 1;
  317. }
  318. }
  319. // ======================== Picture Card ========================
  320. &-picture-card {
  321. &-container {
  322. display: inline-block;
  323. width: @upload-picture-card-size;
  324. height: @upload-picture-card-size;
  325. margin: 0 @margin-xs @margin-xs 0;
  326. vertical-align: top;
  327. }
  328. &.@{upload-prefix-cls}-list::after {
  329. display: none;
  330. }
  331. .@{upload-item} {
  332. height: 100%;
  333. margin: 0;
  334. }
  335. .@{upload-item}-info {
  336. position: relative;
  337. height: 100%;
  338. overflow: hidden;
  339. &::before {
  340. position: absolute;
  341. z-index: 1;
  342. width: 100%;
  343. height: 100%;
  344. background-color: fade(@black, 50%);
  345. opacity: 0;
  346. transition: all 0.3s;
  347. content: ' ';
  348. }
  349. }
  350. .@{upload-item}:hover .@{upload-item}-info::before {
  351. opacity: 1;
  352. }
  353. .@{upload-item}-actions {
  354. position: absolute;
  355. top: 50%;
  356. left: 50%;
  357. z-index: 10;
  358. white-space: nowrap;
  359. transform: translate(-50%, -50%);
  360. opacity: 0;
  361. transition: all 0.3s;
  362. .@{iconfont-css-prefix}-eye,
  363. .@{iconfont-css-prefix}-download,
  364. .@{iconfont-css-prefix}-delete {
  365. z-index: 10;
  366. width: 16px;
  367. margin: 0 4px;
  368. color: @text-color-dark;
  369. font-size: 16px;
  370. cursor: pointer;
  371. transition: all 0.3s;
  372. &:hover {
  373. color: @text-color-inverse;
  374. }
  375. }
  376. }
  377. .@{upload-item}-info:hover + .@{upload-item}-actions,
  378. .@{upload-item}-actions:hover {
  379. opacity: 1;
  380. }
  381. .@{upload-item}-thumbnail,
  382. .@{upload-item}-thumbnail img {
  383. position: static;
  384. display: block;
  385. width: 100%;
  386. height: 100%;
  387. object-fit: contain;
  388. }
  389. .@{upload-item}-name {
  390. display: none;
  391. margin: 8px 0 0;
  392. padding: 0;
  393. line-height: @line-height-base;
  394. text-align: center;
  395. }
  396. .@{upload-item}-file + .@{upload-item}-name {
  397. position: absolute;
  398. bottom: 10px;
  399. display: block;
  400. }
  401. .@{upload-item}-uploading {
  402. &.@{upload-item} {
  403. background-color: @background-color-light;
  404. }
  405. .@{upload-item}-info {
  406. height: auto;
  407. &::before,
  408. .@{iconfont-css-prefix}-eye,
  409. .@{iconfont-css-prefix}-delete {
  410. display: none;
  411. }
  412. }
  413. }
  414. .@{upload-item}-progress {
  415. bottom: 32px;
  416. width: calc(100% - 14px);
  417. padding-left: 0;
  418. }
  419. }
  420. // ======================= Picture & Text =======================
  421. &-text,
  422. &-picture {
  423. &-container {
  424. transition: opacity @animation-duration-slow, height @animation-duration-slow;
  425. &::before {
  426. display: table;
  427. width: 0;
  428. height: 0;
  429. content: '';
  430. }
  431. // Don't know why span here, just stretch it
  432. .@{upload-prefix-cls}-span {
  433. display: block;
  434. flex: auto;
  435. }
  436. }
  437. // text & picture no need this additional element.
  438. // But it used for picture-card, let's keep it.
  439. .@{upload-prefix-cls}-span {
  440. display: flex;
  441. align-items: center;
  442. > * {
  443. flex: none;
  444. }
  445. }
  446. .@{upload-item}-name {
  447. flex: auto;
  448. margin: 0;
  449. padding: 0 @padding-xs;
  450. }
  451. .@{upload-item}-card-actions {
  452. position: static;
  453. }
  454. }
  455. // ============================ Text ============================
  456. &-text {
  457. .@{upload-prefix-cls}-text-icon {
  458. .@{iconfont-css-prefix} {
  459. position: static;
  460. }
  461. }
  462. }
  463. // =========================== Motion ===========================
  464. .@{upload-prefix-cls}-animate-inline-appear,
  465. .@{upload-prefix-cls}-animate-inline-enter,
  466. .@{upload-prefix-cls}-animate-inline-leave {
  467. animation-duration: @animation-duration-slow;
  468. animation-fill-mode: @ease-in-out-circ;
  469. }
  470. .@{upload-prefix-cls}-animate-inline-appear,
  471. .@{upload-prefix-cls}-animate-inline-enter {
  472. animation-name: uploadAnimateInlineIn;
  473. }
  474. .@{upload-prefix-cls}-animate-inline-leave {
  475. animation-name: uploadAnimateInlineOut;
  476. }
  477. }
  478. @keyframes uploadAnimateInlineIn {
  479. from {
  480. width: 0;
  481. height: 0;
  482. margin: 0;
  483. padding: 0;
  484. opacity: 0;
  485. }
  486. }
  487. @keyframes uploadAnimateInlineOut {
  488. to {
  489. width: 0;
  490. height: 0;
  491. margin: 0;
  492. padding: 0;
  493. opacity: 0;
  494. }
  495. }
  496. @import './rtl';