@nova-design-system/nova-react 3.0.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{constants-98e2dcc2-C0SBCapP.js → constants-b97e736d-BzFAKCkR.js} +11 -0
- package/dist/cjs/{index-Byv3Vmev.js → index-B2jv2KXv.js} +2856 -1620
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/{nv-alert.entry-BXY4KXbF.js → nv-alert.entry-pxBJfmIm.js} +11 -11
- package/dist/cjs/{nv-avatar.entry-BnPSKkJJ.js → nv-avatar.entry-CHtVctSK.js} +7 -7
- package/dist/cjs/nv-badge_2.entry-BO88KO1O.js +204 -0
- package/dist/cjs/{nv-breadcrumb.entry-D5vGHLOG.js → nv-breadcrumb.entry-7azRtyl5.js} +1 -1
- package/dist/cjs/{nv-breadcrumbs.entry-CsaqAsnb.js → nv-breadcrumbs.entry-DfZVMKpY.js} +1 -1
- package/dist/cjs/{nv-button.entry-DzZfGZGy.js → nv-button.entry-DW9SblsY.js} +7 -7
- package/dist/cjs/nv-calendar.entry-BeayRRor.js +1043 -0
- package/dist/cjs/{nv-col.entry-Cng8NaTW.js → nv-col.entry-C6oEkSbI.js} +1 -1
- package/dist/cjs/{nv-datagrid.entry-BbAOzpiO.js → nv-datagrid.entry-xhQP6JJP.js} +423 -94
- package/dist/cjs/{nv-datagridcolumn.entry-CRogHbVM.js → nv-datagridcolumn.entry-CjYmo4fM.js} +2 -2
- package/dist/cjs/{nv-dialog.entry-BSIZGYGF.js → nv-dialog.entry-mxETaZbc.js} +19 -13
- package/dist/cjs/{nv-dialogfooter_2.entry-Q4_li_QU.js → nv-dialogfooter_2.entry-DnLg2DHy.js} +3 -3
- package/dist/cjs/{nv-fieldcheckbox.entry-DmgzfmRd.js → nv-fieldcheckbox.entry-Be9__i15.js} +1 -1
- package/dist/cjs/{nv-fielddate.entry-qAvLX_Ru.js → nv-fielddate.entry-BlNily-X.js} +9 -18
- package/dist/cjs/nv-fielddaterange.entry-CycpKoJd.js +408 -0
- package/dist/cjs/{nv-fielddropdown.entry-DKXmoXeW.js → nv-fielddropdown.entry-BPwviyCp.js} +88 -57
- package/dist/cjs/{nv-fielddropdownitem.entry-BVLVXi0e.js → nv-fielddropdownitem.entry-BGuUR9KP.js} +2 -2
- package/dist/cjs/{nv-fieldmultiselect.entry-DrTbd3Dj.js → nv-fieldmultiselect.entry-Lrxr1gsi.js} +122 -104
- package/dist/cjs/nv-fieldnumber.entry-B1VySoWj.js +130 -0
- package/dist/cjs/nv-fieldpassword.entry-D7Qlx7Bh.js +121 -0
- package/dist/cjs/{nv-fieldradio.entry-CVEY4v6F.js → nv-fieldradio.entry-CDu8xs0p.js} +4 -4
- package/dist/cjs/{nv-fieldselect.entry-BrCUuRWa.js → nv-fieldselect.entry-NEdv8bQK.js} +11 -7
- package/dist/cjs/nv-fieldslider.entry-51gF9XPz.js +660 -0
- package/dist/cjs/nv-fieldtext.entry-Bug9zMgo.js +123 -0
- package/dist/cjs/{nv-fieldtextarea.entry-B4qiLmX1.js → nv-fieldtextarea.entry-D44HbsVQ.js} +9 -5
- package/dist/cjs/{nv-fieldtime.entry-Bp2IWjhN.js → nv-fieldtime.entry-MbaWbVtc.js} +71 -68
- package/dist/cjs/nv-icon.entry-BSSHr-ud.js +79 -0
- package/dist/cjs/{nv-iconbutton_2.entry-BRPAGl2S.js → nv-iconbutton_2.entry-DMaO-JWz.js} +3 -3
- package/dist/cjs/{nv-menu.entry-BiWiIZAm.js → nv-menu.entry-D5_lj9XB.js} +4 -2
- package/dist/cjs/{nv-menuitem.entry-CFkXoZ_r.js → nv-menuitem.entry-fhnYI91K.js} +2 -2
- package/dist/cjs/{nv-popover.entry-KT1iQUJk.js → nv-popover.entry-CYqBaVbr.js} +2 -2
- package/dist/cjs/{nv-row.entry-Cs2GDrcu.js → nv-row.entry-BUheLufV.js} +2 -2
- package/dist/cjs/{nv-stack.entry-Ci7pxGSo.js → nv-stack.entry-DNPce51E.js} +2 -2
- package/dist/cjs/{nv-table.entry-N4MV8Y6E.js → nv-table.entry-DXQM8l3t.js} +3 -3
- package/dist/cjs/{nv-tablecolumn.entry-CTz4jsZl.js → nv-tablecolumn.entry-DROQK_0c.js} +1 -1
- package/dist/cjs/{nv-toggle.entry-m10-ncYR.js → nv-toggle.entry-fMzTrdte.js} +3 -3
- package/dist/cjs/{nv-tooltip.entry-B6aRDto3.js → nv-tooltip.entry-yB2Ek1Cz.js} +3 -3
- package/dist/generated/components.js +12 -1
- package/dist/types/generated/components.d.ts +19 -7
- package/package.json +1 -1
- package/dist/cjs/nv-badge_2.entry-BsI3B8Rr.js +0 -195
- package/dist/cjs/nv-calendar.entry-CGKv_-gO.js +0 -1065
- package/dist/cjs/nv-fielddaterange.entry-DVB8Rwxk.js +0 -355
- package/dist/cjs/nv-fieldnumber.entry-DegbEHRL.js +0 -126
- package/dist/cjs/nv-fieldpassword.entry-gqjlEl7a.js +0 -117
- package/dist/cjs/nv-fieldtext.entry-q9NnqL5c.js +0 -119
- package/dist/cjs/nv-icon.entry-B1ax9cJS.js +0 -79
|
@@ -1,355 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var index = require('./index-Byv3Vmev.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-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}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)}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;position:relative;flex:1;min-width:0;padding-right:32px}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%}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 nv-icon.validation{color:var(--nv-field-border-default)}nv-fielddaterange .input-wrapper .input-container .toggle-calendar-icon{position:absolute;right:0;top:50%;transform:translateY(-50%)}nv-fielddaterange .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-fielddaterange .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)}nv-fielddaterange .range-inputs{display:flex;align-items:center;gap:8px;flex:1}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.popoverId = v4A79185f4.v4();
|
|
17
|
-
/****************************************************************************/
|
|
18
|
-
//#region PROPERTIES
|
|
19
|
-
/**
|
|
20
|
-
* Sets the ID for the start input element and the for attribute of the associated
|
|
21
|
-
* label. If no ID is provided, a random one will be automatically generated.
|
|
22
|
-
*/
|
|
23
|
-
this.startInputId = v4A79185f4.v4();
|
|
24
|
-
/**
|
|
25
|
-
* Sets the ID for the end input element and the for attribute of the associated
|
|
26
|
-
* label. If no ID is provided, a random one will be automatically generated.
|
|
27
|
-
*/
|
|
28
|
-
this.endInputId = v4A79185f4.v4();
|
|
29
|
-
/**
|
|
30
|
-
* Disables both input fields.
|
|
31
|
-
*/
|
|
32
|
-
this.disabled = false;
|
|
33
|
-
/**
|
|
34
|
-
* Sets both input fields as read-only.
|
|
35
|
-
*/
|
|
36
|
-
this.readonly = false;
|
|
37
|
-
/**
|
|
38
|
-
* Marks both input fields as required.
|
|
39
|
-
*/
|
|
40
|
-
this.required = false;
|
|
41
|
-
/**
|
|
42
|
-
* Indicates an error state.
|
|
43
|
-
*/
|
|
44
|
-
this.error = false;
|
|
45
|
-
/**
|
|
46
|
-
* Indicates a success state.
|
|
47
|
-
*/
|
|
48
|
-
this.success = false;
|
|
49
|
-
/**
|
|
50
|
-
* Autofocus the start input when the component is mounted.
|
|
51
|
-
*/
|
|
52
|
-
this.shouldAutoFocus = false;
|
|
53
|
-
/**
|
|
54
|
-
* The initial value of the date range (in string format).
|
|
55
|
-
*/
|
|
56
|
-
this.value = '';
|
|
57
|
-
/**
|
|
58
|
-
* The current value of the start date in string format.
|
|
59
|
-
*/
|
|
60
|
-
this.startValue = '';
|
|
61
|
-
/**
|
|
62
|
-
* The current value of the end date in string format.
|
|
63
|
-
*/
|
|
64
|
-
this.endValue = '';
|
|
65
|
-
/**
|
|
66
|
-
* Controls the opening of the popover.
|
|
67
|
-
*/
|
|
68
|
-
this.open = false;
|
|
69
|
-
/**
|
|
70
|
-
* First day of the week 0 = Sunday, 1 = Monday, etc.
|
|
71
|
-
* @default 1
|
|
72
|
-
*/
|
|
73
|
-
this.firstDayOfWeek = 1;
|
|
74
|
-
/**
|
|
75
|
-
* Number of calendars to display
|
|
76
|
-
* @default 2
|
|
77
|
-
*/
|
|
78
|
-
this.numberOfCalendars = 2;
|
|
79
|
-
/**
|
|
80
|
-
* Minimum date for selection ISO string format, ex: 2025-01-01
|
|
81
|
-
*/
|
|
82
|
-
this.min = '';
|
|
83
|
-
/**
|
|
84
|
-
* Maximum date for selection ISO string format, ex: 2025-12-31
|
|
85
|
-
*/
|
|
86
|
-
this.max = '';
|
|
87
|
-
/** Locale for date formatting
|
|
88
|
-
* @default 'en-BE'
|
|
89
|
-
*/
|
|
90
|
-
this.locale = 'en-BE';
|
|
91
|
-
/** Date format ex: YYYY-MM-DD, DD-MM-YYYY, etc.
|
|
92
|
-
* @default 'YYYY-MM-DD'
|
|
93
|
-
*/
|
|
94
|
-
this.dateFormat = 'YYYY-MM-DD';
|
|
95
|
-
/**
|
|
96
|
-
* Footer placement
|
|
97
|
-
* @default 'bottom'
|
|
98
|
-
*/
|
|
99
|
-
this.shortcutsPlacement = 'bottom';
|
|
100
|
-
/**
|
|
101
|
-
* Show action buttons
|
|
102
|
-
* @default false
|
|
103
|
-
*/
|
|
104
|
-
this.showActions = false;
|
|
105
|
-
/**
|
|
106
|
-
* Custom actions to display in the footer
|
|
107
|
-
* JSON array of objects with the following properties:
|
|
108
|
-
* - label: string
|
|
109
|
-
* - onClick: function
|
|
110
|
-
* @default '[]'
|
|
111
|
-
*/
|
|
112
|
-
this.shortcuts = '[]';
|
|
113
|
-
/**
|
|
114
|
-
* Show week numbers
|
|
115
|
-
* @default true
|
|
116
|
-
*/
|
|
117
|
-
// eslint-disable-next-line @stencil-community/ban-default-true
|
|
118
|
-
this.showWeekNumbers = true;
|
|
119
|
-
/**
|
|
120
|
-
* Disabled dates ISO string array
|
|
121
|
-
* @default '[]'
|
|
122
|
-
*/
|
|
123
|
-
this.disabledDates = '[]';
|
|
124
|
-
/**
|
|
125
|
-
* Closes the popover when a click is detected outside the component.
|
|
126
|
-
* @param {MouseEvent} event - The mouse event
|
|
127
|
-
*/
|
|
128
|
-
this.handleClickOutside = (event) => {
|
|
129
|
-
if (this.open && this.el && !this.el.contains(event.target)) {
|
|
130
|
-
this.open = false;
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
/**
|
|
134
|
-
* Handles the input event on the start input element.
|
|
135
|
-
* @param {Event} event - The input event
|
|
136
|
-
*/
|
|
137
|
-
this.handleStartInput = (event) => {
|
|
138
|
-
if (this.readonly || this.disabled) {
|
|
139
|
-
event.preventDefault();
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
const input = event.target;
|
|
143
|
-
this.startValue = input.value;
|
|
144
|
-
this.dateRangeChange.emit({ start: input.value, end: this.endValue });
|
|
145
|
-
};
|
|
146
|
-
/**
|
|
147
|
-
* Handles the input event on the end input element.
|
|
148
|
-
* @param {Event} event - The input event
|
|
149
|
-
*/
|
|
150
|
-
this.handleEndInput = (event) => {
|
|
151
|
-
if (this.readonly || this.disabled) {
|
|
152
|
-
event.preventDefault();
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
const input = event.target;
|
|
156
|
-
this.endValue = input.value;
|
|
157
|
-
this.dateRangeChange.emit({ start: this.startValue, end: input.value });
|
|
158
|
-
};
|
|
159
|
-
/**
|
|
160
|
-
* Handles focus events on the input elements.
|
|
161
|
-
* @param {FocusEvent} event - The focus event
|
|
162
|
-
*/
|
|
163
|
-
this.handleFocus = (event) => {
|
|
164
|
-
if (this.readonly || this.disabled) {
|
|
165
|
-
event.preventDefault();
|
|
166
|
-
event.target.blur();
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
// Open the popover when an input is focused
|
|
170
|
-
this.open = true;
|
|
171
|
-
};
|
|
172
|
-
/**
|
|
173
|
-
* Toggles the opening/closing of the popover.
|
|
174
|
-
*/
|
|
175
|
-
this.toggleCalendar = () => {
|
|
176
|
-
if (this.readonly || this.disabled) {
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
this.open = !this.open;
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
//#endregion PROPERTIES
|
|
183
|
-
/****************************************************************************/
|
|
184
|
-
//#region METHODS
|
|
185
|
-
/**
|
|
186
|
-
* Converts the nv-calendar date format to the format expected by Inputmask.
|
|
187
|
-
* @param {string} format - The date format to convert
|
|
188
|
-
* @returns {string} The converted format for Inputmask
|
|
189
|
-
*/
|
|
190
|
-
convertToInputmaskFormat(format) {
|
|
191
|
-
// Si le format n'est pas spécifié, utiliser le format par défaut YYYY-MM-DD
|
|
192
|
-
if (!format) {
|
|
193
|
-
return 'dd/mm/yyyy';
|
|
194
|
-
}
|
|
195
|
-
// Conversion des formats
|
|
196
|
-
const formatMap = {
|
|
197
|
-
'YYYY-MM-DD': 'yyyy-mm-dd',
|
|
198
|
-
'DD/MM/YYYY': 'dd/mm/yyyy',
|
|
199
|
-
'MM/DD/YYYY': 'mm/dd/yyyy',
|
|
200
|
-
'DD.MM.YYYY': 'dd.mm.yyyy',
|
|
201
|
-
'YYYYMMDD': 'yyyymmdd',
|
|
202
|
-
};
|
|
203
|
-
return formatMap[format] || 'dd/mm/yyyy';
|
|
204
|
-
}
|
|
205
|
-
//#endregion METHODS
|
|
206
|
-
/****************************************************************************/
|
|
207
|
-
//#region LIFECYCLE
|
|
208
|
-
connectedCallback() {
|
|
209
|
-
document.addEventListener('click', this.handleClickOutside);
|
|
210
|
-
}
|
|
211
|
-
componentWillLoad() {
|
|
212
|
-
if (this.value) {
|
|
213
|
-
try {
|
|
214
|
-
const range = JSON.parse(this.value);
|
|
215
|
-
this.startValue = range.start || '';
|
|
216
|
-
this.endValue = range.end || '';
|
|
217
|
-
}
|
|
218
|
-
catch (error) {
|
|
219
|
-
console.error('Invalid JSON for value:');
|
|
220
|
-
console.error(error);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
componentDidLoad() {
|
|
225
|
-
const inputs = this.el.querySelectorAll('.input-wrapper input');
|
|
226
|
-
inputs.forEach((input) => {
|
|
227
|
-
const inputMask = new inputmaskEdcad3c1.Inputmask({
|
|
228
|
-
alias: 'datetime',
|
|
229
|
-
inputFormat: this.convertToInputmaskFormat(this.dateFormat),
|
|
230
|
-
placeholder: '_',
|
|
231
|
-
clearIncomplete: false,
|
|
232
|
-
showMaskOnHover: false,
|
|
233
|
-
showMaskOnFocus: false,
|
|
234
|
-
clearMaskOnLostFocus: false,
|
|
235
|
-
insertMode: true,
|
|
236
|
-
rightAlign: false,
|
|
237
|
-
oncomplete: function (e) {
|
|
238
|
-
const input = e.target;
|
|
239
|
-
const event = new CustomEvent('input', { bubbles: true });
|
|
240
|
-
input.dispatchEvent(event);
|
|
241
|
-
},
|
|
242
|
-
});
|
|
243
|
-
inputMask.mask(input);
|
|
244
|
-
// Set the value after applying the mask
|
|
245
|
-
if (input.name === this.startName && this.startValue) {
|
|
246
|
-
requestAnimationFrame(() => {
|
|
247
|
-
input.value = this.startValue;
|
|
248
|
-
const event = new CustomEvent('input', { bubbles: true });
|
|
249
|
-
input.dispatchEvent(event);
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
else if (input.name === this.endName && this.endValue) {
|
|
253
|
-
requestAnimationFrame(() => {
|
|
254
|
-
input.value = this.endValue;
|
|
255
|
-
const event = new CustomEvent('input', { bubbles: true });
|
|
256
|
-
input.dispatchEvent(event);
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
componentDidRender() {
|
|
262
|
-
const inputs = this.el.querySelectorAll('.input-wrapper input');
|
|
263
|
-
inputs.forEach((input) => {
|
|
264
|
-
const value = input.name === this.startName
|
|
265
|
-
? this.startValue
|
|
266
|
-
: this.endName
|
|
267
|
-
? this.endValue
|
|
268
|
-
: '';
|
|
269
|
-
if (value) {
|
|
270
|
-
// Make sure the value is defined both as a property and attribute
|
|
271
|
-
requestAnimationFrame(() => {
|
|
272
|
-
input.value = value;
|
|
273
|
-
input.setAttribute('value', value);
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
disconnectedCallback() {
|
|
279
|
-
document.removeEventListener('click', this.handleClickOutside);
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* Handles the range date selection event from nv-calendar.
|
|
283
|
-
* @param {CustomEvent<DateRange>} event - The custom event
|
|
284
|
-
*/
|
|
285
|
-
handleRangeDateChange(event) {
|
|
286
|
-
const { start, end } = event.detail || {};
|
|
287
|
-
// Check that both dates are defined
|
|
288
|
-
if (start && end) {
|
|
289
|
-
this.startValue = start;
|
|
290
|
-
this.endValue = end;
|
|
291
|
-
this.dateRangeChange.emit({
|
|
292
|
-
start: this.startValue,
|
|
293
|
-
end: this.endValue,
|
|
294
|
-
});
|
|
295
|
-
if (!this.showActions) {
|
|
296
|
-
this.open = false;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
handleClosePopover() {
|
|
301
|
-
this.open = false;
|
|
302
|
-
}
|
|
303
|
-
handleApplyDateRange() {
|
|
304
|
-
this.open = false;
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Handles keyboard events.
|
|
308
|
-
* @param {KeyboardEvent} event - The keyboard event
|
|
309
|
-
*/
|
|
310
|
-
handleKeyDown(event) {
|
|
311
|
-
if (!this.open) {
|
|
312
|
-
if (event.key === 'ArrowDown') {
|
|
313
|
-
this.open = true;
|
|
314
|
-
event.preventDefault();
|
|
315
|
-
return;
|
|
316
|
-
}
|
|
317
|
-
return;
|
|
318
|
-
}
|
|
319
|
-
if (!this.popoverElement) {
|
|
320
|
-
console.warn('nv-fielddaterange -> Popover element is not defined');
|
|
321
|
-
return;
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
handleValueChange(newValue) {
|
|
325
|
-
try {
|
|
326
|
-
const range = JSON.parse(newValue);
|
|
327
|
-
this.startValue = range.start || '';
|
|
328
|
-
this.endValue = range.end || '';
|
|
329
|
-
}
|
|
330
|
-
catch (error) {
|
|
331
|
-
console.error('Invalid JSON for value:', error);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
//#endregion EVENTS
|
|
335
|
-
/****************************************************************************/
|
|
336
|
-
//#region RENDER
|
|
337
|
-
render() {
|
|
338
|
-
return (index.h(index.Host, { key: '965223047219ae767b07ccecb0a00580ea39c232' }, ((this.label && this.label.length > 0) ||
|
|
339
|
-
this.el.querySelector('[slot="label"]')) && (index.h("label", { key: '096d6a34148da30d61686024b5891e7e15cd92e2', htmlFor: this.startInputId }, index.h("slot", { key: 'ee6e84ef1927ad809e7dddb2f4ad5ef7380d0bca', name: "label" }, this.label))), index.h("nv-popover", { key: '1a0549e85ab73157b379fcbcee014a7d85be9752', ref: el => (this.popoverElement = el), id: this.popoverId, triggerMode: "controlled", placement: "bottom-start", open: this.open }, index.h("div", { key: 'd9fc4c8f379e3c1884867c87bcaa67b2da1c64ae', slot: "trigger", class: "input-wrapper" }, index.h("slot", { key: '4189696f3e877c19d4c24b09377b2ab0ce9aa437', name: "before-input" }), index.h("div", { key: '98025c8fc29121c736deb3042e961ef0eb1442fe', class: "input-container" }, index.h("slot", { key: '897481f836e33fd70a7c3b083a4e9b3db87637f2', name: "leading-input" }), index.h("div", { key: '788df58693fafaf8c78645b81d1b09a828138ccf', class: "range-inputs" }, index.h("input", { key: '7966b844668ca4cb02ac34886b62ee24cb7b1399', id: this.startInputId, type: "text", placeholder: this.startPlaceholder, name: this.startName, disabled: this.disabled, readOnly: this.readonly, required: this.required, autofocus: this.shouldAutoFocus, value: this.startValue, onInput: this.handleStartInput, onFocus: this.handleFocus }), index.h("svg", { key: '67c0b68f0fb32ce122f9d4e5b1240440f3b649d0', 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: 'eb68f32a768c1c48b51a45ddba3f85357b8045e6', stroke: "none", d: "M0 0h24v24H0z", fill: "none" }), index.h("path", { key: 'b8ccaf592dc2d36719a8418800a736b06d1c1775', d: "M18 9l3 3l-3 3" }), index.h("path", { key: 'c4b8d8e8ffad9a339abcde63a9a0feb2ddc771d3', d: "M15 12h6" }), index.h("path", { key: '7a28c7086d7085163ff8d885acd7434b4e5ea69a', d: "M6 9l-3 3l3 3" }), index.h("path", { key: '39917978c25b13a270f0852818b31868f2034832', d: "M3 12h6" })), index.h("input", { key: 'aaad42e407d1fe8e31a7e7c153e2d4cd35d8d2df', 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 })), index.h("nv-iconbutton", { key: '04701e7bdf80a869f8a5f519141ac99c0077c20b', 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: 'cf1a48dcd20b4e363a746c9f26ecae8085e8ebbd', name: "after-input" })), index.h("div", { key: 'a36a223b6d5edd30bb9a4590d059caede5412b6a', slot: "content" }, index.h("nv-calendar", { key: '1ff22f214d648c4bb35455cf477529251c436e2d', dateFormat: this.dateFormat, rangeValue: this.startValue && this.endValue
|
|
340
|
-
? JSON.stringify({
|
|
341
|
-
start: this.startValue,
|
|
342
|
-
end: this.endValue,
|
|
343
|
-
})
|
|
344
|
-
: '', 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" }))), ((this.description && this.description.length > 0) ||
|
|
345
|
-
this.el.querySelector('[slot="description"]')) && (index.h("div", { key: '780f82060de810eb394285f4799511d2223312a3', class: "description" }, index.h("slot", { key: '326cbf626387738b9997f3b4d452c50ea2b3d5b2', name: "description" }, this.description))), (this.errorDescription ||
|
|
346
|
-
this.el.querySelector('[slot="error-description"]')) && (index.h("div", { key: '6043f611a60f14976b8572e975621fac57b18f89', hidden: !this.error, class: "error-description" }, this.el.querySelector('[slot="error-description"]') ? (index.h("slot", { name: "error-description" })) : (this.errorDescription))), index.h("slot", { key: '129fe5bcd6c5bd9449242dc6b4f0e1c90ae31082' })));
|
|
347
|
-
}
|
|
348
|
-
get el() { return index.getElement(this); }
|
|
349
|
-
static get watchers() { return {
|
|
350
|
-
"value": ["handleValueChange"]
|
|
351
|
-
}; }
|
|
352
|
-
};
|
|
353
|
-
NvFielddaterange.style = NvFielddaterangeStyle0;
|
|
354
|
-
|
|
355
|
-
exports.nv_fielddaterange = NvFielddaterange;
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var index = require('./index-Byv3Vmev.js');
|
|
4
|
-
var v4A79185f4 = require('./v4-a79185f4-2n0dOd_Y.js');
|
|
5
|
-
require('react');
|
|
6
|
-
|
|
7
|
-
const nvFieldnumberCss = "nv-fieldnumber {\n --nv-field-border-default: var(--components-form-field-border-default);\n --nv-field-border-hover: var(--components-form-field-border-hover);\n --nv-field-border-focus: var(--components-form-field-border-focus);\n --nv-field-border-disabled: var(--components-form-field-border-default);\n --nv-field-border-readonly: var(--components-form-field-border-default);\n --nv-field-focus-box-shadow: var(--color-focus-brand);\n --nv-field-background: var(--components-form-field-background-default);\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: var(--form-gap-y);\n box-sizing: border-box;\n}\nnv-fieldnumber[readonly]:not([readonly=false]) {\n --nv-field-border-default: var(--components-form-field-border-readonly);\n --nv-field-border-hover: var(--nv-field-border-default);\n --nv-field-border-focus: var(--components-form-field-border-focus);\n --nv-field-border-disabled: var(--nv-field-border-default);\n --nv-field-border-readonly: var(--nv-field-border-default);\n --nv-field-background: var(--components-form-field-background-readonly);\n}\nnv-fieldnumber[error]:not([error=false]) {\n --nv-field-border-default: var(--components-form-field-border-error);\n --nv-field-border-hover: var(--nv-field-border-default);\n --nv-field-border-focus: var(--nv-field-border-default);\n --nv-field-border-disabled: var(--nv-field-border-default);\n --nv-field-border-readonly: var(--nv-field-border-default);\n --nv-field-focus-box-shadow: var(--color-focus-destructive);\n}\nnv-fieldnumber[success]:not([success=false]) {\n --nv-field-border-default: var(--components-form-field-border-success);\n --nv-field-border-hover: var(--nv-field-border-default);\n --nv-field-border-focus: var(--nv-field-border-default);\n --nv-field-border-disabled: var(--nv-field-border-default);\n --nv-field-border-readonly: var(--nv-field-border-default);\n --nv-field-focus-box-shadow: var(--color-focus-success);\n}\nnv-fieldnumber[required]:not([required=false]) label::after {\n content: \"*\";\n color: var(--components-form-text-required);\n font-weight: 700;\n}\nnv-fieldnumber label {\n display: flex;\n align-items: center;\n gap: var(--form-label-gap);\n align-self: stretch;\n color: var(--components-form-text-label-default);\n font-family: \"TT Norms Pro\", sans-serif;\n font-size: var(--form-label-font-size);\n font-style: normal;\n font-weight: 500;\n line-height: var(--form-label-line-height);\n}\nnv-fieldnumber .input-wrapper {\n display: flex;\n flex-wrap: wrap;\n gap: var(--form-gap-x);\n align-items: stretch;\n align-self: stretch;\n}\nnv-fieldnumber .input-wrapper .input-container {\n display: flex;\n flex-grow: 1;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n border-radius: var(--form-field-radius);\n border-width: 1px;\n border-style: solid;\n border-color: var(--nv-field-border-default);\n opacity: var(--components-form-opacity-default, 1);\n background: var(--nv-field-background);\n transition: all 150ms ease-out;\n container-type: inline-size;\n container-name: field-number-input-container;\n overflow: hidden;\n position: relative;\n}\nnv-fieldnumber .input-wrapper .input-container:hover {\n border-color: var(--nv-field-border-hover);\n}\nnv-fieldnumber .input-wrapper .input-container:focus-within, nv-fieldnumber .input-wrapper .input-container:focus-within:hover, nv-fieldnumber .input-wrapper .input-container:focus, nv-fieldnumber .input-wrapper .input-container:focus:hover {\n border-color: var(--nv-field-border-focus);\n box-shadow: 0px 0px 0px var(--focus-field-stroke) var(--nv-field-focus-box-shadow);\n}\nnv-fieldnumber .input-wrapper .input-container:has(input:read-only) {\n opacity: 0.5;\n background-color: var(--components-form-field-background-readonly);\n border-color: var(--nv-field-border-readonly);\n}\nnv-fieldnumber .input-wrapper .input-container:has(input:disabled) {\n opacity: 0.5;\n background-color: var(--components-form-field-background-disabled);\n border-color: var(--nv-field-border-disabled);\n}\nnv-fieldnumber .input-wrapper .input-container input {\n display: flex;\n align-items: center;\n flex: 1 0 0;\n overflow: hidden;\n background-color: transparent;\n color: var(--components-form-field-content-text);\n padding: var(--form-field-padding-y) var(--form-field-padding-x);\n font-size: var(--form-field-font-size);\n font-style: normal;\n font-weight: 500;\n line-height: var(--form-field-line-height);\n width: 100%;\n appearance: textfield;\n}\nnv-fieldnumber .input-wrapper .input-container input:focus {\n outline: none;\n}\nnv-fieldnumber .input-wrapper .input-container input::placeholder {\n overflow: hidden;\n color: var(--components-form-field-content-placeholder);\n text-overflow: ellipsis;\n font-family: \"TT Norms Pro\", sans-serif;\n font-size: var(--form-field-font-size);\n font-style: normal;\n font-weight: 400;\n line-height: var(--form-field-line-height);\n}\nnv-fieldnumber .input-wrapper .input-container input::-webkit-inner-spin-button, nv-fieldnumber .input-wrapper .input-container input::-webkit-outer-spin-button {\n appearance: none;\n margin: 0;\n}\nnv-fieldnumber .input-wrapper .input-container nv-icon.validation {\n color: var(--nv-field-border-default);\n margin-right: var(--form-field-gap);\n}\nnv-fieldnumber .input-wrapper .input-container > nv-iconbutton {\n border: 0px;\n border-radius: 0px;\n}\nnv-fieldnumber .input-wrapper .input-container > nv-iconbutton:focus-visible {\n border-radius: var(--button-md-border-radius);\n outline-offset: -3px;\n}\nnv-fieldnumber .input-wrapper .input-container .stepper {\n display: flex;\n border-left: var(--notification-border-width-low-emphasis) solid var(--components-form-field-border-readonly);\n}\nnv-fieldnumber .input-wrapper .input-container .stepper > nv-iconbutton {\n border: 0px;\n border-radius: 0px;\n border-radius: 0px;\n}\nnv-fieldnumber .input-wrapper .input-container .stepper > nv-iconbutton:focus-visible {\n border-radius: var(--button-md-border-radius);\n outline-offset: -3px;\n}\n@container field-number-input-container (width < 150px) {\n nv-fieldnumber .input-wrapper .input-container .stepper-spacer {\n display: none;\n }\n nv-fieldnumber .input-wrapper .input-container .stepper {\n display: none;\n }\n}\nnv-fieldnumber .description {\n align-self: stretch;\n color: var(--components-form-text-description-default);\n font-family: \"TT Norms Pro\", sans-serif;\n font-size: var(--form-description-font-size);\n font-style: normal;\n line-height: var(--form-description-line-height);\n}\nnv-fieldnumber .error-description {\n align-self: stretch;\n color: var(--components-form-text-description-default);\n font-family: \"TT Norms Pro\", sans-serif;\n font-size: var(--form-description-font-size);\n font-style: normal;\n line-height: var(--form-description-line-height);\n color: var(--components-form-text-description-error);\n}";
|
|
8
|
-
const NvFieldnumberStyle0 = nvFieldnumberCss;
|
|
9
|
-
|
|
10
|
-
const NvFieldnumber = 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 disabled prop lets you turn off the input field so that users can’t
|
|
26
|
-
* type in it. When disabled, the field is grayed out and won’t respond to#
|
|
27
|
-
* clicks or touches.
|
|
28
|
-
*/
|
|
29
|
-
this.disabled = false;
|
|
30
|
-
/**
|
|
31
|
-
* Display the input field’s content without allowing users to change it.
|
|
32
|
-
* Users can still click on it, select, and copy the text, but they won’t be
|
|
33
|
-
* able to type or delete anything.
|
|
34
|
-
*/
|
|
35
|
-
this.readonly = false;
|
|
36
|
-
/**
|
|
37
|
-
* Marks the input field as required, ensuring that the user must fill it out
|
|
38
|
-
* before submitting the form.
|
|
39
|
-
*/
|
|
40
|
-
this.required = false;
|
|
41
|
-
/**
|
|
42
|
-
* Alters the input field’s appearance to indicate an error, helping users
|
|
43
|
-
* identify fields that need correction.
|
|
44
|
-
* @validator error
|
|
45
|
-
*/
|
|
46
|
-
this.error = false;
|
|
47
|
-
/**
|
|
48
|
-
* Changes the input field’s appearance to indicate successful input or
|
|
49
|
-
* validation.
|
|
50
|
-
*/
|
|
51
|
-
this.success = false;
|
|
52
|
-
/**
|
|
53
|
-
* Define the increment value for the input field. It determines how much the
|
|
54
|
-
* value will increase or decrease when the user clicks the stepper buttons.
|
|
55
|
-
*/
|
|
56
|
-
this.step = 1;
|
|
57
|
-
/**
|
|
58
|
-
* Applies focus to the input field as soon as the component is mounted. This
|
|
59
|
-
* is equivalent to setting the native autofocus attribute on an <input>
|
|
60
|
-
* element.
|
|
61
|
-
*/
|
|
62
|
-
this.autofocus = false;
|
|
63
|
-
//#endregion WATCHERS
|
|
64
|
-
/****************************************************************************/
|
|
65
|
-
//#region METHODS
|
|
66
|
-
this.handleInput = (event) => {
|
|
67
|
-
const input = event.target;
|
|
68
|
-
this.value = Number(input.value);
|
|
69
|
-
};
|
|
70
|
-
this.handleInputContainerClick = () => {
|
|
71
|
-
this.inputElement.focus();
|
|
72
|
-
};
|
|
73
|
-
this.handlePlus = () => {
|
|
74
|
-
this.inputElement.stepUp();
|
|
75
|
-
this.value = Number(this.inputElement.value);
|
|
76
|
-
};
|
|
77
|
-
this.handleMinus = () => {
|
|
78
|
-
this.inputElement.stepDown();
|
|
79
|
-
this.value = Number(this.inputElement.value);
|
|
80
|
-
};
|
|
81
|
-
// prevents text selection when clicking the buttons multiple times
|
|
82
|
-
this.preventSelection = (event) => {
|
|
83
|
-
event.preventDefault();
|
|
84
|
-
};
|
|
85
|
-
this.isMinValueReached = () => {
|
|
86
|
-
return this.min !== undefined && this.value <= this.min;
|
|
87
|
-
};
|
|
88
|
-
this.isMaxValueReached = () => {
|
|
89
|
-
return this.max !== undefined && this.value >= this.max;
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
//#endregion EVENTS
|
|
93
|
-
/****************************************************************************/
|
|
94
|
-
//#region WATCHERS
|
|
95
|
-
watchValueHandler(newValue) {
|
|
96
|
-
this.valueChanged.emit(newValue);
|
|
97
|
-
}
|
|
98
|
-
//#endregion METHODS
|
|
99
|
-
/****************************************************************************/
|
|
100
|
-
//#region LIFECYCLE
|
|
101
|
-
componentWillRender() {
|
|
102
|
-
if (this.message) {
|
|
103
|
-
this.description = this.message;
|
|
104
|
-
}
|
|
105
|
-
if (this.validation) {
|
|
106
|
-
this.errorDescription = this.validation;
|
|
107
|
-
this.error = true;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
//#endregion LIFECYCLE
|
|
111
|
-
/****************************************************************************/
|
|
112
|
-
//#region RENDER
|
|
113
|
-
render() {
|
|
114
|
-
return (index.h(index.Host, { key: 'e054d1e05c0623bf3d5d78c2bafb6d096dbcbd08' }, (this.label || this.el.querySelector('[slot="label"]')) && (index.h("label", { key: '0743432faff56e8256b2a30fab68ced0592bbf6a', htmlFor: this.inputId }, index.h("slot", { key: '709f68c3f4bf6ade475cd6afbee5c9912c782c43', name: "label" }, this.label))), index.h("div", { key: '5798b0faf23bc671aeda3273dcfff7c1d1ca4109', class: "input-wrapper" }, index.h("slot", { key: '47b9f0ef000d2d98e2e3ad1c1f4191ce91c69266', name: "before-input" }), index.h("div", { key: '082d2ab64b892cc994955b723d1ab342414061fb', class: "input-container", onClick: this.handleInputContainerClick }, index.h("slot", { key: '34511207a7ebc1cc5fe8cc91d05f4fa549fda316', name: "leading-input" }), index.h("input", { key: '20f96b319b6e7528d738bdc31152649575409dd1', id: this.inputId, ref: e => (this.inputElement = e), placeholder: this.placeholder, name: this.name, type: "number", autofocus: this.autofocus, required: this.required, max: this.max, min: this.min, step: this.step, value: this.value, disabled: this.disabled, readOnly: this.readonly, onInput: this.handleInput }), this.error && (index.h("nv-icon", { key: '2b05afbbc94bd39dd82a270511e4372536ee80ba', name: "alert-circle", class: "validation", size: "md" })), this.success && (index.h("nv-icon", { key: '95d74e6298e49d422b19bf080d3e2de25c2ad8e2', name: "circle-check", class: "validation", size: "md" })), index.h("div", { key: '5c665de10e9650003b127997cd6010e35d7d0b7a', class: "stepper" }, index.h("nv-iconbutton", { key: '9702ee4778623862e67d29a56f7790af364786bf', size: "md", name: "minus", emphasis: "lower", onClick: this.handleMinus, disabled: this.isMinValueReached(), onMouseDown: this.preventSelection, tabindex: "-1" }), index.h("nv-iconbutton", { key: '20fc509c42230f6768d98e4144db12afae3649ef', size: "md", name: "plus", emphasis: "lower", onClick: this.handlePlus, disabled: this.isMaxValueReached(), onMouseDown: this.preventSelection, tabindex: "-1" }))), index.h("slot", { key: 'd432d4e6fb8c4fd67c6c972b5c967e093cadfe68', name: "after-input" })), (this.description ||
|
|
115
|
-
this.el.querySelector('[slot="description"]')) && (index.h("div", { key: 'e1d585c32f4cff50d84f5d1b6696856c8c875ef7', class: "description" }, index.h("slot", { key: '860b5fb8ba3e24fc728021b238b371178ae54ead', name: "description" }, this.description))), (this.errorDescription ||
|
|
116
|
-
this.el.querySelector('[slot="error-description"]')) && (index.h("div", { key: 'aaa707753b98415ca4e329fab9b45bfc3b42525a', hidden: !this.error, class: "error-description" }, index.h("slot", { key: 'f8c0910451550baa82663500a7c0339064720428', name: "error-description" }, this.errorDescription)))));
|
|
117
|
-
}
|
|
118
|
-
static get formAssociated() { return true; }
|
|
119
|
-
get el() { return index.getElement(this); }
|
|
120
|
-
static get watchers() { return {
|
|
121
|
-
"value": ["watchValueHandler"]
|
|
122
|
-
}; }
|
|
123
|
-
};
|
|
124
|
-
NvFieldnumber.style = NvFieldnumberStyle0;
|
|
125
|
-
|
|
126
|
-
exports.nv_fieldnumber = NvFieldnumber;
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var index = require('./index-Byv3Vmev.js');
|
|
4
|
-
var v4A79185f4 = require('./v4-a79185f4-2n0dOd_Y.js');
|
|
5
|
-
require('react');
|
|
6
|
-
|
|
7
|
-
const nvFieldpasswordCss = "nv-fieldpassword{--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-fieldpassword[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-fieldpassword[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-fieldpassword[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-fieldpassword[required]:not([required=false]) label::after{content:\"*\";color:var(--components-form-text-required);font-weight:700}nv-fieldpassword 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-fieldpassword .input-wrapper{display:flex;flex-wrap:wrap;gap:var(--form-gap-x);align-items:stretch;align-self:stretch}nv-fieldpassword .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;position:relative}nv-fieldpassword .input-wrapper .input-container:hover{border-color:var(--nv-field-border-hover)}nv-fieldpassword .input-wrapper .input-container:focus-within,nv-fieldpassword .input-wrapper .input-container:focus-within:hover,nv-fieldpassword .input-wrapper .input-container:focus,nv-fieldpassword .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-fieldpassword .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-fieldpassword .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-fieldpassword .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-fieldpassword .input-wrapper .input-container input:focus{outline:none}nv-fieldpassword .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-fieldpassword .input-wrapper .input-container>nv-iconbutton{border:0px;border-radius:0px}nv-fieldpassword .input-wrapper .input-container>nv-iconbutton:focus-visible{border-radius:var(--button-md-border-radius);outline-offset:-3px}nv-fieldpassword .input-wrapper .input-container nv-icon.validation{color:var(--nv-field-border-default)}nv-fieldpassword .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-fieldpassword .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 NvFieldpasswordStyle0 = nvFieldpasswordCss;
|
|
9
|
-
|
|
10
|
-
const NvFieldpassword = class {
|
|
11
|
-
constructor(hostRef) {
|
|
12
|
-
index.registerInstance(this, hostRef);
|
|
13
|
-
this.valueChanged = index.createEvent(this, "valueChanged");
|
|
14
|
-
/****************************************************************************/
|
|
15
|
-
//#region PROPERTIES
|
|
16
|
-
/**
|
|
17
|
-
* Sets the ID for the input element and the for attribute of the associated
|
|
18
|
-
* label. If no ID is provided, a random one will be automatically generated
|
|
19
|
-
* to ensure unique identification, facilitating proper label association and
|
|
20
|
-
* accessibility.
|
|
21
|
-
*/
|
|
22
|
-
this.inputId = v4A79185f4.v4();
|
|
23
|
-
/**
|
|
24
|
-
* The disabled prop lets you turn off the input field so that users can’t
|
|
25
|
-
* type in it. When disabled, the field is grayed out and won’t respond to#
|
|
26
|
-
* clicks or touches.
|
|
27
|
-
*/
|
|
28
|
-
this.disabled = false;
|
|
29
|
-
/**
|
|
30
|
-
* Display the input field’s content without allowing users to change it.
|
|
31
|
-
* Users can still click on it, select, and copy the text, but they won’t be
|
|
32
|
-
* able to type or delete anything.
|
|
33
|
-
*/
|
|
34
|
-
this.readonly = false;
|
|
35
|
-
/**
|
|
36
|
-
* Marks the input field as required, ensuring that the user must fill it out
|
|
37
|
-
* before submitting the form.
|
|
38
|
-
*/
|
|
39
|
-
this.required = false;
|
|
40
|
-
/**
|
|
41
|
-
* Alters the input field’s appearance to indicate an error, helping users
|
|
42
|
-
* identify fields that need correction.
|
|
43
|
-
* @validator error
|
|
44
|
-
*/
|
|
45
|
-
this.error = false;
|
|
46
|
-
/**
|
|
47
|
-
* Changes the input field’s appearance to indicate successful input or
|
|
48
|
-
* validation.
|
|
49
|
-
*/
|
|
50
|
-
this.success = false;
|
|
51
|
-
/**
|
|
52
|
-
* Defines the type of the input.
|
|
53
|
-
* @default 'text'
|
|
54
|
-
*/
|
|
55
|
-
this.mode = 'text';
|
|
56
|
-
/**
|
|
57
|
-
* The autocomplete prop helps users fill out the input field faster by
|
|
58
|
-
* suggesting entries they’ve used before, like their email or address.
|
|
59
|
-
* You can turn it on to make forms more convenient or off to ensure users
|
|
60
|
-
* always type in fresh data.
|
|
61
|
-
*/
|
|
62
|
-
this.autocomplete = 'off';
|
|
63
|
-
/**
|
|
64
|
-
* Hide the button to show/hide the password.
|
|
65
|
-
*/
|
|
66
|
-
this.hidePasswordIcon = false;
|
|
67
|
-
/**
|
|
68
|
-
* Show/hide the password programmatically.
|
|
69
|
-
*/
|
|
70
|
-
this.showPassword = false;
|
|
71
|
-
/**
|
|
72
|
-
* Applies focus to the input field as soon as the component is mounted. This
|
|
73
|
-
* is equivalent to setting the native autofocus attribute on an <input>
|
|
74
|
-
* element.
|
|
75
|
-
*/
|
|
76
|
-
this.autofocus = false;
|
|
77
|
-
//#endregion EVENTS
|
|
78
|
-
/****************************************************************************/
|
|
79
|
-
//#region METHODS
|
|
80
|
-
this.handleInputContainerClick = () => {
|
|
81
|
-
this.inputElement.focus();
|
|
82
|
-
};
|
|
83
|
-
this.togglePasswordVisibility = () => {
|
|
84
|
-
this.showPasswordState = !this.showPasswordState;
|
|
85
|
-
};
|
|
86
|
-
this.handleInput = (event) => {
|
|
87
|
-
const input = event.target;
|
|
88
|
-
this.value = input.value; // Update the input value without worrying about the space
|
|
89
|
-
this.valueChanged.emit(input.value);
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
handleShowPasswordChange(newValue) {
|
|
93
|
-
this.showPasswordState = newValue;
|
|
94
|
-
}
|
|
95
|
-
//#endregion METHODS
|
|
96
|
-
/****************************************************************************/
|
|
97
|
-
//#region LIFECYCLE
|
|
98
|
-
componentWillLoad() {
|
|
99
|
-
this.showPasswordState = this.showPassword;
|
|
100
|
-
}
|
|
101
|
-
//#endregion LIFECYCLE
|
|
102
|
-
/****************************************************************************/
|
|
103
|
-
//#region RENDER
|
|
104
|
-
render() {
|
|
105
|
-
return (index.h(index.Host, { key: '4a6de90f24bd6607293d616d60f6d742c46b04a9' }, (this.label || this.el.querySelector('[slot="label"]')) && (index.h("label", { key: '715f5935de3aa0f0f7b6aa9aa72c409a3875a849', htmlFor: this.inputId }, index.h("slot", { key: 'da11187833b12acfae578024bb67d717efbafaa1', name: "label" }, this.label))), index.h("div", { key: 'a669823e6c5aea5b4e0aacf0bfc1c8f7dbe67bab', class: "input-wrapper" }, index.h("slot", { key: '98b2b6eaaa867228a667bec2920c640ff0b829c7', name: "before-input" }), index.h("div", { key: 'fc896f9018563e80ea0f2aa1e2eb7992fd4a854c', class: "input-container", onClick: this.handleInputContainerClick }, index.h("slot", { key: '715814e77d1ba40463253d12751129f2c0d05407', name: "leading-input" }), index.h("input", { key: '8101af836f80da56ac9e2b859ab9fd5b6d254b91', id: this.inputId, ref: e => (this.inputElement = e), autofocus: this.autofocus, autocomplete: this.autocomplete, placeholder: this.placeholder, name: this.name, type: this.showPasswordState ? 'text' : 'password', inputMode: this.mode, value: this.value, required: this.required, maxlength: this.maxlength, minlength: this.minlength, pattern: this.pattern, disabled: this.disabled, readOnly: this.readonly, onInput: this.handleInput }), (this.success || this.error) && (index.h("nv-icon", { key: 'fdf5caa936a43961bd3f00f5d50635124b57ff0b', name: this.success ? 'circle-check' : 'alert-circle', class: "validation", size: "md" })), !this.hidePasswordIcon && (index.h("nv-iconbutton", { key: '9b9e70d855fca2ea1ff2769609af05fc7d3fd1c2', name: this.showPasswordState ? 'eye' : 'eye-off', size: "md", emphasis: "lower", onClick: this.togglePasswordVisibility, "aria-label": this.showPasswordState ? 'Hide password' : 'Show password', "aria-pressed": this.showPasswordState.toString() }))), index.h("slot", { key: '4458e83104562509b53b05faf3a316a5502b76b7', name: "after-input" })), (this.description ||
|
|
106
|
-
this.el.querySelector('[slot="description"]')) && (index.h("div", { key: '91dcddd8a80abccaaffda9cd583759bebf376456', class: "description" }, index.h("slot", { key: 'fe6da6eb725b3866faf138e848f89152f0f24a00', name: "description" }, this.description))), (this.errorDescription ||
|
|
107
|
-
this.el.querySelector('[slot="error-description"]')) && (index.h("div", { key: 'bfe57a6b0f199c3b371a2036a7b8787f40f639a4', hidden: !this.error, class: "error-description" }, index.h("slot", { key: '529e34f2197c64ac768df11251bb285fec1f2cd5', name: "error-description" }, this.errorDescription)))));
|
|
108
|
-
}
|
|
109
|
-
static get formAssociated() { return true; }
|
|
110
|
-
get el() { return index.getElement(this); }
|
|
111
|
-
static get watchers() { return {
|
|
112
|
-
"showPassword": ["handleShowPasswordChange"]
|
|
113
|
-
}; }
|
|
114
|
-
};
|
|
115
|
-
NvFieldpassword.style = NvFieldpasswordStyle0;
|
|
116
|
-
|
|
117
|
-
exports.nv_fieldpassword = NvFieldpassword;
|