hikari-components 0.3.14

Core UI components (buttons, inputs, tables, modals) for the Hikari design system
// Component demo block — live preview + source with a segmented toggle in
// the header. Pure style family (same convention as .hi-code-block): no
// Rust emitter in this crate; downstream emitters (static site generators,
// markdown renderers) output the markup:
//
//   <div class="hi-component-demo">
//     <div class="hi-component-demo-header">
//       <span class="hi-component-demo-badge">mermaid</span>
//       <div class="hi-component-demo-toggle" role="tablist">
//         <button class="hi-component-demo-toggle-btn hi-component-demo-toggle-active">Preview</button>
//         <button class="hi-component-demo-toggle-btn">Source</button>
//       </div>
//     </div>
//     <div class="hi-component-demo-preview">…rendered output…</div>
//     <div class="hi-component-demo-source" hidden>…a code block…</div>
//   </div>

.hi-component-demo {
    background-color: var(--hi-color-bg-container, var(--hi-color-surface));
    border: 1px solid var(--hi-color-border);
    border-radius: 8px;
    margin: 1.5rem 0;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.hi-component-demo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.4rem 0.75rem;
    background-color: var(--hi-color-surface-secondary, var(--hi-secondary-bg));
    border-bottom: 1px solid var(--hi-color-border);
}

.hi-component-demo-badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--hi-color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: 'Courier New', monospace;
}

// Segmented preview/source toggle (pill variant of the Tabs language).
.hi-component-demo-toggle {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    background: var(--hi-color-surface-secondary, var(--hi-secondary-bg));
    border: 1px solid var(--hi-color-border);
    border-radius: 999px;
}

.hi-component-demo-toggle-btn {
    appearance: none;
    border: none;
    background: transparent;
    border-radius: 999px;
    padding: 0.15rem 0.7rem;
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--hi-color-text-secondary);
    cursor: pointer;
    transition: background var(--hi-duration-fast, 0.2s) var(--hi-ease-default, ease),
        color var(--hi-duration-fast, 0.2s) var(--hi-ease-default, ease);

    &:hover {
        color: var(--hi-color-text-primary);
    }

    &.hi-component-demo-toggle-active {
        background: var(--hi-color-bg-container, var(--hi-color-surface));
        color: var(--hi-color-text-primary);
        font-weight: 600;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
    }
}

.hi-component-demo-preview {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 1.5rem;
    overflow-x: auto;

    > svg,
    > img,
    > .mermaid {
        max-width: 100%;
    }
}

// The source pane hosts a regular code block; strip its outer chrome so it
// sits flush inside the demo container (its own header keeps the copy
// button reachable).
.hi-component-demo-source {
    > .hi-code-highlight,
    > .hi-code-block {
        border: none;
        border-radius: 0;
        margin: 0;
        box-shadow: none;
    }
}

// Render-failure notice shown in place of (or above) the preview.
.hi-component-demo-error {
    margin: 1rem 1.5rem 0;
    padding: 0.75rem 1rem;
    background-color: rgba(233, 75, 53, 0.1);
    border: 1px solid var(--hi-color-danger);
    border-radius: 8px;
    color: var(--hi-color-danger);
    font-size: 0.875rem;
}