Mercurial
view design_system/src/styles/components.css @ 251:117c4d53c9a4
[ui] Add HTML-first Web Component system
Co-authored-by: Copilot <[email protected]>
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Tue, 04 Aug 2026 09:14:57 -0700 |
| parents | |
| children | 7a7581f040e8 |
line wrap: on
line source
:where(zen-button, zen-card, zen-alert, zen-field, zen-stack) { box-sizing: border-box; font-family: var(--zen-font-sans); color: var(--zen-color-text); } zen-button { display: inline-flex; } zen-button > :where(button, a) { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: var(--zen-space-2); min-height: 2.75rem; padding: var(--zen-space-2) var(--zen-space-4); border: var(--zen-border-width) solid var(--zen-color-border); border-radius: var(--zen-radius-md); box-shadow: var(--zen-shadow-sm); background: var(--zen-color-accent); color: #171a21; font: 700 var(--zen-font-size-md)/1 var(--zen-font-sans); text-decoration: none; cursor: pointer; transition: background var(--zen-motion-fast) ease, box-shadow var(--zen-motion-fast) ease, transform var(--zen-motion-fast) ease; } zen-button > :where(button, a):hover { background: var(--zen-color-accent-hover); transform: translate(-1px, -1px); box-shadow: 5px 5px 0 rgba(23, 26, 33, 0.18); } zen-button > :where(button, a):active { transform: translate(2px, 2px); box-shadow: none; } zen-button > :where(button, a):focus-visible, zen-alert [data-zen-dismiss]:focus-visible, zen-field :where(input, select, textarea):focus-visible { outline: 3px solid var(--zen-color-focus); outline-offset: 3px; } zen-button[variant="quiet"] > :where(button, a) { background: var(--zen-color-surface); color: var(--zen-color-text); } zen-button[variant="danger"] > :where(button, a) { background: var(--zen-color-danger); color: var(--zen-color-on-danger); } zen-button[disabled] > :where(button, a), zen-button[loading] > :where(button, a) { opacity: 0.55; box-shadow: none; cursor: not-allowed; transform: none; } zen-button[loading] > :where(button, a)::before { width: 0.85rem; height: 0.85rem; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; content: ""; animation: zen-spin 700ms linear infinite; } @keyframes zen-spin { to { transform: rotate(1turn); } } zen-card { display: block; } zen-card > :where(article, section) { height: 100%; padding: var(--zen-space-5); border: var(--zen-border-width) solid var(--zen-color-border); border-radius: var(--zen-radius-lg); box-shadow: var(--zen-shadow-md); background: var(--zen-color-surface-raised); } zen-card[interactive] > :where(article, section) { transition: box-shadow var(--zen-motion-fast) ease, transform var(--zen-motion-fast) ease; } zen-card[interactive] > :where(article, section):hover { transform: translate(-2px, -2px); box-shadow: 10px 10px 0 rgba(23, 26, 33, 0.18); } zen-card :where(h2, h3, p) { margin-top: 0; } zen-alert { display: grid; grid-template-columns: 0.35rem minmax(0, 1fr) auto; align-items: start; gap: var(--zen-space-3); padding: var(--zen-space-4); border: var(--zen-border-width) solid var(--zen-color-border); border-radius: var(--zen-radius-md); background: var(--zen-color-surface-raised); } zen-alert::before { align-self: stretch; border-radius: 999px; background: var(--zen-color-info); content: ""; } zen-alert[tone="success"]::before { background: var(--zen-color-success); } zen-alert[tone="warning"]::before { background: var(--zen-color-warning); } zen-alert[tone="danger"]::before { background: var(--zen-color-danger); } zen-alert > :where(p, div) { margin: 0; } zen-alert [data-zen-dismiss] { min-width: 2rem; min-height: 2rem; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; font: 700 1.2rem/1 var(--zen-font-sans); cursor: pointer; } zen-field { display: grid; gap: var(--zen-space-2); } zen-field > label { font-weight: 750; } zen-field > :where(input, select, textarea) { width: 100%; min-height: 2.75rem; box-sizing: border-box; padding: var(--zen-space-3); border: var(--zen-border-width) solid var(--zen-color-border); border-radius: var(--zen-radius-md); background: var(--zen-color-surface); color: var(--zen-color-text); font: inherit; } zen-field > textarea { min-height: 7rem; resize: vertical; } zen-field > :where(small, [data-help]) { color: var(--zen-color-text-muted); } zen-field[data-invalid] > :where(input, select, textarea) { border-color: var(--zen-color-danger); } zen-field[data-invalid] > :where(small, [data-help]) { color: var(--zen-color-danger); } zen-stack { display: flex; flex-direction: column; gap: var(--zen-stack-gap, var(--zen-space-4)); } zen-stack[direction="row"] { flex-flow: row wrap; align-items: center; } zen-stack[gap="tight"] { --zen-stack-gap: var(--zen-space-2); } zen-stack[gap="loose"] { --zen-stack-gap: var(--zen-space-6); } @media (prefers-reduced-motion: reduce) { zen-button > :where(button, a), zen-card > :where(article, section) { transition: none; } zen-button[loading] > :where(button, a)::before { animation-duration: 1400ms; } }