@acontplus/ng-components 2.1.29 → 2.1.31
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/fesm2022/acontplus-ng-components.mjs +5713 -3552
- package/fesm2022/acontplus-ng-components.mjs.map +1 -1
- package/package.json +21 -20
- package/src/_index.scss +22 -0
- package/src/core/color/_all-color.scss +16 -0
- package/src/core/density/_all-density.scss +38 -0
- package/src/core/style/_elevation.scss +207 -0
- package/src/core/theming/_all-theme.scss +50 -0
- package/src/core/theming/_config-validation.scss +171 -0
- package/src/core/theming/_definition.scss +158 -0
- package/src/core/theming/_palettes.scss +1060 -0
- package/src/core/tokens/_m3-tokens.scss +141 -0
- package/src/core/tokens/_m3-utils.scss +36 -0
- package/src/core/tokens/_system.scss +395 -0
- package/src/core/tokens/_token-utils.scss +117 -0
- package/src/core/tokens/m3/_index.scss +7 -0
- package/src/core/tokens/m3/_md-sys-color.scss +150 -0
- package/src/core/tokens/m3/_md-sys-elevation.scss +8 -0
- package/src/core/tokens/m3/_md-sys-motion.scss +35 -0
- package/src/core/tokens/m3/_md-sys-shape.scss +31 -0
- package/src/core/tokens/m3/_md-sys-state.scss +13 -0
- package/src/core/tokens/m3/_md-sys-typescale.scss +131 -0
- package/src/core/tokens/m3/_theme.scss +41 -0
- package/src/core/typography/_all-typography.scss +34 -0
- package/src/lib/components/alert/_alert-theme.scss +57 -0
- package/src/lib/components/alert/_m3-alert.scss +72 -0
- package/src/lib/components/alert/alert.scss +60 -0
- package/src/lib/components/autocomplete-wrapper/autocomplete-wrapper.scss +667 -0
- package/src/lib/components/button/button.scss +297 -0
- package/src/lib/components/cards/dynamic-card/dynamic-card.scss +131 -0
- package/src/lib/components/data-grid/_grid-theme.scss +53 -0
- package/src/lib/components/data-grid/_m3-grid.scss +34 -0
- package/src/lib/components/data-grid/cell/cell.scss +38 -0
- package/src/lib/components/data-grid/column-menu/column-menu.scss +117 -0
- package/src/lib/components/data-grid/column-resize/_column-resize.scss +126 -0
- package/src/lib/components/data-grid/grid.scss +245 -0
- package/src/lib/components/date-range-input/calendar/date-range-calendar.scss +29 -0
- package/src/lib/components/date-range-input/date-range-input.scss +194 -0
- package/src/lib/components/dialog-wrapper/dialog-wrapper.scss +36 -0
- package/src/lib/components/drawer/_drawer-theme.scss +57 -0
- package/src/lib/components/drawer/_m3-drawer.scss +24 -0
- package/src/lib/components/drawer/drawer-container.scss +97 -0
- package/src/lib/components/icons/svg-icon/svg-icon.scss +16 -0
- package/src/lib/components/icons/user-icon/user-icon.scss +0 -0
- package/src/lib/components/input-chip/input-chip.scss +0 -0
- package/src/lib/components/popover/_m3-popover.scss +24 -0
- package/src/lib/components/popover/_popover-theme.scss +57 -0
- package/src/lib/components/popover/popover.scss +239 -0
- package/src/lib/components/spinner/spinner.scss +6 -0
- package/src/lib/components/tables/tabulator-table/tabulator-table.scss +68 -0
- package/src/lib/components/theme-toggle/theme-toggle.scss +3 -0
- package/src/lib/styles/_elevation.scss +168 -0
- package/src/lib/styles/_token-utils.scss +115 -0
- package/types/acontplus-ng-components.d.ts +920 -536
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acontplus/ng-components",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.31",
|
|
4
4
|
"description": "Comprehensive Angular Material UI component library featuring dynamic Tabulator tables, theme toggle with dark mode, dialog wrappers, autocomplete components, cards, buttons, icons, input chips, spinners, directives, pipes, and SCSS styling utilities.",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@acontplus/ui-kit": "^1.0.2",
|
|
7
|
-
"@angular/cdk": "^
|
|
8
|
-
"@angular/common": "^
|
|
9
|
-
"@angular/core": "^
|
|
10
|
-
"@angular/material": "^
|
|
7
|
+
"@angular/cdk": "^22.0.0",
|
|
8
|
+
"@angular/common": "^22.0.0",
|
|
9
|
+
"@angular/core": "^22.0.0",
|
|
10
|
+
"@angular/material": "^22.0.0",
|
|
11
11
|
"tabulator-tables": "^6.3.1",
|
|
12
12
|
"@formkit/tempo": "1.0.0",
|
|
13
13
|
"ngx-datex": "1.0.5"
|
|
@@ -16,6 +16,16 @@
|
|
|
16
16
|
"main": "fesm2022/acontplus-ng-components.mjs",
|
|
17
17
|
"module": "fesm2022/acontplus-ng-components.mjs",
|
|
18
18
|
"typings": "types/acontplus-ng-components.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"sass": "./src/_index.scss",
|
|
22
|
+
"types": "./types/acontplus-ng-components.d.ts",
|
|
23
|
+
"default": "./fesm2022/acontplus-ng-components.mjs"
|
|
24
|
+
},
|
|
25
|
+
"./package.json": {
|
|
26
|
+
"default": "./package.json"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
19
29
|
"files": [
|
|
20
30
|
"index.d.ts",
|
|
21
31
|
"*.d.ts",
|
|
@@ -27,8 +37,7 @@
|
|
|
27
37
|
"node": ">=18.0.0"
|
|
28
38
|
},
|
|
29
39
|
"publishConfig": {
|
|
30
|
-
"access": "public"
|
|
31
|
-
"registry": "https://registry.npmjs.org/"
|
|
40
|
+
"access": "public"
|
|
32
41
|
},
|
|
33
42
|
"keywords": [
|
|
34
43
|
"acontplus",
|
|
@@ -65,28 +74,20 @@
|
|
|
65
74
|
"author": "Ivan Paz <ifer343@gmail.com>",
|
|
66
75
|
"license": "MIT",
|
|
67
76
|
"bugs": {
|
|
68
|
-
"url": "https://github.com/
|
|
77
|
+
"url": "https://github.com/acontplus/acontplus-libs/issues"
|
|
69
78
|
},
|
|
70
|
-
"homepage": "https://github.com/
|
|
79
|
+
"homepage": "https://github.com/acontplus/acontplus-libs#readme",
|
|
71
80
|
"repository": {
|
|
72
81
|
"type": "git",
|
|
73
|
-
"url": "
|
|
82
|
+
"url": "https://github.com/acontplus/acontplus-libs.git"
|
|
74
83
|
},
|
|
75
84
|
"release": {
|
|
76
85
|
"branches": [
|
|
77
86
|
"main"
|
|
78
87
|
]
|
|
79
88
|
},
|
|
80
|
-
"
|
|
81
|
-
"./package.json": {
|
|
82
|
-
"default": "./package.json"
|
|
83
|
-
},
|
|
84
|
-
".": {
|
|
85
|
-
"types": "./types/acontplus-ng-components.d.ts",
|
|
86
|
-
"default": "./fesm2022/acontplus-ng-components.mjs"
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
+
"type": "module",
|
|
89
90
|
"dependencies": {
|
|
90
91
|
"tslib": "^2.3.0"
|
|
91
92
|
}
|
|
92
|
-
}
|
|
93
|
+
}
|
package/src/_index.scss
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
@forward './lib/components/alert/alert-theme' as alert-* show alert-theme, alert-color,
|
|
2
|
+
alert-typography, alert-density, alert-base, alert-overrides;
|
|
3
|
+
|
|
4
|
+
@forward './lib/components/drawer/drawer-theme' as drawer-* show drawer-theme, drawer-color,
|
|
5
|
+
drawer-typography, drawer-density, drawer-base, drawer-overrides;
|
|
6
|
+
@forward './lib/components/grid/grid-theme' as grid-* show grid-theme, grid-color, grid-typography,
|
|
7
|
+
grid-density, grid-base, grid-overrides;
|
|
8
|
+
@forward './lib/components/popover/popover-theme' as popover-* show popover-theme, popover-color,
|
|
9
|
+
popover-typography, popover-density, popover-base, popover-overrides;
|
|
10
|
+
@forward './core/theming/definition' show define-theme, define-colors, define-typography,
|
|
11
|
+
define-density;
|
|
12
|
+
@forward './core/theming/color-api-backwards-compatibility' show
|
|
13
|
+
color-variants-backwards-compatibility;
|
|
14
|
+
|
|
15
|
+
@forward './core/tokens/system' show system-level-colors, system-level-typography,
|
|
16
|
+
system-level-elevation, system-level-shape, system-level-motion, system-level-state, theme,
|
|
17
|
+
theme-overrides, m2-theme;
|
|
18
|
+
|
|
19
|
+
@forward './core/theming/all-theme' show all-component-themes, all-component-bases;
|
|
20
|
+
@forward './core/color/all-color' show all-component-colors;
|
|
21
|
+
@forward './core/typography/all-typography' show all-component-typographies;
|
|
22
|
+
@forward './core/density/all-density' show all-component-densities;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
@use '@angular/material' as mat;
|
|
2
|
+
@use '../theming/all-theme';
|
|
3
|
+
|
|
4
|
+
// Includes all of the color styles.
|
|
5
|
+
@mixin all-component-colors($theme) {
|
|
6
|
+
@if not mat.theme-has($theme, color) {
|
|
7
|
+
@error 'No color configuration specified.';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@include all-theme.all-component-themes(mat.theme-remove($theme, base, typography, density));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// @deprecated Use `all-component-colors`.
|
|
14
|
+
@mixin material-extensions-color($theme) {
|
|
15
|
+
@include all-component-colors($theme);
|
|
16
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
@use '@angular/material' as mat;
|
|
2
|
+
@use './../../lib/components/alert/alert-theme';
|
|
3
|
+
// @use '../../button/button-theme';
|
|
4
|
+
// @use '../../colorpicker/colorpicker-theme';
|
|
5
|
+
// @use '../../datetimepicker/datetimepicker-theme';
|
|
6
|
+
@use './../../lib/components/drawer/drawer-theme';
|
|
7
|
+
@use './../../lib/components/grid/grid-theme';
|
|
8
|
+
// @use '../../loader/loader-theme';
|
|
9
|
+
@use './../../lib/components/popover/popover-theme';
|
|
10
|
+
// @use '../../progress/progress-theme';
|
|
11
|
+
// @use '../../select/select-theme';
|
|
12
|
+
// @use '../../split/split-theme';
|
|
13
|
+
// @use '../../tooltip/tooltip-theme';
|
|
14
|
+
|
|
15
|
+
// Includes all of the density styles.
|
|
16
|
+
@mixin all-component-densities($theme) {
|
|
17
|
+
@if not mat.theme-has($theme, density) {
|
|
18
|
+
@error 'No density configuration specified.';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@include alert-theme.density($theme);
|
|
22
|
+
// @include button-theme.density($theme);
|
|
23
|
+
// @include colorpicker-theme.density($theme);
|
|
24
|
+
// @include datetimepicker-theme.density($theme);
|
|
25
|
+
@include drawer-theme.density($theme);
|
|
26
|
+
@include grid-theme.density($theme);
|
|
27
|
+
// @include loader-theme.density($theme);
|
|
28
|
+
@include popover-theme.density($theme);
|
|
29
|
+
// @include progress-theme.density($theme);
|
|
30
|
+
// @include select-theme.density($theme);
|
|
31
|
+
// @include split-theme.density($theme);
|
|
32
|
+
// @include tooltip-theme.density($theme);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// @deprecated Use `all-component-densities`.
|
|
36
|
+
@mixin material-extensions-density($theme) {
|
|
37
|
+
@include all-component-densities($theme);
|
|
38
|
+
}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use 'sass:math';
|
|
3
|
+
@use 'sass:meta';
|
|
4
|
+
@use 'sass:string';
|
|
5
|
+
@use '@angular/material' as mat;
|
|
6
|
+
|
|
7
|
+
$_umbra-opacity: 0.2;
|
|
8
|
+
$_penumbra-opacity: 0.14;
|
|
9
|
+
$_ambient-opacity: 0.12;
|
|
10
|
+
|
|
11
|
+
$_umbra-map: (
|
|
12
|
+
0: '0px 0px 0px 0px',
|
|
13
|
+
1: '0px 2px 1px -1px',
|
|
14
|
+
2: '0px 3px 1px -2px',
|
|
15
|
+
3: '0px 3px 3px -2px',
|
|
16
|
+
4: '0px 2px 4px -1px',
|
|
17
|
+
5: '0px 3px 5px -1px',
|
|
18
|
+
6: '0px 3px 5px -1px',
|
|
19
|
+
7: '0px 4px 5px -2px',
|
|
20
|
+
8: '0px 5px 5px -3px',
|
|
21
|
+
9: '0px 5px 6px -3px',
|
|
22
|
+
10: '0px 6px 6px -3px',
|
|
23
|
+
11: '0px 6px 7px -4px',
|
|
24
|
+
12: '0px 7px 8px -4px',
|
|
25
|
+
13: '0px 7px 8px -4px',
|
|
26
|
+
14: '0px 7px 9px -4px',
|
|
27
|
+
15: '0px 8px 9px -5px',
|
|
28
|
+
16: '0px 8px 10px -5px',
|
|
29
|
+
17: '0px 8px 11px -5px',
|
|
30
|
+
18: '0px 9px 11px -5px',
|
|
31
|
+
19: '0px 9px 12px -6px',
|
|
32
|
+
20: '0px 10px 13px -6px',
|
|
33
|
+
21: '0px 10px 13px -6px',
|
|
34
|
+
22: '0px 10px 14px -6px',
|
|
35
|
+
23: '0px 11px 14px -7px',
|
|
36
|
+
24: '0px 11px 15px -7px',
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
$_penumbra-map: (
|
|
40
|
+
0: '0px 0px 0px 0px',
|
|
41
|
+
1: '0px 1px 1px 0px',
|
|
42
|
+
2: '0px 2px 2px 0px',
|
|
43
|
+
3: '0px 3px 4px 0px',
|
|
44
|
+
4: '0px 4px 5px 0px',
|
|
45
|
+
5: '0px 5px 8px 0px',
|
|
46
|
+
6: '0px 6px 10px 0px',
|
|
47
|
+
7: '0px 7px 10px 1px',
|
|
48
|
+
8: '0px 8px 10px 1px',
|
|
49
|
+
9: '0px 9px 12px 1px',
|
|
50
|
+
10: '0px 10px 14px 1px',
|
|
51
|
+
11: '0px 11px 15px 1px',
|
|
52
|
+
12: '0px 12px 17px 2px',
|
|
53
|
+
13: '0px 13px 19px 2px',
|
|
54
|
+
14: '0px 14px 21px 2px',
|
|
55
|
+
15: '0px 15px 22px 2px',
|
|
56
|
+
16: '0px 16px 24px 2px',
|
|
57
|
+
17: '0px 17px 26px 2px',
|
|
58
|
+
18: '0px 18px 28px 2px',
|
|
59
|
+
19: '0px 19px 29px 2px',
|
|
60
|
+
20: '0px 20px 31px 3px',
|
|
61
|
+
21: '0px 21px 33px 3px',
|
|
62
|
+
22: '0px 22px 35px 3px',
|
|
63
|
+
23: '0px 23px 36px 3px',
|
|
64
|
+
24: '0px 24px 38px 3px',
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
$_ambient-map: (
|
|
68
|
+
0: '0px 0px 0px 0px',
|
|
69
|
+
1: '0px 1px 3px 0px',
|
|
70
|
+
2: '0px 1px 5px 0px',
|
|
71
|
+
3: '0px 1px 8px 0px',
|
|
72
|
+
4: '0px 1px 10px 0px',
|
|
73
|
+
5: '0px 1px 14px 0px',
|
|
74
|
+
6: '0px 1px 18px 0px',
|
|
75
|
+
7: '0px 2px 16px 1px',
|
|
76
|
+
8: '0px 3px 14px 2px',
|
|
77
|
+
9: '0px 3px 16px 2px',
|
|
78
|
+
10: '0px 4px 18px 3px',
|
|
79
|
+
11: '0px 4px 20px 3px',
|
|
80
|
+
12: '0px 5px 22px 4px',
|
|
81
|
+
13: '0px 5px 24px 4px',
|
|
82
|
+
14: '0px 5px 26px 4px',
|
|
83
|
+
15: '0px 6px 28px 5px',
|
|
84
|
+
16: '0px 6px 30px 5px',
|
|
85
|
+
17: '0px 6px 32px 5px',
|
|
86
|
+
18: '0px 7px 34px 6px',
|
|
87
|
+
19: '0px 7px 36px 6px',
|
|
88
|
+
20: '0px 8px 38px 7px',
|
|
89
|
+
21: '0px 8px 40px 7px',
|
|
90
|
+
22: '0px 8px 42px 7px',
|
|
91
|
+
23: '0px 9px 44px 8px',
|
|
92
|
+
24: '0px 9px 46px 8px',
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
// A collection of mixins and CSS classes that can be used to apply elevation to a material
|
|
96
|
+
// element.
|
|
97
|
+
// See: https://material.io/design/environment/elevation.html
|
|
98
|
+
// Examples:
|
|
99
|
+
//
|
|
100
|
+
//
|
|
101
|
+
// .mat-foo {
|
|
102
|
+
// @include $mat-elevation(2);
|
|
103
|
+
//
|
|
104
|
+
// &:active {
|
|
105
|
+
// @include $mat-elevation(8);
|
|
106
|
+
// }
|
|
107
|
+
// }
|
|
108
|
+
//
|
|
109
|
+
// <div id="external-card" class="mat-elevation-z2"><p>Some content</p></div>
|
|
110
|
+
//
|
|
111
|
+
// For an explanation of the design behind how elevation is implemented, see the design doc at
|
|
112
|
+
// https://docs.google.com/document/d/1W3NGSLqDZzjbBBLW2C6y_6NUxtvdZAVaJvg58LY3Q0E/edit
|
|
113
|
+
|
|
114
|
+
// The default duration value for elevation transitions.
|
|
115
|
+
$transition-duration: 280ms !default;
|
|
116
|
+
|
|
117
|
+
// The default easing value for elevation transitions.
|
|
118
|
+
$transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !default;
|
|
119
|
+
|
|
120
|
+
// The default color for elevation shadows.
|
|
121
|
+
$color: black !default;
|
|
122
|
+
|
|
123
|
+
// Prefix for elevation-related selectors.
|
|
124
|
+
$prefix: 'mat-elevation-z';
|
|
125
|
+
|
|
126
|
+
// Applies the correct css rules to an element to give it the elevation specified by $zValue.
|
|
127
|
+
// The $zValue must be between 0 and 24.
|
|
128
|
+
@mixin elevation($zValue, $color: $color, $opacity: null) {
|
|
129
|
+
box-shadow: get-box-shadow($zValue, $color, $opacity);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Applies the elevation to an element in a manner that allows
|
|
133
|
+
// consumers to override it via the Material elevation classes.
|
|
134
|
+
@mixin overridable-elevation($zValue, $color: $color, $opacity: null) {
|
|
135
|
+
&:not([class*='#{$prefix}']) {
|
|
136
|
+
@include elevation($zValue, $color, $opacity);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Gets the box shadow value for a specific elevation.
|
|
141
|
+
@function get-box-shadow($zValue, $shadow-color: black, $opacity: null) {
|
|
142
|
+
@if $zValue == null {
|
|
143
|
+
@return null;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@if (mat.private-is-css-var-name($zValue)) {
|
|
147
|
+
@return $zValue;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
@if meta.type-of($zValue) != number or not math.is-unitless($zValue) {
|
|
151
|
+
@error '$zValue must be a unitless number, but received `#{$zValue}`';
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
@if $zValue < 0 or $zValue > 24 {
|
|
155
|
+
@error '$zValue must be between 0 and 24, but received `#{$zValue}`';
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
$umbra-z-value: map.get($_umbra-map, $zValue);
|
|
159
|
+
$penumbra-z-value: map.get($_penumbra-map, $zValue);
|
|
160
|
+
$ambient-z-value: map.get($_ambient-map, $zValue);
|
|
161
|
+
$color-opacity: 1;
|
|
162
|
+
|
|
163
|
+
@if ($opacity != null) {
|
|
164
|
+
$color-opacity: $opacity;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
$umbra-color: _compute-color-opacity($shadow-color, $_umbra-opacity * $color-opacity);
|
|
168
|
+
$penumbra-color: _compute-color-opacity($shadow-color, $_penumbra-opacity * $color-opacity);
|
|
169
|
+
$ambient-color: _compute-color-opacity($shadow-color, $_ambient-opacity * $color-opacity);
|
|
170
|
+
|
|
171
|
+
@return string.unquote(
|
|
172
|
+
'#{$umbra-z-value} #{$umbra-color}, #{$penumbra-z-value} ' +
|
|
173
|
+
'#{$penumbra-color}, #{$ambient-z-value} #{$ambient-color}'
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Returns a string that can be used as the value for a transition property for elevation.
|
|
178
|
+
// Calling this function directly is useful in situations where a component needs to transition
|
|
179
|
+
// more than one property.
|
|
180
|
+
//
|
|
181
|
+
// .foo {
|
|
182
|
+
// transition: mat-elevation-transition-property-value(), opacity 100ms ease;
|
|
183
|
+
// }
|
|
184
|
+
@function private-transition-property-value(
|
|
185
|
+
$duration: $transition-duration,
|
|
186
|
+
$easing: $transition-timing-function
|
|
187
|
+
) {
|
|
188
|
+
@return box-shadow #{$duration} #{$easing};
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Applies the correct css rules needed to have an element transition between elevations.
|
|
192
|
+
// This mixin should be applied to elements whose elevation values will change depending on their
|
|
193
|
+
// context (e.g. when active or disabled).
|
|
194
|
+
//
|
|
195
|
+
// NOTE(traviskaufman): Both this mixin and the above function use default parameters so they can
|
|
196
|
+
// be used in the same way by clients.
|
|
197
|
+
@mixin elevation-transition($duration: $transition-duration, $easing: $transition-timing-function) {
|
|
198
|
+
transition: private-transition-property-value($duration, $easing);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
@function _compute-color-opacity($color, $opacity) {
|
|
202
|
+
@if meta.type-of($color) == color and $opacity != null {
|
|
203
|
+
@return rgba($color, $opacity);
|
|
204
|
+
} @else {
|
|
205
|
+
@return $color;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Import all the theming functionality.
|
|
2
|
+
@use '@angular/material' as mat;
|
|
3
|
+
@use './../../lib/components/alert/alert-theme';
|
|
4
|
+
// @use '../../button/button-theme';
|
|
5
|
+
// @use '../../colorpicker/colorpicker-theme';
|
|
6
|
+
// @use '../../datetimepicker/datetimepicker-theme';
|
|
7
|
+
@use './../../lib/components/drawer/drawer-theme';
|
|
8
|
+
@use './../../lib/components/data-grid/grid-theme';
|
|
9
|
+
// @use '../../loader/loader-theme';
|
|
10
|
+
@use './../../lib/components/popover/popover-theme';
|
|
11
|
+
// @use '../../progress/progress-theme';
|
|
12
|
+
// @use '../../select/select-theme';
|
|
13
|
+
// @use '../../split/split-theme';
|
|
14
|
+
// @use '../../tooltip/tooltip-theme';
|
|
15
|
+
|
|
16
|
+
// Create a theme.
|
|
17
|
+
@mixin all-component-themes($theme) {
|
|
18
|
+
@include alert-theme.theme($theme);
|
|
19
|
+
// @include button-theme.theme($theme);
|
|
20
|
+
// @include colorpicker-theme.theme($theme);
|
|
21
|
+
// @include datetimepicker-theme.theme($theme);
|
|
22
|
+
@include drawer-theme.theme($theme);
|
|
23
|
+
@include grid-theme.theme($theme);
|
|
24
|
+
// @include loader-theme.theme($theme);
|
|
25
|
+
@include popover-theme.theme($theme);
|
|
26
|
+
// @include progress-theme.theme($theme);
|
|
27
|
+
// @include select-theme.theme($theme);
|
|
28
|
+
// @include split-theme.theme($theme);
|
|
29
|
+
// @include tooltip-theme.theme($theme);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@mixin all-component-bases($theme) {
|
|
33
|
+
@include alert-theme.base($theme);
|
|
34
|
+
// @include button-theme.base($theme);
|
|
35
|
+
// @include colorpicker-theme.base($theme);
|
|
36
|
+
// @include datetimepicker-theme.base($theme);
|
|
37
|
+
@include drawer-theme.base($theme);
|
|
38
|
+
@include grid-theme.base($theme);
|
|
39
|
+
// @include loader-theme.base($theme);
|
|
40
|
+
@include popover-theme.base($theme);
|
|
41
|
+
// @include progress-theme.base($theme);
|
|
42
|
+
// @include select-theme.base($theme);
|
|
43
|
+
// @include split-theme.base($theme);
|
|
44
|
+
// @include tooltip-theme.base($theme);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// @deprecated Use `all-component-themes`.
|
|
48
|
+
@mixin material-extensions-theme($theme) {
|
|
49
|
+
@include all-component-themes($theme);
|
|
50
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
@use 'sass:list';
|
|
2
|
+
@use 'sass:map';
|
|
3
|
+
@use 'sass:meta';
|
|
4
|
+
@use 'sass:string';
|
|
5
|
+
@use '@angular/material' as mat;
|
|
6
|
+
|
|
7
|
+
/// Creates an error message by finding `$config` in the existing message and appending a suffix to
|
|
8
|
+
/// it.
|
|
9
|
+
/// @param {List|String} $err The error message.
|
|
10
|
+
/// @param {String} $suffix The suffix to add.
|
|
11
|
+
/// @return {List|String} The updated error message.
|
|
12
|
+
@function _create-dollar-config-error-message($err, $suffix) {
|
|
13
|
+
@if meta.type-of($err) == 'list' {
|
|
14
|
+
@for $i from 1 through list.length($err) {
|
|
15
|
+
$err: list.set-nth(
|
|
16
|
+
$err,
|
|
17
|
+
$i,
|
|
18
|
+
_create-dollar-config-error-message(list.nth($err, $i), $suffix)
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
} @else if meta.type-of($err) == 'string' {
|
|
22
|
+
$start: string.index($err, '$config');
|
|
23
|
+
@if $start {
|
|
24
|
+
$err: string.insert($err, $suffix, $start + 7);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
@return $err;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/// Validates that the given object is an M3 palette.
|
|
31
|
+
/// @param {*} $palette The object to test
|
|
32
|
+
/// @return {Boolean|null} null if it is a valid M3 palette, else true.
|
|
33
|
+
@function validate-palette($palette) {
|
|
34
|
+
@if not meta.type-of($palette) == 'map' {
|
|
35
|
+
@return true;
|
|
36
|
+
}
|
|
37
|
+
$keys: map.keys($palette);
|
|
38
|
+
$expected-keys: map.keys(mat.$red-palette);
|
|
39
|
+
@if mat.private-validate-allowed-values($keys, $expected-keys...) or
|
|
40
|
+
mat.private-validate-required-values($keys, $expected-keys...)
|
|
41
|
+
{
|
|
42
|
+
@return true;
|
|
43
|
+
}
|
|
44
|
+
$nv-keys: map.keys(map.get($palette, neutral-variant));
|
|
45
|
+
$expected-nv-keys: map.keys(map.get(mat.$red-palette, neutral-variant));
|
|
46
|
+
@if mat.private-validate-allowed-values($nv-keys, $expected-nv-keys...) or
|
|
47
|
+
mat.private-validate-required-values($nv-keys, $expected-nv-keys...)
|
|
48
|
+
{
|
|
49
|
+
@return true;
|
|
50
|
+
}
|
|
51
|
+
@return null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/// Validates a theme config.
|
|
55
|
+
/// @param {Map} $config The config to test.
|
|
56
|
+
/// @return {List} null if no error, else the error message
|
|
57
|
+
@function validate-theme-config($config) {
|
|
58
|
+
$err: mat.private-validate-type($config, 'map', 'null');
|
|
59
|
+
@if $err {
|
|
60
|
+
@return (#{'$config should be a configuration object. Got:'} $config);
|
|
61
|
+
}
|
|
62
|
+
$allowed: (color, typography, density);
|
|
63
|
+
$err: mat.private-validate-allowed-values(map.keys($config or ()), $allowed...);
|
|
64
|
+
@if $err {
|
|
65
|
+
@return (
|
|
66
|
+
#{'$config has unexpected properties. Valid properties are'} #{'#{$allowed}.'} #{'Found:'}
|
|
67
|
+
$err
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
$err: validate-color-config(map.get($config, color));
|
|
71
|
+
@if $err {
|
|
72
|
+
@return _create-dollar-config-error-message($err, '.color');
|
|
73
|
+
}
|
|
74
|
+
$err: validate-typography-config(map.get($config, typography));
|
|
75
|
+
@if $err {
|
|
76
|
+
@return _create-dollar-config-error-message($err, '.typography');
|
|
77
|
+
}
|
|
78
|
+
$err: validate-density-config(map.get($config, density));
|
|
79
|
+
@if $err {
|
|
80
|
+
@return _create-dollar-config-error-message($err, '.density');
|
|
81
|
+
}
|
|
82
|
+
@return null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/// Validates a theme color config.
|
|
86
|
+
/// @param {Map} $config The config to test.
|
|
87
|
+
/// @return {List} null if no error, else the error message
|
|
88
|
+
@function validate-color-config($config) {
|
|
89
|
+
$err: mat.private-validate-type($config, 'map', 'null');
|
|
90
|
+
@if $err {
|
|
91
|
+
@return (#{'$config should be a color configuration object. Got:'} $config);
|
|
92
|
+
}
|
|
93
|
+
$allowed: (theme-type, primary, tertiary, use-system-variables);
|
|
94
|
+
$err: mat.private-validate-allowed-values(map.keys($config or ()), $allowed...);
|
|
95
|
+
@if $err {
|
|
96
|
+
@return (
|
|
97
|
+
#{'$config has unexpected properties. Valid properties are'} #{'#{$allowed}.'} #{'Found:'}
|
|
98
|
+
$err
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
@if $config and
|
|
102
|
+
map.has-key($config, theme-type) and not
|
|
103
|
+
list.index((light, dark, color-scheme), map.get($config, theme-type))
|
|
104
|
+
{
|
|
105
|
+
@return (
|
|
106
|
+
#{'Expected $config.theme-type to be one of: light, dark, color-scheme. Got:'}
|
|
107
|
+
map.get($config, theme-type)
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
@each $palette in (primary, secondary, tertiary) {
|
|
111
|
+
@if $config and map.has-key($config, $palette) {
|
|
112
|
+
$err: validate-palette(map.get($config, $palette));
|
|
113
|
+
@if $err {
|
|
114
|
+
@return (
|
|
115
|
+
#{'Expected $config.#{$palette} to be a valid M3 palette. Got:'}
|
|
116
|
+
map.get($config, $palette)
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
@return null;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/// Validates a theme typography config.
|
|
125
|
+
/// @param {Map} $config The config to test.
|
|
126
|
+
/// @return {List} null if no error, else the error message
|
|
127
|
+
@function validate-typography-config($config) {
|
|
128
|
+
$err: mat.private-validate-type($config, 'map', 'null');
|
|
129
|
+
@if $err {
|
|
130
|
+
@return (#{'$config should be a typography configuration object. Got:'} $config);
|
|
131
|
+
}
|
|
132
|
+
$allowed: (
|
|
133
|
+
brand-family,
|
|
134
|
+
plain-family,
|
|
135
|
+
bold-weight,
|
|
136
|
+
medium-weight,
|
|
137
|
+
regular-weight,
|
|
138
|
+
use-system-variables
|
|
139
|
+
);
|
|
140
|
+
$err: mat.private-validate-allowed-values(map.keys($config or ()), $allowed...);
|
|
141
|
+
@if $err {
|
|
142
|
+
@return (
|
|
143
|
+
#{'$config has unexpected properties. Valid properties are'} #{'#{$allowed}.'} #{'Found:'}
|
|
144
|
+
$err
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
@return null;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/// Validates a theme density config.
|
|
151
|
+
/// @param {Map} $config The config to test.
|
|
152
|
+
/// @return {List} null if no error, else the error message
|
|
153
|
+
@function validate-density-config($config) {
|
|
154
|
+
$err: mat.private-validate-type($config, 'map', 'null');
|
|
155
|
+
@if $err {
|
|
156
|
+
@return (#{'$config should be a density configuration object. Got:'} $config);
|
|
157
|
+
}
|
|
158
|
+
$err: mat.private-validate-allowed-values(map.keys($config or ()), scale);
|
|
159
|
+
@if $err {
|
|
160
|
+
@return (#{'$config has unexpected properties. Valid properties are: scale. Found:'} $err);
|
|
161
|
+
}
|
|
162
|
+
@if $config and map.has-key($config, scale) {
|
|
163
|
+
$allowed-scales: (0, -1, -2, -3, -4, -5, minimum, maximum);
|
|
164
|
+
@if mat.private-validate-allowed-values(map.get($config, scale), $allowed-scales...) {
|
|
165
|
+
@return (
|
|
166
|
+
#{'Expected $config.scale to be one of: #{$allowed-scales}. Got:'} map.get($config, scale)
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
@return null;
|
|
171
|
+
}
|