oasys-lib 1.1.4 → 1.2.0
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/.browserslistrc +17 -0
- package/karma.conf.js +44 -0
- package/ng-package.json +10 -0
- package/package.json +3 -10
- package/src/assets/bloomandwild/variables.css +21 -13
- package/src/assets/bloomon/variables.css +21 -13
- package/src/assets/global/scss-breakpoints.scss +1 -1
- package/src/assets/global/typography.scss +4 -6
- package/src/assets/global/variables.css +5 -2
- package/src/lib/components/button/button.component.html +16 -0
- package/src/lib/components/button/button.component.scss +188 -0
- package/src/lib/components/button/button.component.spec.ts +25 -0
- package/src/lib/components/button/button.component.ts +95 -0
- package/src/lib/components/button/button.modifiers.scss +101 -0
- package/src/lib/components/button/button.ts +48 -0
- package/src/lib/components/icon/icon.component.html +5 -0
- package/src/lib/components/icon/icon.component.scss +5 -0
- package/src/lib/components/icon/icon.component.spec.ts +25 -0
- package/src/lib/components/icon/icon.component.ts +50 -0
- package/src/lib/components/icon/icon.ts +25 -0
- package/src/lib/components/layout/Layout.ts +64 -0
- package/src/lib/components/layout/_layout.scss +105 -0
- package/src/lib/components/layout/box/box.component.scss +124 -0
- package/src/lib/components/layout/box/box.component.ts +103 -0
- package/src/lib/components/layout/container/container.component.scss +66 -0
- package/src/lib/components/layout/container/container.component.ts +70 -0
- package/src/lib/components/layout/grid/grid.component.scss +162 -0
- package/src/lib/components/layout/grid/grid.component.ts +103 -0
- package/src/lib/components/layout/stack/stack.component.scss +60 -0
- package/src/lib/components/layout/stack/stack.component.ts +58 -0
- package/src/lib/components/text/text.component.html +1 -0
- package/src/lib/components/text/text.component.scss +33 -0
- package/src/lib/components/text/text.component.spec.ts +25 -0
- package/src/lib/components/text/text.component.ts +29 -0
- package/src/lib/components/text/text.ts +1 -0
- package/src/lib/oasys-lib.module.ts +42 -0
- package/src/lib/oasys-lib.service.spec.ts +16 -0
- package/src/lib/oasys-lib.service.ts +9 -0
- package/src/lib/services/token.service.ts +37 -0
- package/src/lib/services/window.service.ts +16 -0
- package/{public-api.d.ts → src/public-api.ts} +7 -1
- package/src/test.ts +27 -0
- package/tsconfig.lib.json +17 -0
- package/tsconfig.lib.prod.json +7 -0
- package/tsconfig.spec.json +17 -0
- package/bundles/oasys-lib.umd.js +0 -629
- package/bundles/oasys-lib.umd.js.map +0 -1
- package/esm2015/lib/components/button/button.component.js +0 -97
- package/esm2015/lib/components/button/button.js +0 -2
- package/esm2015/lib/components/icon/icon.component.js +0 -58
- package/esm2015/lib/components/icon/icon.js +0 -2
- package/esm2015/lib/components/layout/Layout.js +0 -2
- package/esm2015/lib/components/layout/box/box.component.js +0 -99
- package/esm2015/lib/components/layout/container/container.component.js +0 -81
- package/esm2015/lib/components/layout/grid/grid.component.js +0 -104
- package/esm2015/lib/components/layout/stack/stack.component.js +0 -65
- package/esm2015/lib/components/text/text.js +0 -2
- package/esm2015/lib/oasys-lib.module.js +0 -66
- package/esm2015/lib/services/token.service.js +0 -41
- package/esm2015/lib/services/window.service.js +0 -19
- package/esm2015/oasys-lib.js +0 -5
- package/esm2015/public-api.js +0 -11
- package/fesm2015/oasys-lib.js +0 -601
- package/fesm2015/oasys-lib.js.map +0 -1
- package/lib/components/button/button.component.d.ts +0 -32
- package/lib/components/button/button.component.d.ts.map +0 -1
- package/lib/components/button/button.d.ts +0 -18
- package/lib/components/button/button.d.ts.map +0 -1
- package/lib/components/icon/icon.component.d.ts +0 -26
- package/lib/components/icon/icon.component.d.ts.map +0 -1
- package/lib/components/icon/icon.d.ts +0 -3
- package/lib/components/icon/icon.d.ts.map +0 -1
- package/lib/components/layout/Layout.d.ts +0 -27
- package/lib/components/layout/Layout.d.ts.map +0 -1
- package/lib/components/layout/box/box.component.d.ts +0 -28
- package/lib/components/layout/box/box.component.d.ts.map +0 -1
- package/lib/components/layout/container/container.component.d.ts +0 -21
- package/lib/components/layout/container/container.component.d.ts.map +0 -1
- package/lib/components/layout/grid/grid.component.d.ts +0 -31
- package/lib/components/layout/grid/grid.component.d.ts.map +0 -1
- package/lib/components/layout/stack/stack.component.d.ts +0 -21
- package/lib/components/layout/stack/stack.component.d.ts.map +0 -1
- package/lib/components/text/text.d.ts +0 -2
- package/lib/components/text/text.d.ts.map +0 -1
- package/lib/oasys-lib.module.d.ts +0 -15
- package/lib/oasys-lib.module.d.ts.map +0 -1
- package/lib/services/token.service.d.ts +0 -12
- package/lib/services/token.service.d.ts.map +0 -1
- package/lib/services/window.service.d.ts +0 -7
- package/lib/services/window.service.d.ts.map +0 -1
- package/oasys-lib.d.ts +0 -6
- package/oasys-lib.d.ts.map +0 -1
- package/public-api.d.ts.map +0 -1
package/.browserslistrc
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
|
|
2
|
+
# For additional information regarding the format and rule options, please see:
|
|
3
|
+
# https://github.com/browserslist/browserslist#queries
|
|
4
|
+
|
|
5
|
+
# For the full list of supported browsers by the Angular framework, please see:
|
|
6
|
+
# https://angular.io/guide/browser-support
|
|
7
|
+
|
|
8
|
+
# You can see what browsers were selected by your queries by running:
|
|
9
|
+
# npx browserslist
|
|
10
|
+
|
|
11
|
+
last 1 Chrome version
|
|
12
|
+
last 1 Firefox version
|
|
13
|
+
last 2 Edge major versions
|
|
14
|
+
last 2 Safari major versions
|
|
15
|
+
last 2 iOS major versions
|
|
16
|
+
Firefox ESR
|
|
17
|
+
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.
|
package/karma.conf.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Karma configuration file, see link for more information
|
|
2
|
+
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
|
3
|
+
|
|
4
|
+
module.exports = function (config) {
|
|
5
|
+
config.set({
|
|
6
|
+
basePath: '',
|
|
7
|
+
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
|
8
|
+
plugins: [
|
|
9
|
+
require('karma-jasmine'),
|
|
10
|
+
require('karma-chrome-launcher'),
|
|
11
|
+
require('karma-jasmine-html-reporter'),
|
|
12
|
+
require('karma-coverage'),
|
|
13
|
+
require('@angular-devkit/build-angular/plugins/karma')
|
|
14
|
+
],
|
|
15
|
+
client: {
|
|
16
|
+
jasmine: {
|
|
17
|
+
// you can add configuration options for Jasmine here
|
|
18
|
+
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
|
|
19
|
+
// for example, you can disable the random execution with `random: false`
|
|
20
|
+
// or set a specific seed with `seed: 4321`
|
|
21
|
+
},
|
|
22
|
+
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
|
23
|
+
},
|
|
24
|
+
jasmineHtmlReporter: {
|
|
25
|
+
suppressAll: true // removes the duplicated traces
|
|
26
|
+
},
|
|
27
|
+
coverageReporter: {
|
|
28
|
+
dir: require('path').join(__dirname, '../../coverage/oasys-lib'),
|
|
29
|
+
subdir: '.',
|
|
30
|
+
reporters: [
|
|
31
|
+
{ type: 'html' },
|
|
32
|
+
{ type: 'text-summary' }
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
reporters: ['progress', 'kjhtml'],
|
|
36
|
+
port: 9876,
|
|
37
|
+
colors: true,
|
|
38
|
+
logLevel: config.LOG_INFO,
|
|
39
|
+
autoWatch: true,
|
|
40
|
+
browsers: ['Chrome'],
|
|
41
|
+
singleRun: false,
|
|
42
|
+
restartOnFileChange: true
|
|
43
|
+
});
|
|
44
|
+
};
|
package/ng-package.json
ADDED
package/package.json
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oasys-lib",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/common": "^12.2.0",
|
|
6
6
|
"@angular/core": "^12.2.0"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"tslib": "^2.3.0"
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
"module": "fesm2015/oasys-lib.js",
|
|
13
|
-
"es2015": "fesm2015/oasys-lib.js",
|
|
14
|
-
"esm2015": "esm2015/oasys-lib.js",
|
|
15
|
-
"fesm2015": "fesm2015/oasys-lib.js",
|
|
16
|
-
"typings": "oasys-lib.d.ts",
|
|
17
|
-
"sideEffects": false
|
|
18
|
-
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Do not edit directly
|
|
3
|
-
* Generated on Wed,
|
|
3
|
+
* Generated on Wed, 16 Nov 2022 17:54:25 GMT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
:root .brand-tokens-bloomandwild {
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
--component-button-color-tertiary-inverse-background: transparent;
|
|
23
23
|
--component-button-color-tertiary-inverse-border: transparent;
|
|
24
24
|
--component-button-color-tertiary-inverse-text: #ffffff;
|
|
25
|
-
--component-button-color-expressive-background: #
|
|
26
|
-
--component-button-color-expressive-border: #
|
|
25
|
+
--component-button-color-expressive-background: #fdf888;
|
|
26
|
+
--component-button-color-expressive-border: #fdf888;
|
|
27
27
|
--component-button-color-expressive-text: #262626;
|
|
28
28
|
--component-button-color-danger-background: #DB4141;
|
|
29
29
|
--component-button-color-danger-border: #DB4141;
|
|
@@ -116,20 +116,28 @@
|
|
|
116
116
|
--semantic-font-letter-spacing-action-primary: 0rem;
|
|
117
117
|
--semantic-color-action-primary: #262626;
|
|
118
118
|
--semantic-color-action-primary-inverse: #ffffff;
|
|
119
|
-
--semantic-color-action-expressive: #
|
|
119
|
+
--semantic-color-action-expressive: #fdf888;
|
|
120
120
|
--semantic-color-action-danger: #DB4141;
|
|
121
121
|
--semantic-color-action-disabled: #f4f3f2;
|
|
122
122
|
--semantic-color-action-focus-visible: #538FFC;
|
|
123
|
-
--semantic-color-
|
|
124
|
-
--semantic-color-
|
|
125
|
-
--semantic-color-
|
|
126
|
-
--semantic-color-
|
|
127
|
-
--semantic-color-
|
|
128
|
-
--semantic-color-
|
|
123
|
+
--semantic-color-state-focus: #538FFC;
|
|
124
|
+
--semantic-color-state-selected-fill: #f9ecd7;
|
|
125
|
+
--semantic-color-state-selected-border: #262626;
|
|
126
|
+
--semantic-color-background-transparent: transparent;
|
|
127
|
+
--semantic-color-background-primary: #ffffff;
|
|
128
|
+
--semantic-color-background-secondary: #f9ecd7;
|
|
129
|
+
--semantic-color-background-tertiary: #447964;
|
|
130
|
+
--semantic-color-background-quaternary: #2d5443;
|
|
131
|
+
--semantic-color-text-primary: #262626;
|
|
132
|
+
--semantic-color-text-primary-on-dark: #ffffff;
|
|
133
|
+
--semantic-color-text-primary-disabled: #898989;
|
|
134
|
+
--semantic-color-text-supporting: #4d4840;
|
|
135
|
+
--semantic-color-text-supporting-on-dark: #e2e0dc;
|
|
129
136
|
--semantic-color-transparent: transparent;
|
|
130
|
-
--semantic-color-
|
|
131
|
-
--semantic-color-
|
|
132
|
-
--semantic-color-
|
|
137
|
+
--semantic-color-tint-success: #ADD685;
|
|
138
|
+
--semantic-color-tint-warning: #F8BB40;
|
|
139
|
+
--semantic-color-tint-error: #DB4141;
|
|
140
|
+
--semantic-color-tint-highlight: #fdf888;
|
|
133
141
|
--semantic-spacing-border-width-none: 0rem;
|
|
134
142
|
--semantic-spacing-border-width-default: 0.1rem;
|
|
135
143
|
--semantic-spacing-border-width-emphasis: 0.2rem;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Do not edit directly
|
|
3
|
-
* Generated on Wed,
|
|
3
|
+
* Generated on Wed, 16 Nov 2022 17:54:25 GMT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
:root .brand-tokens-bloomon {
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
--component-button-color-tertiary-inverse-background: transparent;
|
|
23
23
|
--component-button-color-tertiary-inverse-border: transparent;
|
|
24
24
|
--component-button-color-tertiary-inverse-text: #ffffff;
|
|
25
|
-
--component-button-color-expressive-background: #
|
|
26
|
-
--component-button-color-expressive-border: #
|
|
25
|
+
--component-button-color-expressive-background: #fff799;
|
|
26
|
+
--component-button-color-expressive-border: #fff799;
|
|
27
27
|
--component-button-color-expressive-text: #464646;
|
|
28
28
|
--component-button-color-danger-background: #C84116;
|
|
29
29
|
--component-button-color-danger-border: #C84116;
|
|
@@ -116,20 +116,28 @@
|
|
|
116
116
|
--semantic-font-letter-spacing-action-primary: 0.2rem;
|
|
117
117
|
--semantic-color-action-primary: #464646;
|
|
118
118
|
--semantic-color-action-primary-inverse: #ffffff;
|
|
119
|
-
--semantic-color-action-expressive: #
|
|
119
|
+
--semantic-color-action-expressive: #fff799;
|
|
120
120
|
--semantic-color-action-danger: #C84116;
|
|
121
121
|
--semantic-color-action-disabled: #f7f7f7;
|
|
122
122
|
--semantic-color-action-focus-visible: #538FFC;
|
|
123
|
-
--semantic-color-
|
|
124
|
-
--semantic-color-
|
|
125
|
-
--semantic-color-
|
|
126
|
-
--semantic-color-
|
|
127
|
-
--semantic-color-
|
|
128
|
-
--semantic-color-
|
|
123
|
+
--semantic-color-state-focus: #538FFC;
|
|
124
|
+
--semantic-color-state-selected-fill: #fff8f4;
|
|
125
|
+
--semantic-color-state-selected-border: #ff9f80;
|
|
126
|
+
--semantic-color-background-transparent: transparent;
|
|
127
|
+
--semantic-color-background-primary: #ffffff;
|
|
128
|
+
--semantic-color-background-secondary: #f8d7be;
|
|
129
|
+
--semantic-color-background-tertiary: #f6e9dc;
|
|
130
|
+
--semantic-color-background-quaternary: #d89078;
|
|
131
|
+
--semantic-color-text-primary: #464646;
|
|
132
|
+
--semantic-color-text-primary-on-dark: #ffffff;
|
|
133
|
+
--semantic-color-text-primary-disabled: #898989;
|
|
134
|
+
--semantic-color-text-supporting: #676767;
|
|
135
|
+
--semantic-color-text-supporting-on-dark: #cdcdcd;
|
|
129
136
|
--semantic-color-transparent: transparent;
|
|
130
|
-
--semantic-color-
|
|
131
|
-
--semantic-color-
|
|
132
|
-
--semantic-color-
|
|
137
|
+
--semantic-color-tint-success: #fff799;
|
|
138
|
+
--semantic-color-tint-warning: #ff9f80;
|
|
139
|
+
--semantic-color-tint-error: #DB4141;
|
|
140
|
+
--semantic-color-tint-highlight: #fff799;
|
|
133
141
|
--semantic-spacing-border-width-none: 0rem;
|
|
134
142
|
--semantic-spacing-border-width-default: 0.1rem;
|
|
135
143
|
--semantic-spacing-border-width-emphasis: 0.2rem;
|
|
@@ -187,21 +187,19 @@ label,
|
|
|
187
187
|
Type colours
|
|
188
188
|
--------------------- */
|
|
189
189
|
html, body {
|
|
190
|
-
color: var(--semantic-color-
|
|
190
|
+
color: var(--semantic-color-primary-body);
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
.text-color--on-dark {
|
|
194
|
-
color: var(--semantic-color-text-
|
|
194
|
+
color: var(--semantic-color-text-primary-on-dark)
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
.text-color--supporting {
|
|
198
|
-
|
|
199
|
-
// color: var(--semantic-color-text-body-on-dark)
|
|
198
|
+
color: var(--semantic-color-text-supporting)
|
|
200
199
|
}
|
|
201
200
|
|
|
202
201
|
.text-color--supporting-on-dark {
|
|
203
|
-
|
|
204
|
-
// color: var(--semantic-color-text-body-on-dark)
|
|
202
|
+
color: var(--semantic-color-text-supporting-on-dark)
|
|
205
203
|
}
|
|
206
204
|
|
|
207
205
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Do not edit directly
|
|
3
|
-
* Generated on Wed,
|
|
3
|
+
* Generated on Wed, 16 Nov 2022 17:54:25 GMT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
:root {
|
|
7
|
+
--global-color-transparent: transparent;
|
|
7
8
|
--global-color-white: #ffffff;
|
|
8
9
|
--global-color-grey-10: #f7f7f7;
|
|
9
10
|
--global-color-grey-20: #cdcdcd;
|
|
@@ -23,11 +24,12 @@
|
|
|
23
24
|
--global-color-linen-grey-75: #4d4840;
|
|
24
25
|
--global-color-yellow-50: #fdf888;
|
|
25
26
|
--global-color-yellow-60: #fff799;
|
|
27
|
+
--global-color-yellow-80: #F8BB40;
|
|
26
28
|
--global-color-linen-10: #fcf5ea;
|
|
27
29
|
--global-color-linen-20: #f9ecd7;
|
|
28
30
|
--global-color-linen-40: #e8b767;
|
|
29
31
|
--global-color-linen-60: #b67b1b;
|
|
30
|
-
--global-color-linen-75: #
|
|
32
|
+
--global-color-linen-75: #534E46;
|
|
31
33
|
--global-color-pine-10: #f0f6f4;
|
|
32
34
|
--global-color-pine-20: #e2eee9;
|
|
33
35
|
--global-color-pine-40: #8fc0ac;
|
|
@@ -42,6 +44,7 @@
|
|
|
42
44
|
--global-color-red-50: #DB4141;
|
|
43
45
|
--global-color-red-60: #C84116;
|
|
44
46
|
--global-color-blue: #538FFC;
|
|
47
|
+
--global-color-green: #ADD685;
|
|
45
48
|
--global-color-partners-facebook: #485b94;
|
|
46
49
|
--global-color-partners-paypal: #ffc43a;
|
|
47
50
|
--global-color-partners-trustpilot: #29b47c;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<button (click)="onClick()"
|
|
2
|
+
[routerLink]="button.href || null"
|
|
3
|
+
[ngClass]="button.buttonDisplayClasses"
|
|
4
|
+
[attr.disabled]="button.buttonDisabled === true || null"
|
|
5
|
+
[attr.aria-label]="accessibleButtonContent"
|
|
6
|
+
[attr.title]="accessibleButtonContent"
|
|
7
|
+
role="button">
|
|
8
|
+
<div class="button-content">
|
|
9
|
+
<ui-icon *ngIf="button.buttonIcon && button.buttonIconPlacement !== 'none'" [iconName]="button.buttonIcon" [iconSize]="button.buttonSize" [iconClass]="'buttonIcon'" [iconContext]="button.buttonIconPlacement"></ui-icon>
|
|
10
|
+
<span class="ui-text" [ngClass]="{'visuallyhidden': button.buttonIconPlacement === 'iconOnly'}">
|
|
11
|
+
<ng-content></ng-content>
|
|
12
|
+
</span>
|
|
13
|
+
</div>
|
|
14
|
+
<div class="button-overlay"></div>
|
|
15
|
+
<div class="button-overlay-focus"></div>
|
|
16
|
+
</button>
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
@import './button.modifiers.scss';
|
|
2
|
+
|
|
3
|
+
ui-button button {
|
|
4
|
+
/* ---------------------
|
|
5
|
+
Button Reset
|
|
6
|
+
--------------------- */
|
|
7
|
+
border: 0;
|
|
8
|
+
padding: 0;
|
|
9
|
+
position: relative;
|
|
10
|
+
display: inline-flex;
|
|
11
|
+
text-align: center;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
align-items: center;
|
|
14
|
+
border-style: solid;
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
user-select: none;
|
|
17
|
+
appearance: none;
|
|
18
|
+
|
|
19
|
+
// Vendor Specific
|
|
20
|
+
-webkit-appearance: none;
|
|
21
|
+
-webkit-font-smoothing: antialiased;
|
|
22
|
+
-webkit-tap-highlight-color: transparent;
|
|
23
|
+
-webkit-touch-callout: none;
|
|
24
|
+
-webkit-user-select: none;
|
|
25
|
+
-khtml-user-select: none;
|
|
26
|
+
-moz-user-select: none;
|
|
27
|
+
-ms-user-select: none;
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
/* ---------------------
|
|
32
|
+
Global Styles
|
|
33
|
+
--------------------- */
|
|
34
|
+
border-radius: var(--component-button-border-radius);
|
|
35
|
+
font-family: var(--semantic-font-family-body);
|
|
36
|
+
|
|
37
|
+
$buttonLineHeight: var(--component-button-line-height);
|
|
38
|
+
|
|
39
|
+
.button-content {
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
|
|
43
|
+
.ui-icon {
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
max-height: $buttonLineHeight;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.ui-text {
|
|
50
|
+
text-transform: var(--component-button-text-transform);
|
|
51
|
+
letter-spacing: var(--component-button-letter-spacing);
|
|
52
|
+
font-weight: var(--component-button-font-weight);
|
|
53
|
+
line-height: $buttonLineHeight;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
/* ---------------------
|
|
60
|
+
Hover / Focus Overlay
|
|
61
|
+
--------------------- */
|
|
62
|
+
.button-overlay,
|
|
63
|
+
.button-overlay-focus {
|
|
64
|
+
position: absolute;
|
|
65
|
+
top: 0;
|
|
66
|
+
right: 0;
|
|
67
|
+
bottom: 0;
|
|
68
|
+
left: 0;
|
|
69
|
+
touch-action: none;
|
|
70
|
+
pointer-events: none;
|
|
71
|
+
border-radius: var(--component-button-border-radius);
|
|
72
|
+
opacity: 0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
&:hover {
|
|
78
|
+
.button-overlay {
|
|
79
|
+
opacity: var(--component-button-opacity-overlay-hover);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&:focus {
|
|
84
|
+
.button-overlay {
|
|
85
|
+
opacity: var(--component-button-opacity-overlay-focus);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&:focus-visible {
|
|
90
|
+
.button-overlay {
|
|
91
|
+
opacity: var(--component-button-opacity-overlay-focus-visible);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
/* ---------------------
|
|
98
|
+
Keyboard Focus Outline
|
|
99
|
+
--------------------- */
|
|
100
|
+
&:focus-visible {
|
|
101
|
+
outline: none;
|
|
102
|
+
|
|
103
|
+
.button-overlay-focus {
|
|
104
|
+
$outlineGap: var(--component-button-outline-gap);
|
|
105
|
+
top: calc(#{$outlineGap} * -1);
|
|
106
|
+
right: calc(#{$outlineGap} * -1);
|
|
107
|
+
bottom: calc(#{$outlineGap} * -1);
|
|
108
|
+
left: calc(#{$outlineGap} * -1);
|
|
109
|
+
box-shadow: 0 0 0 var(--component-button-outline-width) var(--component-button-color-focus-visible);
|
|
110
|
+
opacity: 1;
|
|
111
|
+
border-radius: calc(var(--component-button-border-radius) + var(--component-button-outline-width));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&:focus {
|
|
116
|
+
outline: none;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
/* ---------------------
|
|
121
|
+
Button Colour Styles
|
|
122
|
+
--------------------- */
|
|
123
|
+
@each $buttonType in $buttonTypes {
|
|
124
|
+
&.type-#{$buttonType} {
|
|
125
|
+
@include buttonColors(($buttonType));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
/* ---------------------
|
|
131
|
+
Icon Color Styling - Inherits from text color
|
|
132
|
+
--------------------- */
|
|
133
|
+
.buttonIcon {
|
|
134
|
+
fill: currentColor;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
/* ---------------------
|
|
140
|
+
Button Size Variants
|
|
141
|
+
--------------------- */
|
|
142
|
+
@each $buttonSize in $buttonSizes {
|
|
143
|
+
&.size-#{$buttonSize} {
|
|
144
|
+
@include buttonSize(($buttonSize));
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
@each $buttonSize in $outlineButtonSizes {
|
|
148
|
+
&.button--outline.size-#{$buttonSize} {
|
|
149
|
+
@include buttonSize($buttonSize, 'true');
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
/* ---------------------
|
|
156
|
+
Disabled State
|
|
157
|
+
--------------------- */
|
|
158
|
+
&[disabled] {
|
|
159
|
+
background-color: var(--component-button-color-disabled-background);
|
|
160
|
+
border-color: var(--component-button-color-disabled-border);
|
|
161
|
+
color: var(--component-button-color-disabled-text);
|
|
162
|
+
cursor: default;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
/* ---------------------
|
|
168
|
+
Trailing Icon Placement
|
|
169
|
+
(uses row reverse to support RTL languages)
|
|
170
|
+
--------------------- */
|
|
171
|
+
&.button--has-icon.button--icon--trailing {
|
|
172
|
+
.button-content {
|
|
173
|
+
flex-direction: row-reverse;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
/* ---------------------
|
|
179
|
+
Full Width Style
|
|
180
|
+
--------------------- */
|
|
181
|
+
&.button--full-width {
|
|
182
|
+
display: flex;
|
|
183
|
+
width: 100%;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { OasysButtonComponent } from './button.component';
|
|
4
|
+
|
|
5
|
+
describe('OasysButtonComponent', () => {
|
|
6
|
+
let component: OasysButtonComponent;
|
|
7
|
+
let fixture: ComponentFixture<OasysButtonComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ OasysButtonComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
fixture = TestBed.createComponent(OasysButtonComponent);
|
|
18
|
+
component = fixture.componentInstance;
|
|
19
|
+
fixture.detectChanges();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { Component, Input, OnInit, Output, ViewEncapsulation, EventEmitter, ChangeDetectionStrategy, ChangeDetectorRef, OnChanges, ContentChild, ElementRef, AfterViewInit } from '@angular/core';
|
|
2
|
+
import { IconNames, IconContext } from '../icon/icon';
|
|
3
|
+
import { TextTransform } from '../text/text';
|
|
4
|
+
import {
|
|
5
|
+
// ButtonTypeOptions,
|
|
6
|
+
UIButton,
|
|
7
|
+
UIButtonBoolean,
|
|
8
|
+
UIButtonSize,
|
|
9
|
+
UIButtonType
|
|
10
|
+
} from './button';
|
|
11
|
+
|
|
12
|
+
@Component({
|
|
13
|
+
selector:'ui-button',
|
|
14
|
+
templateUrl: './button.component.html',
|
|
15
|
+
styleUrls: ['./button.component.scss'],
|
|
16
|
+
encapsulation: ViewEncapsulation.None,
|
|
17
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
18
|
+
})
|
|
19
|
+
export class OasysButtonComponent implements OnInit, OnChanges, AfterViewInit {
|
|
20
|
+
|
|
21
|
+
button: UIButton;
|
|
22
|
+
|
|
23
|
+
// // Button Content
|
|
24
|
+
@Input() buttonIcon?: IconNames;
|
|
25
|
+
@Input() buttonIconPlacement: IconContext = 'leading';
|
|
26
|
+
|
|
27
|
+
// @Input() buttonText: string;
|
|
28
|
+
@ContentChild('buttonText') buttonText: ElementRef;
|
|
29
|
+
|
|
30
|
+
// Button Stylings
|
|
31
|
+
@Input() buttonSize: UIButtonSize = 'large';
|
|
32
|
+
@Input() buttonFullWidth: UIButtonBoolean = false;
|
|
33
|
+
@Input() buttonType: UIButtonType = 'primary';
|
|
34
|
+
@Input() buttonDisabled: boolean = false;
|
|
35
|
+
|
|
36
|
+
// Button Actions
|
|
37
|
+
@Input() href: string = '';
|
|
38
|
+
@Output() clicked: EventEmitter<void> = new EventEmitter();
|
|
39
|
+
|
|
40
|
+
buttonDisplayClasses: string[];
|
|
41
|
+
iconContext: IconContext = 'none';
|
|
42
|
+
textTransform!: TextTransform;
|
|
43
|
+
accessibleButtonContent: string;
|
|
44
|
+
outlineButtonTypes = ['secondary', 'secondary-inverse']
|
|
45
|
+
|
|
46
|
+
constructor(private changes: ChangeDetectorRef) { }
|
|
47
|
+
|
|
48
|
+
onClick(): void {
|
|
49
|
+
this.clicked.emit();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
createButton(): UIButton {
|
|
53
|
+
|
|
54
|
+
return <UIButton>{
|
|
55
|
+
buttonIcon: this.buttonIcon,
|
|
56
|
+
buttonIconPlacement: this.buttonIconPlacement,
|
|
57
|
+
buttonType: this.buttonType,
|
|
58
|
+
buttonSize: this.buttonSize,
|
|
59
|
+
buttonDisabled: this.buttonDisabled,
|
|
60
|
+
href: this.href,
|
|
61
|
+
target: '',
|
|
62
|
+
buttonDisplayClasses: [
|
|
63
|
+
`type-${this.buttonType}`,
|
|
64
|
+
`size-${this.buttonSize}`,
|
|
65
|
+
`${this.buttonIcon ? 'button--has-icon': ''}`,
|
|
66
|
+
`${this.buttonFullWidth ? 'button--full-width': ''}`,
|
|
67
|
+
`${this.buttonIcon ? 'button--icon--'+this.buttonIconPlacement : ''}`,
|
|
68
|
+
`${this.outlineButtonTypes.indexOf(this.buttonType) !== -1 ? 'button--outline' : ''}`
|
|
69
|
+
].filter((d) => !!d)
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
ngAfterViewInit(): void {
|
|
74
|
+
if(this.buttonText?.nativeElement?.innerText) {
|
|
75
|
+
this.accessibleButtonContent = this.buttonText.nativeElement.innerText;
|
|
76
|
+
} else {
|
|
77
|
+
throw new Error(`
|
|
78
|
+
No inner text found. All buttons should have text passed via ng-content to enable accessibility for screen readers, this includes icon-only buttons.
|
|
79
|
+
|
|
80
|
+
Pass content using the template variable #buttonText eg:
|
|
81
|
+
ui-button()
|
|
82
|
+
span(#buttonText) Buy All The Things
|
|
83
|
+
`)
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
ngOnChanges(): void {
|
|
88
|
+
this.button = this.createButton();
|
|
89
|
+
this.changes.markForCheck();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
ngOnInit(): void {
|
|
93
|
+
this.button = this.createButton();
|
|
94
|
+
}
|
|
95
|
+
}
|