@acontplus/ng-components 2.1.30 → 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.
Files changed (54) hide show
  1. package/fesm2022/acontplus-ng-components.mjs +5713 -3552
  2. package/fesm2022/acontplus-ng-components.mjs.map +1 -1
  3. package/package.json +19 -18
  4. package/src/_index.scss +22 -0
  5. package/src/core/color/_all-color.scss +16 -0
  6. package/src/core/density/_all-density.scss +38 -0
  7. package/src/core/style/_elevation.scss +207 -0
  8. package/src/core/theming/_all-theme.scss +50 -0
  9. package/src/core/theming/_config-validation.scss +171 -0
  10. package/src/core/theming/_definition.scss +158 -0
  11. package/src/core/theming/_palettes.scss +1060 -0
  12. package/src/core/tokens/_m3-tokens.scss +141 -0
  13. package/src/core/tokens/_m3-utils.scss +36 -0
  14. package/src/core/tokens/_system.scss +395 -0
  15. package/src/core/tokens/_token-utils.scss +117 -0
  16. package/src/core/tokens/m3/_index.scss +7 -0
  17. package/src/core/tokens/m3/_md-sys-color.scss +150 -0
  18. package/src/core/tokens/m3/_md-sys-elevation.scss +8 -0
  19. package/src/core/tokens/m3/_md-sys-motion.scss +35 -0
  20. package/src/core/tokens/m3/_md-sys-shape.scss +31 -0
  21. package/src/core/tokens/m3/_md-sys-state.scss +13 -0
  22. package/src/core/tokens/m3/_md-sys-typescale.scss +131 -0
  23. package/src/core/tokens/m3/_theme.scss +41 -0
  24. package/src/core/typography/_all-typography.scss +34 -0
  25. package/src/lib/components/alert/_alert-theme.scss +57 -0
  26. package/src/lib/components/alert/_m3-alert.scss +72 -0
  27. package/src/lib/components/alert/alert.scss +60 -0
  28. package/src/lib/components/autocomplete-wrapper/autocomplete-wrapper.scss +667 -0
  29. package/src/lib/components/button/button.scss +297 -0
  30. package/src/lib/components/cards/dynamic-card/dynamic-card.scss +131 -0
  31. package/src/lib/components/data-grid/_grid-theme.scss +53 -0
  32. package/src/lib/components/data-grid/_m3-grid.scss +34 -0
  33. package/src/lib/components/data-grid/cell/cell.scss +38 -0
  34. package/src/lib/components/data-grid/column-menu/column-menu.scss +117 -0
  35. package/src/lib/components/data-grid/column-resize/_column-resize.scss +126 -0
  36. package/src/lib/components/data-grid/grid.scss +245 -0
  37. package/src/lib/components/date-range-input/calendar/date-range-calendar.scss +29 -0
  38. package/src/lib/components/date-range-input/date-range-input.scss +194 -0
  39. package/src/lib/components/dialog-wrapper/dialog-wrapper.scss +36 -0
  40. package/src/lib/components/drawer/_drawer-theme.scss +57 -0
  41. package/src/lib/components/drawer/_m3-drawer.scss +24 -0
  42. package/src/lib/components/drawer/drawer-container.scss +97 -0
  43. package/src/lib/components/icons/svg-icon/svg-icon.scss +16 -0
  44. package/src/lib/components/icons/user-icon/user-icon.scss +0 -0
  45. package/src/lib/components/input-chip/input-chip.scss +0 -0
  46. package/src/lib/components/popover/_m3-popover.scss +24 -0
  47. package/src/lib/components/popover/_popover-theme.scss +57 -0
  48. package/src/lib/components/popover/popover.scss +239 -0
  49. package/src/lib/components/spinner/spinner.scss +6 -0
  50. package/src/lib/components/tables/tabulator-table/tabulator-table.scss +68 -0
  51. package/src/lib/components/theme-toggle/theme-toggle.scss +3 -0
  52. package/src/lib/styles/_elevation.scss +168 -0
  53. package/src/lib/styles/_token-utils.scss +115 -0
  54. package/types/acontplus-ng-components.d.ts +920 -536
@@ -0,0 +1,97 @@
1
+ /* stylelint-disable keyframes-name-pattern */
2
+ @use '@angular/cdk' as cdk;
3
+ @use '@angular/material' as mat;
4
+ @use './../../../core/tokens/token-utils';
5
+ @use './m3-drawer';
6
+
7
+ $fallbacks: m3-drawer.get-tokens();
8
+
9
+ @keyframes _acp-drawer-enter {
10
+ from {
11
+ box-shadow: none;
12
+ visibility: hidden;
13
+ }
14
+
15
+ to {
16
+ transform: none;
17
+ visibility: visible;
18
+ }
19
+ }
20
+
21
+ @keyframes _acp-drawer-exit {
22
+ from {
23
+ transform: none;
24
+ visibility: visible;
25
+ }
26
+
27
+ to {
28
+ box-shadow: none;
29
+ visibility: hidden;
30
+ }
31
+ }
32
+
33
+ .acp-drawer-container {
34
+ display: block;
35
+ width: 100%;
36
+ padding: 8px 16px;
37
+ overflow: auto;
38
+ outline: 0;
39
+ box-sizing: border-box;
40
+
41
+ // We don't use this, but it's useful for consumers to position
42
+ // elements (e.g. close buttons) inside the bottom sheet.
43
+ position: relative;
44
+ background-color: token-utils.slot(drawer-container-background-color, $fallbacks);
45
+ color: token-utils.slot(drawer-container-text-color, $fallbacks);
46
+ box-shadow: token-utils.slot(drawer-container-elevation-shadow, $fallbacks);
47
+
48
+ @include cdk.high-contrast(active, off) {
49
+ outline: 1px solid;
50
+ }
51
+ }
52
+
53
+ .acp-drawer-container-animations-enabled {
54
+ &.acp-drawer-container-enter {
55
+ animation: _acp-drawer-enter 150ms cubic-bezier(0, 0, 0.2, 1) forwards;
56
+ }
57
+
58
+ &.acp-drawer-container-exit {
59
+ animation: _acp-drawer-exit 400ms cubic-bezier(0.25, 0.8, 0.25, 1) backwards;
60
+ }
61
+
62
+ &.acp-drawer-right {
63
+ transform: translateX(100%);
64
+ }
65
+
66
+ &.acp-drawer-left {
67
+ transform: translateX(-100%);
68
+ }
69
+
70
+ &.acp-drawer-bottom {
71
+ transform: translateY(100%);
72
+ }
73
+
74
+ &.acp-drawer-top {
75
+ transform: translateY(-100%);
76
+ }
77
+ }
78
+
79
+ .acp-drawer-right {
80
+ border-top-left-radius: token-utils.slot(drawer-container-shape, $fallbacks);
81
+ border-bottom-left-radius: token-utils.slot(drawer-container-shape, $fallbacks);
82
+ }
83
+
84
+ .acp-drawer-left {
85
+ border-top-right-radius: token-utils.slot(drawer-container-shape, $fallbacks);
86
+ border-bottom-right-radius: token-utils.slot(drawer-container-shape, $fallbacks);
87
+ }
88
+
89
+ .acp-drawer-bottom {
90
+ border-top-left-radius: token-utils.slot(drawer-container-shape, $fallbacks);
91
+ border-top-right-radius: token-utils.slot(drawer-container-shape, $fallbacks);
92
+ }
93
+
94
+ .acp-drawer-top {
95
+ border-bottom-left-radius: token-utils.slot(drawer-container-shape, $fallbacks);
96
+ border-bottom-right-radius: token-utils.slot(drawer-container-shape, $fallbacks);
97
+ }
@@ -0,0 +1,16 @@
1
+ .acp-svg-icon {
2
+ display: inline-flex;
3
+ align-items: center;
4
+ justify-content: center;
5
+
6
+ svg {
7
+ width: 100%;
8
+ height: 100%;
9
+ fill: currentColor;
10
+ }
11
+
12
+ // When icon is not found and no fallback, hide the container
13
+ &:empty {
14
+ display: none;
15
+ }
16
+ }
File without changes
@@ -0,0 +1,24 @@
1
+ @use 'sass:map';
2
+ @use '../../../core/tokens/m3-utils';
3
+ @use '../../../core/tokens/m3';
4
+
5
+ @function get-tokens($theme: m3.$sys-theme) {
6
+ $system: m3-utils.get-system($theme);
7
+ $tokens: (
8
+ base: (
9
+ popover-container-shape: map.get($system, corner-extra-small),
10
+ // Note that this uses a value, rather than a computed box-shadow, because we use
11
+ // the value at runtime to determine which shadow to set based on the popover's depth.
12
+ popover-base-elevation-level: 2,
13
+ ),
14
+ color: (
15
+ popover-outline-color: map.get($system, surface-container),
16
+ popover-background-color: map.get($system, surface-container),
17
+ popover-text-color: map.get($system, on-surface),
18
+ ),
19
+ typography: (),
20
+ density: (),
21
+ );
22
+
23
+ @return $tokens;
24
+ }
@@ -0,0 +1,57 @@
1
+ @use 'sass:map';
2
+ @use '@angular/material' as mat;
3
+ @use '../../../core/tokens/token-utils';
4
+ @use './m3-popover';
5
+
6
+ @mixin base($theme) {
7
+ $tokens: map.get(m3-popover.get-tokens($theme), base);
8
+
9
+ @include token-utils.values($tokens);
10
+ }
11
+
12
+ @mixin color($theme) {
13
+ $tokens: map.get(m3-popover.get-tokens($theme), color);
14
+ @include token-utils.values($tokens);
15
+ }
16
+
17
+ @mixin typography($theme) {
18
+ $tokens: map.get(m3-popover.get-tokens($theme), typography);
19
+ @include token-utils.values($tokens);
20
+ }
21
+
22
+ @mixin density($theme) {
23
+ $tokens: map.get(m3-popover.get-tokens($theme), density);
24
+
25
+ @include token-utils.values($tokens);
26
+ }
27
+
28
+ /// Defines the tokens that will be available in the `overrides` mixin and for docs extraction.
29
+ @function _define-overrides() {
30
+ @return (
31
+ (namespace: popover, tokens: token-utils.get-overrides(m3-popover.get-tokens(), popover))
32
+ );
33
+ }
34
+
35
+ @mixin overrides($tokens: ()) {
36
+ @include token-utils.batch-create-token-values($tokens, _define-overrides());
37
+ }
38
+
39
+ @mixin theme($theme, $color-variant: null) {
40
+ @if mat.get-theme-version($theme) == 1 {
41
+ @include base($theme);
42
+ @include color($theme);
43
+ @include density($theme);
44
+ @include typography($theme);
45
+ } @else {
46
+ @include base($theme);
47
+ @if mat.theme-has($theme, color) {
48
+ @include color($theme);
49
+ }
50
+ @if mat.theme-has($theme, density) {
51
+ @include density($theme);
52
+ }
53
+ @if mat.theme-has($theme, typography) {
54
+ @include typography($theme);
55
+ }
56
+ }
57
+ }
@@ -0,0 +1,239 @@
1
+ /* stylelint-disable keyframes-name-pattern */
2
+ @use './../../../core/tokens/token-utils';
3
+ @use './m3-popover';
4
+ $fallbacks: m3-popover.get-tokens();
5
+
6
+ $arrow-size: 1em; // 16px default
7
+
8
+ @keyframes _acp-popover-enter {
9
+ from {
10
+ opacity: 0;
11
+ transform: scale(0.8);
12
+ }
13
+
14
+ to {
15
+ opacity: 1;
16
+ transform: none;
17
+ }
18
+ }
19
+
20
+ @keyframes _acp-popover-exit {
21
+ from {
22
+ opacity: 1;
23
+ }
24
+
25
+ to {
26
+ opacity: 0;
27
+ }
28
+ }
29
+
30
+ .acp-popover-panel {
31
+ position: relative;
32
+ max-height: calc(100vh - 48px);
33
+ padding: 8px;
34
+ font-size: inherit; // It can change the arrow size
35
+ outline: 0;
36
+ animation: _acp-popover-enter 120ms cubic-bezier(0, 0, 0.2, 1);
37
+ border-radius: token-utils.slot(popover-container-shape, $fallbacks);
38
+ background-color: token-utils.slot(popover-background-color, $fallbacks);
39
+ color: token-utils.slot(popover-text-color, $fallbacks);
40
+
41
+ &.acp-popover-panel-exit-animation {
42
+ animation: _acp-popover-exit 100ms 25ms linear forwards;
43
+ }
44
+
45
+ &.acp-popover-panel-animations-disabled {
46
+ animation: none;
47
+ }
48
+
49
+ &.acp-popover-panel-animating {
50
+ pointer-events: none;
51
+
52
+ // &:has(.acp-popover-content:empty) {
53
+ // display: none;
54
+ // }
55
+ }
56
+
57
+ &[class*='acp-popover-below'] {
58
+ margin-top: calc(#{$arrow-size * 0.5} + 2px);
59
+ }
60
+
61
+ &[class*='acp-popover-above'] {
62
+ margin-bottom: calc(#{$arrow-size * 0.5} + 2px);
63
+ }
64
+
65
+ &[class*='acp-popover-before'] {
66
+ margin-right: calc(#{$arrow-size * 0.5} + 2px);
67
+
68
+ [dir='rtl'] & {
69
+ margin-right: auto;
70
+ margin-left: calc(#{$arrow-size * 0.5} + 2px);
71
+ }
72
+ }
73
+
74
+ &[class*='acp-popover-after'] {
75
+ margin-left: calc(#{$arrow-size * 0.5} + 2px);
76
+
77
+ [dir='rtl'] & {
78
+ margin-left: auto;
79
+ margin-right: calc(#{$arrow-size * 0.5} + 2px);
80
+ }
81
+ }
82
+
83
+ &.acp-popover-panel-without-arrow {
84
+ margin: 0;
85
+ }
86
+ }
87
+
88
+ .acp-popover-direction-arrow {
89
+ position: absolute;
90
+
91
+ &::before,
92
+ &::after {
93
+ position: absolute;
94
+ display: inline-block;
95
+ content: '';
96
+ border-width: $arrow-size * 0.5;
97
+ border-style: solid;
98
+ }
99
+
100
+ &::before {
101
+ border-color: token-utils.slot(popover-outline-color, $fallbacks);
102
+ }
103
+
104
+ &::after {
105
+ border-width: calc(#{$arrow-size * 0.5} - 1px);
106
+ border-color: token-utils.slot(popover-background-color, $fallbacks);
107
+ }
108
+ }
109
+
110
+ // Arrow up and down
111
+
112
+ [class*='acp-popover-below'],
113
+ [class*='acp-popover-above'] {
114
+ .acp-popover-direction-arrow {
115
+ width: $arrow-size;
116
+
117
+ &::before,
118
+ &::after {
119
+ border-left-color: transparent;
120
+ border-right-color: transparent;
121
+ }
122
+
123
+ &::after {
124
+ left: 1px;
125
+
126
+ [dir='rtl'] & {
127
+ right: 1px;
128
+ left: auto;
129
+ }
130
+ }
131
+ }
132
+ }
133
+
134
+ [class*='acp-popover-below'] {
135
+ .acp-popover-direction-arrow {
136
+ top: 0;
137
+
138
+ &::before,
139
+ &::after {
140
+ bottom: 0;
141
+ border-top-width: 0;
142
+ }
143
+ }
144
+ }
145
+
146
+ [class*='acp-popover-above'] {
147
+ .acp-popover-direction-arrow {
148
+ bottom: 0;
149
+
150
+ &::before,
151
+ &::after {
152
+ top: 0;
153
+ border-bottom-width: 0;
154
+ }
155
+ }
156
+ }
157
+
158
+ // Arrow left and right
159
+
160
+ [class*='acp-popover-before'],
161
+ [class*='acp-popover-after'] {
162
+ .acp-popover-direction-arrow {
163
+ height: $arrow-size;
164
+
165
+ &::before,
166
+ &::after {
167
+ border-top-color: transparent;
168
+ border-bottom-color: transparent;
169
+ }
170
+
171
+ &::after {
172
+ top: 1px;
173
+ }
174
+ }
175
+ }
176
+
177
+ [class*='acp-popover-before'] {
178
+ .acp-popover-direction-arrow {
179
+ right: 0;
180
+
181
+ &::before,
182
+ &::after {
183
+ left: 0;
184
+ border-right-width: 0;
185
+ }
186
+
187
+ [dir='rtl'] & {
188
+ right: auto;
189
+ left: 0;
190
+
191
+ &::before,
192
+ &::after {
193
+ left: auto;
194
+ right: 0;
195
+ border-left-width: 0;
196
+ }
197
+
198
+ &::before {
199
+ border-right-width: $arrow-size * 0.5;
200
+ }
201
+
202
+ &::after {
203
+ border-right-width: calc(#{$arrow-size * 0.5} - 1px);
204
+ }
205
+ }
206
+ }
207
+ }
208
+
209
+ [class*='acp-popover-after'] {
210
+ .acp-popover-direction-arrow {
211
+ left: 0;
212
+
213
+ &::before,
214
+ &::after {
215
+ right: 0;
216
+ border-left-width: 0;
217
+ }
218
+
219
+ [dir='rtl'] & {
220
+ left: auto;
221
+ right: 0;
222
+
223
+ &::before,
224
+ &::after {
225
+ right: auto;
226
+ left: 0;
227
+ border-right-width: 0;
228
+ }
229
+
230
+ &::before {
231
+ border-left-width: $arrow-size * 0.5;
232
+ }
233
+
234
+ &::after {
235
+ border-left-width: calc(#{$arrow-size * 0.5} - 1px);
236
+ }
237
+ }
238
+ }
239
+ }
@@ -0,0 +1,6 @@
1
+ .acp-spinner {
2
+ display: flex;
3
+ justify-content: center;
4
+ align-items: center;
5
+ height: 100%;
6
+ }
@@ -0,0 +1,68 @@
1
+ /* tabulator-table.styles */
2
+ // Default Tabulator theme
3
+ // Note: Tabulator themes are imported globally in styles/index.styles
4
+ // This component only contains custom styling enhancements
5
+
6
+ .tabulator {
7
+ font-size: 12px;
8
+ border-collapse: collapse;
9
+ width: 100%;
10
+ }
11
+
12
+ .acp-tabulator-table {
13
+ display: block;
14
+ }
15
+
16
+ // Base container styles
17
+ .acp-tabulator-table-container {
18
+ width: 100%;
19
+
20
+ // Custom enhancements that work across all themes
21
+ .tabulator-row.tabulator-selectable:hover {
22
+ background-color: rgba(0, 0, 0, 0.04);
23
+ cursor: pointer;
24
+ transition: background-color 0.2s ease;
25
+ }
26
+
27
+ .tabulator-row.tabulator-selected {
28
+ background-color: var(--mat-sys-primary-container, rgba(25, 118, 210, 0.12));
29
+ }
30
+
31
+ // Responsive enhancements
32
+ @media (max-width: 768px) {
33
+ .tabulator-header {
34
+ font-size: 0.875rem;
35
+ }
36
+
37
+ .tabulator-cell {
38
+ font-size: 0.875rem;
39
+ padding: 8px 6px;
40
+ }
41
+ }
42
+
43
+ // Loading state
44
+ .tabulator-loader {
45
+ background: var(--mat-sys-surface-container, rgba(255, 255, 255, 0.8));
46
+ backdrop-filter: blur(2px);
47
+ }
48
+
49
+ // Enhanced scrollbar styling
50
+ .tabulator-tableholder::-webkit-scrollbar {
51
+ width: 8px;
52
+ height: 8px;
53
+ }
54
+
55
+ .tabulator-tableholder::-webkit-scrollbar-track {
56
+ background: var(--mat-sys-surface-variant, #f1f1f1);
57
+ border-radius: 4px;
58
+ }
59
+
60
+ .tabulator-tableholder::-webkit-scrollbar-thumb {
61
+ background: var(--mat-sys-outline, #c1c1c1);
62
+ border-radius: 4px;
63
+
64
+ &:hover {
65
+ background: var(--mat-sys-on-surface-variant, #a8a8a8);
66
+ }
67
+ }
68
+ }
@@ -0,0 +1,3 @@
1
+ .acp-theme-toggle {
2
+ display: inline-block;
3
+ }
@@ -0,0 +1,168 @@
1
+ @use 'sass:map';
2
+ @use 'sass:math';
3
+ @use 'sass:meta';
4
+ @use 'sass:string';
5
+
6
+ $_umbra-opacity: 0.2;
7
+ $_penumbra-opacity: 0.14;
8
+ $_ambient-opacity: 0.12;
9
+
10
+ $_umbra-map: (
11
+ 0: '0px 0px 0px 0px',
12
+ 1: '0px 2px 1px -1px',
13
+ 2: '0px 3px 1px -2px',
14
+ 3: '0px 3px 3px -2px',
15
+ 4: '0px 2px 4px -1px',
16
+ 5: '0px 3px 5px -1px',
17
+ 6: '0px 3px 5px -1px',
18
+ 7: '0px 4px 5px -2px',
19
+ 8: '0px 5px 5px -3px',
20
+ 9: '0px 5px 6px -3px',
21
+ 10: '0px 6px 6px -3px',
22
+ 11: '0px 6px 7px -4px',
23
+ 12: '0px 7px 8px -4px',
24
+ 13: '0px 7px 8px -4px',
25
+ 14: '0px 7px 9px -4px',
26
+ 15: '0px 8px 9px -5px',
27
+ 16: '0px 8px 10px -5px',
28
+ 17: '0px 8px 11px -5px',
29
+ 18: '0px 9px 11px -5px',
30
+ 19: '0px 9px 12px -6px',
31
+ 20: '0px 10px 13px -6px',
32
+ 21: '0px 10px 13px -6px',
33
+ 22: '0px 10px 14px -6px',
34
+ 23: '0px 11px 14px -7px',
35
+ 24: '0px 11px 15px -7px',
36
+ );
37
+
38
+ $_penumbra-map: (
39
+ 0: '0px 0px 0px 0px',
40
+ 1: '0px 1px 1px 0px',
41
+ 2: '0px 2px 2px 0px',
42
+ 3: '0px 3px 4px 0px',
43
+ 4: '0px 4px 5px 0px',
44
+ 5: '0px 5px 8px 0px',
45
+ 6: '0px 6px 10px 0px',
46
+ 7: '0px 7px 10px 1px',
47
+ 8: '0px 8px 10px 1px',
48
+ 9: '0px 9px 12px 1px',
49
+ 10: '0px 10px 14px 1px',
50
+ 11: '0px 11px 15px 1px',
51
+ 12: '0px 12px 17px 2px',
52
+ 13: '0px 13px 19px 2px',
53
+ 14: '0px 14px 21px 2px',
54
+ 15: '0px 15px 22px 2px',
55
+ 16: '0px 16px 24px 2px',
56
+ 17: '0px 17px 26px 2px',
57
+ 18: '0px 18px 28px 2px',
58
+ 19: '0px 19px 29px 2px',
59
+ 20: '0px 20px 31px 3px',
60
+ 21: '0px 21px 33px 3px',
61
+ 22: '0px 22px 35px 3px',
62
+ 23: '0px 23px 36px 3px',
63
+ 24: '0px 24px 38px 3px',
64
+ );
65
+
66
+ $_ambient-map: (
67
+ 0: '0px 0px 0px 0px',
68
+ 1: '0px 1px 3px 0px',
69
+ 2: '0px 1px 5px 0px',
70
+ 3: '0px 1px 8px 0px',
71
+ 4: '0px 1px 10px 0px',
72
+ 5: '0px 1px 14px 0px',
73
+ 6: '0px 1px 18px 0px',
74
+ 7: '0px 2px 16px 1px',
75
+ 8: '0px 3px 14px 2px',
76
+ 9: '0px 3px 16px 2px',
77
+ 10: '0px 4px 18px 3px',
78
+ 11: '0px 4px 20px 3px',
79
+ 12: '0px 5px 22px 4px',
80
+ 13: '0px 5px 24px 4px',
81
+ 14: '0px 5px 26px 4px',
82
+ 15: '0px 6px 28px 5px',
83
+ 16: '0px 6px 30px 5px',
84
+ 17: '0px 6px 32px 5px',
85
+ 18: '0px 7px 34px 6px',
86
+ 19: '0px 7px 36px 6px',
87
+ 20: '0px 8px 38px 7px',
88
+ 21: '0px 8px 40px 7px',
89
+ 22: '0px 8px 42px 7px',
90
+ 23: '0px 9px 44px 8px',
91
+ 24: '0px 9px 46px 8px',
92
+ );
93
+
94
+ // A collection of mixins and CSS classes that can be used to apply elevation to a material
95
+ // element.
96
+ // See: https://material.io/design/environment/elevation.html
97
+ // Examples:
98
+ //
99
+ //
100
+ // .mat-foo {
101
+ // @include $mat-elevation(2);
102
+ //
103
+ // &:active {
104
+ // @include $mat-elevation(8);
105
+ // }
106
+ // }
107
+ //
108
+ // <div id="external-card" class="mat-elevation-z2"><p>Some content</p></div>
109
+ //
110
+ // For an explanation of the design behind how elevation is implemented, see the design doc at
111
+ // https://goo.gl/Kq0k9Z.
112
+
113
+ // The default color for elevation shadows.
114
+ $color: black !default;
115
+
116
+ // Prefix for elevation-related selectors.
117
+ $prefix: 'mat-elevation-z';
118
+
119
+ // Applies the correct css rules to an element to give it the elevation specified by $zValue.
120
+ // The $zValue must be between 0 and 24.
121
+ @mixin elevation($zValue, $color: $color, $opacity: null) {
122
+ box-shadow: get-box-shadow($zValue, $color, $opacity);
123
+ }
124
+
125
+ // Applies the elevation to an element in a manner that allows
126
+ // consumers to override it via the Material elevation classes.
127
+ @mixin overridable-elevation($zValue, $color: $color, $opacity: null) {
128
+ &:not([class*='#{$prefix}']) {
129
+ @include elevation($zValue, $color, $opacity);
130
+ }
131
+ }
132
+
133
+ // Gets the box shadow value for a specific elevation.
134
+ @function get-box-shadow($zValue, $shadow-color: black, $opacity: null) {
135
+ @if $zValue == null {
136
+ @return null;
137
+ }
138
+
139
+ @if meta.type-of($zValue) != number or not math.is-unitless($zValue) {
140
+ @error '$zValue must be a unitless number, but received `#{$zValue}`';
141
+ }
142
+
143
+ @if $zValue < 0 or $zValue > 24 {
144
+ @error '$zValue must be between 0 and 24, but received `#{$zValue}`';
145
+ }
146
+
147
+ $umbra-z-value: map.get($_umbra-map, $zValue);
148
+ $penumbra-z-value: map.get($_penumbra-map, $zValue);
149
+ $ambient-z-value: map.get($_ambient-map, $zValue);
150
+
151
+ $color-opacity: if($opacity != null, $opacity, 1);
152
+ $umbra-color: _compute-color-opacity($shadow-color, $_umbra-opacity * $color-opacity);
153
+ $penumbra-color: _compute-color-opacity($shadow-color, $_penumbra-opacity * $color-opacity);
154
+ $ambient-color: _compute-color-opacity($shadow-color, $_ambient-opacity * $color-opacity);
155
+
156
+ @return string.unquote(
157
+ '#{$umbra-z-value} #{$umbra-color}, #{$penumbra-z-value} ' +
158
+ '#{$penumbra-color}, #{$ambient-z-value} #{$ambient-color}'
159
+ );
160
+ }
161
+
162
+ @function _compute-color-opacity($color, $opacity) {
163
+ @if meta.type-of($color) == color and $opacity != null {
164
+ @return rgba($color, $opacity);
165
+ } @else {
166
+ @return $color;
167
+ }
168
+ }