oasys-lib 1.2.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oasys-lib",
3
- "version": "1.2.0",
3
+ "version": "1.3.1",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^12.2.0",
6
6
  "@angular/core": "^12.2.0"
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Wed, 16 Nov 2022 17:54:25 GMT
3
+ * Generated on Fri, 02 Dec 2022 13:11:34 GMT
4
4
  */
5
5
 
6
6
  :root .brand-tokens-bloomandwild {
@@ -77,6 +77,11 @@
77
77
  --component-button-opacity-overlay-focus-visible: 0.0;
78
78
  --component-button-border-radius: 0.2rem;
79
79
  --component-button-text-transform: normal;
80
+ --component-heading-alignment-default: center;
81
+ --component-heading-alignment-functional: start;
82
+ --component-heading-gap-default: default;
83
+ --component-heading-gap-secondary: near;
84
+ --component-heading-gap-functional: tight;
80
85
  --semantic-font-styles-heading-hero-size: 5.2rem;
81
86
  --semantic-font-styles-heading-hero-line-height: 6.4rem;
82
87
  --semantic-font-styles-heading-hero-mobile-size: 3.6rem;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Wed, 16 Nov 2022 17:54:25 GMT
3
+ * Generated on Fri, 02 Dec 2022 13:11:34 GMT
4
4
  */
5
5
 
6
6
  :root .brand-tokens-bloomon {
@@ -77,6 +77,11 @@
77
77
  --component-button-opacity-overlay-focus-visible: 0.0;
78
78
  --component-button-border-radius: 2.4rem;
79
79
  --component-button-text-transform: uppercase;
80
+ --component-heading-alignment-default: start;
81
+ --component-heading-alignment-functional: start;
82
+ --component-heading-gap-default: default;
83
+ --component-heading-gap-secondary: near;
84
+ --component-heading-gap-functional: tight;
80
85
  --semantic-font-styles-heading-hero-size: 5.2rem;
81
86
  --semantic-font-styles-heading-hero-line-height: 6.4rem;
82
87
  --semantic-font-styles-heading-hero-mobile-size: 3.6rem;
@@ -131,8 +136,8 @@
131
136
  --semantic-color-text-primary: #464646;
132
137
  --semantic-color-text-primary-on-dark: #ffffff;
133
138
  --semantic-color-text-primary-disabled: #898989;
134
- --semantic-color-text-supporting: #676767;
135
- --semantic-color-text-supporting-on-dark: #cdcdcd;
139
+ --semantic-color-text-supporting: #464646;
140
+ --semantic-color-text-supporting-on-dark: #ffffff;
136
141
  --semantic-color-transparent: transparent;
137
142
  --semantic-color-tint-success: #fff799;
138
143
  --semantic-color-tint-warning: #ff9f80;
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Wed, 16 Nov 2022 17:54:25 GMT
3
+ // Generated on Fri, 02 Dec 2022 13:11:34 GMT
4
4
 
5
5
  $global-breakpoint-mobile: 0px;
6
6
  $global-breakpoint-tablet: 767px;
@@ -53,7 +53,7 @@ h3,
53
53
  h4,
54
54
  h5,
55
55
  h6,
56
- .text-heading-functional {
56
+ .text-heading--functional {
57
57
  font-family: var(--semantic-font-family-headline-secondary);
58
58
  }
59
59
 
@@ -63,7 +63,10 @@ h6,
63
63
  Heading Sizes
64
64
  --------------------- */
65
65
 
66
- h1,
66
+ // add .seo-h1 on to any H1 tag which is used
67
+ // purely for SEO and should not appear like an h1
68
+
69
+ h1:not(.seo-h1),
67
70
  .text-heading--hero {
68
71
  font-size: var(--semantic-font-styles-heading-hero-size);
69
72
  line-height: var(--semantic-font-styles-heading-hero-line-height);
@@ -98,7 +101,7 @@ h3,
98
101
  --------------------- */
99
102
 
100
103
  h4,
101
- .text-heading-functional--primary {
104
+ .text-heading--functional--primary {
102
105
  font-size: var(--semantic-font-styles-heading-functional-primary-size);
103
106
  line-height: var(--semantic-font-styles-heading-functional-primary-line-height);
104
107
 
@@ -109,7 +112,7 @@ h4,
109
112
  }
110
113
 
111
114
  h5,
112
- .text-heading-functional--secondary {
115
+ .text-heading--functional--secondary {
113
116
  font-size: var(--semantic-font-styles-heading-functional-secondary-size);
114
117
  line-height: var(--semantic-font-styles-heading-functional-secondary-line-height);
115
118
 
@@ -191,15 +194,16 @@ html, body {
191
194
  }
192
195
 
193
196
  .text-color--on-dark {
194
- color: var(--semantic-color-text-primary-on-dark)
195
- }
197
+ color: var(--semantic-color-text-primary-on-dark);
196
198
 
197
- .text-color--supporting {
198
- color: var(--semantic-color-text-supporting)
199
+ &.text-color--supporting,
200
+ .text-color--supporting {
201
+ color: var(--semantic-color-text-supporting-on-dark)
202
+ }
199
203
  }
200
204
 
201
- .text-color--supporting-on-dark {
202
- color: var(--semantic-color-text-supporting-on-dark)
205
+ .text-color--supporting {
206
+ color: var(--semantic-color-text-supporting);
203
207
  }
204
208
 
205
209
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Wed, 16 Nov 2022 17:54:25 GMT
3
+ * Generated on Fri, 02 Dec 2022 13:11:34 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -0,0 +1,41 @@
1
+ <hgroup>
2
+ <ui-stack [stackAlign]="headingAlignment" [stackGap]="headingGap">
3
+
4
+ <p *ngIf="headingSurtitle && headingSurtitle.length" class="heading-surtitle text-body--supporting text-color--supporting">
5
+ {{headingSurtitle}}
6
+ </p>
7
+
8
+ <ng-template #content>
9
+ <span
10
+ class="heading-title"
11
+ [ngClass]="{
12
+ 'text-heading': !headingTypeIsFunctional(headingType),
13
+ 'text-heading--functional': headingTypeIsFunctional(headingType),
14
+
15
+ 'text-heading--hero': headingType === 'hero',
16
+ 'text-heading--primary': headingType === 'primary',
17
+ 'text-heading--secondary': headingType === 'secondary',
18
+ 'text-heading--functional--primary': headingType === 'functional-primary',
19
+ 'text-heading--functional--secondary': headingType === 'functional-secondary'
20
+ }"
21
+ >{{headingTitle}}</span>
22
+ </ng-template>
23
+
24
+ <h1 role="heading" [attr.aria-level]="headingPriority" class="seo-h1" *ngIf="headingSeoPriority">
25
+ <ng-container *ngTemplateOutlet="content"></ng-container>
26
+ </h1>
27
+ <span role="heading" [attr.aria-level]="headingPriority" *ngIf="!headingSeoPriority">
28
+ <ng-container *ngTemplateOutlet="content"></ng-container>
29
+ </span>
30
+
31
+ <p
32
+ *ngIf="headingSubtitle && headingSubtitle.length"
33
+ class="heading-subtitle"
34
+ [ngClass]="{
35
+ 'text-body--hero': headingType === 'hero',
36
+ 'text-body--default': headingType !== 'hero'
37
+ }"
38
+ >{{headingSubtitle}}</p>
39
+
40
+ </ui-stack>
41
+ </hgroup>
@@ -0,0 +1,9 @@
1
+ ui-heading {
2
+ &.ui-heading-alignment-start {
3
+ text-align: start;
4
+ }
5
+
6
+ &.ui-heading-alignment-center {
7
+ text-align: center;
8
+ }
9
+ }
@@ -0,0 +1,87 @@
1
+ import { Component, Input, OnInit, ViewEncapsulation, OnChanges, SimpleChanges, HostBinding } from '@angular/core';
2
+ import { TokenService } from '../../services/token.service';
3
+ import { HeadingAlignment, HeadingGap, HeadingType } from './heading';
4
+
5
+ @Component({
6
+ selector:'ui-heading',
7
+ templateUrl: './heading.component.html',
8
+ styleUrls: ['./heading.component.scss'],
9
+ encapsulation: ViewEncapsulation.None
10
+ })
11
+ export class OasysHeadingComponent implements OnInit {
12
+
13
+ @Input()
14
+ headingType: HeadingType = 'primary';
15
+
16
+ @Input()
17
+ headingOnDark: boolean = false;
18
+
19
+ @Input()
20
+ headingTitle: string;
21
+
22
+ @Input()
23
+ headingSeoPriority: boolean = false;
24
+
25
+ @Input()
26
+ headingPriority?: 1 | 2 | 3 | 4 | 5 | 6;
27
+
28
+ @Input()
29
+ headingAlignmentOverride?: HeadingAlignment;
30
+
31
+ @Input()
32
+ headingSubtitle?: string = '';
33
+
34
+ @Input()
35
+ headingSurtitle?: string = '';
36
+
37
+ headingAlignment: HeadingAlignment;
38
+ headingGap: HeadingGap;
39
+
40
+
41
+ @HostBinding('class') get class() {
42
+ return `
43
+ ${this.headingOnDark ? 'text-color--on-dark' : ''}
44
+ ui-heading-alignment-${this.headingAlignment}
45
+ `
46
+ }
47
+
48
+ constructor(private tokenService: TokenService) { }
49
+
50
+ headingTypeIsFunctional(headingType: HeadingType): boolean {
51
+ return headingType.indexOf('functional') !== -1;
52
+ }
53
+
54
+ setupHeadingStackAlignment(headingType: HeadingType): void {
55
+ if(this.headingAlignmentOverride) {
56
+ this.headingAlignment = this.headingAlignmentOverride;
57
+ return;
58
+ }
59
+
60
+ const alignment = this.tokenService.getTokenValue('--component-heading-alignment-default') as HeadingAlignment;
61
+ const functionalAlignment = this.tokenService.getTokenValue('--component-heading-alignment-functional') as HeadingAlignment;
62
+
63
+ this.headingAlignment = this.headingTypeIsFunctional(headingType) ? functionalAlignment : alignment;
64
+
65
+ }
66
+
67
+ setupHeadingStackGap(headingType: HeadingType): void {
68
+ if(this.headingTypeIsFunctional(headingType)){
69
+ this.headingGap = this.tokenService.getTokenValue('--component-heading-gap-functional') as HeadingGap;
70
+ return;
71
+ }
72
+
73
+ if(this.headingType === 'secondary') {
74
+ this.headingGap = this.tokenService.getTokenValue('--component-heading-gap-secondary') as HeadingGap;
75
+ return;
76
+ }
77
+
78
+ this.headingGap = this.tokenService.getTokenValue('--component-heading-gap-default') as HeadingGap;
79
+ }
80
+
81
+ ngOnInit(): void {
82
+ this.setupHeadingStackAlignment(this.headingType);
83
+ this.setupHeadingStackGap(this.headingType);
84
+ this.headingPriority = this.headingPriority || this.headingSeoPriority ? 1 : 2;
85
+ }
86
+
87
+ }
@@ -0,0 +1,15 @@
1
+ export type HeadingType =
2
+ | 'hero'
3
+ | 'primary'
4
+ | 'secondary'
5
+ | 'functional-primary'
6
+ | 'functional-secondary';
7
+
8
+ export type HeadingAlignment =
9
+ | 'start'
10
+ | 'center';
11
+
12
+ export type HeadingGap =
13
+ | 'default'
14
+ | 'near'
15
+ | 'tight';
@@ -1,5 +1,5 @@
1
1
  import { APP_BASE_HREF, CommonModule } from '@angular/common';
2
- import { NgModule } from '@angular/core';
2
+ import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
3
3
  import { RouterModule } from '@angular/router';
4
4
  import { OasysButtonComponent } from './components/button/button.component';
5
5
  import { IconComponent } from './components/icon/icon.component';
@@ -9,6 +9,7 @@ import { TokenService } from './services/token.service';
9
9
  import { LayoutStackComponent } from './components/layout/stack/stack.component';
10
10
  import { LayoutGridComponent, LayoutGridColumnComponent } from './components/layout/grid/grid.component';
11
11
  import { LayoutContainerComponent } from './components/layout/container/container.component';
12
+ import { OasysHeadingComponent } from './components/heading/heading.component';
12
13
 
13
14
 
14
15
 
@@ -20,7 +21,8 @@ import { LayoutContainerComponent } from './components/layout/container/containe
20
21
  LayoutStackComponent,
21
22
  LayoutGridComponent,
22
23
  LayoutGridColumnComponent,
23
- LayoutContainerComponent
24
+ LayoutContainerComponent,
25
+ OasysHeadingComponent
24
26
  ],
25
27
  imports: [
26
28
  CommonModule,
@@ -32,11 +34,15 @@ import { LayoutContainerComponent } from './components/layout/container/containe
32
34
  LayoutStackComponent,
33
35
  LayoutGridComponent,
34
36
  LayoutGridColumnComponent,
35
- LayoutContainerComponent
37
+ LayoutContainerComponent,
38
+ OasysHeadingComponent
36
39
  ],
37
40
  providers: [
38
41
  WindowService,
39
42
  TokenService
43
+ ],
44
+ schemas: [
45
+ NO_ERRORS_SCHEMA
40
46
  ]
41
47
  })
42
48
  export class OasysLibModule { }
package/src/public-api.ts CHANGED
@@ -11,4 +11,6 @@ export * from './lib/components/layout/box/box.component';
11
11
  export * from './lib/components/layout/stack/stack.component';
12
12
  export * from './lib/components/layout/grid/grid.component';
13
13
  export * from './lib/components/layout/container/container.component';
14
+ export * from './lib/components/heading/heading.component';
15
+
14
16