dropzone-vue
Version:
Vue3 Library Component for drag’n’drop file uploads with image previews..
327 lines (279 loc) • 7.24 kB
CSS
@keyframes passing-through {
0% {
opacity: 0;
transform: translateY(40px); }
30%, 70% {
opacity: 1;
transform: translateY(0px); }
100% {
opacity: 1;
transform: translateY(0px); } }
@keyframes slide-in {
0% {
opacity: 0;
transform: translateY(40px); }
30% {
opacity: 1;
transform: translateY(0px); } }
.gg-close {
box-sizing: border-box;
position: relative;
display: block;
transform: scale(var(--ggs, 1));
width: 22px;
height: 22px;
border: 2px solid transparent;
border-radius: 40px; }
.gg-close::after,
.gg-close::before {
cursor: pointer;
content: "";
display: block;
box-sizing: border-box;
position: absolute;
width: 16px;
height: 2px;
background: currentColor;
transform: rotate(45deg);
border-radius: 5px;
top: 8px;
left: 1px; }
.gg-close::after {
transform: rotate(-45deg); }
.gg-check-o {
box-sizing: border-box;
position: relative;
display: block;
transform: scale(var(--ggs, 2));
width: 22px;
height: 22px;
border: 2px solid;
border-radius: 100px;
color: #747474;
opacity: 0.98;
background-color: #FFFFFF; }
.gg-check-o::after {
content: "";
display: block;
box-sizing: border-box;
position: absolute;
left: 3px;
top: -1px;
width: 6px;
height: 10px;
border-color: currentColor;
border-width: 0 2px 2px 0;
border-style: solid;
transform-origin: bottom left;
transform: rotate(45deg); }
.gg-check-o {
box-sizing: border-box;
position: relative;
display: block;
transform: scale(var(--ggs, 1));
width: 22px;
height: 22px;
border: 2px solid;
border-radius: 100px; }
.gg-danger {
box-sizing: border-box;
position: relative;
display: block;
transform: scale(var(--ggs, 1));
width: 20px;
height: 20px;
border: 2px solid;
border-radius: 40px; }
.gg-danger::after,
.gg-danger::before {
content: "";
display: block;
box-sizing: border-box;
position: absolute;
border-radius: 3px;
width: 2px;
background: currentColor;
left: 7px; }
.gg-danger::after {
top: 2px;
height: 8px; }
.gg-danger::before {
height: 2px;
bottom: 2px; }
.gg-check-o::after {
content: "";
display: block;
box-sizing: border-box;
position: absolute;
left: 3px;
top: -1px;
width: 6px;
height: 10px;
border-color: currentColor;
border-width: 0 2px 2px 0;
border-style: solid;
transform-origin: bottom left;
transform: rotate(45deg); }
:root {
--preview-size: 128px;
--dropzone-min-height: 64px; }
.dropzone, .dropzone * {
box-sizing: border-box; }
.dropzone__box {
position: relative;
display: flex;
flex-flow: row wrap;
min-height: var(--dropzone-min-height);
border: 2px dashed #03A062;
border-radius: 4px;
padding: 4px; }
.dropzone__message--style {
flex-grow: 1;
text-align: center; }
.dropzone__details--style {
padding: 2em 1em;
text-align: center;
color: rgba(0, 0, 0, 0.9);
font-size: 13px;
line-height: 150%;
width: 64px;
min-width: 100%;
max-width: 100%; }
.dropzone__item--style:not(.dropzone--has-thumbnail) > .dropzone__item-thumbnail {
border-radius: 12px;
border: solid 1px black; }
.dropzone__item--style {
margin: auto auto;
padding: 4px; }
.dropzone__item:hover {
z-index: 1000; }
.dropzone__item {
position: relative;
display: inline-block; }
.dropzone__error-mark, .dropzone__success-mark {
pointer-events: none;
opacity: 0;
z-index: 500;
position: absolute;
display: block;
top: 8px;
left: 8px; }
.dropzone--has-error > .dropzone__error-mark > * {
display: block; }
.dropzone--has-error .dropzone__progress {
opacity: 0;
transition: opacity 0.4s ease-in; }
.dropzone--has-error .dropzone__error-mark {
opacity: 1;
animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1); }
.dropzone--success > .dropzone__success-mark > * {
display: block; }
.dropzone--success .dropzone__progress {
opacity: 0;
transition: opacity 0.4s ease-in; }
.dropzone .dropzone--success > .dropzone__success-mark {
opacity: 1;
-webkit-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
-moz-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
-ms-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
-o-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1); }
.dropzone__item-thumbnail {
border-radius: 24px;
overflow: hidden;
width: var(--preview-size);
height: var(--preview-size);
position: relative;
display: block; }
.dropzone__item:not(.dropzone--has-thumbnail) > .dropzone__details {
opacity: 1; }
.dropzone--has-thumbnail:hover > .dropzone__details {
opacity: 1; }
.dropzone--has-thumbnail > .dropzone__item-thumbnail > img {
display: block;
width: 100%;
height: auto; }
.dropzone--has-thumbnail > .dropzone__details {
-webkit-transition: opacity 0.2s linear;
-moz-transition: opacity 0.2s linear;
-ms-transition: opacity 0.2s linear;
-o-transition: opacity 0.2s linear;
transition: opacity 0.2s linear;
transition-property: opacity;
transition-duration: 0.2s;
transition-timing-function: ease-in;
transition-delay: 100ms; }
.dropzone--has-thumbnail:hover > .dropzone__item-thumbnail > img {
-webkit-transform: scale(1.01, 1.01);
-moz-transform: scale(1.01, 1.01);
-ms-transform: scale(1.01, 1.01);
-o-transform: scale(1.01, 1.01);
transform: scale(1.01, 1.01);
-webkit-filter: blur(1px);
filter: blur(1px); }
.dropzone__item-controls {
display: inline-block;
position: absolute;
z-index: 10000;
border-radius: 4px;
top: 8px;
right: 8px; }
.dropzone__item-controls .dropzone__item-control {
cursor: pointer; }
.dropzone-clickable {
cursor: pointer; }
.dropzone-clickable * {
cursor: default; }
.dropzone-clickable .dropzone__message * {
box-sizing: border-box;
cursor: pointer; }
.dropzone__file-size {
margin-bottom: 1em;
font-size: 16px; }
.dropzone__file-size > span {
background-color: rgba(255, 255, 255, 0.4);
padding: 0 0.4em;
border-radius: 3px; }
.dropzone__filename {
white-space: nowrap; }
.dropzone__filename > span {
background-color: rgba(255, 255, 255, 0.4);
padding: 0 0.4em;
border-radius: 3px; }
.dropzone__filename:not(:hover) {
overflow: hidden;
text-overflow: ellipsis; }
.dropzone__filename:not(:hover) > span {
border: 1px solid transparent; }
.dropzone__details {
z-index: 20;
position: absolute;
top: 0;
left: 0;
opacity: 0; }
.dropzone__progress {
opacity: 1;
z-index: 1000;
position: absolute;
left: 50%;
top: 50%;
margin-left: -40px;
-webkit-transform: scale(1);
border-radius: 8px;
overflow: hidden; }
.dropzone__progress .dropzone__progress-bar {
position: relative;
pointer-events: none;
background: rgba(255, 255, 255, 0.9);
height: 16px;
margin-top: -8px;
width: 80px;
transition: width 300ms ease-in-out; }
.dropzone--added .dropzone__progress {
opacity: 0;
transition: opacity 0.4s ease-in; }
.dropzone-processing .dropzone__progress {
opacity: 1;
transition: all 0.2s linear; }
.dropzone__item:not(.dropzone-processing) .dropzone__progress {
animation: pulse 6s ease infinite; }