Skip to content

Commit 58c1ef8

Browse files
authored
Merge branch 'master' into select
2 parents 4692ce0 + fef25d3 commit 58c1ef8

File tree

4 files changed

+24
-17
lines changed

4 files changed

+24
-17
lines changed

src/inline-loading/inline-loading.component.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ import {
1212
<div class="bx--inline-loading__animation">
1313
<div
1414
*ngIf="success === false"
15-
class="bx--loading bx--loading--small">
15+
class="bx--loading bx--loading--small"
16+
[ngClass]="{
17+
'bx--loading--stop': !isActive
18+
}">
1619
<svg class="bx--loading__svg" viewBox="-75 -75 150 150">
1720
<circle cx="0" cy="0" r="37.5"></circle>
1821
</svg>
@@ -30,22 +33,20 @@ import {
3033
export class InlineLoading {
3134
/**
3235
* Specify the text description for the loading state.
33-
*
34-
* @memberof InlineLoading
3536
*/
3637
@Input() loadingText;
3738
/**
3839
* Specify the text description for the success state.
39-
*
40-
* @memberof InlineLoading
4140
*/
4241
@Input() successText;
4342
/**
4443
* Provide a delay for the `setTimeout` for success.
45-
*
46-
* @memberof InlineLoading
4744
*/
4845
@Input() successDelay = 1500;
46+
/**
47+
* set to `false` to stop the loading animation
48+
*/
49+
@Input() isActive = true;
4950

5051
/**
5152
* Returns value `true` if the component is in the success state.
@@ -69,16 +70,13 @@ export class InlineLoading {
6970
* Emits event after the success state is active
7071
*
7172
* @type {EventEmitter<any>}
72-
* @memberof InlineLoading
7373
*/
7474
@Output() onSuccess: EventEmitter<any> = new EventEmitter();
7575

7676
@HostBinding("class.bx--inline-loading") loadingClass = true;
7777

7878
/**
7979
* Set to `true` if the action is completed successfully.
80-
*
81-
* @memberof InlineLoading
8280
*/
8381
protected _success = false;
8482
}

src/inline-loading/inline-loading.stories.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { storiesOf, moduleMetadata } from "@storybook/angular";
22
import { withNotes } from "@storybook/addon-notes";
33
import { action } from "@storybook/addon-actions";
4-
import { withKnobs, boolean, object } from "@storybook/addon-knobs/angular";
4+
import { withKnobs, text, object } from "@storybook/addon-knobs/angular";
55

66
import { InlineLoadingModule, ButtonModule } from "../";
77

@@ -19,7 +19,7 @@ storiesOf("Inline Loading", module)
1919
`,
2020
props: {
2121
onSuccess: action("onSuccess"),
22-
loadingText: "Loading data...",
23-
successText: "Data loaded."
22+
loadingText: text("The loading text", "Loading data..."),
23+
successText: text("The success text", "Data loaded.")
2424
}
2525
}));

src/loading/loading.component.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ import { I18n } from "./../i18n/i18n.module";
55
selector: "ibm-loading",
66
template: `
77
<div
8-
[ngClass]="{'bx--loading--small': size === 'sm'}"
8+
[ngClass]="{
9+
'bx--loading--small': size === 'sm',
10+
'bx--loading--stop': !isActive && !overlay,
11+
'bx--loading-overlay--stop': !isActive && overlay
12+
}"
913
class="bx--loading">
1014
<svg class="bx--loading__svg" viewBox="-75 -75 150 150">
1115
<title>{{title}}</title>
@@ -21,17 +25,21 @@ export class Loading {
2125
*/
2226
@Input() title = this.i18n.get().LOADING.TITLE;
2327

28+
/**
29+
* set to `false` to stop the loading animation
30+
* @type {boolean}
31+
*/
32+
@Input() isActive = true;
33+
2434
/**
2535
* Specify the size of the button
2636
* @type {("normal" | "sm")}
27-
* @memberof Loading
2837
*/
2938
@Input() size: "normal" | "sm" = "normal";
3039

3140
/**
3241
* Set to `true` to make loader with an overlay.
3342
* @type {boolean}
34-
* @memberof Loading
3543
*/
3644
@Input() @HostBinding("class.bx--loading-overlay") overlay = false;
3745

src/loading/loading.stories.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ storiesOf("Loading", module).addDecorator(
1212
.addDecorator(withKnobs)
1313
.add("Basic", () => ({
1414
template: `
15-
<ibm-loading [size]="size" [overlay]="overlay"></ibm-loading>
15+
<ibm-loading [isActive]="isActive" [size]="size" [overlay]="overlay"></ibm-loading>
1616
`,
1717
props: {
18+
isActive: boolean("Active", true),
1819
overlay: boolean("With overlay", false),
1920
size: select("Size of the loading circle", ["normal", "sm"], "normal")
2021
}

0 commit comments

Comments
 (0)