UNPKG

@taiga-ui/kit

Version:
16 lines (14 loc) • 8.64 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@taiga-ui/cdk"),require("@taiga-ui/core"),require("rxjs"),require("rxjs/operators"),require("@angular/common")):"function"==typeof define&&define.amd?define("@taiga-ui/kit/components/stepper",["exports","@angular/core","@taiga-ui/cdk","@taiga-ui/core","rxjs","rxjs/operators","@angular/common"],t):t(((e=e||self)["taiga-ui"]=e["taiga-ui"]||{},e["taiga-ui"].kit=e["taiga-ui"].kit||{},e["taiga-ui"].kit.components=e["taiga-ui"].kit.components||{},e["taiga-ui"].kit.components.stepper={}),e.ng.core,e.cdk,e.core$1,e.rxjs,e.rxjs.operators,e.ng.common)}(this,(function(e,t,r,o,i,n,a){"use strict"; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */function s(e,t,r,o){var i,n=arguments.length,a=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a}function c(e,t){return function(r,o){t(r,o,e)}}var u=function(){function e(){this.orientation="horizontal",this.activeItemIndex=0,this.activeItemIndexChange=new t.EventEmitter,this.steps=r.EMPTY_QUERY}return Object.defineProperty(e.prototype,"changes$",{get:function(){return r.itemsQueryListObservable(this.steps).pipe(n.delay(0))},enumerable:!0,configurable:!0}),e.prototype.indexOf=function(e){return r.getOriginalArrayFromQueryList(this.steps).findIndex((function(t){return t.nativeElement===e}))},e.prototype.isActive=function(e){return e===this.activeItemIndex},e.prototype.activate=function(e){this.activeItemIndex!==e&&(this.activeItemIndex=e,this.activeItemIndexChange.emit(e))},e.prototype.onHorizontal=function(e,t){"horizontal"===this.orientation&&e.target&&(e.preventDefault(),this.moveFocus(e.target,t))},e.prototype.onVertical=function(e,t){"vertical"===this.orientation&&e.target&&(e.preventDefault(),this.moveFocus(e.target,t))},e.prototype.moveFocus=function(e,t){var o=r.getOriginalArrayFromQueryList(this.steps).map((function(e){return e.nativeElement}));r.moveFocus(o.indexOf(e),o,t)},s([t.Input(),t.HostBinding("attr.data-orientation"),r.tuiDefaultProp()],e.prototype,"orientation",void 0),s([t.Input(),r.tuiDefaultProp()],e.prototype,"activeItemIndex",void 0),s([t.Output()],e.prototype,"activeItemIndexChange",void 0),s([t.ContentChildren(t.forwardRef((function(){return p})),{read:t.ElementRef})],e.prototype,"steps",void 0),s([r.tuiPure],e.prototype,"changes$",null),s([t.HostListener("keydown.arrowRight",["$event","1"]),t.HostListener("keydown.arrowLeft",["$event","-1"])],e.prototype,"onHorizontal",null),s([t.HostListener("keydown.arrowDown",["$event","1"]),t.HostListener("keydown.arrowUp",["$event","-1"])],e.prototype,"onVertical",null),e=s([t.Component({selector:"tui-stepper, nav[tuiStepper]",template:'<ng-container *ngIf="changes$ | async"></ng-container>\n<ng-content></ng-content>\n',changeDetection:t.ChangeDetectionStrategy.OnPush,host:{class:"tui-zero-scrollbar"},styles:[":host{display:flex;overflow:auto;counter-reset:steps}:host[data-orientation=vertical]{flex-direction:column}"]})],e)}(),p=function(){function e(e,t,o,i){var a=this;this.stepper=o,this.elementRef=i,this.state="normal",this.icon="",this.focusVisible=!1,t.pipe(n.filter(r.identity)).subscribe((function(){a.activate()})),e.subscribe((function(e){a.focusVisible=e}))}return Object.defineProperty(e.prototype,"isActive",{get:function(){return this.stepper.isActive(this.index)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isVertical",{get:function(){return"vertical"===this.stepper.orientation},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabIndex",{get:function(){return this.isActive?0:-1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){return this.stepper.indexOf(this.elementRef.nativeElement)},enumerable:!0,configurable:!0}),e.prototype.activate=function(){this.stepper.activate(this.index)},e.ctorParameters=function(){return[{type:r.TuiFocusVisibleService,decorators:[{type:t.Inject,args:[r.TuiFocusVisibleService]}]},{type:i.Observable,decorators:[{type:t.Inject,args:[o.TuiRouterLinkActiveService]}]},{type:u,decorators:[{type:t.Inject,args:[u]}]},{type:t.ElementRef,decorators:[{type:t.Inject,args:[t.ElementRef]}]}]},s([t.Input(),t.HostBinding("attr.data-state"),r.tuiDefaultProp()],e.prototype,"state",void 0),s([t.Input(),r.tuiDefaultProp()],e.prototype,"icon",void 0),s([t.HostBinding("class._focus-visible")],e.prototype,"focusVisible",void 0),s([t.HostBinding("class._active")],e.prototype,"isActive",null),s([t.HostBinding("class._vertical")],e.prototype,"isVertical",null),s([t.HostBinding("tabIndex")],e.prototype,"tabIndex",null),s([t.HostListener("click")],e.prototype,"activate",null),e=s([t.Component({selector:"button[tuiStep], a[tuiStep]:not([routerLink]), a[tuiStep][routerLink][routerLinkActive]",template:'<tui-svg *ngIf="icon" class="marker marker_custom" [src]="icon"></tui-svg>\n<tui-svg class="marker marker_error" src="tuiIconWarningLarge"></tui-svg>\n<tui-svg class="marker marker_pass" src="tuiIconCheckLarge"></tui-svg>\n<div class="marker marker_index"></div>\n<ng-content></ng-content>\n',changeDetection:t.ChangeDetectionStrategy.OnPush,providers:[r.TuiDestroyService,o.TuiRouterLinkActiveService,r.TuiFocusVisibleService],host:{type:"button"},styles:[":host{-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:0;border:0;background:0 0;font-size:inherit;line-height:inherit;position:relative;display:flex;align-items:center;flex-shrink:0;color:var(--tui-link);margin-right:32px;outline:0;cursor:pointer;text-decoration:none;counter-increment:steps}:host:disabled{pointer-events:none;color:var(--tui-base-07)}:host:hover{color:var(--tui-link-hover)}:host:not(:last-of-type)._vertical{margin-bottom:20px}:host._active,:host._active:hover{color:var(--tui-text-01);cursor:default}:host._focus-visible:before{content:'';position:absolute;left:44px;right:0;top:50%;height:24px;margin-top:-12px;background:var(--tui-selection)}.marker{transition-property:background;transition-duration:.3s;transition-timing-function:ease-in-out;display:flex;width:32px;height:32px;border-radius:100%;margin-right:12px;flex-shrink:0;align-items:center;justify-content:center;background:var(--tui-secondary);color:var(--tui-link)}:host:disabled .marker{background:var(--tui-base-03);color:var(--tui-base-07)}.marker_index:before{content:counter(steps)}:host:hover .marker_index{color:var(--tui-link-hover);background:var(--tui-secondary-hover)}:host._active .marker_index{color:var(--tui-primary-text);background:var(--tui-primary)}:host:not(._active) .marker_custom~.marker_index,:host:not([data-state=normal]):not(._active) .marker_index{display:none}.marker_error{background:var(--tui-error-bg);color:var(--tui-error-fill)}:host:hover .marker_error{background:var(--tui-error-bg-hover);color:var(--tui-error-fill)}:host._active .marker_error,:host:not([data-state=error]) .marker_error{display:none}:host._active .marker_pass,:host:not([data-state=pass]) .marker_pass{display:none}:host._active .marker_custom,:host:not([data-state=normal]) .marker_custom{display:none}:host:hover .marker_custom{color:var(--tui-link-hover);background:var(--tui-secondary-hover)}"]}),c(0,t.Inject(r.TuiFocusVisibleService)),c(1,t.Inject(o.TuiRouterLinkActiveService)),c(2,t.Inject(u)),c(3,t.Inject(t.ElementRef))],e)}(),l=function(){function e(){}return e=s([t.NgModule({imports:[a.CommonModule,o.TuiSvgModule],declarations:[u,p],exports:[u,p]})],e)}();e.TuiStepComponent=p,e.TuiStepperComponent=u,e.TuiStepperModule=l,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=taiga-ui-kit-components-stepper.umd.min.js.map