@c8y/style
Version:
Styles for Cumulocity IoT applications
219 lines (203 loc) • 4.87 kB
text/less
@import "../../mixins/_gradients.less";
@import "../../mixins/_opacity.less";
/**
* File Picker - File upload component with drag-and-drop
*
* Note: Uses @size-* tokens for spacing where applicable.
*
* Intentionally hardcoded values:
* - Component-specific sizes (36px, 28px, 100px, 150px, 300px): Icon and container dimensions
* - Fine-tuning offsets (3px, 6px): Positioning adjustments
* - Border widths (2px): Standard dashed borders
* - Transition duration (0.35s): Animation timing
* - Transform scale (1.1): Hover effect
*/
// Shared mixin for upload status/placeholder styling
.upload-elements-styling() {
.upload-status,
.upload-placeholder {
padding: 0 @size-16;
width: 100%;
}
}
// Shared mixin for alert positioning
.alert-positioning() {
.alert {
position: absolute;
bottom: 0;
margin: 0;
width: 100%;
}
}
// Shared mixin for file placeholder icon styling
.file-placeholder-icon() {
[class^='dlt-c8y-icon-'],
[class*=' dlt-c8y-icon-'] {
color: @component-brand-primary;
font-size: 36px;
transition: all 0.35s ease;
}
}
// Shared mixin for icon hover/drag-over effect
.icon-hover-effect() {
.hint-placeholder {
[class^='dlt-c8y-icon-'],
[class*=' dlt-c8y-icon-'] {
transform: scale(1.1);
}
}
}
// Shared mixin for error state styling
.file-placeholder-error() {
&.has-errors .file-placeholder {
border-bottom-style: solid;
border-bottom-color: @form-control-validation-error;
}
}
c8y-drop-area {
display: block;
}
.drop-zone {
position: relative;
display: block;
padding-bottom: 100%;
height: 0;
.alert-positioning();
.upload-elements-styling();
.file-placeholder {
position: absolute;
display: flex;
align-items: center;
flex-flow: column nowrap;
justify-content: center;
width: 100%;
height: 100%;
border: 2px dashed @component-border-color;
color: @component-color-default;
text-align: center;
transition: border 0.25s ease;
.hint-placeholder {
.file-placeholder-icon();
}
&.drag-over,
&:hover {
border-color: @component-brand-primary;
.icon-hover-effect();
}
}
.file-placeholder-error();
&.drop-zone-sm,
.drop-area-sm & {
padding: 0;
min-height: unset ;
height: auto;
.alert {
position: relative;
}
.file-placeholder {
position: static;
display: block;
.hint-placeholder {
position: relative;
padding: @size-10 @size-10 @size-10 50px;
text-align: left;
[class^='dlt-c8y-icon-'],
[class*=' dlt-c8y-icon-'] {
position: absolute;
top: 50%;
left: 3px;
transform: translate(0, -50%);
}
p {
margin-bottom: 0;
}
}
&:hover,
&.drag-over {
.hint-placeholder [class^='dlt-c8y-icon-'],
.hint-placeholder [class*=' dlt-c8y-icon-'] {
transform: translate(0, -50%) scale(1.1);
}
}
}
}
.drop-area-sm & {
.file-placeholder {
.hint-placeholder {
[class^='dlt-c8y-icon-'],
[class*=' dlt-c8y-icon-'] {
left: @size-8;
font-size: 28px;
}
p {
br {
display: contents;
+ span {
margin-left: 6px;
}
}
}
}
}
}
&.disabled {
&,
&:hover,
&:focus {
pointer-events: none ;
cursor: @cursor-disabled ;
color: @component-color-default;
.opacity(0.65);
box-shadow: none;
}
}
}
c8y-file-picker-form-control {
.file-picker-drop-zone {
display: flex;
flex-direction: column;
min-height: 150px;
height: fit-content;
transition: min-height 0.25s ease;
padding: @size-10;
&.unsupported-format {
background-size: 100px 100px;
.gradient-striped(rgba(0, 0, 0, 0.10));
}
&.dragging {
min-height: 300px;
}
.alert-positioning();
.upload-elements-styling();
.file-placeholder {
flex: 1;
display: flex;
align-items: center;
flex-flow: column nowrap;
justify-content: center;
height: 100%;
border: 2px dashed @component-border-color;
color: @component-color-default;
text-align: center;
transition: border 0.25s ease;
.hint-placeholder {
.file-placeholder-icon();
[class^='dlt-c8y-icon-'],
[class*=' dlt-c8y-icon-'] {
&.warning {
color: var(--palette-status-warning, var(--c8y-palette-status-warning));
}
}
}
> * {
pointer-events: none;
}
&.drag-over,
&:hover {
border-color: @component-brand-primary;
.icon-hover-effect();
}
}
.file-placeholder-error();
}
}