@porscheinformatik/material-addons 21.0.4 → 22.0.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.
@@ -1,540 +1,31 @@
1
- @use 'sass:map';
2
1
  @use '@angular/material' as mat;
3
2
  @use './theme';
4
-
5
- @import 'material-icons/iconfont/material-icons.css';
6
- @import 'roboto-fontface/css/roboto/roboto-fontface.css';
3
+ @use './components/button' as button;
4
+ @use './components/color-overrides' as color-overrides;
5
+ @use './components/flowbar' as flowbar;
6
+ @use './components/material-overrides' as material-overrides;
7
+ @use './components/readonly' as readonly;
8
+ @use './components/toolbar' as toolbar;
9
+ @use './foundation/base';
10
+ @use './foundation/fonts';
11
+ @use './foundation/typography' as typography;
12
+ @use './foundation/utilities';
13
+ @use './tokens/tokens' as tokens;
14
+ @forward './tokens/tokens' show $default-palette;
7
15
 
8
16
  @include mat.elevation-classes();
9
17
  @include mat.app-background();
10
18
 
11
- //TODO Contrasts should be part of the themes!
12
- $contrast: (
13
- 50: rgba(black, 0.87),
14
- 100: rgba(black, 0.87),
15
- 200: rgba(black, 0.87),
16
- 300: rgba(black, 0.87),
17
- 400: rgba(black, 0.87),
18
- 500: white,
19
- 600: white,
20
- 700: white,
21
- 800: white,
22
- 900: white,
23
- A100: rgba(black, 0.87),
24
- A200: rgba(black, 0.87),
25
- A400: rgba(black, 0.87),
26
- A700: rgba(black, 0.87),
27
- );
28
-
29
- $default-palette: (
30
- panel-background-color: #e8e8e8,
31
- panel-border-color: #cccccc,
32
- panel-select-background: white,
33
- alert-success-background-color: rgb(238, 252, 227),
34
- alert-success-border-color: rgb(66, 129, 14),
35
- alert-success-text-color: #155724,
36
- alert-info-background-color: rgb(229, 247, 255),
37
- alert-info-border-color: rgb(0, 121, 173),
38
- alert-info-text-color: #0c5460,
39
- alert-warning-background-color: rgb(255, 242, 214),
40
- alert-warning-border-color: rgb(255, 185, 46),
41
- alert-warning-text-color: #856404,
42
- alert-error-background-color: rgb(255, 242, 240),
43
- alert-error-border-color: rgb(224, 34, 0),
44
- alert-error-text-color: #721c24,
45
- );
46
-
47
- @mixin color($theme-name, $theme) {
48
- $main-primary: theme.get-main-color();
49
- $selection-background: theme.get-selection-background();
50
- $table-hover-color: theme.get-table-hover-color($main-primary);
51
- $background-color: theme.get-background-color();
52
- $warn-color: map-get(theme.$primary-palette, warn-color);
53
- $error-color: map-get(theme.$primary-palette, error-color);
54
- $hover-color: map-get(theme.$primary-palette, 50);
55
- $panel-color: map-get(theme.$primary-palette, 900);
56
- $panel-background-color: theme.map-get-or-default(theme.$primary-palette, panel-background-color);
57
- $panel-border-color: theme.map-get-or-default(theme.$primary-palette, panel-border-color);
58
- $panel-select-background: theme.map-get-or-default(theme.$primary-palette, panel-select-background);
59
-
60
- $alert-success-background-color: theme.map-get-or-default(theme.$primary-palette, alert-success-background-color);
61
- $alert-success-border-color: theme.map-get-or-default(theme.$primary-palette, alert-success-border-color);
62
- $alert-success-text-color: theme.map-get-or-default(theme.$primary-palette, alert-success-text-color);
63
-
64
- $alert-info-background-color: theme.map-get-or-default(theme.$primary-palette, alert-info-background-color);
65
- $alert-info-border-color: theme.map-get-or-default(theme.$primary-palette, alert-info-border-color);
66
- $alert-info-text-color: theme.map-get-or-default(theme.$primary-palette, alert-info-text-color);
67
-
68
- $alert-warning-background-color: theme.map-get-or-default(theme.$primary-palette, alert-warning-background-color);
69
- $alert-warning-border-color: theme.map-get-or-default(theme.$primary-palette, alert-warning-border-color);
70
- $alert-warning-text-color: theme.map-get-or-default(theme.$primary-palette, alert-warning-text-color);
71
-
72
- $alert-error-background-color: theme.map-get-or-default(theme.$primary-palette, alert-error-background-color);
73
- $alert-error-border-color: theme.map-get-or-default(theme.$primary-palette, alert-error-border-color);
74
- $alert-error-text-color: theme.map-get-or-default(theme.$primary-palette, alert-error-text-color);
75
-
76
- // Remark: when we style the addons components there is no theme set, yet. So we have multiple possibilities:
77
- // a) include the components in the mixin (so it gets styled when the theme is set)
78
- // b) use the theme-functions (e.g. see nav-child.component.scss)
79
- // c) use css-variables which are overwritten at runtime (what we currently prefer)
80
-
81
- :root {
82
- --main-primary: #{$main-primary};
83
- --selection-background: #{$selection-background};
84
- --hover-color: #{$hover-color};
85
- --table-hover-color: #{$table-hover-color};
86
- --warn-color: #{$warn-color};
87
- --error-color: #{$error-color};
88
- --background-color: #{$background-color};
89
- --panel-color: #{$panel-color};
90
- --panel-background-color: #{$panel-background-color};
91
- --panel-border-color: #{$panel-border-color};
92
- --panel-select-background: #{$panel-select-background};
93
- --mat-button-protected-label-text-color: #{$main-primary};
94
- --alert-success-background-color: #{$alert-success-background-color};
95
- --alert-success-border-color: #{$alert-success-border-color};
96
- --alert-success-text-color: #{$alert-success-text-color};
97
- --alert-info-background-color: #{$alert-info-background-color};
98
- --alert-info-border-color: #{$alert-info-border-color};
99
- --alert-info-text-color: #{$alert-info-text-color};
100
- --alert-warning-background-color: #{$alert-warning-background-color};
101
- --alert-warning-border-color: #{$alert-warning-border-color};
102
- --alert-warning-text-color: #{$alert-warning-text-color};
103
- --alert-error-background-color: #{$alert-error-background-color};
104
- --alert-error-border-color: #{$alert-error-border-color};
105
- --alert-error-text-color: #{$alert-error-text-color};
106
- }
107
-
108
- @if variable-exists(table-hover-color) {
109
- .clickable-table-row:hover,
110
- .mat-row-link:hover {
111
- background-color: $table-hover-color;
112
- }
113
- } @else {
114
- @warn 'variable $table-hover-color in theme #{$theme-name} is not defined';
115
- }
116
-
117
- @if variable_exists(warn-color) {
118
- .mat-mdc-form-field-required-marker {
119
- color: $warn-color;
120
- }
121
-
122
- .mat-chip.mat-standard-chip.mat-warn {
123
- color: $warn-color;
124
- border: 1px solid $warn-color;
125
- }
126
- } @else {
127
- @warn 'variable $warn-color in theme #{$theme-name} is not defined';
128
- }
129
-
130
- @if variable_exists(main-primary) {
131
- .mat-mdc-outlined-button {
132
- border-color: $main-primary !important;
133
- }
134
- .mat-chip-selected {
135
- border: 1px solid $main-primary !important;
136
- color: $main-primary !important;
137
- }
138
- .mat-stroked-button {
139
- border-color: $main-primary !important;
140
- }
141
- .selected-drag-list {
142
- border-color: $main-primary !important;
143
- }
144
- .active-column-definition {
145
- color: $main-primary !important;
146
- }
147
- } @else {
148
- @warn 'variable $main-primary in theme #{$theme-name} is not defined';
149
- }
150
-
151
- .mat-chip-selected {
152
- background-color: white !important;
153
- }
154
- }
155
-
156
- @mixin typography($theme-name, $theme) {
157
- $typography-config: mat.m2-get-typography-config($theme);
158
-
159
- // set custom typography styles here
160
- }
161
-
162
19
  @mixin theme($theme-name, $theme) {
163
- $color-config: mat.m2-get-color-config($theme-name, $theme);
164
- @if $color-config != null {
165
- @include color($theme-name, $theme);
166
- }
167
-
168
- $typography-config: mat.m2-get-typography-config($theme-name, $theme);
169
- @if $typography-config != null {
170
- @include typography($theme-name, $theme);
171
- }
172
- }
173
-
174
- body {
175
- margin: 0;
176
- }
177
-
178
- a {
179
- color: inherit;
180
- text-decoration: inherit;
181
- }
182
-
183
- .spacer {
184
- flex: 1 1 auto;
185
- }
186
-
187
- table {
188
- width: 100%;
189
- }
190
-
191
- app-root {
192
- display: flex;
193
- flex-direction: column;
194
- height: 100vh;
195
- }
196
-
197
- .mat-mdc-input-element:disabled {
198
- cursor: auto;
199
- color: black;
200
- }
201
-
202
- .mat-mdc-select-disabled .mat-select-value {
203
- color: black;
204
- }
205
-
206
- .mat-mdc-form-field .mat-mdc-select.mat-select-disabled .mat-select-arrow {
207
- color: white;
208
- }
209
-
210
- .mat-mdc-checkbox-disabled .mat-checkbox-label {
211
- color: black;
212
- }
213
-
214
- .clickable-table-row:hover,
215
- .mat-row-link:hover {
216
- cursor: pointer;
217
- }
218
-
219
- .button-panel {
220
- padding-top: 16px;
221
- padding-bottom: 8px;
222
- padding-right: 16px;
223
- }
224
-
225
- mad-primary-button {
226
- margin-right: 8px;
227
- }
228
-
229
- mad-outline-button {
230
- margin-right: 8px;
231
- }
232
-
233
- mad-link-button {
234
- margin-right: 8px;
235
- }
236
-
237
- mad-danger-button {
238
- margin-right: 8px;
239
- }
240
-
241
- .simple-edit-section {
242
- display: flex;
243
- flex-direction: column;
244
- }
245
-
246
- .simple-edit-section > * {
247
- width: 100%;
248
- max-width: 640px;
249
- }
250
-
251
- .tiny-table-section {
252
- display: flex;
253
- flex-direction: column;
254
- }
255
-
256
- .table-condensed > .mat-mdc-row {
257
- min-height: 36px;
258
- }
259
-
260
- .small-input {
261
- max-width: 90px !important;
262
- }
263
-
264
- .tiny-input {
265
- max-width: 60px !important;
266
- }
267
-
268
- .main-content {
269
- padding: 73px 16px 16px;
270
- }
271
-
272
- .mat-mdc-tab-header {
273
- margin: -16px -16px 16px;
274
- }
275
-
276
- .mat-mdc-row {
277
- position: relative;
278
- }
279
-
280
- .mat-row-link {
281
- position: absolute;
282
- width: 100%;
283
- height: 100%;
284
- left: 0;
285
- top: 0;
286
- }
287
-
288
- .mat-mdc-button,
289
- .mat-mdc-unelevated-button,
290
- .mat-mdc-raised-button,
291
- .mat-mdc-outlined-button,
292
- .mat-mdc-icon-button {
293
- text-transform: uppercase !important;
294
- }
295
-
296
- .toolbar-title {
297
- text-overflow: ellipsis;
298
- white-space: nowrap;
299
- overflow: hidden;
300
- }
301
-
302
- .mat-mdc-select-disabled {
303
- color: rgba(0, 0, 0, 0.38);
304
- }
305
-
306
- .sticky-paginator {
307
- background-color: white;
308
- position: fixed;
309
- padding-right: 16px;
310
- bottom: 0;
311
- right: 0;
312
- left: 0;
313
- z-index: 5;
314
- text-align: right;
315
- }
316
-
317
- .with-sticky-paginator {
318
- padding-bottom: 64px;
319
- }
320
-
321
- .criteria-panel {
322
- display: flex;
323
- flex-direction: row;
324
- flex-wrap: wrap;
325
- justify-content: flex-start;
326
- }
327
-
328
- .criteria-panel > * {
329
- padding-right: 16px;
330
- }
331
-
332
- .mat-chip.mat-standard-chip {
333
- background-color: white;
334
- color: rgba(0, 0, 0, 0.87);
335
- border: 1px solid rgba(0, 0, 0, 0.4);
336
- }
337
-
338
- .mat-chip.mat-standard-chip.mat-warn {
339
- background-color: white;
340
- }
341
-
342
- .mat-mdc-tab-group {
343
- max-width: 100%;
344
- }
345
-
346
- .large-icon {
347
- font-size: xx-large;
348
- }
349
-
350
- .transparent .mat-mdc-dialog-container {
351
- box-shadow: none;
352
- background: rgba(0, 0, 0, 0);
353
- }
354
-
355
- /*
356
- * This class can be used to fix mat-tabs at the top of a page
357
- */
358
- .fixedtabs > .mat-mdc-tab-header {
359
- z-index: 10;
360
- width: 100vw;
361
- position: fixed;
362
- background-color: white;
363
- }
364
-
365
- .mat-mdc-dialog-actions {
366
- justify-content: flex-end;
367
- }
368
-
369
- .mat-md-card-header-text {
370
- margin: 0 !important;
371
- }
372
-
373
- mat-icon.mat-icon.narrow-icon {
374
- margin-right: 0;
375
- margin-left: 0;
376
- }
377
-
378
- button.mat-mdc-menu-item {
379
- min-height: 38px;
380
- }
381
-
382
- .mat-toolbar {
383
- background-color: var(--panel-select-background);
384
-
385
- .mat-mdc-button {
386
- min-width: 0;
387
- padding: 0;
388
- margin: 0 5px;
389
- }
390
- }
391
-
392
- .drop-down {
393
- mat-icon.mat-icon.notranslate {
394
- padding: 0;
395
- margin: 0;
396
- }
397
-
398
- .mat-mdc-outlined-button:not(:disabled) {
399
- color: var(--mat-button-outlined-label-text-color, inherit);
400
- border-color: var(--mat-button-outlined-, inherit);
401
- }
402
-
403
- &::after {
404
- content: '\02C7';
405
- font-size: 2em !important;
406
- padding-top: 15px;
407
- padding-left: 3px;
408
- }
409
- }
410
-
411
- // full page
412
- .top-nav-bar {
413
- top: 0;
414
- left: 0;
415
- right: 0;
416
- z-index: 2;
417
- }
418
-
419
- //maybe we have different navs for desktop, mobile,...
420
- .top-main-nav {
421
- display: flex;
422
- flex-wrap: wrap;
423
- align-items: center;
424
- background-color: white;
425
-
426
- > .mat-mdc-button {
427
- &:last-child {
428
- margin-left: auto;
429
- }
430
- }
431
- }
432
-
433
- .flex-spacer {
434
- flex-grow: 1;
435
- }
436
-
437
- .logo {
438
- display: flex;
439
- height: 26px;
440
- margin-right: 20px;
441
- }
442
-
443
- .logo a {
444
- display: flex;
445
- align-items: center;
446
- gap: 5px;
447
- color: var(--main-primary);
448
- }
449
-
450
- @mixin ellipsis-text-overflow {
451
- text-overflow: ellipsis;
452
- overflow: hidden;
453
- white-space: nowrap;
454
- }
455
-
456
- .ellipsis-text-overflow {
457
- @include ellipsis-text-overflow;
458
- }
459
-
460
- @media print {
461
- .no-print,
462
- .no-print * {
463
- display: none !important;
464
- width: 0 !important;
465
- height: 0 !important;
466
- }
467
-
468
- mat-paginator {
469
- display: none !important;
470
- height: 0 !important;
471
- }
472
-
473
- mat-sidenav-content {
474
- margin: 0 !important;
475
- }
476
-
477
- .mat-mdc-raised-button,
478
- .mat-mdc-outlined-button,
479
- .button-panel {
480
- display: none !important;
481
- }
482
-
483
- mad-primary-button,
484
- mad-outline-button,
485
- mad-danger-button,
486
- mad-link-button,
487
- mad-icon-button {
488
- display: none !important;
489
- }
490
-
491
- .criteria-panel {
492
- display: none !important;
493
- height: 0 !important;
494
- }
495
-
496
- async-autocomplete mat-icon {
497
- display: none !important;
498
- }
499
- .mat-mdc-tab-label:not(.mat-tab-label-active) {
500
- display: none !important;
501
- }
502
- }
503
-
504
- .mad-read-only {
505
- mat-label {
506
- color: black;
507
- }
508
- .content {
509
- color: black !important;
510
- }
511
- .mdc-notched-outline__leading,
512
- .mdc-notched-outline__notch,
513
- .mdc-notched-outline__trailing {
514
- border: none !important;
515
- }
516
- }
517
-
518
- // needed for the padding fix when subscriptSizing: 'dynamic'
519
- mat-form-field .mat-mdc-form-field {
520
- &-subscript-wrapper {
521
- margin-bottom: 1.25em;
522
- }
523
- }
524
-
525
- // the label of the outline input is set into the padding of the form-field-component
526
- .mat-form-field-appearance-outline {
527
- margin-top: 8px;
528
- }
529
-
530
- .pointer {
531
- cursor: pointer;
20
+ @include tokens.color-variables($theme-name, $theme);
532
21
  }
533
22
 
534
- .quick-list-row {
535
- display: flex;
536
- flex-direction: row;
537
- mad-icon-button {
538
- margin-top: 8px;
539
- }
23
+ @mixin theme-styles($theme-name, $theme) {
24
+ @include color-overrides.component-colors();
25
+ @include toolbar.toolbar-theme();
26
+ @include readonly.readonly-theme();
27
+ @include flowbar.flowbar-theme();
28
+ @include typography.typography($theme-name, $theme);
29
+ @include button.button-theme();
30
+ @include material-overrides.material-overrides();
540
31
  }
@@ -0,0 +1,52 @@
1
+ @use 'sass:map';
2
+ @use '@angular/material' as mat;
3
+ @use './theme';
4
+ @use './styles' as common;
5
+
6
+ $default-html-overrides: (
7
+ --mat-sys-surface: #ffffff,
8
+ --mat-sys-surface-variant: #f5f5f5,
9
+ --mat-sys-surface-container-lowest: #ffffff,
10
+ --mat-sys-surface-container-low: #ffffff,
11
+ --mat-sys-surface-container: #fafafa,
12
+ --mat-sys-surface-container-high: #f5f5f5,
13
+ --mat-sys-surface-container-highest: #eeeeee,
14
+ );
15
+
16
+ @mixin apply-theme($theme-config, $options: ()) {
17
+ $theme-name: theme.get-theme-name($theme-config);
18
+ $mat-theme: theme.material-theme($theme-config);
19
+ $root-overrides: (
20
+ --mat-sys-on-surface: #181c1f,
21
+ );
22
+ $html-overrides: $default-html-overrides;
23
+
24
+ @if map.has-key($options, root-overrides) {
25
+ $root-overrides: map.get($options, root-overrides);
26
+ }
27
+
28
+ @if map.has-key($options, html-overrides) and map.get($options, html-overrides) != null {
29
+ $html-overrides: map.merge($html-overrides, map.get($options, html-overrides));
30
+ }
31
+
32
+ :root {
33
+ @include common.theme($theme-name, $theme-config);
34
+ @include _emit-declarations($root-overrides);
35
+ }
36
+
37
+ html {
38
+ @include mat.system-level-colors($mat-theme);
39
+ @include _emit-declarations($html-overrides);
40
+ @include mat.all-component-themes($mat-theme);
41
+ @include mat.typography-hierarchy($mat-theme);
42
+ @include common.theme-styles($theme-name, $theme-config);
43
+ }
44
+ }
45
+
46
+ @mixin _emit-declarations($declarations) {
47
+ @if $declarations != null {
48
+ @each $prop, $value in $declarations {
49
+ #{$prop}: #{$value};
50
+ }
51
+ }
52
+ }