diff --git a/projects/cashmere-examples/src/lib/checkbox-align/checkbox-align-example.component.html b/projects/cashmere-examples/src/lib/checkbox-align/checkbox-align-example.component.html new file mode 100644 index 000000000..2ddc29596 --- /dev/null +++ b/projects/cashmere-examples/src/lib/checkbox-align/checkbox-align-example.component.html @@ -0,0 +1,16 @@ +
+ + This is a center aligned checkbox (default) with a lot of associated text. + The align parameter is used to position the checkbox relative to its label. + + + + This checkbox is top aligned. Lorem ipsum dolor sit amet, consectetur adipiscing elit. + Aenean commodo dolor sed justo ullamcorper mattis. + + + + This checkbox is bottom aligned. Praesent dignissim fermentum auctor. + Nulla nibh lectus, dignissim ultrices condimentum et, rutrum eu tortor. + +
diff --git a/projects/cashmere-examples/src/lib/checkbox-align/checkbox-align-example.component.scss b/projects/cashmere-examples/src/lib/checkbox-align/checkbox-align-example.component.scss new file mode 100644 index 000000000..9f9106a03 --- /dev/null +++ b/projects/cashmere-examples/src/lib/checkbox-align/checkbox-align-example.component.scss @@ -0,0 +1,9 @@ +.checkbox-example-container { + display: flex; + align-items: center; + + hc-checkbox { + flex: 1; + margin-right: 15px; + } +} diff --git a/projects/cashmere-examples/src/lib/checkbox-align/checkbox-align-example.component.ts b/projects/cashmere-examples/src/lib/checkbox-align/checkbox-align-example.component.ts new file mode 100644 index 000000000..402a38008 --- /dev/null +++ b/projects/cashmere-examples/src/lib/checkbox-align/checkbox-align-example.component.ts @@ -0,0 +1,11 @@ +import {Component} from '@angular/core'; + +/** + * @title Checkbox Alignment + */ +@Component({ + selector: 'hc-checkbox-align-example', + templateUrl: 'checkbox-align-example.component.html', + styleUrls: ['checkbox-align-example.component.scss'] +}) +export class CheckboxAlignExampleComponent {} diff --git a/projects/cashmere-examples/src/lib/checkbox-standard/checkbox-standard-example.component.html b/projects/cashmere-examples/src/lib/checkbox-standard/checkbox-standard-example.component.html index 836cb0923..627556a3f 100644 --- a/projects/cashmere-examples/src/lib/checkbox-standard/checkbox-standard-example.component.html +++ b/projects/cashmere-examples/src/lib/checkbox-standard/checkbox-standard-example.component.html @@ -1,5 +1,7 @@ -Standard Checkbox +Standard Checkbox -Disabled Checkbox +Disabled Checkbox -Disabled Checkbox (Checked) +Disabled Checkbox (Checked) + +Tight Checkbox diff --git a/projects/cashmere-examples/src/lib/form-field-tight/form-field-tight-example.component.html b/projects/cashmere-examples/src/lib/form-field-tight/form-field-tight-example.component.html new file mode 100644 index 000000000..48d71a3d5 --- /dev/null +++ b/projects/cashmere-examples/src/lib/form-field-tight/form-field-tight-example.component.html @@ -0,0 +1,45 @@ +

For forms that need to fit in smaller spaces, the tight parameter may be set to true on +either the hcForm or individual hc-form-field elements.

+
+
+
+ + Job Name: + + A job name is required + +
+ + + Data Source: + + Source Mart + Subject Area Mart + Other + + Specified data source does not match description + + +
+ + Run Frequency: + + + + + + Please select the run frequency for this item + +
+ +
+ + Requested Notifications: + On failure + On sucess + On row-count mismatch + On dependency-wait timeout + At least one notification must be selected + +
+
diff --git a/projects/cashmere-examples/src/lib/form-field-tight/form-field-tight-example.component.scss b/projects/cashmere-examples/src/lib/form-field-tight/form-field-tight-example.component.scss new file mode 100644 index 000000000..388ac6032 --- /dev/null +++ b/projects/cashmere-examples/src/lib/form-field-tight/form-field-tight-example.component.scss @@ -0,0 +1,8 @@ +.form-sample { + max-width: 350px; + width: 100%; +} + +.flex-column { + flex-direction: column; +} diff --git a/projects/cashmere-examples/src/lib/form-field-tight/form-field-tight-example.component.ts b/projects/cashmere-examples/src/lib/form-field-tight/form-field-tight-example.component.ts new file mode 100644 index 000000000..0ea1a2006 --- /dev/null +++ b/projects/cashmere-examples/src/lib/form-field-tight/form-field-tight-example.component.ts @@ -0,0 +1,17 @@ +import {Component} from '@angular/core'; +import {FormControl} from '@angular/forms'; + +/** + * @title Tight Form Field Elements + */ +@Component({ + selector: 'hc-form-field-tight-example', + templateUrl: 'form-field-tight-example.component.html', + styleUrls: ['form-field-tight-example.component.scss'] +}) +export class FormFieldTightExampleComponent { + selectControl = new FormControl('daily'); + inputControl = new FormControl(''); + radioControl = new FormControl('SM'); + checkControl = new FormControl(''); +} diff --git a/projects/cashmere-examples/src/lib/input-suffix/input-suffix-example.component.html b/projects/cashmere-examples/src/lib/input-suffix/input-suffix-example.component.html index e021b09eb..7db7f6481 100644 --- a/projects/cashmere-examples/src/lib/input-suffix/input-suffix-example.component.html +++ b/projects/cashmere-examples/src/lib/input-suffix/input-suffix-example.component.html @@ -1,10 +1,14 @@ - +

These inputs have the tight parameter set to true.

+ +
+ + Minimum Value: - + Maximum Value: diff --git a/projects/cashmere-examples/src/lib/modal-overview/modal-overview-example-modal.component.html b/projects/cashmere-examples/src/lib/modal-overview/modal-overview-example-modal.component.html index 1f75ef75a..c872b7e4d 100644 --- a/projects/cashmere-examples/src/lib/modal-overview/modal-overview-example-modal.component.html +++ b/projects/cashmere-examples/src/lib/modal-overview/modal-overview-example-modal.component.html @@ -1,5 +1,9 @@ Modal Header Title + + WARNING + You are about to export data which may include Protected Health Information (PHI) + Data: {{ activeModal.data }} diff --git a/projects/cashmere-examples/src/lib/radio-button-forms/radio-button-forms-example.component.html b/projects/cashmere-examples/src/lib/radio-button-forms/radio-button-forms-example.component.html index 862667ca5..091e63c38 100644 --- a/projects/cashmere-examples/src/lib/radio-button-forms/radio-button-forms-example.component.html +++ b/projects/cashmere-examples/src/lib/radio-button-forms/radio-button-forms-example.component.html @@ -1,5 +1,5 @@ - - Select your favorite: + + Radio buttons with tight styling: {{show}} diff --git a/projects/cashmere-examples/src/lib/select-validation/select-validation-example.component.html b/projects/cashmere-examples/src/lib/select-validation/select-validation-example.component.html index 434ad17be..7e7435967 100644 --- a/projects/cashmere-examples/src/lib/select-validation/select-validation-example.component.html +++ b/projects/cashmere-examples/src/lib/select-validation/select-validation-example.component.html @@ -1,7 +1,7 @@
- - Project Status: + + Select with Tight Styling: diff --git a/projects/cashmere-examples/src/lib/stepper-overview/stepper-overview-example.component.html b/projects/cashmere-examples/src/lib/stepper-overview/stepper-overview-example.component.html new file mode 100644 index 000000000..46a175304 --- /dev/null +++ b/projects/cashmere-examples/src/lib/stepper-overview/stepper-overview-example.component.html @@ -0,0 +1,32 @@ +
+ + Stepper Type: + + + + + + + Stepper Color: + + + + + + + Step Count (Isolated type only): + Show Step Count + +
+ + + + +

Current Step Index: {{currentStep}}

diff --git a/projects/cashmere-examples/src/lib/stepper-overview/stepper-overview-example.component.scss b/projects/cashmere-examples/src/lib/stepper-overview/stepper-overview-example.component.scss new file mode 100644 index 000000000..7af440ef5 --- /dev/null +++ b/projects/cashmere-examples/src/lib/stepper-overview/stepper-overview-example.component.scss @@ -0,0 +1,10 @@ +.stepper-options { + display: flex; + margin-bottom: 20px; + + hc-form-field { + flex: 1; + max-width: 250px; + margin-right: 25px; + } +} diff --git a/projects/cashmere-examples/src/lib/stepper-overview/stepper-overview-example.component.ts b/projects/cashmere-examples/src/lib/stepper-overview/stepper-overview-example.component.ts new file mode 100644 index 000000000..c68dfbeb3 --- /dev/null +++ b/projects/cashmere-examples/src/lib/stepper-overview/stepper-overview-example.component.ts @@ -0,0 +1,32 @@ +import {Component, OnInit} from '@angular/core'; +import {StepInterface} from '@healthcatalyst/cashmere'; + +/** + * @title Stepper overview + */ +@Component({ + selector: 'hc-stepper-overview-example', + templateUrl: 'stepper-overview-example.component.html', + styleUrls: ['stepper-overview-example.component.scss'] +}) +export class StepperOverviewExampleComponent implements OnInit { + progressSteps: StepInterface[]; + currentColor: string = 'green'; + colorOptions: string[] = ['green', 'blue', 'purple', 'orange', 'red']; + currentType: string = 'arrow'; + typeOptions: string[] = ['arrow', 'isolated']; + showSteps: boolean = true; + currentStep: number = 2; + + ngOnInit() { + // To use with a router, add a `routerLink` to each step + this.progressSteps = [ + {label: 'Winter', iconSet: 'fa', icon: 'fa-check'}, + {label: 'January', iconSet: 'fa', icon: 'fa-check'}, + {label: 'Spring'}, + {label: 'Summer'}, + {label: 'Fall', iconSet: 'fa', icon: 'fa-lock', disabled: true}, + {label: 'Year Round', iconSet: 'fa', icon: 'fa-lock', disabled: true} + ]; + } +} diff --git a/projects/cashmere-examples/src/lib/table-sort/table-sort-example.component.html b/projects/cashmere-examples/src/lib/table-sort/table-sort-example.component.html index 69bed2923..ef7e4ab1e 100644 --- a/projects/cashmere-examples/src/lib/table-sort/table-sort-example.component.html +++ b/projects/cashmere-examples/src/lib/table-sort/table-sort-example.component.html @@ -1,4 +1,6 @@ - +

This is an example of a sortable table with tight styling.

+ +
diff --git a/projects/cashmere-examples/src/lib/tabs-vertical/tabs-vertical-example.component.html b/projects/cashmere-examples/src/lib/tabs-vertical/tabs-vertical-example.component.html index 448673409..10a1cba3d 100644 --- a/projects/cashmere-examples/src/lib/tabs-vertical/tabs-vertical-example.component.html +++ b/projects/cashmere-examples/src/lib/tabs-vertical/tabs-vertical-example.component.html @@ -1,5 +1,5 @@
- + @@ -43,3 +43,5 @@
+ +Apply Tight Styling to Tabs diff --git a/projects/cashmere-examples/src/lib/tabs-vertical/tabs-vertical-example.component.scss b/projects/cashmere-examples/src/lib/tabs-vertical/tabs-vertical-example.component.scss index 3893f5c52..ab469fc82 100644 --- a/projects/cashmere-examples/src/lib/tabs-vertical/tabs-vertical-example.component.scss +++ b/projects/cashmere-examples/src/lib/tabs-vertical/tabs-vertical-example.component.scss @@ -4,6 +4,7 @@ .tab-demo { border: 1px solid #e0e0e0; + margin-bottom: 15px; } .tab-bar-content { diff --git a/projects/cashmere-examples/src/lib/tabs-vertical/tabs-vertical-example.component.ts b/projects/cashmere-examples/src/lib/tabs-vertical/tabs-vertical-example.component.ts index d68a36dfb..d54664371 100644 --- a/projects/cashmere-examples/src/lib/tabs-vertical/tabs-vertical-example.component.ts +++ b/projects/cashmere-examples/src/lib/tabs-vertical/tabs-vertical-example.component.ts @@ -8,4 +8,6 @@ import {Component} from '@angular/core'; templateUrl: 'tabs-vertical-example.component.html', styleUrls: ['tabs-vertical-example.component.scss'] }) -export class TabsVerticalExampleComponent {} +export class TabsVerticalExampleComponent { + _tight: boolean = false; +} diff --git a/projects/cashmere-examples/src/lib/tile-overview/tile-overview-example.component.html b/projects/cashmere-examples/src/lib/tile-overview/tile-overview-example.component.html index 0f894c705..7c17352e3 100644 --- a/projects/cashmere-examples/src/lib/tile-overview/tile-overview-example.component.html +++ b/projects/cashmere-examples/src/lib/tile-overview/tile-overview-example.component.html @@ -2,3 +2,8 @@
Example Tile

This paragraph is contained within a hc-tile component.

+ + +
Tight Tile
+

This is a tile with tight styling. It has less padding.

+
diff --git a/projects/cashmere-examples/src/project-template/src/app/cashmere.module.ts b/projects/cashmere-examples/src/project-template/src/app/cashmere.module.ts index 36f519d4d..d98c0fd59 100644 --- a/projects/cashmere-examples/src/project-template/src/app/cashmere.module.ts +++ b/projects/cashmere-examples/src/project-template/src/app/cashmere.module.ts @@ -25,6 +25,7 @@ import { ScrollNavModule, SelectModule, SortModule, + StepperModule, SubnavModule, TabsModule, TableModule, @@ -60,6 +61,7 @@ import { ScrollNavModule, SelectModule, SortModule, + StepperModule, SubnavModule, TableModule, TabsModule, diff --git a/projects/cashmere/src/lib/checkbox/checkbox.component.html b/projects/cashmere/src/lib/checkbox/checkbox.component.html index b0589ff87..cd788c2e9 100644 --- a/projects/cashmere/src/lib/checkbox/checkbox.component.html +++ b/projects/cashmere/src/lib/checkbox/checkbox.component.html @@ -1,5 +1,5 @@
-
+
-
diff --git a/projects/cashmere/src/lib/checkbox/checkbox.component.scss b/projects/cashmere/src/lib/checkbox/checkbox.component.scss index 4adeec345..c64e45c2d 100644 --- a/projects/cashmere/src/lib/checkbox/checkbox.component.scss +++ b/projects/cashmere/src/lib/checkbox/checkbox.component.scss @@ -24,13 +24,41 @@ } } +.hc-checkbox-align-center { + @include hc-checkbox-align-center(); +} + +.hc-checkbox-align-top { + @include hc-checkbox-align-top(); +} + +.hc-checkbox-align-bottom { + @include hc-checkbox-align-bottom(); +} + .hc-checkbox-label { @include hc-checkbox-label(); + + .hc-checkbox-tight & { + @include hc-checkbox-label-tight(); + } +} + +.hc-checkbox-align-label-top { + @include hc-checkbox-align-label-top(); +} + +.hc-checkbox-align-label-bottom { + @include hc-checkbox-align-label-bottom(); } .hc-checkbox-overlay { @include hc-checkbox-overlay(); + .hc-checkbox-tight & { + @include hc-checkbox-overlay-tight(); + } + .hc-checkbox-content:hover & { @include hc-checkbox-overlay-hover(); } @@ -39,6 +67,10 @@ @include hc-checkbox-overlay-indeterminate(); } + .hc-checkbox-indeterminate .hc-checkbox-tight & { + @include hc-checkbox-overlay-indeterminate-tight(); + } + input[type='checkbox']:checked + & { @include hc-checkbox-overlay-checked(); } diff --git a/projects/cashmere/src/lib/checkbox/checkbox.component.spec.ts b/projects/cashmere/src/lib/checkbox/checkbox.component.spec.ts index 5cbd22013..20bd023d3 100644 --- a/projects/cashmere/src/lib/checkbox/checkbox.component.spec.ts +++ b/projects/cashmere/src/lib/checkbox/checkbox.component.spec.ts @@ -164,6 +164,11 @@ describe('CheckboxComponent', () => { expect(inputElement.value).toBe('basic_checkbox'); }); + + it('should align the checkbox label based on the align parameter', () => { + let alignClass = fixture.debugElement.queryAll(By.css('.hc-checkbox-align-top')); + expect(alignClass.length).toBe(1); + }); }); describe('with form control', () => { @@ -244,6 +249,7 @@ describe('CheckboxComponent', () => { [checked]="isChecked" [indeterminate]="isIndeterminate" [disabled]="isDisabled" + [align]="alignVal" [value]="checkboxValue" (click)="onCheckboxClick($event)" (change)="onCheckboxChange($event)" @@ -262,6 +268,7 @@ export class SingleCheckboxComponent { parentElementKeyedUp: boolean = false; checkboxId: string | null = 'simple-check'; checkboxValue: string = 'single_checkbox'; + alignVal: string = "top"; onCheckboxClick: (event?: Event) => void = () => {}; onCheckboxChange: (event?: CheckboxChangeEvent) => void = () => {}; diff --git a/projects/cashmere/src/lib/checkbox/checkbox.component.ts b/projects/cashmere/src/lib/checkbox/checkbox.component.ts index 53f36d2f5..c83a2ad6e 100644 --- a/projects/cashmere/src/lib/checkbox/checkbox.component.ts +++ b/projects/cashmere/src/lib/checkbox/checkbox.component.ts @@ -39,6 +39,7 @@ export class CheckboxComponent extends HcFormControlComponent implements Control private _form: NgForm | FormGroupDirective | null; private _checked: boolean = false; private _tabIndex: number; + private _tight: boolean = false; _componentId = this._uniqueId; @@ -60,6 +61,19 @@ export class CheckboxComponent extends HcFormControlComponent implements Control this._componentId = idVal ? idVal : this._uniqueId; } + /** If true, condense the default margin and reduce the font size. *Defaults to `false`.* */ + @Input() + get tight(): boolean { + return this._tight; + } + set tight(value) { + this._tight = parseBooleanAttribute(value); + } + + /** Sets the position of the checkbox relative to its associated label. *Defaults to `center`.* */ + @Input() + align: 'center' | 'top' | 'bottom' = 'center'; + /** Sets unique name used in a form */ @Input() name: string | null = null; diff --git a/projects/cashmere/src/lib/form-field/hc-form-control.component.ts b/projects/cashmere/src/lib/form-field/hc-form-control.component.ts index 2025d90ed..cfe87a51a 100644 --- a/projects/cashmere/src/lib/form-field/hc-form-control.component.ts +++ b/projects/cashmere/src/lib/form-field/hc-form-control.component.ts @@ -19,4 +19,7 @@ export abstract class HcFormControlComponent { /** Whether the control is required */ _isRequired: boolean = false; + + /** Whether the control should apply tight styling */ + tight: boolean = false; } diff --git a/projects/cashmere/src/lib/form-field/hc-form-field.component.html b/projects/cashmere/src/lib/form-field/hc-form-field.component.html index 1d2957ad6..b76167c35 100644 --- a/projects/cashmere/src/lib/form-field/hc-form-field.component.html +++ b/projects/cashmere/src/lib/form-field/hc-form-field.component.html @@ -1,6 +1,10 @@ -
- -