Skip to content

Commit 34fc1c4

Browse files
committed
Added Transition documentation
1 parent babf4d4 commit 34fc1c4

File tree

11 files changed

+123
-2
lines changed

11 files changed

+123
-2
lines changed

components/select/select.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ export class SuiSelect implements AfterContentInit, AfterViewInit {
100100
private set query(value:string) {
101101
this._searchService.updateQuery(value);
102102
this.isOpen = true;
103+
this.focusFirstItem();
103104
}
104105

105106
@Output()
@@ -220,6 +221,13 @@ export class SuiSelect implements AfterContentInit, AfterViewInit {
220221
}
221222
}
222223

224+
private focusFirstItem() {
225+
setTimeout(() => {
226+
this._dropdownService.selectedItem = null;
227+
this._dropdownService.selectNextItem();
228+
});
229+
}
230+
223231
public writeValue(value:any) {
224232
if (value) {
225233
this.selectedOption = value;

components/transition/transition.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export interface ISuiAnimation {
44
name:string;
55
classes?:string[];
66
duration?:number;
7+
static?:boolean;
78
display?:string;
89
direction?:string;
910
callback?:() => any;
@@ -75,6 +76,9 @@ export class SuiTransition {
7576
if (!animation.display) {
7677
animation.display = 'block';
7778
}
79+
if (!animation.static) {
80+
animation.static = ["jiggle", "flash", "shake", "pulse", "tada", "bounce"].indexOf(animation.name) != -1;
81+
}
7882
if (!animation.direction) {
7983
animation.direction = this.isVisible ? "out" : "in";
8084
let queueLast = this.queueFirst();
@@ -117,6 +121,9 @@ export class SuiTransition {
117121
this.renderer.setElementStyle(this.el.nativeElement, `display`, null);
118122

119123
this.isVisible = animation.direction == "in" ? true : false;
124+
if (animation.static) {
125+
this.isVisible = !this.isVisible;
126+
}
120127

121128
if (animation.callback) {
122129
animation.callback();

demo/app/app.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<a class="item" routerLink="/components/search" routerLinkActive="active">Search</a>
2929
<a class="item" routerLink="/components/select" routerLinkActive="active">Select</a>
3030
<a class="item" routerLink="/components/tabs" routerLinkActive="active">Tabs</a>
31+
<a class="item" routerLink="/components/transition" routerLinkActive="active">Transition</a>
3132
</div>
3233
</div>
3334
</div>

demo/app/app.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { TabsPageComponents } from "./pages/tabs/tabs.page";
2323
import { TestPage } from "./pages/test/test.page";
2424

2525
import {CodeblockComponent} from './components/codeblock/codeblock.component';
26+
import {TransitionPageComponents} from "./pages/transition/transition.page";
2627

2728
@NgModule({
2829
declarations: [
@@ -46,6 +47,7 @@ import {CodeblockComponent} from './components/codeblock/codeblock.component';
4647
SearchPageComponents,
4748
SelectPageComponents,
4849
TabsPageComponents,
50+
TransitionPageComponents,
4951

5052
TestPage
5153
],

demo/app/app.routing.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {SearchPage} from "./pages/search/search.page";
1414
import {TabsPage} from "./pages/tabs/tabs.page";
1515
import {TestPage} from "./pages/test/test.page";
1616
import {SelectPage} from "./pages/select/select.page";
17+
import {TransitionPage} from "./pages/transition/transition.page";
1718

1819
const appRoutes: Routes = [
1920
{
@@ -64,6 +65,10 @@ const appRoutes: Routes = [
6465
path: 'components/tabs',
6566
component: TabsPage
6667
},
68+
{
69+
path: 'components/transition',
70+
component: TransitionPage
71+
},
6772
{
6873
path: 'test',
6974
component: TestPage

demo/app/components/example/example.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<i class="edit icon visible" (click)="detail = !detail"></i>
1111
</div>
1212
</div>
13-
<div [suiCollapse]="!detail">
13+
<div [suiCollapse]="!detail" *ngIf="code">
1414
<div class="annotation transition visible">
1515
<div class="ui instructive bottom attached segment">
1616
<demo-codeblock language="markup" [src]="code"></demo-codeblock>

demo/app/components/example/example.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ import {Component, Input} from '@angular/core';
99
export class ExampleComponent {
1010
private detail:boolean = false;
1111

12-
@Input() public code:string;
12+
@Input()
13+
public code:string;
1314
}

demo/app/pages/transition/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './transition.page';

demo/app/pages/transition/transition.page.css

Whitespace-only changes.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<demo-page-title>
2+
<div header>Message</div>
3+
<div sub-header>
4+
<p>A message displays information that explains nearby content</p>
5+
</div>
6+
</demo-page-title>
7+
<div class="ui main container">
8+
<div class="ui dividing right rail"></div>
9+
<h2 id="examples" class="ui dividing header">Examples</h2>
10+
<demo-example [code]="exampleStandardTemplate">
11+
<div info>
12+
<h4 class="ui header">Transition</h4>
13+
<p>Transitions can be added to any DOM element</p>
14+
</div>
15+
<transition-example-standard result></transition-example-standard>
16+
</demo-example>
17+
<demo-example>
18+
<div info>
19+
<h4 class="ui header">Advanced</h4>
20+
<p>To make use of more advanced functionality, directly use the SuiTransition class.</p>
21+
</div>
22+
<demo-codeblock result language="typescript" [src]="advancedExampleCode"></demo-codeblock>
23+
</demo-example>
24+
<h2 id="api" class="ui dividing header">API</h2>
25+
<demo-api [api]="api"></demo-api>
26+
</div>

0 commit comments

Comments
 (0)