@nova-design-system/nova-webcomponents 3.9.0 → 3.9.1

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.
Files changed (48) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/native.cjs.js +1 -1
  3. package/dist/cjs/nv-calendar.cjs.entry.js +9 -3
  4. package/dist/cjs/nv-calendar.cjs.entry.js.map +1 -1
  5. package/dist/cjs/nv-fielddate.cjs.entry.js +62 -94
  6. package/dist/cjs/nv-fielddate.cjs.entry.js.map +1 -1
  7. package/dist/cjs/nv-fielddaterange.cjs.entry.js +52 -33
  8. package/dist/cjs/nv-fielddaterange.cjs.entry.js.map +1 -1
  9. package/dist/collection/components/nv-calendar/nv-calendar.js +9 -3
  10. package/dist/collection/components/nv-calendar/nv-calendar.js.map +1 -1
  11. package/dist/collection/components/nv-fielddate/nv-fielddate.js +63 -94
  12. package/dist/collection/components/nv-fielddate/nv-fielddate.js.map +1 -1
  13. package/dist/collection/components/nv-fielddaterange/nv-fielddaterange.js +52 -33
  14. package/dist/collection/components/nv-fielddaterange/nv-fielddaterange.js.map +1 -1
  15. package/dist/components/nv-calendar.js +1 -1
  16. package/dist/components/nv-fielddate.js +66 -98
  17. package/dist/components/nv-fielddate.js.map +1 -1
  18. package/dist/components/nv-fielddaterange.js +54 -35
  19. package/dist/components/nv-fielddaterange.js.map +1 -1
  20. package/dist/components/{p-d32b75ac.js → p-82e5674c.js} +10 -4
  21. package/dist/components/p-82e5674c.js.map +1 -0
  22. package/dist/components/{p-91a558eb.js → p-f1df2634.js} +2 -2
  23. package/dist/components/{p-91a558eb.js.map → p-f1df2634.js.map} +1 -1
  24. package/dist/esm/loader.js +1 -1
  25. package/dist/esm/native.js +1 -1
  26. package/dist/esm/nv-calendar.entry.js +9 -3
  27. package/dist/esm/nv-calendar.entry.js.map +1 -1
  28. package/dist/esm/nv-fielddate.entry.js +62 -94
  29. package/dist/esm/nv-fielddate.entry.js.map +1 -1
  30. package/dist/esm/nv-fielddaterange.entry.js +52 -33
  31. package/dist/esm/nv-fielddaterange.entry.js.map +1 -1
  32. package/dist/native/native.esm.js +1 -1
  33. package/dist/native/native.esm.js.map +1 -1
  34. package/dist/native/{p-dc34da69.entry.js → p-4a533dd8.entry.js} +2 -2
  35. package/dist/native/p-4a533dd8.entry.js.map +1 -0
  36. package/dist/native/{p-f687e05c.entry.js → p-55cd3d62.entry.js} +2 -2
  37. package/dist/native/p-55cd3d62.entry.js.map +1 -0
  38. package/dist/native/{p-516da423.entry.js → p-9ea3d30d.entry.js} +2 -2
  39. package/dist/native/p-9ea3d30d.entry.js.map +1 -0
  40. package/dist/types/components/nv-fielddate/nv-fielddate.d.ts +4 -19
  41. package/dist/types/components/nv-fielddaterange/nv-fielddaterange.d.ts +1 -0
  42. package/hydrate/index.js +123 -131
  43. package/hydrate/index.mjs +123 -131
  44. package/package.json +1 -1
  45. package/dist/components/p-d32b75ac.js.map +0 -1
  46. package/dist/native/p-516da423.entry.js.map +0 -1
  47. package/dist/native/p-dc34da69.entry.js.map +0 -1
  48. package/dist/native/p-f687e05c.entry.js.map +0 -1
package/hydrate/index.js CHANGED
@@ -6596,6 +6596,12 @@ class NvCalendar {
6596
6596
  .split(',')
6597
6597
  .map(v => v.trim())
6598
6598
  .filter(Boolean);
6599
+ if (this.selectionType === 'range' && values.length < 2) {
6600
+ console.warn(`Invalid date range format: ${value}`);
6601
+ this.startDate = null;
6602
+ this.endDate = null;
6603
+ return;
6604
+ }
6599
6605
  if (this.selectionType === 'single' && values.length >= 1) {
6600
6606
  const parsedDate = parseDate(values[0], this.dateFormat);
6601
6607
  if (parsedDate) {
@@ -6640,7 +6646,7 @@ class NvCalendar {
6640
6646
  }
6641
6647
  else {
6642
6648
  // Handle malformed dates gracefully - reset state
6643
- console.warn(`Invalid date range format: ${values[0]}, ${values[1]}`);
6649
+ console.warn(`Invalid date range format: ${values === null || values === void 0 ? void 0 : values[0]}, ${values === null || values === void 0 ? void 0 : values[1]}`);
6644
6650
  this.startDate = null;
6645
6651
  this.endDate = null;
6646
6652
  if (!this.showActions) {
@@ -7403,8 +7409,8 @@ class NvCalendar {
7403
7409
  * @slot default - Child content of the component.
7404
7410
  */
7405
7411
  render() {
7406
- return (hAsync(Host, { key: '7abeb96312f2bcf26eed3a133ef59d5d3b5b528f' }, hAsync("div", { key: 'e0b2db720853551e3b6445e92b39b418123cb83e', class: "datepicker-root" }, hAsync("div", { key: '1a83c285278c440c4e33ae770a033974e4924830', class: `datepicker-container ${this.numberOfCalendars === 1 ? 'datepicker-container-single' : ''}` }, hAsync("div", { key: '3481fe780a3e1d8f0c1e22ffc82c3b7830721055', class: `datepicker-wrapper ${this.numberOfCalendars === 1 ? 'single' : ''}` }, this.shortcutsPlacement === 'left' && this.renderShortcuts(), Array.from({ length: this.numberOfCalendars }, (_, index) => this.renderCalendar(index, index)), this.shortcutsPlacement === 'right' && this.renderShortcuts()), ((this.hasShortcuts && this.shortcutsPlacement === 'bottom') ||
7407
- this.hasActions) && (hAsync("div", { key: '3a644bdc993142c181c45173756e362025d4a23a', class: "datepicker-controls" }, this.shortcutsPlacement === 'bottom' && this.renderShortcuts(), this.hasActions && this.renderActions())))), hAsync("slot", { key: '4a4290ccf63429a9a88cfd95a33b4fdc34c8ef74' })));
7412
+ return (hAsync(Host, { key: '492526a4a9ed114aba804db45f49847b1db58c9f' }, hAsync("div", { key: '632759b4eb6c65c3b082b707fba75568ed351e49', class: "datepicker-root" }, hAsync("div", { key: '8dc6160dec8ed46e2d2f70e3154cd73cbaeee586', class: `datepicker-container ${this.numberOfCalendars === 1 ? 'datepicker-container-single' : ''}` }, hAsync("div", { key: '55b1c7f8bcda0785ca63a1572bfebc628a3971d5', class: `datepicker-wrapper ${this.numberOfCalendars === 1 ? 'single' : ''}` }, this.shortcutsPlacement === 'left' && this.renderShortcuts(), Array.from({ length: this.numberOfCalendars }, (_, index) => this.renderCalendar(index, index)), this.shortcutsPlacement === 'right' && this.renderShortcuts()), ((this.hasShortcuts && this.shortcutsPlacement === 'bottom') ||
7413
+ this.hasActions) && (hAsync("div", { key: '7234a6d497fccdcab8923b5235f591f24061c92d', class: "datepicker-controls" }, this.shortcutsPlacement === 'bottom' && this.renderShortcuts(), this.hasActions && this.renderActions())))), hAsync("slot", { key: '1a23c6e92ffbc8ca64b42ff41ed6d106a3697e7f' })));
7408
7414
  }
7409
7415
  get el() { return getElement(this); }
7410
7416
  static get watchers() { return {
@@ -17096,8 +17102,6 @@ class NvFielddate {
17096
17102
  * The initial value of the input (date in string format).
17097
17103
  * @bind value
17098
17104
  */
17099
- // eslint-disable-next-line @stencil-community/own-props-must-be-private
17100
- // eslint-disable-next-line @stencil-community/strict-mutable
17101
17105
  this.value = '';
17102
17106
  /**
17103
17107
  * The current value of the input date in string format.
@@ -17169,18 +17173,10 @@ class NvFielddate {
17169
17173
  return;
17170
17174
  }
17171
17175
  this.inputElement.focus();
17172
- // Select the first characters based on the date format
17173
- const format = this.dateFormat;
17174
- if (format.startsWith('DD') || format.startsWith('MM')) {
17175
- this.inputElement.setSelectionRange(0, 2);
17176
- }
17177
- else if (format.startsWith('YYYY')) {
17178
- this.inputElement.setSelectionRange(0, 4);
17179
- }
17180
17176
  };
17181
17177
  /**
17182
17178
  * Handles the input event on the input element.
17183
- * Updates the singleValue and emits the valueChanged event.
17179
+ * Updates the singleValue and emits the valueChanged event if empty.
17184
17180
  * @param {Event} event - The input event.
17185
17181
  */
17186
17182
  this.handleInput = (event) => {
@@ -17189,74 +17185,10 @@ class NvFielddate {
17189
17185
  return;
17190
17186
  }
17191
17187
  const input = event.target;
17192
- const previousValue = this.value;
17193
17188
  this.singleValue = input.value;
17194
17189
  this.value = input.value;
17195
- // Only emit valueChanged if the value actually changed
17196
- if (previousValue !== input.value) {
17197
- this.valueChanged.emit(input.value);
17198
- }
17199
- };
17200
- /**
17201
- * Initializes the input mask.
17202
- */
17203
- this.initializeInputMask = () => {
17204
- this.currentPlaceholder = '';
17205
- if (this.inputElement.inputmask) {
17206
- return;
17207
- }
17208
- const inputMask = new Inputmask({
17209
- alias: 'datetime',
17210
- inputFormat: this.convertToInputmaskFormat(this.dateFormat),
17211
- placeholder: ' ',
17212
- prefillYear: false,
17213
- clearIncomplete: false,
17214
- showMaskOnHover: false,
17215
- showMaskOnFocus: false,
17216
- clearMaskOnLostFocus: false,
17217
- insertMode: true,
17218
- rightAlign: false,
17219
- oncomplete: function (e) {
17220
- const input = e.target;
17221
- const event = new CustomEvent('input', { bubbles: true });
17222
- input.dispatchEvent(event);
17223
- },
17224
- });
17225
- inputMask.mask(this.inputElement);
17226
- // Set the value after applying the mask
17227
- if (this.inputElement.name === this.name && this.singleValue) {
17228
- requestAnimationFrame(() => {
17229
- this.inputElement.value = this.singleValue;
17230
- const event = new CustomEvent('input', { bubbles: true });
17231
- this.inputElement.dispatchEvent(event);
17232
- });
17233
- }
17234
- };
17235
- /**
17236
- * Handles keydown events on the input before the mask is initialized.
17237
- * Initializes the mask on the first number input.
17238
- * @param {KeyboardEvent} event - The keyboard event.
17239
- */
17240
- this.handleKeydownBeforeMask = (event) => {
17241
- const allowedKeys = [
17242
- 'Backspace',
17243
- 'Delete',
17244
- 'Tab',
17245
- 'ArrowLeft',
17246
- 'ArrowRight',
17247
- 'ArrowUp',
17248
- 'ArrowDown',
17249
- 'Home',
17250
- 'End',
17251
- ];
17252
- if (/\d/.test(event.key)) {
17253
- this.initializeInputMask();
17254
- this.inputElement.removeEventListener('keydown', this.handleKeydownBeforeMask);
17255
- }
17256
- else if (!allowedKeys.includes(event.key) &&
17257
- !event.metaKey &&
17258
- !event.ctrlKey) {
17259
- event.preventDefault();
17190
+ if (this.value === '') {
17191
+ this.valueChanged.emit('');
17260
17192
  }
17261
17193
  };
17262
17194
  /**
@@ -17269,17 +17201,8 @@ class NvFielddate {
17269
17201
  event.target.blur();
17270
17202
  return;
17271
17203
  }
17272
- if (!this.inputElement.inputmask) {
17273
- this.inputElement.addEventListener('keydown', this.handleKeydownBeforeMask);
17274
- }
17275
17204
  this.open = true;
17276
17205
  };
17277
- /**
17278
- * Handles blur events on the input element.
17279
- */
17280
- this.handleBlur = () => {
17281
- this.inputElement.removeEventListener('keydown', this.handleKeydownBeforeMask);
17282
- };
17283
17206
  /**
17284
17207
  * Prevents the valueChanged event from the calendar from propagating up.
17285
17208
  * @param {CustomEvent} event - The valueChanged event from nv-calendar.
@@ -17354,6 +17277,27 @@ class NvFielddate {
17354
17277
  // Close the popover if open
17355
17278
  this.open = false;
17356
17279
  }
17280
+ updateMask() {
17281
+ var _a, _b;
17282
+ if (!this.inputElement)
17283
+ return;
17284
+ (_b = (_a = this.inputElement.inputmask) === null || _a === void 0 ? void 0 : _a.remove) === null || _b === void 0 ? void 0 : _b.call(_a);
17285
+ const inputMask = new Inputmask({
17286
+ alias: 'datetime',
17287
+ inputFormat: this.convertToInputmaskFormat(this.dateFormat),
17288
+ placeholder: this.convertToInputmaskFormat(this.dateFormat),
17289
+ clearIncomplete: false,
17290
+ showMaskOnHover: false,
17291
+ showMaskOnFocus: true,
17292
+ clearMaskOnLostFocus: !this.open,
17293
+ postValidation: true,
17294
+ oncomplete: (e) => {
17295
+ var _a;
17296
+ this.valueChanged.emit((_a = e.target) === null || _a === void 0 ? void 0 : _a.value);
17297
+ },
17298
+ });
17299
+ inputMask.mask(this.inputElement);
17300
+ }
17357
17301
  //#endregion METHODS
17358
17302
  /****************************************************************************/
17359
17303
  //#region LIFECYCLE
@@ -17364,10 +17308,26 @@ class NvFielddate {
17364
17308
  if (this.value) {
17365
17309
  this.singleValue = this.value;
17366
17310
  }
17367
- this.currentPlaceholder = this.placeholder || this.dateFormat;
17368
17311
  }
17369
17312
  componentDidLoad() {
17370
- // Inputmask is now initialized on the first keypress
17313
+ this.updateMask();
17314
+ // Set the initial value after applying the mask
17315
+ if (this.inputElement.name === this.name && this.singleValue) {
17316
+ requestAnimationFrame(() => {
17317
+ this.inputElement.value = this.singleValue;
17318
+ const event = new CustomEvent('input', { bubbles: true });
17319
+ this.inputElement.dispatchEvent(event);
17320
+ });
17321
+ }
17322
+ }
17323
+ componentDidRender() {
17324
+ // Only set value on initial render when there's no existing value in the input
17325
+ if (this.singleValue && this.inputElement && !this.inputElement.value) {
17326
+ requestAnimationFrame(() => {
17327
+ this.inputElement.value = this.singleValue;
17328
+ this.inputElement.setAttribute('value', this.singleValue);
17329
+ });
17330
+ }
17371
17331
  }
17372
17332
  disconnectedCallback() {
17373
17333
  document.removeEventListener('click', this.handleClickOutside);
@@ -17386,6 +17346,10 @@ class NvFielddate {
17386
17346
  const previousValue = this.value;
17387
17347
  this.singleValue = value;
17388
17348
  this.value = value;
17349
+ // Set the input value directly when calendar is used
17350
+ if (this.inputElement) {
17351
+ this.inputElement.value = value;
17352
+ }
17389
17353
  // Only emit valueChanged if the value actually changed
17390
17354
  if (previousValue !== value) {
17391
17355
  this.valueChanged.emit(value);
@@ -17414,21 +17378,31 @@ class NvFielddate {
17414
17378
  }
17415
17379
  handleValueChange(newValue) {
17416
17380
  this.singleValue = newValue;
17381
+ // Only set input value if it's different from current input value
17382
+ // This prevents interfering with user typing
17383
+ if (this.inputElement && this.inputElement.value !== newValue) {
17384
+ this.inputElement.value = newValue;
17385
+ }
17386
+ }
17387
+ handleOpenChange() {
17388
+ this.updateMask();
17417
17389
  }
17418
17390
  //#endregion EVENTS
17419
17391
  /****************************************************************************/
17420
17392
  //#region RENDER
17421
17393
  render() {
17422
- return (hAsync(Host, { key: '45af13d8290479c8ec171c0702d9d695c5047610' }, ((this.label && this.label.length > 0) ||
17423
- this.el.querySelector('[slot="label"]')) && (hAsync("label", { key: 'd30403c879f8ca0449d8d25d22bb401ece876758', htmlFor: this.inputId }, hAsync("slot", { key: 'aec155a914cff6b7ea8170dbd1f0d9ee4f35172e', name: "label" }, this.label))), hAsync("nv-popover", { key: '522969535f2b8340f1a9b425c4ea6291fc65cb7e', ref: this.setPopoverRef, id: this.popoverId, triggerMode: "controlled", placement: "bottom-start", open: this.open }, hAsync("div", { key: 'eb1d5ab314fe654b3642afb22d9e3fbc340de969', slot: "trigger", class: "input-wrapper" }, hAsync("slot", { key: '6c28354e914075c36db9bee659d140669a745cab', name: "before-input" }), hAsync("div", { key: '68d3aa4a8afcec4042a8930678cea7046f3e31d7', class: "input-container", onClick: this.handleInputContainerClick }, hAsync("slot", { key: 'ed7ada6913a6735af622369236b5f521f2e96aad', name: "leading-input" }), hAsync("input", { key: '49607b25253233665544e8e85db3814734280fe0', id: this.inputId, ref: this.setInputRef, placeholder: this.currentPlaceholder, name: this.name, disabled: this.disabled, readOnly: this.readonly, required: this.required, autofocus: this.autofocus, value: this.singleValue, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, "data-scope": "date" }), this.error && (hAsync("nv-icon", { key: '35d06926d78f7c653fbf0424b59802fb4489004a', name: "alert-circle", class: "validation", size: "md" })), this.success && (hAsync("nv-icon", { key: '17ca631dca201fb412c921619223c1abc8777d2b', name: "circle-check", class: "validation", size: "md" })), hAsync("nv-iconbutton", { key: 'e08d735115cde3d22a657b986f4a7a5a0347d1af', class: "toggle-calendar-icon", name: "calendar" //{this.open ? 'chevron-top' : 'chevron-down'}
17394
+ return (hAsync(Host, { key: 'e72afd15f69aa6267cc9444e63fae12e4cfcf05b' }, ((this.label && this.label.length > 0) ||
17395
+ this.el.querySelector('[slot="label"]')) && (hAsync("label", { key: 'bc13c15f74ac4dbe4b326fe479dcd9a6fb20cf40', htmlFor: this.inputId }, hAsync("slot", { key: '30ae9788e7768adc9da95e0b89a3f6f7027e625f', name: "label" }, this.label))), hAsync("nv-popover", { key: 'e043d7b021d1d7ee206d231a1cfc7b4541091ae5', ref: this.setPopoverRef, id: this.popoverId, triggerMode: "controlled", placement: "bottom-start", open: this.open }, hAsync("div", { key: '75682a712a8276bc24b285a48ef2312aae9f5097', slot: "trigger", class: "input-wrapper" }, hAsync("slot", { key: '17593b316a870a5edbbc50eb4bb9441759309612', name: "before-input" }), hAsync("div", { key: '0eb576fbe4a800ed7e1583810986e5f7f07e175a', class: "input-container", onClick: this.handleInputContainerClick }, hAsync("slot", { key: 'c058ea07757486cf69621deba85ebbec3b075779', name: "leading-input" }), hAsync("input", { key: '4c31a633358ff96f774a7862507c4c40301062cb', id: this.inputId, ref: this.setInputRef, placeholder: this.placeholder ||
17396
+ this.convertToInputmaskFormat(this.dateFormat), name: this.name, disabled: this.disabled, readOnly: this.readonly, required: this.required, autofocus: this.autofocus, onInput: this.handleInput, onFocus: this.handleFocus, "data-scope": "date" }), this.error && (hAsync("nv-icon", { key: '036392f177a0c10f609e7b555c3e7f256cd63962', name: "alert-circle", class: "validation", size: "md" })), this.success && (hAsync("nv-icon", { key: '5a74ecdd55177d8cda55e8afdb05978e23450346', name: "circle-check", class: "validation", size: "md" })), hAsync("nv-iconbutton", { key: 'e07f8b69d1810430cffff071d39ca7c72a15ccaf', class: "toggle-calendar-icon", name: "calendar" //{this.open ? 'chevron-top' : 'chevron-down'}
17424
17397
  ,
17425
- size: "md", emphasis: "lower", "aria-label": this.open ? 'Hide calendar' : 'Show calendar', "aria-pressed": this.open.toString(), onClick: this.toggleCalendar, tabIndex: this.disabled ? -1 : 0 })), hAsync("slot", { key: '75cf593c7b9f2078f055522d6e43440dbe0cc522', name: "after-input" })), hAsync("div", { key: '0df8cd2360a17f5cc786e6b29c67ded308c18104', slot: "content" }, hAsync("nv-calendar", { key: '045a02370ef9dfe31ae3d0b2f702fafb25c7da8f', dateFormat: this.dateFormat, singleValue: this.singleValue, firstDayOfWeek: this.firstDayOfWeek, numberOfCalendars: this.numberOfCalendars, min: this.min, max: this.max, locale: this.locale, shortcutsPlacement: this.shortcutsPlacement, showActions: this.showActions, shortcuts: this.shortcuts, showWeekNumbers: this.showWeekNumbers, disabledDates: this.disabledDates, onValueChanged: this.handleCalendarValueChanged }))), ((this.description && this.description.length > 0) ||
17426
- this.el.querySelector('[slot="description"]')) && (hAsync("div", { key: 'ecedbfe16857d9976349f3f3875be13f9ffc4b53', class: "description" }, hAsync("slot", { key: 'e848d9e03e169c9ac57ce2fb7cdb00466f658c61', name: "description" }, this.description))), (this.errorDescription ||
17427
- this.el.querySelector('[slot="error-description"]')) && (hAsync("div", { key: '028b4d496ba3ee5eefa0107da8a62c771709a3ed', hidden: !this.error, class: "error-description" }, this.el.querySelector('[slot="error-description"]') ? (hAsync("slot", { name: "error-description" })) : (this.errorDescription))), hAsync("slot", { key: 'd3b79a0ae56ec7eb444c28985b1ffcfd8a4e36a1' })));
17398
+ size: "md", emphasis: "lower", "aria-label": this.open ? 'Hide calendar' : 'Show calendar', "aria-pressed": this.open.toString(), onClick: this.toggleCalendar, tabIndex: this.disabled ? -1 : 0 })), hAsync("slot", { key: 'a84e382a534735adb22741df1751d9c70c050b69', name: "after-input" })), hAsync("div", { key: '29a3ca7ed69a772497590595fc82a78fddf0c32a', slot: "content" }, hAsync("nv-calendar", { key: '6797dab38dba23f7396aadcbf5281aefdabd891f', dateFormat: this.dateFormat, singleValue: this.singleValue, firstDayOfWeek: this.firstDayOfWeek, numberOfCalendars: this.numberOfCalendars, min: this.min, max: this.max, locale: this.locale, shortcutsPlacement: this.shortcutsPlacement, showActions: this.showActions, shortcuts: this.shortcuts, showWeekNumbers: this.showWeekNumbers, disabledDates: this.disabledDates, onValueChanged: this.handleCalendarValueChanged }))), ((this.description && this.description.length > 0) ||
17399
+ this.el.querySelector('[slot="description"]')) && (hAsync("div", { key: '1799cd4dc4f6ca4b520277c080574af089816a9b', class: "description" }, hAsync("slot", { key: 'eb2d9ac73687786e589f5a90791763f4465d1d20', name: "description" }, this.description))), (this.errorDescription ||
17400
+ this.el.querySelector('[slot="error-description"]')) && (hAsync("div", { key: '7c25fc8369b6bc948d7b233eb5b58451b02cbc62', hidden: !this.error, class: "error-description" }, this.el.querySelector('[slot="error-description"]') ? (hAsync("slot", { name: "error-description" })) : (this.errorDescription))), hAsync("slot", { key: '1499ea51b0e2d283037bf71aae6da242839c0e49' })));
17428
17401
  }
17429
17402
  get el() { return getElement(this); }
17430
17403
  static get watchers() { return {
17431
- "value": ["handleValueChange"]
17404
+ "value": ["handleValueChange"],
17405
+ "open": ["handleOpenChange"]
17432
17406
  }; }
17433
17407
  static get style() { return NvFielddateStyle0; }
17434
17408
  static get cmpMeta() { return {
@@ -17461,7 +17435,6 @@ class NvFielddate {
17461
17435
  "disabledDates": [16],
17462
17436
  "fluid": [516],
17463
17437
  "singleValue": [32],
17464
- "currentPlaceholder": [32],
17465
17438
  "open": [32],
17466
17439
  "clear": [64]
17467
17440
  },
@@ -17604,12 +17577,6 @@ class NvFielddaterange {
17604
17577
  this.startValue = values[0];
17605
17578
  this.endValue = values[1];
17606
17579
  }
17607
- else {
17608
- // Handle malformed value gracefully
17609
- console.warn(`Invalid date range format: ${value}`);
17610
- this.startValue = '';
17611
- this.endValue = '';
17612
- }
17613
17580
  };
17614
17581
  /**
17615
17582
  * Closes the popover when a click is detected outside the component.
@@ -17633,9 +17600,6 @@ class NvFielddaterange {
17633
17600
  this.startValue = input.value;
17634
17601
  // Update unified value prop
17635
17602
  this.value = `${input.value},${this.endValue}`;
17636
- this.valueChanged.emit(this.value);
17637
- // Legacy support (deprecated)
17638
- this.dateRangeChange.emit({ start: input.value, end: this.endValue });
17639
17603
  // Temporarily enable navigation for keyboard input
17640
17604
  if (this.calendarElement) {
17641
17605
  this.calendarElement.removeAttribute('data-prevent-navigation');
@@ -17661,9 +17625,6 @@ class NvFielddaterange {
17661
17625
  this.endValue = input.value;
17662
17626
  // Update unified value prop
17663
17627
  this.value = `${this.startValue},${input.value}`;
17664
- this.valueChanged.emit(this.value);
17665
- // Legacy support (deprecated)
17666
- this.dateRangeChange.emit({ start: this.startValue, end: input.value });
17667
17628
  // Temporarily enable navigation for keyboard input
17668
17629
  if (this.calendarElement) {
17669
17630
  this.calendarElement.removeAttribute('data-prevent-navigation');
@@ -17760,6 +17721,50 @@ class NvFielddaterange {
17760
17721
  this.calendarElement.clear();
17761
17722
  }
17762
17723
  }
17724
+ updateMask() {
17725
+ const inputs = this.el.querySelectorAll('.input-wrapper input');
17726
+ inputs.forEach((input) => {
17727
+ var _a, _b;
17728
+ (_b = (_a = input.inputmask) === null || _a === void 0 ? void 0 : _a.remove) === null || _b === void 0 ? void 0 : _b.call(_a);
17729
+ const inputMask = new Inputmask({
17730
+ alias: 'datetime',
17731
+ inputFormat: this.convertToInputmaskFormat(this.dateFormat),
17732
+ placeholder: this.convertToInputmaskFormat(this.dateFormat),
17733
+ clearIncomplete: false,
17734
+ showMaskOnHover: false,
17735
+ showMaskOnFocus: true,
17736
+ clearMaskOnLostFocus: !this.open,
17737
+ postValidation: true,
17738
+ oncleared: (e) => {
17739
+ const input = e.target;
17740
+ if (input.id === this.startInputId) {
17741
+ this.startValue = '';
17742
+ }
17743
+ if (input.id === this.endInputId) {
17744
+ this.endValue = '';
17745
+ }
17746
+ },
17747
+ oncomplete: () => {
17748
+ if (/[a-zA-Z]/g.test(this.value))
17749
+ return;
17750
+ const values = this.value
17751
+ .split(',')
17752
+ .map(v => v.trim())
17753
+ .filter(Boolean);
17754
+ if (values.length < 2)
17755
+ return;
17756
+ // If valid emit change event
17757
+ this.valueChanged.emit(this.value);
17758
+ // Legacy support (deprecated)
17759
+ this.dateRangeChange.emit({
17760
+ start: this.startValue,
17761
+ end: input.value,
17762
+ });
17763
+ },
17764
+ });
17765
+ inputMask.mask(input);
17766
+ });
17767
+ }
17763
17768
  //#endregion METHODS
17764
17769
  /****************************************************************************/
17765
17770
  //#region LIFECYCLE
@@ -17773,25 +17778,9 @@ class NvFielddaterange {
17773
17778
  }
17774
17779
  }
17775
17780
  componentDidLoad() {
17781
+ this.updateMask();
17776
17782
  const inputs = this.el.querySelectorAll('.input-wrapper input');
17777
17783
  inputs.forEach((input) => {
17778
- const inputMask = new Inputmask({
17779
- alias: 'datetime',
17780
- inputFormat: this.convertToInputmaskFormat(this.dateFormat),
17781
- placeholder: this.convertToInputmaskFormat(this.dateFormat),
17782
- clearIncomplete: false,
17783
- showMaskOnHover: false,
17784
- showMaskOnFocus: false,
17785
- clearMaskOnLostFocus: false,
17786
- insertMode: true,
17787
- rightAlign: false,
17788
- oncomplete: function (e) {
17789
- const input = e.target;
17790
- const event = new CustomEvent('input', { bubbles: true });
17791
- input.dispatchEvent(event);
17792
- },
17793
- });
17794
- inputMask.mask(input);
17795
17784
  // Set the value after applying the mask
17796
17785
  if (input.name === this.startName && this.startValue) {
17797
17786
  requestAnimationFrame(() => {
@@ -17923,6 +17912,7 @@ class NvFielddaterange {
17923
17912
  this.parseUnifiedValue(newValue);
17924
17913
  }
17925
17914
  onOpenChanged(newValue) {
17915
+ this.updateMask();
17926
17916
  if (this.contentRef) {
17927
17917
  if (newValue) {
17928
17918
  this.contentRef.style.transition = 'none';
@@ -17948,10 +17938,12 @@ class NvFielddaterange {
17948
17938
  /****************************************************************************/
17949
17939
  //#region RENDER
17950
17940
  render() {
17951
- return (hAsync(Host, { key: 'e2d5ce2c864dbc8ba478a1ce1353aa8e51e13ec1' }, ((this.label && this.label.length > 0) ||
17952
- this.el.querySelector('[slot="label"]')) && (hAsync("label", { key: '6e171200b763f8e7a907d305475bb7d4faa27979', htmlFor: this.startInputId }, hAsync("slot", { key: '9f8b94e7491d4cd73e17f41ba290acda1fe73f3b', name: "label" }, this.label))), hAsync("nv-popover", { key: '9bf5539eeceadb960c3438ddc05fe986f800d33b', ref: el => (this.popoverElement = el), id: this.popoverId, triggerMode: "controlled", placement: "bottom-start", open: this.open }, hAsync("div", { key: '58f7625d27c2266429ddc4f653d61efefed5bc66', slot: "trigger", class: "input-wrapper" }, hAsync("slot", { key: '206064a5c1be74082202849b96e46a8207377098', name: "before-input" }), hAsync("div", { key: 'bd66fb676a5a749e17ede3f75c8a4404586c0c63', class: "input-container" }, hAsync("slot", { key: '7c78a037f5189143ea32ca843e1c27b52d8f2d4b', name: "leading-input" }), hAsync("div", { key: 'fbe89bc4502eca56e05029d65a45684484921433', class: "range-inputs" }, hAsync("input", { key: '397e572e87dd7f01977008b44847469cabd06494', id: this.startInputId, type: "text", placeholder: this.startPlaceholder, name: this.startName, disabled: this.disabled, readOnly: this.readonly, required: this.required, autofocus: this.autofocus, value: this.startValue, onInput: this.handleStartInput, onFocus: this.handleFocus, "data-scope": "date-range" }), hAsync("div", { key: '378d2755919eafc9f4edd8ee451c01e49dc70cfe', class: "range-separator" }), hAsync("input", { key: '2de8dcda3161667a543c04ae529a0f617f6598c6', id: this.endInputId, type: "text", placeholder: this.endPlaceholder, name: this.endName, disabled: this.disabled, readOnly: this.readonly, required: this.required, value: this.endValue, onInput: this.handleEndInput, onFocus: this.handleFocus, "data-scope": "date-range" })), this.error && (hAsync("nv-icon", { key: '5880e135764a7f9f87d92a4f7a84eba9f56b7d46', name: "alert-circle", class: "validation", size: "md" })), this.success && (hAsync("nv-icon", { key: '5d764360d3dbfc306962cb9e4b67d7d3c4bc09ed', name: "circle-check", class: "validation", size: "md" })), hAsync("nv-iconbutton", { key: '1b09d57633f8e115cc3d92a82d35399c53be265b', class: "toggle-calendar-icon", name: "calendar", size: "md", emphasis: "lower", "aria-label": this.open ? 'Hide calendar' : 'Show calendar', "aria-pressed": this.open.toString(), onClick: this.toggleCalendar, tabIndex: this.disabled ? -1 : 0 })), hAsync("slot", { key: '7ec41f782b0343eeb427bee4d7f2ab1b549978b3', name: "after-input" })), hAsync("div", { key: 'ea714333fe596af8a10c6f8a1e6c72935f8e5c91', slot: "content" }, hAsync("nv-calendar", { key: 'ffaa70c5bc76c422396b233d3dc46fdeb2d06b10', ref: el => (this.calendarElement = el), dateFormat: this.dateFormat, value: this.value, firstDayOfWeek: this.firstDayOfWeek, numberOfCalendars: this.numberOfCalendars, min: this.min, max: this.max, locale: this.locale, shortcutsPlacement: this.shortcutsPlacement, showActions: this.showActions, shortcuts: this.shortcuts, showWeekNumbers: this.showWeekNumbers, disabledDates: this.disabledDates, selectionType: "range", "data-prevent-navigation": "true" }))), ((this.description && this.description.length > 0) ||
17953
- this.el.querySelector('[slot="description"]')) && (hAsync("div", { key: '7f4aa271c896234907d95cfe7660e1c41ab8ddf7', class: "description" }, hAsync("slot", { key: 'fce93594f7af4d054f886ce3caf48cfffb6809aa', name: "description" }, this.description))), (this.errorDescription ||
17954
- this.el.querySelector('[slot="error-description"]')) && (hAsync("div", { key: 'f5a19b5d4c90c4319dc4eb09d1067f202ab229c9', hidden: !this.error, class: "error-description" }, this.el.querySelector('[slot="error-description"]') ? (hAsync("slot", { name: "error-description" })) : (this.errorDescription))), hAsync("slot", { key: '1d494e4c192b38c26e8cfe5482516382cacc13c6' })));
17941
+ return (hAsync(Host, { key: '2f100d067fa3ca5917252ac2ce921eecac98791e' }, ((this.label && this.label.length > 0) ||
17942
+ this.el.querySelector('[slot="label"]')) && (hAsync("label", { key: 'd427e5fd307896971a798a61461a5545af107d95', htmlFor: this.startInputId }, hAsync("slot", { key: 'b6735f19e0fa53528e0c088ee81eb54f7076a8b5', name: "label" }, this.label))), hAsync("nv-popover", { key: '069225a1606c105b9370f6eb0b5268fbf3fc5d96', ref: el => (this.popoverElement = el), id: this.popoverId, triggerMode: "controlled", placement: "bottom-start", open: this.open }, hAsync("div", { key: 'ec43cbd1c063f2e8c4de3e765b776982da607fbe', slot: "trigger", class: "input-wrapper" }, hAsync("slot", { key: '6d6dc2263764bdd53674d9b62eb04904ceecf428', name: "before-input" }), hAsync("div", { key: 'd465d4a360baf008977e9f9c23058980c7357668', class: "input-container" }, hAsync("slot", { key: '52463fb16a84025f910ab5d34ad5f95e575a3999', name: "leading-input" }), hAsync("div", { key: 'a432151dabdf6976f463d794b24b85cb7c784d3f', class: "range-inputs" }, hAsync("input", { key: '98e48271dce40353ba577aedc1daca8398f9526a', id: this.startInputId, type: "text", placeholder: this.startPlaceholder ||
17943
+ this.convertToInputmaskFormat(this.dateFormat), name: this.startName, disabled: this.disabled, readOnly: this.readonly, required: this.required, autofocus: this.autofocus, value: this.startValue, onInput: this.handleStartInput, onFocus: this.handleFocus, "data-scope": "date-range" }), hAsync("div", { key: 'daddef3bb169bcdf4baf4d5dd7c727d7fa66dd0f', class: "range-separator" }), hAsync("input", { key: 'c498d3b8a82372606d315a3102ada5763bc4791e', id: this.endInputId, type: "text", placeholder: this.endPlaceholder ||
17944
+ this.convertToInputmaskFormat(this.dateFormat), name: this.endName, disabled: this.disabled, readOnly: this.readonly, required: this.required, value: this.endValue, onInput: this.handleEndInput, onFocus: this.handleFocus, "data-scope": "date-range" })), this.error && (hAsync("nv-icon", { key: 'c83a0f241b7eb2407117a5eb52caa1bee955c764', name: "alert-circle", class: "validation", size: "md" })), this.success && (hAsync("nv-icon", { key: 'a96c7cd55a903e38f10453fe6bbea0f828573367', name: "circle-check", class: "validation", size: "md" })), hAsync("nv-iconbutton", { key: '39b92aa357457f0be9264335173f8335fdd84b26', class: "toggle-calendar-icon", name: "calendar", size: "md", emphasis: "lower", "aria-label": this.open ? 'Hide calendar' : 'Show calendar', "aria-pressed": this.open.toString(), onClick: this.toggleCalendar, tabIndex: this.disabled ? -1 : 0 })), hAsync("slot", { key: 'b739f98ecb80e73fd84b557a0165438beb3f16bd', name: "after-input" })), hAsync("div", { key: '503406610a224a2b0173fcf6117b1b3a45d3d44d', slot: "content" }, hAsync("nv-calendar", { key: 'ac97339bef8aa214da1317601a31af2c2555acaa', ref: el => (this.calendarElement = el), dateFormat: this.dateFormat, value: this.value, firstDayOfWeek: this.firstDayOfWeek, numberOfCalendars: this.numberOfCalendars, min: this.min, max: this.max, locale: this.locale, shortcutsPlacement: this.shortcutsPlacement, showActions: this.showActions, shortcuts: this.shortcuts, showWeekNumbers: this.showWeekNumbers, disabledDates: this.disabledDates, selectionType: "range", "data-prevent-navigation": "true" }))), ((this.description && this.description.length > 0) ||
17945
+ this.el.querySelector('[slot="description"]')) && (hAsync("div", { key: '302bf932d36f484db34d7c94206697fb469faadc', class: "description" }, hAsync("slot", { key: '133e4c69264dbb856f42dee40fbdfe2286caf87d', name: "description" }, this.description))), (this.errorDescription ||
17946
+ this.el.querySelector('[slot="error-description"]')) && (hAsync("div", { key: '2cc57d57cb18cc7ac89135f5e128ffa9ee5487bc', hidden: !this.error, class: "error-description" }, this.el.querySelector('[slot="error-description"]') ? (hAsync("slot", { name: "error-description" })) : (this.errorDescription))), hAsync("slot", { key: '3ef1b28e2bd3879c33faefd20af8cf33360af56c' })));
17955
17947
  }
17956
17948
  get el() { return getElement(this); }
17957
17949
  static get watchers() { return {