Skip to content

The Open Standard for Generative UI

6.4 KB
Raw Blame
@use "../../cssUtils" as cssUtils;
@use "./sidebar.scss";
@use "./historyMenu.scss";
@use "./themeModeToggle.scss";
@use "./threadlist.scss";
@use "./thread.scss";
@use "./threadHeader.scss";
@use "./renameChatDialog.scss";
@use "./mobileHeader.scss";
@use "./resizableSeparator.scss";
@use "./conversationStarter.scss";
@use "./welcomeScreen.scss";
@use "./welcomeGlow.scss";
@use "./components/desktopWelcomeComposer.scss";
@use "./components/welcomePrefillChips.scss";
@use "./components/composer.scss";
@use "./components/ambientLoader.scss";
@use "./components/mascotLoader.scss";
@use "./components/welcomeMascot.scss";
@use "./artifactBrowser.scss";
@use "./workspaceSidebar.scss";
@use "./_shared/shared.scss";

// Covers the interface while saved preferences are restored, on the
// container's own surface, then fades out to reveal it (see Container.tsx).
.openui-agent-container__restore-loader {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  background: inherit;
  transition: opacity 200ms ease-out;

  &--exiting {
    opacity: 0;
    pointer-events: none;
  }

  @media (prefers-reduced-motion: reduce) {
    transition: none;
  }
}

.openui-agent-container {
  display: flex;
  position: relative;
  height: 100dvh;
  width: 100dvw;
  overflow: hidden;

  // Shell surface the sidebar sits on: the card surface pulled 40% toward the
  // page background, so it reads as a faint grey under the white thread card
  // in light mode and as a darker well under the card in dark mode (see
  // thread.scss). Mobile stays a single flat surface.
  background: color-mix(in oklch, cssUtils.$background 40%, cssUtils.$foreground);
  box-sizing: border-box;
  & * {
    box-sizing: border-box;
  }

  &.openui-agent-container--mobile {
    padding: 0;
    background: cssUtils.$foreground;
  }

  // Until saved preferences are restored (see Container.tsx).
  &.openui-agent-container--restoring > :not(.openui-agent-container__restore-loader) {
    visibility: hidden;
  }

  // Until the restored state has settled (see Container.tsx).
  // The restore loader keeps its fade-out.
  &[data-openui-settling],
  &[data-openui-settling] *:not(.openui-agent-container__restore-loader) {
    transition: none !important;
  }
}

// Collapsed rail spacing: mark, then a 12px gap to the round actions.
.openui-agent-sidebar-container--collapsed {
  .openui-agent-sidebar-actions {
    gap: cssUtils.$space-m;
  }

  .openui-agent-sidebar-primary-actions {
    gap: cssUtils.$space-m;
  }
}

.openui-agent-sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: cssUtils.$space-2xl;

  .openui-agent-container--mobile & {
    gap: 0;
  }
}

.openui-agent-sidebar-primary-actions,
.openui-agent-sidebar-artifact-nav {
  display: flex;
  flex-direction: column;
  gap: cssUtils.$space-xs;

  .openui-agent-container--mobile & {
    gap: cssUtils.$space-xl;
  }
}

.openui-agent-container--mobile .openui-agent-sidebar-artifact-nav {
  margin-top: cssUtils.$space-2xl;
  padding: 0 cssUtils.$space-m-l;
}

.openui-agent-new-chat-button {
  @include cssUtils.button-reset;
  @include cssUtils.typography(label, small);

  width: 100%;
  display: flex;
  align-items: center;
  gap: cssUtils.$space-2xs;
  justify-content: flex-start;
  color: cssUtils.$text-neutral-primary;
  border-radius: calc(cssUtils.$radius-s + 1px);
  cursor: pointer;
  overflow: hidden;
  transition: background-color 90ms cubic-bezier(0.22, 1, 0.36, 1);

  &:not(&--collapsed):hover {
    background-color: cssUtils.$highlight;
  }

  &--collapsed:hover {
    background-color: transparent;

    .openui-agent-new-chat-button__icon {
      background-color: cssUtils.$highlight;
    }
  }

  &__icon {
    width: 28px;
    height: 28px;
    margin: cssUtils.$space-3xs;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: cssUtils.$radius-s;
    color: cssUtils.$text-neutral-primary;
    font-size: 16px;
    transition:
      background-color 90ms cubic-bezier(0.22, 1, 0.36, 1),
      color 90ms cubic-bezier(0.22, 1, 0.36, 1),
      box-shadow 90ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  &__label {
    opacity: 1;
    white-space: nowrap;
    transition: opacity 90ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  &--collapsed {
    width: 32px;
    gap: 0;

    .openui-agent-new-chat-button__label {
      width: 0;
      opacity: 0;
      overflow: hidden;
    }

    // Collapsed rail: the primary action is a filled round button.
    .openui-agent-new-chat-button__icon {
      width: 32px;
      height: 32px;
      margin: 0;
      border-radius: cssUtils.$radius-full;
      background-color: cssUtils.$inverted-background;
      color: cssUtils.$foreground;
      font-size: 14px;
    }

    &:hover .openui-agent-new-chat-button__icon {
      background-color: cssUtils.$inverted-background;
      opacity: 0.85;
    }
  }
}

// Collapsed rail: secondary round button that opens the thread history.
.openui-agent-history-button {
  @include cssUtils.button-reset;

  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: cssUtils.$radius-full;
  background-color: cssUtils.$sunk-deep;
  color: cssUtils.$text-neutral-primary;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 90ms cubic-bezier(0.22, 1, 0.36, 1);

  &:hover {
    background-color: cssUtils.$highlight-strong;
  }

  &:focus-visible {
    outline: 2px solid cssUtils.$border-interactive;
    outline-offset: 2px;
  }
}

.openui-agent-new-chat-floating-button {
  position: absolute;
  left: cssUtils.$space-m-l;
  bottom: cssUtils.$space-l;
  z-index: 1;
}

// Same filled neutral treatment as the collapsed-rail New chat button.
.openui-agent-container .openui-agent-new-chat-floating-button.openui-button-base {
  border-color: transparent;
  border-radius: cssUtils.$radius-full;
  background-color: cssUtils.$inverted-background;
  color: cssUtils.$foreground;

  &:not(:disabled):hover,
  &:not(:disabled):active {
    background-color: cssUtils.$inverted-background;
    opacity: 0.85;
  }
}

.openui-agent-tooltip,
.openui-agent-sidebar-tooltip {
  @include cssUtils.typography(label, extra-small);

  z-index: 10000;
  padding: cssUtils.$space-xs cssUtils.$space-s;
  border: 1px solid cssUtils.$border-default;
  border-radius: cssUtils.$radius-m;
  background-color: cssUtils.$inverted-background;
  color: cssUtils.$foreground;
  box-shadow: cssUtils.$shadow-m;
}