@nova-design-system/nova-react 3.1.0 → 3.3.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.
Files changed (50) hide show
  1. package/dist/cjs/{index-Cn-oNJnW.js → index-BlWxX8x6.js} +2199 -1452
  2. package/dist/cjs/index.js +2 -1
  3. package/dist/cjs/{nv-alert.entry-BFwufSUQ.js → nv-alert.entry-BLGSitrm.js} +7 -7
  4. package/dist/cjs/{nv-avatar.entry-Do1K4s3s.js → nv-avatar.entry-CRcLMbEx.js} +7 -7
  5. package/dist/cjs/{nv-badge_2.entry-NTGHyFdg.js → nv-badge_2.entry-BtDAr7_d.js} +1 -1
  6. package/dist/cjs/{nv-breadcrumb.entry-oPVGJYlk.js → nv-breadcrumb.entry-PVDZoF9i.js} +1 -1
  7. package/dist/cjs/{nv-breadcrumbs.entry-BsOw153b.js → nv-breadcrumbs.entry-BY169s5F.js} +1 -1
  8. package/dist/cjs/{nv-button.entry-13tdBiRr.js → nv-button.entry-BpxpxFJP.js} +7 -7
  9. package/dist/cjs/{nv-calendar.entry-u9MgGb83.js → nv-calendar.entry-BobyjFdK.js} +389 -177
  10. package/dist/cjs/{nv-col.entry-DFhv-GI7.js → nv-col.entry-B4BJXJw-.js} +1 -1
  11. package/dist/cjs/{nv-datagrid.entry-BoB17gvI.js → nv-datagrid.entry-D5UVDiYl.js} +100 -108
  12. package/dist/cjs/{nv-datagridcolumn.entry-C3MYBmfS.js → nv-datagridcolumn.entry-dmpcmCIT.js} +2 -2
  13. package/dist/cjs/{nv-dialog.entry-OA3qL3Tx.js → nv-dialog.entry-BYovzkco.js} +3 -3
  14. package/dist/cjs/{nv-dialogfooter_2.entry-LAQYSiGV.js → nv-dialogfooter_2.entry-C9dhLKRM.js} +3 -3
  15. package/dist/cjs/{nv-fieldcheckbox.entry-CP7SDzVO.js → nv-fieldcheckbox.entry-BvFqY2dM.js} +1 -1
  16. package/dist/cjs/nv-fielddate.entry-CSpAcEXW.js +303 -0
  17. package/dist/cjs/nv-fielddaterange.entry-C14o96dd.js +439 -0
  18. package/dist/cjs/{nv-fielddropdown.entry-Nwric1vT.js → nv-fielddropdown.entry-C3VzNRhh.js} +84 -60
  19. package/dist/cjs/{nv-fielddropdownitem.entry-CiqSw5VL.js → nv-fielddropdownitem.entry-D4G4Ytus.js} +1 -1
  20. package/dist/cjs/{nv-fieldmultiselect.entry-QKNIBcW1.js → nv-fieldmultiselect.entry-Ci43ZvzC.js} +116 -104
  21. package/dist/cjs/nv-fieldnumber.entry-nvUi-64H.js +130 -0
  22. package/dist/cjs/nv-fieldpassword.entry-C2uqwDah.js +121 -0
  23. package/dist/cjs/{nv-fieldradio.entry-Dxc6ZCyb.js → nv-fieldradio.entry-DL2GdKqO.js} +1 -1
  24. package/dist/cjs/{nv-fieldselect.entry-Cys0KRyG.js → nv-fieldselect.entry-D4AIRE24.js} +2 -2
  25. package/dist/cjs/nv-fieldslider.entry-BNge4J69.js +665 -0
  26. package/dist/cjs/nv-fieldtext.entry-BI-fdkdX.js +123 -0
  27. package/dist/cjs/nv-fieldtextarea.entry-Ct0g9Qtb.js +198 -0
  28. package/dist/cjs/{nv-fieldtime.entry-BqxiFlLI.js → nv-fieldtime.entry-CmO96Py1.js} +67 -67
  29. package/dist/cjs/nv-icon.entry-TepdQ1jA.js +79 -0
  30. package/dist/cjs/{nv-iconbutton_2.entry-BLNrQz9Q.js → nv-iconbutton_2.entry-B7Xyut9H.js} +3 -3
  31. package/dist/cjs/{nv-menu.entry-7IDfPmZ8.js → nv-menu.entry-DHrRi_37.js} +2 -2
  32. package/dist/cjs/{nv-menuitem.entry-B9cjy7O8.js → nv-menuitem.entry-B_D1pSYa.js} +2 -2
  33. package/dist/cjs/{nv-popover.entry-ChLYZ3zY.js → nv-popover.entry-DyQPEQ4I.js} +2 -2
  34. package/dist/cjs/{nv-row.entry-DiLY8Vbc.js → nv-row.entry-CDTv7ikK.js} +2 -2
  35. package/dist/cjs/{nv-stack.entry-MpPzmg5_.js → nv-stack.entry-A78c6BVf.js} +2 -2
  36. package/dist/cjs/{nv-table.entry-cME3Zuq2.js → nv-table.entry-DkwcfdJM.js} +3 -3
  37. package/dist/cjs/{nv-tablecolumn.entry-DSctDxCS.js → nv-tablecolumn.entry-C8VNSpDf.js} +1 -1
  38. package/dist/cjs/{nv-toggle.entry-EBWm3Xy5.js → nv-toggle.entry-vxSyUDKZ.js} +3 -3
  39. package/dist/cjs/{nv-tooltip.entry-q6rJLq1C.js → nv-tooltip.entry-BQKXRp4d.js} +3 -3
  40. package/dist/generated/components.js +15 -3
  41. package/dist/types/generated/components.d.ts +8 -3
  42. package/package.json +1 -1
  43. package/dist/cjs/nv-fielddate.entry-CD7PX6yA.js +0 -269
  44. package/dist/cjs/nv-fielddaterange.entry-BVBVGmly.js +0 -353
  45. package/dist/cjs/nv-fieldnumber.entry-DfHcI-sO.js +0 -130
  46. package/dist/cjs/nv-fieldpassword.entry-b2pUmS8F.js +0 -121
  47. package/dist/cjs/nv-fieldtext.entry-DCZWLFFp.js +0 -123
  48. package/dist/cjs/nv-fieldtextarea.entry-DEeRdtZ7.js +0 -198
  49. package/dist/cjs/nv-icon.entry-CzEdUDdA.js +0 -79
  50. /package/dist/cjs/{constants-b97e736d-BzFAKCkR.js → constants-4faa1fae-BzFAKCkR.js} +0 -0
@@ -0,0 +1,439 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-BlWxX8x6.js');
4
+ var inputmaskEdcad3c1 = require('./inputmask-edcad3c1-B9Omti4z.js');
5
+ var v4A79185f4 = require('./v4-a79185f4-2n0dOd_Y.js');
6
+ require('react');
7
+ require('./_commonjsHelpers-1789f0cf-BJu3ubxk.js');
8
+
9
+ const nvFielddaterangeCss = "nv-fieldslider .slider-container .track-container:has(.thumb:hover) .track-range{background:var(--components-slider-track-filled-hover)}nv-fieldslider .slider-container .track-container:has(.thumb:hover) .thumb{border-color:var(--components-slider-track-filled-hover)}nv-fieldslider .slider-container .track-container:has(.thumb:focus) .track-range{background:var(--components-slider-track-filled-focus)}nv-fieldslider .slider-container .track-container:has(.thumb:focus) .thumb{border-color:var(--components-slider-track-filled-focus)}nv-fieldslider[error] .slider-container .track-container .track .track-range{background:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb{border-color:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb:hover{border-color:var(--components-slider-track-filled-error);outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-slider-track-filled-error);outline-offset:calc(var(--focus-outline-offset) * 1);background-color:var(--components-slider-handler-background-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb:focus{border-color:var(--components-slider-track-filled-error);outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-slider-track-filled-error);outline-offset:calc(var(--focus-outline-offset) * 1);background-color:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container:has(.thumb:hover) .track-range{background:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container:has(.thumb:hover) .thumb{border-color:var(--components-slider-track-filled-error)}nv-fielddaterange{--nv-field-border-default:var(--components-form-field-border-default);--nv-field-border-hover:var(--components-form-field-border-hover);--nv-field-border-focus:var(--components-form-field-border-focus);--nv-field-border-disabled:var(--components-form-field-border-default);--nv-field-border-readonly:var(--components-form-field-border-default);--nv-field-focus-box-shadow:var(--color-focus-brand);--nv-field-background:var(--components-form-field-background-default);display:flex;flex-direction:column;align-items:flex-start;gap:var(--form-gap-y);box-sizing:border-box;max-width:480px}nv-fielddaterange[fluid]:not([fluid=false]){max-width:unset}nv-fielddaterange[readonly]:not([readonly=false]){--nv-field-border-default:var(--components-form-field-border-readonly);--nv-field-border-hover:var(--nv-field-border-default);--nv-field-border-focus:var(--components-form-field-border-focus);--nv-field-border-disabled:var(--nv-field-border-default);--nv-field-border-readonly:var(--nv-field-border-default);--nv-field-background:var(--components-form-field-background-readonly)}nv-fielddaterange[error]:not([error=false]){--nv-field-border-default:var(--components-form-field-border-error);--nv-field-border-hover:var(--nv-field-border-default);--nv-field-border-focus:var(--nv-field-border-default);--nv-field-border-disabled:var(--nv-field-border-default);--nv-field-border-readonly:var(--nv-field-border-default);--nv-field-focus-box-shadow:var(--color-focus-destructive-in-field)}nv-fielddaterange[success]:not([success=false]){--nv-field-border-default:var(--components-form-field-border-success);--nv-field-border-hover:var(--nv-field-border-default);--nv-field-border-focus:var(--nv-field-border-default);--nv-field-border-disabled:var(--nv-field-border-default);--nv-field-border-readonly:var(--nv-field-border-default);--nv-field-focus-box-shadow:var(--color-focus-success)}nv-fielddaterange[required]:not([required=false]) label::after{content:\"*\";color:var(--components-form-text-required);font-weight:700}nv-fielddaterange label{display:flex;align-items:center;gap:var(--form-label-gap);align-self:stretch;color:var(--components-form-text-label-default);font-family:\"TT Norms Pro\", sans-serif;font-size:var(--form-label-font-size);font-style:normal;font-weight:500;line-height:var(--form-label-line-height)}nv-fielddaterange nv-popover{width:100%;display:block}nv-fielddaterange nv-popover [data-scope=popover]{padding:0;background-color:var(--components-list-dropdown-background);border:1px solid var(--components-list-dropdown-border);width:auto}nv-fielddaterange nv-popover [slot=content]{display:block;width:100%}nv-fielddaterange .input-wrapper{display:flex;flex-wrap:wrap;gap:var(--form-gap-x);align-items:stretch;align-self:stretch;display:flex;align-items:center;gap:8px}nv-fielddaterange .input-wrapper .input-container{display:flex;flex-grow:1;justify-content:center;align-items:center;align-self:stretch;border-radius:var(--form-field-radius);border-width:1px;border-style:solid;border-color:var(--nv-field-border-default);opacity:var(--components-form-opacity-default, 1);background:var(--nv-field-background);transition:all 150ms ease-out}nv-fielddaterange .input-wrapper .input-container:hover{border-color:var(--nv-field-border-hover)}nv-fielddaterange .input-wrapper .input-container:focus-within,nv-fielddaterange .input-wrapper .input-container:focus-within:hover,nv-fielddaterange .input-wrapper .input-container:focus,nv-fielddaterange .input-wrapper .input-container:focus:hover{border-color:var(--nv-field-border-focus);box-shadow:0px 0px 0px var(--focus-field-stroke) var(--nv-field-focus-box-shadow)}nv-fielddaterange .input-wrapper .input-container:has(input:read-only){opacity:0.5;background-color:var(--components-form-field-background-readonly);border-color:var(--nv-field-border-readonly)}nv-fielddaterange .input-wrapper .input-container:has(input:disabled){opacity:0.5;background-color:var(--components-form-field-background-disabled);border-color:var(--nv-field-border-disabled)}nv-fielddaterange .input-wrapper .input-container input{display:flex;align-items:center;flex:1 0 0;overflow:hidden;background-color:transparent;color:var(--components-form-field-content-text);padding:var(--form-field-padding-y) var(--form-field-padding-x);font-size:var(--form-field-font-size);font-style:normal;font-weight:500;line-height:var(--form-field-line-height);width:100%;width:100%}nv-fielddaterange .input-wrapper .input-container input:focus{outline:none}nv-fielddaterange .input-wrapper .input-container input::placeholder{overflow:hidden;color:var(--components-form-field-content-placeholder);text-overflow:ellipsis;font-family:\"TT Norms Pro\", sans-serif;font-size:var(--form-field-font-size);font-style:normal;font-weight:400;line-height:var(--form-field-line-height)}nv-fielddaterange .input-wrapper .input-container input[type=password]::-ms-clear,nv-fielddaterange .input-wrapper .input-container input[type=password]::-ms-reveal{display:none;width:0;height:0}nv-fielddaterange .input-wrapper .input-container>nv-iconbutton{border:0px;border-radius:0px}nv-fielddaterange .input-wrapper .input-container>nv-iconbutton:focus-visible{border-radius:var(--button-md-border-radius);outline-offset:-3px}nv-fielddaterange .input-wrapper .input-container nv-icon.validation{color:var(--nv-field-border-default)}nv-fielddaterange .description{display:flex;align-items:center;align-self:stretch;gap:var(--spacing-1);color:var(--components-form-text-description-default);font-family:\"TT Norms Pro\", sans-serif;font-size:var(--form-description-font-size);font-style:normal;line-height:var(--form-description-line-height)}nv-fielddaterange .error-description{display:flex;align-items:center;align-self:stretch;gap:var(--spacing-1);color:var(--components-form-text-description-default);font-family:\"TT Norms Pro\", sans-serif;font-size:var(--form-description-font-size);font-style:normal;line-height:var(--form-description-line-height);color:var(--components-form-text-description-error)}nv-fielddaterange .range-inputs{display:flex;align-items:center;gap:8px}nv-fielddaterange .range-inputs input{flex:1;border:none;outline:none;padding:0;font-size:var(--form-field-font-size);color:var(--components-form-field-content-text);background:transparent;min-width:0;text-align:center}nv-fielddaterange .range-inputs input::placeholder{color:var(--components-form-field-content-placeholder)}nv-fielddaterange .range-inputs input:disabled{cursor:not-allowed;color:var(--components-form-field-content-text);background-color:var(--components-form-field-background-disabled)}";
10
+ const NvFielddaterangeStyle0 = nvFielddaterangeCss;
11
+
12
+ const NvFielddaterange = class {
13
+ constructor(hostRef) {
14
+ index.registerInstance(this, hostRef);
15
+ this.dateRangeChange = index.createEvent(this, "dateRangeChange");
16
+ this.valueChanged = index.createEvent(this, "valueChanged");
17
+ this.popoverId = v4A79185f4.v4();
18
+ /****************************************************************************/
19
+ //#region PROPERTIES
20
+ /**
21
+ * Sets the ID for the start input element and the for attribute of the associated
22
+ * label. If no ID is provided, a random one will be automatically generated.
23
+ */
24
+ this.startInputId = v4A79185f4.v4();
25
+ /**
26
+ * Sets the ID for the end input element and the for attribute of the associated
27
+ * label. If no ID is provided, a random one will be automatically generated.
28
+ */
29
+ this.endInputId = v4A79185f4.v4();
30
+ /**
31
+ * Disables both input fields.
32
+ */
33
+ this.disabled = false;
34
+ /**
35
+ * Sets both input fields as read-only.
36
+ */
37
+ this.readonly = false;
38
+ /**
39
+ * Marks both input fields as required.
40
+ */
41
+ this.required = false;
42
+ /**
43
+ * Indicates an error state.
44
+ */
45
+ this.error = false;
46
+ /**
47
+ * Indicates a success state.
48
+ */
49
+ this.success = false;
50
+ /**
51
+ * Autofocus the start input when the component is mounted.
52
+ */
53
+ this.autofocus = false;
54
+ /**
55
+ * The initial value of the date range (in string format).
56
+ */
57
+ // eslint-disable-next-line @stencil-community/strict-mutable
58
+ this.value = '';
59
+ /**
60
+ * The current value of the start date in string format.
61
+ */
62
+ this.startValue = '';
63
+ /**
64
+ * The current value of the end date in string format.
65
+ */
66
+ this.endValue = '';
67
+ /**
68
+ * Controls the opening of the popover.
69
+ */
70
+ this.open = false;
71
+ /**
72
+ * First day of the week 0 = Sunday, 1 = Monday, etc.
73
+ * @default 1
74
+ */
75
+ this.firstDayOfWeek = 1;
76
+ /**
77
+ * Number of calendars to display
78
+ * @default 2
79
+ */
80
+ this.numberOfCalendars = 2;
81
+ /**
82
+ * Minimum date for selection ISO string format, ex: 2025-01-01
83
+ */
84
+ this.min = '';
85
+ /**
86
+ * Maximum date for selection ISO string format, ex: 2025-12-31
87
+ */
88
+ this.max = '';
89
+ /** Locale for date formatting
90
+ * @default 'en-BE'
91
+ */
92
+ this.locale = 'en-BE';
93
+ /** Date format ex: YYYY-MM-DD, DD-MM-YYYY, etc.
94
+ * @default 'YYYY-MM-DD'
95
+ */
96
+ this.dateFormat = 'YYYY-MM-DD';
97
+ /**
98
+ * Footer placement
99
+ * @default 'bottom'
100
+ */
101
+ this.shortcutsPlacement = 'bottom';
102
+ /**
103
+ * Show action buttons
104
+ * @default false
105
+ */
106
+ this.showActions = false;
107
+ /**
108
+ * Allows the field to stretch and fill the entire width of its container.
109
+ */
110
+ this.fluid = false;
111
+ //#endregion PROPERTIES
112
+ /****************************************************************************/
113
+ //#region METHODS
114
+ /**
115
+ * Parses the unified value prop and synchronizes with internal state
116
+ * @param {string} value - Value to parse
117
+ */
118
+ this.parseUnifiedValue = (value) => {
119
+ if (!value) {
120
+ // Reset all selections
121
+ this.startValue = '';
122
+ this.endValue = '';
123
+ return;
124
+ }
125
+ const values = value
126
+ .split(',')
127
+ .map(v => v.trim())
128
+ .filter(Boolean);
129
+ if (values.length >= 2) {
130
+ this.startValue = values[0];
131
+ this.endValue = values[1];
132
+ }
133
+ else {
134
+ // Handle malformed value gracefully
135
+ console.warn(`Invalid date range format: ${value}`);
136
+ this.startValue = '';
137
+ this.endValue = '';
138
+ }
139
+ };
140
+ /**
141
+ * Closes the popover when a click is detected outside the component.
142
+ * @param {MouseEvent} event - The mouse event
143
+ */
144
+ this.handleClickOutside = (event) => {
145
+ if (this.open && this.el && !this.el.contains(event.target)) {
146
+ this.open = false;
147
+ }
148
+ };
149
+ /**
150
+ * Handles the input event on the start input element.
151
+ * @param {Event} event - The input event
152
+ */
153
+ this.handleStartInput = (event) => {
154
+ if (this.readonly || this.disabled) {
155
+ event.preventDefault();
156
+ return;
157
+ }
158
+ const input = event.target;
159
+ this.startValue = input.value;
160
+ // Update unified value prop
161
+ this.value = `${input.value},${this.endValue}`;
162
+ this.valueChanged.emit(this.value);
163
+ // Legacy support (deprecated)
164
+ this.dateRangeChange.emit({ start: input.value, end: this.endValue });
165
+ // Temporarily enable navigation for keyboard input
166
+ if (this.calendarElement) {
167
+ this.calendarElement.removeAttribute('data-prevent-navigation');
168
+ this.updateCalendarValue();
169
+ // Restore navigation prevention after update
170
+ setTimeout(() => {
171
+ if (this.calendarElement) {
172
+ this.calendarElement.setAttribute('data-prevent-navigation', 'true');
173
+ }
174
+ }, 100);
175
+ }
176
+ };
177
+ /**
178
+ * Handles the input event on the end input element.
179
+ * @param {Event} event - The input event
180
+ */
181
+ this.handleEndInput = (event) => {
182
+ if (this.readonly || this.disabled) {
183
+ event.preventDefault();
184
+ return;
185
+ }
186
+ const input = event.target;
187
+ this.endValue = input.value;
188
+ // Update unified value prop
189
+ this.value = `${this.startValue},${input.value}`;
190
+ this.valueChanged.emit(this.value);
191
+ // Legacy support (deprecated)
192
+ this.dateRangeChange.emit({ start: this.startValue, end: input.value });
193
+ // Temporarily enable navigation for keyboard input
194
+ if (this.calendarElement) {
195
+ this.calendarElement.removeAttribute('data-prevent-navigation');
196
+ this.updateCalendarValue();
197
+ // Restore navigation prevention after update
198
+ setTimeout(() => {
199
+ if (this.calendarElement) {
200
+ this.calendarElement.setAttribute('data-prevent-navigation', 'true');
201
+ }
202
+ }, 100);
203
+ }
204
+ };
205
+ /**
206
+ * Handles focus events on the input elements.
207
+ * @param {FocusEvent} event - The focus event
208
+ */
209
+ this.handleFocus = (event) => {
210
+ if (this.readonly || this.disabled) {
211
+ event.preventDefault();
212
+ event.target.blur();
213
+ return;
214
+ }
215
+ // Enable navigation on focus
216
+ if (this.calendarElement) {
217
+ this.calendarElement.removeAttribute('data-prevent-navigation');
218
+ }
219
+ this.open = true;
220
+ // Restore navigation prevention after opening
221
+ setTimeout(() => {
222
+ if (this.calendarElement) {
223
+ this.calendarElement.setAttribute('data-prevent-navigation', 'true');
224
+ }
225
+ }, 300);
226
+ };
227
+ /**
228
+ * Toggles the opening/closing of the popover.
229
+ */
230
+ this.toggleCalendar = () => {
231
+ if (this.readonly || this.disabled) {
232
+ return;
233
+ }
234
+ this.open = !this.open;
235
+ };
236
+ }
237
+ /**
238
+ * Converts the nv-calendar date format to the format expected by Inputmask.
239
+ * @param {string} format - The date format to convert
240
+ * @returns {string} The converted format for Inputmask
241
+ */
242
+ convertToInputmaskFormat(format) {
243
+ // If the format is not specified, use the default format YYYY-MM-DD
244
+ if (!format) {
245
+ return 'dd/mm/yyyy';
246
+ }
247
+ const formatMap = {
248
+ 'YYYY-MM-DD': 'yyyy-mm-dd',
249
+ 'DD/MM/YYYY': 'dd/mm/yyyy',
250
+ 'MM/DD/YYYY': 'mm/dd/yyyy',
251
+ 'DD.MM.YYYY': 'dd.mm.yyyy',
252
+ 'YYYYMMDD': 'yyyymmdd',
253
+ };
254
+ return formatMap[format] || 'dd/mm/yyyy';
255
+ }
256
+ /**
257
+ * Update the calendar's rangeValue property without forcing month change
258
+ */
259
+ updateCalendarValue() {
260
+ }
261
+ //#endregion METHODS
262
+ /****************************************************************************/
263
+ //#region LIFECYCLE
264
+ connectedCallback() {
265
+ document.addEventListener('click', this.handleClickOutside);
266
+ }
267
+ componentWillLoad() {
268
+ if (this.value) {
269
+ // Use the unified parsing method
270
+ this.parseUnifiedValue(this.value);
271
+ }
272
+ }
273
+ componentDidLoad() {
274
+ const inputs = this.el.querySelectorAll('.input-wrapper input');
275
+ inputs.forEach((input) => {
276
+ const inputMask = new inputmaskEdcad3c1.Inputmask({
277
+ alias: 'datetime',
278
+ inputFormat: this.convertToInputmaskFormat(this.dateFormat),
279
+ placeholder: '_',
280
+ clearIncomplete: false,
281
+ showMaskOnHover: false,
282
+ showMaskOnFocus: false,
283
+ clearMaskOnLostFocus: false,
284
+ insertMode: true,
285
+ rightAlign: false,
286
+ oncomplete: function (e) {
287
+ const input = e.target;
288
+ const event = new CustomEvent('input', { bubbles: true });
289
+ input.dispatchEvent(event);
290
+ },
291
+ });
292
+ inputMask.mask(input);
293
+ // Set the value after applying the mask
294
+ if (input.name === this.startName && this.startValue) {
295
+ requestAnimationFrame(() => {
296
+ input.value = this.startValue;
297
+ const event = new CustomEvent('input', { bubbles: true });
298
+ input.dispatchEvent(event);
299
+ });
300
+ }
301
+ else if (input.name === this.endName && this.endValue) {
302
+ requestAnimationFrame(() => {
303
+ input.value = this.endValue;
304
+ const event = new CustomEvent('input', { bubbles: true });
305
+ input.dispatchEvent(event);
306
+ });
307
+ }
308
+ });
309
+ }
310
+ componentDidRender() {
311
+ const inputs = this.el.querySelectorAll('.input-wrapper input');
312
+ inputs.forEach((input) => {
313
+ const value = input.name === this.startName
314
+ ? this.startValue
315
+ : this.endName
316
+ ? this.endValue
317
+ : '';
318
+ if (value) {
319
+ // Make sure the value is defined both as a property and attribute
320
+ requestAnimationFrame(() => {
321
+ input.value = value;
322
+ input.setAttribute('value', value);
323
+ });
324
+ }
325
+ });
326
+ }
327
+ disconnectedCallback() {
328
+ document.removeEventListener('click', this.handleClickOutside);
329
+ }
330
+ /**
331
+ * Handles the range date selection event from nv-calendar.
332
+ * @param {CustomEvent<DateRange>} event - The custom event
333
+ */
334
+ handleRangeDateChange(event) {
335
+ const { start, end } = event.detail || {};
336
+ // Check that both dates are defined
337
+ if (start && end) {
338
+ this.startValue = start;
339
+ this.endValue = end;
340
+ // Update unified value prop (like nv-calendar)
341
+ this.value = `${start},${end}`;
342
+ this.valueChanged.emit(this.value);
343
+ // Legacy support (deprecated)
344
+ this.dateRangeChange.emit({
345
+ start: this.startValue,
346
+ end: this.endValue,
347
+ });
348
+ if (!this.showActions) {
349
+ this.open = false;
350
+ }
351
+ }
352
+ }
353
+ /**
354
+ * Handles the unified value change event from nv-calendar
355
+ * @param {CustomEvent<string>} event - The custom event
356
+ */
357
+ handleCalendarValueChanged(event) {
358
+ const newValue = event.detail || '';
359
+ if (newValue !== this.value) {
360
+ this.value = newValue;
361
+ this.valueChanged.emit(newValue);
362
+ // Parse and update internal state
363
+ this.parseUnifiedValue(newValue);
364
+ // Legacy support - emit dateRangeChange
365
+ this.dateRangeChange.emit({
366
+ start: this.startValue,
367
+ end: this.endValue,
368
+ });
369
+ }
370
+ }
371
+ handleClosePopover() {
372
+ this.open = false;
373
+ }
374
+ handleApplyDateRange() {
375
+ this.open = false;
376
+ }
377
+ /**
378
+ * Handles the reset event from the calendar's cancel button
379
+ * @param {CustomEvent} event - The event emitted by the calendar
380
+ */
381
+ handleDateReset(event) {
382
+ const isResetSingle = event.type === 'singleDateChange' && event.detail === '';
383
+ const isResetRange = event.type === 'rangeDateChange' &&
384
+ event.detail &&
385
+ event.detail.start === '' &&
386
+ event.detail.end === '';
387
+ if (isResetSingle || isResetRange) {
388
+ this.startValue = '';
389
+ this.endValue = '';
390
+ // Update unified value prop
391
+ this.value = '';
392
+ this.valueChanged.emit('');
393
+ const inputs = this.el.querySelectorAll('.input-wrapper input');
394
+ inputs.forEach((input) => {
395
+ input.value = '';
396
+ });
397
+ // Legacy support (deprecated)
398
+ this.dateRangeChange.emit({ start: '', end: '' });
399
+ }
400
+ }
401
+ /**
402
+ * Handles keyboard events.
403
+ * @param {KeyboardEvent} event - The keyboard event
404
+ */
405
+ handleKeyDown(event) {
406
+ if (!this.open) {
407
+ if (event.key === 'ArrowDown') {
408
+ this.open = true;
409
+ event.preventDefault();
410
+ return;
411
+ }
412
+ return;
413
+ }
414
+ if (!this.popoverElement) {
415
+ console.warn('nv-fielddaterange -> Popover element is not defined');
416
+ return;
417
+ }
418
+ }
419
+ handleValueChange(newValue) {
420
+ // Use the unified parsing method instead of JSON.parse
421
+ this.parseUnifiedValue(newValue);
422
+ }
423
+ //#endregion EVENTS
424
+ /****************************************************************************/
425
+ //#region RENDER
426
+ render() {
427
+ return (index.h(index.Host, { key: 'a451ea256b0149d8c49676f764832a2fb0f751e1' }, ((this.label && this.label.length > 0) ||
428
+ this.el.querySelector('[slot="label"]')) && (index.h("label", { key: '8b5dfcffa03da62b728b121705213a5dbc61dc6c', htmlFor: this.startInputId }, index.h("slot", { key: 'f55bf5e98ac77ab4781956ed98f2e327f0806df6', name: "label" }, this.label))), index.h("nv-popover", { key: 'c818788df088dd87bce8e0f3f7dfadf282675981', ref: el => (this.popoverElement = el), id: this.popoverId, triggerMode: "controlled", placement: "bottom-start", open: this.open }, index.h("div", { key: '2208b4f6033232fde9c149bd7ec7096a7b5bf36c', slot: "trigger", class: "input-wrapper" }, index.h("slot", { key: 'c32096e78b3b1846e8aac664770310f3e2a658c7', name: "before-input" }), index.h("div", { key: '478355cdb09432c84c44811f048ff832a58b7c21', class: "input-container" }, index.h("slot", { key: '4703b43ce78daec5c249cb64e2d5c6ea239e9682', name: "leading-input" }), index.h("div", { key: '02e39ceb5d680fe73b4e701162b12fdf6d351128', class: "range-inputs" }, index.h("input", { key: '54548154537b4f9661b2bc07cfa1e8fbdc587788', 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" }), index.h("svg", { key: 'b32d842470237bdb1d846b61ed165d2d1587a491', xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", class: "icon icon-tabler icons-tabler-outline icon-tabler-arrows-move-horizontal" }, index.h("path", { key: '7281b2de95391d3dc04ffdbfbc5da81a4b3f2fc3', stroke: "none", d: "M0 0h24v24H0z", fill: "none" }), index.h("path", { key: '13f2cfe57b9eaadc9317bd489f6abfc472addd0e', d: "M18 9l3 3l-3 3" }), index.h("path", { key: '646dbf9fe81981c93a4ad70a7cf75d485b573e42', d: "M15 12h6" }), index.h("path", { key: '753699e6aa5325cd91b27af5ede8d316adaa7727', d: "M6 9l-3 3l3 3" }), index.h("path", { key: 'aab52481a7846a400bd0274f197b5c29c71fa15c', d: "M3 12h6" })), index.h("input", { key: '9c441f448382dd4f5c73c94d7ebaff80c6bcec2a', 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 && (index.h("nv-icon", { key: 'f16264bdc82de90a1c8e7b5acf25687ed31a0a49', name: "alert-circle", class: "validation", size: "md" })), this.success && (index.h("nv-icon", { key: '9b1a0f81dc60bbcf68e53bc1c6ff33be515d3689', name: "circle-check", class: "validation", size: "md" })), index.h("nv-iconbutton", { key: '5e898f106896aa5496b9f243c8e4896d007dea65', 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 })), index.h("slot", { key: 'f1ab4a033654907143750a47ab44acf0b5293def', name: "after-input" })), index.h("div", { key: '55d69c575b8630b08a90334c7b65190d398ebec8', slot: "content" }, index.h("nv-calendar", { key: 'a3f9d43a961d7a8c38ffc7d7bd8fcbe7e0b544f8', 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) ||
429
+ this.el.querySelector('[slot="description"]')) && (index.h("div", { key: 'b58241fe9c321b2c55aab00235e07627d4aae5a8', class: "description" }, index.h("slot", { key: '4450872685fbb82838f5bc920fd0fd1b867347c5', name: "description" }, this.description))), (this.errorDescription ||
430
+ this.el.querySelector('[slot="error-description"]')) && (index.h("div", { key: '947701fd9a14ef6e564460cd73bafb510883692a', hidden: !this.error, class: "error-description" }, this.el.querySelector('[slot="error-description"]') ? (index.h("slot", { name: "error-description" })) : (this.errorDescription))), index.h("slot", { key: '95dc7827c626e92a74067ffb7759dcca63cc4102' })));
431
+ }
432
+ get el() { return index.getElement(this); }
433
+ static get watchers() { return {
434
+ "value": ["handleValueChange"]
435
+ }; }
436
+ };
437
+ NvFielddaterange.style = NvFielddaterangeStyle0;
438
+
439
+ exports.nv_fielddaterange = NvFielddaterange;