@angular/material 17.1.0-next.2 → 17.1.0-rc.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/LICENSE +1 -1
- package/_index.scss +6 -6
- package/bottom-sheet/index.d.ts +2 -4
- package/button/_button-base.scss +20 -2
- package/button/_button-theme.scss +131 -97
- package/button/_fab-theme.scss +2 -8
- package/button/_icon-button-theme.scss +11 -9
- package/button/index.d.ts +31 -2
- package/core/_core-theme.scss +6 -7
- package/core/_core.scss +17 -2
- package/core/index.d.ts +10 -3
- package/core/mdc-helpers/_mdc-helpers.scss +0 -184
- package/core/style/_sass-utils.scss +19 -0
- package/core/tokens/_token-utils.scss +56 -0
- package/core/tokens/m2/_index.scss +19 -5
- package/core/tokens/m2/mat/{_slide-toggle.scss → _app.scss} +12 -15
- package/core/tokens/m2/mat/_fab.scss +3 -0
- package/core/tokens/m2/mat/_filled-button.scss +3 -0
- package/core/tokens/m2/mat/_form-field.scss +50 -1
- package/core/tokens/m2/mat/_icon-button.scss +3 -0
- package/core/tokens/m2/mat/_outlined-button.scss +3 -0
- package/core/tokens/m2/mat/_protected-button.scss +3 -0
- package/core/tokens/m2/mat/_slider.scss +34 -8
- package/core/tokens/m2/mat/_tab-header.scss +6 -1
- package/core/tokens/m2/mat/_text-button.scss +3 -0
- package/core/tokens/m2/mdc/_extended-fab.scss +7 -6
- package/core/tokens/m2/mdc/_fab.scss +5 -5
- package/core/tokens/m2/mdc/_filled-button.scss +13 -12
- package/core/tokens/m2/mdc/_outlined-button.scss +7 -7
- package/core/tokens/m2/mdc/_protected-button.scss +14 -13
- package/core/tokens/m2/mdc/_text-button.scss +7 -12
- package/esm2022/autocomplete/autocomplete-origin.mjs +3 -3
- package/esm2022/autocomplete/autocomplete-trigger.mjs +7 -5
- package/esm2022/autocomplete/autocomplete.mjs +4 -5
- package/esm2022/autocomplete/module.mjs +4 -4
- package/esm2022/badge/badge-module.mjs +4 -4
- package/esm2022/badge/badge.mjs +3 -3
- package/esm2022/bottom-sheet/bottom-sheet-container.mjs +7 -8
- package/esm2022/bottom-sheet/bottom-sheet-module.mjs +4 -4
- package/esm2022/bottom-sheet/bottom-sheet.mjs +3 -3
- package/esm2022/button/button-base.mjs +46 -19
- package/esm2022/button/button.mjs +9 -9
- package/esm2022/button/fab.mjs +17 -17
- package/esm2022/button/icon-button.mjs +9 -9
- package/esm2022/button/module.mjs +4 -4
- package/esm2022/button/public-api.mjs +2 -1
- package/esm2022/button/testing/button-harness.mjs +4 -3
- package/esm2022/button-toggle/button-toggle-module.mjs +4 -4
- package/esm2022/button-toggle/button-toggle.mjs +6 -6
- package/esm2022/card/card.mjs +42 -42
- package/esm2022/card/module.mjs +4 -4
- package/esm2022/checkbox/checkbox-required-validator.mjs +3 -3
- package/esm2022/checkbox/checkbox.mjs +3 -3
- package/esm2022/checkbox/module.mjs +8 -8
- package/esm2022/chips/chip-action.mjs +3 -3
- package/esm2022/chips/chip-edit-input.mjs +3 -3
- package/esm2022/chips/chip-grid.mjs +3 -3
- package/esm2022/chips/chip-icons.mjs +9 -9
- package/esm2022/chips/chip-input.mjs +3 -3
- package/esm2022/chips/chip-listbox.mjs +4 -5
- package/esm2022/chips/chip-option.mjs +3 -3
- package/esm2022/chips/chip-row.mjs +3 -3
- package/esm2022/chips/chip-set.mjs +3 -3
- package/esm2022/chips/chip.mjs +5 -4
- package/esm2022/chips/module.mjs +4 -4
- package/esm2022/core/common-behaviors/common-module.mjs +4 -4
- package/esm2022/core/datetime/index.mjs +16 -11
- package/esm2022/core/datetime/native-date-adapter.mjs +3 -3
- package/esm2022/core/error/error-options.mjs +6 -6
- package/esm2022/core/internal-form-field/internal-form-field.mjs +3 -3
- package/esm2022/core/line/line.mjs +7 -7
- package/esm2022/core/option/index.mjs +4 -4
- package/esm2022/core/option/optgroup.mjs +3 -3
- package/esm2022/core/option/option.mjs +3 -3
- package/esm2022/core/private/ripple-loader.mjs +30 -12
- package/esm2022/core/ripple/index.mjs +4 -4
- package/esm2022/core/ripple/ripple-renderer.mjs +1 -1
- package/esm2022/core/ripple/ripple.mjs +3 -3
- package/esm2022/core/selection/pseudo-checkbox/pseudo-checkbox-module.mjs +4 -4
- package/esm2022/core/selection/pseudo-checkbox/pseudo-checkbox.mjs +3 -3
- package/esm2022/core/version.mjs +1 -1
- package/esm2022/datepicker/calendar-body.mjs +3 -3
- package/esm2022/datepicker/calendar.mjs +8 -8
- package/esm2022/datepicker/date-range-input-parts.mjs +9 -9
- package/esm2022/datepicker/date-range-input.mjs +3 -3
- package/esm2022/datepicker/date-range-picker.mjs +3 -3
- package/esm2022/datepicker/date-range-selection-strategy.mjs +3 -3
- package/esm2022/datepicker/date-selection-model.mjs +9 -9
- package/esm2022/datepicker/datepicker-actions.mjs +9 -9
- package/esm2022/datepicker/datepicker-base.mjs +6 -6
- package/esm2022/datepicker/datepicker-errors.mjs +4 -4
- package/esm2022/datepicker/datepicker-input-base.mjs +3 -3
- package/esm2022/datepicker/datepicker-input.mjs +3 -3
- package/esm2022/datepicker/datepicker-intl.mjs +3 -3
- package/esm2022/datepicker/datepicker-module.mjs +4 -4
- package/esm2022/datepicker/datepicker-toggle.mjs +6 -6
- package/esm2022/datepicker/datepicker.mjs +3 -3
- package/esm2022/datepicker/month-view.mjs +3 -3
- package/esm2022/datepicker/multi-year-view.mjs +3 -3
- package/esm2022/datepicker/year-view.mjs +3 -3
- package/esm2022/dialog/dialog-container.mjs +5 -5
- package/esm2022/dialog/dialog-content-directives.mjs +18 -21
- package/esm2022/dialog/dialog.mjs +3 -3
- package/esm2022/dialog/module.mjs +4 -4
- package/esm2022/divider/divider-module.mjs +4 -4
- package/esm2022/divider/divider.mjs +3 -3
- package/esm2022/expansion/accordion.mjs +4 -5
- package/esm2022/expansion/expansion-module.mjs +4 -4
- package/esm2022/expansion/expansion-panel-content.mjs +3 -3
- package/esm2022/expansion/expansion-panel-header.mjs +9 -9
- package/esm2022/expansion/expansion-panel.mjs +8 -8
- package/esm2022/form-field/directives/error.mjs +3 -3
- package/esm2022/form-field/directives/floating-label.mjs +3 -3
- package/esm2022/form-field/directives/hint.mjs +3 -3
- package/esm2022/form-field/directives/label.mjs +3 -3
- package/esm2022/form-field/directives/line-ripple.mjs +3 -3
- package/esm2022/form-field/directives/notched-outline.mjs +3 -3
- package/esm2022/form-field/directives/prefix.mjs +3 -3
- package/esm2022/form-field/directives/suffix.mjs +3 -3
- package/esm2022/form-field/form-field-control.mjs +3 -3
- package/esm2022/form-field/form-field.mjs +6 -6
- package/esm2022/form-field/module.mjs +4 -4
- package/esm2022/grid-list/grid-list-module.mjs +4 -4
- package/esm2022/grid-list/grid-list.mjs +3 -3
- package/esm2022/grid-list/grid-tile.mjs +15 -15
- package/esm2022/icon/icon-module.mjs +4 -4
- package/esm2022/icon/icon-registry.mjs +3 -3
- package/esm2022/icon/icon.mjs +3 -3
- package/esm2022/icon/testing/fake-icon-registry.mjs +7 -7
- package/esm2022/input/input.mjs +3 -3
- package/esm2022/input/module.mjs +4 -4
- package/esm2022/list/action-list.mjs +3 -3
- package/esm2022/list/list-base.mjs +6 -6
- package/esm2022/list/list-item-sections.mjs +18 -18
- package/esm2022/list/list-module.mjs +4 -4
- package/esm2022/list/list-option.mjs +6 -6
- package/esm2022/list/list.mjs +6 -6
- package/esm2022/list/nav-list.mjs +3 -3
- package/esm2022/list/selection-list.mjs +3 -3
- package/esm2022/list/subheader.mjs +3 -3
- package/esm2022/list/tokens.mjs +2 -2
- package/esm2022/menu/menu-content.mjs +3 -3
- package/esm2022/menu/menu-item.mjs +3 -3
- package/esm2022/menu/menu-trigger.mjs +3 -3
- package/esm2022/menu/menu.mjs +4 -5
- package/esm2022/menu/module.mjs +4 -4
- package/esm2022/paginator/module.mjs +4 -4
- package/esm2022/paginator/paginator-intl.mjs +3 -3
- package/esm2022/paginator/paginator.mjs +5 -5
- package/esm2022/progress-bar/module.mjs +4 -4
- package/esm2022/progress-bar/progress-bar.mjs +3 -3
- package/esm2022/progress-spinner/module.mjs +4 -4
- package/esm2022/progress-spinner/progress-spinner.mjs +3 -3
- package/esm2022/radio/module.mjs +4 -4
- package/esm2022/radio/radio.mjs +6 -6
- package/esm2022/select/module.mjs +4 -4
- package/esm2022/select/select.mjs +19 -19
- package/esm2022/sidenav/drawer.mjs +22 -18
- package/esm2022/sidenav/sidenav-module.mjs +4 -4
- package/esm2022/sidenav/sidenav.mjs +10 -13
- package/esm2022/slide-toggle/module.mjs +8 -8
- package/esm2022/slide-toggle/slide-toggle-required-validator.mjs +3 -3
- package/esm2022/slide-toggle/slide-toggle.mjs +7 -7
- package/esm2022/slider/module.mjs +4 -4
- package/esm2022/slider/slider-input.mjs +43 -26
- package/esm2022/slider/slider-interface.mjs +1 -1
- package/esm2022/slider/slider-thumb.mjs +12 -5
- package/esm2022/slider/slider.mjs +5 -6
- package/esm2022/snack-bar/module.mjs +4 -4
- package/esm2022/snack-bar/simple-snack-bar.mjs +3 -3
- package/esm2022/snack-bar/snack-bar-container.mjs +13 -12
- package/esm2022/snack-bar/snack-bar-content.mjs +9 -9
- package/esm2022/snack-bar/snack-bar.mjs +3 -3
- package/esm2022/sort/sort-header-intl.mjs +3 -3
- package/esm2022/sort/sort-header.mjs +3 -3
- package/esm2022/sort/sort-module.mjs +4 -4
- package/esm2022/sort/sort.mjs +3 -3
- package/esm2022/stepper/step-content.mjs +3 -3
- package/esm2022/stepper/step-header.mjs +3 -3
- package/esm2022/stepper/step-label.mjs +3 -3
- package/esm2022/stepper/stepper-button.mjs +7 -9
- package/esm2022/stepper/stepper-icon.mjs +3 -3
- package/esm2022/stepper/stepper-intl.mjs +3 -3
- package/esm2022/stepper/stepper-module.mjs +4 -4
- package/esm2022/stepper/stepper.mjs +16 -12
- package/esm2022/table/cell.mjs +21 -21
- package/esm2022/table/module.mjs +4 -4
- package/esm2022/table/row.mjs +21 -21
- package/esm2022/table/table.mjs +64 -31
- package/esm2022/table/text-column.mjs +3 -3
- package/esm2022/tabs/ink-bar.mjs +4 -4
- package/esm2022/tabs/module.mjs +4 -4
- package/esm2022/tabs/paginated-tab-header.mjs +13 -6
- package/esm2022/tabs/tab-body.mjs +6 -6
- package/esm2022/tabs/tab-content.mjs +3 -3
- package/esm2022/tabs/tab-group.mjs +20 -9
- package/esm2022/tabs/tab-header.mjs +6 -6
- package/esm2022/tabs/tab-label-wrapper.mjs +3 -3
- package/esm2022/tabs/tab-label.mjs +3 -3
- package/esm2022/tabs/tab-nav-bar/tab-nav-bar.mjs +12 -12
- package/esm2022/tabs/tab.mjs +9 -5
- package/esm2022/toolbar/toolbar-module.mjs +4 -4
- package/esm2022/toolbar/toolbar.mjs +7 -7
- package/esm2022/tooltip/module.mjs +4 -4
- package/esm2022/tooltip/tooltip.mjs +6 -6
- package/esm2022/tree/node.mjs +9 -9
- package/esm2022/tree/outlet.mjs +3 -3
- package/esm2022/tree/padding.mjs +3 -3
- package/esm2022/tree/toggle.mjs +3 -3
- package/esm2022/tree/tree-module.mjs +4 -4
- package/esm2022/tree/tree.mjs +3 -3
- package/expansion/index.d.ts +2 -2
- package/fesm2022/autocomplete.mjs +16 -15
- package/fesm2022/autocomplete.mjs.map +1 -1
- package/fesm2022/badge.mjs +7 -7
- package/fesm2022/bottom-sheet.mjs +12 -13
- package/fesm2022/bottom-sheet.mjs.map +1 -1
- package/fesm2022/button/testing.mjs +3 -2
- package/fesm2022/button/testing.mjs.map +1 -1
- package/fesm2022/button-toggle.mjs +10 -10
- package/fesm2022/button.mjs +82 -55
- package/fesm2022/button.mjs.map +1 -1
- package/fesm2022/card.mjs +46 -46
- package/fesm2022/checkbox.mjs +14 -14
- package/fesm2022/chips.mjs +41 -41
- package/fesm2022/chips.mjs.map +1 -1
- package/fesm2022/core.mjs +93 -70
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/datepicker.mjs +86 -86
- package/fesm2022/datepicker.mjs.map +1 -1
- package/fesm2022/dialog.mjs +28 -31
- package/fesm2022/dialog.mjs.map +1 -1
- package/fesm2022/divider.mjs +7 -7
- package/fesm2022/expansion.mjs +26 -27
- package/fesm2022/expansion.mjs.map +1 -1
- package/fesm2022/form-field.mjs +36 -36
- package/fesm2022/form-field.mjs.map +1 -1
- package/fesm2022/grid-list.mjs +22 -22
- package/fesm2022/icon/testing.mjs +7 -7
- package/fesm2022/icon.mjs +10 -10
- package/fesm2022/input.mjs +7 -7
- package/fesm2022/list.mjs +52 -52
- package/fesm2022/list.mjs.map +1 -1
- package/fesm2022/menu.mjs +16 -17
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/paginator.mjs +11 -11
- package/fesm2022/paginator.mjs.map +1 -1
- package/fesm2022/progress-bar.mjs +7 -7
- package/fesm2022/progress-spinner.mjs +7 -7
- package/fesm2022/radio.mjs +10 -10
- package/fesm2022/select.mjs +22 -22
- package/fesm2022/select.mjs.map +1 -1
- package/fesm2022/sidenav.mjs +34 -33
- package/fesm2022/sidenav.mjs.map +1 -1
- package/fesm2022/slide-toggle.mjs +17 -17
- package/fesm2022/slide-toggle.mjs.map +1 -1
- package/fesm2022/slider.mjs +60 -38
- package/fesm2022/slider.mjs.map +1 -1
- package/fesm2022/snack-bar.mjs +32 -30
- package/fesm2022/snack-bar.mjs.map +1 -1
- package/fesm2022/sort.mjs +13 -13
- package/fesm2022/stepper.mjs +40 -38
- package/fesm2022/stepper.mjs.map +1 -1
- package/fesm2022/table.mjs +111 -78
- package/fesm2022/table.mjs.map +1 -1
- package/fesm2022/tabs.mjs +76 -55
- package/fesm2022/tabs.mjs.map +1 -1
- package/fesm2022/toolbar.mjs +11 -11
- package/fesm2022/toolbar.mjs.map +1 -1
- package/fesm2022/tooltip.mjs +10 -10
- package/fesm2022/tree.mjs +25 -25
- package/form-field/_form-field-subscript.scss +1 -2
- package/form-field/_form-field-theme.scss +4 -2
- package/form-field/_mdc-text-field-density-overrides.scss +60 -0
- package/icon/_icon-theme.scss +24 -10
- package/list/index.d.ts +1 -1
- package/package.json +49 -49
- package/paginator/_paginator-theme.scss +5 -4
- package/prebuilt-themes/deeppurple-amber.css +1 -1
- package/prebuilt-themes/indigo-pink.css +1 -1
- package/prebuilt-themes/pink-bluegrey.css +1 -1
- package/prebuilt-themes/purple-green.css +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/schematics/ng-generate/address-form/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +3 -3
- package/schematics/ng-generate/dashboard/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html.template +1 -1
- package/schematics/ng-generate/dashboard/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +5 -3
- package/schematics/ng-generate/mdc-migration/index_bundled.js +1251 -633
- package/schematics/ng-generate/mdc-migration/index_bundled.js.map +4 -4
- package/schematics/ng-generate/mdc-migration/schema.json +0 -1
- package/schematics/ng-generate/navigation/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +3 -3
- package/schematics/ng-generate/table/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +3 -3
- package/schematics/ng-generate/tree/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +3 -3
- package/slide-toggle/_slide-toggle-theme.scss +16 -28
- package/slide-toggle/index.d.ts +2 -2
- package/slider/_slider-theme.scss +10 -12
- package/slider/index.d.ts +9 -12
- package/snack-bar/index.d.ts +2 -2
- package/stepper/index.d.ts +5 -3
- package/table/index.d.ts +2 -4
- package/tabs/_tabs-common.scss +20 -1
- package/tabs/index.d.ts +14 -7
- package/form-field/_form-field-density.scss +0 -118
- package/form-field/_form-field-sizing.scss +0 -40
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
// TODO(mmalerba): this file should be split into separate cohesive partials for things like
|
|
2
2
|
// "theming", "typography", "core".
|
|
3
|
-
@use '../theming/inspection';
|
|
4
3
|
@use '../typography/typography';
|
|
5
4
|
@use '@material/feature-targeting' as mdc-feature-targeting;
|
|
6
5
|
@use '@material/typography' as mdc-typography;
|
|
7
6
|
@use '@material/theme/theme-color' as mdc-theme-color;
|
|
8
7
|
@use '@material/theme/css' as mdc-theme-css;
|
|
9
|
-
@use 'sass:map';
|
|
10
8
|
@use 'sass:meta';
|
|
11
9
|
|
|
12
10
|
// A set of standard queries to use with MDC's queryable mixins.
|
|
@@ -16,71 +14,6 @@ $mdc-base-styles-without-animation-query:
|
|
|
16
14
|
$mdc-theme-styles-query: color;
|
|
17
15
|
$mdc-typography-styles-query: typography;
|
|
18
16
|
|
|
19
|
-
// Mappings from Angular Material's typography levels to MDC's typography levels.
|
|
20
|
-
$mat-typography-mdc-level-mappings: (
|
|
21
|
-
headline-1: headline1,
|
|
22
|
-
headline-2: headline2,
|
|
23
|
-
headline-3: headline3,
|
|
24
|
-
headline-4: headline4,
|
|
25
|
-
headline-5: headline5,
|
|
26
|
-
headline-6: headline6,
|
|
27
|
-
subtitle-1: subtitle1,
|
|
28
|
-
subtitle-2: subtitle2,
|
|
29
|
-
body-1: body1,
|
|
30
|
-
body-2: body2,
|
|
31
|
-
caption: caption,
|
|
32
|
-
button: button,
|
|
33
|
-
overline: overline
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
// Converts an Angular Material typography level config to an MDC one.
|
|
37
|
-
@function typography-level-config-to-mdc($theme, $mat-level) {
|
|
38
|
-
$mdc-level: map.get($mat-typography-mdc-level-mappings, $mat-level);
|
|
39
|
-
|
|
40
|
-
$result-with-nulls: map.merge(
|
|
41
|
-
if($mdc-level,
|
|
42
|
-
map.get(mdc-typography.$styles, $mdc-level),
|
|
43
|
-
(
|
|
44
|
-
text-decoration: none,
|
|
45
|
-
-moz-osx-font-smoothing: grayscale,
|
|
46
|
-
-webkit-font-smoothing: antialiased
|
|
47
|
-
)),
|
|
48
|
-
if($mat-level,
|
|
49
|
-
(
|
|
50
|
-
font-size: inspection.get-theme-typography($theme, $mat-level, font-size),
|
|
51
|
-
line-height: inspection.get-theme-typography($theme, $mat-level, line-height),
|
|
52
|
-
font-weight: inspection.get-theme-typography($theme, $mat-level, font-weight),
|
|
53
|
-
letter-spacing: inspection.get-theme-typography($theme, $mat-level, letter-spacing),
|
|
54
|
-
font-family: inspection.get-theme-typography($theme, $mat-level, font-family),
|
|
55
|
-
// Angular Material doesn't use text-transform, so disable it.
|
|
56
|
-
text-transform: none,
|
|
57
|
-
),
|
|
58
|
-
()));
|
|
59
|
-
|
|
60
|
-
// We need to strip out any keys with a null value. Leaving them in will cause MDC to emit CSS
|
|
61
|
-
// variables with no fallback value, which breaks some builds.
|
|
62
|
-
$result: ();
|
|
63
|
-
@each $property, $value in $result-with-nulls {
|
|
64
|
-
@if $value != null {
|
|
65
|
-
$result: map.merge($result, ($property: $value));
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
@return $result;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Converts an Angular Material typography config to an MDC one.
|
|
72
|
-
@function typography-config-to-mdc($theme) {
|
|
73
|
-
$mdc-config: ();
|
|
74
|
-
|
|
75
|
-
@each $mat-level, $mdc-level in $mat-typography-mdc-level-mappings {
|
|
76
|
-
$mdc-config: map.merge(
|
|
77
|
-
$mdc-config,
|
|
78
|
-
($mdc-level: typography-level-config-to-mdc($theme, $mat-level)));
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
@return $mdc-config;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
17
|
// MDC logs a warning if the `contrast-tone` function is called with a CSS variable.
|
|
85
18
|
// This function falls back to determining the tone based on whether the theme is light or dark.
|
|
86
19
|
@function variable-safe-contrast-tone($value, $is-dark) {
|
|
@@ -91,123 +24,6 @@ $mat-typography-mdc-level-mappings: (
|
|
|
91
24
|
@return if($is-dark, 'light', 'dark');
|
|
92
25
|
}
|
|
93
26
|
|
|
94
|
-
@function _variable-safe-ink-color-for-fill($text-style, $fill-color, $is-dark) {
|
|
95
|
-
$contrast-tone: variable-safe-contrast-tone($fill-color, $is-dark);
|
|
96
|
-
@return map.get(map.get(mdc-theme-color.$text-colors, $contrast-tone), $text-style);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// Configures MDC's global variables to reflect the given theme, applies the given styles,
|
|
100
|
-
// then resets the global variables to prevent unintended side effects.
|
|
101
|
-
@mixin using-mdc-theme($theme) {
|
|
102
|
-
$primary: inspection.get-theme-color($theme, primary);
|
|
103
|
-
$accent: inspection.get-theme-color($theme, accent);
|
|
104
|
-
$warn: inspection.get-theme-color($theme, warn);
|
|
105
|
-
$is-dark: inspection.get-theme-type($theme) == dark;
|
|
106
|
-
|
|
107
|
-
// Save the original values.
|
|
108
|
-
$orig-primary: mdc-theme-color.$primary;
|
|
109
|
-
$orig-on-primary: mdc-theme-color.$on-primary;
|
|
110
|
-
$orig-secondary: mdc-theme-color.$secondary;
|
|
111
|
-
$orig-on-secondary: mdc-theme-color.$on-secondary;
|
|
112
|
-
$orig-background: mdc-theme-color.$background;
|
|
113
|
-
$orig-surface: mdc-theme-color.$surface;
|
|
114
|
-
$orig-on-surface: mdc-theme-color.$on-surface;
|
|
115
|
-
$orig-error: mdc-theme-color.$error;
|
|
116
|
-
$orig-on-error: mdc-theme-color.$on-error;
|
|
117
|
-
$orig-property-values: mdc-theme-color.$property-values;
|
|
118
|
-
|
|
119
|
-
// Set new values based on the given Angular Material theme.
|
|
120
|
-
mdc-theme-color.$primary: $primary;
|
|
121
|
-
mdc-theme-color.$on-primary:
|
|
122
|
-
if(variable-safe-contrast-tone(mdc-theme-color.$primary, $is-dark) == 'dark', #000, #fff);
|
|
123
|
-
mdc-theme-color.$secondary: $accent;
|
|
124
|
-
mdc-theme-color.$on-secondary:
|
|
125
|
-
if(variable-safe-contrast-tone(mdc-theme-color.$secondary, $is-dark) == 'dark', #000, #fff);
|
|
126
|
-
mdc-theme-color.$background: inspection.get-theme-color($theme, background, background);
|
|
127
|
-
mdc-theme-color.$surface: inspection.get-theme-color($theme, background, card);
|
|
128
|
-
mdc-theme-color.$on-surface:
|
|
129
|
-
if(variable-safe-contrast-tone(mdc-theme-color.$surface, $is-dark) == 'dark', #000, #fff);
|
|
130
|
-
mdc-theme-color.$error: $warn;
|
|
131
|
-
mdc-theme-color.$on-error:
|
|
132
|
-
if(variable-safe-contrast-tone(mdc-theme-color.$error, $is-dark) == 'dark', #000, #fff);
|
|
133
|
-
mdc-theme-color.$property-values: (
|
|
134
|
-
// Primary
|
|
135
|
-
primary: mdc-theme-color.$primary,
|
|
136
|
-
// Secondary
|
|
137
|
-
secondary: mdc-theme-color.$secondary,
|
|
138
|
-
// Background
|
|
139
|
-
background: mdc-theme-color.$background,
|
|
140
|
-
// Surface
|
|
141
|
-
surface: mdc-theme-color.$surface,
|
|
142
|
-
// Error
|
|
143
|
-
error: mdc-theme-color.$error,
|
|
144
|
-
on-primary: mdc-theme-color.$on-primary,
|
|
145
|
-
on-secondary: mdc-theme-color.$on-secondary,
|
|
146
|
-
on-surface: mdc-theme-color.$on-surface,
|
|
147
|
-
on-error: mdc-theme-color.$on-error,
|
|
148
|
-
// Text-primary on "background" background
|
|
149
|
-
text-primary-on-background:
|
|
150
|
-
_variable-safe-ink-color-for-fill(primary, mdc-theme-color.$background, $is-dark),
|
|
151
|
-
text-secondary-on-background:
|
|
152
|
-
_variable-safe-ink-color-for-fill(secondary, mdc-theme-color.$background, $is-dark),
|
|
153
|
-
text-hint-on-background:
|
|
154
|
-
_variable-safe-ink-color-for-fill(hint, mdc-theme-color.$background, $is-dark),
|
|
155
|
-
text-disabled-on-background:
|
|
156
|
-
_variable-safe-ink-color-for-fill(disabled, mdc-theme-color.$background, $is-dark),
|
|
157
|
-
text-icon-on-background:
|
|
158
|
-
_variable-safe-ink-color-for-fill(icon, mdc-theme-color.$background, $is-dark),
|
|
159
|
-
// Text-primary on "light" background
|
|
160
|
-
text-primary-on-light: _variable-safe-ink-color-for-fill(primary, light, $is-dark),
|
|
161
|
-
text-secondary-on-light: _variable-safe-ink-color-for-fill(secondary, light, $is-dark),
|
|
162
|
-
text-hint-on-light: _variable-safe-ink-color-for-fill(hint, light, $is-dark),
|
|
163
|
-
text-disabled-on-light: _variable-safe-ink-color-for-fill(disabled, light, $is-dark),
|
|
164
|
-
text-icon-on-light: _variable-safe-ink-color-for-fill(icon, light, $is-dark),
|
|
165
|
-
// Text-primary on "dark" background
|
|
166
|
-
text-primary-on-dark: _variable-safe-ink-color-for-fill(primary, dark, $is-dark),
|
|
167
|
-
text-secondary-on-dark: _variable-safe-ink-color-for-fill(secondary, dark, $is-dark),
|
|
168
|
-
text-hint-on-dark: _variable-safe-ink-color-for-fill(hint, dark, $is-dark),
|
|
169
|
-
text-disabled-on-dark: _variable-safe-ink-color-for-fill(disabled, dark, $is-dark),
|
|
170
|
-
text-icon-on-dark: _variable-safe-ink-color-for-fill(icon, dark, $is-dark)
|
|
171
|
-
);
|
|
172
|
-
|
|
173
|
-
// Apply given rules.
|
|
174
|
-
@include disable-mdc-fallback-declarations {
|
|
175
|
-
@content;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
// Reset the original values.
|
|
179
|
-
mdc-theme-color.$primary: $orig-primary;
|
|
180
|
-
mdc-theme-color.$on-primary: $orig-on-primary;
|
|
181
|
-
mdc-theme-color.$secondary: $orig-secondary;
|
|
182
|
-
mdc-theme-color.$on-secondary: $orig-on-secondary;
|
|
183
|
-
mdc-theme-color.$background: $orig-background;
|
|
184
|
-
mdc-theme-color.$surface: $orig-surface;
|
|
185
|
-
mdc-theme-color.$on-surface: $orig-on-surface;
|
|
186
|
-
mdc-theme-color.$error: $orig-error;
|
|
187
|
-
mdc-theme-color.$on-error: $orig-on-error;
|
|
188
|
-
mdc-theme-color.$property-values: $orig-property-values;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
// Configures MDC's global variables to reflect the given typography config,
|
|
192
|
-
// applies the given styles, then resets the global variables to prevent unintended side effects.
|
|
193
|
-
@mixin using-mdc-typography($theme) {
|
|
194
|
-
// Save the original values.
|
|
195
|
-
$orig-mdc-typography-styles: mdc-typography.$styles;
|
|
196
|
-
|
|
197
|
-
// Set new values based on the given Angular Material typography configuration.
|
|
198
|
-
@if inspection.theme-has($theme, typography) {
|
|
199
|
-
mdc-typography.$styles: typography-config-to-mdc($theme);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
// Apply given rules.
|
|
203
|
-
@include disable-mdc-fallback-declarations {
|
|
204
|
-
@content;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
// Reset the original values.
|
|
208
|
-
mdc-typography.$styles: $orig-mdc-typography-styles;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
27
|
// Function to create an Angular Material typography config from MDC's predefined typography levels.
|
|
212
28
|
// This is used for components where we accidentally ended up supporting null typography configs
|
|
213
29
|
// that were silently falling back to MDC's typography. At the moment of writing this includes
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@use 'sass:color';
|
|
2
|
+
@use 'sass:list';
|
|
2
3
|
@use 'sass:map';
|
|
3
4
|
@use 'sass:meta';
|
|
4
5
|
|
|
@@ -59,3 +60,21 @@
|
|
|
59
60
|
$args: meta.keywords($args);
|
|
60
61
|
@return if(meta.type-of($color) == 'color', color.change($color, $args...), $color);
|
|
61
62
|
}
|
|
63
|
+
|
|
64
|
+
/// Gets the given arguments as a map of keywords and validates that only supported arguments were
|
|
65
|
+
/// passed.
|
|
66
|
+
/// @param {ArgList} $args The arguments to convert to a keywords map.
|
|
67
|
+
/// @param {List} $supported-args The supported argument names.
|
|
68
|
+
/// @return {Map} The $args as a map of argument name to argument value.
|
|
69
|
+
@function validate-keyword-args($args, $supported-args) {
|
|
70
|
+
@if list.length($args) > 0 {
|
|
71
|
+
@error #{'Expected keyword args, but got positional args: '}#{$args};
|
|
72
|
+
}
|
|
73
|
+
$kwargs: meta.keywords($args);
|
|
74
|
+
@each $arg, $v in $kwargs {
|
|
75
|
+
@if list.index($supported-args, $arg) == null {
|
|
76
|
+
@error #{'Unsupported argument '}#{$arg}#{'. Valid arguments are: '}#{$supported-args};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
@return $kwargs;
|
|
80
|
+
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
@use 'sass:list';
|
|
1
2
|
@use 'sass:map';
|
|
2
3
|
@use '@material/elevation/elevation-theme' as mdc-elevation-theme;
|
|
3
4
|
@use '@material/theme/custom-properties' as mdc-custom-properties;
|
|
4
5
|
@use '@material/theme/theme' as mdc-theme;
|
|
5
6
|
@use '@material/theme/keys' as mdc-keys;
|
|
7
|
+
@use '../style/sass-utils';
|
|
6
8
|
@use '../theming/palette';
|
|
7
9
|
@use '../theming/theming';
|
|
8
10
|
@use '../typography/typography';
|
|
@@ -125,3 +127,57 @@ $_component-prefix: null;
|
|
|
125
127
|
$shadow-color-token: null,
|
|
126
128
|
));
|
|
127
129
|
}
|
|
130
|
+
|
|
131
|
+
/// Checks whether a list starts wih a given prefix
|
|
132
|
+
/// @param {List} $list The list value to check the prefix of.
|
|
133
|
+
/// @param {List} $prefix The prefix to check.
|
|
134
|
+
/// @return {Boolean} Whether the list starts with the prefix.
|
|
135
|
+
@function _is-prefix($list, $prefix) {
|
|
136
|
+
@for $i from 1 through list.length($prefix) {
|
|
137
|
+
@if list.nth($list, $i) != list.nth($prefix, $i) {
|
|
138
|
+
@return false;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
@return true;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/// Gets the supported color variants in the given token set for the given prefix.
|
|
145
|
+
/// @param {Map} $tokens The full token map.
|
|
146
|
+
/// @param {List} $prefix The component prefix to get color variants for.
|
|
147
|
+
/// @return {List} The supported color variants.
|
|
148
|
+
@function _supported-color-variants($tokens, $prefix) {
|
|
149
|
+
$result: ();
|
|
150
|
+
@each $namespace in map.keys($tokens) {
|
|
151
|
+
@if list.length($prefix) == list.length($namespace) - 1 and _is-prefix($namespace, $prefix) {
|
|
152
|
+
$result: list.append($result, list.nth($namespace, list.length($namespace)), comma);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
@return $result;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/// Gets the token values for the given components prefix with the given options.
|
|
159
|
+
/// @param {Map} $tokens The full token map.
|
|
160
|
+
/// @param {List} $prefix The component prefix to get the token values for.
|
|
161
|
+
/// @param {ArgList} Any additional options
|
|
162
|
+
/// Currently the additional supported options are:
|
|
163
|
+
// - $color-variant (The color variant to use for the component)
|
|
164
|
+
/// @throws If given options are invalid
|
|
165
|
+
/// @return {Map} The token values for the requested component.
|
|
166
|
+
@function get-tokens-for($tokens, $prefix, $options...) {
|
|
167
|
+
$options: sass-utils.validate-keyword-args($options, (color-variant));
|
|
168
|
+
@if $tokens == () {
|
|
169
|
+
@return ();
|
|
170
|
+
}
|
|
171
|
+
$values: map.get($tokens, $prefix);
|
|
172
|
+
$color-variant: map.get($options, color-variant);
|
|
173
|
+
@if $color-variant == null {
|
|
174
|
+
@return $values;
|
|
175
|
+
}
|
|
176
|
+
$overrides: map.get($tokens, list.append($prefix, $color-variant));
|
|
177
|
+
@if $overrides == null {
|
|
178
|
+
@error #{'Invalid color variant: '}#{$color-variant}#{'. Supported color variants are: '}#{
|
|
179
|
+
_supported-color-variants($tokens, $prefix)
|
|
180
|
+
}#{'.'};
|
|
181
|
+
}
|
|
182
|
+
@return map.merge($values, $overrides);
|
|
183
|
+
}
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
@use '../../style/sass-utils';
|
|
4
4
|
@use './mat/autocomplete' as tokens-mat-autocomplete;
|
|
5
5
|
@use './mat/badge' as tokens-mat-badge;
|
|
6
|
+
@use './mat/text-button' as tokens-mat-text-button;
|
|
7
|
+
@use './mat/protected-button' as tokens-mat-protected-button;
|
|
8
|
+
@use './mat/filled-button' as tokens-mat-filled-button;
|
|
9
|
+
@use './mat/outlined-button' as tokens-mat-outlined-button;
|
|
6
10
|
@use './mat/bottom-sheet' as tokens-mat-bottom-sheet;
|
|
7
11
|
@use './mat/card' as tokens-mat-card;
|
|
8
12
|
@use './mat/datepicker' as tokens-mat-datepicker;
|
|
@@ -21,7 +25,6 @@
|
|
|
21
25
|
@use './mat/ripple' as tokens-mat-ripple;
|
|
22
26
|
@use './mat/select' as tokens-mat-select;
|
|
23
27
|
@use './mat/sidenav' as tokens-mat-sidenav;
|
|
24
|
-
@use './mat/slide-toggle' as tokens-mat-slide-toggle;
|
|
25
28
|
@use './mat/slider' as tokens-mat-slider;
|
|
26
29
|
@use './mat/snack-bar' as tokens-mat-snack-bar;
|
|
27
30
|
@use './mat/sort' as tokens-mat-sort;
|
|
@@ -33,6 +36,10 @@
|
|
|
33
36
|
@use './mat/toolbar' as tokens-mat-toolbar;
|
|
34
37
|
@use './mat/tree' as tokens-mat-tree;
|
|
35
38
|
@use './mdc/checkbox' as tokens-mdc-checkbox;
|
|
39
|
+
@use './mdc/text-button' as tokens-mdc-text-button;
|
|
40
|
+
@use './mdc/protected-button' as tokens-mdc-protected-button;
|
|
41
|
+
@use './mdc/filled-button' as tokens-mdc-filled-button;
|
|
42
|
+
@use './mdc/outlined-button' as tokens-mdc-outlined-button;
|
|
36
43
|
@use './mdc/chip' as tokens-mdc-chip;
|
|
37
44
|
@use './mdc/circular-progress' as tokens-mdc-circular-progress;
|
|
38
45
|
@use './mdc/dialog' as tokens-mdc-dialog;
|
|
@@ -105,26 +112,29 @@
|
|
|
105
112
|
_get-tokens-for-module($theme, tokens-mat-divider),
|
|
106
113
|
_get-tokens-for-module($theme, tokens-mat-expansion),
|
|
107
114
|
_get-tokens-for-module($theme, tokens-mat-fab),
|
|
115
|
+
_get-tokens-for-module($theme, tokens-mat-filled-button),
|
|
108
116
|
_get-tokens-for-module($theme, tokens-mat-form-field),
|
|
109
117
|
_get-tokens-for-module($theme, tokens-mat-grid-list),
|
|
110
|
-
_get-tokens-for-module($theme, tokens-mat-icon),
|
|
111
118
|
_get-tokens-for-module($theme, tokens-mat-icon-button),
|
|
119
|
+
_get-tokens-for-module($theme, tokens-mat-icon),
|
|
112
120
|
_get-tokens-for-module($theme, tokens-mat-menu),
|
|
113
121
|
_get-tokens-for-module($theme, tokens-mat-optgroup),
|
|
114
122
|
_get-tokens-for-module($theme, tokens-mat-option),
|
|
123
|
+
_get-tokens-for-module($theme, tokens-mat-outlined-button),
|
|
115
124
|
_get-tokens-for-module($theme, tokens-mat-paginator),
|
|
125
|
+
_get-tokens-for-module($theme, tokens-mat-protected-button),
|
|
116
126
|
_get-tokens-for-module($theme, tokens-mat-radio),
|
|
117
127
|
_get-tokens-for-module($theme, tokens-mat-ripple),
|
|
118
128
|
_get-tokens-for-module($theme, tokens-mat-select),
|
|
119
129
|
_get-tokens-for-module($theme, tokens-mat-sidenav),
|
|
120
|
-
_get-tokens-for-module($theme, tokens-mat-slide-toggle),
|
|
121
130
|
_get-tokens-for-module($theme, tokens-mat-slider),
|
|
122
131
|
_get-tokens-for-module($theme, tokens-mat-snack-bar),
|
|
123
132
|
_get-tokens-for-module($theme, tokens-mat-sort),
|
|
124
133
|
_get-tokens-for-module($theme, tokens-mat-stepper),
|
|
125
|
-
_get-tokens-for-module($theme, tokens-mat-tab-header),
|
|
126
134
|
_get-tokens-for-module($theme, tokens-mat-tab-header-with-background),
|
|
135
|
+
_get-tokens-for-module($theme, tokens-mat-tab-header),
|
|
127
136
|
_get-tokens-for-module($theme, tokens-mat-table),
|
|
137
|
+
_get-tokens-for-module($theme, tokens-mat-text-button),
|
|
128
138
|
_get-tokens-for-module($theme, tokens-mat-toolbar),
|
|
129
139
|
_get-tokens-for-module($theme, tokens-mat-tree),
|
|
130
140
|
_get-tokens-for-module($theme, tokens-mdc-checkbox),
|
|
@@ -134,18 +144,22 @@
|
|
|
134
144
|
_get-tokens-for-module($theme, tokens-mdc-elevated-card),
|
|
135
145
|
_get-tokens-for-module($theme, tokens-mdc-extended-fab),
|
|
136
146
|
_get-tokens-for-module($theme, tokens-mdc-fab),
|
|
147
|
+
_get-tokens-for-module($theme, tokens-mdc-filled-button),
|
|
137
148
|
_get-tokens-for-module($theme, tokens-mdc-filled-text-field),
|
|
138
149
|
_get-tokens-for-module($theme, tokens-mdc-icon-button),
|
|
139
150
|
_get-tokens-for-module($theme, tokens-mdc-linear-progress),
|
|
140
151
|
_get-tokens-for-module($theme, tokens-mdc-list),
|
|
152
|
+
_get-tokens-for-module($theme, tokens-mdc-outlined-button),
|
|
141
153
|
_get-tokens-for-module($theme, tokens-mdc-outlined-card),
|
|
142
154
|
_get-tokens-for-module($theme, tokens-mdc-outlined-text-field),
|
|
143
155
|
_get-tokens-for-module($theme, tokens-mdc-plain-tooltip),
|
|
156
|
+
_get-tokens-for-module($theme, tokens-mdc-protected-button),
|
|
144
157
|
_get-tokens-for-module($theme, tokens-mdc-radio),
|
|
145
158
|
_get-tokens-for-module($theme, tokens-mdc-slider),
|
|
146
159
|
_get-tokens-for-module($theme, tokens-mdc-snack-bar),
|
|
147
160
|
_get-tokens-for-module($theme, tokens-mdc-switch),
|
|
148
|
-
_get-tokens-for-module($theme, tokens-mdc-tab),
|
|
149
161
|
_get-tokens-for-module($theme, tokens-mdc-tab-indicator),
|
|
162
|
+
_get-tokens-for-module($theme, tokens-mdc-tab),
|
|
163
|
+
_get-tokens-for-module($theme, tokens-mdc-text-button),
|
|
150
164
|
);
|
|
151
165
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
@use '../../token-utils';
|
|
2
|
-
@use '../../../style/sass-utils';
|
|
3
2
|
@use '../../../theming/inspection';
|
|
3
|
+
@use '../../../style/sass-utils';
|
|
4
4
|
|
|
5
5
|
// The prefix used to generate the fully qualified name for tokens in this file.
|
|
6
|
-
$prefix: (mat,
|
|
6
|
+
$prefix: (mat, app);
|
|
7
7
|
|
|
8
8
|
// Tokens that can't be configured through Angular Material's current theming API,
|
|
9
9
|
// but may be in a future version of the theming API.
|
|
@@ -13,19 +13,16 @@ $prefix: (mat, slide-toggle);
|
|
|
13
13
|
|
|
14
14
|
// Tokens that can be configured through Angular Material's color theming API.
|
|
15
15
|
@function get-color-tokens($theme) {
|
|
16
|
-
@return (
|
|
16
|
+
@return (
|
|
17
|
+
background-color: inspection.get-theme-color($theme, background, background),
|
|
18
|
+
text-color: inspection.get-theme-color($theme, foreground, text),
|
|
19
|
+
);
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
// Tokens that can be configured through Angular Material's typography theming API.
|
|
20
23
|
@function get-typography-tokens($theme) {
|
|
21
|
-
@return (
|
|
22
|
-
|
|
23
|
-
label-text-size: inspection.get-theme-typography($theme, body-2, font-size),
|
|
24
|
-
label-text-tracking: inspection.get-theme-typography($theme, body-2, letter-spacing),
|
|
25
|
-
label-text-line-height: inspection.get-theme-typography($theme, body-2, line-height),
|
|
26
|
-
label-text-weight: inspection.get-theme-typography($theme, body-2, font-weight),
|
|
27
|
-
);
|
|
28
|
-
}
|
|
24
|
+
@return ();
|
|
25
|
+
}
|
|
29
26
|
|
|
30
27
|
// Tokens that can be configured through Angular Material's density theming API.
|
|
31
28
|
@function get-density-tokens($theme) {
|
|
@@ -36,9 +33,9 @@ $prefix: (mat, slide-toggle);
|
|
|
36
33
|
// This is used to create token slots.
|
|
37
34
|
@function get-token-slots() {
|
|
38
35
|
@return sass-utils.deep-merge-all(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
get-unthemable-tokens(),
|
|
37
|
+
get-color-tokens(token-utils.$placeholder-color-config),
|
|
38
|
+
get-typography-tokens(token-utils.$placeholder-typography-config),
|
|
39
|
+
get-density-tokens(token-utils.$placeholder-density-config)
|
|
43
40
|
);
|
|
44
41
|
}
|
|
@@ -30,6 +30,9 @@ $prefix: (mat, fab);
|
|
|
30
30
|
// Color of the element that shows the hover, focus and pressed states.
|
|
31
31
|
state-layer-color: $on-surface,
|
|
32
32
|
|
|
33
|
+
// Color of the element that shows the hover, focus and pressed states while disabled.
|
|
34
|
+
disabled-state-layer-color: $on-surface,
|
|
35
|
+
|
|
33
36
|
// Color of the ripple element.
|
|
34
37
|
ripple-color: rgba($on-surface, 0.1),
|
|
35
38
|
|
|
@@ -27,6 +27,9 @@ $prefix: (mat, filled-button);
|
|
|
27
27
|
// Color of the element that shows the hover, focus and pressed states.
|
|
28
28
|
state-layer-color: $on-surface,
|
|
29
29
|
|
|
30
|
+
// Color of the element that shows the hover, focus and pressed states while disabled.
|
|
31
|
+
disabled-state-layer-color: $on-surface,
|
|
32
|
+
|
|
30
33
|
// Color of the ripple element.
|
|
31
34
|
ripple-color: rgba($on-surface, 0.1),
|
|
32
35
|
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
1
2
|
@use 'sass:map';
|
|
3
|
+
@use '@material/textfield' as mdc-textfield;
|
|
4
|
+
@use '@material/density' as mdc-density;
|
|
2
5
|
@use '../../token-utils';
|
|
3
6
|
@use '../../../style/sass-utils';
|
|
7
|
+
@use '../../../theming/theming';
|
|
4
8
|
@use '../../../theming/inspection';
|
|
5
9
|
@use '../../../theming/palette';
|
|
6
10
|
|
|
@@ -86,7 +90,52 @@ $prefix: (mat, form-field);
|
|
|
86
90
|
|
|
87
91
|
// Tokens that can be configured through Angular Material's density theming API.
|
|
88
92
|
@function get-density-tokens($theme) {
|
|
89
|
-
|
|
93
|
+
$density-scale: theming.clamp-density(inspection.get-theme-density($theme), -4);
|
|
94
|
+
$height: mdc-density.prop-value(
|
|
95
|
+
$density-config: mdc-textfield.$density-config,
|
|
96
|
+
$density-scale: inspection.get-theme-density($theme),
|
|
97
|
+
$property-name: height,
|
|
98
|
+
);
|
|
99
|
+
$hide-label: $height < mdc-textfield.$minimum-height-for-filled-label;
|
|
100
|
+
|
|
101
|
+
// We computed the desired height of the form-field using the density configuration. The
|
|
102
|
+
// spec only describes vertical spacing/alignment in non-dense mode. This means that we
|
|
103
|
+
// cannot update the spacing to explicit numbers based on the density scale. Instead, we
|
|
104
|
+
// determine the height reduction and equally subtract it from the default `top` and `bottom`
|
|
105
|
+
// padding that is provided by the Material Design specification.
|
|
106
|
+
$vertical-deduction: math.div(mdc-textfield.$height - $height, 2);
|
|
107
|
+
|
|
108
|
+
// Note: these calculations are trivial enough that we could do them at runtime with `calc`
|
|
109
|
+
// and the value of the `height` token. The problem is that because we need to hide the label
|
|
110
|
+
// if the container becomes too short, we have to change the padding calculation. This is
|
|
111
|
+
// complicated further by the fact that filled form fields without labels have the same
|
|
112
|
+
// vertical padding as outlined ones. Alternatives:
|
|
113
|
+
// 1. Using container queries to hide the label and change the padding - this doesn't work
|
|
114
|
+
// because size container queries require setting the `container-type` property which breaks
|
|
115
|
+
// the form field layout. We could use style queries, but they're only supported in Chrome.
|
|
116
|
+
// 2. Monitoring the size of the label - we already have a `ResizeObserver` on the label so we
|
|
117
|
+
// could reuse it to also check when it becomes `display: none`. This would allows us to remove
|
|
118
|
+
// the three padding tokens. We don't do it, because it would require us to always set up
|
|
119
|
+
// the resize observer, as opposed to currently where it's only set up for outlined form fields.
|
|
120
|
+
// This may lead to performance regressions.
|
|
121
|
+
// 3. Conditionally adding `::before` and `::after` to the infix with positive and negative
|
|
122
|
+
// margin respectively - this works, but is likely to break a lot of overrides that are targeting
|
|
123
|
+
// a specific padding. It also runs the risk of overflowing the container.
|
|
124
|
+
// TODO: switch the padding tokens to style-based container queries
|
|
125
|
+
// when they become available in all the browsers we support.
|
|
126
|
+
$filled-with-label-padding-top: 24px - $vertical-deduction;
|
|
127
|
+
$filled-with-label-padding-bottom: 8px - $vertical-deduction;
|
|
128
|
+
$vertical-padding: 16px - $vertical-deduction;
|
|
129
|
+
|
|
130
|
+
@return (
|
|
131
|
+
container-height: $height,
|
|
132
|
+
filled-label-display: if($hide-label, none, block),
|
|
133
|
+
container-vertical-padding: $vertical-padding,
|
|
134
|
+
filled-with-label-container-padding-top:
|
|
135
|
+
if($hide-label, $vertical-padding, $filled-with-label-padding-top),
|
|
136
|
+
filled-with-label-container-padding-bottom:
|
|
137
|
+
if($hide-label, $vertical-padding, $filled-with-label-padding-bottom),
|
|
138
|
+
);
|
|
90
139
|
}
|
|
91
140
|
|
|
92
141
|
// Combines the tokens generated by the above functions into a single map with placeholder values.
|
|
@@ -27,6 +27,9 @@ $prefix: (mat, icon-button);
|
|
|
27
27
|
// Color of the element that shows the hover, focus and pressed states.
|
|
28
28
|
state-layer-color: $on-surface,
|
|
29
29
|
|
|
30
|
+
// Color of the element that shows the hover, focus and pressed states while disabled.
|
|
31
|
+
disabled-state-layer-color: $on-surface,
|
|
32
|
+
|
|
30
33
|
// Color of the ripple element.
|
|
31
34
|
ripple-color: rgba($on-surface, 0.1),
|
|
32
35
|
|
|
@@ -27,6 +27,9 @@ $prefix: (mat, outlined-button);
|
|
|
27
27
|
// Color of the element that shows the hover, focus and pressed states.
|
|
28
28
|
state-layer-color: $on-surface,
|
|
29
29
|
|
|
30
|
+
// Color of the element that shows the hover, focus and pressed states while disabled.
|
|
31
|
+
disabled-state-layer-color: $on-surface,
|
|
32
|
+
|
|
30
33
|
// Color of the ripple element.
|
|
31
34
|
ripple-color: rgba($on-surface, 0.1),
|
|
32
35
|
|
|
@@ -27,6 +27,9 @@ $prefix: (mat, protected-button);
|
|
|
27
27
|
// Color of the element that shows the hover, focus and pressed states.
|
|
28
28
|
state-layer-color: $on-surface,
|
|
29
29
|
|
|
30
|
+
// Color of the element that shows the hover, focus and pressed states while disabled.
|
|
31
|
+
disabled-state-layer-color: $on-surface,
|
|
32
|
+
|
|
30
33
|
// Color of the ripple element.
|
|
31
34
|
ripple-color: rgba($on-surface, 0.1),
|
|
32
35
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
1
2
|
@use '../../token-utils';
|
|
2
3
|
@use '../../../style/sass-utils';
|
|
3
4
|
@use '../../../theming/inspection';
|
|
@@ -8,23 +9,48 @@ $prefix: (mat, slider);
|
|
|
8
9
|
// Tokens that can't be configured through Angular Material's current theming API,
|
|
9
10
|
// but may be in a future version of the theming API.
|
|
10
11
|
@function get-unthemable-tokens() {
|
|
11
|
-
@return (
|
|
12
|
+
@return (
|
|
13
|
+
value-indicator-width: auto,
|
|
14
|
+
value-indicator-height: 32px,
|
|
15
|
+
value-indicator-caret-display: block,
|
|
16
|
+
value-indicator-border-radius: 4px,
|
|
17
|
+
value-indicator-padding: 0 12px,
|
|
18
|
+
value-indicator-text-transform: none,
|
|
19
|
+
value-indicator-container-transform: translateX(-50%)
|
|
20
|
+
);
|
|
12
21
|
}
|
|
13
22
|
|
|
14
23
|
// Tokens that can be configured through Angular Material's color theming API.
|
|
15
24
|
@function get-color-tokens($theme) {
|
|
25
|
+
$theme-color-tokens: private-get-color-palette-color-tokens($theme, primary);
|
|
16
26
|
$is-dark: inspection.get-theme-type($theme) == dark;
|
|
17
27
|
|
|
28
|
+
@return map.merge(
|
|
29
|
+
$theme-color-tokens,
|
|
30
|
+
(
|
|
31
|
+
// Opacity of value indicator text container
|
|
32
|
+
value-indicator-opacity: if($is-dark, 0.9, 0.6)
|
|
33
|
+
),
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Generates tokens for the slider properties that change based on the theme.
|
|
38
|
+
@function private-get-color-palette-color-tokens($theme, $palette-name) {
|
|
39
|
+
$ripple-color: inspection.get-theme-color($theme, $palette-name);
|
|
40
|
+
$hover-ripple-color: if($ripple-color == null, null, #{rgba($ripple-color, 0.05)});
|
|
41
|
+
$focus-ripple-color: if($ripple-color == null, null, #{rgba($ripple-color, 0.2)});
|
|
42
|
+
|
|
18
43
|
@return (
|
|
19
|
-
|
|
20
|
-
|
|
44
|
+
ripple-color: $ripple-color,
|
|
45
|
+
hover-state-layer-color: $hover-ripple-color,
|
|
46
|
+
focus-state-layer-color: $focus-ripple-color
|
|
21
47
|
);
|
|
22
48
|
}
|
|
23
49
|
|
|
24
50
|
// Tokens that can be configured through Angular Material's typography theming API.
|
|
25
51
|
@function get-typography-tokens($theme) {
|
|
26
52
|
@return ();
|
|
27
|
-
|
|
53
|
+
}
|
|
28
54
|
|
|
29
55
|
// Tokens that can be configured through Angular Material's density theming API.
|
|
30
56
|
@function get-density-tokens($theme) {
|
|
@@ -35,9 +61,9 @@ $prefix: (mat, slider);
|
|
|
35
61
|
// This is used to create token slots.
|
|
36
62
|
@function get-token-slots() {
|
|
37
63
|
@return sass-utils.deep-merge-all(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
64
|
+
get-unthemable-tokens(),
|
|
65
|
+
get-color-tokens(token-utils.$placeholder-color-config),
|
|
66
|
+
get-typography-tokens(token-utils.$placeholder-typography-config),
|
|
67
|
+
get-density-tokens(token-utils.$placeholder-density-config)
|
|
42
68
|
);
|
|
43
69
|
}
|
|
@@ -8,7 +8,12 @@ $prefix: (mat, tab-header);
|
|
|
8
8
|
// Tokens that can't be configured through Angular Material's current theming API,
|
|
9
9
|
// but may be in a future version of the theming API.
|
|
10
10
|
@function get-unthemable-tokens() {
|
|
11
|
-
@return (
|
|
11
|
+
@return (
|
|
12
|
+
// For some period of time, the MDC tabs removed the divider. This has been added back in
|
|
13
|
+
// and will be present in M3.
|
|
14
|
+
divider-color: transparent,
|
|
15
|
+
divider-height: 0,
|
|
16
|
+
);
|
|
12
17
|
}
|
|
13
18
|
|
|
14
19
|
// Tokens that can be configured through Angular Material's color theming API.
|
|
@@ -27,6 +27,9 @@ $prefix: (mat, text-button);
|
|
|
27
27
|
// Color of the element that shows the hover, focus and pressed states.
|
|
28
28
|
state-layer-color: $on-surface,
|
|
29
29
|
|
|
30
|
+
// Color of the element that shows the hover, focus and pressed states while disabled.
|
|
31
|
+
disabled-state-layer-color: $on-surface,
|
|
32
|
+
|
|
30
33
|
// Color of the ripple element.
|
|
31
34
|
ripple-color: rgba($on-surface, 0.1),
|
|
32
35
|
|