@mintplayer/ng-bootstrap 22.24.0 → 22.25.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.
|
@@ -2,6 +2,16 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { input, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import { Color } from '@mintplayer/ng-bootstrap';
|
|
4
4
|
|
|
5
|
+
// `.badge` paints white text, and `bg-{color}` sets only the background: white
|
|
6
|
+
// on warning was 1.63:1. Bootstrap's `text-bg-{color}` pairs each theme colour
|
|
7
|
+
// with the text colour color-contrast() picks (black on warning, info and light).
|
|
8
|
+
// It exists for the eight theme colours only; the other three pair a background
|
|
9
|
+
// with a text utility, the way `<bs-card [color]>` colours them.
|
|
10
|
+
const pairedColorClasses = {
|
|
11
|
+
[Color.body]: 'bg-body text-body',
|
|
12
|
+
[Color.white]: 'bg-white text-black',
|
|
13
|
+
[Color.transparent]: 'bg-transparent text-reset',
|
|
14
|
+
};
|
|
5
15
|
class BsBadgeComponent {
|
|
6
16
|
constructor() {
|
|
7
17
|
this.colors = Color;
|
|
@@ -16,7 +26,7 @@ class BsBadgeComponent {
|
|
|
16
26
|
/** Purely decorative badges leave the accessibility tree entirely. */
|
|
17
27
|
this.decorative = input(false, /* @ts-ignore */
|
|
18
28
|
...(ngDevMode ? [{ debugName: "decorative" }] : /* istanbul ignore next */ []));
|
|
19
|
-
this.colorClass = computed(() => `bg-${this.colors[this.type()]}`, /* @ts-ignore */
|
|
29
|
+
this.colorClass = computed(() => pairedColorClasses[this.type()] ?? `text-bg-${this.colors[this.type()]}`, /* @ts-ignore */
|
|
20
30
|
...(ngDevMode ? [{ debugName: "colorClass" }] : /* istanbul ignore next */ []));
|
|
21
31
|
}
|
|
22
32
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: BsBadgeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mintplayer-ng-bootstrap-badge.mjs","sources":["../../../../libs/mintplayer-ng-bootstrap/badge/src/badge.component.ts","../../../../libs/mintplayer-ng-bootstrap/badge/src/badge.component.html","../../../../libs/mintplayer-ng-bootstrap/badge/mintplayer-ng-bootstrap-badge.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';\nimport { Color } from '@mintplayer/ng-bootstrap';\n\n@Component({\n selector: 'bs-badge',\n templateUrl: './badge.component.html',\n styleUrls: ['./badge.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BsBadgeComponent {\n colors = Color;\n\n type = input<Color>(Color.primary);\n /**\n * What the number counts ('unread messages'): a bare '3' badge is\n * meaningless out of visual context. Appended visually hidden.\n */\n unit = input<string | null>(null);\n /** Purely decorative badges leave the accessibility tree entirely. */\n decorative = input(false);\n\n colorClass = computed(() => `bg-${this.colors[this.type()]}`);\n}\n","<span class=\"badge\" [class]=\"colorClass()\" [attr.aria-hidden]=\"decorative() ? 'true' : null\">\n <ng-content></ng-content>\n @if (unit(); as u) {\n <span class=\"visually-hidden-unit\">&ngsp;{{ u }}</span>\n }\n</span>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"mintplayer-ng-bootstrap-badge.mjs","sources":["../../../../libs/mintplayer-ng-bootstrap/badge/src/badge.component.ts","../../../../libs/mintplayer-ng-bootstrap/badge/src/badge.component.html","../../../../libs/mintplayer-ng-bootstrap/badge/mintplayer-ng-bootstrap-badge.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';\nimport { Color } from '@mintplayer/ng-bootstrap';\n\n// `.badge` paints white text, and `bg-{color}` sets only the background: white\n// on warning was 1.63:1. Bootstrap's `text-bg-{color}` pairs each theme colour\n// with the text colour color-contrast() picks (black on warning, info and light).\n// It exists for the eight theme colours only; the other three pair a background\n// with a text utility, the way `<bs-card [color]>` colours them.\nconst pairedColorClasses: Partial<Record<Color, string>> = {\n [Color.body]: 'bg-body text-body',\n [Color.white]: 'bg-white text-black',\n [Color.transparent]: 'bg-transparent text-reset',\n};\n\n@Component({\n selector: 'bs-badge',\n templateUrl: './badge.component.html',\n styleUrls: ['./badge.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BsBadgeComponent {\n colors = Color;\n\n type = input<Color>(Color.primary);\n /**\n * What the number counts ('unread messages'): a bare '3' badge is\n * meaningless out of visual context. Appended visually hidden.\n */\n unit = input<string | null>(null);\n /** Purely decorative badges leave the accessibility tree entirely. */\n decorative = input(false);\n\n colorClass = computed(() => pairedColorClasses[this.type()] ?? `text-bg-${this.colors[this.type()]}`);\n}\n","<span class=\"badge\" [class]=\"colorClass()\" [attr.aria-hidden]=\"decorative() ? 'true' : null\">\n <ng-content></ng-content>\n @if (unit(); as u) {\n <span class=\"visually-hidden-unit\">&ngsp;{{ u }}</span>\n }\n</span>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAGA;AACA;AACA;AACA;AACA;AACA,MAAM,kBAAkB,GAAmC;AACzD,IAAA,CAAC,KAAK,CAAC,IAAI,GAAG,mBAAmB;AACjC,IAAA,CAAC,KAAK,CAAC,KAAK,GAAG,qBAAqB;AACpC,IAAA,CAAC,KAAK,CAAC,WAAW,GAAG,2BAA2B;CACjD;MAQY,gBAAgB,CAAA;AAN7B,IAAA,WAAA,GAAA;QAOE,IAAA,CAAA,MAAM,GAAG,KAAK;AAEd,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK,CAAQ,KAAK,CAAC,OAAO;iFAAC;AAClC;;;AAGG;QACH,IAAA,CAAA,IAAI,GAAG,KAAK,CAAgB,IAAI;iFAAC;;QAEjC,IAAA,CAAA,UAAU,GAAG,KAAK,CAAC,KAAK;uFAAC;QAEzB,IAAA,CAAA,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