+
+
-
+
{{heading}}
@@ -114,16 +100,17 @@ import {Collapse} from '../collapse/collapse';
})
export class AccordionGroup {
private templateUrl:string;
+ private panelClass:string;
private _isOpen:boolean;
public isDisabled:boolean;
- public headingTemplate:any;
- // public templateRef: any;
+ public headingTemplate:TemplateRef;
constructor(private accordion:Accordion) {
}
onInit() {
+ this.panelClass = this.panelClass || 'panel-default';
this.accordion.addGroup(this);
}
@@ -145,7 +132,7 @@ export class AccordionGroup {
public set isOpen(value:boolean) {
this._isOpen = value;
if (value) {
- this.accordion.closeOthers(this);
+ this.accordion.closeOtherGroups(this);
}
}
}
@@ -154,11 +141,9 @@ export class AccordionGroup {
selector: 'accordion-heading, [accordion-heading]'
})
export class AccordionHeading {
- constructor(private group:AccordionGroup, private templateRef: TemplateRef) {
+ constructor(private group:AccordionGroup, private templateRef:TemplateRef) {
group.headingTemplate = templateRef;
}
}
-export const accordion:Array = [
- Accordion, AccordionGroup,
- AccordionHeading, AccordionTransclude];
+export const accordion:Array = [Accordion, AccordionGroup, AccordionHeading];
diff --git a/components/accordion/readme.md b/components/accordion/readme.md
index 7d850b95f2..0be13a963a 100644
--- a/components/accordion/readme.md
+++ b/components/accordion/readme.md
@@ -1,19 +1,49 @@
-The **accordion directive** builds on top of the collapse directive to provide a list of items, with collapsible bodies that are collapsed or expanded by clicking on the item's header.
+### Usage
+```typescript
+import {accordion} from 'ng2-bootstrap';
+```
-We can control whether expanding an item will cause the other items to close, using the `close-others` attribute on accordion.
+### Annotations
+```typescript
+// class Accordion
+@Component({
+ selector: 'accordion, [accordion]',
+ properties: ['templateUrl', 'closeOthers'],
+ host: {
+ '[class.panel-group]': 'true'
+ }
+})
-The body of each accordion group is transcluded in to the body of the collapsible element.
+// class AccordionGroup
+@Component({
+ selector: 'accordion-group, [accordion-group]',
+ properties: ['templateUrl', 'heading', 'isOpen', 'isDisabled', 'panelClass'],
+ host: {
+ '[class.panel-open]': 'isOpen'
+ },
+ lifecycle: [LifecycleEvent.onInit, LifecycleEvent.onDestroy]
+})
-### Accordion Settings ###
+// class AccordionHeading
+@Directive({
+ selector: 'accordion-heading, [accordion-heading]'
+})
- * `is-open` (Defaults: false) :
- Whether accordion group is open or closed.
- * `template-url` (Defaults: `template/accordion/accordion.html`) :
- Add ability to override the template url used
-### Accordion Group Settings ###
+export const accordion:Array = [Accordion, AccordionGroup, AccordionHeading];
+```
- * `panel-class` (Defaults: `panel-default`) :
- Add ability to use Bootstrap's contextual panel classes (panel-primary, panel-success, panel-info, etc...) or your own. This must be a string.
- * `template-url` (Defaults: `template/accordion/accordion-group.html`) :
- Add ability to override the template url used. Note that this must be a string
+### Accordion properties
+ - `close-others` (`?boolean=false`) - if `true` expanding one item will close all others
+ - `template-url` (*not yet supported*) - allows to override the template url of component (default: `components/accordion/accordion.html`)
+
+### Accordion Group properties
+ - `heading` (`?string=''`) - clickable text in accordion's group header
+ - `is-open` (`?boolean=false`) - is accordion group open or closed
+ - `is-disabled` (`?boolean=false`) - if `true` disables accordion group
+ - `panel-class` (`?string='panel-default'`) - provides an ability to use Bootstrap's contextual panel classes (`panel-primary`, `panel-success`, `panel-info`, etc...). List of all available classes [link](http://getbootstrap.com/components/#panels-alternatives)
+ - `template-url` (*not yet supported*) - allows to override the template url of component (default: `components/accordion/accordion-group.html`)
+
+### Accordion heading
+
+Instead of the `heading` attribute on the `accordion-group`, you can use an `accordion-heading` attribute on `template` element inside a group that will be used as the group's header.
diff --git a/components/accordion/title.md b/components/accordion/title.md
new file mode 100644
index 0000000000..6a5218df2b
--- /dev/null
+++ b/components/accordion/title.md
@@ -0,0 +1,3 @@
+The **accordion component** builds on top of the collapse directive to provide a list of items, with collapsible bodies that are collapsed or expanded by clicking on the item's header.
+
+Base specifications: [bootstrap 3](http://getbootstrap.com/javascript/#collapse-example-accordion) or [bootstrap 4](http://v4-alpha.getbootstrap.com/components/collapse/#accordion-example)
diff --git a/components/alert/alert.ts b/components/alert/alert.ts
index 9373cad7b3..cb355fda8a 100644
--- a/components/alert/alert.ts
+++ b/components/alert/alert.ts
@@ -10,7 +10,7 @@ import {
// TODO: templateUrl
@Component({
selector: 'alert',
- properties: ['type', 'dismissOnTimeout: dismiss-on-timeout'],
+ properties: ['type', 'dismissible', 'dismissOnTimeout'],
events: ['close'],
lifecycle: [LifecycleEvent.onInit]
})
@@ -35,8 +35,15 @@ export class Alert {
private closeable:boolean;
private classes:Array = [];
+ private set dismissible(v:boolean){
+ this.closeable = v;
+ }
+ private get dismissible():boolean{
+ return this.closeable;
+ }
+
constructor(public el:ElementRef) {
- this.closeable = el.nativeElement.getAttribute('(close)');
+ this.closeable = this.closeable || el.nativeElement.getAttribute('(close)');
}
onInit() {
@@ -55,8 +62,8 @@ export class Alert {
}
// todo: mouse event + touch + pointer
- onClose($event: MouseEvent) {
- this.close.next($event);
+ onClose() {
+ this.close.next(this);
this.closed = true;
}
}
diff --git a/components/alert/readme.md b/components/alert/readme.md
new file mode 100644
index 0000000000..50dc91e2f0
--- /dev/null
+++ b/components/alert/readme.md
@@ -0,0 +1,29 @@
+### Usage
+```typescript
+import {Alert} from 'ng2-bootstrap';
+```
+
+### Annotations
+```typescript
+// class Alert
+@Component({
+ selector: 'alert',
+ properties: ['type', 'dismissible', 'dismissOnTimeout'],
+ events: ['close'],
+ lifecycle: [LifecycleEvent.onInit]
+})
+```
+
+### Alert properties
+- `type` (`?:string='warning'`) - provide one of the four supported contextual classes:
+`success`,`info`, `warning`, `danger`
+- `dismissible` (`?:boolean=false`) - determines if an inline close button is displayed
+- `dismiss-on-timeout` (`?number=0`) - number of milliseconds, if specified sets a timeout duration, after which the alert will be closed
+- `template-url` (*not yet supported*) - allows to provide message template
+
+### Alert events
+- `close` - fired when `alert` closed with inline button or by timeout, `$event` is an instance of `Alert` component
+
+*Will be deprecated*: The presence of the `(close)` event handler determines
+if a close button is displayed, use `dismissible` instead
+
diff --git a/components/alert/title.md b/components/alert/title.md
new file mode 100644
index 0000000000..2558835abd
--- /dev/null
+++ b/components/alert/title.md
@@ -0,0 +1,5 @@
+Provides contextual feedback messages for typical user actions with the handful of available and flexible alert messages.
+
+Base specifications: [bootstrap 3](http://getbootstrap.com/components/#alerts) or [bootstrap 4](http://v4-alpha.getbootstrap.com/components/alerts/)
+
+This directive can be used to generate alerts from the dynamic model data (using the `ng-for` directive).
diff --git a/components/buttons/button-checkbox.ts b/components/buttons/button-checkbox.ts
index dbb13b615a..bef4d9f752 100644
--- a/components/buttons/button-checkbox.ts
+++ b/components/buttons/button-checkbox.ts
@@ -8,19 +8,10 @@ import {
@Directive({
- selector: '[ng-model][btn-checkbox]',
- properties: [
- 'btnCheckboxTrue: btn-checkbox-true',
- 'btnCheckboxFalse: btn-checkbox-false'
- ],
+ selector: '[btn-checkbox][ng-model]',
+ properties: ['btnCheckboxTrue', 'btnCheckboxFalse'],
host: {
'(click)': 'onClick()',
- '[class.ng-untouched]': 'ngClassUntouched',
- '[class.ng-touched]': 'ngClassTouched',
- '[class.ng-pristine]': 'ngClassPristine',
- '[class.ng-dirty]': 'ngClassDirty',
- '[class.ng-valid]': 'ngClassValid',
- '[class.ng-invalid]': 'ngClassInvalid',
'[class.active]': 'state'
},
lifecycle: [LifecycleEvent.onInit]
@@ -35,16 +26,16 @@ export class ButtonCheckbox extends DefaultValueAccessor {
super(cd, renderer, elementRef);
}
- private get trueValue(){
- return typeof this.btnCheckboxTrue !== 'undefined' ? this.btnCheckboxTrue : true;
+ onInit() {
+ this.toggle(this.trueValue === this.value);
}
- private get falseValue(){
- return typeof this.btnCheckboxFalse !== 'undefined' ? this.btnCheckboxFalse : false;
+ private get trueValue() {
+ return typeof this.btnCheckboxTrue !== 'undefined' ? this.btnCheckboxTrue : true;
}
- onInit() {
- this.toggle(this.trueValue === this.value);
+ private get falseValue() {
+ return typeof this.btnCheckboxFalse !== 'undefined' ? this.btnCheckboxFalse : false;
}
toggle(state:boolean) {
@@ -54,6 +45,7 @@ export class ButtonCheckbox extends DefaultValueAccessor {
// model -> view
writeValue(value:any) {
+ this.state = this.trueValue === value;
this.value = value;
}
diff --git a/components/buttons/button-radio.ts b/components/buttons/button-radio.ts
index cc5e9e6033..a3a65a2908 100644
--- a/components/buttons/button-radio.ts
+++ b/components/buttons/button-radio.ts
@@ -1,39 +1,35 @@
///
import {
Directive,
- DefaultValueAccessor,
+ DefaultValueAccessor, LifecycleEvent,
Self, NgModel, Renderer, ElementRef
} from 'angular2/angular2';
@Directive({
- selector: '[ng-model][btn-radio]',
- properties: [
- 'btnRadio: btn-radio'
- ],
+ selector: '[btn-radio][ng-model]',
+ properties: ['btnRadio', 'uncheckable'],
host: {
'(click)': 'onClick()',
- '[class.ng-untouched]': 'ngClassUntouched',
- '[class.ng-touched]': 'ngClassTouched',
- '[class.ng-pristine]': 'ngClassPristine',
- '[class.ng-dirty]': 'ngClassDirty',
- '[class.ng-valid]': 'ngClassValid',
- '[class.ng-invalid]': 'ngClassInvalid',
'[class.active]': 'isActive'
- }
+ },
+ lifecycle: [LifecycleEvent.onInit]
})
export class ButtonRadio extends DefaultValueAccessor {
- private btnRadio:any;
- uncheckable:any;
- cd: NgModel;
+ private btnRadio:string;
+ private uncheckable:boolean;
+ cd:NgModel;
constructor(@Self() cd:NgModel, renderer:Renderer, elementRef:ElementRef) {
super(cd, renderer, elementRef);
- this.uncheckable = elementRef.nativeElement.getAttribute('uncheckable') != null;
+ }
+
+ onInit() {
+ this.uncheckable = typeof this.uncheckable !== 'undefined';
}
private get isActive() {
- return typeof this.btnRadio !== 'undefined' ? (this.btnRadio === this.value) : false;
+ return this.btnRadio === this.value;
}
// hack view model!
diff --git a/components/buttons/readme.md b/components/buttons/readme.md
new file mode 100644
index 0000000000..9e1ee07e1c
--- /dev/null
+++ b/components/buttons/readme.md
@@ -0,0 +1,36 @@
+### Usage
+```typescript
+import {ButtonRadio, ButtonCheckbox} from 'ng2-bootstrap';
+```
+### Annotations
+```typescript
+// class ButtonRadio
+@Directive({
+ selector: '[btn-radio][ng-model]',
+ properties: ['btnRadio', 'uncheckable'],
+ host: {
+ '(click)': 'onClick()',
+ '[class.active]': 'isActive'
+ },
+ lifecycle: [LifecycleEvent.onInit]
+})
+
+// class ButtonCheckbox
+@Directive({
+ selector: '[btn-checkbox][ng-model]',
+ properties: ['btnCheckboxTrue', 'btnCheckboxFalse'],
+ host: {
+ '(click)': 'onClick()',
+ '[class.active]': 'state'
+ },
+ lifecycle: [LifecycleEvent.onInit]
+})
+```
+
+### Radio button properties
+ - `btn-radio` (`string`) - radio button value, will be set to `ng-model`
+ - `uncheckable` (`?boolean=false`) - if `true` radio button can be unchecked and `null` will be set to `ng-model`
+
+### Checkbox button properties
+ - `btn-checkbox-true` (`?any=true`) - truthy value
+ - `btn-checkbox-false` (`?any=false`) - falsy value
diff --git a/components/buttons/title.md b/components/buttons/title.md
new file mode 100644
index 0000000000..becfc1a3f7
--- /dev/null
+++ b/components/buttons/title.md
@@ -0,0 +1,3 @@
+There are two directives that can make a group of buttons behave like a set of checkboxes, radio buttons, or a hybrid where radio buttons can be unchecked.
+
+Base specifications: [bootstrap 3](http://getbootstrap.com/javascript/#buttons) or [bootstrap 4](http://v4-alpha.getbootstrap.com/components/buttons/#checkbox-and-radio-buttons)
diff --git a/components/carousel/carousel.ts b/components/carousel/carousel.ts
index f42f0d3c97..a406fe4a04 100644
--- a/components/carousel/carousel.ts
+++ b/components/carousel/carousel.ts
@@ -7,14 +7,13 @@ import {
CORE_DIRECTIVES, NgClass
} from 'angular2/angular2';
-import {Ng2BootstrapConfig} from '../ng2-bootstrap-config';
+import {Ng2BootstrapConfig, Ng2BootstrapTheme} from '../ng2-bootstrap-config';
export enum Direction {UNKNOWN, NEXT, PREV}
-
// todo: add animate
const NAVIGATION = {
- bs4: `
+ [Ng2BootstrapTheme.BS4]: `
Previous
@@ -24,7 +23,7 @@ const NAVIGATION = {
Next
`,
- bs3: `
+ [Ng2BootstrapTheme.BS3]: `
@@ -36,12 +35,7 @@ const NAVIGATION = {
@Component({
selector: 'carousel, [carousel]',
- properties: [
- 'interval',
- 'noTransition',
- 'noPause',
- 'noWrap'
- ],
+ properties: ['interval', 'noTransition', 'noPause', 'noWrap'],
lifecycle: [LifecycleEvent.onDestroy]
})
// todo:
@@ -53,7 +47,7 @@ const NAVIGATION = {
- ${NAVIGATION[Ng2BootstrapConfig.theme] || NAVIGATION.bs3}
+ ${NAVIGATION[Ng2BootstrapConfig.theme]}
`,
directives: [CORE_DIRECTIVES, NgClass]
@@ -81,7 +75,7 @@ export class Carousel {
this.restartTimer();
}
- public select(nextSlide:Slide, direction?:Direction = Direction.UNKNOWN) {
+ public select(nextSlide:Slide, direction:Direction = Direction.UNKNOWN) {
let nextIndex = nextSlide.index;
if (direction === Direction.UNKNOWN) {
direction = nextIndex > this.getCurrentIndex() ? Direction.NEXT : Direction.PREV;
@@ -212,11 +206,7 @@ export class Carousel {
@Component({
selector: 'slide, [slide]',
- properties: [
- 'direction',
- 'active',
- 'index'
- ],
+ properties: ['direction', 'active', 'index'],
host: {
'[class.active]': 'active',
'[class.item]': 'true',
@@ -226,7 +216,9 @@ export class Carousel {
})
@View({
template: `
-
+
+
+
`,
directives: [NgClass]
})
diff --git a/components/carousel/readme.md b/components/carousel/readme.md
new file mode 100644
index 0000000000..c066260998
--- /dev/null
+++ b/components/carousel/readme.md
@@ -0,0 +1,45 @@
+### Usage
+```typescript
+import {carousel} from 'ng2-bootstrap';
+```
+
+### Annotations
+```typescript
+// class Carousel
+@Component({
+ selector: 'carousel, [carousel]',
+ properties: ['interval', 'noTransition', 'noPause', 'noWrap'],
+ lifecycle: [LifecycleEvent.onDestroy]
+})
+
+// class Slide
+@Component({
+ selector: 'slide, [slide]',
+ properties: ['direction', 'active', 'index'],
+ host: {
+ '[class.active]': 'active',
+ '[class.item]': 'true',
+ '[class.carousel-item]': 'true'
+ },
+ lifecycle: [LifecycleEvent.onInit, LifecycleEvent.onDestroy]
+})
+
+export const carousel:Array
= [Carousel, Slide];
+```
+
+### Carousel properties
+- `interval` (`?number=5000`) - amount of time in milliseconds to delay between automatically cycling an item. If `false`, carousel will not automatically cycle
+- `no-transition` (`?boolean=false`) - if `true` will disable transitions on the carousel
+- `no-pause` (`?boolean=false`) - if `true` will disable pausing on carousel mouse hover
+- `no-wrap` (`?boolean=false`) - if `true` the carousel will not cycle continuously and will have hard stops (prevent looping)
+- `pause` (*not yet supported*) (`?string='hover'`) - event group name which pauses the cycling of the carousel, if `hover` pauses on mouseenter and resumes on mouseleave
+- `keyboard` (*not yet supported*) (`?boolean=true`) - if `false` carousel will not react to keyboard events
+- `template-url` (*not yet supported*) - allows to override the template url of component (default: `components/carousel/carousel.html`)
+- *note*: swiping not yet supported
+
+### Slide properties
+- `active` (`?boolean=false`) - currently active slide
+- `index` (`?number`) - index of slide in carousel's slides
+- `direction` (`?string`) (*not yet supported*)
+- `actual` (*not yet supported*) (`?any`) - will be bind to slider context, to be used from template
+- `template-url` (*not yet supported*) (`?string='hover'`) - allows to override the template url of component (default: `components/carousel/slide.html`)
diff --git a/components/carousel/title.md b/components/carousel/title.md
new file mode 100644
index 0000000000..5b40c0c3f9
--- /dev/null
+++ b/components/carousel/title.md
@@ -0,0 +1,3 @@
+A slideshow component for cycling through elements—images or slides of text—like a carousel. *Nested carousels are not supported.*
+
+Base specifications: [bootstrap 3](http://getbootstrap.com/javascript/#carousel) or [bootstrap 4](http://v4-alpha.getbootstrap.com/components/carousel/)
diff --git a/components/collapse/collapse.ts b/components/collapse/collapse.ts
index de770e4e1a..7670d0dbdc 100644
--- a/components/collapse/collapse.ts
+++ b/components/collapse/collapse.ts
@@ -10,9 +10,7 @@ import {
// todo: add init and on change
@Directive({
selector: '[collapse]',
- properties: [
- 'collapse'
- ],
+ properties: ['collapse'],
host: {
'[class.in]': 'isExpanded',
'[class.collapse]': 'isCollapse',
diff --git a/components/collapse/readme.md b/components/collapse/readme.md
new file mode 100644
index 0000000000..7e15820d66
--- /dev/null
+++ b/components/collapse/readme.md
@@ -0,0 +1,24 @@
+### Usage
+```typescript
+import {Collapse} from 'ng2-bootstrap';
+```
+
+### Annotations
+```typescript
+// class Collapse
+@Directive({
+ selector: '[collapse]',
+ properties: ['collapse'],
+ host: {
+ '[class.in]': 'isExpanded',
+ '[class.collapse]': 'isCollapse',
+ '[class.collapsing]': 'isCollapsing',
+ '[attr.aria-expanded]': 'isExpanded',
+ '[attr.aria-hidden]': 'isCollapsed',
+ '[style.height]': 'height'
+ }
+})
+```
+
+### Collapse properties
+- `collapse` (`boolean=false`) - if `true` collapse block will be expanded
diff --git a/components/collapse/title.md b/components/collapse/title.md
new file mode 100644
index 0000000000..7bfc0cea44
--- /dev/null
+++ b/components/collapse/title.md
@@ -0,0 +1,4 @@
+Collapse component allows you to toggle content on your pages with a bit of JavaScript and some classes. Flexible component that utilizes a handful of classes (from the **required transitions component**(*not yet implemented*)) for easy toggle behavior.
+
+Base specifications: [bootstrap 3](http://getbootstrap.com/javascript/#collapse) or [bootstrap 4](http://v4-alpha.getbootstrap.com/components/collapse/)
+
diff --git a/components/dropdown/dropdown-keyboard-nav.ts b/components/dropdown/dropdown-keyboard-nav.ts
index 919aa950a7..b03b59d7c0 100644
--- a/components/dropdown/dropdown-keyboard-nav.ts
+++ b/components/dropdown/dropdown-keyboard-nav.ts
@@ -12,7 +12,7 @@ import {Dropdown} from './dropdown';
export class KeyboardNav {
constructor(private dd:Dropdown, private el:ElementRef) {
console.warn('keyboard-nav deprecated');
- dd.keynavEnabled = true;
+ dd.keyboardNav = true;
}
onKeydown(event:KeyboardEvent) {
diff --git a/components/dropdown/dropdown-menu.ts b/components/dropdown/dropdown-menu.ts
index 942536522c..a272bc7339 100644
--- a/components/dropdown/dropdown-menu.ts
+++ b/components/dropdown/dropdown-menu.ts
@@ -5,9 +5,7 @@ import {Dropdown} from './dropdown';
@Directive({
selector: '[dropdown-menu], .dropdown-menu',
- host: {
- '[attr.templateUrl]': 'templateUrl'
- },
+ properties: ['templateUrl'],
lifecycle: [LifecycleEvent.onInit]
})
export class DropdownMenu {
diff --git a/components/dropdown/dropdown-service.ts b/components/dropdown/dropdown-service.ts
index 3d827fdf04..1ac0fa2817 100644
--- a/components/dropdown/dropdown-service.ts
+++ b/components/dropdown/dropdown-service.ts
@@ -66,7 +66,7 @@ export class DropdownService {
return;
}
- if (this.openScope.keynavEnabled && this.openScope.isOpen &&
+ if (this.openScope.keyboardNav && this.openScope.isOpen &&
(event.which === 38 || event.which === 40)) {
event.preventDefault();
event.stopPropagation();
diff --git a/components/dropdown/dropdown.ts b/components/dropdown/dropdown.ts
index 2ea7cdbfad..0dd2218674 100644
--- a/components/dropdown/dropdown.ts
+++ b/components/dropdown/dropdown.ts
@@ -10,15 +10,8 @@ import {dropdownService, ALWAYS} from './dropdown-service';
@Directive({
selector: '[dropdown]',
- properties: [
- 'isOpen',
- 'autoClose',
- 'keynavEnabled: keyboardNav',
- 'dropdownAppendToBody'
- ],
- events: [
- 'onToggle'
- ],
+ properties: ['isOpen', 'autoClose', 'keyboardNav', 'dropdownAppendToBody'],
+ events: ['onToggle'],
lifecycle: [LifecycleEvent.onInit, LifecycleEvent.onDestroy],
host: {
'[class.dropdown]': 'true',
@@ -32,7 +25,7 @@ export class Dropdown {
private onToggle:EventEmitter = new EventEmitter();
public autoClose:string;
- public keynavEnabled:boolean;
+ public keyboardNav:boolean;
// index of selected element
public selectedOption:number;
// drop menu html
@@ -48,7 +41,7 @@ export class Dropdown {
onInit() {
this.autoClose = this.autoClose || ALWAYS;
- this.keynavEnabled = typeof this.keynavEnabled !== 'undefined';
+ this.keyboardNav = typeof this.keyboardNav !== 'undefined';
this.dropdownAppendToBody = typeof this.dropdownAppendToBody !== 'undefined';
if (this.isOpen) {
// todo: watch for event get-is-open?
@@ -61,7 +54,7 @@ export class Dropdown {
}
}
- public set dropDownMenu(dropdownMenu:DropdownMenuInterface){
+ public set dropDownMenu(dropdownMenu:DropdownMenuInterface) {
// init drop down menu
this.menuEl = dropdownMenu.el;
@@ -74,7 +67,7 @@ export class Dropdown {
}
}
- public set dropDownToggle(dropdownToggle: DropdownToggleInterface){
+ public set dropDownToggle(dropdownToggle:DropdownToggleInterface) {
// init toggle element
this.toggleEl = dropdownToggle.el;
}
diff --git a/components/dropdown/readme.md b/components/dropdown/readme.md
new file mode 100644
index 0000000000..59a5d9f7ee
--- /dev/null
+++ b/components/dropdown/readme.md
@@ -0,0 +1,72 @@
+### Usage
+```typescript
+import {dropdown} from 'ng2-bootstrap';
+```
+
+```html
+
+
+```
+
+### Annotations
+```typescript
+// class Dropdown
+@Directive({
+ selector: '[dropdown]',
+ properties: ['isOpen', 'autoClose', 'keyboardNav', 'dropdownAppendToBody'],
+ events: ['onToggle'],
+ lifecycle: [LifecycleEvent.onInit, LifecycleEvent.onDestroy],
+ host: {
+ '[class.dropdown]': 'true',
+ '[class.open]': 'isOpen'
+ }
+})
+
+// class DropdownToggle
+@Directive({
+ selector: '[dropdown-toggle]',
+ properties: ['disabled'],
+ host: {
+ '(click)': 'toggleDropdown($event)',
+ '[class.dropdown-toggle]': 'true',
+ '[class.disabled]': 'disabled',
+ '[attr.aria-haspopup]': 'true',
+ '[attr.aria-expanded]': 'isOpen'
+ },
+ lifecycle: [LifecycleEvent.onInit]
+})
+
+// class DropdownMenu
+@Directive({
+ selector: '[dropdown-menu], .dropdown-menu',
+ properties: ['templateUrl'],
+ lifecycle: [LifecycleEvent.onInit]
+})
+
+export const dropdown: Array = [Dropdown, DropdownMenu, DropdownToggle];
+```
+
+### Dropdown properties
+- `is-open` (`?boolean=false`) - if `true` dropdown will be opened
+- `auto-close` (`?string='always'`) - behaviour vary:
+ * `always` - (default) automatically closes the dropdown when any of its elements is clicked
+ * `outsideClick` - closes the dropdown automatically only when the user clicks any element outside the dropdown
+ * `disabled` - disables the auto close. You can then control the open/close status of the dropdown manually, by using `is-open`. Please notice that the dropdown will still close if the toggle is clicked, the `esc` key is pressed or another dropdown is open
+- `keyboard-nav` (`?boolean=false`) - if `true` will enable navigation of dropdown list elements with the arrow keys
+- `dropdown-append-to-body` (*not yet tested*) (`?boolean=false`) - if `true` `dropdown-menu` content will be appended to the body. This is useful when the dropdown button is inside a div with `overflow: hidden`, and the menu would otherwise be hidden
+
+### Dropdown events
+- `on-toggle` - fired when `dropdown` toggles, `$event:boolean` equals dropdown `is-open` state
+
+### Dropdown toggle properties
+- `disabled` (`?boolean=false`) - if `true` dropdown toggle will be disabled
+
+### Dropdown menu properties
+- `template-url` (*not yet supported*) - allows to provide dropdown menu template
diff --git a/components/dropdown/title.md b/components/dropdown/title.md
new file mode 100644
index 0000000000..eb2036896b
--- /dev/null
+++ b/components/dropdown/title.md
@@ -0,0 +1,4 @@
+Dropdowns are toggleable, contextual overlays for displaying lists of links and more. They’re made interactive with the included dropdown directives.
+
+Base specifications: [bootstrap 3](http://getbootstrap.com/javascript/#dropdowns) or [bootstrap 4](http://v4-alpha.getbootstrap.com/components/dropdowns/)
+
diff --git a/components/ng2-bootstrap-config.ts b/components/ng2-bootstrap-config.ts
index 94e97753f9..b3f999c669 100644
--- a/components/ng2-bootstrap-config.ts
+++ b/components/ng2-bootstrap-config.ts
@@ -1,16 +1,16 @@
-export enum Theme {BS3 = 'bs3', BS4 = 'bs4'}
-
-interface Window {
- __theme: string;
-}
-
+export enum Ng2BootstrapTheme {BS3 = 1, BS4 = 2}
export class Ng2BootstrapConfig {
- private static _theme: Theme;
- static get theme():Theme {
- return this._theme || window.__theme === 'bs4' ? Theme.BS4 : Theme.BS3;
+ private static _theme: Ng2BootstrapTheme;
+ static get theme():Ng2BootstrapTheme {
+ // hack as for now
+ let w: any = window;
+ if (w && w.__theme === 'bs4') {
+ return Ng2BootstrapTheme.BS4;
+ }
+ return (this._theme || Ng2BootstrapTheme.BS3);
}
- static set theme(v:Theme){
+ static set theme(v:Ng2BootstrapTheme){
this._theme = v;
}
}
diff --git a/components/pagination/pagination.ts b/components/pagination/pagination.ts
index 626185c3f8..28d6287bae 100644
--- a/components/pagination/pagination.ts
+++ b/components/pagination/pagination.ts
@@ -29,19 +29,12 @@ const paginationConfig = {
};
@Component({
- selector: 'pagination, [pagination]',
+ selector: 'pagination[ng-model], [pagination][ng-model]',
properties: [
- 'maxSize',
- 'rotate',
- 'boundaryLinks',
- 'totalItems',
- 'firstText',
- 'previousText',
- 'nextText',
- 'lastText',
- 'disabled',
- 'directionLinks',
- 'itemsPerPage'
+ 'rotate', 'disabled',
+ 'totalItems', 'itemsPerPage', 'maxSize',
+ 'boundaryLinks', 'directionLinks',
+ 'firstText', 'previousText', 'nextText', 'lastText'
],
events: ['numPages'],
lifecycle: [LifecycleEvent.onInit]
@@ -80,7 +73,7 @@ const paginationConfig = {
export class Pagination extends DefaultValueAccessor {
public config:any;
- private classMap: string;
+ private classMap:string;
private maxSize:number;
private rotate:boolean;
private boundaryLinks:any;
@@ -108,7 +101,7 @@ export class Pagination extends DefaultValueAccessor {
this.totalPages = this.calculateTotalPages();
}
- private get totalItems() {
+ private get totalItems():number {
return this._totalItems;
}
@@ -121,10 +114,10 @@ export class Pagination extends DefaultValueAccessor {
return this._totalPages;
}
- private set totalPages(v: number) {
+ private set totalPages(v:number) {
this._totalPages = v;
this.numPages.next(v);
- if (this.page > v) {
+ if (this.page > v) {
this.selectPage(v);
}
}
@@ -262,26 +255,29 @@ const pagerConfig = {
};
@Component({
- selector: 'pager, [pager]',
+ selector: 'pager[ng-model], [pager][ng-model]',
properties: [
- 'align', 'totalItems', 'previousText', 'nextText', 'itemsPerPage'
+ 'align',
+ 'totalItems', 'itemsPerPage',
+ 'previousText', 'nextText',
],
lifecycle: [LifecycleEvent.onInit]
})
@View({
template: `
`,
directives: [NgClass]
})
export class Pager extends Pagination {
+ private align: boolean = pagerConfig.align;
+ public config = pagerConfig;
constructor(@Self() cd:NgModel, renderer:Renderer, elementRef:ElementRef) {
- this.config = pagerConfig;
super(cd, renderer, elementRef);
}
}
-export const pagination = [Pagination, Pager];
+export const pagination:Array = [Pagination, Pager];
diff --git a/components/pagination/readme.md b/components/pagination/readme.md
new file mode 100644
index 0000000000..57c9392332
--- /dev/null
+++ b/components/pagination/readme.md
@@ -0,0 +1,61 @@
+### Usage
+```typescript
+import {pagination} from 'ng2-bootstrap';
+```
+
+### Annotations
+```typescript
+// class Pagination
+@Component({
+ selector: 'pagination[ng-model], [pagination][ng-model]',
+ properties: [
+ 'rotate', 'disabled',
+ 'totalItems', 'itemsPerPage', 'maxSize',
+ 'boundaryLinks', 'directionLinks',
+ 'firstText', 'previousText', 'nextText', 'lastText'
+ ],
+ events: ['numPages'],
+ lifecycle: [LifecycleEvent.onInit]
+})
+
+// class Pager
+@Component({
+ selector: 'pager[ng-model], [pager][ng-model]',
+ properties: [
+ 'align',
+ 'totalItems', 'itemsPerPage',
+ 'previousText', 'nextText',
+ ],
+ lifecycle: [LifecycleEvent.onInit]
+})
+
+export const pagination:Array = [Pagination, Pager];
+```
+### Pagination properties
+ - `rotate` (`?boolean=true`) - if `true` current page will in the middle of pages list
+ - `disabled` (`?boolean=false`) - if `true` pagination component will be disabled
+ - `total-items` (`number`) - total number of items in all pages
+ - `items-per-page` (`?number=10`) - maximum number of items per page. If value less than 1 will display all items on one page
+ - `max-size` (`?number=undefined`) - limit number for page links in pager
+ - `boundary-links` (`?boolean=true`) - if `false` first and last buttons will be hidden
+ - `direction-links` (`?boolean=true`) - if `false` previous and next buttons will be hidden
+ - `previous-text` (`?string='Previous'`) - previous button text
+ - `next-text` (`?string='Next'`) - next button text
+ - `first-text` (`?string='First'`) - first button text
+ - `last-text` (`?string='Last'`) - last button text
+ - `template-url`(*not yet supported*) (`?string`) - allows to override the template url of component (default: `components/pagination/pagination.html`)
+
+### Pagination events
+- `num-pages` - fired when total pages count changes, `$event:number` equals to total pages count
+
+### Pager properties
+ - `align` (`?boolean=true`) - if `true` aligns each link to the sides of pager
+ - `disabled` (`?boolean=false`) - if `true` pagination component will be disabled
+ - `total-items` (`number`) - total number of items in all pages
+ - `items-per-page` (`?number=10`) - maximum number of items per page. If value less than 1 will display all items on one page
+ - `previous-text` (`?string='Previous'`) - previous button text
+ - `next-text` (`?string='Next'`) - next button text
+ - `template-url`(*not yet supported*) (`?string`) - allows to override the template url of component (default: `components/pagination/pager.html`)
+
+### Pager events
+ - `num-pages` - fired when total pages count changes, `$event:number` equals to total pages count
diff --git a/components/pagination/title.md b/components/pagination/title.md
new file mode 100644
index 0000000000..3f45c9e934
--- /dev/null
+++ b/components/pagination/title.md
@@ -0,0 +1,6 @@
+**Pagination** - provide pagination links for your site or app with the multi-page pagination component, or the simpler pager alternative.
+
+**Pager** - quick previous and next links for simple pagination implementations with light markup and styles. It's great for simple sites like blogs or magazines.
+
+Base specifications: [bootstrap 3](http://getbootstrap.com/components/#pagination) or [bootstrap 4](http://v4-alpha.getbootstrap.com/components/pagination/)
+
diff --git a/components/progressbar/progressbar.ts b/components/progressbar/progressbar.ts
index 9558ca4ae4..846857e826 100644
--- a/components/progressbar/progressbar.ts
+++ b/components/progressbar/progressbar.ts
@@ -70,9 +70,7 @@ export class Progress {
// todo: use query from progress?
@Component({
selector: 'bar, [bar]',
- properties: [
- 'type', 'value'
- ],
+ properties: ['type', 'value'],
lifecycle: [LifecycleEvent.onInit, LifecycleEvent.onDestroy]
})
@View({
diff --git a/components/progressbar/readme.md b/components/progressbar/readme.md
new file mode 100644
index 0000000000..2f67b62446
--- /dev/null
+++ b/components/progressbar/readme.md
@@ -0,0 +1,39 @@
+### Usage
+```typescript
+import {progressbar} from 'ng2-bootstrap';
+```
+
+### Annotations
+```typescript
+// class Progress
+@Directive({
+ selector: 'bs-progress, [progress]',
+ properties: ['animate', 'max'],
+ host: {
+ 'class': 'progress',
+ '[attr.max]': 'max'
+ },
+ lifecycle: [LifecycleEvent.onInit]
+})
+
+// class Bar
+@Component({
+ selector: 'bar, [bar]',
+ properties: ['type', 'value'],
+ lifecycle: [LifecycleEvent.onInit, LifecycleEvent.onDestroy]
+})
+
+// class Progressbar
+@Component({
+ selector: 'progressbar, [progressbar]',
+ properties: ['animate', 'max', 'type', 'value']
+})
+```
+
+### Properties
+**Note**: all components have same meaning of properties
+ - `value` (`*number`) - current value of progress bar
+ - `type` (`*string`) - provide one of the four supported contextual classes:
+ `success`,`info`, `warning`, `danger`
+ - `max` (`?number=100`) - maximum total value of progress element
+ - `animate` (`?boolean=true`) - if `true` changing `value` of progress bar will be animated (*note*: not supported by Bootstrap 4)
diff --git a/components/progressbar/title.md b/components/progressbar/title.md
new file mode 100644
index 0000000000..7bb2a4ef81
--- /dev/null
+++ b/components/progressbar/title.md
@@ -0,0 +1,3 @@
+Provide up-to-date feedback on the progress of a workflow or action with simple yet flexible progress bars.
+
+Base specifications: [bootstrap 3](http://getbootstrap.com/components/#progress) or [bootstrap 4](http://v4-alpha.getbootstrap.com/components/progress/)
diff --git a/components/rating/rating.ts b/components/rating/rating.ts
index 2b591715c2..f28599db63 100644
--- a/components/rating/rating.ts
+++ b/components/rating/rating.ts
@@ -9,7 +9,7 @@ import {
// TODO: templateUrl
@Component({
- selector: 'rating',
+ selector: 'rating[ng-model]',
properties: [
'max', 'readonly', 'titles',
'stateOn', 'stateOff',
@@ -102,7 +102,7 @@ export class Rating extends DefaultValueAccessor {
private reset() {
this.value = this.preValue;
- this.onLeave.next(null);
+ this.onLeave.next(this.value);
}
private onKeydown(event:KeyboardEvent) {
diff --git a/components/rating/readme.md b/components/rating/readme.md
new file mode 100644
index 0000000000..1367a93a14
--- /dev/null
+++ b/components/rating/readme.md
@@ -0,0 +1,34 @@
+### Usage
+```typescript
+import {Rating} from 'ng2-bootstrap';
+```
+
+### Annotations
+```typescript
+// class Rating
+@Component({
+ selector: 'rating[ng-model]',
+ properties: [
+ 'max', 'readonly', 'titles',
+ 'stateOn', 'stateOff',
+ 'ratingStates'
+ ],
+ events: ['onHover', 'onLeave'],
+ host: {
+ '(keydown)': 'onKeydown($event)'
+ },
+ lifecycle: [LifecycleEvent.onInit]
+})
+```
+
+### Rating properties
+ - `max` (`?number=5`) - number of icons
+ - `readonly` (`?boolean=false`) - if `true` will not react on any user events
+ - `titles` (`?Array`) - array of icons titles, default: (`["one", "two", "three", "four", "five"]`)
+ - `state-on` (`?string='glyphicon-star'`) - selected icon class
+ - `state-off` (`?string='glyphicon-star-empty'`) - unselected icon class
+ - `rating-states` (`?Array<{stateOn:string, stateOff:string}>`) - array of custom icons classes
+
+### Rating events
+ - `on-hover` - fired when icon selected, `$event:number` equals to selected rating
+ - `on-leave` - fired when icon selected, `$event:number` equals to previous rating value
diff --git a/components/rating/title.md b/components/rating/title.md
new file mode 100644
index 0000000000..39acb3afa2
--- /dev/null
+++ b/components/rating/title.md
@@ -0,0 +1,3 @@
+Rating component that will take care of visualising a star rating bar
+
+*Note*: Bootstrap 4 do not include glyphicons anymore, so if you want to continue use this font, you will need to add a link to [`glyphicons.css`](https://github.com/valor-software/ng2-bootstrap/blob/master/demo/assets/css/glyphicons.css)
diff --git a/components/tabs/readme.md b/components/tabs/readme.md
new file mode 100644
index 0000000000..6101f529fc
--- /dev/null
+++ b/components/tabs/readme.md
@@ -0,0 +1,60 @@
+### Usage
+```typescript
+import {tabs} from 'ng2-bootstrap';
+```
+
+```html
+
+ Tab 1 content
+
+ Tab 2
+ Tab 2 content
+
+
+```
+
+### Annotations
+```typescript
+// class Tabset
+@Component({
+ selector: 'tabset',
+ properties: ['vertical', 'justified', 'type'],
+ lifecycle: [LifecycleEvent.onInit]
+})
+
+// class Tab
+@Directive({
+ selector: 'tab, [tab]',
+ properties: ['active', 'disable', 'disabled', 'heading'],
+ events: ['select', 'deselect'],
+ host: {
+ '[class.tab-pane]': 'true',
+ '[class.active]': 'active'
+ },
+ lifecycle: [LifecycleEvent.onInit, LifecycleEvent.onDestroy,
+ LifecycleEvent.onCheck]
+})
+
+// class TabHeading
+@Directive({selector: '[tab-heading]'})
+
+export const tabs:Array = [Tab, TabHeading, Tabset];
+```
+
+### Tabset properties
+ - `vertical` (`?boolean=false`) - if `true` tabs will be placed vertically
+ - `justified` (`?boolean=false`) - if `true` tabs fill the container and have a consistent width
+ - `type` (`?string='tabs'`) - navigation context class: 'tabs' or 'pills'
+
+### Tab properties
+ - `heading` (`string`) - tab header text
+ - `active` (`?boolean=false`) - if tab is active equals true, or set `true` to activate tab
+ - `disabled` (`?boolean=false`) - if `true` tab can not be activated
+ - `disable` (**note: deprecated**) - mirrors `disabled` property
+
+### Tab events
+ - `select` - fired when `tab` became active, `$event:Tab` equals to selected instance of `Tab` component
+ - `deselect` - fired when `tab` became inactive, `$event:Tab` equals to deselected instance of `Tab` component
+
+### Tab heading
+Should be used to mark `` element as template for tab heading
diff --git a/components/tabs/tabs.ts b/components/tabs/tabs.ts
index a2264c40bc..f1dd59c3dd 100644
--- a/components/tabs/tabs.ts
+++ b/components/tabs/tabs.ts
@@ -18,17 +18,15 @@ import {NgTransclude} from '../common';
})
@View({
template: `
-
-
-
-
-
+
+
+
`,
directives: [CORE_DIRECTIVES, NgClass, NgTransclude]
diff --git a/components/tabs/title.md b/components/tabs/title.md
new file mode 100644
index 0000000000..84d5bc2b5d
--- /dev/null
+++ b/components/tabs/title.md
@@ -0,0 +1,3 @@
+Add quick, dynamic tab functionality to transition through panes of local content, even via dropdown menus. **Nested tabs are not supported.**
+
+Base specifications: [bootstrap 3](http://getbootstrap.com/javascript/#tabs) or [bootstrap 4](http://v4-alpha.getbootstrap.com/components/navs/)
diff --git a/components/timepicker/readme.md b/components/timepicker/readme.md
new file mode 100644
index 0000000000..57ad7c7eaf
--- /dev/null
+++ b/components/timepicker/readme.md
@@ -0,0 +1,38 @@
+### Usage
+```typescript
+import {Timepicker} from 'ng2-bootstrap';
+```
+
+### Annotations
+```typescript
+// class Timepicker
+@Component({
+ selector: 'timepicker[ng-model]',
+ properties: [
+ 'hourStep', 'minuteStep',
+ 'meridians', 'showMeridian',
+ 'readonlyInput',
+ 'mousewheel', 'arrowkeys',
+ 'showSpinners',
+ 'min', 'max'
+ ],
+ lifecycle: [LifecycleEvent.onInit]
+})
+```
+
+### Timepicker properties
+ - `vertical` (`?boolean=false`) - if `true` tabs will be placed vertically
+ - `justified` (`?boolean=false`) - if `true` tabs fill the container and have a consistent width
+ - `type` (`?string='tabs'`) - navigation context class: 'tabs' or 'pills'
+
+ - `ng-model` (`*Date`) - binds to Date object
+ - `hour-step` (`?number=1`) - hours change step
+ - `minute-step` (`?number=1`) - minutes change step
+ - `meridians` (`?Array
= ['AM', 'PM'];`) - meridian labels based on locale (*will be based later*)
+ - `show-meridian` (`?boolean=true`) - if `true` works in 12H mode and displays AM/PM. If `false` works in 24H mode and hides AM/PM
+ - `readonly-input` (`?boolean=false`) - if `true` hours and minutes fields will be readonly
+ - `mousewheel` (`?boolean=true`) - if `true` scroll inside hours and minutes inputs will change time
+ - `arrowkeys` (`?boolean=true`) - if `true` up/down arrowkeys inside hours and minutes inputs will change time
+ - `show-spinners` (`?boolean=true`) - if `true` spinner arrows above and below the inputs will be shown
+ - `min` (`?Date:undefined`) - minimum time user can select
+ - `max` (`?Date:undefined`) - maximum time user can select
diff --git a/components/timepicker/timepicker.ts b/components/timepicker/timepicker.ts
index d2b7bb3e09..511d9cfb52 100644
--- a/components/timepicker/timepicker.ts
+++ b/components/timepicker/timepicker.ts
@@ -45,18 +45,14 @@ function addMinutes(date, minutes) {
// TODO: templateUrl
@Component({
- selector: 'timepicker',
+ selector: 'timepicker[ng-model]',
properties: [
- 'hourStep',
- 'minuteStep',
- 'showMeridian',
- 'meridians',
+ 'hourStep', 'minuteStep',
+ 'meridians', 'showMeridian',
'readonlyInput',
- 'mousewheel',
- 'arrowkeys',
+ 'mousewheel', 'arrowkeys',
'showSpinners',
- 'min',
- 'max'
+ 'min', 'max'
],
lifecycle: [LifecycleEvent.onInit]
})
@@ -68,7 +64,7 @@ function addMinutes(date, minutes) {
-
+
@@ -78,13 +74,13 @@ function addMinutes(date, minutes) {
- {{meridian}}
+ {{meridian}}
-
+
@@ -99,7 +95,7 @@ export class Timepicker extends DefaultValueAccessor {
private minuteStep:number;
private _showMeridian:boolean;
private meridian:any; // ??
- private meridians:Array = ['AM', 'PM']; // ??
+ private meridians:Array = ['AM', 'PM']; // ??
private readonlyInput:boolean;
private mousewheel:boolean;
private arrowkeys:boolean;
diff --git a/components/timepicker/title.md b/components/timepicker/title.md
new file mode 100644
index 0000000000..40f77827bc
--- /dev/null
+++ b/components/timepicker/title.md
@@ -0,0 +1 @@
+A lightweight & configurable timepicker directive
diff --git a/components/tooltip/readme.md b/components/tooltip/readme.md
new file mode 100644
index 0000000000..ecbb982bae
--- /dev/null
+++ b/components/tooltip/readme.md
@@ -0,0 +1,37 @@
+### Usage
+```typescript
+import {Timepicker} from 'ng2-bootstrap';
+```
+
+### Annotations
+```typescript
+// class Tooltip
+@Directive({
+ selector: '[tooltip]',
+ properties: [
+ 'content:tooltip',
+ 'placement:tooltip-placement',
+ 'appendToBody',
+ 'isOpen: tooltip-is-open',
+ 'enable: tooltip-enable'
+ ],
+ host: {
+ '(mouseenter)': 'show($event, $targe)',
+ '(mouseleave)': 'hide($event, $targe)',
+ '(focusin)': 'show($event, $targe)',
+ '(focusout)': 'hide($event, $targe)'
+ },
+ lifecycle: [LifecycleEvent.onInit]
+})
+```
+
+### Tooltip properties
+ - `tooltip` (`string`) - text of tooltip
+ - `tooltip-placement` (`?string='top'`) - tooltip positioning instruction, supported positions: 'top', 'bottom', 'left', 'right'
+ - `tooltip-animation` (`?boolean=true`) - if `false` fade tooltip animation will be disabled
+ - `tooltip-popup-delay` (*not implemented*) (`?numer=0`) - time in milliseconds before tooltip occurs
+ - `tooltip-trigger` (*not implemented*) (`?Array`) - array of event names which triggers tooltip opening
+ - `tooltip-enable` (*not implemented*) (`?boolean=true`) - if `false` tooltip is disabled and will not be shown
+ - `tooltip-append-to-body` (*not implemented*) (`?boolean=false`) - if `true` tooltip will be appended to body
+ - `tooltip-class` (*not implemented*) (`?string`) - custom tooltip class applied to the tooltip container.
+ - `tooltip-is-open` (`?boolean=false`) - if `true` tooltip is currently visible
diff --git a/components/tooltip/title.md b/components/tooltip/title.md
new file mode 100644
index 0000000000..7ff8a222e2
--- /dev/null
+++ b/components/tooltip/title.md
@@ -0,0 +1,3 @@
+Inspired by the excellent Tipsy jQuery plugin written by Jason Frame. Tooltips are an updated version, which don’t rely on images, use CSS3 for animations, and much more.
+
+Base specifications: [bootstrap 3](http://getbootstrap.com/javascript/#tooltips) or [bootstrap 4](http://v4-alpha.getbootstrap.com/components/tooltips/)
diff --git a/demo/assets/css/prism-okaidia.css b/demo/assets/css/prism-okaidia.css
new file mode 100644
index 0000000000..0fac6828db
--- /dev/null
+++ b/demo/assets/css/prism-okaidia.css
@@ -0,0 +1,119 @@
+/**
+ * okaidia theme for JavaScript, CSS and HTML
+ * Loosely based on Monokai textmate theme by http://www.monokai.nl/
+ * @author ocodia
+ */
+
+code[class*="language-"],
+pre[class*="language-"] {
+ color: #f8f8f2;
+ text-shadow: 0 1px rgba(0, 0, 0, 0.3);
+ font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
+ direction: ltr;
+ text-align: left;
+ white-space: pre;
+ word-spacing: normal;
+ word-break: normal;
+ line-height: 1.5;
+
+ -moz-tab-size: 4;
+ -o-tab-size: 4;
+ tab-size: 4;
+
+ -webkit-hyphens: none;
+ -moz-hyphens: none;
+ -ms-hyphens: none;
+ hyphens: none;
+}
+
+/* Code blocks */
+pre[class*="language-"] {
+ padding: 1em;
+ margin: .5em 0;
+ overflow: auto;
+ border-radius: 0.3em;
+}
+
+:not(pre) > code[class*="language-"],
+pre[class*="language-"] {
+ background: #272822;
+}
+
+/* Inline code */
+:not(pre) > code[class*="language-"] {
+ padding: .1em;
+ border-radius: .3em;
+}
+
+.token.comment,
+.token.prolog,
+.token.doctype,
+.token.cdata {
+ color: slategray;
+}
+
+.token.punctuation {
+ color: #f8f8f2;
+}
+
+.namespace {
+ opacity: .7;
+}
+
+.token.property,
+.token.tag,
+.token.constant,
+.token.symbol,
+.token.deleted {
+ color: #f92672;
+}
+
+.token.boolean,
+.token.number {
+ color: #ae81ff;
+}
+
+.token.selector,
+.token.attr-name,
+.token.string,
+.token.char,
+.token.builtin,
+.token.inserted {
+ color: #a6e22e;
+}
+
+.token.operator,
+.token.entity,
+.token.url,
+.language-css .token.string,
+.style .token.string,
+.token.variable {
+ color: #f8f8f2;
+}
+
+.token.atrule,
+.token.attr-value,
+.token.function {
+ color: #e6db74;
+}
+
+.token.keyword {
+ color: #66d9ef;
+}
+
+.token.regex,
+.token.important {
+ color: #fd971f;
+}
+
+.token.important,
+.token.bold {
+ font-weight: bold;
+}
+.token.italic {
+ font-style: italic;
+}
+
+.token.entity {
+ cursor: help;
+}
diff --git a/demo/assets/css/style.css b/demo/assets/css/style.css
new file mode 100644
index 0000000000..55492779f8
--- /dev/null
+++ b/demo/assets/css/style.css
@@ -0,0 +1,248 @@
+/*!
+ * Bootstrap Docs (http://getbootstrap.com)
+ * Copyright 2011-2014 Twitter, Inc.
+ * Licensed under the Creative Commons Attribution 3.0 Unported License. For
+ * details, see http://creativecommons.org/licenses/by/3.0/.
+ */
+
+.h1, .h2, .h3, h1, h2, h3 {
+ margin-top: 20px;
+ margin-bottom: 10px;
+}
+
+.h1, h1 {
+ font-size: 36px;
+}
+
+.btn-group-lg > .btn, .btn-lg {
+ font-size: 18px;
+}
+
+section {
+ padding-top: 30px;
+}
+
+.bd-pageheader {
+ margin-top: 51px;
+}
+
+.page-header {
+ padding-bottom: 9px;
+ margin: 40px 0 20px;
+ border-bottom: 1px solid #eee;
+}
+
+.navbar-default .navbar-nav > li > a {
+ color: #777;
+}
+
+.navbar {
+ padding: 0;
+}
+
+.navbar-nav .nav-item {
+ margin-left: 0 !important;
+}
+
+.nav > li > a {
+ position: relative;
+ display: block;
+ padding: 10px 15px;
+}
+
+.nav .navbar-brand {
+ float: left;
+ height: 50px;
+ padding: 15px 15px;
+ font-size: 18px;
+ line-height: 20px;
+ margin-right: 0 !important;
+}
+
+.navbar-brand {
+ color: #777;
+ float: left;
+ height: 50px;
+ padding: 15px 15px;
+ font-size: 18px;
+ line-height: 20px;
+}
+
+.navbar-toggler {
+ margin-top: 8px;
+ margin-right: 15px;
+}
+
+.navbar-default .navbar-nav > li > a:focus, .navbar-default .navbar-nav > li > a:hover {
+ color: #333;
+ background-color: transparent;
+}
+
+.bd-pageheader, .bs-docs-masthead {
+ position: relative;
+ padding: 30px 0;
+ color: #cdbfe3;
+ text-align: center;
+ text-shadow: 0 1px 0 rgba(0, 0, 0, .1);
+ background-color: #6f5499;
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#563d7c), to(#6f5499));
+ background-image: -webkit-linear-gradient(top, #563d7c 0, #6f5499 100%);
+ background-image: -o-linear-gradient(top, #563d7c 0, #6f5499 100%);
+ background-image: linear-gradient(to bottom, #563d7c 0, #6f5499 100%);
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#563d7c', endColorstr='#6F5499', GradientType=0);
+ background-repeat: repeat-x;
+}
+
+.bd-pageheader {
+ margin-bottom: 40px;
+ font-size: 20px;
+}
+
+.bd-pageheader h1 {
+ margin-top: 0;
+ color: #fff;
+}
+
+.bd-pageheader p {
+ margin-bottom: 0;
+ font-weight: 300;
+ line-height: 1.4;
+}
+
+.bd-pageheader .btn {
+ margin: 10px 0;
+}
+
+.scrollable-menu .nav-link {
+ color: #337ab7;
+ font-size: 14px;
+}
+
+.scrollable-menu .nav-link:hover {
+ color: #23527c;
+ background-color: #eee;
+}
+
+@media (min-width: 992px) {
+ .bd-pageheader h1, .bd-pageheader p {
+ margin-right: 380px;
+ }
+}
+
+@media (min-width: 768px) {
+ .bd-pageheader {
+ padding-top: 60px;
+ padding-bottom: 60px;
+ font-size: 24px;
+ text-align: left;
+ }
+
+ .bd-pageheader h1 {
+ font-size: 60px;
+ line-height: 1;
+ }
+
+ .navbar-nav > li > a.nav-link {
+ padding-top: 15px;
+ padding-bottom: 15px;
+ font-size: 14px;
+ }
+
+ .navbar > .container .navbar-brand, .navbar > .container-fluid .navbar-brand {
+ margin-left: -15px;
+ }
+}
+
+@media (max-width: 767px) {
+ .hidden-xs {
+ display: none !important;
+ }
+
+ .navbar .container {
+ width: 100%;
+ max-width: 100%;
+ }
+ .navbar .container,
+ .navbar .container .navbar-header {
+ padding: 0;
+ margin: 0;
+ }
+}
+
+@media (max-width: 400px) {
+ code, kbd {
+ font-size: 60%;
+ }
+}
+
+/**
+ * VH and VW units can cause issues on iOS devices: http://caniuse.com/#feat=viewport-units
+ *
+ * To overcome this, create media queries that target the width, height, and orientation of iOS devices.
+ * It isn't optimal, but there is really no other way to solve the problem. In this example, I am fixing
+ * the height of element '.scrollable-menu' —which is a full width and height cover image.
+ *
+ * iOS Resolution Quick Reference: http://www.iosres.com/
+ */
+
+.scrollable-menu {
+ height: 90vh !important;
+ width: 100vw;
+ overflow-x: hidden;
+ padding: 0 0 20px;
+}
+
+/**
+ * iPad with portrait orientation.
+ */
+@media all and (device-width: 768px) and (device-height: 1024px) and (orientation: portrait) {
+ .scrollable-menu {
+ height: 1024px !important;
+ }
+}
+
+/**
+ * iPad with landscape orientation.
+ */
+@media all and (device-width: 768px) and (device-height: 1024px) and (orientation: landscape) {
+ .scrollable-menu {
+ height: 768px !important;
+ }
+}
+
+/**
+ * iPhone 5
+ * You can also target devices with aspect ratio.
+ */
+@media screen and (device-aspect-ratio: 40/71) {
+ .scrollable-menu {
+ height: 500px !important;
+ }
+}
+
+.navbar-default .navbar-toggle .icon-bar {
+ background-color: #888;
+}
+
+.navbar-toggle:focus {
+ outline: 0
+}
+
+.navbar-toggle .icon-bar {
+ display: block;
+ width: 22px;
+ height: 2px;
+ border-radius: 1px
+}
+
+.navbar-toggle .icon-bar + .icon-bar {
+ margin-top: 4px
+}
+
+pre {
+ white-space: pre-wrap; /* CSS 3 */
+ white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
+ white-space: -pre-wrap; /* Opera 4-6 */
+ white-space: -o-pre-wrap; /* Opera 7 */
+ word-wrap: break-word; /* Internet Explorer 5.5+ */
+}
diff --git a/demo/components/accordion-demo.ts b/demo/components/accordion-demo.ts
deleted file mode 100644
index d1578c22f8..0000000000
--- a/demo/components/accordion-demo.ts
+++ /dev/null
@@ -1,79 +0,0 @@
-///
-
-import {Component, View, bootstrap,
- CORE_DIRECTIVES, FORM_DIRECTIVES,
- NgClass
-} from 'angular2/angular2';
-
-import {accordion} from '../../components/index';
-
-@Component({
- selector: 'accordion-demo'
-})
-@View({
- template: `
-
- Accordion demo
-
-
- Toggle last panel
- Enable / Disable first panel
-
-
-
-
-
- Open only one at a time
-
-
-
-
- This content is straight in the template.
-
-
- {{group.content}}
-
-
- The body of the accordion group grows to fit the contents
- Add Item
- {{item}}
-
-
-
- I can have markup, too!
-
- This is just some content to illustrate fancy headings.
-
-
-
- `,
- directives: [accordion, NgClass, CORE_DIRECTIVES, FORM_DIRECTIVES]
-})
-export class AccordionDemo {
- public oneAtATime:boolean = true;
- public groups:Array = [
- {
- title: 'Dynamic Group Header - 1',
- content: 'Dynamic Group Body - 1'
- },
- {
- title: 'Dynamic Group Header - 2',
- content: 'Dynamic Group Body - 2'
- }
- ];
- public items:Array = ['Item 1', 'Item 2', 'Item 3'];
-
- public status:Object = {
- isFirstOpen: true,
- isFirstDisabled: false
- };
-
- public addItem() {
- this.items.push(`Items ${this.items.length + 1}`);
- }
-}
diff --git a/demo/components/accordion-section.ts b/demo/components/accordion-section.ts
new file mode 100644
index 0000000000..1e642bce4b
--- /dev/null
+++ b/demo/components/accordion-section.ts
@@ -0,0 +1,64 @@
+///
+
+import {Component, View, CORE_DIRECTIVES, NgNonBindable} from 'angular2/angular2';
+
+import {tabs} from '../../components/index';
+import {AccordionDemo} from './accordion/accordion-demo';
+
+let name = 'Accordion';
+let src = 'https://github.com/valor-software/ng2-bootstrap/blob/master/components/accordion/accordion.ts';
+// webpack html imports
+let doc = require('../../components/accordion/readme.md');
+let titleDoc = require('../../components/accordion/title.md');
+let ts = require('!!prismjs?lang=typescript!./accordion/accordion-demo.ts');
+let html = require('!!prismjs?lang=markup!./accordion/accordion-demo.html');
+
+@Component({
+ selector: 'accordion-section'
+})
+@View({
+ template: `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ `,
+ directives: [AccordionDemo, tabs, CORE_DIRECTIVES, NgNonBindable]
+})
+export class AccordionSection {
+}
diff --git a/demo/components/accordion/accordion-demo.html b/demo/components/accordion/accordion-demo.html
new file mode 100644
index 0000000000..c445fe9688
--- /dev/null
+++ b/demo/components/accordion/accordion-demo.html
@@ -0,0 +1,38 @@
+
+ Toggle last panel
+
+ Enable / Disable first panel
+
+
+
+
+
+
+ Open only one at a time
+
+
+
+
+ This content is straight in the template.
+
+
+ {{group.content}}
+
+
+ The body of the accordion group grows to fit the contents
+ Add Item
+ {{item}}
+
+
+
+ I can have markup, too!
+
+
+ This is just some content to illustrate fancy headings.
+
+
diff --git a/demo/components/accordion/accordion-demo.ts b/demo/components/accordion/accordion-demo.ts
new file mode 100644
index 0000000000..88c13057f0
--- /dev/null
+++ b/demo/components/accordion/accordion-demo.ts
@@ -0,0 +1,43 @@
+///
+
+import {
+ Component, View,
+ CORE_DIRECTIVES, FORM_DIRECTIVES, NgClass
+} from 'angular2/angular2';
+
+import {accordion} from '../../../components/index';
+
+// webpack html imports
+let template = require('./accordion-demo.html');
+
+@Component({
+ selector: 'accordion-demo'
+})
+@View({
+ template: template,
+ directives: [accordion, NgClass, CORE_DIRECTIVES, FORM_DIRECTIVES]
+})
+export class AccordionDemo {
+ public oneAtATime:boolean = true;
+ public items:Array = ['Item 1', 'Item 2', 'Item 3'];
+
+ public status:Object = {
+ isFirstOpen: true,
+ isFirstDisabled: false
+ };
+
+ public groups:Array = [
+ {
+ title: 'Dynamic Group Header - 1',
+ content: 'Dynamic Group Body - 1'
+ },
+ {
+ title: 'Dynamic Group Header - 2',
+ content: 'Dynamic Group Body - 2'
+ }
+ ];
+
+ public addItem() {
+ this.items.push(`Items ${this.items.length + 1}`);
+ }
+}
diff --git a/demo/components/alert-demo.ts b/demo/components/alert-demo.ts
deleted file mode 100644
index ee73a93d6e..0000000000
--- a/demo/components/alert-demo.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-///
-
-import {Component, View, bootstrap, CORE_DIRECTIVES} from 'angular2/angular2';
-
-import {Alert} from '../../components/index';
-
-@Component({
- selector: 'alert-demo'
-})
-@View({
- template: `
-
- Alerts demo
- Hello, {{name}}!
- This alert will dismiss in 3s
- {{ alert.msg }}
-
- Add Alert
- `,
- directives: [Alert, CORE_DIRECTIVES]
-})
-export class AlertDemo {
- alerts:Array;
-
- constructor() {
- this.alerts = [
- {type: 'danger', msg: 'Oh snap! Change a few things up and try submitting again.'},
- {type: 'success', msg: 'Well done! You successfully read this important alert message.', closable: true}
- ];
- }
-
- closeAlert(i:number) {
- this.alerts.splice(i, 1);
- }
-
- addAlert() {
- this.alerts.push({msg: 'Another alert!', closable: true});
- }
-}
diff --git a/demo/components/alert-section.ts b/demo/components/alert-section.ts
new file mode 100644
index 0000000000..07f1f54d68
--- /dev/null
+++ b/demo/components/alert-section.ts
@@ -0,0 +1,66 @@
+///
+
+import {Component, View, CORE_DIRECTIVES, NgNonBindable} from 'angular2/angular2';
+
+import {tabs} from '../../components/index';
+import {AlertDemo} from './alert/alert-demo';
+
+let name = 'Alerts';
+let src = 'https://github.com/valor-software/ng2-bootstrap/blob/master/components/alert/alert.ts';
+
+// webpack html imports
+let doc = require('../../components/alert/readme.md');
+let titleDoc = require('../../components/alert/title.md');
+
+let ts = require('!!prismjs?lang=typescript!./alert/alert-demo.ts');
+let html = require('!!prismjs?lang=markup!./alert/alert-demo.html');
+
+@Component({
+ selector: 'alert-section'
+})
+@View({
+ template: `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ `,
+ directives: [AlertDemo, tabs, CORE_DIRECTIVES, NgNonBindable]
+})
+export class AlertSection {
+}
diff --git a/demo/components/alert/alert-demo.html b/demo/components/alert/alert-demo.html
new file mode 100644
index 0000000000..f1b91a3f8c
--- /dev/null
+++ b/demo/components/alert/alert-demo.html
@@ -0,0 +1,7 @@
+
+ {{ alert.msg }}
+
+
+This alert will dismiss in 3s
+
+Add Alert
diff --git a/demo/components/alert/alert-demo.ts b/demo/components/alert/alert-demo.ts
new file mode 100644
index 0000000000..706c634b2a
--- /dev/null
+++ b/demo/components/alert/alert-demo.ts
@@ -0,0 +1,36 @@
+///
+
+import {Component, View, NgFor} from 'angular2/angular2';
+import {Alert} from '../../../components/index';
+
+// webpack html imports
+let template = require('./alert-demo.html');
+
+@Component({
+ selector: 'alert-demo'
+})
+@View({
+ template: template,
+ directives: [Alert, NgFor]
+})
+export class AlertDemo {
+ alerts:Array = [
+ {
+ type: 'danger',
+ msg: 'Oh snap! Change a few things up and try submitting again.'
+ },
+ {
+ type: 'success',
+ msg: 'Well done! You successfully read this important alert message.',
+ closable: true
+ }
+ ];
+
+ closeAlert(i:number) {
+ this.alerts.splice(i, 1);
+ }
+
+ addAlert() {
+ this.alerts.push({msg: 'Another alert!', closable: true});
+ }
+}
diff --git a/demo/components/buttons-demo.ts b/demo/components/buttons-demo.ts
deleted file mode 100644
index c3ee584b35..0000000000
--- a/demo/components/buttons-demo.ts
+++ /dev/null
@@ -1,52 +0,0 @@
-///
-
-import {Component, View, bootstrap} from 'angular2/angular2';
-import {CORE_DIRECTIVES, FORM_DIRECTIVES} from 'angular2/angular2';
-
-
-import {ButtonCheckbox, ButtonRadio} from '../../components/index';
-
-@Component({
- selector: 'buttons-demo'
-})
-@View({
- template: `
-
- Buttons
- Single toggle
-
-
- Single Toggle
-
- Checkbox
-
-
-
- Left
- Middle
- Right
-
- Radio & Uncheckable Radio
-
-
- Left
- Middle
- Right
-
-
- Left
- Middle
- Right
-
-
- `,
- directives: [
- CORE_DIRECTIVES, FORM_DIRECTIVES,
- ButtonCheckbox, ButtonRadio
- ]
-})
-export class ButtonsDemo {
- singleModel:string = '1';
- checkModel:Object = {left: false, middle: true, right: false};
- radioModel:string = 'Middle';
-}
diff --git a/demo/components/buttons-section.ts b/demo/components/buttons-section.ts
new file mode 100644
index 0000000000..4f9e0934bb
--- /dev/null
+++ b/demo/components/buttons-section.ts
@@ -0,0 +1,68 @@
+///
+
+import {Component, View, CORE_DIRECTIVES, NgNonBindable} from 'angular2/angular2';
+
+import {tabs} from '../../components/index';
+import {ButtonsDemo} from './buttons/buttons-demo';
+
+let name = 'Buttons';
+let src = 'https://github.com/valor-software/ng2-bootstrap/blob/master/components/buttons/';
+
+// webpack html imports
+let doc = require('../../components/buttons/readme.md');
+let titleDoc = require('../../components/buttons/title.md');
+
+let ts = require('!!prismjs?lang=typescript!./buttons/buttons-demo.ts');
+let html = require('!!prismjs?lang=markup!./buttons/buttons-demo.html');
+
+@Component({
+ selector: 'buttons-section'
+})
+@View({
+ template: `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ `,
+ directives: [ButtonsDemo, tabs, CORE_DIRECTIVES, NgNonBindable]
+})
+export class ButtonsSection {
+}
diff --git a/demo/components/buttons/buttons-demo.html b/demo/components/buttons/buttons-demo.html
new file mode 100644
index 0000000000..4bf2ca1075
--- /dev/null
+++ b/demo/components/buttons/buttons-demo.html
@@ -0,0 +1,27 @@
+Single toggle
+
+
+ Single Toggle
+
+Checkbox
+
+
+
+ Left
+ Middle
+ Right
+
+Radio & Uncheckable Radio
+
+
+ Left
+ Middle
+ Right
+
+
+ Left
+ Middle
+ Right
+
diff --git a/demo/components/buttons/buttons-demo.ts b/demo/components/buttons/buttons-demo.ts
new file mode 100644
index 0000000000..6cc2824241
--- /dev/null
+++ b/demo/components/buttons/buttons-demo.ts
@@ -0,0 +1,27 @@
+///
+
+import {
+ Component, View,
+ CORE_DIRECTIVES, FORM_DIRECTIVES
+} from 'angular2/angular2';
+
+import {ButtonCheckbox, ButtonRadio} from '../../../components/index';
+
+// webpack html imports
+let template = require('./buttons-demo.html');
+
+@Component({
+ selector: 'buttons-demo'
+})
+@View({
+ template:template,
+ directives: [
+ ButtonCheckbox, ButtonRadio,
+ CORE_DIRECTIVES, FORM_DIRECTIVES
+ ]
+})
+export class ButtonsDemo {
+ private singleModel:string = '1';
+ private radioModel:string = 'Middle';
+ private checkModel:Object = {left: false, middle: true, right: false};
+}
diff --git a/demo/components/carousel-demo.ts b/demo/components/carousel-demo.ts
deleted file mode 100644
index be575937f8..0000000000
--- a/demo/components/carousel-demo.ts
+++ /dev/null
@@ -1,72 +0,0 @@
-///
-
-import {Component, View, NgFor, bootstrap, CORE_DIRECTIVES, FORM_DIRECTIVES} from 'angular2/angular2';
-
-import {carousel} from '../../components/index';
-
-@Component({
- selector: 'carousel-demo'
-})
-@View({
- template: `
-
-Carousel demo
-
-
-
-
-
-
-
-
Slide {{index}}
-
{{slidez.text}}
-
-
-
-
-
-
-
-
Add Slide
-
Remove Slide#3
-
-
-
- Disable Slide Looping
-
-
-
-
- Interval, in milliseconds:
- Enter a negative number or 0 to stop the interval.
-
-
-
-
- `,
- directives: [carousel, CORE_DIRECTIVES, FORM_DIRECTIVES]
-})
-export class CarouselDemo {
- private myInterval:number = 5000;
- private noWrapSlides:boolean = false;
- private slides:Array = [];
-
- constructor() {
- for (let i = 0; i < 4; i++) {
- this.addSlide();
- }
- }
-
- private addSlide() {
- let newWidth = 600 + this.slides.length + 1;
- this.slides.push({
- image: `//placekitten.com/${newWidth}/300`,
- text: `${['More', 'Extra', 'Lots of', 'Surplus'][this.slides.length % 4]}
- ${['Cats', 'Kittys', 'Felines', 'Cutes'][this.slides.length % 4]}`
- });
- }
-
- private removeSlide(index) {
- this.slides.splice(index, 1);
- }
-}
diff --git a/demo/components/carousel-section.ts b/demo/components/carousel-section.ts
new file mode 100644
index 0000000000..7d72ef9b5f
--- /dev/null
+++ b/demo/components/carousel-section.ts
@@ -0,0 +1,68 @@
+///
+
+import {Component, View, CORE_DIRECTIVES, NgNonBindable} from 'angular2/angular2';
+
+import {tabs} from '../../components/index';
+import {CarouselDemo} from './carousel/carousel-demo';
+
+let name = 'Carousel';
+let src = 'https://github.com/valor-software/ng2-bootstrap/blob/master/components/carousel/carousel.ts';
+
+// webpack html imports
+let doc = require('../../components/carousel/readme.md');
+let titleDoc = require('../../components/carousel/title.md');
+
+let ts = require('!!prismjs?lang=typescript!./carousel/carousel-demo.ts');
+let html = require('!!prismjs?lang=markup!./carousel/carousel-demo.html');
+
+@Component({
+ selector: 'carousel-section'
+})
+@View({
+ template: `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ `,
+ directives: [CarouselDemo, tabs, CORE_DIRECTIVES, NgNonBindable]
+})
+export class CarouselSection {
+}
diff --git a/demo/components/carousel/carousel-demo.html b/demo/components/carousel/carousel-demo.html
new file mode 100644
index 0000000000..f996ea9bf4
--- /dev/null
+++ b/demo/components/carousel/carousel-demo.html
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
Slide {{index}}
+
+
{{slidez.text}}
+
+
+
+
+
+
+
Add Slide
+
+
+
+
+
+
+
+
+
+
+ Disable Slide Looping
+
+
+
+ Interval, in milliseconds:
+
Enter a negative number or 0 to stop the interval.
+
+
diff --git a/demo/components/carousel/carousel-demo.ts b/demo/components/carousel/carousel-demo.ts
new file mode 100644
index 0000000000..5672233b96
--- /dev/null
+++ b/demo/components/carousel/carousel-demo.ts
@@ -0,0 +1,39 @@
+///
+
+import {Component, View, CORE_DIRECTIVES, FORM_DIRECTIVES} from 'angular2/angular2';
+import {carousel} from '../../../components/index';
+
+// webpack html imports
+let template = require('./carousel-demo.html');
+
+@Component({
+ selector: 'carousel-demo'
+})
+@View({
+ template: template,
+ directives: [carousel, CORE_DIRECTIVES, FORM_DIRECTIVES]
+})
+export class CarouselDemo {
+ private myInterval:number = 5000;
+ private noWrapSlides:boolean = false;
+ private slides:Array = [];
+
+ constructor() {
+ for (let i = 0; i < 4; i++) {
+ this.addSlide();
+ }
+ }
+
+ private addSlide() {
+ let newWidth = 600 + this.slides.length + 1;
+ this.slides.push({
+ image: `//placekitten.com/${newWidth}/300`,
+ text: `${['More', 'Extra', 'Lots of', 'Surplus'][this.slides.length % 4]}
+ ${['Cats', 'Kittys', 'Felines', 'Cutes'][this.slides.length % 4]}`
+ });
+ }
+
+ private removeSlide(index) {
+ this.slides.splice(index, 1);
+ }
+}
diff --git a/demo/components/collapse-demo.ts b/demo/components/collapse-demo.ts
deleted file mode 100644
index fa65281bdd..0000000000
--- a/demo/components/collapse-demo.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-///
-
-import {Component, View, bootstrap, CORE_DIRECTIVES} from 'angular2/angular2';
-
-import {Collapse} from '../../components/index';
-
-@Component({
- selector: 'collapse-demo'
-})
-@View({
- template: `
-
- Collapse demo
-
- Toggle collapse
-
-
-
- `,
- directives: [Collapse, CORE_DIRECTIVES]
-})
-export class CollapseDemo {
- public isCollapsed:boolean = false;
-}
diff --git a/demo/components/collapse-section.ts b/demo/components/collapse-section.ts
new file mode 100644
index 0000000000..b850799939
--- /dev/null
+++ b/demo/components/collapse-section.ts
@@ -0,0 +1,68 @@
+///
+
+import {Component, View, CORE_DIRECTIVES, NgNonBindable} from 'angular2/angular2';
+
+import {tabs} from '../../components/index';
+import {CollapseDemo} from './collapse/collapse-demo';
+
+let name = 'Collapse';
+let src = 'https://github.com/valor-software/ng2-bootstrap/blob/master/components/collapse/collapse.ts';
+
+// webpack html imports
+let doc = require('../../components/collapse/readme.md');
+let titleDoc = require('../../components/collapse/title.md');
+
+let ts = require('!!prismjs?lang=typescript!./collapse/collapse-demo.ts');
+let html = require('!!prismjs?lang=markup!./collapse/collapse-demo.html');
+
+@Component({
+ selector: 'collapse-section'
+})
+@View({
+ template: `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ `,
+ directives: [CollapseDemo, tabs, CORE_DIRECTIVES, NgNonBindable]
+})
+export class CollapseSection {
+}
diff --git a/demo/components/collapse/collapse-demo.html b/demo/components/collapse/collapse-demo.html
new file mode 100644
index 0000000000..924540b4c3
--- /dev/null
+++ b/demo/components/collapse/collapse-demo.html
@@ -0,0 +1,7 @@
+Toggle collapse
+
+
+
diff --git a/demo/components/collapse/collapse-demo.ts b/demo/components/collapse/collapse-demo.ts
new file mode 100644
index 0000000000..4a78e9079d
--- /dev/null
+++ b/demo/components/collapse/collapse-demo.ts
@@ -0,0 +1,17 @@
+///
+import {Component, View} from 'angular2/angular2';
+import {Collapse} from '../../../components/index';
+
+// webpack html imports
+let template = require('./collapse-demo.html');
+
+@Component({
+ selector: 'collapse-demo'
+})
+@View({
+ template: template,
+ directives: [Collapse]
+})
+export class CollapseDemo {
+ public isCollapsed:boolean = false;
+}
diff --git a/demo/components/demo-header.ts b/demo/components/demo-header.ts
new file mode 100644
index 0000000000..694dd2ebd5
--- /dev/null
+++ b/demo/components/demo-header.ts
@@ -0,0 +1,64 @@
+///
+import {Component, View, bootstrap, NgFor} from 'angular2/angular2';
+import {Collapse, dropdown, Ng2BootstrapConfig, Ng2BootstrapTheme} from '../../components/index';
+
+let components = [
+ 'Accordion', 'Alerts', 'Buttons', 'Carousel', 'Collapse', /*'Datepicker',*/
+ 'Dropdowns', /*'Modal',*/ 'Pagination', /*'Popover',*/ 'Progressbar',
+ 'Rating', 'Tabs', 'Timepicker', 'Tooltip', /*'Typeahead'*/
+];
+
+let template = `
+ `;
+
+@Component({
+ selector: 'demo-header'
+})
+@View({
+ template: template,
+ directives: [
+ NgFor,
+ Collapse,
+ dropdown
+ ]
+})
+export class DemoHeader {
+ private components:Array = components;
+ private prefix:string;
+
+ constructor() {
+ this.prefix = Ng2BootstrapConfig.theme === Ng2BootstrapTheme.BS4 ? 'index-bs4.html' : '';
+ }
+}
diff --git a/demo/components/demo-section.ts b/demo/components/demo-section.ts
new file mode 100644
index 0000000000..3d4df30462
--- /dev/null
+++ b/demo/components/demo-section.ts
@@ -0,0 +1,85 @@
+///
+
+import {
+ Component, View,
+ LifecycleEvent,
+ CORE_DIRECTIVES, NgNonBindable
+} from 'angular2/angular2';
+
+import {tabs} from '../../components/index';
+
+let name = 'Alerts';
+let src = 'https://github.com/valor-software/ng2-bootstrap/blob/master/components/alert/alert.ts';
+
+// webpack html imports
+let doc = require('../../components/alert/readme.md');
+let titleDoc = require('../../components/alert/title.md');
+
+let ts = require('!!prismjs?lang=typescript!./alert/alert-demo.ts');
+let html = require('!!prismjs?lang=markup!./alert/alert-demo.html');
+let annotations = require('!!prismjs?lang=typescript!../../components/alert/annotation.md');
+
+export class DemoSectionConfig {
+ public doc: string;
+ public title: string;
+ public ts: string;
+ public html: string;
+ public annotations: string;
+}
+
+@Component({
+ selector: 'demo-section',
+ properties: ['demoSection'],
+ lifecycle: [LifecycleEvent.onInit]
+})
+@View({
+ template: `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
API
+
+
Annotations
+
${annotations}
+ ${doc}
+
+
+
+ `,
+ directives: [tabs, CORE_DIRECTIVES, NgNonBindable]
+})
+export class DemoSection {
+ private demoSection: DemoSectionConfig;
+}
diff --git a/demo/components/dropdown-demo.ts b/demo/components/dropdown-demo.ts
deleted file mode 100644
index 4d0ccc71ed..0000000000
--- a/demo/components/dropdown-demo.ts
+++ /dev/null
@@ -1,127 +0,0 @@
-///
-
-import {Component, View, bootstrap, CORE_DIRECTIVES} from 'angular2/angular2';
-
-import {dropdown} from '../../components/index';
-import {Ng2BootstrapConfig} from '../../components/ng2-bootstrap-config';
-
-@Component({
- selector: 'dropdown-demo'
-})
-@View({
- template: `
-
- Dropdown
-
-
-
-
- Click me for a dropdown, yo!
-
-
-
-
-
-
-
- Button dropdown
-
-
-
-
-
-
- Action
-
-
- Split button!
-
-
-
-
-
-
-
-
-
-
-
-
- Toggle button dropdown
- Enable/Disable
-
-
-
-
-
-
- Dropdown with keyboard navigation
-
-
-
-
-
-
- `,
- directives: [dropdown, CORE_DIRECTIVES]
-})
-export class DropdownDemo {
- disabled = false;
- items: Array = ['The first choice!', 'And another choice for you.', 'but wait! A third!'];
- status = {isopen: false};
- toggled(open:any) {
- console.log('Dropdown is now: ', open);
- }
- toggleDropdown ($event: MouseEvent) {
- $event.preventDefault();
- $event.stopPropagation();
- this.status.isopen = !this.status.isopen;
- }
-}
diff --git a/demo/components/dropdown-section.ts b/demo/components/dropdown-section.ts
new file mode 100644
index 0000000000..050498505e
--- /dev/null
+++ b/demo/components/dropdown-section.ts
@@ -0,0 +1,68 @@
+///
+
+import {Component, View, CORE_DIRECTIVES, NgNonBindable} from 'angular2/angular2';
+
+import {tabs} from '../../components/index';
+import {DropdownDemo} from './dropdown/dropdown-demo';
+
+let name = 'Dropdowns';
+let src = 'https://github.com/valor-software/ng2-bootstrap/blob/master/components/dropdown';
+
+// webpack html imports
+let doc = require('../../components/dropdown/readme.md');
+let titleDoc = require('../../components/dropdown/title.md');
+
+let ts = require('!!prismjs?lang=typescript!./dropdown/dropdown-demo.ts');
+let html = require('!!prismjs?lang=markup!./dropdown/dropdown-demo.html');
+
+@Component({
+ selector: 'dropdown-section'
+})
+@View({
+ template: `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ `,
+ directives: [DropdownDemo, tabs, CORE_DIRECTIVES, NgNonBindable]
+})
+export class DropdownSection {
+}
diff --git a/demo/components/dropdown/dropdown-demo.html b/demo/components/dropdown/dropdown-demo.html
new file mode 100644
index 0000000000..b3fbbef7f4
--- /dev/null
+++ b/demo/components/dropdown/dropdown-demo.html
@@ -0,0 +1,65 @@
+
+
+
+
+ Click me for a dropdown, yo!
+
+
+
+
+
+
+
+ Button dropdown
+
+
+
+
+
+
+ Action
+
+
+ Split button!
+
+
+
+
+
+
+ Toggle button dropdown
+
+ Enable/Disable
+
+
+
+
+
+
+ Dropdown with keyboard navigation
+
+
+
+
diff --git a/demo/components/dropdown/dropdown-demo.ts b/demo/components/dropdown/dropdown-demo.ts
new file mode 100644
index 0000000000..92c21d35d3
--- /dev/null
+++ b/demo/components/dropdown/dropdown-demo.ts
@@ -0,0 +1,31 @@
+///
+
+import {Component, View, CORE_DIRECTIVES} from 'angular2/angular2';
+
+import {dropdown} from '../../../components/index';
+
+// webpack html imports
+let template = require('./dropdown-demo.html');
+
+@Component({
+ selector: 'dropdown-demo'
+})
+@View({
+ template: template,
+ directives: [dropdown, CORE_DIRECTIVES]
+})
+export class DropdownDemo {
+ private disabled:boolean = false;
+ private status:{isopen:boolean} = {isopen: false};
+ private items:Array = ['The first choice!', 'And another choice for you.', 'but wait! A third!'];
+
+ private toggled(open:boolean):void {
+ console.log('Dropdown is now: ', open);
+ }
+
+ private toggleDropdown($event:MouseEvent):void {
+ $event.preventDefault();
+ $event.stopPropagation();
+ this.status.isopen = !this.status.isopen;
+ }
+}
diff --git a/demo/components/dropdown/not-yet-supported.html b/demo/components/dropdown/not-yet-supported.html
new file mode 100644
index 0000000000..dbe24c0a8b
--- /dev/null
+++ b/demo/components/dropdown/not-yet-supported.html
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
diff --git a/demo/components/pagination-demo.ts b/demo/components/pagination-demo.ts
deleted file mode 100644
index ec4c1903d6..0000000000
--- a/demo/components/pagination-demo.ts
+++ /dev/null
@@ -1,52 +0,0 @@
-///
-
-import {Component, View, bootstrap,
- FORM_DIRECTIVES, CORE_DIRECTIVES} from 'angular2/angular2';
-
-import {pagination} from '../../components/index';
-
-@Component({
- selector: 'pagination-demo'
-})
-@View({
- template: `
-
- Pagination demo
-
-
Default
-
-
-
-
-
-
Set current page to: 3
-
-
-
Pager
-
-
-
-
Limit the maximum visible buttons
-
-
-
-
- `,
- directives: [pagination, FORM_DIRECTIVES, CORE_DIRECTIVES]
-})
-export class PaginationDemo {
- private totalItems = 64;
- private currentPage = 4;
-
- private maxSize = 5;
- private bigTotalItems = 175;
- private bigCurrentPage = 1;
-
- private setPage(pageNo) {
- this.currentPage = pageNo;
- };
-
- private pageChanged() {
- console.log('Page changed to: ' + this.currentPage);
- };
-}
diff --git a/demo/components/pagination-section.ts b/demo/components/pagination-section.ts
new file mode 100644
index 0000000000..a1a08251a8
--- /dev/null
+++ b/demo/components/pagination-section.ts
@@ -0,0 +1,65 @@
+///
+import {Component, View, CORE_DIRECTIVES, NgNonBindable} from 'angular2/angular2';
+
+import {tabs} from '../../components/index';
+import {PaginationDemo} from './pagination/pagination-demo';
+
+let name = 'Pagination';
+let src = 'https://github.com/valor-software/ng2-bootstrap/blob/master/components/pagination/pagination.ts';
+
+// webpack html imports
+let doc = require('../../components/pagination/readme.md');
+let titleDoc = require('../../components/pagination/title.md');
+
+let ts = require('!!prismjs?lang=typescript!./pagination/pagination-demo.ts');
+let html = require('!!prismjs?lang=markup!./pagination/pagination-demo.html');
+
+@Component({
+ selector: 'pagination-section'
+})
+@View({
+ template: `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ `,
+ directives: [PaginationDemo, tabs, CORE_DIRECTIVES, NgNonBindable]
+})
+export class PaginationSection {
+}
diff --git a/demo/components/pagination/pagination-demo.html b/demo/components/pagination/pagination-demo.html
new file mode 100644
index 0000000000..b7c805092a
--- /dev/null
+++ b/demo/components/pagination/pagination-demo.html
@@ -0,0 +1,27 @@
+
+
+
Default
+
+
+
+
+
+
Set current page to: 3
+
+
+
+
Pager
+
+
+
+
Limit the maximum visible buttons
+
+
+
+
+
diff --git a/demo/components/pagination/pagination-demo.ts b/demo/components/pagination/pagination-demo.ts
new file mode 100644
index 0000000000..5ea70b8bd1
--- /dev/null
+++ b/demo/components/pagination/pagination-demo.ts
@@ -0,0 +1,30 @@
+///
+import {Component, View, FORM_DIRECTIVES, CORE_DIRECTIVES} from 'angular2/angular2';
+import {pagination} from '../../../components/index';
+
+// webpack html imports
+let template = require('./pagination-demo.html');
+
+@Component({
+ selector: 'pagination-demo'
+})
+@View({
+ template: template,
+ directives: [pagination, FORM_DIRECTIVES, CORE_DIRECTIVES]
+})
+export class PaginationDemo {
+ private totalItems:number = 64;
+ private currentPage:number = 4;
+
+ private maxSize:number = 5;
+ private bigTotalItems:number = 175;
+ private bigCurrentPage:number = 1;
+
+ private setPage(pageNo:number):void {
+ this.currentPage = pageNo;
+ };
+
+ private pageChanged():void {
+ console.log('Page changed to: ' + this.currentPage);
+ };
+}
diff --git a/demo/components/progressbar-demo.ts b/demo/components/progressbar-demo.ts
deleted file mode 100644
index bef854ddcf..0000000000
--- a/demo/components/progressbar-demo.ts
+++ /dev/null
@@ -1,139 +0,0 @@
-///
-
-import {Component, View, bootstrap, CORE_DIRECTIVES, NgStyle} from 'angular2/angular2';
-
-import {progressbar} from '../../components/index';
-import {Ng2BootstrapConfig, Theme} from '../../components/ng2-bootstrap-config';
-
-let templates = {
- [Theme.BS3]: `
-
-
Static
-
-
-
-
Dynamic Randomize
-
{{dynamic}} / {{max}}
-
-
No animation
-
{{dynamic}}%
-
-
Object (changes type based on value)
-
{{type}} !!! Watch out !!!
-
-
-
Stacked Randomize
-
-
- {{baz.value}}%
-
-
-
`,
- [Theme.BS4]: `
- In bootstrap 4 progress has a different concept, no inner text, no default transition animation
- Static
-
-
- Dynamic Randomize
-
- {{dynamic}} / {{max}}
-
-
- No animation
- {{dynamic}}%
-
- Object (changes type based on value)
-
- {{type}} !!! Watch out !!!
-
-
-
- Stacked Randomize
-
-
-
- {{baz.value}}%
-
-
-
-
- `
-};
-
-@Component({
- selector: 'progressbar-demo'
-})
-@View({
- template: `
-
- Progressbar demo
- ${templates[Ng2BootstrapConfig.theme]}
- `,
- directives: [progressbar, CORE_DIRECTIVES, NgStyle]
-})
-export class ProgressbarDemo {
- public max:number = 200;
- public showWarning:boolean;
- public dynamic:number;
- public type:string;
- public stacked:Array = [];
-
- constructor() {
- this.random();
- this.randomStacked();
- }
-
- private random() {
- let value = Math.floor((Math.random() * 100) + 1);
- let type;
-
- if (value < 25) {
- type = 'success';
- } else if (value < 50) {
- type = 'info';
- } else if (value < 75) {
- type = 'warning';
- } else {
- type = 'danger';
- }
-
- this.showWarning = (type === 'danger' || type === 'warning');
- this.dynamic = value;
- this.type = type;
- };
-
- private randomStacked() {
- let types = ['success', 'info', 'warning', 'danger'];
-
- this.stacked = [];
- let total = 0;
- for (let i = 0, n = Math.floor((Math.random() * 4) + 1); i < n; i++) {
- let index = Math.floor((Math.random() * 4));
- let value = Math.floor((Math.random() * 30) + 1);
- total += value;
- this.stacked.push({
- value: value,
- max: value, // i !== (n - 1) ? value : 100,
- type: types[index]
- });
- }
- };
-}
diff --git a/demo/components/progressbar-section.ts b/demo/components/progressbar-section.ts
new file mode 100644
index 0000000000..05d5068866
--- /dev/null
+++ b/demo/components/progressbar-section.ts
@@ -0,0 +1,71 @@
+///
+
+import {Component, View, CORE_DIRECTIVES, NgNonBindable} from 'angular2/angular2';
+import {Ng2BootstrapConfig, Ng2BootstrapTheme} from '../../components/ng2-bootstrap-config';
+
+import {tabs} from '../../components/index';
+import {ProgressbarDemo} from './progressbar/progressbar-demo';
+
+let name = 'Progressbar';
+let src = 'https://github.com/valor-software/ng2-bootstrap/blob/master/components/progressbar/progressbar.ts';
+
+// webpack html imports
+let doc = require('../../components/progressbar/readme.md');
+let titleDoc = require('../../components/progressbar/title.md');
+
+let ts = require('!!prismjs?lang=typescript!./progressbar/progressbar-demo.ts');
+let templates = {
+ [Ng2BootstrapTheme.BS3]: require('!!prismjs?lang=markup!./progressbar/progressbar-demo.html'),
+ [Ng2BootstrapTheme.BS4]: require('!!prismjs?lang=markup!./progressbar/progressbar-demo-bs4.html')
+};
+let html = templates[Ng2BootstrapConfig.theme];
+
+@Component({
+ selector: 'progressbar-section'
+})
+@View({
+ template: `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ `,
+ directives: [ProgressbarDemo, tabs, CORE_DIRECTIVES, NgNonBindable]
+})
+export class ProgressbarSection {
+}
diff --git a/demo/components/progressbar/progressbar-demo-bs4.html b/demo/components/progressbar/progressbar-demo-bs4.html
new file mode 100644
index 0000000000..e7c80747d4
--- /dev/null
+++ b/demo/components/progressbar/progressbar-demo-bs4.html
@@ -0,0 +1,41 @@
+In bootstrap 4 progress has a different concept, no inner text, no default transition animation
+Static
+
+
+Dynamic Randomize
+
+ {{dynamic}} / {{max}}
+
+
+No animation
+{{dynamic}}%
+
+Object (changes type based on value)
+
+ {{type}} !!! Watch out !!!
+
+
+
+Stacked Randomize
+
+
+
+ {{baz.value}}%
+
+
+
+
diff --git a/demo/components/progressbar/progressbar-demo.html b/demo/components/progressbar/progressbar-demo.html
new file mode 100644
index 0000000000..84a43b4289
--- /dev/null
+++ b/demo/components/progressbar/progressbar-demo.html
@@ -0,0 +1,36 @@
+Static
+
+
+
+Dynamic
+ Randomize
+
+{{dynamic}} / {{max}}
+
+
+No animation
+{{dynamic}}%
+
+Object (changes type based on value)
+{{type}} !!!
+ Watch out !!!
+
+
+Stacked
+ Randomize
+
+
+
+ {{baz.value}}%
+
+
diff --git a/demo/components/progressbar/progressbar-demo.ts b/demo/components/progressbar/progressbar-demo.ts
new file mode 100644
index 0000000000..81d779838d
--- /dev/null
+++ b/demo/components/progressbar/progressbar-demo.ts
@@ -0,0 +1,68 @@
+///
+import {Component, View, CORE_DIRECTIVES, NgStyle} from 'angular2/angular2';
+// switch bs3\bs4 templates
+import {Ng2BootstrapConfig, Ng2BootstrapTheme} from '../../../components/ng2-bootstrap-config';
+
+import {progressbar} from '../../../components/index';
+
+// webpack html imports
+let templates = {
+ [Ng2BootstrapTheme.BS3]: require('./progressbar-demo.html'),
+ [Ng2BootstrapTheme.BS4]: require('./progressbar-demo-bs4.html')
+};
+
+@Component({
+ selector: 'progressbar-demo'
+})
+@View({
+ template: templates[Ng2BootstrapConfig.theme],
+ directives: [progressbar, CORE_DIRECTIVES, NgStyle]
+})
+export class ProgressbarDemo {
+ public max:number = 200;
+ public showWarning:boolean;
+ public dynamic:number;
+ public type:string;
+ public stacked:Array = [];
+
+ constructor() {
+ this.random();
+ this.randomStacked();
+ }
+
+ private random() {
+ let value = Math.floor((Math.random() * 100) + 1);
+ let type;
+
+ if (value < 25) {
+ type = 'success';
+ } else if (value < 50) {
+ type = 'info';
+ } else if (value < 75) {
+ type = 'warning';
+ } else {
+ type = 'danger';
+ }
+
+ this.showWarning = (type === 'danger' || type === 'warning');
+ this.dynamic = value;
+ this.type = type;
+ };
+
+ private randomStacked() {
+ let types = ['success', 'info', 'warning', 'danger'];
+
+ this.stacked = [];
+ let total = 0;
+ for (let i = 0, n = Math.floor((Math.random() * 4) + 1); i < n; i++) {
+ let index = Math.floor((Math.random() * 4));
+ let value = Math.floor((Math.random() * 30) + 1);
+ total += value;
+ this.stacked.push({
+ value: value,
+ max: value, // i !== (n - 1) ? value : 100,
+ type: types[index]
+ });
+ }
+ };
+}
diff --git a/demo/components/rating-demo.ts b/demo/components/rating-demo.ts
deleted file mode 100644
index a211312598..0000000000
--- a/demo/components/rating-demo.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-///
-
-import {Component, View, bootstrap,
- NgClass, NgStyle,
- CORE_DIRECTIVES, FORM_DIRECTIVES} from 'angular2/angular2';
-
-import {Rating} from '../../components/index';
-
-@Component({
- selector: 'rating-demo'
-})
-@View({
- template: `
-
- Rating demo
-
-
Default
-
-
=30 && percent<70, 'label-success': percent>=70}" [ng-style]="{display: (overStar && !isReadonly) ? 'inline' : 'none'}">{{percent}}%
-
-
-
-
Clear
-
Toggle Readonly
-
-
-
Custom icons
-
- (Rate: {{x}})
-
-
- (Rate: {{y}})
-
- `,
- directives: [Rating, NgClass, NgStyle, FORM_DIRECTIVES, CORE_DIRECTIVES]
-})
-export class RatingDemo {
- private x = 5;
- private y = 2;
- private max = 10;
- private rate = 7;
- private isReadonly = false;
-
- private overStar:number;
- private percent:number;
-
- private ratingStates = [
- {stateOn: 'glyphicon-ok-sign', stateOff: 'glyphicon-ok-circle'},
- {stateOn: 'glyphicon-star', stateOff: 'glyphicon-star-empty'},
- {stateOn: 'glyphicon-heart', stateOff: 'glyphicon-ban-circle'},
- {stateOn: 'glyphicon-heart'},
- {stateOff: 'glyphicon-off'}
- ];
-
- private hoveringOver(value:number) {
- this.overStar = value;
- this.percent = 100 * (value / this.max);
- };
-
- private test() {
- this.overStar = null;
- }
-}
diff --git a/demo/components/rating-section.ts b/demo/components/rating-section.ts
new file mode 100644
index 0000000000..fe29059a23
--- /dev/null
+++ b/demo/components/rating-section.ts
@@ -0,0 +1,65 @@
+///
+import {Component, View, CORE_DIRECTIVES, NgNonBindable} from 'angular2/angular2';
+
+import {tabs} from '../../components/index';
+import {RatingDemo} from './rating/rating-demo';
+
+let name = 'Rating';
+let src = 'https://github.com/valor-software/ng2-bootstrap/blob/master/components/rating/rating.ts';
+
+// webpack html imports
+let doc = require('../../components/rating/readme.md');
+let titleDoc = require('../../components/rating/title.md');
+
+let ts = require('!!prismjs?lang=typescript!./rating/rating-demo.ts');
+let html = require('!!prismjs?lang=markup!./rating/rating-demo.html');
+
+@Component({
+ selector: 'rating-section'
+})
+@View({
+ template: `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ `,
+ directives: [RatingDemo, tabs, CORE_DIRECTIVES, NgNonBindable]
+})
+export class RatingSection {
+}
diff --git a/demo/components/rating/rating-demo.html b/demo/components/rating/rating-demo.html
new file mode 100644
index 0000000000..7d5ddc4539
--- /dev/null
+++ b/demo/components/rating/rating-demo.html
@@ -0,0 +1,28 @@
+Default
+
+=30 && percent<70, 'label-success': percent>=70}"
+ [ng-style]="{display: (overStar && !isReadonly) ? 'inline' : 'none'}">{{percent}}%
+
+
+
+Clear
+
+Toggle Readonly
+
+
+
+Custom icons
+
+
+ (Rate: {{x}})
+
+
+
+ (Rate: {{y}})
+
diff --git a/demo/components/rating/rating-demo.ts b/demo/components/rating/rating-demo.ts
new file mode 100644
index 0000000000..3b3c47ceaf
--- /dev/null
+++ b/demo/components/rating/rating-demo.ts
@@ -0,0 +1,45 @@
+///
+import {
+ Component, View, NgClass, NgStyle,
+ CORE_DIRECTIVES, FORM_DIRECTIVES
+} from 'angular2/angular2';
+
+import {Rating} from '../../../components/index';
+
+// webpack html imports
+let template = require('./rating-demo.html');
+
+@Component({
+ selector: 'rating-demo'
+})
+@View({
+ template: template,
+ directives: [Rating, NgClass, NgStyle, FORM_DIRECTIVES, CORE_DIRECTIVES]
+})
+export class RatingDemo {
+ private x:number = 5;
+ private y:number = 2;
+ private max:number = 10;
+ private rate:number = 7;
+ private isReadonly:boolean = false;
+
+ private overStar:number;
+ private percent:number;
+
+ private ratingStates:any = [
+ {stateOn: 'glyphicon-ok-sign', stateOff: 'glyphicon-ok-circle'},
+ {stateOn: 'glyphicon-star', stateOff: 'glyphicon-star-empty'},
+ {stateOn: 'glyphicon-heart', stateOff: 'glyphicon-ban-circle'},
+ {stateOn: 'glyphicon-heart'},
+ {stateOff: 'glyphicon-off'}
+ ];
+
+ private hoveringOver(value:number):void {
+ this.overStar = value;
+ this.percent = 100 * (value / this.max);
+ };
+
+ private resetStar() {
+ this.overStar = null;
+ }
+}
diff --git a/demo/components/tabs-demo.ts b/demo/components/tabs-demo.ts
deleted file mode 100644
index 764a1531bc..0000000000
--- a/demo/components/tabs-demo.ts
+++ /dev/null
@@ -1,71 +0,0 @@
-///
-
-import {Component, View, bootstrap, CORE_DIRECTIVES} from 'angular2/angular2';
-
-import {tabs} from '../../components/index';
-
-@Component({
- selector: 'tabs-demo'
-})
-@View({
- template: `
-
- Tabs demo
-
-
Select a tab by setting active binding to true:
-
- Select second tab
- Select third tab
-
-
- Enable / Disable third tab
-
-
-
- Static content
-
- {{tabz.content}}
-
-
-
- Alert!
-
- I've got an HTML heading, and a select callback. Pretty cool!
-
-
-
-
-
-
- Vertical content 1
- Vertical content 2
-
-
-
-
-
- Justified content
- Short Labeled Justified content
- Long Labeled Justified content
-
-
- `,
- directives: [tabs, CORE_DIRECTIVES]
-})
-export class TabsDemo {
- private tabs:Array = [
- {title: 'Dynamic Title 1', content: 'Dynamic content 1'},
- {title: 'Dynamic Title 2', content: 'Dynamic content 2', disabled: true}
- ];
-
- alertMe() {
- setTimeout(function () {
- alert('You\'ve selected the alert tab!');
- });
- };
-}
diff --git a/demo/components/tabs-section.ts b/demo/components/tabs-section.ts
new file mode 100644
index 0000000000..354ba38ecb
--- /dev/null
+++ b/demo/components/tabs-section.ts
@@ -0,0 +1,66 @@
+///
+
+import {Component, View, CORE_DIRECTIVES, NgNonBindable} from 'angular2/angular2';
+
+import {tabs} from '../../components/index';
+import {TabsDemo} from './tabs/tabs-demo';
+
+let name = 'Tabs';
+let src = 'https://github.com/valor-software/ng2-bootstrap/blob/master/components/tabs/tabs.ts';
+
+// webpack html imports
+let doc = require('../../components/tabs/readme.md');
+let titleDoc = require('../../components/tabs/title.md');
+
+let ts = require('!!prismjs?lang=typescript!./tabs/tabs-demo.ts');
+let html = require('!!prismjs?lang=markup!./tabs/tabs-demo.html');
+
+@Component({
+ selector: 'tabs-section'
+})
+@View({
+ template: `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ `,
+ directives: [TabsDemo, tabs, CORE_DIRECTIVES, NgNonBindable]
+})
+export class TabsSection {
+}
diff --git a/demo/components/tabs/tabs-demo.html b/demo/components/tabs/tabs-demo.html
new file mode 100644
index 0000000000..3129fa4c66
--- /dev/null
+++ b/demo/components/tabs/tabs-demo.html
@@ -0,0 +1,44 @@
+
+
Select a tab by setting active binding to true:
+
+ Select second tab
+ Select third tab
+
+
+ Enable / Disable third tab
+
+
+
+ Static content
+
+ {{tabz.content}}
+
+
+
+ Alert!
+
+ I've got an HTML heading, and a select callback. Pretty cool!
+
+
+
+
+
+
+ Vertical content 1
+ Vertical content 2
+
+
+
+
+
Bootstrap 4 doesn't have justified classes
+
+ Justified content
+ Short Labeled Justified content
+ Long Labeled Justified content
+
+
diff --git a/demo/components/tabs/tabs-demo.ts b/demo/components/tabs/tabs-demo.ts
new file mode 100644
index 0000000000..e5de77189c
--- /dev/null
+++ b/demo/components/tabs/tabs-demo.ts
@@ -0,0 +1,27 @@
+///
+import {Component, View, CORE_DIRECTIVES} from 'angular2/angular2';
+
+import {tabs} from '../../../components/index';
+
+// webpack html imports
+let template = require('./tabs-demo.html');
+
+@Component({
+ selector: 'tabs-demo'
+})
+@View({
+ template: template,
+ directives: [tabs, CORE_DIRECTIVES]
+})
+export class TabsDemo {
+ private tabs:Array = [
+ {title: 'Dynamic Title 1', content: 'Dynamic content 1'},
+ {title: 'Dynamic Title 2', content: 'Dynamic content 2', disabled: true}
+ ];
+
+ private alertMe() {
+ setTimeout(function () {
+ alert('You\'ve selected the alert tab!');
+ });
+ };
+}
diff --git a/demo/components/timepicker-demo.ts b/demo/components/timepicker-demo.ts
deleted file mode 100644
index 53e29d47c4..0000000000
--- a/demo/components/timepicker-demo.ts
+++ /dev/null
@@ -1,73 +0,0 @@
-///
-
-import {Component, View, bootstrap, CORE_DIRECTIVES, FORM_DIRECTIVES} from 'angular2/angular2';
-
-import {Timepicker} from '../../components/index';
-
-@Component({
- selector: 'timepicker-demo'
-})
-@View({
- template: `
-
- Timepicker demo
-
-
-
-
Time is: {{mytime | date:'shortTime' }}
-
-
-
- Hours step is:
-
- {{opt}}
-
-
-
- Minutes step is:
-
- {{opt}}
-
-
-
-
-
-
-
12H / 24H
-
Set to 14:00
-
Clear
-
-
- `,
- directives: [Timepicker, CORE_DIRECTIVES, FORM_DIRECTIVES]
-})
-export class TimepickerDemo {
- private hstep = 1;
- private mstep = 15;
- private ismeridian = true;
-
- private mytime = new Date();
- private options = {
- hstep: [1, 2, 3],
- mstep: [1, 5, 10, 15, 25, 30]
- };
-
- private toggleMode() {
- this.ismeridian = !this.ismeridian;
- };
-
- private update() {
- let d = new Date();
- d.setHours(14);
- d.setMinutes(0);
- this.mytime = d;
- };
-
- private changed() {
- console.log('Time changed to: ' + this.mytime);
- };
-
- private clear () {
- this.mytime = null;
- };
-}
diff --git a/demo/components/timepicker-section.ts b/demo/components/timepicker-section.ts
new file mode 100644
index 0000000000..e1971da0f9
--- /dev/null
+++ b/demo/components/timepicker-section.ts
@@ -0,0 +1,65 @@
+///
+import {Component, View, CORE_DIRECTIVES, NgNonBindable} from 'angular2/angular2';
+
+import {tabs} from '../../components/index';
+import {TimepickerDemo} from './timepicker/timepicker-demo';
+
+let name = 'Timepicker';
+let src = 'https://github.com/valor-software/ng2-bootstrap/blob/master/components/timepicker/timepicker.ts';
+
+// webpack html imports
+let doc = require('../../components/timepicker/readme.md');
+let titleDoc = require('../../components/timepicker/title.md');
+
+let ts = require('!!prismjs?lang=typescript!./timepicker/timepicker-demo.ts');
+let html = require('!!prismjs?lang=markup!./timepicker/timepicker-demo.html');
+
+@Component({
+ selector: 'timepicker-section'
+})
+@View({
+ template: `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ `,
+ directives: [TimepickerDemo, tabs, CORE_DIRECTIVES, NgNonBindable]
+})
+export class TimepickerSection {
+}
diff --git a/demo/components/timepicker/timepicker-demo.html b/demo/components/timepicker/timepicker-demo.html
new file mode 100644
index 0000000000..b4ddbb7e27
--- /dev/null
+++ b/demo/components/timepicker/timepicker-demo.html
@@ -0,0 +1,25 @@
+
+
+Time is: {{mytime}}
+ (note: | date:'shortTime' and date pipe currently supported only in Chrome)
+
+
+
+ Hours step is:
+
+ {{opt}}
+
+
+
+ Minutes step is:
+
+ {{opt}}
+
+
+
+
+
+
+12H / 24H
+Set to 14:00
+Clear
diff --git a/demo/components/timepicker/timepicker-demo.ts b/demo/components/timepicker/timepicker-demo.ts
new file mode 100644
index 0000000000..ff7fafa2f2
--- /dev/null
+++ b/demo/components/timepicker/timepicker-demo.ts
@@ -0,0 +1,45 @@
+///
+import {Component, View, CORE_DIRECTIVES, FORM_DIRECTIVES} from 'angular2/angular2';
+
+import {Timepicker} from '../../../components/index';
+
+// webpack html imports
+let template = require('./timepicker-demo.html');
+
+@Component({
+ selector: 'timepicker-demo'
+})
+@View({
+ template: template,
+ directives: [Timepicker, CORE_DIRECTIVES, FORM_DIRECTIVES]
+})
+export class TimepickerDemo {
+ private hstep:number = 1;
+ private mstep:number = 15;
+ private ismeridian:boolean = true;
+
+ private mytime:Date = new Date();
+ private options:any = {
+ hstep: [1, 2, 3],
+ mstep: [1, 5, 10, 15, 25, 30]
+ };
+
+ private toggleMode():void {
+ this.ismeridian = !this.ismeridian;
+ };
+
+ private update():void {
+ let d = new Date();
+ d.setHours(14);
+ d.setMinutes(0);
+ this.mytime = d;
+ };
+
+ private changed():void {
+ console.log('Time changed to: ' + this.mytime);
+ };
+
+ private clear():void {
+ this.mytime = null;
+ };
+}
diff --git a/demo/components/tooltip-demo.ts b/demo/components/tooltip-demo.ts
deleted file mode 100644
index 69fd6005b2..0000000000
--- a/demo/components/tooltip-demo.ts
+++ /dev/null
@@ -1,90 +0,0 @@
-///
-
-import {Component, View, bootstrap,
- CORE_DIRECTIVES, FORM_DIRECTIVES, NgClass
-} from 'angular2/angular2';
-
-import {tooltip} from '../../components/index';
-
-@Component({
- selector: 'tooltip-demo'
-})
-@View({
- template: `
-
- Tooltip demo
-
-
- Dynamic Tooltip Text
-
-
-
- Dynamic Tooltip Popup Text
-
-
-
- Pellentesque {{dynamicTooltipText}} ,
- sit amet venenatis urna cursus eget nunc scelerisque viverra mauris, in
- aliquam. Tincidunt lobortis feugiat vivamus at
- left eget
- arcu dictum varius duis at consectetur lorem. Vitae elementum curabitur
- right
- nunc sed velit dignissim sodales ut eu sem integer vitae. Turpis egestas
- bottom
- pharetra convallis posuere morbi leo urna,
- fading
- at elementum eu, facilisis sed odio morbi quis commodo odio. In cursus
- delayed turpis massa tincidunt dui ut.
- Custom template
- nunc sed velit dignissim sodales ut eu sem integer vitae. Turpis egestas
-
-
-
- I can even contain HTML. Check me out!
-
-
-
-
- I can have a custom class. Check me out!
-
-
-
-
-
-
`,
- directives: [tooltip, CORE_DIRECTIVES, FORM_DIRECTIVES, NgClass],
- style: `
- /* Specify styling for tooltip contents */
- .tooltip.customClass .tooltip-inner {
- color: #880000;
- background-color: #ffff66;
- box-shadow: 0 6px 12px rgba(0,0,0,.175);
- }
- /* Hide arrow */
- .tooltip.customClass .tooltip-arrow {
- display: none;
- }
- `
-})
-export class TooltipDemo {
- public dynamicTooltip:string = 'Hello, World!';
- public dynamicTooltipText:string = 'dynamic';
- public htmlTooltip:string = 'I\'ve been made bold !';
-}
diff --git a/demo/components/tooltip-section.ts b/demo/components/tooltip-section.ts
new file mode 100644
index 0000000000..d4f2da7394
--- /dev/null
+++ b/demo/components/tooltip-section.ts
@@ -0,0 +1,66 @@
+///
+
+import {Component, View, CORE_DIRECTIVES, NgNonBindable} from 'angular2/angular2';
+
+import {tabs} from '../../components/index';
+import {TooltipDemo} from './tooltip/tooltip-demo';
+
+let name = 'Tooltip';
+let src = 'https://github.com/valor-software/ng2-bootstrap/blob/master/components/tooltip/tooltip.ts';
+
+// webpack html imports
+let doc = require('../../components/tooltip/readme.md');
+let titleDoc = require('../../components/tooltip/title.md');
+
+let ts = require('!!prismjs?lang=typescript!./tooltip/tooltip-demo.ts');
+let html = require('!!prismjs?lang=markup!./tooltip/tooltip-demo.html');
+
+@Component({
+ selector: 'tooltip-section'
+})
+@View({
+ template: `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ `,
+ directives: [TooltipDemo, tabs, CORE_DIRECTIVES, NgNonBindable]
+})
+export class TooltipSection {
+}
diff --git a/demo/components/tooltip/tooltip-demo.html b/demo/components/tooltip/tooltip-demo.html
new file mode 100644
index 0000000000..ae0309d251
--- /dev/null
+++ b/demo/components/tooltip/tooltip-demo.html
@@ -0,0 +1,49 @@
+
+ Dynamic Tooltip Text
+
+
+
+ Dynamic Tooltip Popup Text
+
+
+
+ Pellentesque {{dynamicTooltipText}} ,
+ sit amet venenatis urna cursus eget nunc scelerisque viverra mauris, in
+ aliquam. Tincidunt lobortis feugiat vivamus at
+ left eget
+ arcu dictum varius duis at consectetur lorem. Vitae elementum curabitur
+ right
+ nunc sed velit dignissim sodales ut eu sem integer vitae. Turpis egestas
+ bottom
+ pharetra convallis posuere morbi leo urna,
+ fading
+ at elementum eu, facilisis sed odio morbi quis commodo odio. In cursus
+ delayed turpis massa tincidunt dui ut.
+ Custom template
+ nunc sed velit dignissim sodales ut eu sem integer vitae. Turpis egestas
+
+
+
+ I can even contain HTML. Check me out!
+
+
+
+ I can have a custom class. Check me out!
+
+
+
diff --git a/demo/components/tooltip/tooltip-demo.ts b/demo/components/tooltip/tooltip-demo.ts
new file mode 100644
index 0000000000..63a64b91a1
--- /dev/null
+++ b/demo/components/tooltip/tooltip-demo.ts
@@ -0,0 +1,35 @@
+///
+import {
+ Component, View, NgClass,
+ CORE_DIRECTIVES, FORM_DIRECTIVES
+} from 'angular2/angular2';
+
+import {tooltip} from '../../../components/index';
+
+// webpack html imports
+let template = require('./tooltip-demo.html');
+
+@Component({
+ selector: 'tooltip-demo'
+})
+@View({
+ template: template,
+ directives: [tooltip, CORE_DIRECTIVES, FORM_DIRECTIVES, NgClass],
+ style: `
+ /* Specify styling for tooltip contents */
+ .tooltip.customClass .tooltip-inner {
+ color: #880000;
+ background-color: #ffff66;
+ box-shadow: 0 6px 12px rgba(0,0,0,.175);
+ }
+ /* Hide arrow */
+ .tooltip.customClass .tooltip-arrow {
+ display: none;
+ }
+ `
+})
+export class TooltipDemo {
+ public dynamicTooltip:string = 'Hello, World!';
+ public dynamicTooltipText:string = 'dynamic';
+ public htmlTooltip:string = 'I\'ve been made bold !';
+}
diff --git a/demo/getting-started.md b/demo/getting-started.md
new file mode 100644
index 0000000000..a4cfad888c
--- /dev/null
+++ b/demo/getting-started.md
@@ -0,0 +1,55 @@
+# Getting started
+
+### First of all, Welcome!
+
+This module is currently in alfa while an Angular2 in alfa too ;)
+
+It contains a lot of issues, no really a looot of issues,
+and it is a great chance to contribute and help us bring it to life!
+
+**80%** of baseline functionality is already **rewritten** to Angular2,
+currently Modal, Popover and Typeahed are left.
+
+*Note*: template-url and animation not yet implemented
+
+While animations is just another feature,
+template-url implementation in Angular 2 seems no trivial task,
+more of that it has a chance to be against new Angular mental model.
+
+Most probably template-url will be replaced by:
+1. temporal hack with dynamic components
+2. template-ref, could became a standard
+3. component extension with template overwriting
+
+### Dependencies
+This module consists of native Angular2 components and directives, no jQuery or Bootstrap javascript is required.
+
+Always actual list of JS dependencies you can find [here](https://david-dm.org/valor-software/ng2-bootstrap)
+
+Plus this module plays nice with Bootstrap CSS [v3](http://getbootstrap.com/css/) and [v4](http://v4-alpha.getbootstrap.com)
+
+*Note* later on each component will be available independently via npm, jspm, etc.
+
+### Installation
+
+Currently preferable way to install this module is `npm`:
+
+```bash
+npm install --save ng2-bootstrap
+```
+
+You may find angular2 bootstrap starter [repo](https://github.com/valor-software/angular2-bootstrap-starter) useful, until we added plunker examples
+
+Just 4 commands to start hacking Angular2 with bootstrap ;)
+```bash
+git clone git@github.com:valor-software/angular2-bootstrap-starter.git
+cd angular2-bootstrap-starter
+npm i && npm start
+```
+
+Have fun!
+
+### Reading documentation
+
+Each `ng2-bootstrap` component has api and annotation docs, examples and working demo. Each `property` and `event` has type annotation and default value if any.
+
diff --git a/demo/index-bs4.html b/demo/index-bs4.html
index 01b1b512e0..b32cd4391c 100644
--- a/demo/index-bs4.html
+++ b/demo/index-bs4.html
@@ -1,34 +1,30 @@
- Angular2 Bootstrap by @valorkin
+ Angular2 Bootstrap
-
+
+
-
-
-
-
-
-
-
-
+ Loading...
+
+
+
+
+
+
+
+
diff --git a/demo/index.html b/demo/index.html
index f3ed849878..be815ed16a 100644
--- a/demo/index.html
+++ b/demo/index.html
@@ -1,32 +1,44 @@
- Angular2 Bootstrap by @valorkin
+ Angular2 Bootstrap
+
-
+
-
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/demo/index.ts b/demo/index.ts
index 514ce6ec24..284997e6a5 100644
--- a/demo/index.ts
+++ b/demo/index.ts
@@ -1,70 +1,102 @@
///
+import {Component, View, bootstrap, NgClass} from 'angular2/angular2';
-import {Component, View, bootstrap} from 'angular2/angular2';
+import {Ng2BootstrapConfig, Ng2BootstrapTheme} from '../components/index';
-import {AccordionDemo} from './components/accordion-demo';
-import {AlertDemo} from './components/alert-demo';
-import {ButtonsDemo} from './components/buttons-demo';
-import {DropdownDemo} from './components/dropdown-demo';
-import {CarouselDemo} from './components/carousel-demo';
-import {CollapseDemo} from './components/collapse-demo';
-import {PaginationDemo} from './components/pagination-demo';
-import {ProgressbarDemo} from './components/progressbar-demo';
-import {RatingDemo} from './components/rating-demo';
-import {TabsDemo} from './components/tabs-demo';
-import {TimepickerDemo} from './components/timepicker-demo';
-import {TooltipDemo} from './components/tooltip-demo';
+let w:any = window;
+if (w && w.__theme === 'bs4') {
+ Ng2BootstrapConfig.theme = Ng2BootstrapTheme.BS4;
+}
+
+import {AccordionSection} from './components/accordion-section';
+import {AlertSection} from './components/alert-section';
+import {ButtonsSection} from './components/buttons-section';
+import {CarouselSection} from './components/carousel-section';
+import {CollapseSection} from './components/collapse-section';
+import {DropdownSection} from './components/dropdown-section';
+import {PaginationSection} from './components/pagination-section';
+import {ProgressbarSection} from './components/progressbar-section';
+import {RatingSection} from './components/rating-section';
+import {TabsSection} from './components/tabs-section';
+import {TimepickerSection} from './components/timepicker-section';
+import {TooltipSection} from './components/tooltip-section';
+
+import {DemoHeader} from './components/demo-header';
+
+let gettingStarted = require('./getting-started.md');
@Component({
selector: 'app'
})
@View({
template: `
-
-
-
-
-
-
-
-
-
-
-
-
-
+ Loading header
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
`,
directives: [
- AlertDemo,
- AccordionDemo,
- ButtonsDemo,
- DropdownDemo,
- CarouselDemo,
- CollapseDemo,
- PaginationDemo,
- ProgressbarDemo,
- RatingDemo,
- TabsDemo,
- TimepickerDemo,
- TooltipDemo
+ NgClass,
+ DemoHeader,
+
+ AccordionSection,
+ AlertSection,
+ ButtonsSection,
+ CarouselSection,
+ CollapseSection,
+ DropdownSection,
+ PaginationSection,
+ ProgressbarSection,
+ RatingSection,
+ TabsSection,
+ TimepickerSection,
+ TooltipSection
]
})
-export class Home {
+export class Demo {
+ private isBs3:boolean = Ng2BootstrapConfig.theme === Ng2BootstrapTheme.BS3;
}
-bootstrap(Home);
-
-
-// "demo/index.ts",
-// "demo/typings/es6-object.d.ts",
-// "demo/components/accordion-demo.ts",
-// "demo/components/alert-demo.ts",
-// "demo/components/buttons-demo.ts",
-// "demo/components/dropdown-demo.ts",
-// "demo/components/collapse-demo.ts",
-// "demo/components/pagination-demo.ts",
-// "demo/components/progressbar-demo.ts",
-// "demo/components/rating-demo.ts",
-// "demo/components/tabs-demo.ts",
-// "demo/components/timepicker-demo.ts",
-// "demo/components/tooltip-demo.ts"
+bootstrap(Demo);
diff --git a/gulpfile.js b/gulpfile.js
index 04e612a6cd..723499832f 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -17,7 +17,6 @@ gulp.paths = {
require('require-dir')('./gulp-tasks');
-// todo: rework ts compile
var typescript = require('gulp-tsc');
var options = require('./tsconfig.json').compilerOptions;
options.emitError = false;
diff --git a/package.json b/package.json
index 8d4286fd49..7e378f447f 100644
--- a/package.json
+++ b/package.json
@@ -13,7 +13,8 @@
"main": "dist/index.js",
"typescript": {
"definition": [
- "dist/module.d.ts", "typings/es6-object.d.ts"
+ "dist/module.d.ts",
+ "typings/es6-object.d.ts"
]
},
"files": [
@@ -51,14 +52,22 @@
"clean-webpack-plugin": "^0.1.3",
"compression-webpack-plugin": "^0.2.0",
"eslint": "^1.1.0",
+ "exports-loader": "^0.6.2",
+ "file-loader": "^0.8.4",
"gulp": "^3.9.0",
"gulp-clean": "^0.3.1",
"gulp-eslint": "^1.0.0",
"gulp-size": "^2.0.0",
"gulp-tsc": "^1.1.1",
"gulp-tslint": "^3.1.2",
+ "html-loader": "^0.3.0",
+ "markdown-loader": "alansouzati/markdown-loader#FULL_OPTIONS_SET",
+ "marked": "^0.3.5",
"moment": "^2.10.6",
"pre-commit": "^1.1.1",
+ "prismjs": "valorkin/prism",
+ "prismjs-loader": "0.0.2",
+ "raw-loader": "^0.5.1",
"require-dir": "^0.3.0",
"typescript": "^1.5.3",
"typescript-simple-loader": "^0.3.4",
diff --git a/tsconfig.json b/tsconfig.json
index 23ec716cbc..4e720b2c27 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,45 +1,85 @@
{
- "version": "1.5.3",
- "compilerOptions": {
- "target": "es5",
- "module": "commonjs",
- "outDir": "dist",
- "sourceMap": true,
- "declaration": true,
- "removeComments": true,
- "emitDecoratorMetadata": true,
- "experimentalDecorators": true,
- "listFiles": false,
- "noLib": false,
- "noEmitOnError": false,
- "noImplicitAny": false
- },
- "filesGlob": [
- "./**/*.ts",
- "!./node_modules/**/*.ts"
- ],
- "files": [
- "tsd.d.ts",
- "components/index.ts",
- "components/ng2-bootstrap-config.ts",
- "components/module.ts",
- "components/accordion/accordion.ts",
- "components/alert/alert.ts",
- "components/buttons/button-radio.ts",
- "components/buttons/button-checkbox.ts",
- "components/dropdown/index.ts",
- "components/dropdown/dropdown.ts",
- "components/dropdown/dropdown-menu.ts",
- "components/dropdown/dropdown-service.ts",
- "components/dropdown/dropdown-toggle.ts",
- "components/carousel/carousel.ts",
- "components/collapse/collapse.ts",
- "components/pagination/pagination.ts",
- "components/progressbar/progressbar.ts",
- "components/rating/rating.ts",
- "components/tabs/tabs.ts",
- "components/timepicker/timepicker.ts",
- "components/tooltip/tooltip.ts",
- "components/position.ts"
- ]
+ "version": "1.5.3",
+ "compilerOptions": {
+ "target": "es5",
+ "module": "commonjs",
+ "outDir": "dist",
+ "sourceMap": true,
+ "declaration": true,
+ "removeComments": true,
+ "emitDecoratorMetadata": true,
+ "experimentalDecorators": true,
+ "listFiles": false,
+ "noLib": false,
+ "noEmitOnError": false,
+ "noImplicitAny": false
+ },
+ "filesGlob": [
+ "./**/*.ts",
+ "!./node_modules/**/*.ts"
+ ],
+ "files": [
+ "./components/accordion/accordion.ts",
+ "./components/alert/alert.ts",
+ "./components/buttons/button-checkbox.ts",
+ "./components/buttons/button-radio.ts",
+ "./components/carousel/carousel.ts",
+ "./components/collapse/collapse.ts",
+ "./components/common.ts",
+ "./components/dropdown/dropdown-menu.ts",
+ "./components/dropdown/dropdown-service.ts",
+ "./components/dropdown/dropdown-toggle.ts",
+ "./components/dropdown/dropdown.interfaces.ts",
+ "./components/dropdown/dropdown.ts",
+ "./components/dropdown/index.ts",
+ "./components/index.ts",
+ "./components/module.ts",
+ "./components/ng2-bootstrap-config.ts",
+ "./components/pagination/pagination.ts",
+ "./components/position.ts",
+ "./components/progressbar/progressbar.ts",
+ "./components/rating/rating.ts",
+ "./components/tabs/tabs.ts",
+ "./components/timepicker/timepicker.ts",
+ "./components/tooltip/tooltip.ts",
+ "./demo/components/accordion-demo.ts",
+ "./demo/components/alert-demo.ts",
+ "./demo/components/buttons-demo.ts",
+ "./demo/components/carousel-demo.ts",
+ "./demo/components/collapse-demo.ts",
+ "./demo/components/dropdown-demo.ts",
+ "./demo/components/pagination-demo.ts",
+ "./demo/components/progressbar-demo.ts",
+ "./demo/components/rating-demo.ts",
+ "./demo/components/tabs-demo.ts",
+ "./demo/components/timepicker-demo.ts",
+ "./demo/components/tooltip-demo.ts",
+ "./demo/index.ts",
+ "./dist/accordion/accordion.d.ts",
+ "./dist/alert/alert.d.ts",
+ "./dist/buttons/button-checkbox.d.ts",
+ "./dist/buttons/button-radio.d.ts",
+ "./dist/carousel/carousel.d.ts",
+ "./dist/collapse/collapse.d.ts",
+ "./dist/common.d.ts",
+ "./dist/dropdown/dropdown-keyboard-nav.d.ts",
+ "./dist/dropdown/dropdown-menu.d.ts",
+ "./dist/dropdown/dropdown-service.d.ts",
+ "./dist/dropdown/dropdown-toggle.d.ts",
+ "./dist/dropdown/dropdown.d.ts",
+ "./dist/dropdown/dropdown.interfaces.d.ts",
+ "./dist/dropdown/index.d.ts",
+ "./dist/index.d.ts",
+ "./dist/module.d.ts",
+ "./dist/ng2-bootstrap-config.d.ts",
+ "./dist/pagination/pagination.d.ts",
+ "./dist/position.d.ts",
+ "./dist/progressbar/progressbar.d.ts",
+ "./dist/rating/rating.d.ts",
+ "./dist/tabs/tabs.d.ts",
+ "./dist/timepicker/timepicker.d.ts",
+ "./dist/tooltip/tooltip.d.ts",
+ "./tsd.d.ts",
+ "./typings/es6-object.d.ts"
+ ]
}
diff --git a/typings/es6-object.d.ts b/typings/es6-object.d.ts
index 5047f97dd2..bede479322 100644
--- a/typings/es6-object.d.ts
+++ b/typings/es6-object.d.ts
@@ -23,4 +23,4 @@ interface ObjectConstructor {
setPrototypeOf(o: any, proto: any): any;
}
-declare function require(path:string): Function;
+declare function require(path:string): any;
diff --git a/webpack.config.js b/webpack.config.js
index 2c2c8e424e..b8479a64f6 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -1,9 +1,22 @@
-var webpack = require('webpack');
var path = require('path');
+var marked = require('marked');
+var webpack = require('webpack');
var Clean = require('clean-webpack-plugin');
var CompressionPlugin = require('compression-webpack-plugin');
+// marked renderer hack
+marked.Renderer.prototype.code = function (code, lang) {
+ var out = this.options.highlight(code, lang);
+
+ if (!lang) {
+ return '
' + out + '\n
';
+ }
+
+ var classMap = this.options.langPrefix + lang;
+ return '
' + out + '\n
\n';
+};
+
/*eslint no-process-env:0, camelcase:0*/
var isProduction = (process.env.NODE_ENV || 'development') === 'production';
@@ -17,7 +30,7 @@ var config = {
devtool: 'source-map',
debug: true,
- cache: true,
+ cache: false,
context: __dirname,
resolve: {
@@ -54,8 +67,25 @@ var config = {
contentBase: src,
publicPath: dest
},
+ markdownLoader: {
+ langPrefix: 'language-',
+ highlight: function (code, lang) {
+ var language = !lang || lang === 'html' ? 'markup' : lang;
+ if (!global.Prism) {
+ global.Prism = require('prismjs');
+ }
+ var Prism = global.Prism;
+ if (!Prism.languages[language]) {
+ require('prismjs/components/prism-' + language + '.js');
+ }
+ return Prism.highlight(code, Prism.languages[language]);
+ }
+ },
module: {
loaders: [
+ // support markdown
+ {test: /\.md$/, loader: 'html!markdown'},
+
// Support for *.json files.
{test: /\.json$/, loader: 'json'},
@@ -102,7 +132,7 @@ var config = {
}
this.plugins.push.apply(this.plugins, [
- //production only
+ //production only
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,