@gambito-corp/mbs-library
Version:
Librería de componentes React reutilizables - Sistema de diseño modular y escalable
299 lines (244 loc) • 5.54 kB
CSS
/* ===== BLOCK: input-container ===== */
.input-container {
display: block;
position: relative;
}
.input-container--full {
width: 100%;
}
/* ===== BLOCK: input ===== */
.input {
display: block;
width: 100%;
border: 1px solid #d1d5db;
border-radius: 0.5rem;
font-family: inherit;
font-size: 1rem;
line-height: 1.5;
background-color: #ffffff;
color: #111827;
transition: all 0.2s ease-in-out;
outline: none;
box-sizing: border-box;
}
.input:focus {
border-color: #3b82f6;
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.input::placeholder {
color: #9ca3af;
}
/* ===== ELEMENT: input__wrapper ===== */
.input__wrapper {
position: relative;
display: flex;
align-items: center;
}
/* ===== ELEMENT: input__label ===== */
.input__label {
display: block;
font-size: 0.875rem;
font-weight: 500;
color: #374151;
margin-bottom: 0.5rem;
}
.input__label--required::after {
content: ' *';
color: #ef4444;
}
/* ===== ELEMENT: input__icon ===== */
.input__icon {
position: absolute;
top: 50%;
transform: translateY(-50%);
color: #6b7280;
pointer-events: none;
z-index: 1;
}
.input__icon--left {
left: 0.75rem;
}
.input__icon--right {
right: 0.75rem;
}
.input__icon--clickable {
pointer-events: auto;
cursor: pointer;
transition: color 0.2s ease-in-out;
}
.input__icon--clickable:hover {
color: #374151;
}
/* ===== ELEMENT: input__message ===== */
.input__message {
display: block;
font-size: 0.75rem;
margin-top: 0.5rem;
color: #6b7280;
}
.input__message--error {
color: #ef4444;
}
.input__message--success {
color: #10b981;
}
.input__message--warning {
color: #f59e0b;
}
/* ===== MODIFIERS: Tamaños ===== */
.input--small {
padding: 0.375rem 0.75rem;
font-size: 0.875rem;
min-height: 32px;
}
.input--medium {
padding: 0.5rem 0.75rem;
font-size: 1rem;
min-height: 40px;
}
.input--large {
padding: 0.75rem 1rem;
font-size: 1.125rem;
min-height: 48px;
}
/* ===== MODIFIERS: Variantes ===== */
.input--success {
border-color: #10b981;
background-color: #f0fdf4;
}
.input--success:focus {
border-color: #059669;
box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}
.input--error {
border-color: #ef4444;
background-color: #fef2f2;
}
.input--error:focus {
border-color: #dc2626;
box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}
.input--warning {
border-color: #f59e0b;
background-color: #fffbeb;
}
.input--warning:focus {
border-color: #d97706;
box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}
/* ===== MODIFIERS: Estados ===== */
.input--disabled {
opacity: 0.5;
cursor: not-allowed;
background-color: #f9fafb;
color: #6b7280;
}
.input--readonly {
background-color: #f9fafb;
cursor: default;
}
.input--full {
width: 100%;
}
/* ===== MODIFIERS: Con iconos ===== */
.input--with-icon-left {
padding-left: 2.5rem;
}
.input--with-icon-right {
padding-right: 2.5rem;
}
.input--small.input--with-icon-left {
padding-left: 2rem;
}
.input--small.input--with-icon-right {
padding-right: 2rem;
}
.input--large.input--with-icon-left {
padding-left: 3rem;
}
.input--large.input--with-icon-right {
padding-right: 3rem;
}
/* ===== MODO OSCURO ===== */
[data-theme="dark"] .input {
background-color: #1f2937;
color: #f9fafb;
border-color: #4b5563;
}
[data-theme="dark"] .input:focus {
border-color: #60a5fa;
box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}
[data-theme="dark"] .input::placeholder {
color: #6b7280;
}
[data-theme="dark"] .input__label {
color: #f9fafb;
}
[data-theme="dark"] .input__icon {
color: #9ca3af;
}
[data-theme="dark"] .input__icon--clickable:hover {
color: #f9fafb;
}
[data-theme="dark"] .input__message {
color: #9ca3af;
}
[data-theme="dark"] .input--disabled {
background-color: #374151;
color: #6b7280;
}
[data-theme="dark"] .input--readonly {
background-color: #374151;
}
[data-theme="dark"] .input--success {
background-color: rgba(16, 185, 129, 0.1);
}
[data-theme="dark"] .input--error {
background-color: rgba(239, 68, 68, 0.1);
}
[data-theme="dark"] .input--warning {
background-color: rgba(245, 158, 11, 0.1);
}
/* ===== ACCESIBILIDAD ===== */
.input:focus-visible {
outline: 2px solid #3b82f6;
outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
.input,
.input__icon {
transition: none ;
}
}
/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
.input {
min-height: 44px; /* Mejor accesibilidad táctil */
}
.input--small {
min-height: 40px;
}
.input--large {
min-height: 48px;
}
}
/* ===== HIGH CONTRAST ===== */
@media (prefers-contrast: high) {
.input {
border-width: 2px;
}
.input:focus {
outline-width: 3px;
outline-offset: 3px;
}
}
/* ===== PRINT STYLES ===== */
@media print {
.input {
background: white ;
color: black ;
border: 1px solid black ;
box-shadow: none ;
}
}