1.1.1 • Published 9 months ago

rt-tab-carousel v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

RT-TAB-CAROUSEL

npm.io npm.io

Install

yarn add rt-tab-carousel

or

npm install rt-tab-carousel

rtCarouselContainer

Use for a ready-made container in which all the items lie

OptionDefaultTypeDescription
scrollStep1Input
uuidCarousel *requirednullInputThis is a required property that indicates ownership and creates relationships between controls, containers, and items
activeClassnullInputApply class for styling for the last selected tab
antiBounce5InputAnti bounce for scrolling

IMPORTANT USE trackBy for *ngFor

rtCarouselTab

OptionDefaultTypeDescription
disabledTabfalseInput
uuidCarouselnull *requiredInputThis is a required property that indicates ownership and creates relationships between controls, containers, and items. Please, take note, that applying the same UUID to the different carousels will cause a specific behavior: the service will treat them as the same item that will cause arrows to appear on every navigation no matter the real content visibility

rtCarouselNextButton rtCarouselPreviousButton

OptionDefaultTypeDescription
activeClassfalseInputApplies the given class to the active item
uuidCarouselnull *requiredInputThis is a required property that indicates ownership and creates relationships between controls, containers, and items
autoHidetrueInputIf the content is placed in the container, the button will disappear automatically
buttonHiddenOutputboolean

Button components

<rt-carousel-previous-button></rt-carousel-previous-button>
<rt-carousel-next-button></rt-carousel-next-button>
OptionDefaultTypeDescription
uuidCarouselnull *requiredInputThis is a required property that indicates ownership and creates relationships between controls, containers, and items
autoHidetrueInputIf the content is placed in the container, the button will disappear automatically

Service

RtCarouselService

OptionInputOutput
setScrollStep(string, number)uuidCarousel, valuevoid
previousPart(string)uuidCarouselvoid
nextPart(string)uuidCarouselvoid
selectedTab(string)uuidCarouselObservable\
selectTab(string)uuidCarouselvoid
lastVisibleIndex(string)uuidCarouselObservable\
lastVisibleIndexEnd(string)uuidCarouselObservable\
isLastTabVisible(string)uuidCarouselObservable\
isFirstTabVisible(string)uuidCarouselObservable\

Usages Directive

rt-carousel-directive-example.ts

import {ChangeDetectionStrategy, Component} from '@angular/core';

@Component({
  selector: 'rt-tab-carousel-directive-example',
  templateUrl: './rt-tab-carousel-root.component.html',
  styleUrls: ['./rt-tab-carousel-root.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class RtCarouselRootComponent {
  disableTab = false;
  selectedTabIndex: number;

  selectedTab(index: number): void {
    this.selectedTabIndex = index;
  }
}

rt-carousel-directive-example.html

<div class="rt-carousel-directive-example">

  <div
    rtCarouselPreviousButton
    [uuidCarousel]="'first-carousel'"
    [activeClass]="'rt-carousel__shadow-left-array'"
    class="rt-carousel__next-part"
  >
    <img ngSrc="/assets/images/icons/icn_chevron-left.svg" alt="" height="24" width="24">
  </div>

  <nav
    rtCarouselContainer
    [uuidCarousel]="'first-carousel'"
    [scrollStep]="4"
  >

    <div
      *ngFor="let tab of [].constructor(50); let index=index; trackBy: trackByFn"
      class="tab"
      [ngClass]="{'tab__active': selectedTabIndex === index}"
      rtCarouselTab
      [uuidCarousel]="'first-carousel'"
      [disabledTab]="disableTab"
    >
      First {{index + 1}}
    </div>

  </nav>


  <div
    rtCarouselNextButton
    [uuidCarousel]="'first-carousel'"
    [activeClass]="'rt-carousel__shadow-right-array'"
    class="rt-carousel__next-part"
  >
    <img ngSrc="/assets/images/icons/icn_chevron-right.svg" alt="" height="24" width="24">
  </div>

</div>

Note that you can also use ready-made button components

<rt-carousel-previous-button uuidCarousel="carousel-text-book"></rt-carousel-previous-button>
<rt-carousel-next-button uuidCarousel="carousel-text-book"></rt-carousel-next-button>

rt-carousel-directive-example.scss

.rt-carousel-example {
  display: flex;
  flex-direction: column;
  margin: 20px;
}

.rt-carousel-directive-example {
  display: flex;
  align-items: center;
  height: 100px;
  margin: 20px;
}

.tab {
  padding: 10px;
}

.tab__active {
  border-bottom: #6a88d9 solid 2px;
}

.rt-carousel-tab__disabled {
  opacity: .6;
  pointer-events: none;
}

.rt-carousel__next-part {
  cursor: pointer;
  width: 24px;
  align-items: center;
  display: flex;
  z-index: 1;
  transition: box-shadow .3s;
}

.rt-carousel__shadow-left-array {
  box-shadow: 10px 0 10px -10px #000000b5;
  border-right: solid 0.3px;
  border-image: linear-gradient(to bottom, transparent, #0e0e0e, rgb(0 0 0 / 0%)) 0 100%;
  height: 100%;
  align-items: center;
  display: flex;
}

.rt-carousel__shadow-right-array {
  box-shadow: -10px 0 10px -10px #000000b5;
  border-left: solid 0.3px;
  border-image: linear-gradient(to bottom, transparent, #0e0e0e, rgb(0 0 0 / 0%)) 0 100%;
  height: 100%;
  align-items: center;
  display: flex;
}

https://www.regulus.team/

1.1.1

9 months ago

1.1.0

9 months ago

1.0.22

11 months ago

1.0.21

11 months ago

1.0.20

11 months ago

1.0.19

11 months ago

1.0.18

11 months ago

1.0.17

11 months ago

1.0.16

11 months ago

1.0.15

11 months ago

1.0.14

11 months ago

1.0.13

11 months ago

1.0.12

11 months ago

1.0.11

11 months ago

1.0.10

11 months ago

1.0.9

11 months ago

1.0.8

11 months ago

1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

11 months ago

0.0.0-watch

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago