@clr/angular 17.0.0-beta.3 → 17.0.0-beta.4

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,8 +2,8 @@ import * as i0 from '@angular/core';
2
2
  import { Directive, NgModule, Optional, Input, Injectable, Component, ChangeDetectionStrategy, EventEmitter, HostBinding, Output, ContentChildren, PLATFORM_ID, Inject, ViewChild, HostListener, SkipSelf, Renderer2, InjectionToken, ElementRef, ContentChild, ComponentFactoryResolver, KeyValueDiffers, Self, Attribute, LOCALE_ID, ViewContainerRef, NgZone, ChangeDetectorRef, TemplateRef } from '@angular/core';
3
3
  import * as i5 from '@angular/common';
4
4
  import { CommonModule, isPlatformBrowser, DOCUMENT, NgForOf, getLocaleDayNames, FormStyle, TranslationWidth, getLocaleMonthNames, getLocaleFirstDayOfWeek, getLocaleDateFormat, FormatWidth } from '@angular/common';
5
- import { ClarityIcons, angleIcon, exclamationCircleIcon, checkCircleIcon, ellipsisHorizontalIcon, windowCloseIcon, eventIcon, calendarIcon, eyeHideIcon, eyeIcon, ellipsisVerticalIcon, viewColumnsIcon, arrowIcon, timesIcon, stepForward2Icon, angleDoubleIcon, filterGridCircleIcon, filterGridIcon, infoCircleIcon, exclamationTriangleIcon, circleIcon, dotCircleIcon, errorStandardIcon, successStandardIcon } from '@cds/core/icon';
6
- import { map, tap, startWith, distinctUntilChanged, pairwise, filter, debounceTime, takeUntil, take, first, switchMap } from 'rxjs/operators';
5
+ import { ClarityIcons, angleIcon, exclamationCircleIcon, checkCircleIcon, ellipsisHorizontalIcon, windowCloseIcon, eventIcon, calendarIcon, eyeHideIcon, eyeIcon, ellipsisVerticalIcon, viewColumnsIcon, arrowIcon, timesIcon, stepForward2Icon, angleDoubleIcon, filterGridCircleIcon, filterGridIcon, errorStandardIcon, helpIcon, infoStandardIcon, noteIcon, successStandardIcon, warningStandardIcon, infoCircleIcon, circleIcon, dotCircleIcon } from '@cds/core/icon';
6
+ import { map, tap, startWith, distinctUntilChanged, filter, skipUntil, debounceTime, takeUntil, take, first, switchMap } from 'rxjs/operators';
7
7
  import * as i3 from 'rxjs';
8
8
  import { Subject, BehaviorSubject, Observable, fromEvent, isObservable, of, ReplaySubject, combineLatest, merge } from 'rxjs';
9
9
  import { trigger, transition, style, animate, state, keyframes } from '@angular/animations';
@@ -363,8 +363,8 @@ const commonStringsDefault = {
363
363
  * Password Input
364
364
  * Screen-reader text for the hide/show password field button
365
365
  */
366
- passwordHide: 'Hide password',
367
- passwordShow: 'Show password',
366
+ passwordHide: 'Hide password for {LABEL}',
367
+ passwordShow: 'Show password for {LABEL}',
368
368
  /**
369
369
  * Datagrid footer; sr-only text after the number of selected rows.
370
370
  */
@@ -947,6 +947,12 @@ class StepperModel extends AccordionModel {
947
947
  }
948
948
  });
949
949
  }
950
+ setPanelValid(panelId) {
951
+ this._panels[panelId].status = AccordionStatus.Complete;
952
+ }
953
+ setPanelInvalid(panelId) {
954
+ this._panels[panelId].status = AccordionStatus.Error;
955
+ }
950
956
  setPanelsWithErrors(ids) {
951
957
  ids.forEach(id => this.setPanelError(id));
952
958
  }
@@ -1030,6 +1036,14 @@ class StepperService extends AccordionService {
1030
1036
  this.accordion.resetPanels();
1031
1037
  this.emitUpdatedPanels();
1032
1038
  }
1039
+ setPanelValid(panelId) {
1040
+ this.accordion.setPanelValid(panelId);
1041
+ this.emitUpdatedPanels();
1042
+ }
1043
+ setPanelInvalid(panelId) {
1044
+ this.accordion.setPanelInvalid(panelId);
1045
+ this.emitUpdatedPanels();
1046
+ }
1033
1047
  setPanelsWithErrors(ids) {
1034
1048
  this.accordion.setPanelsWithErrors(ids);
1035
1049
  this.emitUpdatedPanels();
@@ -1092,11 +1106,16 @@ class ClrStepperPanel extends ClrAccordionPanel {
1092
1106
  this.panel = this.panel.pipe(tap(panel => this.triggerAllFormControlValidationIfError(panel)));
1093
1107
  this.stepperService.disablePanel(this.id, true);
1094
1108
  this.listenToFocusChanges();
1109
+ // not all stepper panels are guaranteed to have a form (i.e. empty template-driven)
1095
1110
  if (this.formGroup) {
1096
- // not all stepper panels are guaranteed to have a form (i.e. empty template-driven)
1097
- this.subscriptions.push(this.formGroup.statusChanges.pipe(pairwise()).subscribe(([prevStatus, newStatus]) => {
1098
- if ('VALID' === prevStatus && 'INVALID' === newStatus) {
1099
- this.stepperService.navigateToNextPanel(this.id, this.formGroup.valid);
1111
+ // set panel status on form status change only after the form becomes invalid
1112
+ const invalidStatusTrigger = this.formGroup.statusChanges.pipe(filter(status => status === 'INVALID'));
1113
+ this.subscriptions.push(this.formGroup.statusChanges.pipe(skipUntil(invalidStatusTrigger), distinctUntilChanged()).subscribe(status => {
1114
+ if (status === 'VALID') {
1115
+ this.stepperService.setPanelValid(this.id);
1116
+ }
1117
+ else if (status === 'INVALID') {
1118
+ this.stepperService.setPanelInvalid(this.id);
1100
1119
  }
1101
1120
  }));
1102
1121
  }
@@ -7157,25 +7176,24 @@ class ClrOptionItems {
7157
7176
  if (!this._rawItems || this.filter === undefined || this.filter === null) {
7158
7177
  return;
7159
7178
  }
7179
+ const normalizedFilterValue = normalizeValue(this.filter);
7160
7180
  if (this.optionService.showAllOptions) {
7161
7181
  this.filteredItems = this._rawItems;
7162
7182
  }
7163
7183
  else if (this._filterField) {
7164
7184
  this.filteredItems = this._rawItems.filter(item => {
7165
7185
  const objValue = item[this._filterField];
7166
- return objValue ? objValue.toString().toLowerCase().indexOf(this.filter.toLowerCase().toString()) > -1 : false;
7186
+ return objValue ? normalizeValue(objValue).includes(normalizedFilterValue) : false;
7167
7187
  });
7168
7188
  }
7169
7189
  else {
7170
7190
  // Filter by all item object values
7171
7191
  this.filteredItems = this._rawItems.filter(item => {
7172
7192
  if (typeof item !== 'object') {
7173
- return item.toString().toLowerCase().indexOf(this.filter.toString().toLowerCase()) > -1;
7193
+ return normalizeValue(item).includes(normalizedFilterValue);
7174
7194
  }
7175
7195
  const objValues = Object.values(item).filter(value => {
7176
- return value !== null && value !== undefined
7177
- ? value.toString().toLowerCase().indexOf(this.filter.toString().toLowerCase()) > -1
7178
- : false;
7196
+ return value !== null && value !== undefined ? normalizeValue(value).includes(normalizedFilterValue) : false;
7179
7197
  });
7180
7198
  return objValues.length > 0;
7181
7199
  });
@@ -7200,6 +7218,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImpor
7200
7218
  type: Input,
7201
7219
  args: ['clrOptionItemsField']
7202
7220
  }] } });
7221
+ function normalizeValue(value) {
7222
+ return value
7223
+ .toString()
7224
+ .normalize('NFD')
7225
+ .replace(/\p{Diacritic}/gu, '')
7226
+ .toLowerCase();
7227
+ }
7203
7228
 
7204
7229
  /*
7205
7230
  * Copyright (c) 2016-2023 VMware, Inc. All Rights Reserved.
@@ -9996,6 +10021,12 @@ class ClrPasswordContainer extends ClrAbstractContainer {
9996
10021
  this.show = !this.show;
9997
10022
  this.toggleService.next(this.show);
9998
10023
  }
10024
+ showPasswordText(label) {
10025
+ return this.commonStrings.parse(this.commonStrings.keys.passwordShow, { LABEL: label });
10026
+ }
10027
+ hidePasswordText(label) {
10028
+ return this.commonStrings.parse(this.commonStrings.keys.passwordHide, { LABEL: label });
10029
+ }
9999
10030
  }
10000
10031
  ClrPasswordContainer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: ClrPasswordContainer, deps: [{ token: IfControlStateService }, { token: LayoutService, optional: true }, { token: ControlClassService }, { token: NgControlService }, { token: FocusService }, { token: TOGGLE_SERVICE }, { token: ClrCommonStringsService }], target: i0.ɵɵFactoryTarget.Component });
10001
10032
  ClrPasswordContainer.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.2", type: ClrPasswordContainer, selector: "clr-password-container", inputs: { clrToggle: "clrToggle" }, host: { properties: { "class.clr-form-control": "true", "class.clr-form-control-disabled": "control?.disabled", "class.clr-row": "addGrid()" } }, providers: [
@@ -10021,7 +10052,7 @@ ClrPasswordContainer.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", v
10021
10052
  >
10022
10053
  <cds-icon class="clr-password-eye-icon" [attr.shape]="show ? 'eye-hide' : 'eye'"></cds-icon>
10023
10054
  <span class="clr-sr-only">
10024
- {{ show ? commonStrings.keys.passwordHide : commonStrings.keys.passwordShow }}
10055
+ {{ show ? hidePasswordText(label?.labelText) : showPasswordText(label?.labelText) }}
10025
10056
  </span>
10026
10057
  </button>
10027
10058
  </div>
@@ -10065,7 +10096,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImpor
10065
10096
  >
10066
10097
  <cds-icon class="clr-password-eye-icon" [attr.shape]="show ? 'eye-hide' : 'eye'"></cds-icon>
10067
10098
  <span class="clr-sr-only">
10068
- {{ show ? commonStrings.keys.passwordHide : commonStrings.keys.passwordShow }}
10099
+ {{ show ? hidePasswordText(label?.labelText) : showPasswordText(label?.labelText) }}
10069
10100
  </span>
10070
10101
  </button>
10071
10102
  </div>
@@ -13549,6 +13580,7 @@ class ClrSignpostTrigger {
13549
13580
  this.signpostIdService = signpostIdService;
13550
13581
  this.signpostFocusManager = signpostFocusManager;
13551
13582
  this.platformId = platformId;
13583
+ this.ariaExpanded = false;
13552
13584
  this.subscriptions = [];
13553
13585
  this.document = document;
13554
13586
  }
@@ -19671,7 +19703,7 @@ const ALERT_TYPES = ['info', 'warning', 'danger', 'success', 'neutral', 'unknown
19671
19703
  class AlertIconAndTypesService {
19672
19704
  constructor(commonStrings) {
19673
19705
  this.commonStrings = commonStrings;
19674
- this.defaultIconShape = 'info-circle';
19706
+ this.defaultIconShape = 'info-standard';
19675
19707
  this._alertIconShape = '';
19676
19708
  this._alertType = 'info';
19677
19709
  }
@@ -19704,22 +19736,22 @@ class AlertIconAndTypesService {
19704
19736
  const returnObj = { shape: '', cssClass: '', title: '' };
19705
19737
  switch (type) {
19706
19738
  case 'warning':
19707
- returnObj.shape = 'exclamation-triangle';
19739
+ returnObj.shape = 'warning-standard';
19708
19740
  returnObj.cssClass = 'alert-warning';
19709
19741
  returnObj.title = this.commonStrings.keys.warning;
19710
19742
  break;
19711
19743
  case 'danger':
19712
- returnObj.shape = 'exclamation-circle';
19744
+ returnObj.shape = 'error-standard';
19713
19745
  returnObj.cssClass = 'alert-danger';
19714
19746
  returnObj.title = this.commonStrings.keys.danger;
19715
19747
  break;
19716
19748
  case 'success':
19717
- returnObj.shape = 'check-circle';
19749
+ returnObj.shape = 'success-standard';
19718
19750
  returnObj.cssClass = 'alert-success';
19719
19751
  returnObj.title = this.commonStrings.keys.success;
19720
19752
  break;
19721
19753
  case 'neutral':
19722
- returnObj.shape = 'note-edit';
19754
+ returnObj.shape = 'note';
19723
19755
  returnObj.cssClass = 'alert-neutral';
19724
19756
  returnObj.title = this.commonStrings.keys.neutral;
19725
19757
  break;
@@ -19918,11 +19950,7 @@ class ClrAlert {
19918
19950
  this.subscriptions.forEach(sub => sub.unsubscribe());
19919
19951
  }
19920
19952
  configAlertType(val) {
19921
- let innerVal = val;
19922
- if (!this._isLightweight && (innerVal === 'loading' || innerVal === 'unknown')) {
19923
- innerVal = 'info';
19924
- }
19925
- this.iconService.alertType = innerVal;
19953
+ this.iconService.alertType = val;
19926
19954
  }
19927
19955
  open() {
19928
19956
  this._closed = false;
@@ -20226,7 +20254,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImpor
20226
20254
  const CLR_ALERT_DIRECTIVES = [ClrAlert, ClrAlertItem, ClrAlerts, ClrAlertsPager, ClrAlertText];
20227
20255
  class ClrAlertModule {
20228
20256
  constructor() {
20229
- ClarityIcons.addIcons(checkCircleIcon, infoCircleIcon, exclamationCircleIcon, exclamationTriangleIcon, windowCloseIcon);
20257
+ ClarityIcons.addIcons(errorStandardIcon, helpIcon, infoStandardIcon, noteIcon, successStandardIcon, warningStandardIcon, windowCloseIcon);
20230
20258
  }
20231
20259
  }
20232
20260
  ClrAlertModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: ClrAlertModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });