Skip to content

Commit 2e68552

Browse files
committed
Merge branch 'master' of github.com:cal-smith/carbon-components-angular
2 parents 9f49b5f + 806991e commit 2e68552

17 files changed

+722
-470
lines changed

package-lock.json

Lines changed: 151 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,16 @@
1313
"test:watch": "karma start --auto-watch --no-single-run",
1414
"utils:add": "git subtree add --prefix=src/utils [email protected]:peretz/utils.git master --squash",
1515
"utils:update": "git subtree pull --prefix=src/utils [email protected]:peretz/utils.git master --squash",
16-
"prepush": "bash scripts/prepush.sh",
1716
"build-storybook": "build-storybook -c .storybook -s .storybook/public -o dist/docs/storybook",
1817
"semantic-release": "semantic-release",
19-
"commitmsg": "commitlint -E GIT_PARAMS",
2018
"commit": "git-cz"
2119
},
20+
"husky": {
21+
"hooks": {
22+
"pre-push": "bash scripts/prepush.sh",
23+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
24+
}
25+
},
2226
"release": {
2327
"pkgRoot": "dist"
2428
},
@@ -80,7 +84,7 @@
8084
"@angular/router": "6.1.0",
8185
"@commitlint/cli": "7.0.0",
8286
"@commitlint/config-conventional": "7.0.1",
83-
"@compodoc/compodoc": "^1.1.5",
87+
"@compodoc/compodoc": "1.1.5",
8488
"@storybook/addon-actions": "3.4.8",
8589
"@storybook/addon-knobs": "3.4.8",
8690
"@storybook/addon-links": "3.4.8",
@@ -106,7 +110,7 @@
106110
"gulp-tap": "1.0.1",
107111
"html-loader": "0.5.5",
108112
"html-webpack-plugin": "3.2.0",
109-
"husky": "0.14.3",
113+
"husky": "1.1.2",
110114
"jasmine-core": "3.1.0",
111115
"karma": "2.0.2",
112116
"karma-chrome-launcher": "2.2.0",
@@ -118,7 +122,7 @@
118122
"karma-sourcemap-loader": "0.3.7",
119123
"karma-spec-reporter": "0.0.32",
120124
"karma-webpack": "3.0.0",
121-
"node-sass": "^4.9.3",
125+
"node-sass": "4.9.3",
122126
"postcss-loader": "2.1.4",
123127
"raw-loader": "0.5.1",
124128
"run-sequence": "2.2.0",

src/combobox/combobox.component.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ import { NG_VALUE_ACCESSOR } from "@angular/forms";
6767
class="bx--text-input"
6868
aria-label="ListBox input field"
6969
autocomplete="off"
70-
placeholder="Filter..."/>
70+
[placeholder]="placeholder"/>
7171
<div
7272
[ngClass]="{'bx--list-box__menu-icon--open': open}"
7373
class="bx--list-box__menu-icon">
@@ -132,7 +132,7 @@ export class ComboBox implements OnChanges, OnInit, AfterViewInit, AfterContentI
132132
* Text to show when nothing is selected.
133133
* @memberof ComboBox
134134
*/
135-
@Input() placeholder = "";
135+
@Input() placeholder = "Filter...";
136136
/**
137137
* Combo box type (supporting single or multi selection of items).
138138
* @type {("single" | "multi")}
@@ -351,6 +351,9 @@ export class ComboBox implements OnChanges, OnInit, AfterViewInit, AfterContentI
351351
});
352352
this.view["updateList"](this.items);
353353
this.updatePills();
354+
// clearSelected can only fire on type=multi
355+
// so we just emit getSelected() (just in case there's any disabled but selected items)
356+
this.selected.emit(this.view.getSelected() as any);
354357
}
355358

356359
/**

src/combobox/combobox.stories.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ storiesOf("Combobox", module)
1616
.addDecorator(withKnobs)
1717
.add("Basic", () => ({
1818
template: `
19-
<ibm-combo-box [items]="items">
19+
<ibm-combo-box [items]="items" (selected)="selected($event)">
2020
<ibm-dropdown-list></ibm-dropdown-list>
2121
</ibm-combo-box>
2222
`,
@@ -40,7 +40,7 @@ storiesOf("Combobox", module)
4040
}))
4141
.add("Multi-select", () => ({
4242
template: `
43-
<ibm-combo-box [items]="items" type="multi">
43+
<ibm-combo-box [items]="items" type="multi" (selected)="selected($event)">
4444
<ibm-dropdown-list></ibm-dropdown-list>
4545
</ibm-combo-box>
4646
`,

src/dialog/dialog.directive.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import {
99
TemplateRef,
1010
ViewContainerRef,
1111
HostListener,
12-
OnChanges
12+
OnChanges,
13+
HostBinding
1314
} from "@angular/core";
1415
import { fromEvent } from "rxjs";
1516
import { DialogService } from "./dialog.service";
@@ -94,6 +95,9 @@ export class DialogDirective implements OnInit, OnDestroy, OnChanges {
9495
@Output() onClose: EventEmitter<any> = new EventEmitter<any>();
9596
dialogConfig: DialogConfig;
9697

98+
@HostBinding("attr.role") role = "button";
99+
@HostBinding("attr.aria-expanded") expanded = false;
100+
97101
/**
98102
* Creates an instance of DialogDirective.
99103
* @param {ElementRef} elementRef
@@ -158,7 +162,7 @@ export class DialogDirective implements OnInit, OnDestroy, OnChanges {
158162
this.dialogService.isClosed.subscribe(value => {
159163
if (value) {
160164
this.onClose.emit();
161-
this.elementRef.nativeElement.setAttribute("aria-expanded", "false");
165+
this.expanded = false;
162166
}
163167
});
164168

@@ -182,7 +186,7 @@ export class DialogDirective implements OnInit, OnDestroy, OnChanges {
182186
*/
183187
open() {
184188
this.dialogService.open(this.viewContainerRef, this.dialogConfig);
185-
this.elementRef.nativeElement.setAttribute("aria-expanded", "true");
189+
this.expanded = true;
186190
}
187191

188192
/**
@@ -192,7 +196,7 @@ export class DialogDirective implements OnInit, OnDestroy, OnChanges {
192196
*/
193197
toggle() {
194198
this.dialogService.toggle(this.viewContainerRef, this.dialogConfig);
195-
this.elementRef.nativeElement.setAttribute("aria-expanded", this.dialogService.isOpen);
199+
this.expanded = this.dialogService.isOpen;
196200
}
197201

198202
/**
@@ -202,7 +206,7 @@ export class DialogDirective implements OnInit, OnDestroy, OnChanges {
202206
*/
203207
close() {
204208
this.dialogService.close(this.viewContainerRef);
205-
this.elementRef.nativeElement.setAttribute("aria-expanded", "false");
209+
this.expanded = false;
206210
}
207211

208212
/**

src/dialog/tooltip/tooltip.directive.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import {
55
ElementRef,
66
Injector,
77
ComponentFactoryResolver,
8-
ViewContainerRef
8+
ViewContainerRef,
9+
HostBinding
910
} from "@angular/core";
1011
import { DialogDirective } from "./../dialog.directive";
1112
import { Tooltip } from "./tooltip.component";
@@ -64,6 +65,8 @@ export class TooltipDirective extends DialogDirective {
6465
// tslint:disable-next-line:no-input-rename
6566
@Input("tooltip-type") tooltipType: "warning" | "error" | "" = "";
6667

68+
@HostBinding("attr.aria-describedby") descriptorId: string;
69+
6770
/**
6871
* Creates an instance of `TooltipDirective`.
6972
* @param {ElementRef} elementRef
@@ -89,6 +92,6 @@ export class TooltipDirective extends DialogDirective {
8992
this.dialogConfig.compID = "tooltip-" + TooltipDirective.tooltipCounter;
9093
this.dialogConfig.content = this.ibmTooltip;
9194
this.dialogConfig.type = this.tooltipType !== undefined ? this.tooltipType : this.type;
92-
this.elementRef.nativeElement.setAttribute("aria-describedby", this.dialogConfig.compID);
95+
this.descriptorId = this.dialogConfig.compID;
9396
}
9497
}

src/i18n/en.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@
6363
"RESET_SEARCH": "Reset search"
6464
}
6565
},
66-
"MODAL" : {
66+
"MODAL": {
6767
"CLOSE": "Close modal"
6868
},
69-
"OVERFLOW_MENU" : {
69+
"OVERFLOW_MENU": {
7070
"OVERFLOW": "Overflow"
7171
},
7272
"SIDENAV": {

src/input/input.stories.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ storiesOf("Input", module).addDecorator(
2020
}))
2121
.add("Input", () => ({
2222
template: `
23-
<input ibmText placeholder="Optional placeholder text"/>
23+
<input ibmText aria-label="input" placeholder="Optional placeholder text"/>
2424
`
2525
})).add("TextArea", () => ({
2626
template: `
27-
<textarea ibmTextArea placeholder="Optional placeholder text" rows="4" cols="50"></textarea>
27+
<textarea ibmTextArea aria-label="textarea" placeholder="Optional placeholder text" rows="4" cols="50"></textarea>
2828
`
2929
}));

0 commit comments

Comments
 (0)