penpot/frontend/src/app/main/ui/components/forms.scss
2024-03-01 11:04:24 +01:00

442 lines
9.3 KiB
SCSS

// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Copyright (c) KALEIDOS INC
@import "refactor/common-refactor.scss";
// INPUT
.input-wrapper {
display: flex;
flex-direction: column;
align-items: center;
position: relative;
&.valid {
input {
border: $s-1 solid var(--input-border-color-success);
@extend .disabled-input;
&:hover,
&:focus {
border: $s-1 solid var(--input-border-color-success);
}
}
}
&.invalid {
input {
border: $s-1 solid var(--input-border-color-error);
@extend .disabled-input;
&:hover,
&:focus {
border: $s-1 solid var(--input-border-color-error);
}
}
}
&.valid .help-icon,
&.invalid .help-icon {
right: $s-40;
}
}
.input-with-label {
@include flexColumn;
gap: $s-8;
@include bodySmallTypography;
justify-content: flex-start;
align-items: flex-start;
height: 100%;
width: 100%;
padding: 0;
cursor: pointer;
color: var(--modal-title-foreground-color);
text-transform: uppercase;
margin-bottom: $s-8;
input {
@extend .input-element;
color: var(--input-foreground-color-active);
margin-top: 0;
width: 100%;
height: 100%;
padding: 0 $s-8;
&:focus {
outline: none;
border: $s-1 solid var(--input-border-color-focus);
border-radius: $br-8;
}
}
// Input autofill
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
-webkit-text-fill-color: var(--input-foreground-color-active);
-webkit-box-shadow: inset 0 0 20px 20px var(--input-background-color);
border: $s-1 solid var(--input-border-color);
-webkit-background-clip: text;
transition: background-color 5000s ease-in-out 0s;
caret-color: var(--input-foreground-color-active);
}
}
.input-and-icon {
position: relative;
width: var(--input-width, calc(100% - $s-1));
min-width: var(--input-min-width);
height: var(--input-height, $s-32);
}
.help-icon {
cursor: pointer;
position: absolute;
right: $s-16;
top: calc(50% - $s-8);
svg {
@extend .button-icon-small;
stroke: $df-secondary;
width: $s-16;
height: $s-16;
}
}
.invalid-icon {
width: $s-16;
height: $s-16;
background: var(--input-border-color-error);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
position: absolute;
right: $s-16;
top: calc(50% - $s-8);
svg {
width: $s-12;
height: $s-12;
stroke: var(--input-background-color);
}
}
.valid-icon {
width: $s-16;
height: $s-16;
background: var(--input-border-color-success);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
position: absolute;
right: $s-16;
top: calc(50% - $s-8);
svg {
width: $s-12;
height: $s-12;
fill: var(--input-border-color-success);
stroke: var(--input-background-color);
}
}
.error {
color: var(--input-border-color-error);
width: 100%;
font-size: $fs-14;
}
.hint {
@include bodySmallTypography;
color: var(--modal-text-foreground-color);
width: 99%;
}
.checkbox {
@extend .input-checkbox;
.checkbox-label {
@include bodySmallTypography;
display: flex;
align-items: center;
flex-direction: row-reverse;
gap: $s-6;
min-height: $s-32;
cursor: pointer;
span {
@extend .checkbox-icon;
}
input {
display: none !important;
}
&:hover {
span {
border-color: var(--input-checkbox-border-color-hover);
}
}
}
}
// SELECT
.custom-select {
@extend .select-wrapper;
height: $s-32;
.input-container {
@include flexRow;
height: $s-32;
width: 100%;
border-radius: $br-8;
border: $s-1 solid var(--input-border-color);
color: var(--input-foreground-color-active);
background-color: var(--input-background-color);
.main-content {
@include flexColumn;
@include bodySmallTypography;
position: relative;
justify-content: center;
flex-grow: 1;
height: 100%;
padding: $s-8;
.label {
color: var(--input-foreground-color);
}
.value {
width: 100%;
padding: 0px;
margin: 0px;
border: 0px;
color: var(--input-foreground-color-active);
}
}
.icon {
@include flexCenter;
height: $s-32;
width: $s-24;
pointer-events: none;
svg {
@extend .button-icon-small;
stroke: var(--icon-foreground);
transform: rotate(90deg);
}
}
&.disabled {
background-color: var(--input-background-color-disabled);
border: $s-1 solid var(--input-border-color-disabled);
color: var(--input-foreground-color-disabled);
}
&.focus {
outline: none;
color: var(--input-foreground-color-active);
background-color: var(--input-background-color-active);
border: $s-1 solid var(--input-border-color-active);
}
}
select {
@extend .menu-dropdown;
@include bodySmallTypography;
box-sizing: border-box;
position: absolute;
top: 0;
left: 0;
min-height: $s-32;
height: auto;
width: calc(100% - 1px);
padding: 0 $s-12;
margin: 0;
border: none;
opacity: 0;
z-index: $z-index-10;
background-color: transparent;
cursor: pointer;
option {
@include bodySmallTypography;
color: var(--title-foreground-color-hover);
background-color: var(--menu-background-color);
appearance: none;
height: $s-32;
}
}
}
// SUBMIT-BUTTON
.button-submit {
@extend .button-primary;
}
:disabled {
@extend .button-disabled;
}
// MULTI INPUT
.custom-multi-input {
display: flex;
flex-direction: column;
position: relative;
min-height: $s-40;
max-height: $s-180;
width: 100%;
overflow-y: hidden;
.inside-input {
@include removeInputStyle;
@include bodySmallTypography;
@include textEllipsis;
width: 100%;
max-width: calc(100% - $s-1);
min-height: $s-32;
padding-top: 0;
height: $s-32;
padding: $s-8;
margin: 0;
border-radius: $br-8;
color: var(--input-foreground-color-active);
background-color: var(--input-background-color);
border: $s-1 solid var(--input-border-color-active);
&:focus {
outline: none;
border: $s-1 solid var(--input-border-color-focus);
}
}
label {
display: none;
}
.selected-items {
display: flex;
flex-wrap: wrap;
gap: $s-4;
max-height: $s-136;
padding: $s-4 0;
overflow-y: scroll;
.selected-item {
.around {
@include flexRow;
height: $s-24;
width: fit-content;
padding-left: $s-6;
border-radius: $br-6;
background-color: var(--pill-background-color);
border: $s-1 solid var(--pill-background-color);
box-sizing: border-box;
.text {
@include bodySmallTypography;
padding-right: $s-8;
color: var(--pill-foreground-color);
}
.icon {
@include flexCenter;
@include buttonStyle;
height: $s-32;
width: $s-24;
svg {
@extend .button-icon-small;
stroke: var(--icon-foreground);
}
}
&.invalid {
background-color: var(--status-widget-background-color-error);
.text {
color: var(--alert-text-foreground-color-error);
}
.icon svg {
stroke: var(--alert-icon-foreground-color-error);
}
}
}
}
}
}
// RADIO BUTTONS
.custom-radio {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: $s-16;
}
.radio-label {
@include bodySmallTypography;
@include flexRow;
align-items: flex-start;
gap: $s-8;
min-height: $s-32;
height: fit-content;
border-radius: $br-8;
padding: $s-8;
color: var(--input-foreground-color);
border: $s-1 solid transparent;
&:focus,
&:focus-within {
outline: none;
border: $s-1 solid var(--input-border-color-active);
}
}
.radio-dot {
height: $s-8;
width: $s-8;
border-radius: $br-circle;
background-color: var(--color-background-tertiary);
}
.radio-input {
width: 0;
margin: 0;
}
.radio-icon {
@extend .checkbox-icon;
border-radius: $br-circle;
}
.radio-label.with-image {
@include smallTitleTipography;
display: grid;
grid-template-rows: auto auto 0px;
justify-items: center;
gap: 0;
height: $s-116;
width: $s-92;
border-radius: $br-8;
margin: 0;
border: 1px solid var(--color-background-tertiary);
cursor: pointer;
&:global(.checked) {
border: 1px solid var(--color-accent-primary);
}
&:focus,
&:focus-within {
outline: none;
border: $s-1 solid var(--input-border-color-active);
}
}
.image-inside {
width: $s-60;
height: $s-48;
background-size: $s-48;
background-repeat: no-repeat;
background-position: center;
}
.icon-inside {
width: $s-60;
height: $s-48;
svg {
width: $s-60;
height: $s-48;
stroke: var(--icon-foreground);
fill: none;
}
}
//TEXTAREA
.textarea-label {
@include uppercaseTitleTipography;
color: var(--modal-title-foreground-color);
text-transform: uppercase;
margin-bottom: $s-8;
}
.textarea-wrapper {
display: grid;
grid-template-rows: auto 1fr;
}