file.less 7.5 KB

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