file.less 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. //some file input variables
  2. @file-input-bg:#FFF;
  3. @file-input-border:#D5D5D5;
  4. @file-input-shadow:~"0 0 0 4px rgba(0,0,0,0.06)";
  5. @file-input-hover-border:#F59942;
  6. @file-input-hover-shadow:~"0 0 0 4px rgba(245, 153, 66, 0.3)";
  7. @file-input-btn-bg:#6FB3E0;
  8. @file-input-name-color:#888;
  9. @file-input-selected-name-color:#666;
  10. @file-input-icon-bg:#D1D1D1;//!ignore
  11. @file-input-selected-icon-bg:#EFAD62;//!ignore
  12. @file-input-selected-icon-picture-bg:#BD7A9D;//!ignore
  13. @file-input-selected-icon-film-bg:#87B87F;//!ignore
  14. @file-input-selected-icon-music-bg:#8B7AC9;//!ignore
  15. @file-input-selected-icon-archive-bg:#EFAD62;//!ignore
  16. @file-remove-bg:#FB7142;
  17. @file-multi-remove-color:#F4C0B1;
  18. @file-multi-border:#AAA;
  19. .enable_file_input() when(@enable-file-input = true) {
  20. .ace-file-input {
  21. display: block;
  22. font-size: inherit;
  23. position: relative;
  24. height: 30px;
  25. //line-height: 38px;
  26. //margin-bottom: 9px;
  27. input[type=file] {
  28. position: fixed;
  29. z-index: -2;
  30. .opacity(0);
  31. &:focus {
  32. outline: none;
  33. }
  34. }
  35. .ace-file-container {
  36. display: block;
  37. position: absolute;
  38. top: 0;
  39. left: 0;
  40. right: 0;
  41. height: 30px;
  42. background-color:@file-input-bg;
  43. border:1px solid @file-input-border;
  44. cursor:pointer;
  45. //.box-shadow(@file-input-shadow);
  46. .box-shadow(none);
  47. .transition(~"all 0.15s");
  48. &:hover {
  49. //.box-shadow(@file-input-hover-shadow);
  50. .box-shadow(none);
  51. border-color:@file-input-hover-border;
  52. }
  53. //the button
  54. &:before {
  55. display: inline-block;
  56. content: attr(data-title);
  57. position: absolute;
  58. right: 0;
  59. top: 0;
  60. bottom: 0;
  61. line-height: 24px;
  62. text-align: center;
  63. padding: 0 8px;
  64. background-color: @file-input-btn-bg;
  65. color: #FFF;
  66. font-size: @font-size-file-input-btn;
  67. font-weight: bold;
  68. border: 2px solid #FFF;
  69. border-left-width: 4px;
  70. .transition(~"all 0.3s");
  71. }
  72. .ace-file-name { //the file name container
  73. display: inline-block;
  74. height: 28px;
  75. max-width: 80%;
  76. white-space: nowrap;
  77. overflow: hidden;
  78. line-height: 28px;
  79. color:@file-input-name-color;
  80. font-size: @font-size-file-input-name;
  81. vertical-align: top;
  82. position: static;
  83. padding-left: 30px;
  84. &:after { //the file name
  85. display: inline-block;
  86. content: attr(data-title);
  87. }
  88. }
  89. &.selected {
  90. right: 16px;
  91. .ace-file-name {
  92. color:@file-input-selected-name-color;
  93. }
  94. }
  95. .@{icon} {
  96. .ace-file-icon();
  97. background-color:@file-input-icon-bg;//should be here
  98. }
  99. &.selected .ace-file-name {
  100. .@{icon} {
  101. background-color:@file-input-selected-icon-bg;
  102. }
  103. .file-image {
  104. background-color:@file-input-selected-icon-picture-bg;
  105. }
  106. .file-video {
  107. background-color:@file-input-selected-icon-film-bg;
  108. }
  109. .file-audio {
  110. background-color:@file-input-selected-icon-music-bg;
  111. }
  112. .file-archive {
  113. background-color:@file-input-selected-icon-archive-bg;
  114. }
  115. }
  116. &.hide-placeholder:before {
  117. display:none;
  118. }
  119. }
  120. a:hover{
  121. text-decoration:none;
  122. }
  123. .remove { // the remove button
  124. position: absolute;
  125. right: -8px;
  126. top: 6px;
  127. display: none;
  128. width: 17px;
  129. text-align: center;
  130. height: 17px;
  131. line-height: 15px;
  132. font-size: 11px;
  133. font-weight: normal;
  134. background-color: @file-remove-bg;
  135. .border-radius(100%);
  136. color: #FFF;
  137. text-decoration: none;
  138. }
  139. .ace-file-container.selected + .remove {
  140. display: inline-block;
  141. }
  142. }
  143. @media screen and (-webkit-min-device-pixel-ratio:0) {
  144. .ace-file-input input[type=file] {
  145. position: absolute;
  146. width: 0; height: 0;
  147. }
  148. }
  149. .ace-file-input input[type=file] {
  150. &.disabled , &[disabled] , &[readonly] {
  151. + .ace-file-container {
  152. cursor: not-allowed;
  153. background-color:#EEE;
  154. &:hover {
  155. //box-shadow: 0 0 0 4px rgba(0,0,0,0.06);
  156. .box-shadow(none);
  157. border-color:#E3E3E3;
  158. }
  159. &:before {
  160. border-color:#EEE;
  161. background-color:#A1AAAF;
  162. }
  163. }
  164. }
  165. &[readonly] + .ace-file-container {
  166. cursor:default;
  167. }
  168. }
  169. .ace-file-icon() {
  170. display: inline-block;
  171. position: absolute;
  172. left: 0;
  173. top: 0;
  174. bottom: 0;
  175. line-height: 24px;
  176. width: 26px;
  177. text-align: center;
  178. font-family: FontAwesome;
  179. font-size: @font-size-file-input-icon;
  180. border: 2px solid #FFF;
  181. color: #FFF;
  182. .transition(~"all 0.1s");
  183. }
  184. .ace-file-input .ace-file-overlay {
  185. position: absolute;
  186. top: -2px;
  187. bottom: -2px;
  188. left: -2px;
  189. right: -10px;
  190. z-index: 99;
  191. background-color: rgba(0,0,0,0.5);
  192. > .overlay-content {
  193. display: inline-block;
  194. position: relative;
  195. top: 10%;
  196. left: 0;
  197. right: 0;
  198. text-align: center;
  199. }
  200. }
  201. .enable_file_input_multiple() when(@enable-file-input-multiple = true) {
  202. .ace-file-multiple {
  203. height:auto;
  204. .ace-file-container {
  205. position:relative;
  206. height:auto;
  207. border:1px dashed @file-multi-border;
  208. border-radius:4px;
  209. text-align:center;
  210. &:before {//the button
  211. display: inline-block;
  212. content: attr(data-title);
  213. position: relative;
  214. right: 0;
  215. left: 0;
  216. margin: 12px;
  217. line-height: 22px;
  218. background-color: #FFF;
  219. color: #CCC;
  220. font-size: @font-size-file-input-name-large;
  221. font-weight: bold;
  222. border-width: 0;
  223. }
  224. &.selected .ace-file-name .@{icon} {
  225. .ace-file-icon();
  226. }
  227. .ace-file-name {
  228. position: relative;
  229. display: block;
  230. padding: 0;
  231. height: auto;
  232. width: auto;
  233. max-width: 100%;
  234. margin: 0 4px;
  235. border-bottom: 1px solid #DDD;
  236. text-align: left;
  237. &:first-child {
  238. margin-top: 1px;
  239. }
  240. &:last-child {
  241. border-bottom-width: 0;
  242. margin-bottom: 1px;
  243. }
  244. img {
  245. padding: 2px;
  246. border: 1px solid #D7D7D7;
  247. background-color: #FFF;
  248. background-repeat: no-repeat;
  249. background-position: center;
  250. margin: 4px 8px 4px 1px;
  251. }
  252. &:after {//the file name
  253. display: none;
  254. }
  255. }
  256. &.selected .ace-file-name:after {//the file name
  257. display: inline-block;
  258. white-space: pre;
  259. }
  260. .ace-file-name img + .@{icon} , &.selected .ace-file-name img + .@{icon} {
  261. display: none;
  262. }
  263. }
  264. .remove {
  265. right: -11px;
  266. top: -11px;
  267. border: 3px solid #BBB;
  268. border-radius: 32px;
  269. background-color: #FFF;
  270. color: red;
  271. width: 23px;
  272. height: 23px;
  273. line-height: 15px;
  274. }
  275. .ace-file-container.selected + .remove:hover {
  276. border-color: @file-multi-remove-color;
  277. }
  278. .ace-file-overlay {
  279. position: absolute;
  280. top: -12px;
  281. bottom: -6px;
  282. left: -12px;
  283. right: -12px;
  284. > .overlay-content {
  285. top: 20%;
  286. }
  287. }
  288. }
  289. .ace-file-multiple .ace-file-container {
  290. .ace-file-name .@{icon} {
  291. position: relative;
  292. display: block;
  293. text-align: center;
  294. height: auto;
  295. line-height: 64px;
  296. width: auto;
  297. font-size: @font-size-file-input-icon-large;
  298. color: #D5D5D5;
  299. margin: 4px 0;
  300. background-color: transparent;
  301. }
  302. &.selected:after {
  303. display:none;
  304. }
  305. &.selected .ace-file-name .@{icon} {
  306. position:relative;
  307. margin-right:4px; margin-left:2px;
  308. line-height:24px;
  309. }
  310. .ace-file-name.large {
  311. text-align: center;
  312. border-bottom: 1px solid #222;
  313. margin: 0 1px 3px;
  314. &:last-child {
  315. margin: 0 1px;
  316. //border-bottom-width: 0;
  317. }
  318. &:after { //image caption
  319. position: absolute;
  320. top: auto;
  321. bottom: 0;
  322. left: 0;
  323. right: 0;
  324. padding: 0 4px;
  325. background-color: #555;
  326. color: #FFF;
  327. .opacity(0.8);
  328. }
  329. img {
  330. border-width: 0;
  331. margin: 0 !important;//to override .RTL's
  332. padding: 0;
  333. }
  334. }
  335. }
  336. .ace-file-multiple input[type=file] {
  337. &.disabled , &[disabled] , &[readonly] {
  338. + .ace-file-container {
  339. &:hover {
  340. border-color:#AAA;
  341. }
  342. &:before {
  343. background-color:transparent;
  344. }
  345. .@{icon} {
  346. border-color:#EEE;
  347. }
  348. }
  349. }
  350. }
  351. }
  352. .enable_file_input_multiple();
  353. }
  354. .enable_file_input();