projects/ngclient/src/app/core/components/file-tree/file-tree.component.scss
@use '@ship-ui/core/styles/helpers' as *;

:host {
  display: flex;
  flex-direction: column;
  gap: p2r(16);

  &.disabled {
    opacity: 0.5;
    user-select: none;
    pointer-events: none;
    position: relative;

    &:before {
      content: '';
      position: absolute;
      inset: 0;
      background: transparent;
    }
  }

  &.fill {
    height: auto;
    overflow: hidden;
    flex: 1 0;

    .section {
      height: auto;
      overflow: hidden;
      flex: 1 0;
      display: grid;
      grid-template-columns: 1fr auto;
      grid-template-rows: auto 1fr;
      grid-template-areas:
        'label toggle'
        'tree tree';
    }

    .browse-files {
      resize: none;
      height: initial;
      grid-area: tree;
    }

    label {
      grid-area: label;
    }

    sh-toggle {
      grid-area: toggle;
      flex-direction: row-reverse;
    }
  }
}

.section {
  display: flex;
  flex-direction: column;
  gap: p2r(8);
}

.form-field.hidden {
  display: none;
}

.browse-files {
  display: flex;
  gap: p2r(8);
  padding: p2r(8 16);
  height: p2r(200);
  border: 1px solid var(--base-4);
  border-radius: var(--shape-3);
  overflow: auto;
  resize: vertical;
  background: var(--base-1);
  position: relative;

  sh-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
  }

  &.visualize-accepted {
    [action]:not(.accepted) {
      opacity: 0.5;
    }

    [action].accepted {
      opacity: 1;
    }
  }

  sh-list {
    --list-active-bg: var(--base-3);

    gap: p2r(2);
    padding: 0;
    height: min-content;
    min-width: min-content;

    [action] {
      padding: 0;
      gap: 0;
      border: 1px solid transparent;

      &.active {
        border-color: transparent;
        --list-active-bg: var(--primary-2);
      }

      &.indeterminate {
        border-color: var(--primary-4);
      }

      &.usually-hidden {
        opacity: 0.6;
      }

      &.root {
        gap: p2r(4);

        .icon:has(sh-icon:nth-child(2)) {
          width: p2r(48);
        }

        .icon {
          width: p2r(24);
        }
      }

      .text {
        flex: 1 0;
        height: 100%;
        width: max-content;
        display: flex;
        align-items: center;
      }

      .icon {
        width: p2r(48);
        gap: p2r(4);
        height: p2r(24);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;

        &.file {
          width: p2r(48);
          padding: p2r(0 4);
        }
      }
    }
  }
}

.browse-files-toggle {
  color: var(--base-9);
}

.hidden {
  display: none;
}

.footer {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}