@nova-design-system/nova-react 3.0.0-beta.41 → 3.0.0-beta.42

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 (89) hide show
  1. package/dist/cjs/_commonjsHelpers-1789f0cf-BJu3ubxk.js +10 -0
  2. package/dist/cjs/clsx-297c1ffe-BtxeOLZW.js +5 -0
  3. package/dist/cjs/constants-98e2dcc2-C0SBCapP.js +250 -0
  4. package/dist/cjs/dom.utils-ac71e0ef-CmIwRr6O.js +168 -0
  5. package/dist/cjs/events.utils-fe1d907f-01N__3wY.js +23 -0
  6. package/dist/cjs/fade.animation-2a077983-aKN0EDTo.js +1832 -0
  7. package/dist/cjs/index-C8UfzrMI.js +26405 -0
  8. package/dist/cjs/index-CinzsZ8D.js +26405 -0
  9. package/dist/cjs/index.js +48 -0
  10. package/dist/cjs/inputmask-edcad3c1-B9Omti4z.js +3749 -0
  11. package/dist/cjs/nv-alert.entry-8esWDUyU.js +173 -0
  12. package/dist/cjs/nv-alert.entry-BVY_rxey.js +173 -0
  13. package/dist/cjs/nv-avatar.entry-CO6bt4k6.js +67 -0
  14. package/dist/cjs/nv-avatar.entry-pREKtiv2.js +67 -0
  15. package/dist/cjs/nv-badge_2.entry-wDuiCwys.js +195 -0
  16. package/dist/cjs/nv-badge_2.entry-xfXsesV0.js +195 -0
  17. package/dist/cjs/nv-base.entry-BO-6krwg.js +71 -0
  18. package/dist/cjs/nv-base.entry-DwtTXK_n.js +71 -0
  19. package/dist/cjs/nv-breadcrumb.entry-B0hIeE83.js +45 -0
  20. package/dist/cjs/nv-breadcrumb.entry-DTwjCmMI.js +45 -0
  21. package/dist/cjs/nv-breadcrumbs.entry-Cq0LsIFs.js +20 -0
  22. package/dist/cjs/nv-breadcrumbs.entry-jn5hRjpQ.js +20 -0
  23. package/dist/cjs/nv-button.entry-DaSGnB1L.js +162 -0
  24. package/dist/cjs/nv-button.entry-DxzA6-My.js +162 -0
  25. package/dist/cjs/nv-calendar.entry-BC6NDsVl.js +1036 -0
  26. package/dist/cjs/nv-calendar.entry-DKz-iBnp.js +1036 -0
  27. package/dist/cjs/nv-col.entry-DNUY559i.js +37 -0
  28. package/dist/cjs/nv-col.entry-X7jkNThH.js +37 -0
  29. package/dist/cjs/nv-datagrid.entry-Cp8RCSEv.js +3671 -0
  30. package/dist/cjs/nv-datagrid.entry-DL-Fyo4l.js +3671 -0
  31. package/dist/cjs/nv-datagridcolumn.entry-CR9_1fsZ.js +18 -0
  32. package/dist/cjs/nv-datagridcolumn.entry-CyTG5E7M.js +18 -0
  33. package/dist/cjs/nv-dialog.entry-BjTJ5FFL.js +784 -0
  34. package/dist/cjs/nv-dialog.entry-Do_uALC6.js +784 -0
  35. package/dist/cjs/nv-dialogfooter_2.entry-DJ8qS9q6.js +134 -0
  36. package/dist/cjs/nv-dialogfooter_2.entry-DJkKzEgO.js +134 -0
  37. package/dist/cjs/nv-fieldcheckbox.entry-C0DmeqXD.js +137 -0
  38. package/dist/cjs/nv-fieldcheckbox.entry-DoGQX-5D.js +137 -0
  39. package/dist/cjs/nv-fielddate.entry-D-PjbYaA.js +278 -0
  40. package/dist/cjs/nv-fielddate.entry-DRX2mfZL.js +278 -0
  41. package/dist/cjs/nv-fielddaterange.entry-BrC5jKLp.js +355 -0
  42. package/dist/cjs/nv-fielddaterange.entry-ka3JiDvT.js +355 -0
  43. package/dist/cjs/nv-fielddropdown.entry-DUAKFYgw.js +391 -0
  44. package/dist/cjs/nv-fielddropdown.entry-MsUR1kVe.js +391 -0
  45. package/dist/cjs/nv-fielddropdownitem.entry-BsbvJERH.js +70 -0
  46. package/dist/cjs/nv-fielddropdownitem.entry-DRM-Zljt.js +70 -0
  47. package/dist/cjs/nv-fieldmultiselect.entry-DFr-ZICs.js +1060 -0
  48. package/dist/cjs/nv-fieldmultiselect.entry-Dr8FfT_W.js +1060 -0
  49. package/dist/cjs/nv-fieldnumber.entry-DZsM1vmO.js +126 -0
  50. package/dist/cjs/nv-fieldnumber.entry-ezdDvJh_.js +126 -0
  51. package/dist/cjs/nv-fieldpassword.entry-Biw__M2W.js +115 -0
  52. package/dist/cjs/nv-fieldpassword.entry-D4a8SnGr.js +115 -0
  53. package/dist/cjs/nv-fieldradio.entry-Co7WX2vI.js +102 -0
  54. package/dist/cjs/nv-fieldradio.entry-ZL7KgEZ7.js +102 -0
  55. package/dist/cjs/nv-fieldselect.entry-D6eRsM9T.js +365 -0
  56. package/dist/cjs/nv-fieldselect.entry-sTbv_flF.js +365 -0
  57. package/dist/cjs/nv-fieldtext.entry-DKdxC2cG.js +119 -0
  58. package/dist/cjs/nv-fieldtext.entry-DRPCH6Sf.js +119 -0
  59. package/dist/cjs/nv-fieldtextarea.entry-BwJCUiVW.js +194 -0
  60. package/dist/cjs/nv-fieldtextarea.entry-Dc_TGlmI.js +194 -0
  61. package/dist/cjs/nv-fieldtime.entry-CXRtpWt1.js +1011 -0
  62. package/dist/cjs/nv-fieldtime.entry-uU-IET2k.js +1011 -0
  63. package/dist/cjs/nv-icon.entry-iipuvT3D.js +79 -0
  64. package/dist/cjs/nv-icon.entry-xltjoSa2.js +79 -0
  65. package/dist/cjs/nv-iconbutton_2.entry-BsXvYbCi.js +163 -0
  66. package/dist/cjs/nv-iconbutton_2.entry-Dx4usGkY.js +163 -0
  67. package/dist/cjs/nv-menu.entry-D3qvf_0H.js +227 -0
  68. package/dist/cjs/nv-menu.entry-DFEYw_KZ.js +227 -0
  69. package/dist/cjs/nv-menuitem.entry-3t6TixM7.js +58 -0
  70. package/dist/cjs/nv-menuitem.entry-BeTXOtir.js +58 -0
  71. package/dist/cjs/nv-popover.entry-Bv6kuTK_.js +1960 -0
  72. package/dist/cjs/nv-popover.entry-Zt25YeAv.js +1960 -0
  73. package/dist/cjs/nv-row.entry-BPK1Li7w.js +21 -0
  74. package/dist/cjs/nv-row.entry-Bwzlub3i.js +21 -0
  75. package/dist/cjs/nv-stack.entry-ByaO-0TJ.js +30 -0
  76. package/dist/cjs/nv-stack.entry-bhess4lQ.js +30 -0
  77. package/dist/cjs/nv-table.entry-C7Hd57Iq.js +338 -0
  78. package/dist/cjs/nv-table.entry-D3U4dFcw.js +338 -0
  79. package/dist/cjs/nv-tablecolumn.entry-BDCw_45v.js +18 -0
  80. package/dist/cjs/nv-tablecolumn.entry-BzwWPlLf.js +18 -0
  81. package/dist/cjs/nv-toggle.entry-BTqGH_H0.js +79 -0
  82. package/dist/cjs/nv-toggle.entry-DXpNGkbz.js +79 -0
  83. package/dist/cjs/nv-tooltip.entry-BDZfrLHv.js +44 -0
  84. package/dist/cjs/nv-tooltip.entry-CvCZZV88.js +44 -0
  85. package/dist/cjs/timeline.animation-1b88f052-B8-vCVrY.js +105 -0
  86. package/dist/cjs/v4-a79185f4-2n0dOd_Y.js +56 -0
  87. package/dist/generated/components.js +16 -0
  88. package/dist/types/generated/components.d.ts +19 -3
  89. package/package.json +1 -1
@@ -0,0 +1,365 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-CinzsZ8D.js');
4
+ var v4A79185f4 = require('./v4-a79185f4-2n0dOd_Y.js');
5
+ require('react');
6
+
7
+ const nvFieldselectCss = "nv-fieldselect{--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}nv-fieldselect[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-fieldselect[display-value]:not([display-value=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-fieldselect[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)}nv-fieldselect[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-fieldselect[required]:not([required=false]) label::after{content:\"*\";color:var(--components-form-text-required);font-weight:700}nv-fieldselect[multiple]:not([multiple=false]) .select-wrapper>.select-container>.select-icons{top:var(--form-field-padding-y);right:var(--form-field-padding-x)}nv-fieldselect[multiple]:not([multiple=false]) .select-wrapper>.select-container>select{height:100%;box-sizing:border-box}nv-fieldselect 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-fieldselect .select-wrapper{display:flex;flex-wrap:wrap;align-items:stretch;align-self:stretch}nv-fieldselect .select-wrapper .select-container{position:relative;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);background:var(--nv-field-background);transition:all 150ms ease-out}nv-fieldselect .select-wrapper .select-container:hover{border-color:var(--nv-field-border-hover)}nv-fieldselect .select-wrapper .select-container:focus-within{border-color:var(--nv-field-border-focus);box-shadow:0 0 0 var(--focus-field-stroke) var(--nv-field-focus-box-shadow)}nv-fieldselect .select-wrapper .select-container:has(select:disabled){opacity:0.5;background-color:var(--components-form-field-background-disabled);border-color:var(--nv-field-border-disabled)}nv-fieldselect .select-wrapper .select-container>.select-icons{position:absolute;right:0;top:0;pointer-events:none}nv-fieldselect .select-wrapper .select-container>.select-icons>nv-iconbutton{border:0px;border-radius:0px}nv-fieldselect .select-wrapper .select-container>.select-icons>nv-iconbutton:focus-visible{border-radius:var(--button-md-border-radius);outline-offset:-3px}nv-fieldselect .select-wrapper .select-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)}nv-fieldselect .select-wrapper .select-container input:focus{outline:none}nv-fieldselect .select-wrapper .select-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-fieldselect .select-wrapper .select-container input:read-only{opacity:0.5;background-color:var(--components-form-field-background-readonly, rgba(0, 0, 0, 0.1));border-color:var(--nv-field-border-readonly)}nv-fieldselect .select-wrapper .select-container select{display:flex;align-items:center;flex:1 0 0;overflow:hidden;background-color:transparent;color:var(--components-form-field-content-text);text-overflow:ellipsis;font-size:var(--form-field-font-size);font-style:normal;font-weight:500;height:var(--form-field-line-height);padding:var(--form-field-padding-y) var(--form-field-padding-x);box-sizing:content-box;-webkit-appearance:none;-moz-appearance:none;cursor:pointer}nv-fieldselect .select-wrapper .select-container select:focus{outline:none}nv-fieldselect .select-wrapper .select-container select::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-fieldselect .select-wrapper .select-container select option{font-size:var(--form-field-font-size, 16px);font-style:normal;font-weight:500;line-height:var(--form-field-line-height, 24px)}nv-fieldselect .select-wrapper .select-container select.hidden{display:none}nv-fieldselect .select-wrapper .select-container nv-icon.readonly-icon{color:var(--nv-field-border-default)}nv-fieldselect .select-wrapper .select-container nv-icon.validation{color:var(--nv-field-border-default)}nv-fieldselect .description{align-self:stretch;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-fieldselect .error-description{align-self:stretch;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)}";
8
+ const NvFieldselectStyle0 = nvFieldselectCss;
9
+
10
+ const NvFieldselect = class {
11
+ constructor(hostRef) {
12
+ index.registerInstance(this, hostRef);
13
+ this.valueChanged = index.createEvent(this, "valueChanged");
14
+ //#endregion DEPRECATED
15
+ /****************************************************************************/
16
+ //#region STATES
17
+ this.computedDisplayValue = '';
18
+ this.internalReadonly = false;
19
+ /**
20
+ * Parsed options stored internally
21
+ */
22
+ this.parsedOptions = [];
23
+ //#endregion STATES
24
+ /****************************************************************************/
25
+ //#region PROPERTIES
26
+ /**
27
+ * Sets the ID for the select element and the for attribute of the associated
28
+ * label. If no ID is provided, a random one will be automatically generated
29
+ * to ensure unique identification, facilitating proper label association and
30
+ * accessibility.
31
+ */
32
+ this.inputId = v4A79185f4.v4();
33
+ /**
34
+ * The disabled prop lets you turn off the select field so that users can’t
35
+ * choose something. When disabled, the field is grayed out and won’t respond to
36
+ * clicks or touches.
37
+ */
38
+ this.disabled = false;
39
+ /**
40
+ * Display the select field’s content without allowing users to change it.
41
+ * Users can still click on it, select, and copy the text, but they won’t be
42
+ * able to change or delete anything.
43
+ */
44
+ this.readonly = false;
45
+ /**
46
+ * Marks the select field as required, ensuring that the user must fill it out
47
+ * before submitting the form.
48
+ */
49
+ this.required = false;
50
+ /**
51
+ * Alters the select field’s appearance to indicate an error, helping users
52
+ * identify fields that need correction.
53
+ * @validator error
54
+ */
55
+ this.error = false;
56
+ /**
57
+ * Changes the select field’s appearance to indicate successful input or
58
+ * validation.
59
+ */
60
+ this.success = false;
61
+ /**
62
+ * When enabled, allows the select to handle multiple selections.
63
+ */
64
+ this.multiple = false;
65
+ /**
66
+ * The value of the select field.
67
+ * - If `multiple` is `false`, it's a single string.
68
+ * - If `multiple` is `true`, it's a comma-separated string of selected values.
69
+ */
70
+ this.value = '';
71
+ /**
72
+ * When enabled, displays the value element instead of the label when readonly.
73
+ * By default, the label is displayed in readonly mode. Also it automatically
74
+ * sets the component to readonly.
75
+ */
76
+ this.displayValue = false;
77
+ /**
78
+ * Applies focus to the input field as soon as the component is mounted. This
79
+ * is equivalent to setting the native autofocus attribute on a <select>
80
+ * element.
81
+ */
82
+ this.autofocus = false;
83
+ //#endregion WATCHERS
84
+ /****************************************************************************/
85
+ //#region METHODS
86
+ /**
87
+ * Handles the change event on the select element. This method is used to
88
+ * update the value property when the selected options change. It is also
89
+ * used to emit the selectChanged event when the selected value changes.
90
+ * @param {Event} event - The change event on the select element.
91
+ * @emits selectChanged
92
+ */
93
+ this.handleSelectChange = (event) => {
94
+ const select = event.target;
95
+ let selectedValues = Array.from(select.selectedOptions).map(option => option.value);
96
+ if (!this.multiple) {
97
+ selectedValues = selectedValues.slice(0, 1);
98
+ }
99
+ this.value = this.multiple
100
+ ? selectedValues.join(', ')
101
+ : selectedValues[0] || '';
102
+ this.valueChanged.emit(this.value);
103
+ // Update form value
104
+ this.setFormValue();
105
+ };
106
+ /**
107
+ * Handles focus when the select container is clicked.
108
+ */
109
+ this.handleSelectContainerClick = () => {
110
+ if (!this.internalReadonly && this.selectElement) {
111
+ this.selectElement.focus();
112
+ }
113
+ };
114
+ }
115
+ //#endregion EVENTS
116
+ /****************************************************************************/
117
+ //#region WATCHERS
118
+ /**
119
+ * Updates the display value when the value property changes. This watcher is
120
+ * used to update the display value when the selected value changes. This is
121
+ * necessary for readonly select fields to display the selected value.
122
+ * @internal This watcher is not intended to be called outside of the component.
123
+ * @param {string} newValue - The new value of the select field.
124
+ */
125
+ updateDisplayValueWatcher(newValue) {
126
+ this.updateDisplayValue();
127
+ if (this.selectElement) {
128
+ const selectedValues = newValue.split(',').map(val => val.trim());
129
+ const options = this.selectElement.options;
130
+ if (options) {
131
+ Array.from(options).forEach(option => {
132
+ option.selected = this.multiple
133
+ ? selectedValues.includes(option.value)
134
+ : option.value === selectedValues[0];
135
+ });
136
+ if (!this.multiple) {
137
+ this.selectElement.value = newValue; // Only set when not multiple
138
+ }
139
+ }
140
+ else {
141
+ this.selectElement.value = selectedValues[0] || '';
142
+ }
143
+ }
144
+ // Update form value
145
+ this.setFormValue();
146
+ }
147
+ /**
148
+ * Watcher for the displayValue prop to ensure internalReadonly is true when displayValue is true.
149
+ * @param {boolean} newValue - The new value of displayValue.
150
+ */
151
+ handleDisplayValueChange(newValue) {
152
+ this.internalReadonly = newValue; // Set internalReadonly to true if displayValue is true
153
+ if (this.readonly) {
154
+ this.internalReadonly = true;
155
+ }
156
+ }
157
+ /**
158
+ * Watcher for the readonly prop to ensure internalReadonly is true when readonly is true.
159
+ * @param {boolean} newValue - The new value of readonly.
160
+ */
161
+ handleReadonlyChange(newValue) {
162
+ this.internalReadonly = newValue; // Set internalReadonly to true if displayValue is true
163
+ if (this.displayValue) {
164
+ this.internalReadonly = true;
165
+ }
166
+ }
167
+ /**
168
+ * Parse options and update the internal state
169
+ * @param {string} newValue - The new value of options
170
+ */
171
+ handleOptionsChange(newValue) {
172
+ if (typeof newValue === 'string') {
173
+ try {
174
+ const parsedOpts = JSON.parse(newValue);
175
+ this.parsedOptions = [...parsedOpts];
176
+ // Update the value if an option is pre-selected
177
+ const selectedOption = parsedOpts.find(opt => opt.selected);
178
+ if (selectedOption) {
179
+ this.value = selectedOption.value;
180
+ }
181
+ }
182
+ catch (error) {
183
+ console.error('Error parsing options:', error);
184
+ this.parsedOptions = [];
185
+ }
186
+ }
187
+ }
188
+ /**
189
+ * Updates the display value of the select field. This method is used to
190
+ * update the display value when the selected value changes. This is necessary
191
+ * for readonly select fields to display the selected value. This method is
192
+ * called in the componentDidLoad lifecycle hook and the updateDisplayValueWatcher
193
+ * watcher.
194
+ * @internal This method is not intended to be called outside of the component.
195
+ */
196
+ updateDisplayValue() {
197
+ if (this.internalReadonly && !this.displayValue) {
198
+ if (this.multiple) {
199
+ const selectedLabels = this.value
200
+ .split(',')
201
+ .map(key => key.trim())
202
+ .map(key => this.getLabelFromId(key) || '')
203
+ .filter(label => label !== '');
204
+ this.computedDisplayValue = selectedLabels.join(', ') || '';
205
+ }
206
+ else {
207
+ this.computedDisplayValue = this.getLabelFromId(this.value) || '';
208
+ }
209
+ }
210
+ else if (this.internalReadonly && this.displayValue) {
211
+ this.computedDisplayValue = this.value || '';
212
+ }
213
+ }
214
+ /**
215
+ * Retrieves the label from the <option> elements based on the provided key (value).
216
+ * This method uses the id or value attribute directly from the <select> options.
217
+ * @param {string} key - The key (value) for which to find the corresponding label.
218
+ * @returns {string} The label if found; otherwise, an empty string.
219
+ */
220
+ getLabelFromId(key) {
221
+ this.ensureSelectElement();
222
+ if (!this.selectElement) {
223
+ return '';
224
+ }
225
+ // Cache the option list
226
+ const options = this.selectElement.options;
227
+ if (options) {
228
+ const option = Array.from(options).find(option => option.value === key);
229
+ return option ? option.textContent.trim() || '' : '';
230
+ }
231
+ else {
232
+ return '';
233
+ }
234
+ }
235
+ /**
236
+ * Sets the value of the form element for form submission. This method is
237
+ * called when the selected value changes or when the value property is set.
238
+ * @internal This method is not intended to be called outside of the component.
239
+ */
240
+ setFormValue() {
241
+ this.internals.setFormValue(this.value);
242
+ }
243
+ /**
244
+ * Ensures the select element is available. This method is used to ensure
245
+ * the select element is available before attempting to access it.
246
+ * @internal This method is not intended to be called outside of the component.
247
+ */
248
+ ensureSelectElement() {
249
+ if (!this.selectElement) {
250
+ this.selectElement = this.el.querySelector('select');
251
+ }
252
+ }
253
+ //#endregion METHODS
254
+ /****************************************************************************/
255
+ //#region LIFECYCLE
256
+ componentWillRender() {
257
+ this.updateDisplayValue(); // Ensure display value is updated before render
258
+ if (this.message) {
259
+ this.description = this.message;
260
+ }
261
+ if (this.validation) {
262
+ this.errorDescription = this.validation;
263
+ this.error = true;
264
+ }
265
+ }
266
+ /**
267
+ * Lifecycle method that is called before the component is rendered. This is
268
+ * where the internal state is set up before rendering occurs.
269
+ */
270
+ componentWillLoad() {
271
+ // Set internalReadonly based on the readonly prop
272
+ this.internalReadonly = this.readonly;
273
+ // Ensure internalReadonly is true if displayValue is true during loading
274
+ if (this.displayValue) {
275
+ this.internalReadonly = true;
276
+ }
277
+ if ('attachInternals' in this.el) {
278
+ this.internals = this.el.attachInternals();
279
+ }
280
+ else {
281
+ // Fallback logic for browsers without attachInternals support
282
+ this.internals = {
283
+ setFormValue: (value) => {
284
+ const formElement = this.el.closest('form');
285
+ if (formElement) {
286
+ const input = document.createElement('input');
287
+ input.type = 'hidden';
288
+ input.name = this.name;
289
+ input.value = value;
290
+ formElement.appendChild(input);
291
+ }
292
+ },
293
+ };
294
+ }
295
+ // Initialize value as an empty string if multiple is true
296
+ if (this.multiple && typeof this.value !== 'string') {
297
+ this.value = '';
298
+ }
299
+ // Parse initial options if present
300
+ if (this.options) {
301
+ this.handleOptionsChange(this.options);
302
+ }
303
+ }
304
+ /**
305
+ * Lifecycle method that is called after the component has been rendered.
306
+ * This is where the display value is updated and the initial select element's
307
+ * state is set.
308
+ */
309
+ componentDidLoad() {
310
+ this.updateDisplayValue();
311
+ if (this.selectElement) {
312
+ // Only set the value for single selection, skip for multiple
313
+ if (!this.multiple) {
314
+ this.selectElement.value = this.value;
315
+ }
316
+ const selectedValues = this.multiple
317
+ ? this.value.split(',').map(v => v.trim())
318
+ : [this.value];
319
+ const options = this.selectElement.options;
320
+ if (options) {
321
+ Array.from(options).forEach(option => {
322
+ option.selected = this.multiple
323
+ ? selectedValues.includes(option.value)
324
+ : option.value === selectedValues[0];
325
+ });
326
+ }
327
+ else {
328
+ // Handle case where there are no options
329
+ this.selectElement.value = selectedValues[0] || '';
330
+ }
331
+ }
332
+ // Set the initial form value
333
+ this.setFormValue();
334
+ }
335
+ //#endregion LIFECYCLE
336
+ /****************************************************************************/
337
+ //#region RENDERING
338
+ /**
339
+ * The render method creates the HTML structure for the component, including
340
+ * the label, select element, and any error or description messages. It also
341
+ * applies the appropriate CSS classes based on the readonly state and
342
+ * displayValue prop. This method is called when the component is rendered.
343
+ * @returns {HTMLStencilElement} The HTML element to render.
344
+ */
345
+ render() {
346
+ return (index.h(index.Host, { key: 'e447f10faacbd9107b3636b711745655b234daaf' }, (this.label || this.el.querySelector('[slot="label"]')) && (index.h("label", { key: '6949ffbfa4a3d055689aa384521456277336eb31', htmlFor: this.inputId }, index.h("slot", { key: 'c46be62ffca373acaa64555dd055d0e506731ff8', name: "label" }, this.label))), index.h("div", { key: '73173b60885c479e76c9d089f40033ac73641597', class: "select-wrapper" }, index.h("slot", { key: 'a64bbdef05fd860d1534bea9c5d8143abe2aa688', name: "before-input" }), index.h("div", { key: 'c8d5503afd194397a0385959fbe557544208f7e9', class: "select-container", onClick: this.handleSelectContainerClick }, index.h("slot", { key: '82456f7f21d552459af03787b26363acb9d77cb8', name: "leading-input" }), this.internalReadonly && (index.h("input", { key: '2b02c5f82fd43d2f12d2473ebe68704e7aac2c52', id: this.inputId + '-readonly', type: "text", value: this.computedDisplayValue, readonly: true, class: "readonly-input", "aria-readonly": "true", "aria-label": this.label, "aria-describedby": this.error
347
+ ? `${this.inputId}-error`
348
+ : `${this.inputId}-description` })), index.h("select", { key: '597815200ff13a3a94c5f8cf2f31f292630831a1', id: this.inputId, ref: el => (this.selectElement = el), name: this.name, autofocus: this.autofocus, disabled: this.disabled, required: this.required, multiple: this.multiple, onChange: this.handleSelectChange, class: this.internalReadonly ? 'hidden' : '', "aria-label": this.label, "aria-describedby": this.error
349
+ ? `${this.inputId}-error`
350
+ : `${this.inputId}-description` }, this.parsedOptions.length > 0 ? (this.parsedOptions.map(option => (index.h("option", { value: option.value, selected: option.selected, disabled: option.disabled }, option.label)))) : (index.h("slot", null))), index.h("div", { key: 'e7315331865264cfceefc37333f29f503cfaca60', class: "select-icons" }, this.error && (index.h("nv-icon", { key: '20b2a3b436a31b4528c0a6336433baa20f1dade7', name: "alert-circle", class: "validation", size: "md" })), this.success && (index.h("nv-icon", { key: '6ddb9ce572a0e66670ea3a3f084c08b465a1054f', name: "circle-check", class: "validation", size: "md" })), !this.multiple && (index.h("nv-iconbutton", { key: '7df5645e762451036ba84e8ae7e533f6d9c9e89e', name: "chevron-down", size: "md", emphasis: "lower", tabIndex: -1 })))), index.h("slot", { key: '43220cb3c92d9876e2f22645ed695c076439999a', name: "after-input" })), (this.description ||
351
+ this.el.querySelector('[slot="description"]')) && (index.h("div", { key: '7ca06f0ec81f82cce825045bef226bdaeaa2774d', class: "description", id: `${this.inputId}-description` }, index.h("slot", { key: '008a54ac423cfe534214d0f32d5b557419d60aaf', name: "description" }, this.description))), (this.errorDescription ||
352
+ this.el.querySelector('[slot="error-description"]')) && (index.h("div", { key: '1c5d34d7441cdaa28c463f062c74070b8193433e', class: "error-description", id: `${this.inputId}-error` }, index.h("slot", { key: '98a88b41c33a87541d2b3833ca95fc5dff7a8d2e', name: "error-description" }, this.errorDescription)))));
353
+ }
354
+ static get formAssociated() { return true; }
355
+ get el() { return index.getElement(this); }
356
+ static get watchers() { return {
357
+ "value": ["updateDisplayValueWatcher"],
358
+ "displayValue": ["handleDisplayValueChange"],
359
+ "readonly": ["handleReadonlyChange"],
360
+ "options": ["handleOptionsChange"]
361
+ }; }
362
+ };
363
+ NvFieldselect.style = NvFieldselectStyle0;
364
+
365
+ exports.nv_fieldselect = NvFieldselect;
@@ -0,0 +1,119 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-C8UfzrMI.js');
4
+ var v4A79185f4 = require('./v4-a79185f4-2n0dOd_Y.js');
5
+ require('react');
6
+
7
+ const nvFieldtextCss = "nv-fieldtext{--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}nv-fieldtext[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-fieldtext[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)}nv-fieldtext[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-fieldtext[required]:not([required=false]) label::after{content:\"*\";color:var(--components-form-text-required);font-weight:700}nv-fieldtext>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-fieldtext>.input-wrapper{display:flex;flex-wrap:wrap;gap:var(--form-gap-x);align-items:stretch;align-self:stretch}nv-fieldtext>.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-fieldtext>.input-wrapper .input-container:hover{border-color:var(--nv-field-border-hover)}nv-fieldtext>.input-wrapper .input-container:focus-within,nv-fieldtext>.input-wrapper .input-container:focus-within:hover,nv-fieldtext>.input-wrapper .input-container:focus,nv-fieldtext>.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-fieldtext>.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-fieldtext>.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-fieldtext>.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)}nv-fieldtext>.input-wrapper .input-container input:focus{outline:none}nv-fieldtext>.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-fieldtext>.input-wrapper .input-container nv-icon.validation{color:var(--nv-field-border-default);margin-right:var(--form-gap-x)}nv-fieldtext>.description{align-self:stretch;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-fieldtext>.error-description{align-self:stretch;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)}";
8
+ const NvFieldtextStyle0 = nvFieldtextCss;
9
+
10
+ const NvFieldtext = class {
11
+ constructor(hostRef) {
12
+ index.registerInstance(this, hostRef);
13
+ this.valueChanged = index.createEvent(this, "valueChanged");
14
+ //#endregion DEPRECATED
15
+ /****************************************************************************/
16
+ //#region PROPERTIES
17
+ /**
18
+ * Sets the ID for the input element and the for attribute of the associated
19
+ * label. If no ID is provided, a random one will be automatically generated
20
+ * to ensure unique identification, facilitating proper label association and
21
+ * accessibility.
22
+ */
23
+ this.inputId = v4A79185f4.v4();
24
+ /**
25
+ * The type prop lets you specify what kind of information the input field
26
+ * should accept. Choose 'text' for general words or sentences, 'tel' for
27
+ * phone numbers, or 'email' for email addresses. This makes sure users get
28
+ * the right keyboard and validation for what they need to enter.
29
+ */
30
+ this.type = 'text';
31
+ /**
32
+ * The disabled prop lets you turn off the input field so that users can’t
33
+ * type in it. When disabled, the field is grayed out and won’t respond to
34
+ * clicks or touches.
35
+ */
36
+ this.disabled = false;
37
+ /**
38
+ * Display the input field’s content without allowing users to change it.
39
+ * Users can still click on it, select, and copy the text, but they won’t be
40
+ * able to type or delete anything.
41
+ */
42
+ this.readonly = false;
43
+ /**
44
+ * Marks the input field as required, ensuring that the user must fill it out
45
+ * before submitting the form.
46
+ */
47
+ this.required = false;
48
+ /**
49
+ * Alters the input field’s appearance to indicate an error, helping users
50
+ * identify fields that need correction.
51
+ * @validator error
52
+ */
53
+ this.error = false;
54
+ /**
55
+ * Changes the input field’s appearance to indicate successful input or
56
+ * validation.
57
+ */
58
+ this.success = false;
59
+ /**
60
+ * When used with the email input type, this prop enables the field to accept
61
+ * multiple email addresses. Users can enter several addresses, separating
62
+ * each one with a comma, allowing the form to handle multiple recipients.
63
+ */
64
+ this.multiple = false;
65
+ /**
66
+ * Applies focus to the input field as soon as the component is mounted. This
67
+ * is equivalent to setting the native autofocus attribute on an <input>
68
+ * element.
69
+ */
70
+ this.autofocus = false;
71
+ //#endregion EVENTS
72
+ /****************************************************************************/
73
+ //#region METHODS
74
+ /**
75
+ * Handles the input event on the input element.
76
+ * Emits the inputChanged event with the new value.
77
+ * @param {Event} event - Event object of the input event.
78
+ */
79
+ this.handleInput = (event) => {
80
+ const input = event.target;
81
+ this.value = input.value;
82
+ this.valueChanged.emit(input.value);
83
+ };
84
+ /**
85
+ * Handles focus when the input container is clicked.
86
+ */
87
+ this.handleInputContainerClick = () => {
88
+ this.inputElement.focus();
89
+ };
90
+ }
91
+ //#endregion METHODS
92
+ /****************************************************************************/
93
+ //#region LIFECYCLE
94
+ componentWillRender() {
95
+ if (this.textInputType) {
96
+ this.type = this.textInputType;
97
+ }
98
+ if (this.message) {
99
+ this.description = this.message;
100
+ }
101
+ if (this.validation) {
102
+ this.errorDescription = this.validation;
103
+ this.error = true;
104
+ }
105
+ }
106
+ //#endregion LIFECYCLE
107
+ /****************************************************************************/
108
+ //#region RENDER
109
+ render() {
110
+ return (index.h(index.Host, { key: 'c2087a4b6384599a1cc52b18b8c4f981f9de5368' }, (this.label || this.el.querySelector('[slot="label"]')) && (index.h("label", { key: 'cff1e42c5a60b4a21af73baa86c45f7cc25520cc', htmlFor: this.inputId }, index.h("slot", { key: '2bc682d07f905ecb9e02b12b114fee9e88a8c1dd', name: "label" }, this.label))), index.h("div", { key: '84e4440e2a774d7ea0fa92cc9b70ebb1dc75c001', class: "input-wrapper" }, index.h("slot", { key: 'd35fce40a0bb9927bb734628968b6ccfd0a38fe9', name: "before-input" }), index.h("div", { key: '2e3ef34b8cee6187f5996ba4475266f4db65d93f', class: "input-container", onClick: this.handleInputContainerClick }, index.h("slot", { key: '0504980d073238202e51eccde3f4d38f133e883e', name: "leading-input" }), index.h("input", { key: '8208b2ac4c2c8181bcac9542e838aa14bf19c897', id: this.inputId, ref: e => (this.inputElement = e), placeholder: this.placeholder, name: this.name, type: this.type, disabled: this.disabled, readOnly: this.readonly, required: this.required, maxlength: this.maxlength, minlength: this.minlength, pattern: this.pattern, autofocus: this.autofocus, autocomplete: this.autocomplete, multiple: this.multiple, value: this.value, onInput: this.handleInput }), this.error && (index.h("nv-icon", { key: 'f1ade80215e39b7fcc1b28ee8b5bd3a075df1f21', name: "alert-circle", class: "validation", size: "md" })), this.success && (index.h("nv-icon", { key: '15c0df99a2cc6033f760ef9966a1d5c75bcbfac3', name: "circle-check", class: "validation", size: "md" }))), index.h("slot", { key: '2374d49838eaed58f9564a7dbb2b7162e828950b', name: "after-input" })), (this.description ||
111
+ this.el.querySelector('[slot="description"]')) && (index.h("div", { key: 'f28c3e325fbcca0de0aabb94914d2049d8165bb6', class: "description" }, index.h("slot", { key: 'e4bfe4450070f1b15ff67ccfffaf474f59f0aa3d', name: "description" }, this.description))), (this.errorDescription ||
112
+ this.el.querySelector('[slot="error-description"]')) && (index.h("div", { key: '9413a8cd161b7458f6e9d8cb3f0c52128f6861e3', hidden: !this.error, class: "error-description" }, index.h("slot", { key: 'a831645d3c45469e92ec24a8e6c92b7285a0b3f1', name: "error-description" }, this.errorDescription)))));
113
+ }
114
+ static get formAssociated() { return true; }
115
+ get el() { return index.getElement(this); }
116
+ };
117
+ NvFieldtext.style = NvFieldtextStyle0;
118
+
119
+ exports.nv_fieldtext = NvFieldtext;
@@ -0,0 +1,119 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-CinzsZ8D.js');
4
+ var v4A79185f4 = require('./v4-a79185f4-2n0dOd_Y.js');
5
+ require('react');
6
+
7
+ const nvFieldtextCss = "nv-fieldtext{--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}nv-fieldtext[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-fieldtext[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)}nv-fieldtext[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-fieldtext[required]:not([required=false]) label::after{content:\"*\";color:var(--components-form-text-required);font-weight:700}nv-fieldtext>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-fieldtext>.input-wrapper{display:flex;flex-wrap:wrap;gap:var(--form-gap-x);align-items:stretch;align-self:stretch}nv-fieldtext>.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-fieldtext>.input-wrapper .input-container:hover{border-color:var(--nv-field-border-hover)}nv-fieldtext>.input-wrapper .input-container:focus-within,nv-fieldtext>.input-wrapper .input-container:focus-within:hover,nv-fieldtext>.input-wrapper .input-container:focus,nv-fieldtext>.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-fieldtext>.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-fieldtext>.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-fieldtext>.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)}nv-fieldtext>.input-wrapper .input-container input:focus{outline:none}nv-fieldtext>.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-fieldtext>.input-wrapper .input-container nv-icon.validation{color:var(--nv-field-border-default);margin-right:var(--form-gap-x)}nv-fieldtext>.description{align-self:stretch;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-fieldtext>.error-description{align-self:stretch;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)}";
8
+ const NvFieldtextStyle0 = nvFieldtextCss;
9
+
10
+ const NvFieldtext = class {
11
+ constructor(hostRef) {
12
+ index.registerInstance(this, hostRef);
13
+ this.valueChanged = index.createEvent(this, "valueChanged");
14
+ //#endregion DEPRECATED
15
+ /****************************************************************************/
16
+ //#region PROPERTIES
17
+ /**
18
+ * Sets the ID for the input element and the for attribute of the associated
19
+ * label. If no ID is provided, a random one will be automatically generated
20
+ * to ensure unique identification, facilitating proper label association and
21
+ * accessibility.
22
+ */
23
+ this.inputId = v4A79185f4.v4();
24
+ /**
25
+ * The type prop lets you specify what kind of information the input field
26
+ * should accept. Choose 'text' for general words or sentences, 'tel' for
27
+ * phone numbers, or 'email' for email addresses. This makes sure users get
28
+ * the right keyboard and validation for what they need to enter.
29
+ */
30
+ this.type = 'text';
31
+ /**
32
+ * The disabled prop lets you turn off the input field so that users can’t
33
+ * type in it. When disabled, the field is grayed out and won’t respond to
34
+ * clicks or touches.
35
+ */
36
+ this.disabled = false;
37
+ /**
38
+ * Display the input field’s content without allowing users to change it.
39
+ * Users can still click on it, select, and copy the text, but they won’t be
40
+ * able to type or delete anything.
41
+ */
42
+ this.readonly = false;
43
+ /**
44
+ * Marks the input field as required, ensuring that the user must fill it out
45
+ * before submitting the form.
46
+ */
47
+ this.required = false;
48
+ /**
49
+ * Alters the input field’s appearance to indicate an error, helping users
50
+ * identify fields that need correction.
51
+ * @validator error
52
+ */
53
+ this.error = false;
54
+ /**
55
+ * Changes the input field’s appearance to indicate successful input or
56
+ * validation.
57
+ */
58
+ this.success = false;
59
+ /**
60
+ * When used with the email input type, this prop enables the field to accept
61
+ * multiple email addresses. Users can enter several addresses, separating
62
+ * each one with a comma, allowing the form to handle multiple recipients.
63
+ */
64
+ this.multiple = false;
65
+ /**
66
+ * Applies focus to the input field as soon as the component is mounted. This
67
+ * is equivalent to setting the native autofocus attribute on an <input>
68
+ * element.
69
+ */
70
+ this.autofocus = false;
71
+ //#endregion EVENTS
72
+ /****************************************************************************/
73
+ //#region METHODS
74
+ /**
75
+ * Handles the input event on the input element.
76
+ * Emits the inputChanged event with the new value.
77
+ * @param {Event} event - Event object of the input event.
78
+ */
79
+ this.handleInput = (event) => {
80
+ const input = event.target;
81
+ this.value = input.value;
82
+ this.valueChanged.emit(input.value);
83
+ };
84
+ /**
85
+ * Handles focus when the input container is clicked.
86
+ */
87
+ this.handleInputContainerClick = () => {
88
+ this.inputElement.focus();
89
+ };
90
+ }
91
+ //#endregion METHODS
92
+ /****************************************************************************/
93
+ //#region LIFECYCLE
94
+ componentWillRender() {
95
+ if (this.textInputType) {
96
+ this.type = this.textInputType;
97
+ }
98
+ if (this.message) {
99
+ this.description = this.message;
100
+ }
101
+ if (this.validation) {
102
+ this.errorDescription = this.validation;
103
+ this.error = true;
104
+ }
105
+ }
106
+ //#endregion LIFECYCLE
107
+ /****************************************************************************/
108
+ //#region RENDER
109
+ render() {
110
+ return (index.h(index.Host, { key: '9979c9c835f414965a4ae1ee3db398ee6223c3a9' }, (this.label || this.el.querySelector('[slot="label"]')) && (index.h("label", { key: '899abb4f3faaa65e1f32738e7ab91440dcc32fd2', htmlFor: this.inputId }, index.h("slot", { key: 'f82bb9e2e63d56afb8078ffcdaee8da6d2b3df87', name: "label" }, this.label))), index.h("div", { key: 'b75dfdfc0c875db7019a23c084133b90d957ed8e', class: "input-wrapper" }, index.h("slot", { key: 'cf4cd32cd106bee88c662fd0960e67ba87dddbc9', name: "before-input" }), index.h("div", { key: '2f005ef34a722424dcf86c9e189d1ab001bd2495', class: "input-container", onClick: this.handleInputContainerClick }, index.h("slot", { key: '0d554159f716ed6a4dae76a6b0befd05cdf97173', name: "leading-input" }), index.h("input", { key: '8dbba6bce4617cbd3d9168b897c0101c83fb6e1e', id: this.inputId, ref: e => (this.inputElement = e), placeholder: this.placeholder, name: this.name, type: this.type, disabled: this.disabled, readOnly: this.readonly, required: this.required, maxlength: this.maxlength, minlength: this.minlength, pattern: this.pattern, autofocus: this.autofocus, autocomplete: this.autocomplete, multiple: this.multiple, value: this.value, onInput: this.handleInput }), this.error && (index.h("nv-icon", { key: 'cb4a0028e53aefcaf9b3127488811ea9d66cd305', name: "alert-circle", class: "validation", size: "md" })), this.success && (index.h("nv-icon", { key: '307fa39a19684d92b5e64ce83301dac337948822', name: "circle-check", class: "validation", size: "md" }))), index.h("slot", { key: 'a8eb4186286fd472b7c0d515be544e6331bad33c', name: "after-input" })), (this.description ||
111
+ this.el.querySelector('[slot="description"]')) && (index.h("div", { key: 'f5bd9926035d6d8829382adea3f68eb633bbf738', class: "description" }, index.h("slot", { key: '561c28cc04225e9d84a86b161714efde4882debe', name: "description" }, this.description))), (this.errorDescription ||
112
+ this.el.querySelector('[slot="error-description"]')) && (index.h("div", { key: '09e08c344f477d70f698a9c11e38c737667c4ef6', hidden: !this.error, class: "error-description" }, index.h("slot", { key: '117cd688cb63f5411225d468ca2071b19c1be39f', name: "error-description" }, this.errorDescription)))));
113
+ }
114
+ static get formAssociated() { return true; }
115
+ get el() { return index.getElement(this); }
116
+ };
117
+ NvFieldtext.style = NvFieldtextStyle0;
118
+
119
+ exports.nv_fieldtext = NvFieldtext;