fc-dioxus 0.1.2

Typed, accessible Dioxus components over future-css
Documentation
/*!
 * future-css -- https://github.com/estith/future-css
 * A styling system for multi-language, multi-platform systems
 *
 * Regenerate with: npm run build
 * This file is generated; edit the sources in src/ instead.
 */
/*!
 * future-css -- badge and tag
 *
 * A badge is a static label: a status, a count, a category. It is not
 * interactive and is not focusable. A tag is the interactive cousin: it can be
 * toggled (a filter chip, `aria-pressed`) or removed (an input token with its
 * own remove button).
 *
 * Tone is never the only signal. A badge that says "Failed" in red also says
 * "Failed"; the colour is reinforcement for sighted users, not the message.
 */

@layer fc.components {
  .fc-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--fc-space-1);
    max-inline-size: 100%;
    padding-block: var(--fc-space-0-5);
    padding-inline: var(--fc-space-2);

    background-color: var(--fc-color-bg-muted);
    color: var(--fc-color-text-muted);
    border: var(--fc-border-width-thin) solid transparent;
    border-radius: var(--fc-radius-full);

    font-size: var(--fc-font-size-xs);
    font-weight: var(--fc-font-weight-medium);
    line-height: var(--fc-line-height-snug);
    white-space: nowrap;
    vertical-align: middle;
  }

  .fc-badge--accent {
    background-color: var(--fc-color-accent-bg-subtle);
    color: var(--fc-color-accent-text);
  }

  .fc-badge--success {
    background-color: var(--fc-color-success-bg-subtle);
    color: var(--fc-color-success-text);
  }

  .fc-badge--warning {
    background-color: var(--fc-color-warning-bg-subtle);
    color: var(--fc-color-warning-text);
  }

  .fc-badge--danger {
    background-color: var(--fc-color-danger-bg-subtle);
    color: var(--fc-color-danger-text);
  }

  .fc-badge--info {
    background-color: var(--fc-color-info-bg-subtle);
    color: var(--fc-color-info-text);
  }

  /* The one solid tone with a checked foreground pair (text-on-accent). */
  .fc-badge--solid {
    background-color: var(--fc-color-accent-bg);
    color: var(--fc-color-text-on-accent);
  }

  /* Outlined: for dense tables, where a filled pill per row is visual noise. */
  .fc-badge--outline {
    background-color: transparent;
    border-color: currentColor;
  }

  .fc-badge--square {
    border-radius: var(--fc-radius-sm);
  }

  /* Counts: tabular figures so a changing number does not jiggle its neighbours. */
  .fc-badge--count {
    justify-content: center;
    min-inline-size: 1.25rem;
    padding-inline: var(--fc-space-1-5);
    font-variant-numeric: tabular-nums;
  }

  /*
   * A status dot. Decorative: the badge text carries the meaning, so the dot is
   * aria-hidden in the markup.
   */
  .fc-badge__dot {
    flex-shrink: 0;
    inline-size: 0.375rem;
    block-size: 0.375rem;
    border-radius: var(--fc-radius-full);
    background-color: currentColor;
  }

  .fc-badge__label {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* ---- Keyboard key ---------------------------------------------------- */

  /*
   * Keyboard shortcuts, as in "Press <kbd>Enter</kbd> to send". The raised edge
   * is a border, not a shadow, so it survives forced colours.
   */
  .fc-kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-inline-size: 1.5em;
    padding-inline: 0.35em;
    background-color: var(--fc-color-bg-surface);
    color: var(--fc-color-text-muted);
    border: var(--fc-border-width-thin) solid var(--fc-color-border-default);
    border-block-end-width: var(--fc-border-width-thick);
    border-radius: var(--fc-radius-sm);
    font-family: var(--fc-font-family-mono);
    font-size: 0.8em;
    line-height: 1.6;
  }

  /* ---- Tag ------------------------------------------------------------- */

  .fc-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--fc-space-1);
    min-block-size: 2rem;
    max-inline-size: 100%;
    padding-inline: var(--fc-space-3);

    background-color: var(--fc-color-bg-surface);
    color: var(--fc-color-text-default);
    border: var(--fc-border-width-thin) solid var(--fc-color-border-default);
    border-radius: var(--fc-radius-full);

    font-family: inherit;
    font-size: var(--fc-font-size-sm);
    line-height: var(--fc-line-height-snug);
    white-space: nowrap;

    transition:
      background-color var(--fc-duration-fast) var(--fc-easing-standard),
      border-color var(--fc-duration-fast) var(--fc-easing-standard),
      color var(--fc-duration-fast) var(--fc-easing-standard);
  }

  /* Only a tag that is itself a button reacts to the pointer. */
  button.fc-tag {
    cursor: pointer;
  }

  button.fc-tag:hover {
    background-color: var(--fc-color-bg-muted);
    border-color: var(--fc-color-border-strong);
  }

  /*
   * A toggled filter chip. aria-pressed is the state, and the only one: there is
   * no `is-selected` class to fall out of step with what a screen reader hears.
   */
  .fc-tag[aria-pressed="true"] {
    background-color: var(--fc-color-selected-bg);
    color: var(--fc-color-selected-fg);
    border-color: var(--fc-color-accent-border);
  }

  .fc-tag[aria-pressed="true"]::before {
    content: "\2713" / "";
    font-weight: var(--fc-font-weight-bold);
  }

  .fc-tag:disabled,
  .fc-tag[aria-disabled="true"] {
    color: var(--fc-color-disabled-fg);
    border-color: var(--fc-color-disabled-border);
    cursor: not-allowed;
  }

  .fc-tag__label {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /*
   * The remove control is its own button with its own name ("Remove Rust"), not
   * a click handler on the tag: a tag that removes itself when clicked anywhere
   * is impossible to inspect and easy to trigger by accident.
   */
  .fc-tag__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: var(--fc-size-target-min);
    block-size: var(--fc-size-target-min);
    margin-inline-end: calc(var(--fc-space-2) * -1);
    padding: 0;
    background-color: transparent;
    color: var(--fc-color-text-muted);
    border: 0;
    border-radius: var(--fc-radius-full);
    font-size: var(--fc-font-size-md);
    line-height: 1;
    cursor: pointer;
  }

  .fc-tag__remove:hover {
    background-color: var(--fc-color-bg-muted);
    color: var(--fc-color-text-default);
  }

  .fc-tag__remove:active {
    background-color: var(--fc-color-border-subtle);
  }

  /* ---- Forced colors --------------------------------------------------- */

  @media (forced-colors: active) {
    .fc-badge {
      border-color: CanvasText;
    }

    .fc-tag[aria-pressed="true"] {
      border-color: Highlight;
      border-width: var(--fc-border-width-thick);
    }
  }
}