Spaces:
Sleeping

script / static /styles /_components.scss
Lara Monteagudo Tubau
Build CSS for Hugging Face deploy
ba2c0b3
Raw History Blame Contribute Delete
18.6 kB
// =============================================================================
// _components.scss β€” CollabCode Design System
// All UI components, scoped under .cc- prefix (CollabCode namespace)
//
// Component organisation follows Atomic Design (Bradfrost 2013):
// Atoms β†’ badge, button, label, progress bar, separator
// Molecules β†’ card, banner, form group, step, section card
// Organisms β†’ pipeline stepper, episode table, kappa report, rule card,
// coding panel
// =============================================================================
@import 'tokens';
@import 'mixins';
// `sass:map` is unused under libsass; keep the file compatible with the
// existing Python `sass` compiler.
// ─── RESET / SCOPE ───────────────────────────────────────────────────────────
// All CollabCode elements live under .cc-root.
// Gradio injects our CSS globally, so the namespace avoids collisions.
.cc-root * {
box-sizing: border-box;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
// ─── PAGE FRAME ──────────────────────────────────────────────────────────────
.cc-header {
padding: $space-5 0 $space-3;
border-bottom: 1px solid $color-border-default;
margin-bottom: $space-5;
&__title {
font-size: $font-size-2xl;
font-weight: $font-weight-extrabold;
color: $color-text-primary;
letter-spacing: -0.025em;
margin: 0 0 $space-1;
}
&__subtitle {
font-size: $font-size-sm;
color: $color-text-tertiary;
margin: 0;
}
}
// ─── PIPELINE STEPPER ────────────────────────────────────────────────────────
//
// Communicates overall progress at a glance.
// Follows Nielsen's "visibility of system status" heuristic (#1).
// Pattern reference: "progress indicator" in Nielsen Norman Group (2023)
// "Progress Trackers in UX β€” 11 Design Guidelines."
.cc-stepper {
@include flex-row(0);
background: $color-bg-surface;
border: 1px solid $color-border-default;
border-radius: $radius-lg;
padding: $space-3 $space-5;
margin-bottom: $space-5;
box-shadow: $shadow-xs;
&__title {
@include label-overline;
margin-right: $space-4;
flex-shrink: 0;
}
&__steps {
@include flex-row(0);
flex-wrap: wrap;
row-gap: $space-1;
}
&__step {
font-size: $font-size-sm;
font-weight: $font-weight-semibold;
white-space: nowrap;
padding: $space-1 $space-2;
border-radius: $radius-sm;
&--done {
color: $color-step-done;
}
&--active {
color: $color-step-active;
background: $color-interactive-subtle;
}
&--pending {
color: $color-step-pending;
}
}
&__sep {
color: $color-border-strong;
padding: 0 $space-1;
font-size: $font-size-xs;
align-self: center;
}
}
// ─── SECTION CARDS ───────────────────────────────────────────────────────────
//
// Spatial representation of all sections at once reduces the "lost in
// process" feeling. Based on: Shneiderman et al. (2016) "Designing the
// User Interface" ch.3 β€” overview first, zoom/filter, details on demand.
.cc-sections {
display: flex;
gap: $space-2;
flex-wrap: wrap;
margin: $space-3 0;
}
.cc-section {
flex: 1 1 140px;
min-width: 120px;
border-radius: $radius-md;
padding: $space-3 $space-4;
border: 1.5px solid $color-section-pending-border;
background: $color-section-pending-bg;
@include motion-safe {
transition: border-color $duration-fast $ease-in-out,
background $duration-fast $ease-in-out;
}
&__label {
font-size: $font-size-sm;
font-weight: $font-weight-bold;
color: $color-section-pending-text;
line-height: $line-height-snug;
@include truncate;
}
&__meta {
font-size: $font-size-2xs;
color: $color-text-tertiary;
margin-top: $space-1;
@include mono-sm;
}
// State modifiers
&--done {
background: $color-section-done-bg;
border-color: $color-section-done-border;
.cc-section__label { color: $color-section-done-text; }
}
&--active {
background: $color-section-active-bg;
border-color: $color-section-active-border;
border-width: 2px;
box-shadow: $shadow-sm;
.cc-section__label { color: $color-section-active-text; }
}
}
// ─── STATUS BANNERS ──────────────────────────────────────────────────────────
// Never convey meaning by colour alone β€” always include a text label/icon.
// (WCAG 1.4.1 Use of Color)
.cc-banner {
@include banner-info; // default
&--success { @include banner-success; }
&--warning { @include banner-warning; }
&--error { @include banner-error; }
&--info { @include banner-info; }
strong { font-weight: $font-weight-semibold; }
}
// ─── GENERIC CARD ────────────────────────────────────────────────────────────
.cc-card {
@include card;
&__header {
@include label-overline;
margin-bottom: $space-3;
}
&__divider {
@include divider;
}
}
// ─── UNCERTAINTY BANNER ───────────────────────────────────────────────────────
// Rendered when Agent 1b flags a segment as uncertain.
// Uncertainty sampling pattern: Settles (2012) ch.2.
.cc-uncertainty {
@include banner-warning;
display: flex;
align-items: flex-start;
gap: $space-2;
&__icon {
flex-shrink: 0;
font-size: $font-size-md;
line-height: $line-height-normal;
}
&__body {
flex: 1;
strong {
font-weight: $font-weight-semibold;
display: block;
margin-bottom: $space-1;
}
}
}
// ─── DIMENSION DESCRIPTION ───────────────────────────────────────────────────
.cc-dim-desc {
background: $color-interactive-subtle;
border-left: 3px solid $color-interactive;
border-radius: 0 $radius-sm $radius-sm 0;
padding: $space-2 $space-3;
margin-top: $space-2;
font-size: $font-size-sm;
color: $color-info-text;
line-height: $line-height-normal;
@include motion-safe { transition: opacity $duration-fast $ease-out; }
&:empty { display: none; }
}
// ─── BADGE / DIMENSION TAG ───────────────────────────────────────────────────
// Dimension colour badges β€” one per D1–D9 + NS/NA.
// Each pair is verified for AA contrast on its background.
.cc-dim-badge {
@include badge($color-bg-subtle, $color-text-secondary);
// Generated per-dimension variants via @each
@each $dim, $pair in $dim-badge-colors {
$bg: nth($pair, 1);
$text: nth($pair, 2);
&--#{$dim} {
@include badge($bg, $text);
}
}
}
.cc-rule-badge {
@include badge($color-bg-subtle, $color-text-secondary);
border-radius: $radius-full;
margin-bottom: $space-2;
&--boundary { @include badge(#dbeafe, #1e3a8a); border-radius: $radius-full; }
&--disambiguation{ @include badge(#fce7f3, #831843); border-radius: $radius-full; }
&--marker { @include badge(#d1fae5, #064e3b); border-radius: $radius-full; }
}
// ─── EPISODE TABLE ───────────────────────────────────────────────────────────
// Boundary review: shows the episode structure before the researcher confirms.
.cc-ep-table {
@include card;
border-collapse: collapse;
font-size: $font-size-sm;
@include flex-row($space-4, flex-end);
margin-bottom: $space-2;
overflow: hidden; // clips radius on table
th {
font-size: $font-size-4xl;
font-weight: $font-weight-extrabold;
text-align: left;
line-height: $line-height-none;
font-weight: $font-weight-bold;
&--pass { color: $color-kappa-pass; }
&--fail { color: $color-kappa-fail; }
&--warn { color: $color-kappa-warn; }
border-bottom: 1px solid $color-border-default;
}
font-weight: $font-weight-bold;
font-size: $font-size-md;
line-height: $line-height-snug;
margin-bottom: $space-px;
vertical-align: middle;
&--pass { color: $color-kappa-pass; }
&--fail { color: $color-kappa-fail; }
&--warn { color: $color-kappa-warn; }
// Boundary separator rows
&__boundary-row td {
font-size: $font-size-2xs;
color: $color-text-tertiary;
font-size: $font-size-2xs;
border-top: 1px dashed $color-warning-border;
padding: $space-1 $space-3;
em {
background: $color-border-default;
border-radius: $radius-full;
margin: $space-3 0;
.confidence-high { color: $color-success-text; font-weight: $font-weight-semibold; }
.confidence-medium { color: $color-warning-text; font-weight: $font-weight-semibold; }
.confidence-low { color: $color-error-text; font-weight: $font-weight-semibold; }
}
border-radius: $radius-full;
@include motion-safe {
transition: width $duration-slow $ease-out;
}
&__range {
@include mono-sm;
color: $color-text-secondary;
}
&__count {
color: $color-text-tertiary;
font-size: $font-size-xs;
}
}
// ─── KAPPA REPORT ────────────────────────────────────────────────────────────
// Visual score card for inter-rater reliability.
// Landis & Koch (1977) interpretation levels surfaced as coloured text.
.cc-kappa {
@include card;
&__score-row {
@include flex-row($space-4, flex-end);
margin-bottom: $space-2;
}
&__score {
font-size: $font-size-4xl;
font-weight: $font-weight-extrabold;
letter-spacing: -0.04em;
line-height: $line-height-none;
&--pass { color: $color-kappa-pass; }
&--fail { color: $color-kappa-fail; }
&--warn { color: $color-kappa-warn; }
}
&__interp {
font-weight: $font-weight-bold;
font-size: $font-size-md;
line-height: $line-height-snug;
margin-bottom: $space-px;
&--pass { color: $color-kappa-pass; }
&--fail { color: $color-kappa-fail; }
&--warn { color: $color-kappa-warn; }
}
&__cite {
font-size: $font-size-2xs;
color: $color-text-tertiary;
}
&__bar-wrap {
position: relative;
height: 10px;
background: $color-border-default;
border-radius: $radius-full;
margin: $space-3 0;
overflow: visible; // let threshold tick extend
}
&__bar-fill {
position: absolute;
inset: 0 auto 0 0;
border-radius: $radius-full;
@include motion-safe {
transition: width $duration-slow $ease-out;
}
}
&__threshold {
position: absolute;
top: -4px;
height: 18px;
width: 2px;
background: $color-text-tertiary;
border-radius: 1px;
&-label {
position: absolute;
top: -16px;
left: -10px;
font-size: $font-size-2xs;
color: $color-text-tertiary;
white-space: nowrap;
}
}
&__meta {
font-size: $font-size-sm;
color: $color-text-tertiary;
margin-bottom: $space-4;
}
&__dim-header {
@include label-overline;
margin-bottom: $space-3;
}
&__dim-row {
@include flex-row($space-3);
padding: $space-1 0;
&:not(:last-child) {
border-bottom: 1px solid $color-border-default;
}
}
&__dim-name {
font-weight: $font-weight-bold;
font-size: $font-size-sm;
width: 36px;
flex-shrink: 0;
}
&__dim-bar-wrap {
flex: 1;
height: 6px;
background: $color-border-default;
border-radius: $radius-full;
overflow: hidden;
align-self: center;
}
&__dim-bar-fill {
height: 100%;
border-radius: $radius-full;
@include motion-safe {
transition: width $duration-slow $ease-out;
}
}
&__dim-value {
font-weight: $font-weight-semibold;
font-size: $font-size-sm;
width: 40px;
text-align: right;
flex-shrink: 0;
&--pass { color: $color-kappa-pass; }
&--fail { color: $color-kappa-fail; }
&--warn { color: $color-kappa-warn; }
}
}
// ─── RULE CARD ───────────────────────────────────────────────────────────────
// Rule proposals from Agent 2. Human must approve before they affect Agent 1b.
.cc-rule {
@include card;
margin: $space-3 0;
&__top {
@include flex-row($space-3);
justify-content: space-between;
align-items: flex-start;
margin-bottom: $space-3;
flex-wrap: wrap;
gap: $space-2;
}
&__id {
@include mono-sm;
color: $color-text-tertiary;
margin-left: $space-2;
}
&__dims {
font-size: $font-size-xs;
color: $color-text-tertiary;
}
&__description {
font-size: $font-size-base;
color: $color-text-primary;
line-height: $line-height-relaxed;
margin: 0 0 $space-2;
}
&__rationale {
font-size: $font-size-sm;
color: $color-text-secondary;
line-height: $line-height-normal;
margin: 0 0 $space-3;
}
&__footer {
@include flex-row($space-4);
flex-wrap: wrap;
padding-top: $space-3;
border-top: 1px solid $color-border-default;
font-size: $font-size-xs;
color: $color-text-tertiary;
}
}
// ─── CODING PROGRESS ─────────────────────────────────────────────────────────
.cc-coding-progress {
margin-bottom: $space-4;
&__label {
font-size: $font-size-sm;
color: $color-text-secondary;
margin-bottom: $space-1;
strong {
color: $color-text-primary;
font-weight: $font-weight-semibold;
}
}
&__bar-wrap {
@include progress-track(6px);
}
&__bar-fill {
@include progress-fill($color-interactive);
}
&__count {
font-size: $font-size-xs;
color: $color-text-tertiary;
margin-top: $space-1;
}
}
// ─── TRANSCRIPT TURNS DISPLAY ────────────────────────────────────────────────
// Annotation-specific reading pane.
// Optimised for sustained reading: generous line-height, contrast, clear
// speaker attribution β€” reduces cognitive fatigue during long coding sessions.
// Reference: Rayner, K. et al. (2016). "So Much to Read, So Little Time."
// Psychological Science in the Public Interest, 17(1).
.cc-turns {
font-size: $font-size-base;
line-height: $line-height-relaxed;
color: $color-text-primary;
&__turn {
padding: $space-3 0;
border-bottom: 1px solid $color-border-default;
&:last-child { border-bottom: none; }
}
&__speaker {
font-weight: $font-weight-bold;
font-size: $font-size-sm;
color: $color-interactive;
&--alt {
color: $color-text-secondary;
}
}
&__time {
@include mono-sm;
color: $color-text-tertiary;
margin-left: $space-2;
}
&__text {
margin-top: $space-1;
line-height: $line-height-relaxed;
}
}
// ─── PIPELINE SECTION HEADER ─────────────────────────────────────────────────
.cc-section-header {
background: $color-interactive-subtle;
border: 1px solid $color-interactive-muted;
border-radius: $radius-md;
padding: $space-4;
margin-bottom: $space-4;
&__title {
font-size: $font-size-lg;
font-weight: $font-weight-bold;
color: $color-text-primary;
margin: 0 0 $space-1;
}
&__meta {
font-size: $font-size-sm;
color: $color-text-tertiary;
@include mono-sm;
}
&__summary {
font-size: $font-size-sm;
color: $color-text-secondary;
margin-top: $space-1;
font-style: italic;
}
}
// ─── FORM ELEMENTS ───────────────────────────────────────────────────────────
// Gradio renders its own form elements; these styles are for our custom HTML.
.cc-label {
display: block;
font-size: $font-size-sm;
font-weight: $font-weight-medium;
color: $color-text-secondary;
margin-bottom: $space-1;
}
.cc-input {
display: block;
width: 100%;
background: $input-bg;
border: 1px solid $input-border;
border-radius: $input-radius;
font-family: $font-family-sans;
font-size: $input-font-size;
color: $color-text-primary;
padding: $input-padding;
@include focus-ring;
@include motion-safe {
transition: border-color $duration-fast $ease-in-out;
}
&:hover:not(:disabled) {
border-color: $color-border-strong;
}
&::placeholder {
color: $color-text-disabled;
}
}
// ─── UTILITY CLASSES ─────────────────────────────────────────────────────────
// Sparingly β€” prefer component styles over utility sprawl.
.cc-sr-only { @include visually-hidden; }
.cc-truncate { @include truncate; }
.cc-text-primary { color: $color-text-primary !important; }
.cc-text-secondary { color: $color-text-secondary !important; }
.cc-text-tertiary { color: $color-text-tertiary !important; }
.cc-text-success { color: $color-success-text !important; }
.cc-text-warning { color: $color-warning-text !important; }
.cc-text-error { color: $color-error-text !important; }
.cc-mt-2 { margin-top: $space-2 !important; }
.cc-mt-4 { margin-top: $space-4 !important; }
.cc-mb-2 { margin-bottom: $space-2 !important; }
.cc-mb-4 { margin-bottom: $space-4 !important; }
.cc-divider { @include divider; }