@angular/material 12.1.0-rc.0 → 12.1.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.
Files changed (53) hide show
  1. package/badge/_badge-theme.scss +64 -45
  2. package/bundles/material-core.umd.js +9 -7
  3. package/bundles/material-core.umd.js.map +1 -1
  4. package/bundles/material-datepicker.umd.js +11 -19
  5. package/bundles/material-datepicker.umd.js.map +1 -1
  6. package/bundles/material-radio.umd.js +12 -13
  7. package/bundles/material-radio.umd.js.map +1 -1
  8. package/bundles/material-slide-toggle.umd.js +1 -1
  9. package/bundles/material-tabs.umd.js +6 -0
  10. package/bundles/material-tabs.umd.js.map +1 -1
  11. package/bundles/material-tooltip.umd.js +7 -0
  12. package/bundles/material-tooltip.umd.js.map +1 -1
  13. package/core/common-behaviors/error-state.d.ts +5 -1
  14. package/core/index.metadata.json +1 -1
  15. package/datepicker/index.metadata.json +1 -1
  16. package/esm2015/core/common-behaviors/common-module.js +1 -1
  17. package/esm2015/core/common-behaviors/error-state.js +8 -6
  18. package/esm2015/core/version.js +1 -1
  19. package/esm2015/datepicker/calendar-body.js +1 -3
  20. package/esm2015/datepicker/calendar.js +6 -14
  21. package/esm2015/datepicker/date-range-input.js +4 -2
  22. package/esm2015/datepicker/month-view.js +2 -2
  23. package/esm2015/datepicker/multi-year-view.js +2 -2
  24. package/esm2015/datepicker/year-view.js +2 -2
  25. package/esm2015/radio/radio.js +13 -14
  26. package/esm2015/slide-toggle/slide-toggle.js +1 -1
  27. package/esm2015/tabs/tab-nav-bar/tab-nav-bar.js +7 -1
  28. package/esm2015/tooltip/tooltip.js +8 -1
  29. package/fesm2015/core.js +9 -7
  30. package/fesm2015/core.js.map +1 -1
  31. package/fesm2015/datepicker.js +11 -19
  32. package/fesm2015/datepicker.js.map +1 -1
  33. package/fesm2015/radio.js +12 -13
  34. package/fesm2015/radio.js.map +1 -1
  35. package/fesm2015/slide-toggle.js +1 -1
  36. package/fesm2015/tabs.js +6 -0
  37. package/fesm2015/tabs.js.map +1 -1
  38. package/fesm2015/tooltip.js +7 -0
  39. package/fesm2015/tooltip.js.map +1 -1
  40. package/package.json +2 -2
  41. package/prebuilt-themes/deeppurple-amber.css +1 -1
  42. package/prebuilt-themes/indigo-pink.css +1 -1
  43. package/prebuilt-themes/pink-bluegrey.css +1 -1
  44. package/prebuilt-themes/purple-green.css +1 -1
  45. package/radio/index.metadata.json +1 -1
  46. package/radio/radio.d.ts +2 -5
  47. package/schematics/ng-add/index.js +1 -1
  48. package/schematics/ng-add/index.mjs +1 -1
  49. package/slide-toggle/index.metadata.json +1 -1
  50. package/tabs/index.metadata.json +1 -1
  51. package/tabs/tab-nav-bar/tab-nav-bar.d.ts +1 -0
  52. package/tooltip/index.metadata.json +1 -1
  53. package/tooltip/tooltip.d.ts +6 -0
@@ -322,8 +322,6 @@ MatCalendarBody.decorators = [
322
322
  template: "<!--\n If there's not enough space in the first row, create a separate label row. We mark this row as\n aria-hidden because we don't want it to be read out as one of the weeks in the month.\n-->\n<tr *ngIf=\"_firstRowOffset < labelMinRequiredCells\" aria-hidden=\"true\">\n <td class=\"mat-calendar-body-label\"\n [attr.colspan]=\"numCols\"\n [style.paddingTop]=\"_cellPadding\"\n [style.paddingBottom]=\"_cellPadding\">\n {{label}}\n </td>\n</tr>\n\n<!-- Create the first row separately so we can include a special spacer cell. -->\n<tr *ngFor=\"let row of rows; let rowIndex = index\" role=\"row\">\n <!--\n We mark this cell as aria-hidden so it doesn't get read out as one of the days in the week.\n The aspect ratio of the table cells is maintained by setting the top and bottom padding as a\n percentage of the width (a variant of the trick described here:\n https://www.w3schools.com/howto/howto_css_aspect_ratio.asp).\n -->\n <td *ngIf=\"rowIndex === 0 && _firstRowOffset\"\n aria-hidden=\"true\"\n class=\"mat-calendar-body-label\"\n [attr.colspan]=\"_firstRowOffset\"\n [style.paddingTop]=\"_cellPadding\"\n [style.paddingBottom]=\"_cellPadding\">\n {{_firstRowOffset >= labelMinRequiredCells ? label : ''}}\n </td>\n <td *ngFor=\"let item of row; let colIndex = index\"\n role=\"gridcell\"\n class=\"mat-calendar-body-cell\"\n [ngClass]=\"item.cssClasses\"\n [tabindex]=\"_isActiveCell(rowIndex, colIndex) ? 0 : -1\"\n [attr.data-mat-row]=\"rowIndex\"\n [attr.data-mat-col]=\"colIndex\"\n [class.mat-calendar-body-disabled]=\"!item.enabled\"\n [class.mat-calendar-body-active]=\"_isActiveCell(rowIndex, colIndex)\"\n [class.mat-calendar-body-range-start]=\"_isRangeStart(item.compareValue)\"\n [class.mat-calendar-body-range-end]=\"_isRangeEnd(item.compareValue)\"\n [class.mat-calendar-body-in-range]=\"_isInRange(item.compareValue)\"\n [class.mat-calendar-body-comparison-bridge-start]=\"_isComparisonBridgeStart(item.compareValue, rowIndex, colIndex)\"\n [class.mat-calendar-body-comparison-bridge-end]=\"_isComparisonBridgeEnd(item.compareValue, rowIndex, colIndex)\"\n [class.mat-calendar-body-comparison-start]=\"_isComparisonStart(item.compareValue)\"\n [class.mat-calendar-body-comparison-end]=\"_isComparisonEnd(item.compareValue)\"\n [class.mat-calendar-body-in-comparison-range]=\"_isInComparisonRange(item.compareValue)\"\n [class.mat-calendar-body-preview-start]=\"_isPreviewStart(item.compareValue)\"\n [class.mat-calendar-body-preview-end]=\"_isPreviewEnd(item.compareValue)\"\n [class.mat-calendar-body-in-preview]=\"_isInPreview(item.compareValue)\"\n [attr.aria-label]=\"item.ariaLabel\"\n [attr.aria-disabled]=\"!item.enabled || null\"\n [attr.aria-selected]=\"_isSelected(item.compareValue)\"\n (click)=\"_cellClicked(item, $event)\"\n [style.width]=\"_cellWidth\"\n [style.paddingTop]=\"_cellPadding\"\n [style.paddingBottom]=\"_cellPadding\">\n <div class=\"mat-calendar-body-cell-content mat-focus-indicator\"\n [class.mat-calendar-body-selected]=\"_isSelected(item.compareValue)\"\n [class.mat-calendar-body-comparison-identical]=\"_isComparisonIdentical(item.compareValue)\"\n [class.mat-calendar-body-today]=\"todayValue === item.compareValue\">\n {{item.displayValue}}\n </div>\n <div class=\"mat-calendar-body-cell-preview\"></div>\n </td>\n</tr>\n",
323
323
  host: {
324
324
  'class': 'mat-calendar-body',
325
- 'role': 'grid',
326
- 'aria-readonly': 'true'
327
325
  },
328
326
  exportAs: 'matCalendarBody',
329
327
  encapsulation: ViewEncapsulation.None,
@@ -901,7 +899,7 @@ class MatMonthView {
901
899
  MatMonthView.decorators = [
902
900
  { type: Component, args: [{
903
901
  selector: 'mat-month-view',
904
- template: "<table class=\"mat-calendar-table\" role=\"presentation\">\n <thead class=\"mat-calendar-table-header\">\n <tr>\n <th scope=\"col\" *ngFor=\"let day of _weekdays\" [attr.aria-label]=\"day.long\">{{day.narrow}}</th>\n </tr>\n <tr><th class=\"mat-calendar-table-header-divider\" colspan=\"7\" aria-hidden=\"true\"></th></tr>\n </thead>\n <tbody mat-calendar-body\n [label]=\"_monthLabel\"\n [rows]=\"_weeks\"\n [todayValue]=\"_todayDate!\"\n [startValue]=\"_rangeStart!\"\n [endValue]=\"_rangeEnd!\"\n [comparisonStart]=\"_comparisonRangeStart\"\n [comparisonEnd]=\"_comparisonRangeEnd\"\n [previewStart]=\"_previewStart\"\n [previewEnd]=\"_previewEnd\"\n [isRange]=\"_isRange\"\n [labelMinRequiredCells]=\"3\"\n [activeCell]=\"_dateAdapter.getDate(activeDate) - 1\"\n (selectedValueChange)=\"_dateSelected($event)\"\n (previewChange)=\"_previewChanged($event)\"\n (keydown)=\"_handleCalendarBodyKeydown($event)\">\n </tbody>\n</table>\n",
902
+ template: "<table class=\"mat-calendar-table\" role=\"grid\">\n <thead class=\"mat-calendar-table-header\">\n <tr>\n <!-- For the day-of-the-week column header, we use an `<abbr>` element because VoiceOver\n ignores the `aria-label`. ChromeVox, however, does not read the full name\n for the `<abbr>`, so we still set `aria-label` on the header element. -->\n <th scope=\"col\" *ngFor=\"let day of _weekdays\" [attr.aria-label]=\"day.long\">\n <abbr class=\"mat-calendar-abbr\" [attr.title]=\"day.long\">{{day.narrow}}</abbr>\n </th>\n </tr>\n <tr><th aria-hidden=\"true\" class=\"mat-calendar-table-header-divider\" colspan=\"7\"></th></tr>\n </thead>\n <tbody mat-calendar-body\n [label]=\"_monthLabel\"\n [rows]=\"_weeks\"\n [todayValue]=\"_todayDate!\"\n [startValue]=\"_rangeStart!\"\n [endValue]=\"_rangeEnd!\"\n [comparisonStart]=\"_comparisonRangeStart\"\n [comparisonEnd]=\"_comparisonRangeEnd\"\n [previewStart]=\"_previewStart\"\n [previewEnd]=\"_previewEnd\"\n [isRange]=\"_isRange\"\n [labelMinRequiredCells]=\"3\"\n [activeCell]=\"_dateAdapter.getDate(activeDate) - 1\"\n (selectedValueChange)=\"_dateSelected($event)\"\n (previewChange)=\"_previewChanged($event)\"\n (keydown)=\"_handleCalendarBodyKeydown($event)\">\n </tbody>\n</table>\n",
905
903
  exportAs: 'matMonthView',
906
904
  encapsulation: ViewEncapsulation.None,
907
905
  changeDetection: ChangeDetectionStrategy.OnPush
@@ -1128,7 +1126,7 @@ class MatMultiYearView {
1128
1126
  MatMultiYearView.decorators = [
1129
1127
  { type: Component, args: [{
1130
1128
  selector: 'mat-multi-year-view',
1131
- template: "<table class=\"mat-calendar-table\" role=\"presentation\">\n <thead class=\"mat-calendar-table-header\">\n <tr><th class=\"mat-calendar-table-header-divider\" colspan=\"4\"></th></tr>\n </thead>\n <tbody mat-calendar-body\n [rows]=\"_years\"\n [todayValue]=\"_todayYear\"\n [startValue]=\"_selectedYear!\"\n [endValue]=\"_selectedYear!\"\n [numCols]=\"4\"\n [cellAspectRatio]=\"4 / 7\"\n [activeCell]=\"_getActiveCell()\"\n (selectedValueChange)=\"_yearSelected($event)\"\n (keydown)=\"_handleCalendarBodyKeydown($event)\">\n </tbody>\n</table>\n",
1129
+ template: "<table class=\"mat-calendar-table\" role=\"grid\">\n <thead aria-hidden=\"true\" class=\"mat-calendar-table-header\">\n <tr><th class=\"mat-calendar-table-header-divider\" colspan=\"4\"></th></tr>\n </thead>\n <tbody mat-calendar-body\n [rows]=\"_years\"\n [todayValue]=\"_todayYear\"\n [startValue]=\"_selectedYear!\"\n [endValue]=\"_selectedYear!\"\n [numCols]=\"4\"\n [cellAspectRatio]=\"4 / 7\"\n [activeCell]=\"_getActiveCell()\"\n (selectedValueChange)=\"_yearSelected($event)\"\n (keydown)=\"_handleCalendarBodyKeydown($event)\">\n </tbody>\n</table>\n",
1132
1130
  exportAs: 'matMultiYearView',
1133
1131
  encapsulation: ViewEncapsulation.None,
1134
1132
  changeDetection: ChangeDetectionStrategy.OnPush
@@ -1408,7 +1406,7 @@ class MatYearView {
1408
1406
  MatYearView.decorators = [
1409
1407
  { type: Component, args: [{
1410
1408
  selector: 'mat-year-view',
1411
- template: "<table class=\"mat-calendar-table\" role=\"presentation\">\n <thead class=\"mat-calendar-table-header\">\n <tr><th class=\"mat-calendar-table-header-divider\" colspan=\"4\"></th></tr>\n </thead>\n <tbody mat-calendar-body\n [label]=\"_yearLabel\"\n [rows]=\"_months\"\n [todayValue]=\"_todayMonth!\"\n [startValue]=\"_selectedMonth!\"\n [endValue]=\"_selectedMonth!\"\n [labelMinRequiredCells]=\"2\"\n [numCols]=\"4\"\n [cellAspectRatio]=\"4 / 7\"\n [activeCell]=\"_dateAdapter.getMonth(activeDate)\"\n (selectedValueChange)=\"_monthSelected($event)\"\n (keydown)=\"_handleCalendarBodyKeydown($event)\">\n </tbody>\n</table>\n",
1409
+ template: "<table class=\"mat-calendar-table\" role=\"grid\">\n <thead aria-hidden=\"true\" class=\"mat-calendar-table-header\">\n <tr><th class=\"mat-calendar-table-header-divider\" colspan=\"4\"></th></tr>\n </thead>\n <tbody mat-calendar-body\n [label]=\"_yearLabel\"\n [rows]=\"_months\"\n [todayValue]=\"_todayMonth!\"\n [startValue]=\"_selectedMonth!\"\n [endValue]=\"_selectedMonth!\"\n [labelMinRequiredCells]=\"2\"\n [numCols]=\"4\"\n [cellAspectRatio]=\"4 / 7\"\n [activeCell]=\"_dateAdapter.getMonth(activeDate)\"\n (selectedValueChange)=\"_monthSelected($event)\"\n (keydown)=\"_handleCalendarBodyKeydown($event)\">\n </tbody>\n</table>\n",
1412
1410
  exportAs: 'matYearView',
1413
1411
  encapsulation: ViewEncapsulation.None,
1414
1412
  changeDetection: ChangeDetectionStrategy.OnPush
@@ -1680,18 +1678,7 @@ class MatCalendar {
1680
1678
  }
1681
1679
  /** Updates today's date after an update of the active date */
1682
1680
  updateTodaysDate() {
1683
- const currentView = this.currentView;
1684
- let view;
1685
- if (currentView === 'month') {
1686
- view = this.monthView;
1687
- }
1688
- else if (currentView === 'year') {
1689
- view = this.yearView;
1690
- }
1691
- else {
1692
- view = this.multiYearView;
1693
- }
1694
- view._init();
1681
+ this._getCurrentViewComponent()._init();
1695
1682
  }
1696
1683
  /** Handles date selection in the month view. */
1697
1684
  _dateSelected(event) {
@@ -1717,6 +1704,9 @@ class MatCalendar {
1717
1704
  }
1718
1705
  /** Returns the component instance that corresponds to the current calendar view. */
1719
1706
  _getCurrentViewComponent() {
1707
+ // The return type is explicitly written as a union to ensure that the Closure compiler does
1708
+ // not optimize calls to _init(). Without the explict return type, TypeScript narrows it to
1709
+ // only the first component type. See https://github.com/angular/components/issues/22996.
1720
1710
  return this.monthView || this.yearView || this.multiYearView;
1721
1711
  }
1722
1712
  }
@@ -1731,7 +1721,7 @@ MatCalendar.decorators = [
1731
1721
  encapsulation: ViewEncapsulation.None,
1732
1722
  changeDetection: ChangeDetectionStrategy.OnPush,
1733
1723
  providers: [MAT_SINGLE_DATE_SELECTION_MODEL_PROVIDER],
1734
- styles: [".mat-calendar{display:block}.mat-calendar-header{padding:8px 8px 0 8px}.mat-calendar-content{padding:0 8px 8px 8px;outline:none}.mat-calendar-controls{display:flex;margin:5% calc(33% / 7 - 16px)}.mat-calendar-controls .mat-icon-button:hover .mat-button-focus-overlay{opacity:.04}.mat-calendar-spacer{flex:1 1 auto}.mat-calendar-period-button{min-width:0}.mat-calendar-arrow{display:inline-block;width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-top-width:5px;border-top-style:solid;margin:0 0 0 5px;vertical-align:middle}.mat-calendar-arrow.mat-calendar-invert{transform:rotate(180deg)}[dir=rtl] .mat-calendar-arrow{margin:0 5px 0 0}.mat-calendar-previous-button,.mat-calendar-next-button{position:relative}.mat-calendar-previous-button::after,.mat-calendar-next-button::after{top:0;left:0;right:0;bottom:0;position:absolute;content:\"\";margin:15.5px;border:0 solid currentColor;border-top-width:2px}[dir=rtl] .mat-calendar-previous-button,[dir=rtl] .mat-calendar-next-button{transform:rotate(180deg)}.mat-calendar-previous-button::after{border-left-width:2px;transform:translateX(2px) rotate(-45deg)}.mat-calendar-next-button::after{border-right-width:2px;transform:translateX(-2px) rotate(45deg)}.mat-calendar-table{border-spacing:0;border-collapse:collapse;width:100%}.mat-calendar-table-header th{text-align:center;padding:0 0 8px 0}.mat-calendar-table-header-divider{position:relative;height:1px}.mat-calendar-table-header-divider::after{content:\"\";position:absolute;top:0;left:-8px;right:-8px;height:1px}\n"]
1724
+ styles: [".mat-calendar{display:block}.mat-calendar-header{padding:8px 8px 0 8px}.mat-calendar-content{padding:0 8px 8px 8px;outline:none}.mat-calendar-controls{display:flex;margin:5% calc(33% / 7 - 16px)}.mat-calendar-controls .mat-icon-button:hover .mat-button-focus-overlay{opacity:.04}.mat-calendar-spacer{flex:1 1 auto}.mat-calendar-period-button{min-width:0}.mat-calendar-arrow{display:inline-block;width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-top-width:5px;border-top-style:solid;margin:0 0 0 5px;vertical-align:middle}.mat-calendar-arrow.mat-calendar-invert{transform:rotate(180deg)}[dir=rtl] .mat-calendar-arrow{margin:0 5px 0 0}.mat-calendar-previous-button,.mat-calendar-next-button{position:relative}.mat-calendar-previous-button::after,.mat-calendar-next-button::after{top:0;left:0;right:0;bottom:0;position:absolute;content:\"\";margin:15.5px;border:0 solid currentColor;border-top-width:2px}[dir=rtl] .mat-calendar-previous-button,[dir=rtl] .mat-calendar-next-button{transform:rotate(180deg)}.mat-calendar-previous-button::after{border-left-width:2px;transform:translateX(2px) rotate(-45deg)}.mat-calendar-next-button::after{border-right-width:2px;transform:translateX(-2px) rotate(45deg)}.mat-calendar-table{border-spacing:0;border-collapse:collapse;width:100%}.mat-calendar-table-header th{text-align:center;padding:0 0 8px 0}.mat-calendar-table-header-divider{position:relative;height:1px}.mat-calendar-table-header-divider::after{content:\"\";position:absolute;top:0;left:-8px;right:-8px;height:1px}.mat-calendar-abbr{text-decoration:none}\n"]
1735
1725
  },] }
1736
1726
  ];
1737
1727
  MatCalendar.ctorParameters = () => [
@@ -3234,7 +3224,9 @@ class MatDateRangeInput {
3234
3224
  // The datepicker module can be used both with MDC and non-MDC form fields. We have
3235
3225
  // to conditionally add the MDC input class so that the range picker looks correctly.
3236
3226
  if (_formField === null || _formField === void 0 ? void 0 : _formField._elementRef.nativeElement.classList.contains('mat-mdc-form-field')) {
3237
- _elementRef.nativeElement.classList.add('mat-mdc-input-element');
3227
+ const classList = _elementRef.nativeElement.classList;
3228
+ classList.add('mat-mdc-input-element');
3229
+ classList.add('mat-mdc-form-field-control');
3238
3230
  }
3239
3231
  // TODO(crisbeto): remove `as any` after #18206 lands.
3240
3232
  this.ngControl = control;