@educarehq/solaris-components 0.2.5 → 0.2.7
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/fesm2022/educarehq-solaris-components.mjs +727 -227
- package/fesm2022/educarehq-solaris-components.mjs.map +1 -1
- package/package.json +2 -2
- package/styles/actions/button/button.styles.scss +286 -0
- package/styles/forms/input-text/input-text.styles.scss +14 -0
- package/styles/solaris-components.scss +2 -2
- package/types/educarehq-solaris-components.d.ts +209 -16
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ElementRef, Renderer2, Directive, TemplateRef, Injectable, ViewContainerRef, DestroyRef, Input, ContentChild, ViewEncapsulation, Component, EventEmitter, Output, HostBinding, ChangeDetectionStrategy, ApplicationRef, signal, computed, effect, ContentChildren, HostListener, Optional,
|
|
3
|
-
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
2
|
+
import { inject, ElementRef, Renderer2, Directive, TemplateRef, Injectable, ViewContainerRef, DestroyRef, Input, ContentChild, ViewEncapsulation, Component, EventEmitter, Output, HostBinding, ChangeDetectionStrategy, ApplicationRef, signal, computed, effect, ContentChildren, HostListener, Optional, booleanAttribute, InjectionToken, makeEnvironmentProviders, PLATFORM_ID, input, viewChild, numberAttribute, afterNextRender, ViewChild, output, forwardRef, Host, Injector } from '@angular/core';
|
|
3
|
+
import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
|
|
4
4
|
import { Overlay } from '@angular/cdk/overlay';
|
|
5
5
|
import { TemplatePortal } from '@angular/cdk/portal';
|
|
6
6
|
import { fromEvent, merge } from 'rxjs';
|
|
7
7
|
import { filter } from 'rxjs/operators';
|
|
8
8
|
import { CdkMenu, CdkMenuItem, CdkMenuTrigger } from '@angular/cdk/menu';
|
|
9
9
|
import { RouterLink } from '@angular/router';
|
|
10
|
-
import { NgClass, NgTemplateOutlet, NgStyle, DOCUMENT, NgOptimizedImage } from '@angular/common';
|
|
11
|
-
import { SolarisTranslationPipe } from '@educarehq/solaris-services';
|
|
10
|
+
import { NgClass, NgTemplateOutlet, NgStyle, isPlatformBrowser, DOCUMENT, NgOptimizedImage } from '@angular/common';
|
|
11
|
+
import { SOLARIS_TRANSLATION, SOLARIS_TRANSLATION_CONFIGURATION, SolarisTranslationPipe } from '@educarehq/solaris-services';
|
|
12
12
|
import * as i1 from '@angular/forms';
|
|
13
13
|
import { NG_VALUE_ACCESSOR, FormsModule, NG_VALIDATORS, NgForm, FormGroupDirective, NgControl } from '@angular/forms';
|
|
14
14
|
import { getCountries, getCountryCallingCode, parsePhoneNumberFromString, AsYouType } from 'libphonenumber-js';
|
|
@@ -1014,7 +1014,727 @@ function coerceBoolean$2(v) {
|
|
|
1014
1014
|
return v === '' || v === true || v === 'true' || v === 1 || v === '1';
|
|
1015
1015
|
}
|
|
1016
1016
|
|
|
1017
|
-
const PRESET_COLORS$2 = [
|
|
1017
|
+
const PRESET_COLORS$2 = new Set([
|
|
1018
|
+
'primary',
|
|
1019
|
+
'surface',
|
|
1020
|
+
'success',
|
|
1021
|
+
'warning',
|
|
1022
|
+
'error',
|
|
1023
|
+
'info',
|
|
1024
|
+
'gradient',
|
|
1025
|
+
]);
|
|
1026
|
+
function resolveRadius$1(v) {
|
|
1027
|
+
const s = String(v).trim();
|
|
1028
|
+
switch (s) {
|
|
1029
|
+
case 'none':
|
|
1030
|
+
return '0';
|
|
1031
|
+
case 'sm':
|
|
1032
|
+
return 'var(--solaris-radius-sm)';
|
|
1033
|
+
case 'md':
|
|
1034
|
+
return 'var(--solaris-radius-md, var(--solaris-radius-sm))';
|
|
1035
|
+
case 'lg':
|
|
1036
|
+
return 'var(--solaris-radius-lg, var(--solaris-radius-md, var(--solaris-radius-sm)))';
|
|
1037
|
+
case 'full':
|
|
1038
|
+
return 'var(--solaris-radius-full)';
|
|
1039
|
+
default:
|
|
1040
|
+
return s;
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
class ButtonDirective {
|
|
1044
|
+
elementRef = inject((ElementRef));
|
|
1045
|
+
_loading = signal(false, ...(ngDevMode ? [{ debugName: "_loading" }] : []));
|
|
1046
|
+
_disabled = signal(false, ...(ngDevMode ? [{ debugName: "_disabled" }] : []));
|
|
1047
|
+
_iconOnly = signal(false, ...(ngDevMode ? [{ debugName: "_iconOnly" }] : []));
|
|
1048
|
+
_fullWidth = signal(false, ...(ngDevMode ? [{ debugName: "_fullWidth" }] : []));
|
|
1049
|
+
_badgeOverlay = signal(false, ...(ngDevMode ? [{ debugName: "_badgeOverlay" }] : []));
|
|
1050
|
+
_textColor = signal(null, ...(ngDevMode ? [{ debugName: "_textColor" }] : []));
|
|
1051
|
+
_customColor = signal(null, ...(ngDevMode ? [{ debugName: "_customColor" }] : []));
|
|
1052
|
+
_size = signal('md', ...(ngDevMode ? [{ debugName: "_size" }] : []));
|
|
1053
|
+
_variant = signal('solid', ...(ngDevMode ? [{ debugName: "_variant" }] : []));
|
|
1054
|
+
_radius = signal(null, ...(ngDevMode ? [{ debugName: "_radius" }] : []));
|
|
1055
|
+
_color = signal('primary', ...(ngDevMode ? [{ debugName: "_color" }] : []));
|
|
1056
|
+
isAnchor = computed(() => this.elementRef.nativeElement.tagName.toLowerCase() === 'a', ...(ngDevMode ? [{ debugName: "isAnchor" }] : []));
|
|
1057
|
+
set size(v) {
|
|
1058
|
+
if (v)
|
|
1059
|
+
this._size.set(v);
|
|
1060
|
+
}
|
|
1061
|
+
set variant(v) {
|
|
1062
|
+
if (v)
|
|
1063
|
+
this._variant.set(v);
|
|
1064
|
+
}
|
|
1065
|
+
set color(v) {
|
|
1066
|
+
if (v == null || String(v).trim() === '')
|
|
1067
|
+
return;
|
|
1068
|
+
const value = String(v).trim();
|
|
1069
|
+
if (PRESET_COLORS$2.has(value)) {
|
|
1070
|
+
this._color.set(value);
|
|
1071
|
+
this._customColor.set(null);
|
|
1072
|
+
}
|
|
1073
|
+
else {
|
|
1074
|
+
this._color.set('custom');
|
|
1075
|
+
this._customColor.set(value);
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
set textColor(v) {
|
|
1079
|
+
const value = v == null || String(v).trim() === '' ? null : String(v).trim();
|
|
1080
|
+
this._textColor.set(value);
|
|
1081
|
+
}
|
|
1082
|
+
set radius(v) {
|
|
1083
|
+
const value = v == null || String(v).trim() === '' ? null : (v);
|
|
1084
|
+
this._radius.set(value);
|
|
1085
|
+
}
|
|
1086
|
+
set loading(v) {
|
|
1087
|
+
this._loading.set(v);
|
|
1088
|
+
}
|
|
1089
|
+
set iconOnly(v) {
|
|
1090
|
+
this._iconOnly.set(v);
|
|
1091
|
+
}
|
|
1092
|
+
set disabled(v) {
|
|
1093
|
+
this._disabled.set(v);
|
|
1094
|
+
}
|
|
1095
|
+
set fullWidth(v) {
|
|
1096
|
+
this._fullWidth.set(v);
|
|
1097
|
+
}
|
|
1098
|
+
set badgeOverlay(v) {
|
|
1099
|
+
this._badgeOverlay.set(v);
|
|
1100
|
+
}
|
|
1101
|
+
attr = '';
|
|
1102
|
+
get tabIndex() {
|
|
1103
|
+
return this.isAnchor() && (this._disabled() || this._loading()) ? -1 : null;
|
|
1104
|
+
}
|
|
1105
|
+
get ariaBusy() {
|
|
1106
|
+
return this._loading() ? 'true' : null;
|
|
1107
|
+
}
|
|
1108
|
+
get dataSize() {
|
|
1109
|
+
return this._size();
|
|
1110
|
+
}
|
|
1111
|
+
get dataColor() {
|
|
1112
|
+
return this._color();
|
|
1113
|
+
}
|
|
1114
|
+
get nativeDisabled() {
|
|
1115
|
+
const isButton = !this.isAnchor();
|
|
1116
|
+
return isButton && (this._disabled() || this._loading()) ? '' : null;
|
|
1117
|
+
}
|
|
1118
|
+
get dataVariant() {
|
|
1119
|
+
return this._variant();
|
|
1120
|
+
}
|
|
1121
|
+
get ariaDisabled() {
|
|
1122
|
+
return this.isAnchor() && (this._disabled() || this._loading()) ? 'true' : null;
|
|
1123
|
+
}
|
|
1124
|
+
get dataIconOnly() {
|
|
1125
|
+
return this._iconOnly() ? 'true' : null;
|
|
1126
|
+
}
|
|
1127
|
+
get dataFullWidth() {
|
|
1128
|
+
return this._fullWidth() ? 'true' : null;
|
|
1129
|
+
}
|
|
1130
|
+
get customColorValue() {
|
|
1131
|
+
return this._customColor() ?? null;
|
|
1132
|
+
}
|
|
1133
|
+
get dataCustomInk() {
|
|
1134
|
+
return this._textColor() ? 'true' : null;
|
|
1135
|
+
}
|
|
1136
|
+
get customInkValue() {
|
|
1137
|
+
return this._textColor() ?? null;
|
|
1138
|
+
}
|
|
1139
|
+
get dataBadgeOverlay() {
|
|
1140
|
+
return this._badgeOverlay() ? 'true' : null;
|
|
1141
|
+
}
|
|
1142
|
+
get buttonRadius() {
|
|
1143
|
+
return this._radius() ? resolveRadius$1(this._radius()) : null;
|
|
1144
|
+
}
|
|
1145
|
+
onClick(ev) {
|
|
1146
|
+
if (!this.isAnchor())
|
|
1147
|
+
return;
|
|
1148
|
+
if (this._disabled() || this._loading()) {
|
|
1149
|
+
ev.preventDefault();
|
|
1150
|
+
ev.stopImmediatePropagation();
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: ButtonDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1154
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "21.1.1", type: ButtonDirective, isStandalone: true, selector: "button[solaris-button], a[solaris-button]", inputs: { size: "size", variant: "variant", color: "color", textColor: "textColor", radius: "radius", loading: ["loading", "loading", booleanAttribute], iconOnly: ["iconOnly", "iconOnly", booleanAttribute], disabled: ["disabled", "disabled", booleanAttribute], fullWidth: ["fullWidth", "fullWidth", booleanAttribute], badgeOverlay: ["badgeOverlay", "badgeOverlay", booleanAttribute] }, host: { listeners: { "click": "onClick($event)" }, properties: { "attr.solaris-button": "this.attr", "attr.tabindex": "this.tabIndex", "attr.aria-busy": "this.ariaBusy", "attr.data-size": "this.dataSize", "attr.data-color": "this.dataColor", "attr.disabled": "this.nativeDisabled", "attr.data-variant": "this.dataVariant", "attr.aria-disabled": "this.ariaDisabled", "attr.data-icon-only": "this.dataIconOnly", "attr.data-full-width": "this.dataFullWidth", "style.--sb-custom": "this.customColorValue", "attr.data-custom-ink": "this.dataCustomInk", "style.--sb-custom-ink": "this.customInkValue", "attr.data-badge-overlay": "this.dataBadgeOverlay", "style.--solaris-button-radius": "this.buttonRadius" } }, ngImport: i0 });
|
|
1155
|
+
}
|
|
1156
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: ButtonDirective, decorators: [{
|
|
1157
|
+
type: Directive,
|
|
1158
|
+
args: [{
|
|
1159
|
+
selector: 'button[solaris-button], a[solaris-button]',
|
|
1160
|
+
standalone: true,
|
|
1161
|
+
}]
|
|
1162
|
+
}], propDecorators: { size: [{
|
|
1163
|
+
type: Input
|
|
1164
|
+
}], variant: [{
|
|
1165
|
+
type: Input
|
|
1166
|
+
}], color: [{
|
|
1167
|
+
type: Input
|
|
1168
|
+
}], textColor: [{
|
|
1169
|
+
type: Input
|
|
1170
|
+
}], radius: [{
|
|
1171
|
+
type: Input
|
|
1172
|
+
}], loading: [{
|
|
1173
|
+
type: Input,
|
|
1174
|
+
args: [{ transform: booleanAttribute }]
|
|
1175
|
+
}], iconOnly: [{
|
|
1176
|
+
type: Input,
|
|
1177
|
+
args: [{ transform: booleanAttribute }]
|
|
1178
|
+
}], disabled: [{
|
|
1179
|
+
type: Input,
|
|
1180
|
+
args: [{ transform: booleanAttribute }]
|
|
1181
|
+
}], fullWidth: [{
|
|
1182
|
+
type: Input,
|
|
1183
|
+
args: [{ transform: booleanAttribute }]
|
|
1184
|
+
}], badgeOverlay: [{
|
|
1185
|
+
type: Input,
|
|
1186
|
+
args: [{ transform: booleanAttribute }]
|
|
1187
|
+
}], attr: [{
|
|
1188
|
+
type: HostBinding,
|
|
1189
|
+
args: ['attr.solaris-button']
|
|
1190
|
+
}], tabIndex: [{
|
|
1191
|
+
type: HostBinding,
|
|
1192
|
+
args: ['attr.tabindex']
|
|
1193
|
+
}], ariaBusy: [{
|
|
1194
|
+
type: HostBinding,
|
|
1195
|
+
args: ['attr.aria-busy']
|
|
1196
|
+
}], dataSize: [{
|
|
1197
|
+
type: HostBinding,
|
|
1198
|
+
args: ['attr.data-size']
|
|
1199
|
+
}], dataColor: [{
|
|
1200
|
+
type: HostBinding,
|
|
1201
|
+
args: ['attr.data-color']
|
|
1202
|
+
}], nativeDisabled: [{
|
|
1203
|
+
type: HostBinding,
|
|
1204
|
+
args: ['attr.disabled']
|
|
1205
|
+
}], dataVariant: [{
|
|
1206
|
+
type: HostBinding,
|
|
1207
|
+
args: ['attr.data-variant']
|
|
1208
|
+
}], ariaDisabled: [{
|
|
1209
|
+
type: HostBinding,
|
|
1210
|
+
args: ['attr.aria-disabled']
|
|
1211
|
+
}], dataIconOnly: [{
|
|
1212
|
+
type: HostBinding,
|
|
1213
|
+
args: ['attr.data-icon-only']
|
|
1214
|
+
}], dataFullWidth: [{
|
|
1215
|
+
type: HostBinding,
|
|
1216
|
+
args: ['attr.data-full-width']
|
|
1217
|
+
}], customColorValue: [{
|
|
1218
|
+
type: HostBinding,
|
|
1219
|
+
args: ['style.--sb-custom']
|
|
1220
|
+
}], dataCustomInk: [{
|
|
1221
|
+
type: HostBinding,
|
|
1222
|
+
args: ['attr.data-custom-ink']
|
|
1223
|
+
}], customInkValue: [{
|
|
1224
|
+
type: HostBinding,
|
|
1225
|
+
args: ['style.--sb-custom-ink']
|
|
1226
|
+
}], dataBadgeOverlay: [{
|
|
1227
|
+
type: HostBinding,
|
|
1228
|
+
args: ['attr.data-badge-overlay']
|
|
1229
|
+
}], buttonRadius: [{
|
|
1230
|
+
type: HostBinding,
|
|
1231
|
+
args: ['style.--solaris-button-radius']
|
|
1232
|
+
}], onClick: [{
|
|
1233
|
+
type: HostListener,
|
|
1234
|
+
args: ['click', ['$event']]
|
|
1235
|
+
}] } });
|
|
1236
|
+
|
|
1237
|
+
const SOLARIS_NOTIFICATION_POSITIONS = [
|
|
1238
|
+
'top-right', 'top-left', 'top-center',
|
|
1239
|
+
'bottom-right', 'bottom-left', 'bottom-center',
|
|
1240
|
+
];
|
|
1241
|
+
const SOLARIS_NOTIFICATION_DEFAULT_CONFIG = {
|
|
1242
|
+
defaultPosition: 'bottom-center',
|
|
1243
|
+
defaultDuration: 15000,
|
|
1244
|
+
maxVisiblePerPosition: 4,
|
|
1245
|
+
hoverPause: false,
|
|
1246
|
+
newestOnTop: true,
|
|
1247
|
+
expandSingle: false,
|
|
1248
|
+
persistInCenter: true,
|
|
1249
|
+
translationScope: 'solaris.notifications',
|
|
1250
|
+
};
|
|
1251
|
+
const SOLARIS_NOTIFICATION_CONFIG = new InjectionToken('SOLARIS_NOTIFICATION_CONFIG', {
|
|
1252
|
+
providedIn: 'root',
|
|
1253
|
+
factory: () => SOLARIS_NOTIFICATION_DEFAULT_CONFIG,
|
|
1254
|
+
});
|
|
1255
|
+
function mergeConfig(input = {}) {
|
|
1256
|
+
return {
|
|
1257
|
+
...SOLARIS_NOTIFICATION_DEFAULT_CONFIG,
|
|
1258
|
+
...input,
|
|
1259
|
+
};
|
|
1260
|
+
}
|
|
1261
|
+
function provideSolarisNotifications(input = {}) {
|
|
1262
|
+
return makeEnvironmentProviders([
|
|
1263
|
+
{
|
|
1264
|
+
provide: SOLARIS_NOTIFICATION_CONFIG,
|
|
1265
|
+
useValue: mergeConfig(input),
|
|
1266
|
+
},
|
|
1267
|
+
]);
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
class SolarisNotificationIntlService {
|
|
1271
|
+
translationService = inject(SOLARIS_TRANSLATION);
|
|
1272
|
+
notificationConfig = inject(SOLARIS_NOTIFICATION_CONFIG);
|
|
1273
|
+
translationConfig = inject(SOLARIS_TRANSLATION_CONFIGURATION);
|
|
1274
|
+
activeLang = toSignal(this.translationService.languageChanges(), {
|
|
1275
|
+
initialValue: this.translationService.language(),
|
|
1276
|
+
});
|
|
1277
|
+
prefix = computed(() => {
|
|
1278
|
+
this.activeLang();
|
|
1279
|
+
const uiScope = this.translationConfig.uiScope ?? 'ui';
|
|
1280
|
+
const namespace = this.notificationConfig.translationScope;
|
|
1281
|
+
return `${uiScope}.${namespace}`;
|
|
1282
|
+
}, ...(ngDevMode ? [{ debugName: "prefix" }] : []));
|
|
1283
|
+
translate(key, params) {
|
|
1284
|
+
this.activeLang();
|
|
1285
|
+
const isAbsoluteKey = key.startsWith('ui.') || key.startsWith('solaris.')
|
|
1286
|
+
|| key.startsWith('notification.');
|
|
1287
|
+
const finalKey = isAbsoluteKey ? key : `${this.prefix()}.${key}`;
|
|
1288
|
+
return this.translationService.translate(finalKey, params);
|
|
1289
|
+
}
|
|
1290
|
+
close() {
|
|
1291
|
+
return this.translate('close');
|
|
1292
|
+
}
|
|
1293
|
+
expand() {
|
|
1294
|
+
return this.translate('expand');
|
|
1295
|
+
}
|
|
1296
|
+
collapse() {
|
|
1297
|
+
return this.translate('collapse');
|
|
1298
|
+
}
|
|
1299
|
+
stopTimer() {
|
|
1300
|
+
return this.translate('stopTimer');
|
|
1301
|
+
}
|
|
1302
|
+
resumeTimer() {
|
|
1303
|
+
return this.translate('resumeTimer');
|
|
1304
|
+
}
|
|
1305
|
+
paused() {
|
|
1306
|
+
return this.translate('paused');
|
|
1307
|
+
}
|
|
1308
|
+
centerTitle() {
|
|
1309
|
+
return this.translate('centerTitle');
|
|
1310
|
+
}
|
|
1311
|
+
emptyCenter() {
|
|
1312
|
+
return this.translate('emptyCenter');
|
|
1313
|
+
}
|
|
1314
|
+
clearHistory() {
|
|
1315
|
+
return this.translate('clearHistory');
|
|
1316
|
+
}
|
|
1317
|
+
autoClose(seconds) {
|
|
1318
|
+
return this.translate('autoClose', {
|
|
1319
|
+
seconds,
|
|
1320
|
+
unit: seconds === 1 ? this.translate('units.second') : this.translate('units.seconds'),
|
|
1321
|
+
});
|
|
1322
|
+
}
|
|
1323
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: SolarisNotificationIntlService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1324
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: SolarisNotificationIntlService, providedIn: 'root' });
|
|
1325
|
+
}
|
|
1326
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: SolarisNotificationIntlService, decorators: [{
|
|
1327
|
+
type: Injectable,
|
|
1328
|
+
args: [{ providedIn: 'root' }]
|
|
1329
|
+
}] });
|
|
1330
|
+
|
|
1331
|
+
class SolarisNotificationService {
|
|
1332
|
+
platformId = inject(PLATFORM_ID);
|
|
1333
|
+
destroyRef = inject(DestroyRef);
|
|
1334
|
+
config = inject(SOLARIS_NOTIFICATION_CONFIG);
|
|
1335
|
+
translationService = inject(SOLARIS_TRANSLATION);
|
|
1336
|
+
centerOpen = signal(false, ...(ngDevMode ? [{ debugName: "centerOpen" }] : []));
|
|
1337
|
+
_items = signal([], ...(ngDevMode ? [{ debugName: "_items" }] : []));
|
|
1338
|
+
items = computed(() => this._items(), ...(ngDevMode ? [{ debugName: "items" }] : []));
|
|
1339
|
+
visibleItems = computed(() => this._items().filter((item) => item.state === 'visible'), ...(ngDevMode ? [{ debugName: "visibleItems" }] : []));
|
|
1340
|
+
centerItems = computed(() => [...this._items()].sort((a, b) => b.createdAt - a.createdAt), ...(ngDevMode ? [{ debugName: "centerItems" }] : []));
|
|
1341
|
+
lastTick = 0;
|
|
1342
|
+
intervalId = null;
|
|
1343
|
+
constructor() {
|
|
1344
|
+
if (!isPlatformBrowser(this.platformId))
|
|
1345
|
+
return;
|
|
1346
|
+
this.lastTick = performance.now();
|
|
1347
|
+
this.intervalId = globalThis.setInterval(() => this.tick(), 100);
|
|
1348
|
+
const handleVisibility = () => {
|
|
1349
|
+
const hidden = document.visibilityState !== 'visible';
|
|
1350
|
+
this._items.update((items) => items.map((item) => item.duration == null ? item : { ...item, pausedByVisibility: hidden }));
|
|
1351
|
+
};
|
|
1352
|
+
document.addEventListener('visibilitychange', handleVisibility, {
|
|
1353
|
+
passive: true,
|
|
1354
|
+
});
|
|
1355
|
+
this.destroyRef.onDestroy(() => {
|
|
1356
|
+
if (this.intervalId != null) {
|
|
1357
|
+
globalThis.clearInterval(this.intervalId);
|
|
1358
|
+
}
|
|
1359
|
+
document.removeEventListener('visibilitychange', handleVisibility);
|
|
1360
|
+
});
|
|
1361
|
+
}
|
|
1362
|
+
success(input) {
|
|
1363
|
+
return this.show({ ...input, kind: 'success' });
|
|
1364
|
+
}
|
|
1365
|
+
warning(input) {
|
|
1366
|
+
return this.show({ ...input, kind: 'warning' });
|
|
1367
|
+
}
|
|
1368
|
+
error(input) {
|
|
1369
|
+
return this.show({ ...input, kind: 'error' });
|
|
1370
|
+
}
|
|
1371
|
+
info(input) {
|
|
1372
|
+
return this.show({ ...input, kind: 'info' });
|
|
1373
|
+
}
|
|
1374
|
+
show(input) {
|
|
1375
|
+
const item = this.createRecord(input);
|
|
1376
|
+
this._items.update((items) => this.config.newestOnTop ? [item, ...items] : [...items, item]);
|
|
1377
|
+
this.rebalance();
|
|
1378
|
+
return this.createRef(item.id);
|
|
1379
|
+
}
|
|
1380
|
+
visibleByPosition(position) {
|
|
1381
|
+
return this.visibleItems().filter((item) => item.position === position);
|
|
1382
|
+
}
|
|
1383
|
+
isPaused(item) {
|
|
1384
|
+
return item.pausedByHover || item.pausedByUser || item.pausedByVisibility;
|
|
1385
|
+
}
|
|
1386
|
+
dismiss(id) {
|
|
1387
|
+
this._items.update((items) => {
|
|
1388
|
+
if (this.config.persistInCenter) {
|
|
1389
|
+
return items.map((item) => item.id === id ? { ...item, state: 'archived', pausedByHover: false, pausedByUser: false, pausedByVisibility: false, } : item);
|
|
1390
|
+
}
|
|
1391
|
+
return items.filter((item) => item.id !== id);
|
|
1392
|
+
});
|
|
1393
|
+
this.rebalance();
|
|
1394
|
+
}
|
|
1395
|
+
remove(id) {
|
|
1396
|
+
this._items.update((items) => items.filter((item) => item.id !== id));
|
|
1397
|
+
}
|
|
1398
|
+
clearHistory() {
|
|
1399
|
+
this._items.update((items) => items.filter((item) => item.state !== 'archived'));
|
|
1400
|
+
}
|
|
1401
|
+
pause(id) {
|
|
1402
|
+
this.patch(id, { pausedByUser: true });
|
|
1403
|
+
}
|
|
1404
|
+
resume(id) {
|
|
1405
|
+
this.patch(id, { pausedByUser: false });
|
|
1406
|
+
}
|
|
1407
|
+
toggleUserPause(id) {
|
|
1408
|
+
const current = this.find(id);
|
|
1409
|
+
if (!current)
|
|
1410
|
+
return;
|
|
1411
|
+
this.patch(id, { pausedByUser: !current.pausedByUser });
|
|
1412
|
+
}
|
|
1413
|
+
setHoverPaused(id, paused) {
|
|
1414
|
+
const current = this.find(id);
|
|
1415
|
+
if (!current?.pauseOnHover)
|
|
1416
|
+
return;
|
|
1417
|
+
this.patch(id, { pausedByHover: paused });
|
|
1418
|
+
}
|
|
1419
|
+
toggleExpanded(id) {
|
|
1420
|
+
const current = this.find(id);
|
|
1421
|
+
if (!current?.expandable)
|
|
1422
|
+
return;
|
|
1423
|
+
this._items.update((items) => items.map((item) => {
|
|
1424
|
+
if (item.id === id) {
|
|
1425
|
+
return { ...item, expanded: !item.expanded };
|
|
1426
|
+
}
|
|
1427
|
+
if (this.config.expandSingle && item.position === current.position &&
|
|
1428
|
+
item.state === 'visible') {
|
|
1429
|
+
return { ...item, expanded: false };
|
|
1430
|
+
}
|
|
1431
|
+
return item;
|
|
1432
|
+
}));
|
|
1433
|
+
}
|
|
1434
|
+
update(id, patch) {
|
|
1435
|
+
this._items.update((items) => items.map((item) => {
|
|
1436
|
+
if (item.id !== id)
|
|
1437
|
+
return item;
|
|
1438
|
+
const hasDurationPatch = this.hasOwn(patch, 'duration');
|
|
1439
|
+
const hasTitlePatch = this.hasOwn(patch, 'title') ||
|
|
1440
|
+
this.hasOwn(patch, 'titleKey') || this.hasOwn(patch, 'titleParams');
|
|
1441
|
+
const hasDescriptionPatch = this.hasOwn(patch, 'description') ||
|
|
1442
|
+
this.hasOwn(patch, 'descriptionKey') || this.hasOwn(patch, 'descriptionParams');
|
|
1443
|
+
const duration = hasDurationPatch ? (patch.duration ?? null) : item.duration;
|
|
1444
|
+
const title = hasTitlePatch ? this.resolveRequiredText(patch.title, patch.titleKey, patch.titleParams, item.title) : item.title;
|
|
1445
|
+
const description = hasDescriptionPatch ? this.resolveOptionalText(patch.description, patch.descriptionKey, patch.descriptionParams, item.description) : item.description;
|
|
1446
|
+
const hasExplicitExpandable = this.hasOwn(patch, 'expandable');
|
|
1447
|
+
let expandable = item.expandable;
|
|
1448
|
+
if (hasExplicitExpandable) {
|
|
1449
|
+
expandable = patch.expandable ?? item.expandable;
|
|
1450
|
+
}
|
|
1451
|
+
else if (hasDescriptionPatch) {
|
|
1452
|
+
expandable = Boolean(description?.trim().length);
|
|
1453
|
+
}
|
|
1454
|
+
return {
|
|
1455
|
+
...item,
|
|
1456
|
+
title,
|
|
1457
|
+
description,
|
|
1458
|
+
kind: patch.kind ?? item.kind,
|
|
1459
|
+
position: patch.position ?? item.position,
|
|
1460
|
+
duration,
|
|
1461
|
+
remainingMs: hasDurationPatch ? duration ?? null : item.remainingMs,
|
|
1462
|
+
expandable,
|
|
1463
|
+
expanded: patch.expanded ?? item.expanded,
|
|
1464
|
+
closeable: patch.closeable ?? item.closeable,
|
|
1465
|
+
pauseOnHover: patch.pauseOnHover ?? item.pauseOnHover,
|
|
1466
|
+
actions: patch.actions ?? item.actions,
|
|
1467
|
+
ariaLive: patch.ariaLive ?? item.ariaLive,
|
|
1468
|
+
data: patch.data ?? item.data,
|
|
1469
|
+
};
|
|
1470
|
+
}));
|
|
1471
|
+
this.rebalance();
|
|
1472
|
+
}
|
|
1473
|
+
openCenter() {
|
|
1474
|
+
this.centerOpen.set(true);
|
|
1475
|
+
}
|
|
1476
|
+
closeCenter() {
|
|
1477
|
+
this.centerOpen.set(false);
|
|
1478
|
+
}
|
|
1479
|
+
toggleCenter() {
|
|
1480
|
+
this.centerOpen.update((value) => !value);
|
|
1481
|
+
}
|
|
1482
|
+
tick() {
|
|
1483
|
+
const now = performance.now();
|
|
1484
|
+
const delta = now - this.lastTick;
|
|
1485
|
+
this.lastTick = now;
|
|
1486
|
+
let shouldRebalance = false;
|
|
1487
|
+
const expiredIds = new Set();
|
|
1488
|
+
this._items.update((items) => {
|
|
1489
|
+
const next = items.map((item) => {
|
|
1490
|
+
if (item.state !== 'visible')
|
|
1491
|
+
return item;
|
|
1492
|
+
if (item.duration == null || item.remainingMs == null)
|
|
1493
|
+
return item;
|
|
1494
|
+
if (this.isPaused(item))
|
|
1495
|
+
return item;
|
|
1496
|
+
const remainingMs = Math.max(0, item.remainingMs - delta);
|
|
1497
|
+
if (remainingMs === 0) {
|
|
1498
|
+
shouldRebalance = true;
|
|
1499
|
+
expiredIds.add(item.id);
|
|
1500
|
+
if (this.config.persistInCenter) {
|
|
1501
|
+
return {
|
|
1502
|
+
...item,
|
|
1503
|
+
remainingMs: 0,
|
|
1504
|
+
state: 'archived',
|
|
1505
|
+
pausedByHover: false,
|
|
1506
|
+
pausedByUser: false,
|
|
1507
|
+
pausedByVisibility: false,
|
|
1508
|
+
};
|
|
1509
|
+
}
|
|
1510
|
+
return item;
|
|
1511
|
+
}
|
|
1512
|
+
return {
|
|
1513
|
+
...item,
|
|
1514
|
+
remainingMs,
|
|
1515
|
+
};
|
|
1516
|
+
});
|
|
1517
|
+
if (this.config.persistInCenter) {
|
|
1518
|
+
return next;
|
|
1519
|
+
}
|
|
1520
|
+
return next.filter((item) => !expiredIds.has(item.id));
|
|
1521
|
+
});
|
|
1522
|
+
if (shouldRebalance) {
|
|
1523
|
+
this.rebalance();
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
rebalance() {
|
|
1527
|
+
this._items.update((items) => {
|
|
1528
|
+
let next = [...items];
|
|
1529
|
+
for (const position of SOLARIS_NOTIFICATION_POSITIONS) {
|
|
1530
|
+
const visibleCount = next.filter((item) => item.position === position && item.state === 'visible').length;
|
|
1531
|
+
const freeSlots = this.config.maxVisiblePerPosition - visibleCount;
|
|
1532
|
+
if (freeSlots <= 0)
|
|
1533
|
+
continue;
|
|
1534
|
+
const queued = next.filter((item) => item.position === position && item.state === 'queued')
|
|
1535
|
+
.sort((a, b) => this.config.newestOnTop ? b.createdAt - a.createdAt : a.createdAt - b.createdAt)
|
|
1536
|
+
.slice(0, freeSlots);
|
|
1537
|
+
if (!queued.length)
|
|
1538
|
+
continue;
|
|
1539
|
+
const queuedIds = new Set(queued.map((item) => item.id));
|
|
1540
|
+
next = next.map((item) => queuedIds.has(item.id) ? { ...item, state: 'visible' } : item);
|
|
1541
|
+
}
|
|
1542
|
+
return next;
|
|
1543
|
+
});
|
|
1544
|
+
}
|
|
1545
|
+
createRecord(input) {
|
|
1546
|
+
const duration = input.duration === undefined
|
|
1547
|
+
? this.config.defaultDuration
|
|
1548
|
+
: input.duration;
|
|
1549
|
+
const kind = input.kind ?? 'info';
|
|
1550
|
+
const position = input.position ?? this.config.defaultPosition;
|
|
1551
|
+
const title = this.resolveRequiredText(input.title, input.titleKey, input.titleParams, '');
|
|
1552
|
+
const description = this.resolveOptionalText(input.description, input.descriptionKey, input.descriptionParams, null);
|
|
1553
|
+
const expandable = input.expandable ?? Boolean(description?.trim().length);
|
|
1554
|
+
return {
|
|
1555
|
+
id: this.createId(),
|
|
1556
|
+
title,
|
|
1557
|
+
description,
|
|
1558
|
+
kind,
|
|
1559
|
+
position,
|
|
1560
|
+
state: 'queued',
|
|
1561
|
+
duration,
|
|
1562
|
+
remainingMs: duration == null ? null : duration,
|
|
1563
|
+
expandable,
|
|
1564
|
+
expanded: input.expanded ?? false,
|
|
1565
|
+
closeable: input.closeable ?? true,
|
|
1566
|
+
pauseOnHover: input.pauseOnHover ?? this.config.hoverPause,
|
|
1567
|
+
pausedByHover: false,
|
|
1568
|
+
pausedByUser: false,
|
|
1569
|
+
pausedByVisibility: false,
|
|
1570
|
+
actions: input.actions ?? [],
|
|
1571
|
+
ariaLive: input.ariaLive ?? this.resolveAriaLive(kind),
|
|
1572
|
+
data: input.data ?? null,
|
|
1573
|
+
createdAt: Date.now(),
|
|
1574
|
+
};
|
|
1575
|
+
}
|
|
1576
|
+
resolveAriaLive(kind) {
|
|
1577
|
+
return kind === 'success' || kind === 'info' ? 'polite' : 'assertive';
|
|
1578
|
+
}
|
|
1579
|
+
createRef(id) {
|
|
1580
|
+
return {
|
|
1581
|
+
id,
|
|
1582
|
+
dismiss: () => this.dismiss(id),
|
|
1583
|
+
remove: () => this.remove(id),
|
|
1584
|
+
pause: () => this.pause(id),
|
|
1585
|
+
resume: () => this.resume(id),
|
|
1586
|
+
toggleExpanded: () => this.toggleExpanded(id),
|
|
1587
|
+
update: (patch) => this.update(id, patch),
|
|
1588
|
+
};
|
|
1589
|
+
}
|
|
1590
|
+
createId() {
|
|
1591
|
+
const uuid = globalThis.crypto?.randomUUID?.();
|
|
1592
|
+
return uuid ?? `sn_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
|
|
1593
|
+
}
|
|
1594
|
+
find(id) {
|
|
1595
|
+
return this._items().find((item) => item.id === id);
|
|
1596
|
+
}
|
|
1597
|
+
patch(id, patch) {
|
|
1598
|
+
this._items.update((items) => items.map((item) => (item.id === id ? { ...item, ...patch } : item)));
|
|
1599
|
+
}
|
|
1600
|
+
resolveRequiredText(value, key, params, fallback) {
|
|
1601
|
+
if (key) {
|
|
1602
|
+
return this.translationService.translate(key, params);
|
|
1603
|
+
}
|
|
1604
|
+
if (value == null) {
|
|
1605
|
+
return fallback;
|
|
1606
|
+
}
|
|
1607
|
+
return value;
|
|
1608
|
+
}
|
|
1609
|
+
resolveOptionalText(value, key, params, fallback) {
|
|
1610
|
+
if (key) {
|
|
1611
|
+
return this.translationService.translate(key, params);
|
|
1612
|
+
}
|
|
1613
|
+
if (value === undefined) {
|
|
1614
|
+
return fallback;
|
|
1615
|
+
}
|
|
1616
|
+
return value ?? null;
|
|
1617
|
+
}
|
|
1618
|
+
hasOwn(obj, key) {
|
|
1619
|
+
return Object.hasOwn(obj, key);
|
|
1620
|
+
}
|
|
1621
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: SolarisNotificationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1622
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: SolarisNotificationService, providedIn: 'root' });
|
|
1623
|
+
}
|
|
1624
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: SolarisNotificationService, decorators: [{
|
|
1625
|
+
type: Injectable,
|
|
1626
|
+
args: [{ providedIn: 'root' }]
|
|
1627
|
+
}], ctorParameters: () => [] });
|
|
1628
|
+
|
|
1629
|
+
class SolarisNotificationItemComponent {
|
|
1630
|
+
notificationService = inject(SolarisNotificationService);
|
|
1631
|
+
intl = inject(SolarisNotificationIntlService);
|
|
1632
|
+
item = input.required(...(ngDevMode ? [{ debugName: "item" }] : []));
|
|
1633
|
+
mode = input('toast', ...(ngDevMode ? [{ debugName: "mode" }] : []));
|
|
1634
|
+
paused = computed(() => this.notificationService.isPaused(this.item()), ...(ngDevMode ? [{ debugName: "paused" }] : []));
|
|
1635
|
+
secondsLeft = computed(() => {
|
|
1636
|
+
const remaining = this.item().remainingMs ?? 0;
|
|
1637
|
+
return Math.max(1, Math.ceil(remaining / 1000));
|
|
1638
|
+
}, ...(ngDevMode ? [{ debugName: "secondsLeft" }] : []));
|
|
1639
|
+
progress = computed(() => {
|
|
1640
|
+
const duration = this.item().duration;
|
|
1641
|
+
const remaining = this.item().remainingMs;
|
|
1642
|
+
if (duration == null || remaining == null || duration <= 0)
|
|
1643
|
+
return 0;
|
|
1644
|
+
return Math.max(0, Math.min(100, (remaining / duration) * 100));
|
|
1645
|
+
}, ...(ngDevMode ? [{ debugName: "progress" }] : []));
|
|
1646
|
+
iconClass = computed(() => {
|
|
1647
|
+
switch (this.item().kind) {
|
|
1648
|
+
case 'success':
|
|
1649
|
+
return 'ph-check-circle';
|
|
1650
|
+
case 'warning':
|
|
1651
|
+
return 'ph-warning-circle';
|
|
1652
|
+
case 'error':
|
|
1653
|
+
return 'ph-x-circle';
|
|
1654
|
+
default:
|
|
1655
|
+
return 'ph-info';
|
|
1656
|
+
}
|
|
1657
|
+
}, ...(ngDevMode ? [{ debugName: "iconClass" }] : []));
|
|
1658
|
+
toggleExpanded() {
|
|
1659
|
+
this.notificationService.toggleExpanded(this.item().id);
|
|
1660
|
+
}
|
|
1661
|
+
toggleUserPause() {
|
|
1662
|
+
this.notificationService.toggleUserPause(this.item().id);
|
|
1663
|
+
}
|
|
1664
|
+
close() {
|
|
1665
|
+
this.notificationService.dismiss(this.item().id);
|
|
1666
|
+
}
|
|
1667
|
+
onMouseEnter() {
|
|
1668
|
+
if (this.mode() !== 'toast')
|
|
1669
|
+
return;
|
|
1670
|
+
this.notificationService.setHoverPaused(this.item().id, true);
|
|
1671
|
+
}
|
|
1672
|
+
onMouseLeave() {
|
|
1673
|
+
if (this.mode() !== 'toast')
|
|
1674
|
+
return;
|
|
1675
|
+
this.notificationService.setHoverPaused(this.item().id, false);
|
|
1676
|
+
}
|
|
1677
|
+
async runAction(action) {
|
|
1678
|
+
await action.run?.({
|
|
1679
|
+
id: this.item().id,
|
|
1680
|
+
data: this.item().data,
|
|
1681
|
+
dismiss: () => this.notificationService.dismiss(this.item().id),
|
|
1682
|
+
remove: () => this.notificationService.remove(this.item().id),
|
|
1683
|
+
update: (patch) => this.notificationService.update(this.item().id, patch),
|
|
1684
|
+
});
|
|
1685
|
+
if (action.closeOnClick !== false) {
|
|
1686
|
+
this.notificationService.dismiss(this.item().id);
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
resolveActionLabel(action) {
|
|
1690
|
+
if (action.labelKey) {
|
|
1691
|
+
return this.intl.translate(action.labelKey, action.labelParams);
|
|
1692
|
+
}
|
|
1693
|
+
return action.label ?? '';
|
|
1694
|
+
}
|
|
1695
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: SolarisNotificationItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1696
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.1", type: SolarisNotificationItemComponent, isStandalone: true, selector: "solaris-notification-item", inputs: { item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: true, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<article class=\"sn\" [attr.data-kind]=\"item().kind\" [attr.data-mode]=\"mode()\" [attr.data-expanded]=\"item().expanded ? 'true' : 'false'\"\r\n [attr.data-paused]=\"paused() ? 'true' : 'false'\" [attr.aria-live]=\"mode() === 'toast' ? item().ariaLive : null\"\r\n [attr.role]=\"item().ariaLive === 'assertive' ? 'alert' : 'status'\" (mouseenter)=\"onMouseEnter()\" (mouseleave)=\"onMouseLeave()\">\r\n <div class=\"sn__header\">\r\n <div class=\"sn__leading\">\r\n <span class=\"sn__icon\" aria-hidden=\"true\">\r\n <i class=\"ph\" [ngClass]=\"iconClass()\"></i>\r\n </span>\r\n\r\n <div class=\"sn__heading\">\r\n <strong class=\"sn__title\">{{ item().title }}</strong>\r\n\r\n @if (!item().expanded && item().description) {\r\n <p class=\"sn__description sn__description--clamped\">\r\n {{ item().description }}\r\n </p>\r\n }\r\n </div>\r\n </div>\r\n\r\n <div class=\"sn__controls\">\r\n @if (item().expandable && item().description) {\r\n <button type=\"button\" class=\"sn__icon-btn\" [attr.aria-expanded]=\"item().expanded\"\r\n [attr.aria-label]=\"item().expanded ? intl.collapse() : intl.expand()\" (click)=\"toggleExpanded()\">\r\n <i class=\"ph\" [ngClass]=\"item().expanded ? 'ph-caret-up' : 'ph-caret-down'\" aria-hidden=\"true\"></i>\r\n </button>\r\n }\r\n\r\n @if (item().closeable) {\r\n <button type=\"button\" class=\"sn__icon-btn\" [attr.aria-label]=\"intl.close()\" (click)=\"close()\">\r\n <i class=\"ph ph-x\" aria-hidden=\"true\"></i>\r\n </button>\r\n }\r\n </div>\r\n </div>\r\n\r\n @if (item().expanded && item().description) {\r\n <div class=\"sn__body\">\r\n <p class=\"sn__body-text\">{{ item().description }}</p>\r\n @if (item().actions.length) {\r\n <div class=\"sn__actions\">\r\n @for (action of item().actions; track action.id) {\r\n <button type=\"button\" solaris-button [variant]=\"action.variant ?? 'outline'\" [color]=\"action.color ?? 'surface'\"\r\n [size]=\"action.size ?? 'sm'\" [radius]=\"action.radius ?? 'md'\" [disabled]=\"action.disabled ?? false\"\r\n (click)=\"runAction(action)\">\r\n {{ resolveActionLabel(action) }}\r\n </button>\r\n }\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n @if (mode() === 'toast' && item().duration !== null) {\r\n <div class=\"sn__footer\">\r\n @if (!paused()) {\r\n <p class=\"sn__timer\">\r\n {{ intl.autoClose(secondsLeft()) }}\r\n <button type=\"button\" class=\"sn__timer-link\" (click)=\"toggleUserPause()\">\r\n {{ intl.stopTimer() }}\r\n </button>.\r\n </p>\r\n } @else {\r\n <p class=\"sn__timer\">\r\n {{ intl.paused() }}\r\n <button type=\"button\" class=\"sn__timer-link\" (click)=\"toggleUserPause()\">\r\n {{ intl.resumeTimer() }}\r\n </button>.\r\n </p>\r\n }\r\n </div>\r\n\r\n <div class=\"sn__progress\" aria-hidden=\"true\">\r\n <span [style.width.%]=\"progress()\"></span>\r\n </div>\r\n }\r\n</article>\r\n", styles: [":host{display:block;pointer-events:auto}.sn{--sn-accent: var(--solaris-color-info);overflow:hidden;color:var(--solaris-color-text);border-radius:var(--solaris-radius-lg);background:var(--solaris-color-surface);border:.1rem solid var(--solaris-color-border);width:min(42rem,100vw - var(--solaris-space-4) * 2)}.sn[data-kind=success]{--sn-accent: var(--solaris-color-success)}.sn[data-kind=warning]{--sn-accent: var(--solaris-color-warning)}.sn[data-kind=error]{--sn-accent: var(--solaris-color-error)}.sn[data-kind=info]{--sn-accent: var(--solaris-color-info)}.sn__header{display:flex;align-items:flex-start;justify-content:space-between;gap:var(--solaris-space-3);padding:var(--solaris-space-4)}.sn[data-expanded=true] .sn__header{padding-bottom:0}.sn__leading{flex:1;min-width:0;display:flex;align-items:center;gap:var(--solaris-space-3)}.sn__icon{display:grid;flex:0 0 auto;block-size:3.2rem;inline-size:3.2rem;place-items:center;color:var(--sn-accent);border-radius:var(--solaris-radius-full)}.sn__icon .ph{line-height:1;font-size:var(--solaris-fs-24)}.sn__heading{flex:1;min-width:0}.sn__title{display:block;margin:0;font-size:var(--solaris-fs-16);letter-spacing:var(--solaris-ls-0);line-height:var(--solaris-lh-tight);font-family:var(--solaris-font-sans-primary),ui-sans-serif,system-ui}.sn__description,.sn__body-text,.sn__timer{margin:0;font-size:var(--solaris-fs-12);line-height:var(--solaris-lh-relaxed);color:var(--solaris-color-text-muted)}.sn__description--clamped{overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;margin-top:var(--solaris-space-1)}.sn__controls{flex:0 0 auto;align-items:center;display:inline-flex;gap:var(--solaris-space-1)}.sn__icon-btn{border:0;display:grid;place-items:center;inline-size:2.5rem;block-size:2.5rem;background:transparent;cursor:pointer;color:var(--solaris-color-text-muted);border-radius:var(--solaris-radius-full);transition:background-color .14s ease,color .14s ease,transform .14s ease}.sn__icon-btn:hover{color:var(--solaris-color-text);background:var(--solaris-color-surface-2)}.sn__icon-btn:focus-visible{outline-offset:.2rem;outline:.2rem solid var(--solaris-color-primary)}.sn__icon-btn .ph{line-height:1;font-size:var(--solaris-fs-18)}.sn__body{padding:0 var(--solaris-space-4) var(--solaris-space-4) calc(var(--solaris-space-4) + 3.2rem + var(--solaris-space-3))}.sn__actions{display:flex;flex-wrap:wrap;gap:var(--solaris-space-2);margin-top:var(--solaris-space-4)}.sn__footer{background:var(--solaris-color-surface-2);border-top:.1rem solid var(--solaris-color-border);padding:var(--solaris-space-3) var(--solaris-space-4)}.sn__timer-link{margin:0;padding:0;border:0;font:inherit;cursor:pointer;font-weight:700;background:transparent;color:var(--solaris-color-text)}.sn__timer-link:focus-visible{outline-offset:.2rem;border-radius:var(--solaris-radius-xs);outline:.2rem solid var(--solaris-color-primary)}.sn__progress{block-size:.4rem;background:transparent}.sn__progress>span{display:block;block-size:100%;inline-size:100%;background:var(--sn-accent);transition:width .1s linear}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: ButtonDirective, selector: "button[solaris-button], a[solaris-button]", inputs: ["size", "variant", "color", "textColor", "radius", "loading", "iconOnly", "disabled", "fullWidth", "badgeOverlay"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1697
|
+
}
|
|
1698
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: SolarisNotificationItemComponent, decorators: [{
|
|
1699
|
+
type: Component,
|
|
1700
|
+
args: [{ selector: 'solaris-notification-item', standalone: true, imports: [NgClass, ButtonDirective], changeDetection: ChangeDetectionStrategy.OnPush, template: "<article class=\"sn\" [attr.data-kind]=\"item().kind\" [attr.data-mode]=\"mode()\" [attr.data-expanded]=\"item().expanded ? 'true' : 'false'\"\r\n [attr.data-paused]=\"paused() ? 'true' : 'false'\" [attr.aria-live]=\"mode() === 'toast' ? item().ariaLive : null\"\r\n [attr.role]=\"item().ariaLive === 'assertive' ? 'alert' : 'status'\" (mouseenter)=\"onMouseEnter()\" (mouseleave)=\"onMouseLeave()\">\r\n <div class=\"sn__header\">\r\n <div class=\"sn__leading\">\r\n <span class=\"sn__icon\" aria-hidden=\"true\">\r\n <i class=\"ph\" [ngClass]=\"iconClass()\"></i>\r\n </span>\r\n\r\n <div class=\"sn__heading\">\r\n <strong class=\"sn__title\">{{ item().title }}</strong>\r\n\r\n @if (!item().expanded && item().description) {\r\n <p class=\"sn__description sn__description--clamped\">\r\n {{ item().description }}\r\n </p>\r\n }\r\n </div>\r\n </div>\r\n\r\n <div class=\"sn__controls\">\r\n @if (item().expandable && item().description) {\r\n <button type=\"button\" class=\"sn__icon-btn\" [attr.aria-expanded]=\"item().expanded\"\r\n [attr.aria-label]=\"item().expanded ? intl.collapse() : intl.expand()\" (click)=\"toggleExpanded()\">\r\n <i class=\"ph\" [ngClass]=\"item().expanded ? 'ph-caret-up' : 'ph-caret-down'\" aria-hidden=\"true\"></i>\r\n </button>\r\n }\r\n\r\n @if (item().closeable) {\r\n <button type=\"button\" class=\"sn__icon-btn\" [attr.aria-label]=\"intl.close()\" (click)=\"close()\">\r\n <i class=\"ph ph-x\" aria-hidden=\"true\"></i>\r\n </button>\r\n }\r\n </div>\r\n </div>\r\n\r\n @if (item().expanded && item().description) {\r\n <div class=\"sn__body\">\r\n <p class=\"sn__body-text\">{{ item().description }}</p>\r\n @if (item().actions.length) {\r\n <div class=\"sn__actions\">\r\n @for (action of item().actions; track action.id) {\r\n <button type=\"button\" solaris-button [variant]=\"action.variant ?? 'outline'\" [color]=\"action.color ?? 'surface'\"\r\n [size]=\"action.size ?? 'sm'\" [radius]=\"action.radius ?? 'md'\" [disabled]=\"action.disabled ?? false\"\r\n (click)=\"runAction(action)\">\r\n {{ resolveActionLabel(action) }}\r\n </button>\r\n }\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n @if (mode() === 'toast' && item().duration !== null) {\r\n <div class=\"sn__footer\">\r\n @if (!paused()) {\r\n <p class=\"sn__timer\">\r\n {{ intl.autoClose(secondsLeft()) }}\r\n <button type=\"button\" class=\"sn__timer-link\" (click)=\"toggleUserPause()\">\r\n {{ intl.stopTimer() }}\r\n </button>.\r\n </p>\r\n } @else {\r\n <p class=\"sn__timer\">\r\n {{ intl.paused() }}\r\n <button type=\"button\" class=\"sn__timer-link\" (click)=\"toggleUserPause()\">\r\n {{ intl.resumeTimer() }}\r\n </button>.\r\n </p>\r\n }\r\n </div>\r\n\r\n <div class=\"sn__progress\" aria-hidden=\"true\">\r\n <span [style.width.%]=\"progress()\"></span>\r\n </div>\r\n }\r\n</article>\r\n", styles: [":host{display:block;pointer-events:auto}.sn{--sn-accent: var(--solaris-color-info);overflow:hidden;color:var(--solaris-color-text);border-radius:var(--solaris-radius-lg);background:var(--solaris-color-surface);border:.1rem solid var(--solaris-color-border);width:min(42rem,100vw - var(--solaris-space-4) * 2)}.sn[data-kind=success]{--sn-accent: var(--solaris-color-success)}.sn[data-kind=warning]{--sn-accent: var(--solaris-color-warning)}.sn[data-kind=error]{--sn-accent: var(--solaris-color-error)}.sn[data-kind=info]{--sn-accent: var(--solaris-color-info)}.sn__header{display:flex;align-items:flex-start;justify-content:space-between;gap:var(--solaris-space-3);padding:var(--solaris-space-4)}.sn[data-expanded=true] .sn__header{padding-bottom:0}.sn__leading{flex:1;min-width:0;display:flex;align-items:center;gap:var(--solaris-space-3)}.sn__icon{display:grid;flex:0 0 auto;block-size:3.2rem;inline-size:3.2rem;place-items:center;color:var(--sn-accent);border-radius:var(--solaris-radius-full)}.sn__icon .ph{line-height:1;font-size:var(--solaris-fs-24)}.sn__heading{flex:1;min-width:0}.sn__title{display:block;margin:0;font-size:var(--solaris-fs-16);letter-spacing:var(--solaris-ls-0);line-height:var(--solaris-lh-tight);font-family:var(--solaris-font-sans-primary),ui-sans-serif,system-ui}.sn__description,.sn__body-text,.sn__timer{margin:0;font-size:var(--solaris-fs-12);line-height:var(--solaris-lh-relaxed);color:var(--solaris-color-text-muted)}.sn__description--clamped{overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;margin-top:var(--solaris-space-1)}.sn__controls{flex:0 0 auto;align-items:center;display:inline-flex;gap:var(--solaris-space-1)}.sn__icon-btn{border:0;display:grid;place-items:center;inline-size:2.5rem;block-size:2.5rem;background:transparent;cursor:pointer;color:var(--solaris-color-text-muted);border-radius:var(--solaris-radius-full);transition:background-color .14s ease,color .14s ease,transform .14s ease}.sn__icon-btn:hover{color:var(--solaris-color-text);background:var(--solaris-color-surface-2)}.sn__icon-btn:focus-visible{outline-offset:.2rem;outline:.2rem solid var(--solaris-color-primary)}.sn__icon-btn .ph{line-height:1;font-size:var(--solaris-fs-18)}.sn__body{padding:0 var(--solaris-space-4) var(--solaris-space-4) calc(var(--solaris-space-4) + 3.2rem + var(--solaris-space-3))}.sn__actions{display:flex;flex-wrap:wrap;gap:var(--solaris-space-2);margin-top:var(--solaris-space-4)}.sn__footer{background:var(--solaris-color-surface-2);border-top:.1rem solid var(--solaris-color-border);padding:var(--solaris-space-3) var(--solaris-space-4)}.sn__timer-link{margin:0;padding:0;border:0;font:inherit;cursor:pointer;font-weight:700;background:transparent;color:var(--solaris-color-text)}.sn__timer-link:focus-visible{outline-offset:.2rem;border-radius:var(--solaris-radius-xs);outline:.2rem solid var(--solaris-color-primary)}.sn__progress{block-size:.4rem;background:transparent}.sn__progress>span{display:block;block-size:100%;inline-size:100%;background:var(--sn-accent);transition:width .1s linear}\n"] }]
|
|
1701
|
+
}], propDecorators: { item: [{ type: i0.Input, args: [{ isSignal: true, alias: "item", required: true }] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }] } });
|
|
1702
|
+
|
|
1703
|
+
class SolarisNotificationCenterComponent {
|
|
1704
|
+
notificationService = inject(SolarisNotificationService);
|
|
1705
|
+
intl = inject(SolarisNotificationIntlService);
|
|
1706
|
+
onEscape() {
|
|
1707
|
+
if (this.notificationService.centerOpen()) {
|
|
1708
|
+
this.notificationService.closeCenter();
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: SolarisNotificationCenterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1712
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.1", type: SolarisNotificationCenterComponent, isStandalone: true, selector: "solaris-notification-center", host: { listeners: { "document:keydown.escape": "onEscape()" } }, ngImport: i0, template: "@if (notificationService.centerOpen()) {\r\n <div class=\"snc__backdrop\" (click)=\"notificationService.closeCenter()\"></div>\r\n\r\n <aside class=\"snc\" role=\"dialog\" aria-modal=\"true\" [attr.aria-label]=\"intl.centerTitle()\">\r\n <header class=\"snc__header\">\r\n <div>\r\n <strong class=\"snc__title\">{{ intl.centerTitle() }}</strong>\r\n </div>\r\n\r\n <div class=\"snc__controls\">\r\n <button type=\"button\" solaris-button variant=\"outline\" color=\"surface\" size=\"sm\" radius=\"md\"\r\n (click)=\"notificationService.clearHistory()\">\r\n {{ intl.clearHistory() }}\r\n </button>\r\n\r\n <button type=\"button\" class=\"snc__icon-btn\" [attr.aria-label]=\"intl.close()\" (click)=\"notificationService.closeCenter()\">\r\n <i class=\"ph ph-x\" aria-hidden=\"true\"></i>\r\n </button>\r\n </div>\r\n </header>\r\n\r\n <div class=\"snc__list\">\r\n @for (item of notificationService.centerItems(); track item.id) {\r\n <solaris-notification-item [item]=\"item\" mode=\"center\"/>\r\n } @empty {\r\n <div class=\"snc__empty\">\r\n {{ intl.emptyCenter() }}\r\n </div>\r\n }\r\n </div>\r\n </aside>\r\n}\r\n", styles: [".snc__backdrop{inset:0;position:fixed;pointer-events:auto;-webkit-backdrop-filter:blur(.2rem);backdrop-filter:blur(.2rem);background:#00000047;z-index:var(--solaris-z-overlay)}.snc{display:flex;position:fixed;overflow:hidden;pointer-events:auto;flex-direction:column;top:var(--solaris-space-4);z-index:var(--solaris-z-max);right:var(--solaris-space-4);bottom:var(--solaris-space-4);box-shadow:var(--solaris-shadow-lg);border-radius:var(--solaris-radius-lg);background:var(--solaris-color-surface);border:.1rem solid var(--solaris-color-border);width:min(46rem,100vw - var(--solaris-space-4) * 2)}.snc__header{display:flex;align-items:center;gap:var(--solaris-space-3);justify-content:space-between;padding:var(--solaris-space-4);border-bottom:.1rem solid var(--solaris-color-border)}.snc__title{font-size:var(--solaris-h-6);line-height:var(--solaris-lh-tight)}.snc__controls{display:flex;align-items:center;gap:var(--solaris-space-2)}.snc__icon-btn{border:0;display:grid;cursor:pointer;block-size:4rem;inline-size:4rem;place-items:center;background:transparent;color:var(--solaris-color-text-muted);border-radius:var(--solaris-radius-full)}.snc__icon-btn:hover{color:var(--solaris-color-text);background:var(--solaris-color-surface-2)}.snc__list{flex:1;display:flex;overflow:auto;flex-direction:column;gap:var(--solaris-space-3);padding:var(--solaris-space-4);background:var(--solaris-color-bg)}.snc__empty{display:grid;min-height:16rem;text-align:center;place-items:center;color:var(--solaris-color-text-muted)}\n"], dependencies: [{ kind: "directive", type: ButtonDirective, selector: "button[solaris-button], a[solaris-button]", inputs: ["size", "variant", "color", "textColor", "radius", "loading", "iconOnly", "disabled", "fullWidth", "badgeOverlay"] }, { kind: "component", type: SolarisNotificationItemComponent, selector: "solaris-notification-item", inputs: ["item", "mode"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1713
|
+
}
|
|
1714
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: SolarisNotificationCenterComponent, decorators: [{
|
|
1715
|
+
type: Component,
|
|
1716
|
+
args: [{ selector: 'solaris-notification-center', standalone: true, imports: [ButtonDirective, SolarisNotificationItemComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (notificationService.centerOpen()) {\r\n <div class=\"snc__backdrop\" (click)=\"notificationService.closeCenter()\"></div>\r\n\r\n <aside class=\"snc\" role=\"dialog\" aria-modal=\"true\" [attr.aria-label]=\"intl.centerTitle()\">\r\n <header class=\"snc__header\">\r\n <div>\r\n <strong class=\"snc__title\">{{ intl.centerTitle() }}</strong>\r\n </div>\r\n\r\n <div class=\"snc__controls\">\r\n <button type=\"button\" solaris-button variant=\"outline\" color=\"surface\" size=\"sm\" radius=\"md\"\r\n (click)=\"notificationService.clearHistory()\">\r\n {{ intl.clearHistory() }}\r\n </button>\r\n\r\n <button type=\"button\" class=\"snc__icon-btn\" [attr.aria-label]=\"intl.close()\" (click)=\"notificationService.closeCenter()\">\r\n <i class=\"ph ph-x\" aria-hidden=\"true\"></i>\r\n </button>\r\n </div>\r\n </header>\r\n\r\n <div class=\"snc__list\">\r\n @for (item of notificationService.centerItems(); track item.id) {\r\n <solaris-notification-item [item]=\"item\" mode=\"center\"/>\r\n } @empty {\r\n <div class=\"snc__empty\">\r\n {{ intl.emptyCenter() }}\r\n </div>\r\n }\r\n </div>\r\n </aside>\r\n}\r\n", styles: [".snc__backdrop{inset:0;position:fixed;pointer-events:auto;-webkit-backdrop-filter:blur(.2rem);backdrop-filter:blur(.2rem);background:#00000047;z-index:var(--solaris-z-overlay)}.snc{display:flex;position:fixed;overflow:hidden;pointer-events:auto;flex-direction:column;top:var(--solaris-space-4);z-index:var(--solaris-z-max);right:var(--solaris-space-4);bottom:var(--solaris-space-4);box-shadow:var(--solaris-shadow-lg);border-radius:var(--solaris-radius-lg);background:var(--solaris-color-surface);border:.1rem solid var(--solaris-color-border);width:min(46rem,100vw - var(--solaris-space-4) * 2)}.snc__header{display:flex;align-items:center;gap:var(--solaris-space-3);justify-content:space-between;padding:var(--solaris-space-4);border-bottom:.1rem solid var(--solaris-color-border)}.snc__title{font-size:var(--solaris-h-6);line-height:var(--solaris-lh-tight)}.snc__controls{display:flex;align-items:center;gap:var(--solaris-space-2)}.snc__icon-btn{border:0;display:grid;cursor:pointer;block-size:4rem;inline-size:4rem;place-items:center;background:transparent;color:var(--solaris-color-text-muted);border-radius:var(--solaris-radius-full)}.snc__icon-btn:hover{color:var(--solaris-color-text);background:var(--solaris-color-surface-2)}.snc__list{flex:1;display:flex;overflow:auto;flex-direction:column;gap:var(--solaris-space-3);padding:var(--solaris-space-4);background:var(--solaris-color-bg)}.snc__empty{display:grid;min-height:16rem;text-align:center;place-items:center;color:var(--solaris-color-text-muted)}\n"] }]
|
|
1717
|
+
}], propDecorators: { onEscape: [{
|
|
1718
|
+
type: HostListener,
|
|
1719
|
+
args: ['document:keydown.escape']
|
|
1720
|
+
}] } });
|
|
1721
|
+
|
|
1722
|
+
class SolarisNotificationHostComponent {
|
|
1723
|
+
notificationService = inject(SolarisNotificationService);
|
|
1724
|
+
positions = SOLARIS_NOTIFICATION_POSITIONS;
|
|
1725
|
+
withCenter = input(true, ...(ngDevMode ? [{ debugName: "withCenter" }] : []));
|
|
1726
|
+
visibleByPosition(position) {
|
|
1727
|
+
return this.notificationService.visibleByPosition(position);
|
|
1728
|
+
}
|
|
1729
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: SolarisNotificationHostComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1730
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.1", type: SolarisNotificationHostComponent, isStandalone: true, selector: "solaris-notification-host", inputs: { withCenter: { classPropertyName: "withCenter", publicName: "withCenter", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@for (position of positions; track position) {\r\n <section class=\"snh__stack\" [attr.data-position]=\"position\">\r\n @for (item of visibleByPosition(position); track item.id) {\r\n <solaris-notification-item [item]=\"item\" mode=\"toast\"/>\r\n }\r\n </section>\r\n}\r\n\r\n@if (withCenter()) { <solaris-notification-center/> }\r\n", styles: [":host{inset:0;position:fixed;pointer-events:none;z-index:var(--solaris-z-toast)}.snh__stack{display:flex;position:fixed;flex-direction:column;gap:var(--solaris-space-3);padding:var(--solaris-space-4);max-width:calc(100vw - var(--solaris-space-4) * 2)}.snh__stack[data-position=top-right]{top:0;right:0;align-items:flex-end}.snh__stack[data-position=top-left]{top:0;left:0;align-items:flex-start}.snh__stack[data-position=top-center]{top:0;left:50%;align-items:center;transform:translate(-50%)}.snh__stack[data-position=bottom-right]{right:0;bottom:0;align-items:flex-end}.snh__stack[data-position=bottom-left]{left:0;bottom:0;align-items:flex-start}.snh__stack[data-position=bottom-center]{left:50%;bottom:0;align-items:center;transform:translate(-50%)}\n"], dependencies: [{ kind: "component", type: SolarisNotificationItemComponent, selector: "solaris-notification-item", inputs: ["item", "mode"] }, { kind: "component", type: SolarisNotificationCenterComponent, selector: "solaris-notification-center" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1731
|
+
}
|
|
1732
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: SolarisNotificationHostComponent, decorators: [{
|
|
1733
|
+
type: Component,
|
|
1734
|
+
args: [{ selector: 'solaris-notification-host', standalone: true, imports: [SolarisNotificationItemComponent, SolarisNotificationCenterComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "@for (position of positions; track position) {\r\n <section class=\"snh__stack\" [attr.data-position]=\"position\">\r\n @for (item of visibleByPosition(position); track item.id) {\r\n <solaris-notification-item [item]=\"item\" mode=\"toast\"/>\r\n }\r\n </section>\r\n}\r\n\r\n@if (withCenter()) { <solaris-notification-center/> }\r\n", styles: [":host{inset:0;position:fixed;pointer-events:none;z-index:var(--solaris-z-toast)}.snh__stack{display:flex;position:fixed;flex-direction:column;gap:var(--solaris-space-3);padding:var(--solaris-space-4);max-width:calc(100vw - var(--solaris-space-4) * 2)}.snh__stack[data-position=top-right]{top:0;right:0;align-items:flex-end}.snh__stack[data-position=top-left]{top:0;left:0;align-items:flex-start}.snh__stack[data-position=top-center]{top:0;left:50%;align-items:center;transform:translate(-50%)}.snh__stack[data-position=bottom-right]{right:0;bottom:0;align-items:flex-end}.snh__stack[data-position=bottom-left]{left:0;bottom:0;align-items:flex-start}.snh__stack[data-position=bottom-center]{left:50%;bottom:0;align-items:center;transform:translate(-50%)}\n"] }]
|
|
1735
|
+
}], propDecorators: { withCenter: [{ type: i0.Input, args: [{ isSignal: true, alias: "withCenter", required: false }] }] } });
|
|
1736
|
+
|
|
1737
|
+
const PRESET_COLORS$1 = ['primary', 'success', 'warning', 'error', 'surface'];
|
|
1018
1738
|
class SolarisLoading {
|
|
1019
1739
|
marker = '';
|
|
1020
1740
|
label;
|
|
@@ -1092,7 +1812,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
|
|
|
1092
1812
|
args: [{ transform: coerceBoolean$1 }]
|
|
1093
1813
|
}] } });
|
|
1094
1814
|
function isPresetColor(v) {
|
|
1095
|
-
return PRESET_COLORS$
|
|
1815
|
+
return PRESET_COLORS$1.includes(v);
|
|
1096
1816
|
}
|
|
1097
1817
|
function coerceBoolean$1(v) {
|
|
1098
1818
|
return v === '' || v === true || v === 'true' || v === 1 || v === '1';
|
|
@@ -1732,226 +2452,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
|
|
|
1732
2452
|
}]
|
|
1733
2453
|
}] });
|
|
1734
2454
|
|
|
1735
|
-
const PRESET_COLORS$1 = new Set([
|
|
1736
|
-
'primary',
|
|
1737
|
-
'surface',
|
|
1738
|
-
'success',
|
|
1739
|
-
'warning',
|
|
1740
|
-
'error',
|
|
1741
|
-
'info',
|
|
1742
|
-
'gradient',
|
|
1743
|
-
]);
|
|
1744
|
-
function resolveRadius$1(v) {
|
|
1745
|
-
const s = String(v).trim();
|
|
1746
|
-
switch (s) {
|
|
1747
|
-
case 'none':
|
|
1748
|
-
return '0';
|
|
1749
|
-
case 'sm':
|
|
1750
|
-
return 'var(--solaris-radius-sm)';
|
|
1751
|
-
case 'md':
|
|
1752
|
-
return 'var(--solaris-radius-md, var(--solaris-radius-sm))';
|
|
1753
|
-
case 'lg':
|
|
1754
|
-
return 'var(--solaris-radius-lg, var(--solaris-radius-md, var(--solaris-radius-sm)))';
|
|
1755
|
-
case 'full':
|
|
1756
|
-
return 'var(--solaris-radius-full)';
|
|
1757
|
-
default:
|
|
1758
|
-
return s;
|
|
1759
|
-
}
|
|
1760
|
-
}
|
|
1761
|
-
class ButtonDirective {
|
|
1762
|
-
elementRef = inject((ElementRef));
|
|
1763
|
-
_loading = signal(false, ...(ngDevMode ? [{ debugName: "_loading" }] : []));
|
|
1764
|
-
_disabled = signal(false, ...(ngDevMode ? [{ debugName: "_disabled" }] : []));
|
|
1765
|
-
_iconOnly = signal(false, ...(ngDevMode ? [{ debugName: "_iconOnly" }] : []));
|
|
1766
|
-
_fullWidth = signal(false, ...(ngDevMode ? [{ debugName: "_fullWidth" }] : []));
|
|
1767
|
-
_badgeOverlay = signal(false, ...(ngDevMode ? [{ debugName: "_badgeOverlay" }] : []));
|
|
1768
|
-
_textColor = signal(null, ...(ngDevMode ? [{ debugName: "_textColor" }] : []));
|
|
1769
|
-
_customColor = signal(null, ...(ngDevMode ? [{ debugName: "_customColor" }] : []));
|
|
1770
|
-
_size = signal('md', ...(ngDevMode ? [{ debugName: "_size" }] : []));
|
|
1771
|
-
_variant = signal('solid', ...(ngDevMode ? [{ debugName: "_variant" }] : []));
|
|
1772
|
-
_radius = signal(null, ...(ngDevMode ? [{ debugName: "_radius" }] : []));
|
|
1773
|
-
_color = signal('primary', ...(ngDevMode ? [{ debugName: "_color" }] : []));
|
|
1774
|
-
isAnchor = computed(() => this.elementRef.nativeElement.tagName.toLowerCase() === 'a', ...(ngDevMode ? [{ debugName: "isAnchor" }] : []));
|
|
1775
|
-
set size(v) {
|
|
1776
|
-
if (v)
|
|
1777
|
-
this._size.set(v);
|
|
1778
|
-
}
|
|
1779
|
-
set variant(v) {
|
|
1780
|
-
if (v)
|
|
1781
|
-
this._variant.set(v);
|
|
1782
|
-
}
|
|
1783
|
-
set color(v) {
|
|
1784
|
-
if (v == null || String(v).trim() === '')
|
|
1785
|
-
return;
|
|
1786
|
-
const value = String(v).trim();
|
|
1787
|
-
if (PRESET_COLORS$1.has(value)) {
|
|
1788
|
-
this._color.set(value);
|
|
1789
|
-
this._customColor.set(null);
|
|
1790
|
-
}
|
|
1791
|
-
else {
|
|
1792
|
-
this._color.set('custom');
|
|
1793
|
-
this._customColor.set(value);
|
|
1794
|
-
}
|
|
1795
|
-
}
|
|
1796
|
-
set textColor(v) {
|
|
1797
|
-
const value = v == null || String(v).trim() === '' ? null : String(v).trim();
|
|
1798
|
-
this._textColor.set(value);
|
|
1799
|
-
}
|
|
1800
|
-
set radius(v) {
|
|
1801
|
-
const value = v == null || String(v).trim() === '' ? null : (v);
|
|
1802
|
-
this._radius.set(value);
|
|
1803
|
-
}
|
|
1804
|
-
set loading(v) {
|
|
1805
|
-
this._loading.set(v);
|
|
1806
|
-
}
|
|
1807
|
-
set iconOnly(v) {
|
|
1808
|
-
this._iconOnly.set(v);
|
|
1809
|
-
}
|
|
1810
|
-
set disabled(v) {
|
|
1811
|
-
this._disabled.set(v);
|
|
1812
|
-
}
|
|
1813
|
-
set fullWidth(v) {
|
|
1814
|
-
this._fullWidth.set(v);
|
|
1815
|
-
}
|
|
1816
|
-
set badgeOverlay(v) {
|
|
1817
|
-
this._badgeOverlay.set(v);
|
|
1818
|
-
}
|
|
1819
|
-
attr = '';
|
|
1820
|
-
get tabIndex() {
|
|
1821
|
-
return this.isAnchor() && (this._disabled() || this._loading()) ? -1 : null;
|
|
1822
|
-
}
|
|
1823
|
-
get ariaBusy() {
|
|
1824
|
-
return this._loading() ? 'true' : null;
|
|
1825
|
-
}
|
|
1826
|
-
get dataSize() {
|
|
1827
|
-
return this._size();
|
|
1828
|
-
}
|
|
1829
|
-
get dataColor() {
|
|
1830
|
-
return this._color();
|
|
1831
|
-
}
|
|
1832
|
-
get nativeDisabled() {
|
|
1833
|
-
const isButton = !this.isAnchor();
|
|
1834
|
-
return isButton && (this._disabled() || this._loading()) ? '' : null;
|
|
1835
|
-
}
|
|
1836
|
-
get dataVariant() {
|
|
1837
|
-
return this._variant();
|
|
1838
|
-
}
|
|
1839
|
-
get ariaDisabled() {
|
|
1840
|
-
return this.isAnchor() && (this._disabled() || this._loading()) ? 'true' : null;
|
|
1841
|
-
}
|
|
1842
|
-
get dataIconOnly() {
|
|
1843
|
-
return this._iconOnly() ? 'true' : null;
|
|
1844
|
-
}
|
|
1845
|
-
get dataFullWidth() {
|
|
1846
|
-
return this._fullWidth() ? 'true' : null;
|
|
1847
|
-
}
|
|
1848
|
-
get customColorValue() {
|
|
1849
|
-
return this._customColor() ?? null;
|
|
1850
|
-
}
|
|
1851
|
-
get dataCustomInk() {
|
|
1852
|
-
return this._textColor() ? 'true' : null;
|
|
1853
|
-
}
|
|
1854
|
-
get customInkValue() {
|
|
1855
|
-
return this._textColor() ?? null;
|
|
1856
|
-
}
|
|
1857
|
-
get dataBadgeOverlay() {
|
|
1858
|
-
return this._badgeOverlay() ? 'true' : null;
|
|
1859
|
-
}
|
|
1860
|
-
get buttonRadius() {
|
|
1861
|
-
return this._radius() ? resolveRadius$1(this._radius()) : null;
|
|
1862
|
-
}
|
|
1863
|
-
onClick(ev) {
|
|
1864
|
-
if (!this.isAnchor())
|
|
1865
|
-
return;
|
|
1866
|
-
if (this._disabled() || this._loading()) {
|
|
1867
|
-
ev.preventDefault();
|
|
1868
|
-
ev.stopImmediatePropagation();
|
|
1869
|
-
}
|
|
1870
|
-
}
|
|
1871
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: ButtonDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1872
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "21.1.1", type: ButtonDirective, isStandalone: true, selector: "button[solaris-button], a[solaris-button]", inputs: { size: "size", variant: "variant", color: "color", textColor: "textColor", radius: "radius", loading: ["loading", "loading", booleanAttribute], iconOnly: ["iconOnly", "iconOnly", booleanAttribute], disabled: ["disabled", "disabled", booleanAttribute], fullWidth: ["fullWidth", "fullWidth", booleanAttribute], badgeOverlay: ["badgeOverlay", "badgeOverlay", booleanAttribute] }, host: { listeners: { "click": "onClick($event)" }, properties: { "attr.solaris-button": "this.attr", "attr.tabindex": "this.tabIndex", "attr.aria-busy": "this.ariaBusy", "attr.data-size": "this.dataSize", "attr.data-color": "this.dataColor", "attr.disabled": "this.nativeDisabled", "attr.data-variant": "this.dataVariant", "attr.aria-disabled": "this.ariaDisabled", "attr.data-icon-only": "this.dataIconOnly", "attr.data-full-width": "this.dataFullWidth", "style.--sb-custom": "this.customColorValue", "attr.data-custom-ink": "this.dataCustomInk", "style.--sb-custom-ink": "this.customInkValue", "attr.data-badge-overlay": "this.dataBadgeOverlay", "style.--solaris-button-radius": "this.buttonRadius" } }, ngImport: i0 });
|
|
1873
|
-
}
|
|
1874
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: ButtonDirective, decorators: [{
|
|
1875
|
-
type: Directive,
|
|
1876
|
-
args: [{
|
|
1877
|
-
selector: 'button[solaris-button], a[solaris-button]',
|
|
1878
|
-
standalone: true,
|
|
1879
|
-
}]
|
|
1880
|
-
}], propDecorators: { size: [{
|
|
1881
|
-
type: Input
|
|
1882
|
-
}], variant: [{
|
|
1883
|
-
type: Input
|
|
1884
|
-
}], color: [{
|
|
1885
|
-
type: Input
|
|
1886
|
-
}], textColor: [{
|
|
1887
|
-
type: Input
|
|
1888
|
-
}], radius: [{
|
|
1889
|
-
type: Input
|
|
1890
|
-
}], loading: [{
|
|
1891
|
-
type: Input,
|
|
1892
|
-
args: [{ transform: booleanAttribute }]
|
|
1893
|
-
}], iconOnly: [{
|
|
1894
|
-
type: Input,
|
|
1895
|
-
args: [{ transform: booleanAttribute }]
|
|
1896
|
-
}], disabled: [{
|
|
1897
|
-
type: Input,
|
|
1898
|
-
args: [{ transform: booleanAttribute }]
|
|
1899
|
-
}], fullWidth: [{
|
|
1900
|
-
type: Input,
|
|
1901
|
-
args: [{ transform: booleanAttribute }]
|
|
1902
|
-
}], badgeOverlay: [{
|
|
1903
|
-
type: Input,
|
|
1904
|
-
args: [{ transform: booleanAttribute }]
|
|
1905
|
-
}], attr: [{
|
|
1906
|
-
type: HostBinding,
|
|
1907
|
-
args: ['attr.solaris-button']
|
|
1908
|
-
}], tabIndex: [{
|
|
1909
|
-
type: HostBinding,
|
|
1910
|
-
args: ['attr.tabindex']
|
|
1911
|
-
}], ariaBusy: [{
|
|
1912
|
-
type: HostBinding,
|
|
1913
|
-
args: ['attr.aria-busy']
|
|
1914
|
-
}], dataSize: [{
|
|
1915
|
-
type: HostBinding,
|
|
1916
|
-
args: ['attr.data-size']
|
|
1917
|
-
}], dataColor: [{
|
|
1918
|
-
type: HostBinding,
|
|
1919
|
-
args: ['attr.data-color']
|
|
1920
|
-
}], nativeDisabled: [{
|
|
1921
|
-
type: HostBinding,
|
|
1922
|
-
args: ['attr.disabled']
|
|
1923
|
-
}], dataVariant: [{
|
|
1924
|
-
type: HostBinding,
|
|
1925
|
-
args: ['attr.data-variant']
|
|
1926
|
-
}], ariaDisabled: [{
|
|
1927
|
-
type: HostBinding,
|
|
1928
|
-
args: ['attr.aria-disabled']
|
|
1929
|
-
}], dataIconOnly: [{
|
|
1930
|
-
type: HostBinding,
|
|
1931
|
-
args: ['attr.data-icon-only']
|
|
1932
|
-
}], dataFullWidth: [{
|
|
1933
|
-
type: HostBinding,
|
|
1934
|
-
args: ['attr.data-full-width']
|
|
1935
|
-
}], customColorValue: [{
|
|
1936
|
-
type: HostBinding,
|
|
1937
|
-
args: ['style.--sb-custom']
|
|
1938
|
-
}], dataCustomInk: [{
|
|
1939
|
-
type: HostBinding,
|
|
1940
|
-
args: ['attr.data-custom-ink']
|
|
1941
|
-
}], customInkValue: [{
|
|
1942
|
-
type: HostBinding,
|
|
1943
|
-
args: ['style.--sb-custom-ink']
|
|
1944
|
-
}], dataBadgeOverlay: [{
|
|
1945
|
-
type: HostBinding,
|
|
1946
|
-
args: ['attr.data-badge-overlay']
|
|
1947
|
-
}], buttonRadius: [{
|
|
1948
|
-
type: HostBinding,
|
|
1949
|
-
args: ['style.--solaris-button-radius']
|
|
1950
|
-
}], onClick: [{
|
|
1951
|
-
type: HostListener,
|
|
1952
|
-
args: ['click', ['$event']]
|
|
1953
|
-
}] } });
|
|
1954
|
-
|
|
1955
2455
|
class SolarisFilterPanel {
|
|
1956
2456
|
count = 0;
|
|
1957
2457
|
labelKey = '';
|
|
@@ -4768,5 +5268,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
|
|
|
4768
5268
|
* Generated bundle index. Do not edit.
|
|
4769
5269
|
*/
|
|
4770
5270
|
|
|
4771
|
-
export { ButtonDirective, ButtonGroupDirective, FieldErrorComponent, FormField, InputTextDirective, PasswordToggle, SOLARIS_FORM_FIELD_CONTROLLER, SOLARIS_FORM_FIELD_FEATURES, SOLARIS_INPUT, SolarisBadge, SolarisBodyDirective, SolarisBreadcrumb, SolarisCheckbox, SolarisColumnCellDef, SolarisColumnHeaderDef, SolarisControlBridgeDirective, SolarisDivider, SolarisDrawer, SolarisDrawerFooterDirective, SolarisDrawerHeaderDirective, SolarisDropdownContent, SolarisDropdownContentPanelDirective, SolarisDropdownContentRegistry, SolarisDropdownContentTriggerDirective, SolarisEmailDirective, SolarisFilterBar, SolarisFilterChip, SolarisFilterField, SolarisFilterPanel, SolarisFilterPanelFooterDirective, SolarisFooterDirective, SolarisFormFieldController, SolarisHeaderDirective, SolarisIdGenerator, SolarisImageSliderComponent, SolarisLoading, SolarisLoadingOverlay, SolarisPage, SolarisPageHeader, SolarisPageHeaderBreadcrumbDirective, SolarisPageHeaderDescriptionDirective, SolarisPageHeaderTitle, SolarisPageHeaderTitleDirective, SolarisPasswordDirective, SolarisPhoneInput, SolarisPopover, SolarisPopoverPanelDirective, SolarisPopoverTriggerDirective, SolarisPrefixDirective, SolarisRowComponent, SolarisSectionComponent, SolarisSelect, SolarisSuffixDirective, SolarisTab, SolarisTable, SolarisTableColumn, SolarisTableFilters, SolarisTableSkeleton, SolarisTabs, computePopoverPosition, uniqueId };
|
|
5271
|
+
export { ButtonDirective, ButtonGroupDirective, FieldErrorComponent, FormField, InputTextDirective, PasswordToggle, SOLARIS_FORM_FIELD_CONTROLLER, SOLARIS_FORM_FIELD_FEATURES, SOLARIS_INPUT, SOLARIS_NOTIFICATION_CONFIG, SOLARIS_NOTIFICATION_DEFAULT_CONFIG, SOLARIS_NOTIFICATION_POSITIONS, SolarisBadge, SolarisBodyDirective, SolarisBreadcrumb, SolarisCheckbox, SolarisColumnCellDef, SolarisColumnHeaderDef, SolarisControlBridgeDirective, SolarisDivider, SolarisDrawer, SolarisDrawerFooterDirective, SolarisDrawerHeaderDirective, SolarisDropdownContent, SolarisDropdownContentPanelDirective, SolarisDropdownContentRegistry, SolarisDropdownContentTriggerDirective, SolarisEmailDirective, SolarisFilterBar, SolarisFilterChip, SolarisFilterField, SolarisFilterPanel, SolarisFilterPanelFooterDirective, SolarisFooterDirective, SolarisFormFieldController, SolarisHeaderDirective, SolarisIdGenerator, SolarisImageSliderComponent, SolarisLoading, SolarisLoadingOverlay, SolarisNotificationCenterComponent, SolarisNotificationHostComponent, SolarisNotificationIntlService, SolarisNotificationItemComponent, SolarisNotificationService, SolarisPage, SolarisPageHeader, SolarisPageHeaderBreadcrumbDirective, SolarisPageHeaderDescriptionDirective, SolarisPageHeaderTitle, SolarisPageHeaderTitleDirective, SolarisPasswordDirective, SolarisPhoneInput, SolarisPopover, SolarisPopoverPanelDirective, SolarisPopoverTriggerDirective, SolarisPrefixDirective, SolarisRowComponent, SolarisSectionComponent, SolarisSelect, SolarisSuffixDirective, SolarisTab, SolarisTable, SolarisTableColumn, SolarisTableFilters, SolarisTableSkeleton, SolarisTabs, computePopoverPosition, provideSolarisNotifications, uniqueId };
|
|
4772
5272
|
//# sourceMappingURL=educarehq-solaris-components.mjs.map
|