@nova-design-system/nova-react 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-B2jv2KXv.js → index-BlWxX8x6.js} +824 -894
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/{nv-alert.entry-pxBJfmIm.js → nv-alert.entry-BLGSitrm.js} +7 -7
- package/dist/cjs/{nv-avatar.entry-CHtVctSK.js → nv-avatar.entry-CRcLMbEx.js} +7 -7
- package/dist/cjs/{nv-badge_2.entry-BO88KO1O.js → nv-badge_2.entry-BtDAr7_d.js} +1 -1
- package/dist/cjs/{nv-breadcrumb.entry-7azRtyl5.js → nv-breadcrumb.entry-PVDZoF9i.js} +1 -1
- package/dist/cjs/{nv-breadcrumbs.entry-DfZVMKpY.js → nv-breadcrumbs.entry-BY169s5F.js} +1 -1
- package/dist/cjs/{nv-button.entry-DW9SblsY.js → nv-button.entry-BpxpxFJP.js} +7 -7
- package/dist/cjs/{nv-calendar.entry-BeayRRor.js → nv-calendar.entry-BobyjFdK.js} +376 -143
- package/dist/cjs/{nv-col.entry-C6oEkSbI.js → nv-col.entry-B4BJXJw-.js} +1 -1
- package/dist/cjs/{nv-datagrid.entry-xhQP6JJP.js → nv-datagrid.entry-D5UVDiYl.js} +6 -6
- package/dist/cjs/{nv-datagridcolumn.entry-CjYmo4fM.js → nv-datagridcolumn.entry-dmpcmCIT.js} +1 -1
- package/dist/cjs/{nv-dialog.entry-mxETaZbc.js → nv-dialog.entry-BYovzkco.js} +3 -3
- package/dist/cjs/{nv-dialogfooter_2.entry-DnLg2DHy.js → nv-dialogfooter_2.entry-C9dhLKRM.js} +3 -3
- package/dist/cjs/{nv-fieldcheckbox.entry-Be9__i15.js → nv-fieldcheckbox.entry-BvFqY2dM.js} +1 -1
- package/dist/cjs/nv-fielddate.entry-CSpAcEXW.js +303 -0
- package/dist/cjs/nv-fielddaterange.entry-C14o96dd.js +439 -0
- package/dist/cjs/{nv-fielddropdown.entry-BPwviyCp.js → nv-fielddropdown.entry-C3VzNRhh.js} +2 -2
- package/dist/cjs/{nv-fielddropdownitem.entry-BGuUR9KP.js → nv-fielddropdownitem.entry-D4G4Ytus.js} +1 -1
- package/dist/cjs/{nv-fieldmultiselect.entry-Lrxr1gsi.js → nv-fieldmultiselect.entry-Ci43ZvzC.js} +2 -2
- package/dist/cjs/nv-fieldnumber.entry-nvUi-64H.js +130 -0
- package/dist/cjs/nv-fieldpassword.entry-C2uqwDah.js +121 -0
- package/dist/cjs/{nv-fieldradio.entry-CDu8xs0p.js → nv-fieldradio.entry-DL2GdKqO.js} +1 -1
- package/dist/cjs/{nv-fieldselect.entry-NEdv8bQK.js → nv-fieldselect.entry-D4AIRE24.js} +2 -2
- package/dist/cjs/{nv-fieldslider.entry-51gF9XPz.js → nv-fieldslider.entry-BNge4J69.js} +25 -20
- package/dist/cjs/nv-fieldtext.entry-BI-fdkdX.js +123 -0
- package/dist/cjs/{nv-fieldtextarea.entry-D44HbsVQ.js → nv-fieldtextarea.entry-Ct0g9Qtb.js} +2 -2
- package/dist/cjs/{nv-fieldtime.entry-MbaWbVtc.js → nv-fieldtime.entry-CmO96Py1.js} +61 -61
- package/dist/cjs/{nv-icon.entry-BSSHr-ud.js → nv-icon.entry-TepdQ1jA.js} +7 -7
- package/dist/cjs/{nv-iconbutton_2.entry-DMaO-JWz.js → nv-iconbutton_2.entry-B7Xyut9H.js} +1 -1
- package/dist/cjs/{nv-menu.entry-D5_lj9XB.js → nv-menu.entry-DHrRi_37.js} +1 -1
- package/dist/cjs/{nv-menuitem.entry-fhnYI91K.js → nv-menuitem.entry-B_D1pSYa.js} +1 -1
- package/dist/cjs/{nv-popover.entry-CYqBaVbr.js → nv-popover.entry-DyQPEQ4I.js} +1 -1
- package/dist/cjs/{nv-row.entry-BUheLufV.js → nv-row.entry-CDTv7ikK.js} +1 -1
- package/dist/cjs/{nv-stack.entry-DNPce51E.js → nv-stack.entry-A78c6BVf.js} +1 -1
- package/dist/cjs/{nv-table.entry-DXQM8l3t.js → nv-table.entry-DkwcfdJM.js} +1 -1
- package/dist/cjs/{nv-tablecolumn.entry-DROQK_0c.js → nv-tablecolumn.entry-C8VNSpDf.js} +1 -1
- package/dist/cjs/{nv-toggle.entry-fMzTrdte.js → nv-toggle.entry-vxSyUDKZ.js} +1 -1
- package/dist/cjs/{nv-tooltip.entry-yB2Ek1Cz.js → nv-tooltip.entry-BQKXRp4d.js} +1 -1
- package/dist/generated/components.js +7 -3
- package/dist/types/generated/components.d.ts +4 -4
- package/package.json +1 -1
- package/dist/cjs/nv-fielddate.entry-BlNily-X.js +0 -269
- package/dist/cjs/nv-fielddaterange.entry-CycpKoJd.js +0 -408
- package/dist/cjs/nv-fieldnumber.entry-B1VySoWj.js +0 -130
- package/dist/cjs/nv-fieldpassword.entry-D7Qlx7Bh.js +0 -121
- package/dist/cjs/nv-fieldtext.entry-Bug9zMgo.js +0 -123
- /package/dist/cjs/{constants-b97e736d-BzFAKCkR.js → constants-4faa1fae-BzFAKCkR.js} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-BlWxX8x6.js');
|
|
4
4
|
var dom_utilsAc71e0ef = require('./dom.utils-ac71e0ef-CmIwRr6O.js');
|
|
5
|
-
var
|
|
5
|
+
var constants4faa1fae = require('./constants-4faa1fae-BzFAKCkR.js');
|
|
6
6
|
require('react');
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -3459,9 +3459,9 @@ const NvDatagrid = class {
|
|
|
3459
3459
|
return;
|
|
3460
3460
|
const nextOrder = header.column.getNextSortingOrder();
|
|
3461
3461
|
switch (nextOrder) {
|
|
3462
|
-
case
|
|
3462
|
+
case constants4faa1fae.SortingPossibility.Asc:
|
|
3463
3463
|
return 'Sort ascending';
|
|
3464
|
-
case
|
|
3464
|
+
case constants4faa1fae.SortingPossibility.Desc:
|
|
3465
3465
|
return 'Sort descending';
|
|
3466
3466
|
default:
|
|
3467
3467
|
return 'Clear sort';
|
|
@@ -4153,10 +4153,10 @@ const NvDatagrid = class {
|
|
|
4153
4153
|
if (!header.column.getCanSort())
|
|
4154
4154
|
return null;
|
|
4155
4155
|
const sortState = header.column.getIsSorted();
|
|
4156
|
-
if (sortState ===
|
|
4156
|
+
if (sortState === constants4faa1fae.SortingPossibility.Asc) {
|
|
4157
4157
|
return (index.h("div", { class: "inline-flex align-middle" }, index.h("nv-icon", { name: "arrow-up" })));
|
|
4158
4158
|
}
|
|
4159
|
-
if (sortState ===
|
|
4159
|
+
if (sortState === constants4faa1fae.SortingPossibility.Desc) {
|
|
4160
4160
|
return (index.h("div", { class: "inline-flex align-middle" }, index.h("nv-icon", { name: "arrow-down" })));
|
|
4161
4161
|
}
|
|
4162
4162
|
return null;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-BlWxX8x6.js');
|
|
4
4
|
var events_utilsFe1d907f = require('./events.utils-fe1d907f-01N__3wY.js');
|
|
5
5
|
var clsx297c1ffe = require('./clsx-297c1ffe-BtxeOLZW.js');
|
|
6
|
-
var
|
|
6
|
+
var constants4faa1fae = require('./constants-4faa1fae-BzFAKCkR.js');
|
|
7
7
|
var v4A79185f4 = require('./v4-a79185f4-2n0dOd_Y.js');
|
|
8
8
|
require('react');
|
|
9
9
|
|
|
@@ -782,7 +782,7 @@ const NvDialog = class {
|
|
|
782
782
|
//#region RENDER
|
|
783
783
|
render() {
|
|
784
784
|
const hasForm = this.form || this.el.querySelector('form');
|
|
785
|
-
return (index.h(index.Host, { key: 'c1eb9b79f52028c3ef7a57bad99260a45b678eb5' }, index.h("slot", { key: '65a624853aa7242dc849a1196c6b5b8c331d426f', name: "trigger" }), index.h("dialog", { key: '17369b9be014e9136d77f99628b4bc8184d36370', ref: el => (this.dialogElement = el), onClose: this.handleDialogClose, role: "dialog", "aria-modal": "true", "aria-labelledby": "dialog-header", "aria-describedby": "dialog-content", class: clsx297c1ffe.clsx({ full: this.full }) }, index.h("div", { key: '8a17cd8deff162b333e2ac90c487454743d76f3d', class: "content" }, !this.undismissable && (index.h("nv-button", { key: 'd61a63785ce284ce2039be5c62d6e2bcce2a9b44', class: "close-button", emphasis: "lower", size: "sm", onClick: this.handleCloseButton, "aria-label": "Close dialog" }, index.h("nv-icon", { key: '5a0adb449785bc684c41d0e35aad08ccb725386a', name: "x", size: "sm" }))), this.headerElement ? (index.h("slot", { name: "header" })) : (index.h("nv-dialogheader", { id: "dialog-header" })), index.h("div", { key: '7c39e52d8fe6fc9ab2fdc2574a0c105d790bbfbe', class: "content-body", id: "dialog-content" }, index.h("slot", { key: '038d9f3623177af5d996631dd9ae25fec49fd778' })), this.footerElement ? (index.h("slot", { name: "footer" })) : (index.h("nv-dialogfooter", { form: this.form, primaryButtonType: hasForm ?
|
|
785
|
+
return (index.h(index.Host, { key: 'c1eb9b79f52028c3ef7a57bad99260a45b678eb5' }, index.h("slot", { key: '65a624853aa7242dc849a1196c6b5b8c331d426f', name: "trigger" }), index.h("dialog", { key: '17369b9be014e9136d77f99628b4bc8184d36370', ref: el => (this.dialogElement = el), onClose: this.handleDialogClose, role: "dialog", "aria-modal": "true", "aria-labelledby": "dialog-header", "aria-describedby": "dialog-content", class: clsx297c1ffe.clsx({ full: this.full }) }, index.h("div", { key: '8a17cd8deff162b333e2ac90c487454743d76f3d', class: "content" }, !this.undismissable && (index.h("nv-button", { key: 'd61a63785ce284ce2039be5c62d6e2bcce2a9b44', class: "close-button", emphasis: "lower", size: "sm", onClick: this.handleCloseButton, "aria-label": "Close dialog" }, index.h("nv-icon", { key: '5a0adb449785bc684c41d0e35aad08ccb725386a', name: "x", size: "sm" }))), this.headerElement ? (index.h("slot", { name: "header" })) : (index.h("nv-dialogheader", { id: "dialog-header" })), index.h("div", { key: '7c39e52d8fe6fc9ab2fdc2574a0c105d790bbfbe', class: "content-body", id: "dialog-content" }, index.h("slot", { key: '038d9f3623177af5d996631dd9ae25fec49fd778' })), this.footerElement ? (index.h("slot", { name: "footer" })) : (index.h("nv-dialogfooter", { form: this.form, primaryButtonType: hasForm ? constants4faa1fae.ButtonType.Submit : constants4faa1fae.ButtonType.Button, onDialogCanceled: this.handleCancelButton, undismissable: this.undismissable }))))));
|
|
786
786
|
}
|
|
787
787
|
get el() { return index.getElement(this); }
|
|
788
788
|
static get watchers() { return {
|
package/dist/cjs/{nv-dialogfooter_2.entry-DnLg2DHy.js → nv-dialogfooter_2.entry-C9dhLKRM.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var
|
|
3
|
+
var index = require('./index-BlWxX8x6.js');
|
|
4
|
+
var constants4faa1fae = require('./constants-4faa1fae-BzFAKCkR.js');
|
|
5
5
|
require('react');
|
|
6
6
|
|
|
7
7
|
const nvDialogfooterCss = "nv-dialogfooter{display:flex;padding:var(--dialog-footer-padding-top) var(--dialog-footer-padding-x) var(--dialog-footer-padding-bottom) var(--dialog-footer-padding-x);justify-content:flex-end;align-items:flex-end;gap:var(--dialog-footer-gap-y);align-self:stretch}";
|
|
@@ -54,7 +54,7 @@ const NvDialogfooter = class {
|
|
|
54
54
|
/**
|
|
55
55
|
* Sets the type of the primary button.
|
|
56
56
|
*/
|
|
57
|
-
this.primaryButtonType =
|
|
57
|
+
this.primaryButtonType = constants4faa1fae.ButtonType.Button;
|
|
58
58
|
//#endregion EVENTS
|
|
59
59
|
/****************************************************************************/
|
|
60
60
|
//#region METHODS
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-BlWxX8x6.js');
|
|
4
|
+
var inputmaskEdcad3c1 = require('./inputmask-edcad3c1-B9Omti4z.js');
|
|
5
|
+
var v4A79185f4 = require('./v4-a79185f4-2n0dOd_Y.js');
|
|
6
|
+
require('react');
|
|
7
|
+
require('./_commonjsHelpers-1789f0cf-BJu3ubxk.js');
|
|
8
|
+
|
|
9
|
+
const nvFielddateCss = "nv-fieldslider .slider-container .track-container:has(.thumb:hover) .track-range{background:var(--components-slider-track-filled-hover)}nv-fieldslider .slider-container .track-container:has(.thumb:hover) .thumb{border-color:var(--components-slider-track-filled-hover)}nv-fieldslider .slider-container .track-container:has(.thumb:focus) .track-range{background:var(--components-slider-track-filled-focus)}nv-fieldslider .slider-container .track-container:has(.thumb:focus) .thumb{border-color:var(--components-slider-track-filled-focus)}nv-fieldslider[error] .slider-container .track-container .track .track-range{background:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb{border-color:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb:hover{border-color:var(--components-slider-track-filled-error);outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-slider-track-filled-error);outline-offset:calc(var(--focus-outline-offset) * 1);background-color:var(--components-slider-handler-background-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb:focus{border-color:var(--components-slider-track-filled-error);outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-slider-track-filled-error);outline-offset:calc(var(--focus-outline-offset) * 1);background-color:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container:has(.thumb:hover) .track-range{background:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container:has(.thumb:hover) .thumb{border-color:var(--components-slider-track-filled-error)}nv-fielddate{--nv-field-border-default:var(--components-form-field-border-default);--nv-field-border-hover:var(--components-form-field-border-hover);--nv-field-border-focus:var(--components-form-field-border-focus);--nv-field-border-disabled:var(--components-form-field-border-default);--nv-field-border-readonly:var(--components-form-field-border-default);--nv-field-focus-box-shadow:var(--color-focus-brand);--nv-field-background:var(--components-form-field-background-default);display:flex;flex-direction:column;align-items:flex-start;gap:var(--form-gap-y);box-sizing:border-box;max-width:480px}nv-fielddate[fluid]:not([fluid=false]){max-width:unset}nv-fielddate[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-fielddate[error]:not([error=false]){--nv-field-border-default:var(--components-form-field-border-error);--nv-field-border-hover:var(--nv-field-border-default);--nv-field-border-focus:var(--nv-field-border-default);--nv-field-border-disabled:var(--nv-field-border-default);--nv-field-border-readonly:var(--nv-field-border-default);--nv-field-focus-box-shadow:var(--color-focus-destructive-in-field)}nv-fielddate[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-fielddate[required]:not([required=false]) label::after{content:\"*\";color:var(--components-form-text-required);font-weight:700}nv-fielddate 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-fielddate nv-popover{width:100%;display:block}nv-fielddate 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-fielddate nv-popover [slot=content]{display:block;width:100%}nv-fielddate nv-popover .datepicker-container{border:none}nv-fielddate .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-fielddate .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-fielddate .input-wrapper .input-container:hover{border-color:var(--nv-field-border-hover)}nv-fielddate .input-wrapper .input-container:focus-within,nv-fielddate .input-wrapper .input-container:focus-within:hover,nv-fielddate .input-wrapper .input-container:focus,nv-fielddate .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-fielddate .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-fielddate .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-fielddate .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-fielddate .input-wrapper .input-container input:focus{outline:none}nv-fielddate .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-fielddate .input-wrapper .input-container input[type=password]::-ms-clear,nv-fielddate .input-wrapper .input-container input[type=password]::-ms-reveal{display:none;width:0;height:0}nv-fielddate .input-wrapper .input-container>nv-iconbutton{border:0px;border-radius:0px}nv-fielddate .input-wrapper .input-container>nv-iconbutton:focus-visible{border-radius:var(--button-md-border-radius);outline-offset:-3px}nv-fielddate .input-wrapper .input-container nv-icon.validation{color:var(--nv-field-border-default)}nv-fielddate .description{display:flex;align-items:center;align-self:stretch;gap:var(--spacing-1);color:var(--components-form-text-description-default);font-family:\"TT Norms Pro\", sans-serif;font-size:var(--form-description-font-size);font-style:normal;line-height:var(--form-description-line-height)}nv-fielddate .error-description{display:flex;align-items:center;align-self:stretch;gap:var(--spacing-1);color:var(--components-form-text-description-default);font-family:\"TT Norms Pro\", sans-serif;font-size:var(--form-description-font-size);font-style:normal;line-height:var(--form-description-line-height);color:var(--components-form-text-description-error)}";
|
|
10
|
+
const NvFielddateStyle0 = nvFielddateCss;
|
|
11
|
+
|
|
12
|
+
const NvFielddate = class {
|
|
13
|
+
constructor(hostRef) {
|
|
14
|
+
index.registerInstance(this, hostRef);
|
|
15
|
+
this.valueChanged = index.createEvent(this, "valueChanged");
|
|
16
|
+
this.popoverId = v4A79185f4.v4();
|
|
17
|
+
/****************************************************************************/
|
|
18
|
+
//#region PROPERTIES
|
|
19
|
+
/**
|
|
20
|
+
* Sets the ID for the 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.inputId = v4A79185f4.v4();
|
|
24
|
+
/**
|
|
25
|
+
* Disables the input field.
|
|
26
|
+
*/
|
|
27
|
+
this.disabled = false;
|
|
28
|
+
/**
|
|
29
|
+
* Sets the input field as read-only.
|
|
30
|
+
*/
|
|
31
|
+
this.readonly = false;
|
|
32
|
+
/**
|
|
33
|
+
* Marks the input field as required.
|
|
34
|
+
*/
|
|
35
|
+
this.required = false;
|
|
36
|
+
/**
|
|
37
|
+
* Indicates an error state.
|
|
38
|
+
*/
|
|
39
|
+
this.error = false;
|
|
40
|
+
/**
|
|
41
|
+
* Indicates a success state.
|
|
42
|
+
*/
|
|
43
|
+
this.success = false;
|
|
44
|
+
/**
|
|
45
|
+
* Autofocus the input when the component is mounted.
|
|
46
|
+
*/
|
|
47
|
+
this.autofocus = false;
|
|
48
|
+
/**
|
|
49
|
+
* The initial value of the input (date in string format).
|
|
50
|
+
* @bind value
|
|
51
|
+
*/
|
|
52
|
+
// eslint-disable-next-line @stencil-community/own-props-must-be-private
|
|
53
|
+
// eslint-disable-next-line @stencil-community/strict-mutable
|
|
54
|
+
this.value = '';
|
|
55
|
+
/**
|
|
56
|
+
* The current value of the input date in string format.
|
|
57
|
+
*/
|
|
58
|
+
this.singleValue = '';
|
|
59
|
+
/**
|
|
60
|
+
* Controls the opening of the popover.
|
|
61
|
+
*/
|
|
62
|
+
this.open = false;
|
|
63
|
+
/**
|
|
64
|
+
* First day of the week 0 = Sunday, 1 = Monday, etc.
|
|
65
|
+
* @default 1
|
|
66
|
+
*/
|
|
67
|
+
this.firstDayOfWeek = 1;
|
|
68
|
+
/**
|
|
69
|
+
* Number of calendars to display
|
|
70
|
+
* @default 1
|
|
71
|
+
*/
|
|
72
|
+
this.numberOfCalendars = 1;
|
|
73
|
+
/**
|
|
74
|
+
* Minimum date for selection ISO string format, ex: 2025-01-01
|
|
75
|
+
*/
|
|
76
|
+
this.min = '';
|
|
77
|
+
/**
|
|
78
|
+
* Maximum date for selection ISO string format, ex: 2025-12-31
|
|
79
|
+
*/
|
|
80
|
+
this.max = '';
|
|
81
|
+
/** Locale for date formatting
|
|
82
|
+
* @default 'en-BE'
|
|
83
|
+
*/
|
|
84
|
+
this.locale = 'en-BE';
|
|
85
|
+
/** Date format ex: YYYY-MM-DD, DD-MM-YYYY, etc.
|
|
86
|
+
* @default 'YYYY-MM-DD'
|
|
87
|
+
* @note If the date format is in UTC mode, the date will be displayed in UTC time.
|
|
88
|
+
* @note If the date format is not in UTC mode, the date will be displayed in the local time.
|
|
89
|
+
*/
|
|
90
|
+
this.dateFormat = 'YYYY-MM-DD';
|
|
91
|
+
/**
|
|
92
|
+
* Footer placement
|
|
93
|
+
* @default 'bottom'
|
|
94
|
+
*/
|
|
95
|
+
this.shortcutsPlacement = 'bottom';
|
|
96
|
+
/**
|
|
97
|
+
* Show action buttons
|
|
98
|
+
* @default false
|
|
99
|
+
*/
|
|
100
|
+
this.showActions = false;
|
|
101
|
+
/**
|
|
102
|
+
* Allows the field to stretch and fill the entire width of its container.
|
|
103
|
+
*/
|
|
104
|
+
this.fluid = false;
|
|
105
|
+
/**
|
|
106
|
+
* Closes the popover when a click is detected outside the component.
|
|
107
|
+
* @param {MouseEvent} event - The click event.
|
|
108
|
+
*/
|
|
109
|
+
this.handleClickOutside = (event) => {
|
|
110
|
+
if (this.open && this.el && !this.el.contains(event.target)) {
|
|
111
|
+
this.open = false;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Focuses the input when the input container is clicked.
|
|
116
|
+
* @param {MouseEvent} event - The click event.
|
|
117
|
+
*/
|
|
118
|
+
this.handleInputContainerClick = (event) => {
|
|
119
|
+
if (this.readonly || this.disabled) {
|
|
120
|
+
event.preventDefault();
|
|
121
|
+
event.stopPropagation();
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
this.inputElement.focus();
|
|
125
|
+
// Select the first characters based on the date format
|
|
126
|
+
const format = this.dateFormat;
|
|
127
|
+
if (format.startsWith('DD')) {
|
|
128
|
+
this.inputElement.setSelectionRange(0, 2);
|
|
129
|
+
}
|
|
130
|
+
else if (format.startsWith('MM')) {
|
|
131
|
+
this.inputElement.setSelectionRange(0, 2);
|
|
132
|
+
}
|
|
133
|
+
else if (format.startsWith('YYYY')) {
|
|
134
|
+
this.inputElement.setSelectionRange(0, 4);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Handles the input event on the input element.
|
|
139
|
+
* Updates the singleValue and emits the valueChanged event.
|
|
140
|
+
* @param {Event} event - The input event.
|
|
141
|
+
*/
|
|
142
|
+
this.handleInput = (event) => {
|
|
143
|
+
if (this.readonly || this.disabled) {
|
|
144
|
+
event.preventDefault();
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const input = event.target;
|
|
148
|
+
const previousValue = this.value;
|
|
149
|
+
this.singleValue = input.value;
|
|
150
|
+
this.value = input.value;
|
|
151
|
+
// Only emit valueChanged if the value actually changed
|
|
152
|
+
if (previousValue !== input.value) {
|
|
153
|
+
this.valueChanged.emit(input.value);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Toggles the opening/closing of the popover.
|
|
158
|
+
*/
|
|
159
|
+
this.toggleCalendar = () => {
|
|
160
|
+
if (this.readonly || this.disabled) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
this.open = !this.open;
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* Handles focus events on the input element.
|
|
167
|
+
* @param {FocusEvent} event - The focus event.
|
|
168
|
+
*/
|
|
169
|
+
this.handleFocus = (event) => {
|
|
170
|
+
if (this.readonly || this.disabled) {
|
|
171
|
+
event.preventDefault();
|
|
172
|
+
event.target.blur();
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* Prevents the valueChanged event from the calendar from propagating up.
|
|
178
|
+
* @param {CustomEvent} event - The valueChanged event from nv-calendar.
|
|
179
|
+
*/
|
|
180
|
+
this.handleCalendarValueChanged = (event) => {
|
|
181
|
+
event.stopPropagation();
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* Sets the reference to the popover element.
|
|
185
|
+
* @param {HTMLNvPopoverElement} el - The popover element.
|
|
186
|
+
*/
|
|
187
|
+
this.setPopoverRef = (el) => {
|
|
188
|
+
this.popoverElement = el;
|
|
189
|
+
};
|
|
190
|
+
/**
|
|
191
|
+
* Sets the reference to the input element.
|
|
192
|
+
* @param {HTMLInputElement} el - The input element.
|
|
193
|
+
*/
|
|
194
|
+
this.setInputRef = (el) => {
|
|
195
|
+
this.inputElement = el;
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
//#endregion PROPERTIES
|
|
199
|
+
/****************************************************************************/
|
|
200
|
+
//#region METHODS
|
|
201
|
+
/**
|
|
202
|
+
* Converts the nv-calendar date format to the format expected by Inputmask.
|
|
203
|
+
* @param {string} format - The date format.
|
|
204
|
+
* @returns {string} Format adapted for Inputmask.
|
|
205
|
+
*/
|
|
206
|
+
convertToInputmaskFormat(format) {
|
|
207
|
+
switch (format) {
|
|
208
|
+
case 'DD/MM/YYYY':
|
|
209
|
+
return 'dd/mm/yyyy';
|
|
210
|
+
case 'MM/DD/YYYY':
|
|
211
|
+
return 'mm/dd/yyyy';
|
|
212
|
+
case 'YYYY-MM-DD':
|
|
213
|
+
return 'yyyy-mm-dd';
|
|
214
|
+
case 'DD.MM.YYYY':
|
|
215
|
+
return 'dd.mm.yyyy';
|
|
216
|
+
case 'YYYYMMDD':
|
|
217
|
+
return 'yyyymmdd';
|
|
218
|
+
default:
|
|
219
|
+
return format;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
//#endregion METHODS
|
|
223
|
+
/****************************************************************************/
|
|
224
|
+
//#region LIFECYCLE
|
|
225
|
+
connectedCallback() {
|
|
226
|
+
document.addEventListener('click', this.handleClickOutside);
|
|
227
|
+
}
|
|
228
|
+
componentWillLoad() {
|
|
229
|
+
if (this.value) {
|
|
230
|
+
this.singleValue = this.value;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
componentDidLoad() {
|
|
234
|
+
const inputs = this.el.querySelectorAll('.input-wrapper input');
|
|
235
|
+
inputs.forEach((input) => {
|
|
236
|
+
inputmaskEdcad3c1.Inputmask({
|
|
237
|
+
alias: 'datetime',
|
|
238
|
+
inputFormat: this.convertToInputmaskFormat(this.dateFormat),
|
|
239
|
+
placeholder: '_'.repeat(this.dateFormat.length),
|
|
240
|
+
}).mask(input);
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
disconnectedCallback() {
|
|
244
|
+
document.removeEventListener('click', this.handleClickOutside);
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Handles the single date selection event from nv-calendar.
|
|
248
|
+
* Updates the input value and closes the popover.
|
|
249
|
+
* @param {CustomEvent} event - The event from nv-calendar.
|
|
250
|
+
*/
|
|
251
|
+
handleSingleDateChange(event) {
|
|
252
|
+
const value = event.detail;
|
|
253
|
+
const previousValue = this.value;
|
|
254
|
+
this.singleValue = value;
|
|
255
|
+
this.value = value;
|
|
256
|
+
// Only emit valueChanged if the value actually changed
|
|
257
|
+
if (previousValue !== value) {
|
|
258
|
+
this.valueChanged.emit(value);
|
|
259
|
+
}
|
|
260
|
+
if (!this.showActions) {
|
|
261
|
+
this.open = false;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
handleClosePopover() {
|
|
265
|
+
this.open = false;
|
|
266
|
+
}
|
|
267
|
+
handleKeyDown(event) {
|
|
268
|
+
if (!this.open) {
|
|
269
|
+
if (event.key === 'ArrowDown') {
|
|
270
|
+
this.open = true;
|
|
271
|
+
event.preventDefault();
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
// Verify if the popover element is defined
|
|
277
|
+
if (!this.popoverElement) {
|
|
278
|
+
console.warn('nv-fielddate -> Popover element is not defined');
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
handleValueChange(newValue) {
|
|
283
|
+
this.singleValue = newValue;
|
|
284
|
+
}
|
|
285
|
+
//#endregion EVENTS
|
|
286
|
+
/****************************************************************************/
|
|
287
|
+
//#region RENDER
|
|
288
|
+
render() {
|
|
289
|
+
return (index.h(index.Host, { key: '4af4649cc8fdc95f2f12d1c495549a006c82c742' }, ((this.label && this.label.length > 0) ||
|
|
290
|
+
this.el.querySelector('[slot="label"]')) && (index.h("label", { key: 'c4905c94c62c8eb01120b30e3b5c16c2dafec20d', htmlFor: this.inputId }, index.h("slot", { key: 'b8e952b9a6acb9f136d3461514b82a6767723c3c', name: "label" }, this.label))), index.h("nv-popover", { key: 'de6620c60eb3db3c6f0f435977f257636be81a80', ref: this.setPopoverRef, id: this.popoverId, triggerMode: "controlled", placement: "bottom-start", open: this.open }, index.h("div", { key: 'e2189ad3476f3d088c07153bc4c1e63357317ded', slot: "trigger", class: "input-wrapper" }, index.h("slot", { key: 'a35e545f1379c479734719d8460d5031631f5730', name: "before-input" }), index.h("div", { key: '01338c24dfff69e019ff6d2344f176effb2dac06', class: "input-container", onClick: this.handleInputContainerClick }, index.h("slot", { key: 'f6552d188174e77e8f75a9b0554e3ea78c57056d', name: "leading-input" }), index.h("input", { key: '1b9ad6226166b6bf08afda41f0f6b789fe12dd27', id: this.inputId, ref: this.setInputRef, placeholder: this.placeholder, name: this.name, disabled: this.disabled, readOnly: this.readonly, required: this.required, autofocus: this.autofocus, value: this.singleValue, onInput: this.handleInput, onFocus: this.handleFocus, "data-scope": "date" }), this.error && (index.h("nv-icon", { key: '0527f051261672a8df205d26dcb253c20b3dfd4b', name: "alert-circle", class: "validation", size: "md" })), this.success && (index.h("nv-icon", { key: 'ed83a0a0b7a88f392f16bf97f20885261f88665d', name: "circle-check", class: "validation", size: "md" })), index.h("nv-iconbutton", { key: '6abf3dff6a1bcc0759bea91ab3674d61f4c016c2', class: "toggle-calendar-icon", name: "calendar" //{this.open ? 'chevron-top' : 'chevron-down'}
|
|
291
|
+
,
|
|
292
|
+
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: '76d584ac756b228e356a17ad36e4558f9a497ea3', name: "after-input" })), index.h("div", { key: '4914e6fa5046fb287bedb841f2a0b71f1f86e5a3', slot: "content" }, index.h("nv-calendar", { key: 'fcfb949ee9c378aac2d7c792ed79fcb3cbf8e987', dateFormat: this.dateFormat, singleValue: this.singleValue, firstDayOfWeek: this.firstDayOfWeek, numberOfCalendars: this.numberOfCalendars, min: this.min, max: this.max, locale: this.locale, shortcutsPlacement: this.shortcutsPlacement, showActions: this.showActions, shortcuts: this.shortcuts, showWeekNumbers: this.showWeekNumbers, disabledDates: this.disabledDates, onValueChanged: this.handleCalendarValueChanged }))), ((this.description && this.description.length > 0) ||
|
|
293
|
+
this.el.querySelector('[slot="description"]')) && (index.h("div", { key: '52ffcb5f41161b9dc95c0fc18a252b6568817ffb', class: "description" }, index.h("slot", { key: '91c68f28fe31f5ecfa58d80e5decb018890f18fe', name: "description" }, this.description))), (this.errorDescription ||
|
|
294
|
+
this.el.querySelector('[slot="error-description"]')) && (index.h("div", { key: '0c0b8c65f261c2439446dd05014d172e6b829244', hidden: !this.error, class: "error-description" }, this.el.querySelector('[slot="error-description"]') ? (index.h("slot", { name: "error-description" })) : (this.errorDescription))), index.h("slot", { key: 'cf9410ad858faf59d7ada7ce70b18aa768e30a65' })));
|
|
295
|
+
}
|
|
296
|
+
get el() { return index.getElement(this); }
|
|
297
|
+
static get watchers() { return {
|
|
298
|
+
"value": ["handleValueChange"]
|
|
299
|
+
}; }
|
|
300
|
+
};
|
|
301
|
+
NvFielddate.style = NvFielddateStyle0;
|
|
302
|
+
|
|
303
|
+
exports.nv_fielddate = NvFielddate;
|