@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.mjs CHANGED
@@ -6592,6 +6592,12 @@ class NvCalendar {
6592
6592
  .split(',')
6593
6593
  .map(v => v.trim())
6594
6594
  .filter(Boolean);
6595
+ if (this.selectionType === 'range' && values.length < 2) {
6596
+ console.warn(`Invalid date range format: ${value}`);
6597
+ this.startDate = null;
6598
+ this.endDate = null;
6599
+ return;
6600
+ }
6595
6601
  if (this.selectionType === 'single' && values.length >= 1) {
6596
6602
  const parsedDate = parseDate(values[0], this.dateFormat);
6597
6603
  if (parsedDate) {
@@ -6636,7 +6642,7 @@ class NvCalendar {
6636
6642
  }
6637
6643
  else {
6638
6644
  // Handle malformed dates gracefully - reset state
6639
- console.warn(`Invalid date range format: ${values[0]}, ${values[1]}`);
6645
+ console.warn(`Invalid date range format: ${values === null || values === void 0 ? void 0 : values[0]}, ${values === null || values === void 0 ? void 0 : values[1]}`);
6640
6646
  this.startDate = null;
6641
6647
  this.endDate = null;
6642
6648
  if (!this.showActions) {
@@ -7399,8 +7405,8 @@ class NvCalendar {
7399
7405
  * @slot default - Child content of the component.
7400
7406
  */
7401
7407
  render() {
7402
- 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') ||
7403
- this.hasActions) && (hAsync("div", { key: '3a644bdc993142c181c45173756e362025d4a23a', class: "datepicker-controls" }, this.shortcutsPlacement === 'bottom' && this.renderShortcuts(), this.hasActions && this.renderActions())))), hAsync("slot", { key: '4a4290ccf63429a9a88cfd95a33b4fdc34c8ef74' })));
7408
+ 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') ||
7409
+ this.hasActions) && (hAsync("div", { key: '7234a6d497fccdcab8923b5235f591f24061c92d', class: "datepicker-controls" }, this.shortcutsPlacement === 'bottom' && this.renderShortcuts(), this.hasActions && this.renderActions())))), hAsync("slot", { key: '1a23c6e92ffbc8ca64b42ff41ed6d106a3697e7f' })));
7404
7410
  }
7405
7411
  get el() { return getElement(this); }
7406
7412
  static get watchers() { return {
@@ -17092,8 +17098,6 @@ class NvFielddate {
17092
17098
  * The initial value of the input (date in string format).
17093
17099
  * @bind value
17094
17100
  */
17095
- // eslint-disable-next-line @stencil-community/own-props-must-be-private
17096
- // eslint-disable-next-line @stencil-community/strict-mutable
17097
17101
  this.value = '';
17098
17102
  /**
17099
17103
  * The current value of the input date in string format.
@@ -17165,18 +17169,10 @@ class NvFielddate {
17165
17169
  return;
17166
17170
  }
17167
17171
  this.inputElement.focus();
17168
- // Select the first characters based on the date format
17169
- const format = this.dateFormat;
17170
- if (format.startsWith('DD') || format.startsWith('MM')) {
17171
- this.inputElement.setSelectionRange(0, 2);
17172
- }
17173
- else if (format.startsWith('YYYY')) {
17174
- this.inputElement.setSelectionRange(0, 4);
17175
- }
17176
17172
  };
17177
17173
  /**
17178
17174
  * Handles the input event on the input element.
17179
- * Updates the singleValue and emits the valueChanged event.
17175
+ * Updates the singleValue and emits the valueChanged event if empty.
17180
17176
  * @param {Event} event - The input event.
17181
17177
  */
17182
17178
  this.handleInput = (event) => {
@@ -17185,74 +17181,10 @@ class NvFielddate {
17185
17181
  return;
17186
17182
  }
17187
17183
  const input = event.target;
17188
- const previousValue = this.value;
17189
17184
  this.singleValue = input.value;
17190
17185
  this.value = input.value;
17191
- // Only emit valueChanged if the value actually changed
17192
- if (previousValue !== input.value) {
17193
- this.valueChanged.emit(input.value);
17194
- }
17195
- };
17196
- /**
17197
- * Initializes the input mask.
17198
- */
17199
- this.initializeInputMask = () => {
17200
- this.currentPlaceholder = '';
17201
- if (this.inputElement.inputmask) {
17202
- return;
17203
- }
17204
- const inputMask = new Inputmask({
17205
- alias: 'datetime',
17206
- inputFormat: this.convertToInputmaskFormat(this.dateFormat),
17207
- placeholder: ' ',
17208
- prefillYear: false,
17209
- clearIncomplete: false,
17210
- showMaskOnHover: false,
17211
- showMaskOnFocus: false,
17212
- clearMaskOnLostFocus: false,
17213
- insertMode: true,
17214
- rightAlign: false,
17215
- oncomplete: function (e) {
17216
- const input = e.target;
17217
- const event = new CustomEvent('input', { bubbles: true });
17218
- input.dispatchEvent(event);
17219
- },
17220
- });
17221
- inputMask.mask(this.inputElement);
17222
- // Set the value after applying the mask
17223
- if (this.inputElement.name === this.name && this.singleValue) {
17224
- requestAnimationFrame(() => {
17225
- this.inputElement.value = this.singleValue;
17226
- const event = new CustomEvent('input', { bubbles: true });
17227
- this.inputElement.dispatchEvent(event);
17228
- });
17229
- }
17230
- };
17231
- /**
17232
- * Handles keydown events on the input before the mask is initialized.
17233
- * Initializes the mask on the first number input.
17234
- * @param {KeyboardEvent} event - The keyboard event.
17235
- */
17236
- this.handleKeydownBeforeMask = (event) => {
17237
- const allowedKeys = [
17238
- 'Backspace',
17239
- 'Delete',
17240
- 'Tab',
17241
- 'ArrowLeft',
17242
- 'ArrowRight',
17243
- 'ArrowUp',
17244
- 'ArrowDown',
17245
- 'Home',
17246
- 'End',
17247
- ];
17248
- if (/\d/.test(event.key)) {
17249
- this.initializeInputMask();
17250
- this.inputElement.removeEventListener('keydown', this.handleKeydownBeforeMask);
17251
- }
17252
- else if (!allowedKeys.includes(event.key) &&
17253
- !event.metaKey &&
17254
- !event.ctrlKey) {
17255
- event.preventDefault();
17186
+ if (this.value === '') {
17187
+ this.valueChanged.emit('');
17256
17188
  }
17257
17189
  };
17258
17190
  /**
@@ -17265,17 +17197,8 @@ class NvFielddate {
17265
17197
  event.target.blur();
17266
17198
  return;
17267
17199
  }
17268
- if (!this.inputElement.inputmask) {
17269
- this.inputElement.addEventListener('keydown', this.handleKeydownBeforeMask);
17270
- }
17271
17200
  this.open = true;
17272
17201
  };
17273
- /**
17274
- * Handles blur events on the input element.
17275
- */
17276
- this.handleBlur = () => {
17277
- this.inputElement.removeEventListener('keydown', this.handleKeydownBeforeMask);
17278
- };
17279
17202
  /**
17280
17203
  * Prevents the valueChanged event from the calendar from propagating up.
17281
17204
  * @param {CustomEvent} event - The valueChanged event from nv-calendar.
@@ -17350,6 +17273,27 @@ class NvFielddate {
17350
17273
  // Close the popover if open
17351
17274
  this.open = false;
17352
17275
  }
17276
+ updateMask() {
17277
+ var _a, _b;
17278
+ if (!this.inputElement)
17279
+ return;
17280
+ (_b = (_a = this.inputElement.inputmask) === null || _a === void 0 ? void 0 : _a.remove) === null || _b === void 0 ? void 0 : _b.call(_a);
17281
+ const inputMask = new Inputmask({
17282
+ alias: 'datetime',
17283
+ inputFormat: this.convertToInputmaskFormat(this.dateFormat),
17284
+ placeholder: this.convertToInputmaskFormat(this.dateFormat),
17285
+ clearIncomplete: false,
17286
+ showMaskOnHover: false,
17287
+ showMaskOnFocus: true,
17288
+ clearMaskOnLostFocus: !this.open,
17289
+ postValidation: true,
17290
+ oncomplete: (e) => {
17291
+ var _a;
17292
+ this.valueChanged.emit((_a = e.target) === null || _a === void 0 ? void 0 : _a.value);
17293
+ },
17294
+ });
17295
+ inputMask.mask(this.inputElement);
17296
+ }
17353
17297
  //#endregion METHODS
17354
17298
  /****************************************************************************/
17355
17299
  //#region LIFECYCLE
@@ -17360,10 +17304,26 @@ class NvFielddate {
17360
17304
  if (this.value) {
17361
17305
  this.singleValue = this.value;
17362
17306
  }
17363
- this.currentPlaceholder = this.placeholder || this.dateFormat;
17364
17307
  }
17365
17308
  componentDidLoad() {
17366
- // Inputmask is now initialized on the first keypress
17309
+ this.updateMask();
17310
+ // Set the initial value after applying the mask
17311
+ if (this.inputElement.name === this.name && this.singleValue) {
17312
+ requestAnimationFrame(() => {
17313
+ this.inputElement.value = this.singleValue;
17314
+ const event = new CustomEvent('input', { bubbles: true });
17315
+ this.inputElement.dispatchEvent(event);
17316
+ });
17317
+ }
17318
+ }
17319
+ componentDidRender() {
17320
+ // Only set value on initial render when there's no existing value in the input
17321
+ if (this.singleValue && this.inputElement && !this.inputElement.value) {
17322
+ requestAnimationFrame(() => {
17323
+ this.inputElement.value = this.singleValue;
17324
+ this.inputElement.setAttribute('value', this.singleValue);
17325
+ });
17326
+ }
17367
17327
  }
17368
17328
  disconnectedCallback() {
17369
17329
  document.removeEventListener('click', this.handleClickOutside);
@@ -17382,6 +17342,10 @@ class NvFielddate {
17382
17342
  const previousValue = this.value;
17383
17343
  this.singleValue = value;
17384
17344
  this.value = value;
17345
+ // Set the input value directly when calendar is used
17346
+ if (this.inputElement) {
17347
+ this.inputElement.value = value;
17348
+ }
17385
17349
  // Only emit valueChanged if the value actually changed
17386
17350
  if (previousValue !== value) {
17387
17351
  this.valueChanged.emit(value);
@@ -17410,21 +17374,31 @@ class NvFielddate {
17410
17374
  }
17411
17375
  handleValueChange(newValue) {
17412
17376
  this.singleValue = newValue;
17377
+ // Only set input value if it's different from current input value
17378
+ // This prevents interfering with user typing
17379
+ if (this.inputElement && this.inputElement.value !== newValue) {
17380
+ this.inputElement.value = newValue;
17381
+ }
17382
+ }
17383
+ handleOpenChange() {
17384
+ this.updateMask();
17413
17385
  }
17414
17386
  //#endregion EVENTS
17415
17387
  /****************************************************************************/
17416
17388
  //#region RENDER
17417
17389
  render() {
17418
- return (hAsync(Host, { key: '45af13d8290479c8ec171c0702d9d695c5047610' }, ((this.label && this.label.length > 0) ||
17419
- 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'}
17390
+ return (hAsync(Host, { key: 'e72afd15f69aa6267cc9444e63fae12e4cfcf05b' }, ((this.label && this.label.length > 0) ||
17391
+ 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 ||
17392
+ 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'}
17420
17393
  ,
17421
- 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) ||
17422
- this.el.querySelector('[slot="description"]')) && (hAsync("div", { key: 'ecedbfe16857d9976349f3f3875be13f9ffc4b53', class: "description" }, hAsync("slot", { key: 'e848d9e03e169c9ac57ce2fb7cdb00466f658c61', name: "description" }, this.description))), (this.errorDescription ||
17423
- 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' })));
17394
+ 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) ||
17395
+ this.el.querySelector('[slot="description"]')) && (hAsync("div", { key: '1799cd4dc4f6ca4b520277c080574af089816a9b', class: "description" }, hAsync("slot", { key: 'eb2d9ac73687786e589f5a90791763f4465d1d20', name: "description" }, this.description))), (this.errorDescription ||
17396
+ 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' })));
17424
17397
  }
17425
17398
  get el() { return getElement(this); }
17426
17399
  static get watchers() { return {
17427
- "value": ["handleValueChange"]
17400
+ "value": ["handleValueChange"],
17401
+ "open": ["handleOpenChange"]
17428
17402
  }; }
17429
17403
  static get style() { return NvFielddateStyle0; }
17430
17404
  static get cmpMeta() { return {
@@ -17457,7 +17431,6 @@ class NvFielddate {
17457
17431
  "disabledDates": [16],
17458
17432
  "fluid": [516],
17459
17433
  "singleValue": [32],
17460
- "currentPlaceholder": [32],
17461
17434
  "open": [32],
17462
17435
  "clear": [64]
17463
17436
  },
@@ -17600,12 +17573,6 @@ class NvFielddaterange {
17600
17573
  this.startValue = values[0];
17601
17574
  this.endValue = values[1];
17602
17575
  }
17603
- else {
17604
- // Handle malformed value gracefully
17605
- console.warn(`Invalid date range format: ${value}`);
17606
- this.startValue = '';
17607
- this.endValue = '';
17608
- }
17609
17576
  };
17610
17577
  /**
17611
17578
  * Closes the popover when a click is detected outside the component.
@@ -17629,9 +17596,6 @@ class NvFielddaterange {
17629
17596
  this.startValue = input.value;
17630
17597
  // Update unified value prop
17631
17598
  this.value = `${input.value},${this.endValue}`;
17632
- this.valueChanged.emit(this.value);
17633
- // Legacy support (deprecated)
17634
- this.dateRangeChange.emit({ start: input.value, end: this.endValue });
17635
17599
  // Temporarily enable navigation for keyboard input
17636
17600
  if (this.calendarElement) {
17637
17601
  this.calendarElement.removeAttribute('data-prevent-navigation');
@@ -17657,9 +17621,6 @@ class NvFielddaterange {
17657
17621
  this.endValue = input.value;
17658
17622
  // Update unified value prop
17659
17623
  this.value = `${this.startValue},${input.value}`;
17660
- this.valueChanged.emit(this.value);
17661
- // Legacy support (deprecated)
17662
- this.dateRangeChange.emit({ start: this.startValue, end: input.value });
17663
17624
  // Temporarily enable navigation for keyboard input
17664
17625
  if (this.calendarElement) {
17665
17626
  this.calendarElement.removeAttribute('data-prevent-navigation');
@@ -17756,6 +17717,50 @@ class NvFielddaterange {
17756
17717
  this.calendarElement.clear();
17757
17718
  }
17758
17719
  }
17720
+ updateMask() {
17721
+ const inputs = this.el.querySelectorAll('.input-wrapper input');
17722
+ inputs.forEach((input) => {
17723
+ var _a, _b;
17724
+ (_b = (_a = input.inputmask) === null || _a === void 0 ? void 0 : _a.remove) === null || _b === void 0 ? void 0 : _b.call(_a);
17725
+ const inputMask = new Inputmask({
17726
+ alias: 'datetime',
17727
+ inputFormat: this.convertToInputmaskFormat(this.dateFormat),
17728
+ placeholder: this.convertToInputmaskFormat(this.dateFormat),
17729
+ clearIncomplete: false,
17730
+ showMaskOnHover: false,
17731
+ showMaskOnFocus: true,
17732
+ clearMaskOnLostFocus: !this.open,
17733
+ postValidation: true,
17734
+ oncleared: (e) => {
17735
+ const input = e.target;
17736
+ if (input.id === this.startInputId) {
17737
+ this.startValue = '';
17738
+ }
17739
+ if (input.id === this.endInputId) {
17740
+ this.endValue = '';
17741
+ }
17742
+ },
17743
+ oncomplete: () => {
17744
+ if (/[a-zA-Z]/g.test(this.value))
17745
+ return;
17746
+ const values = this.value
17747
+ .split(',')
17748
+ .map(v => v.trim())
17749
+ .filter(Boolean);
17750
+ if (values.length < 2)
17751
+ return;
17752
+ // If valid emit change event
17753
+ this.valueChanged.emit(this.value);
17754
+ // Legacy support (deprecated)
17755
+ this.dateRangeChange.emit({
17756
+ start: this.startValue,
17757
+ end: input.value,
17758
+ });
17759
+ },
17760
+ });
17761
+ inputMask.mask(input);
17762
+ });
17763
+ }
17759
17764
  //#endregion METHODS
17760
17765
  /****************************************************************************/
17761
17766
  //#region LIFECYCLE
@@ -17769,25 +17774,9 @@ class NvFielddaterange {
17769
17774
  }
17770
17775
  }
17771
17776
  componentDidLoad() {
17777
+ this.updateMask();
17772
17778
  const inputs = this.el.querySelectorAll('.input-wrapper input');
17773
17779
  inputs.forEach((input) => {
17774
- const inputMask = new Inputmask({
17775
- alias: 'datetime',
17776
- inputFormat: this.convertToInputmaskFormat(this.dateFormat),
17777
- placeholder: this.convertToInputmaskFormat(this.dateFormat),
17778
- clearIncomplete: false,
17779
- showMaskOnHover: false,
17780
- showMaskOnFocus: false,
17781
- clearMaskOnLostFocus: false,
17782
- insertMode: true,
17783
- rightAlign: false,
17784
- oncomplete: function (e) {
17785
- const input = e.target;
17786
- const event = new CustomEvent('input', { bubbles: true });
17787
- input.dispatchEvent(event);
17788
- },
17789
- });
17790
- inputMask.mask(input);
17791
17780
  // Set the value after applying the mask
17792
17781
  if (input.name === this.startName && this.startValue) {
17793
17782
  requestAnimationFrame(() => {
@@ -17919,6 +17908,7 @@ class NvFielddaterange {
17919
17908
  this.parseUnifiedValue(newValue);
17920
17909
  }
17921
17910
  onOpenChanged(newValue) {
17911
+ this.updateMask();
17922
17912
  if (this.contentRef) {
17923
17913
  if (newValue) {
17924
17914
  this.contentRef.style.transition = 'none';
@@ -17944,10 +17934,12 @@ class NvFielddaterange {
17944
17934
  /****************************************************************************/
17945
17935
  //#region RENDER
17946
17936
  render() {
17947
- return (hAsync(Host, { key: 'e2d5ce2c864dbc8ba478a1ce1353aa8e51e13ec1' }, ((this.label && this.label.length > 0) ||
17948
- 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) ||
17949
- this.el.querySelector('[slot="description"]')) && (hAsync("div", { key: '7f4aa271c896234907d95cfe7660e1c41ab8ddf7', class: "description" }, hAsync("slot", { key: 'fce93594f7af4d054f886ce3caf48cfffb6809aa', name: "description" }, this.description))), (this.errorDescription ||
17950
- 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' })));
17937
+ return (hAsync(Host, { key: '2f100d067fa3ca5917252ac2ce921eecac98791e' }, ((this.label && this.label.length > 0) ||
17938
+ 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 ||
17939
+ 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 ||
17940
+ 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) ||
17941
+ this.el.querySelector('[slot="description"]')) && (hAsync("div", { key: '302bf932d36f484db34d7c94206697fb469faadc', class: "description" }, hAsync("slot", { key: '133e4c69264dbb856f42dee40fbdfe2286caf87d', name: "description" }, this.description))), (this.errorDescription ||
17942
+ 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' })));
17951
17943
  }
17952
17944
  get el() { return getElement(this); }
17953
17945
  static get watchers() { return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nova-design-system/nova-webcomponents",
3
- "version": "3.9.0",
3
+ "version": "3.9.1",
4
4
  "description": "Nova is a design system created by Elia Group to empower creators to efficiently build solutions that people love to use.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",