styleui-components
Version:
Lightweight, modular UI component library with zero dependencies
259 lines (219 loc) • 6.14 kB
CSS
/**
* StyleUI Styles - Base
* This file contains foundational styles for the entire application,
* including typography, resets, accessibility features, and global element styling.
*/
/*------------------------------------*\
#BASE STYLES
\*------------------------------------*/
* {
box-sizing: border-box;
}
html {
scroll-behavior: smooth;
}
body {
margin: 0;
font-family: var(--font-system);
font-size: var(--text-base);
line-height: 1.6;
color: var(--text-primary);
background-color: var(--bg-layer-0);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
overflow-x: hidden;
}
/*------------------------------------*\
#TYPOGRAPHY
\*------------------------------------*/
/* Typography styles are now in css/typography.css */
/*------------------------------------*\
#SCROLLBAR
\*------------------------------------*/
/* Firefox */
/*------------------------------------*\
#ACCESSIBILITY & DEFAULTS
\*------------------------------------*/
.btn:focus-visible,
.nav-item:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.color-swatch:focus-visible {
outline: 3px solid var(--focus-ring);
outline-offset: 2px;
}
:dir(rtl) .nav-panel {
left: auto;
right: var(--space-4);
}
:dir(rtl) .control-panel {
right: auto;
left: var(--space-4);
}
:dir(rtl) .main-content {
margin-left: calc(320px + var(--space-8));
margin-right: calc(var(--nav-width) + var(--space-8));
}
:dir(rtl) body:has(.nav-panel.collapsed) .main-content {
margin-right: calc(64px + var(--space-8));
}
:dir(rtl) body:has(.control-panel.collapsed) .main-content {
margin-left: calc(64px + var(--space-8));
}
/*------------------------------------*\
#LAYOUT UTILITIES
\*------------------------------------*/
.d-flex {
display: flex;
}
.gap-8 {
gap: var(--space-8);
}
.align-items-start {
align-items: flex-start;
}
.flex-1 {
flex: 1;
}
/*------------------------------------*\\
#MAIN LAYOUT
\\*------------------------------------*/
.style-guide-layout {
display: flex;
}
.left-panel {
width: 280px;
flex-shrink: 0;
height: calc(100vh - var(--header-height) - var(--footer-height) - (var(--space-4) * 2));
position: fixed;
top: calc(var(--header-height) + var(--space-4));
left: var(--space-4);
border-radius: 0;
border-right: none;
transition: width var(--transition-base), left var(--transition-base);
background-color: transparent;
box-shadow: none;
z-index: 10;
display: flex;
flex-direction: column;
/* Dim accent color locally for tree edges */
--accent: rgba(var(--accent-rgb), 0.4);
}
.left-panel .panel-header {
display: none;
}
.left-panel .panel-body {
background: transparent;
padding: 0;
}
.right-panel {
width: 280px;
height: calc(100vh - var(--header-height) - var(--footer-height) - (var(--space-4) * 2));
position: fixed;
top: calc(var(--header-height) + var(--space-4));
right: var(--space-4);
border-radius: var(--radius-lg);
background-color: var(--bg-layer-0);
border: 1px solid var(--border-color);
z-index: 10;
display: none;
flex-direction: column;
}
.right-panel .panel-header {
background: var(--bg-layer-2);
}
.right-panel .panel-body {
display: flex;
flex-direction: column;
height: 100%;
}
.left-panel .tree-node-label {
cursor: pointer;
transition: background-color var(--transition-base), color var(--transition-base);
padding: var(--space-2) var(--space-3);
border-radius: var(--radius-md);
}
.left-panel .tree-node-label:hover {
background-color: var(--bg-layer-2);
color: var(--text-primary);
}
.main-container {
flex-grow: 1;
padding: calc(var(--header-height) + var(--space-8)) var(--space-8) calc(var(--footer-height) + var(--space-8));
max-width: 1400px;
margin-left: calc(15vw + var(--space-8));
margin-right: var(--space-8);
transition: margin-left var(--transition-base), margin-right var(--transition-base);
}
#collapsed-navigation-container {
display: none;
flex-direction: column;
align-items: center;
gap: var(--space-4);
padding-top: var(--space-4);
}
#collapsed-navigation-container .nav-divider {
width: 70%;
border: none;
border-top: 1px solid var(--border-color);
margin: var(--space-2) auto;
}
/* Collapsed State */
.style-guide-layout.collapsed .left-panel {
width: calc(56px + var(--space-4));
}
.style-guide-layout.collapsed .main-container {
margin-left: var(--space-8);
}
.style-guide-layout.collapsed + .footer-panel {
left: 50vw;
}
.style-guide-layout.collapsed #navigation-tree-container {
display: none;
}
.style-guide-layout.collapsed #collapsed-navigation-container {
display: flex;
}
#collapsed-settings-container {
display: none;
flex-direction: column;
align-items: center;
gap: var(--space-4);
padding-top: var(--space-4);
}
/* Right Panel Collapsed State */
.style-guide-layout.right-collapsed .right-panel {
width: 80px;
}
.style-guide-layout.right-collapsed .main-container {
margin-right: calc(80px + var(--space-4));
}
.style-guide-layout.right-collapsed .right-panel .panel-title-text,
.style-guide-layout.right-collapsed .right-panel #settings-container {
display: none;
}
.style-guide-layout.right-collapsed .right-panel #collapsed-settings-container {
display: block;
}
/* Initially hide the collapsed container */
#collapsed-settings-container {
display: none;
}
.style-guide-layout.collapsed .left-panel .panel-title-text {
display: none;
}
.style-guide-layout.collapsed .left-panel .panel-header {
justify-content: center;
}
header {
margin-bottom: var(--space-8);
}
/*------------------------------------*\
#IN-PAGE NAVIGATION OFFSET
\*------------------------------------*/
/* Ensure section headers are not hidden behind the fixed header when using anchor links */
section[id^="section-"],
.group-header {
scroll-margin-top: calc(var(--header-height) + var(--space-4));
}