@descope/web-components-ui 1.97.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.
package/dist/index.esm.js CHANGED
@@ -5339,9 +5339,13 @@ const weekdays = [
5339
5339
  ];
5340
5340
 
5341
5341
  const counterConfig = {
5342
- MONTH: { id: 'month', min: 1, max: 12, placeholder: 'MM', count: 5, shiftCount: 10 },
5343
- DAY: { id: 'day', min: 1, max: 31, placeholder: 'DD', count: 5, shiftCount: 10 },
5344
- YEAR: { id: 'year', min: 1900, max: 2099, placeholder: 'YYYY', count: 10, shiftCount: 100 },
5342
+ MONTH: { id: 'month', min: 1, max: 12, placeholder: 'MM' },
5343
+ DAY: { id: 'day', min: 1, max: 31, placeholder: 'DD' },
5344
+ YEAR: { id: 'year', min: 0, max: 9999, placeholder: 'YYYY' },
5345
+ };
5346
+
5347
+ const valRange = {
5348
+ year: { min: 1900, max: 2099 },
5345
5349
  };
5346
5350
 
5347
5351
  const BUTTON_LABEL_DONE = 'Done';
@@ -7208,16 +7212,6 @@ class RawDateFieldClass extends BaseInputClass$a {
7208
7212
  });
7209
7213
  }
7210
7214
 
7211
- setYearRange(val) {
7212
- if (!val) return;
7213
- const [min, max] = val.split?.('-');
7214
- if (min && max) {
7215
- const counter = this.getCounterById('year');
7216
- counter.setMin(min);
7217
- counter.setMax(max);
7218
- }
7219
- }
7220
-
7221
7215
  togglePopoverAccess(visibility) {
7222
7216
  if (visibility) {
7223
7217
  this.popoverToggleButton.classList.remove('hidden');
@@ -7230,9 +7224,6 @@ class RawDateFieldClass extends BaseInputClass$a {
7230
7224
  super.attributeChangedCallback?.(attrName, oldValue, newValue);
7231
7225
 
7232
7226
  if (oldValue !== newValue) {
7233
- if (attrName === 'years-range') {
7234
- this.setYearRange(newValue);
7235
- }
7236
7227
  if (attrName === 'disable-calendar') {
7237
7228
  this.togglePopoverAccess(newValue !== 'true');
7238
7229
  }
@@ -7258,9 +7249,17 @@ class RawDateFieldClass extends BaseInputClass$a {
7258
7249
  // To prevent this error from being submitted, we evaluate the
7259
7250
  // date parts against their generated Date value.
7260
7251
  isInvalidDate() {
7261
- return Object.entries(this.getDateVals()).some(
7262
- ([key, val]) => !val || this.getCounterById(key).numberValue !== val
7263
- );
7252
+ const yearCounter = this.getCounterById('year');
7253
+ const isYearOutOfRange =
7254
+ yearCounter.numberValue > valRange['year'].max ||
7255
+ yearCounter.numberValue < valRange['year'].min;
7256
+
7257
+ const isDateDisplayMismatch = Object.entries(this.getDateVals()).some(([key, val]) => {
7258
+ const counter = this.getCounterById(key);
7259
+ return !val || counter.numberValue !== val;
7260
+ });
7261
+
7262
+ return isYearOutOfRange || isDateDisplayMismatch;
7264
7263
  }
7265
7264
 
7266
7265
  getValidity() {