@descope/web-components-ui 1.96.0 → 1.98.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.
@@ -15681,9 +15681,13 @@ const weekdays = [
15681
15681
  ];
15682
15682
 
15683
15683
  const counterConfig = {
15684
- MONTH: { id: 'month', min: 1, max: 12, placeholder: 'MM', count: 5, shiftCount: 10 },
15685
- DAY: { id: 'day', min: 1, max: 31, placeholder: 'DD', count: 5, shiftCount: 10 },
15686
- YEAR: { id: 'year', min: 1900, max: 2099, placeholder: 'YYYY', count: 10, shiftCount: 100 },
15684
+ MONTH: { id: 'month', min: 1, max: 12, placeholder: 'MM' },
15685
+ DAY: { id: 'day', min: 1, max: 31, placeholder: 'DD' },
15686
+ YEAR: { id: 'year', min: 0, max: 9999, placeholder: 'YYYY' },
15687
+ };
15688
+
15689
+ const valRange = {
15690
+ year: { min: 1900, max: 2099 },
15687
15691
  };
15688
15692
 
15689
15693
  const BUTTON_LABEL_DONE = 'Done';
@@ -16695,7 +16699,10 @@ class DateCounter {
16695
16699
 
16696
16700
  data = [...data, num];
16697
16701
 
16698
- if (this.numberValue > this.max) {
16702
+ // we need to re-evaluate the number value
16703
+ const numVal = Number(data.join(''));
16704
+
16705
+ if (numVal > this.max) {
16699
16706
  data = [num];
16700
16707
  } else if (this.length < data.length) {
16701
16708
  data = data.slice(1, data.length);
@@ -17184,10 +17191,11 @@ class RawDateFieldClass extends BaseInputClass$1 {
17184
17191
 
17185
17192
  if (!this.inputElement.value) {
17186
17193
  this.inputElement.value = this.format;
17187
- // If no value, on focus select the first part of the format placeholder
17188
- this.selectedCounterIdx = 0;
17189
- this.setInputSelectionRange();
17190
17194
  }
17195
+
17196
+ // On focus select the first part of the format placeholder
17197
+ this.selectedCounterIdx = 0;
17198
+ this.setInputSelectionRange();
17191
17199
  }
17192
17200
 
17193
17201
  onBlur() {
@@ -17353,16 +17361,6 @@ class RawDateFieldClass extends BaseInputClass$1 {
17353
17361
  });
17354
17362
  }
17355
17363
 
17356
- setYearRange(val) {
17357
- if (!val) return;
17358
- const [min, max] = val.split?.('-');
17359
- if (min && max) {
17360
- const counter = this.getCounterById('year');
17361
- counter.setMin(min);
17362
- counter.setMax(max);
17363
- }
17364
- }
17365
-
17366
17364
  togglePopoverAccess(visibility) {
17367
17365
  if (visibility) {
17368
17366
  this.popoverToggleButton.classList.remove('hidden');
@@ -17375,9 +17373,6 @@ class RawDateFieldClass extends BaseInputClass$1 {
17375
17373
  super.attributeChangedCallback?.(attrName, oldValue, newValue);
17376
17374
 
17377
17375
  if (oldValue !== newValue) {
17378
- if (attrName === 'years-range') {
17379
- this.setYearRange(newValue);
17380
- }
17381
17376
  if (attrName === 'disable-calendar') {
17382
17377
  this.togglePopoverAccess(newValue !== 'true');
17383
17378
  }
@@ -17403,9 +17398,17 @@ class RawDateFieldClass extends BaseInputClass$1 {
17403
17398
  // To prevent this error from being submitted, we evaluate the
17404
17399
  // date parts against their generated Date value.
17405
17400
  isInvalidDate() {
17406
- return Object.entries(this.getDateVals()).some(
17407
- ([key, val]) => !val || this.getCounterById(key).numberValue !== val
17408
- );
17401
+ const yearCounter = this.getCounterById('year');
17402
+ const isYearOutOfRange =
17403
+ yearCounter.numberValue > valRange['year'].max ||
17404
+ yearCounter.numberValue < valRange['year'].min;
17405
+
17406
+ const isDateDisplayMismatch = Object.entries(this.getDateVals()).some(([key, val]) => {
17407
+ const counter = this.getCounterById(key);
17408
+ return !val || counter.numberValue !== val;
17409
+ });
17410
+
17411
+ return isYearOutOfRange || isDateDisplayMismatch;
17409
17412
  }
17410
17413
 
17411
17414
  getValidity() {