11import { storiesOf , moduleMetadata } from "@storybook/angular" ;
22import { withNotes } from "@storybook/addon-notes" ;
3- import { withKnobs , boolean } from "@storybook/addon-knobs/angular" ;
3+ import { action } from "@storybook/addon-actions" ;
4+ import { withKnobs , boolean , object } from "@storybook/addon-knobs/angular" ;
45
56import { TranslateModule } from "@ngx-translate/core" ;
67
@@ -18,31 +19,46 @@ storiesOf("Dropdown", module)
1819 . addDecorator ( withKnobs )
1920 . add ( "Basic" , ( ) => ( {
2021 template : `
21- <ibm-dropdown placeholder="Select" [disabled]="disabled">
22- <ibm-dropdown-list [items]="[
23- {content: 'one'},
24- {content: 'two'},
25- {content: 'three'},
26- {content: 'four'}
27- ]"></ibm-dropdown-list>
22+ <ibm-dropdown
23+ placeholder="Select"
24+ [disabled]="disabled"
25+ (selected)="selected($event)"
26+ (onClose)="onClose($event)">
27+ <ibm-dropdown-list [items]="items"></ibm-dropdown-list>
2828 </ibm-dropdown>
2929 ` ,
3030 props : {
3131 disabled : boolean ( "disabled" , false ) ,
32+ items : object ( "items" , [
33+ { content : "one" } ,
34+ { content : "two" } ,
35+ { content : "three" } ,
36+ { content : "four" }
37+ ] ) ,
38+ selected : action ( "Selected fired for dropdown" ) ,
39+ onClose : action ( "Dropdown closed" )
3240 }
3341 } ) )
3442 . add ( "Multi-select" , withNotes ( { text : "Notes on multi select" } ) ( ( ) => ( {
3543 template : `
36- <ibm-dropdown type="multi" placeholder="Multi-select" [disabled]="disabled">
37- <ibm-dropdown-list [items]="[
38- {content: 'one'},
39- {content: 'two'},
40- {content: 'three'},
41- {content: 'four'}
42- ] "></ibm-dropdown-list>
44+ <ibm-dropdown
45+ type="multi"
46+ placeholder="Multi-select"
47+ [disabled]="disabled"
48+ (selected)="selected($event)"
49+ (onClose)="onClose($event)">
50+ <ibm-dropdown-list [items]="items "></ibm-dropdown-list>
4351 </ibm-dropdown>
4452 ` ,
4553 props : {
4654 disabled : boolean ( "disabled" , false ) ,
55+ items : object ( "items" , [
56+ { content : "one" } ,
57+ { content : "two" } ,
58+ { content : "three" } ,
59+ { content : "four" }
60+ ] ) ,
61+ selected : action ( "Selected fired for multi-select dropdown" ) ,
62+ onClose : action ( "Multi-select dropdown closed" )
4763 }
4864 } ) ) ) ;
0 commit comments