@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
package/dist/cjs/{nv-datagridcolumn.entry-CRogHbVM.js → nv-datagridcolumn.entry-CjYmo4fM.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-B2jv2KXv.js');
|
|
4
4
|
require('react');
|
|
5
5
|
|
|
6
6
|
const NvDatagridcolumn = class {
|
|
@@ -15,7 +15,7 @@ const NvDatagridcolumn = class {
|
|
|
15
15
|
/****************************************************************************/
|
|
16
16
|
//#region RENDER
|
|
17
17
|
render() {
|
|
18
|
-
return (index.h(index.Host, { key: '
|
|
18
|
+
return (index.h(index.Host, { key: 'daa7b24c99857d7467f0a5ce0b69dcbeb42577e7' }, index.h("slot", { key: '8c2fe1f1b806322cdf1c89b9243dd0d094e565eb', name: "header" }), index.h("slot", { key: '81ae95ccd66f88c05253fde0ec9e0d20e02e5304', name: "cell" })));
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-B2jv2KXv.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 constantsB97e736d = require('./constants-b97e736d-BzFAKCkR.js');
|
|
7
7
|
var v4A79185f4 = require('./v4-a79185f4-2n0dOd_Y.js');
|
|
8
8
|
require('react');
|
|
9
9
|
|
|
@@ -541,7 +541,7 @@ var tabbable = function tabbable(container, options) {
|
|
|
541
541
|
return sortByOrder(candidates);
|
|
542
542
|
};
|
|
543
543
|
|
|
544
|
-
const nvDialogCss = "dialog{border-radius:var(--radius-rounded-2xl);background:var(--color-level-00-background);min-width:400px;width:fit-content;max-width:960px;margin:auto;box-shadow:0px var(--shadow-y-axis-2xl) var(--shadow-blur-2xl) var(--shadow-spread-2xl) var(--shadow-color-opacity-3) var(--shadow-color-opacity-3)}dialog.full{width:90vw}dialog::backdrop{opacity:var(--components-overlay-opacity);background:var(--components-overlay-background)}dialog .content{display:flex;flex-direction:column;align-items:flex-start}dialog .content nv-button.close-button{position:absolute;top:var(--dialog-dismissible-position-top);right:var(--dialog-dismissible-position-right);display:flex;padding:var(--button-sm-icon-button-padding);justify-content:flex-end;align-items:flex-start;gap:10px}dialog .content .content-body{padding:var(--dialog-body-padding-y) var(--dialog-body-padding-x);
|
|
544
|
+
const nvDialogCss = "dialog{border-radius:var(--radius-rounded-2xl);background:var(--color-level-00-background);min-width:400px;width:fit-content;max-width:clamp(90vw, min(90vw, 960px), 960px);margin:auto;max-height:90vh;overflow:hidden;box-shadow:0px var(--shadow-y-axis-2xl) var(--shadow-blur-2xl) var(--shadow-spread-2xl) var(--shadow-color-opacity-3) var(--shadow-color-opacity-3)}dialog.full{width:90vw}dialog::backdrop{opacity:var(--components-overlay-opacity);background:var(--components-overlay-background)}dialog .content{display:flex;flex-direction:column;align-items:flex-start;height:fit-content;max-height:90vh;overflow:hidden}dialog .content nv-button.close-button{position:absolute;top:var(--dialog-dismissible-position-top);right:var(--dialog-dismissible-position-right);display:flex;padding:var(--button-sm-icon-button-padding);justify-content:flex-end;align-items:flex-start;gap:10px}dialog .content .content-body{overflow:auto;box-sizing:border-box;padding:var(--dialog-body-padding-y) var(--dialog-body-padding-x);scrollbar-gutter:stable both-edges;font-family:\"TT Norms Pro\", sans-serif;font-size:var(--font-size-md);font-style:normal;font-weight:400;line-height:var(--line-height-base);color:var(--color-content-medium-text)}dialog .content .content-body::-webkit-scrollbar{width:6px;height:6px}dialog .content .content-body::-webkit-scrollbar-track{background-color:var(--color-level-10-background);border-radius:9999px}dialog .content .content-body::-webkit-scrollbar-thumb{background-color:var(--color-gray-200);border-radius:9999px}";
|
|
545
545
|
const NvDialogStyle0 = nvDialogCss;
|
|
546
546
|
|
|
547
547
|
const NvDialog = class {
|
|
@@ -582,6 +582,17 @@ const NvDialog = class {
|
|
|
582
582
|
this.handleCancelButton = () => {
|
|
583
583
|
this.close();
|
|
584
584
|
};
|
|
585
|
+
/**
|
|
586
|
+
* Checks for and sets up form ID if a form is present
|
|
587
|
+
*/
|
|
588
|
+
this.checkForForm = () => {
|
|
589
|
+
if (!this.form) {
|
|
590
|
+
const formElement = this.el.querySelector('form');
|
|
591
|
+
if (formElement) {
|
|
592
|
+
this.form = this.ensureFormId(formElement);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
};
|
|
585
596
|
/**
|
|
586
597
|
* Handles the native dialog close event.
|
|
587
598
|
*/
|
|
@@ -741,15 +752,8 @@ const NvDialog = class {
|
|
|
741
752
|
return (child.getAttribute('slot') === 'footer' ||
|
|
742
753
|
child.tagName.toLowerCase() === 'nv-dialogfooter');
|
|
743
754
|
});
|
|
744
|
-
//
|
|
745
|
-
|
|
746
|
-
const formElement = Array.from(this.el.children).find(child => {
|
|
747
|
-
return child.tagName.toLowerCase() === 'form';
|
|
748
|
-
});
|
|
749
|
-
if (formElement) {
|
|
750
|
-
this.form = this.ensureFormId(formElement);
|
|
751
|
-
}
|
|
752
|
-
}
|
|
755
|
+
// Initial form check
|
|
756
|
+
this.checkForForm();
|
|
753
757
|
}
|
|
754
758
|
componentWillUpdate() {
|
|
755
759
|
this.attachEventListeners();
|
|
@@ -763,6 +767,8 @@ const NvDialog = class {
|
|
|
763
767
|
this.setAutofocus();
|
|
764
768
|
}
|
|
765
769
|
this.attachEventListeners();
|
|
770
|
+
// Additional form check in case form was added after initial load
|
|
771
|
+
this.checkForForm();
|
|
766
772
|
}
|
|
767
773
|
disconnectedCallback() {
|
|
768
774
|
if (this.triggerElement && !this.eventsAttached && !this.controlled) {
|
|
@@ -776,7 +782,7 @@ const NvDialog = class {
|
|
|
776
782
|
//#region RENDER
|
|
777
783
|
render() {
|
|
778
784
|
const hasForm = this.form || this.el.querySelector('form');
|
|
779
|
-
return (index.h(index.Host, { key: '
|
|
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 ? constantsB97e736d.ButtonType.Submit : constantsB97e736d.ButtonType.Button, onDialogCanceled: this.handleCancelButton, undismissable: this.undismissable }))))));
|
|
780
786
|
}
|
|
781
787
|
get el() { return index.getElement(this); }
|
|
782
788
|
static get watchers() { return {
|
package/dist/cjs/{nv-dialogfooter_2.entry-Q4_li_QU.js → nv-dialogfooter_2.entry-DnLg2DHy.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var
|
|
3
|
+
var index = require('./index-B2jv2KXv.js');
|
|
4
|
+
var constantsB97e736d = require('./constants-b97e736d-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 = constantsB97e736d.ButtonType.Button;
|
|
58
58
|
//#endregion EVENTS
|
|
59
59
|
/****************************************************************************/
|
|
60
60
|
//#region METHODS
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-B2jv2KXv.js');
|
|
4
4
|
var inputmaskEdcad3c1 = require('./inputmask-edcad3c1-B9Omti4z.js');
|
|
5
5
|
var v4A79185f4 = require('./v4-a79185f4-2n0dOd_Y.js');
|
|
6
6
|
require('react');
|
|
7
7
|
require('./_commonjsHelpers-1789f0cf-BJu3ubxk.js');
|
|
8
8
|
|
|
9
|
-
const nvFielddateCss = "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}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)}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 .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>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{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-fielddate .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)}";
|
|
9
|
+
const nvFielddateCss = "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>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
10
|
const NvFielddateStyle0 = nvFielddateCss;
|
|
11
11
|
|
|
12
12
|
const NvFielddate = class {
|
|
@@ -96,18 +96,9 @@ const NvFielddate = class {
|
|
|
96
96
|
*/
|
|
97
97
|
this.showActions = false;
|
|
98
98
|
/**
|
|
99
|
-
*
|
|
100
|
-
* JSON array of objects with the following properties:
|
|
101
|
-
* - label: string
|
|
102
|
-
* - onClick: function
|
|
103
|
-
* @default '[]'
|
|
99
|
+
* Allows the field to stretch and fill the entire width of its container.
|
|
104
100
|
*/
|
|
105
|
-
this.
|
|
106
|
-
/**
|
|
107
|
-
* Disabled dates ISO string array
|
|
108
|
-
* @default '[]'
|
|
109
|
-
*/
|
|
110
|
-
this.disabledDates = '[]';
|
|
101
|
+
this.fluid = false;
|
|
111
102
|
/**
|
|
112
103
|
* Closes the popover when a click is detected outside the component.
|
|
113
104
|
* @param {MouseEvent} event - The click event.
|
|
@@ -261,12 +252,12 @@ const NvFielddate = class {
|
|
|
261
252
|
/****************************************************************************/
|
|
262
253
|
//#region RENDER
|
|
263
254
|
render() {
|
|
264
|
-
return (index.h(index.Host, { key: '
|
|
265
|
-
this.el.querySelector('[slot="label"]')) && (index.h("label", { key: '
|
|
255
|
+
return (index.h(index.Host, { key: 'e59d967d20d9f1ab584058795f30a52e50ec2933' }, ((this.label && this.label.length > 0) ||
|
|
256
|
+
this.el.querySelector('[slot="label"]')) && (index.h("label", { key: 'e159c6731265e73b436093b1aceaf354451245c9', htmlFor: this.inputId }, index.h("slot", { key: '9fc823ee41ec9fc7c8f9a42021277b4729ff0544', name: "label" }, this.label))), index.h("nv-popover", { key: 'cd0e133d5c62b00d4ade7a08184942e0bacc54fe', ref: el => (this.popoverElement = el), id: this.popoverId, triggerMode: "controlled", placement: "bottom-start", open: this.open }, index.h("div", { key: '66b96d21779fd6a8f335af3d2d2bc4df117516d8', slot: "trigger", class: "input-wrapper" }, index.h("slot", { key: 'e2c0e7c249cc4b213afc858281db0a84ab9c4827', name: "before-input" }), index.h("div", { key: '585283bf8880c4d8be911167d27abe34c2f4e21f', class: "input-container", onClick: this.handleInputContainerClick }, index.h("slot", { key: '9c15ffe741369e54fca3a8aeb844e4fbcc93fd5d', name: "leading-input" }), index.h("input", { key: 'bca0e7c19b1081a2849a2a36843628c6f65a4eb2', id: this.inputId, ref: e => (this.inputElement = e), 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: 'd610fdea33086a737ef99ab4e4ed69f09dd40045', name: "alert-circle", class: "validation", size: "md" })), this.success && (index.h("nv-icon", { key: 'cce665f259ef8134cc8737f8077c05915b4f7dcc', name: "circle-check", class: "validation", size: "md" })), index.h("nv-iconbutton", { key: 'd27bcd437f35f5445fb9994fd7283c2339bc7ea8', class: "toggle-calendar-icon", name: "calendar" //{this.open ? 'chevron-top' : 'chevron-down'}
|
|
266
257
|
,
|
|
267
|
-
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: '
|
|
268
|
-
this.el.querySelector('[slot="description"]')) && (index.h("div", { key: '
|
|
269
|
-
this.el.querySelector('[slot="error-description"]')) && (index.h("div", { key: '
|
|
258
|
+
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: '7708b24f9f569094b6f4f850413edd46e210b7e8', name: "after-input" })), index.h("div", { key: '194a99a83c9978691130d17e981c61be742315cf', slot: "content" }, index.h("nv-calendar", { key: '4dc6b2afb3890c5bfb08f070f5b5daac07a76929', 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 }))), ((this.description && this.description.length > 0) ||
|
|
259
|
+
this.el.querySelector('[slot="description"]')) && (index.h("div", { key: '623af8e048bfb7aef8919fa64a0f1baf04608b69', class: "description" }, index.h("slot", { key: 'cd3eecb2488e19ba1faf139ab4546e6db10468d2', name: "description" }, this.description))), (this.errorDescription ||
|
|
260
|
+
this.el.querySelector('[slot="error-description"]')) && (index.h("div", { key: 'eafcfc3c9bb584c78d7f8d6437bbfab269fdaca9', hidden: !this.error, class: "error-description" }, this.el.querySelector('[slot="error-description"]') ? (index.h("slot", { name: "error-description" })) : (this.errorDescription))), index.h("slot", { key: '4b5c23e00f8edb7c0d0d40a5ae89bbb322190c5d' })));
|
|
270
261
|
}
|
|
271
262
|
get el() { return index.getElement(this); }
|
|
272
263
|
static get watchers() { return {
|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-B2jv2KXv.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;max-width:480px}nv-fielddaterange[fluid]:not([fluid=false]){max-width:unset}nv-fielddaterange[readonly]:not([readonly=false]){--nv-field-border-default:var(--components-form-field-border-readonly);--nv-field-border-hover:var(--nv-field-border-default);--nv-field-border-focus:var(--components-form-field-border-focus);--nv-field-border-disabled:var(--nv-field-border-default);--nv-field-border-readonly:var(--nv-field-border-default);--nv-field-background:var(--components-form-field-background-readonly)}nv-fielddaterange[error]:not([error=false]){--nv-field-border-default:var(--components-form-field-border-error);--nv-field-border-hover:var(--nv-field-border-default);--nv-field-border-focus:var(--nv-field-border-default);--nv-field-border-disabled:var(--nv-field-border-default);--nv-field-border-readonly:var(--nv-field-border-default);--nv-field-focus-box-shadow:var(--color-focus-destructive-in-field)}nv-fielddaterange[success]:not([success=false]){--nv-field-border-default:var(--components-form-field-border-success);--nv-field-border-hover:var(--nv-field-border-default);--nv-field-border-focus:var(--nv-field-border-default);--nv-field-border-disabled:var(--nv-field-border-default);--nv-field-border-readonly:var(--nv-field-border-default);--nv-field-focus-box-shadow:var(--color-focus-success)}nv-fielddaterange[required]:not([required=false]) label::after{content:\"*\";color:var(--components-form-text-required);font-weight:700}nv-fielddaterange label{display:flex;align-items:center;gap:var(--form-label-gap);align-self:stretch;color:var(--components-form-text-label-default);font-family:\"TT Norms Pro\", sans-serif;font-size:var(--form-label-font-size);font-style:normal;font-weight:500;line-height:var(--form-label-line-height)}nv-fielddaterange nv-popover{width:100%;display:block}nv-fielddaterange nv-popover [data-scope=popover]{padding:0;background-color:var(--components-list-dropdown-background);border:1px solid var(--components-list-dropdown-border);width:auto}nv-fielddaterange nv-popover [slot=content]{display:block;width:100%}nv-fielddaterange .input-wrapper{display:flex;flex-wrap:wrap;gap:var(--form-gap-x);align-items:stretch;align-self:stretch;display:flex;align-items:center;gap:8px}nv-fielddaterange .input-wrapper .input-container{display:flex;flex-grow:1;justify-content:center;align-items:center;align-self:stretch;border-radius:var(--form-field-radius);border-width:1px;border-style:solid;border-color:var(--nv-field-border-default);opacity:var(--components-form-opacity-default, 1);background:var(--nv-field-background);transition:all 150ms ease-out}nv-fielddaterange .input-wrapper .input-container:hover{border-color:var(--nv-field-border-hover)}nv-fielddaterange .input-wrapper .input-container:focus-within,nv-fielddaterange .input-wrapper .input-container:focus-within:hover,nv-fielddaterange .input-wrapper .input-container:focus,nv-fielddaterange .input-wrapper .input-container:focus:hover{border-color:var(--nv-field-border-focus);box-shadow:0px 0px 0px var(--focus-field-stroke) var(--nv-field-focus-box-shadow)}nv-fielddaterange .input-wrapper .input-container:has(input:read-only){opacity:0.5;background-color:var(--components-form-field-background-readonly);border-color:var(--nv-field-border-readonly)}nv-fielddaterange .input-wrapper .input-container:has(input:disabled){opacity:0.5;background-color:var(--components-form-field-background-disabled);border-color:var(--nv-field-border-disabled)}nv-fielddaterange .input-wrapper .input-container input{display:flex;align-items:center;flex:1 0 0;overflow:hidden;background-color:transparent;color:var(--components-form-field-content-text);padding:var(--form-field-padding-y) var(--form-field-padding-x);font-size:var(--form-field-font-size);font-style:normal;font-weight:500;line-height:var(--form-field-line-height);width:100%;width:100%}nv-fielddaterange .input-wrapper .input-container input:focus{outline:none}nv-fielddaterange .input-wrapper .input-container input::placeholder{overflow:hidden;color:var(--components-form-field-content-placeholder);text-overflow:ellipsis;font-family:\"TT Norms Pro\", sans-serif;font-size:var(--form-field-font-size);font-style:normal;font-weight:400;line-height:var(--form-field-line-height)}nv-fielddaterange .input-wrapper .input-container>nv-iconbutton{border:0px;border-radius:0px}nv-fielddaterange .input-wrapper .input-container>nv-iconbutton:focus-visible{border-radius:var(--button-md-border-radius);outline-offset:-3px}nv-fielddaterange .input-wrapper .input-container nv-icon.validation{color:var(--nv-field-border-default)}nv-fielddaterange .description{display:flex;align-items:center;align-self:stretch;gap:var(--spacing-1);color:var(--components-form-text-description-default);font-family:\"TT Norms Pro\", sans-serif;font-size:var(--form-description-font-size);font-style:normal;line-height:var(--form-description-line-height)}nv-fielddaterange .error-description{display:flex;align-items:center;align-self:stretch;gap:var(--spacing-1);color:var(--components-form-text-description-default);font-family:\"TT Norms Pro\", sans-serif;font-size:var(--form-description-font-size);font-style:normal;line-height:var(--form-description-line-height);color:var(--components-form-text-description-error)}nv-fielddaterange .range-inputs{display:flex;align-items:center;gap:8px}nv-fielddaterange .range-inputs input{flex:1;border:none;outline:none;padding:0;font-size:var(--form-field-font-size);color:var(--components-form-field-content-text);background:transparent;min-width:0;text-align:center}nv-fielddaterange .range-inputs input::placeholder{color:var(--components-form-field-content-placeholder)}nv-fielddaterange .range-inputs input:disabled{cursor:not-allowed;color:var(--components-form-field-content-text);background-color:var(--components-form-field-background-disabled)}";
|
|
10
|
+
const NvFielddaterangeStyle0 = nvFielddaterangeCss;
|
|
11
|
+
|
|
12
|
+
const NvFielddaterange = class {
|
|
13
|
+
constructor(hostRef) {
|
|
14
|
+
index.registerInstance(this, hostRef);
|
|
15
|
+
this.dateRangeChange = index.createEvent(this, "dateRangeChange");
|
|
16
|
+
this.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.autofocus = 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
|
+
* Current calendar state to prevent unwanted navigation
|
|
71
|
+
*/
|
|
72
|
+
this.calendarState = null;
|
|
73
|
+
/**
|
|
74
|
+
* First day of the week 0 = Sunday, 1 = Monday, etc.
|
|
75
|
+
* @default 1
|
|
76
|
+
*/
|
|
77
|
+
this.firstDayOfWeek = 1;
|
|
78
|
+
/**
|
|
79
|
+
* Number of calendars to display
|
|
80
|
+
* @default 2
|
|
81
|
+
*/
|
|
82
|
+
this.numberOfCalendars = 2;
|
|
83
|
+
/**
|
|
84
|
+
* Minimum date for selection ISO string format, ex: 2025-01-01
|
|
85
|
+
*/
|
|
86
|
+
this.min = '';
|
|
87
|
+
/**
|
|
88
|
+
* Maximum date for selection ISO string format, ex: 2025-12-31
|
|
89
|
+
*/
|
|
90
|
+
this.max = '';
|
|
91
|
+
/** Locale for date formatting
|
|
92
|
+
* @default 'en-BE'
|
|
93
|
+
*/
|
|
94
|
+
this.locale = 'en-BE';
|
|
95
|
+
/** Date format ex: YYYY-MM-DD, DD-MM-YYYY, etc.
|
|
96
|
+
* @default 'YYYY-MM-DD'
|
|
97
|
+
*/
|
|
98
|
+
this.dateFormat = 'YYYY-MM-DD';
|
|
99
|
+
/**
|
|
100
|
+
* Footer placement
|
|
101
|
+
* @default 'bottom'
|
|
102
|
+
*/
|
|
103
|
+
this.shortcutsPlacement = 'bottom';
|
|
104
|
+
/**
|
|
105
|
+
* Show action buttons
|
|
106
|
+
* @default false
|
|
107
|
+
*/
|
|
108
|
+
this.showActions = false;
|
|
109
|
+
/**
|
|
110
|
+
* Allows the field to stretch and fill the entire width of its container.
|
|
111
|
+
*/
|
|
112
|
+
this.fluid = false;
|
|
113
|
+
/**
|
|
114
|
+
* Closes the popover when a click is detected outside the component.
|
|
115
|
+
* @param {MouseEvent} event - The mouse event
|
|
116
|
+
*/
|
|
117
|
+
this.handleClickOutside = (event) => {
|
|
118
|
+
if (this.open && this.el && !this.el.contains(event.target)) {
|
|
119
|
+
this.open = false;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Handles the input event on the start input element.
|
|
124
|
+
* @param {Event} event - The input event
|
|
125
|
+
*/
|
|
126
|
+
this.handleStartInput = (event) => {
|
|
127
|
+
if (this.readonly || this.disabled) {
|
|
128
|
+
event.preventDefault();
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const input = event.target;
|
|
132
|
+
this.startValue = input.value;
|
|
133
|
+
this.dateRangeChange.emit({ start: input.value, end: this.endValue });
|
|
134
|
+
// Temporarily enable navigation for keyboard input
|
|
135
|
+
if (this.calendarElement) {
|
|
136
|
+
this.calendarElement.removeAttribute('data-prevent-navigation');
|
|
137
|
+
this.updateCalendarValue();
|
|
138
|
+
// Restore navigation prevention after update
|
|
139
|
+
setTimeout(() => {
|
|
140
|
+
if (this.calendarElement) {
|
|
141
|
+
this.calendarElement.setAttribute('data-prevent-navigation', 'true');
|
|
142
|
+
}
|
|
143
|
+
}, 100);
|
|
144
|
+
}
|
|
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
|
+
// Temporarily enable navigation for keyboard input
|
|
159
|
+
if (this.calendarElement) {
|
|
160
|
+
this.calendarElement.removeAttribute('data-prevent-navigation');
|
|
161
|
+
this.updateCalendarValue();
|
|
162
|
+
// Restore navigation prevention after update
|
|
163
|
+
setTimeout(() => {
|
|
164
|
+
if (this.calendarElement) {
|
|
165
|
+
this.calendarElement.setAttribute('data-prevent-navigation', 'true');
|
|
166
|
+
}
|
|
167
|
+
}, 100);
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* Handles focus events on the input elements.
|
|
172
|
+
* @param {FocusEvent} event - The focus event
|
|
173
|
+
*/
|
|
174
|
+
this.handleFocus = (event) => {
|
|
175
|
+
if (this.readonly || this.disabled) {
|
|
176
|
+
event.preventDefault();
|
|
177
|
+
event.target.blur();
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
// Enable navigation on focus
|
|
181
|
+
if (this.calendarElement) {
|
|
182
|
+
this.calendarElement.removeAttribute('data-prevent-navigation');
|
|
183
|
+
}
|
|
184
|
+
this.open = true;
|
|
185
|
+
// Restore navigation prevention after opening
|
|
186
|
+
setTimeout(() => {
|
|
187
|
+
if (this.calendarElement) {
|
|
188
|
+
this.calendarElement.setAttribute('data-prevent-navigation', 'true');
|
|
189
|
+
}
|
|
190
|
+
}, 300);
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* Toggles the opening/closing of the popover.
|
|
194
|
+
*/
|
|
195
|
+
this.toggleCalendar = () => {
|
|
196
|
+
if (this.readonly || this.disabled) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
this.open = !this.open;
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
//#endregion PROPERTIES
|
|
203
|
+
/****************************************************************************/
|
|
204
|
+
//#region METHODS
|
|
205
|
+
/**
|
|
206
|
+
* Converts the nv-calendar date format to the format expected by Inputmask.
|
|
207
|
+
* @param {string} format - The date format to convert
|
|
208
|
+
* @returns {string} The converted format for Inputmask
|
|
209
|
+
*/
|
|
210
|
+
convertToInputmaskFormat(format) {
|
|
211
|
+
// If the format is not specified, use the default format YYYY-MM-DD
|
|
212
|
+
if (!format) {
|
|
213
|
+
return 'dd/mm/yyyy';
|
|
214
|
+
}
|
|
215
|
+
const formatMap = {
|
|
216
|
+
'YYYY-MM-DD': 'yyyy-mm-dd',
|
|
217
|
+
'DD/MM/YYYY': 'dd/mm/yyyy',
|
|
218
|
+
'MM/DD/YYYY': 'mm/dd/yyyy',
|
|
219
|
+
'DD.MM.YYYY': 'dd.mm.yyyy',
|
|
220
|
+
'YYYYMMDD': 'yyyymmdd',
|
|
221
|
+
};
|
|
222
|
+
return formatMap[format] || 'dd/mm/yyyy';
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Update the calendar's rangeValue property without forcing month change
|
|
226
|
+
*/
|
|
227
|
+
updateCalendarValue() {
|
|
228
|
+
if (this.calendarElement && this.startValue && this.endValue) {
|
|
229
|
+
// Store the current calendar state
|
|
230
|
+
this.calendarState = {
|
|
231
|
+
start: this.startValue,
|
|
232
|
+
end: this.endValue,
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
//#endregion METHODS
|
|
237
|
+
/****************************************************************************/
|
|
238
|
+
//#region LIFECYCLE
|
|
239
|
+
connectedCallback() {
|
|
240
|
+
document.addEventListener('click', this.handleClickOutside);
|
|
241
|
+
}
|
|
242
|
+
componentWillLoad() {
|
|
243
|
+
if (this.value) {
|
|
244
|
+
try {
|
|
245
|
+
const range = JSON.parse(this.value);
|
|
246
|
+
this.startValue = range.start || '';
|
|
247
|
+
this.endValue = range.end || '';
|
|
248
|
+
if (range.start && range.end) {
|
|
249
|
+
this.calendarState = {
|
|
250
|
+
start: range.start,
|
|
251
|
+
end: range.end,
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
catch (error) {
|
|
256
|
+
console.error('Invalid JSON for value:');
|
|
257
|
+
console.error(error);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
componentDidLoad() {
|
|
262
|
+
const inputs = this.el.querySelectorAll('.input-wrapper input');
|
|
263
|
+
inputs.forEach((input) => {
|
|
264
|
+
const inputMask = new inputmaskEdcad3c1.Inputmask({
|
|
265
|
+
alias: 'datetime',
|
|
266
|
+
inputFormat: this.convertToInputmaskFormat(this.dateFormat),
|
|
267
|
+
placeholder: '_',
|
|
268
|
+
clearIncomplete: false,
|
|
269
|
+
showMaskOnHover: false,
|
|
270
|
+
showMaskOnFocus: false,
|
|
271
|
+
clearMaskOnLostFocus: false,
|
|
272
|
+
insertMode: true,
|
|
273
|
+
rightAlign: false,
|
|
274
|
+
oncomplete: function (e) {
|
|
275
|
+
const input = e.target;
|
|
276
|
+
const event = new CustomEvent('input', { bubbles: true });
|
|
277
|
+
input.dispatchEvent(event);
|
|
278
|
+
},
|
|
279
|
+
});
|
|
280
|
+
inputMask.mask(input);
|
|
281
|
+
// Set the value after applying the mask
|
|
282
|
+
if (input.name === this.startName && this.startValue) {
|
|
283
|
+
requestAnimationFrame(() => {
|
|
284
|
+
input.value = this.startValue;
|
|
285
|
+
const event = new CustomEvent('input', { bubbles: true });
|
|
286
|
+
input.dispatchEvent(event);
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
else if (input.name === this.endName && this.endValue) {
|
|
290
|
+
requestAnimationFrame(() => {
|
|
291
|
+
input.value = this.endValue;
|
|
292
|
+
const event = new CustomEvent('input', { bubbles: true });
|
|
293
|
+
input.dispatchEvent(event);
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
componentDidRender() {
|
|
299
|
+
const inputs = this.el.querySelectorAll('.input-wrapper input');
|
|
300
|
+
inputs.forEach((input) => {
|
|
301
|
+
const value = input.name === this.startName
|
|
302
|
+
? this.startValue
|
|
303
|
+
: this.endName
|
|
304
|
+
? this.endValue
|
|
305
|
+
: '';
|
|
306
|
+
if (value) {
|
|
307
|
+
// Make sure the value is defined both as a property and attribute
|
|
308
|
+
requestAnimationFrame(() => {
|
|
309
|
+
input.value = value;
|
|
310
|
+
input.setAttribute('value', value);
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
disconnectedCallback() {
|
|
316
|
+
document.removeEventListener('click', this.handleClickOutside);
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Handles the range date selection event from nv-calendar.
|
|
320
|
+
* @param {CustomEvent<DateRange>} event - The custom event
|
|
321
|
+
*/
|
|
322
|
+
handleRangeDateChange(event) {
|
|
323
|
+
const { start, end } = event.detail || {};
|
|
324
|
+
// Check that both dates are defined
|
|
325
|
+
if (start && end) {
|
|
326
|
+
this.startValue = start;
|
|
327
|
+
this.endValue = end;
|
|
328
|
+
this.calendarState = { start, end };
|
|
329
|
+
this.dateRangeChange.emit({
|
|
330
|
+
start: this.startValue,
|
|
331
|
+
end: this.endValue,
|
|
332
|
+
});
|
|
333
|
+
if (!this.showActions) {
|
|
334
|
+
this.open = false;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
handleClosePopover() {
|
|
339
|
+
this.open = false;
|
|
340
|
+
}
|
|
341
|
+
handleApplyDateRange() {
|
|
342
|
+
this.open = false;
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Handles the reset event from the calendar's cancel button
|
|
346
|
+
* @param {CustomEvent} event - The event emitted by the calendar
|
|
347
|
+
*/
|
|
348
|
+
handleDateReset(event) {
|
|
349
|
+
const isResetSingle = event.type === 'singleDateChange' && event.detail === '';
|
|
350
|
+
const isResetRange = event.type === 'rangeDateChange' &&
|
|
351
|
+
event.detail &&
|
|
352
|
+
event.detail.start === '' &&
|
|
353
|
+
event.detail.end === '';
|
|
354
|
+
if (isResetSingle || isResetRange) {
|
|
355
|
+
this.startValue = '';
|
|
356
|
+
this.endValue = '';
|
|
357
|
+
const inputs = this.el.querySelectorAll('.input-wrapper input');
|
|
358
|
+
inputs.forEach((input) => {
|
|
359
|
+
input.value = '';
|
|
360
|
+
});
|
|
361
|
+
this.dateRangeChange.emit({ start: '', end: '' });
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Handles keyboard events.
|
|
366
|
+
* @param {KeyboardEvent} event - The keyboard event
|
|
367
|
+
*/
|
|
368
|
+
handleKeyDown(event) {
|
|
369
|
+
if (!this.open) {
|
|
370
|
+
if (event.key === 'ArrowDown') {
|
|
371
|
+
this.open = true;
|
|
372
|
+
event.preventDefault();
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
if (!this.popoverElement) {
|
|
378
|
+
console.warn('nv-fielddaterange -> Popover element is not defined');
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
handleValueChange(newValue) {
|
|
383
|
+
try {
|
|
384
|
+
const range = JSON.parse(newValue);
|
|
385
|
+
this.startValue = range.start || '';
|
|
386
|
+
this.endValue = range.end || '';
|
|
387
|
+
}
|
|
388
|
+
catch (error) {
|
|
389
|
+
console.error('Invalid JSON for value:', error);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
//#endregion EVENTS
|
|
393
|
+
/****************************************************************************/
|
|
394
|
+
//#region RENDER
|
|
395
|
+
render() {
|
|
396
|
+
return (index.h(index.Host, { key: '152a588b815a0f3846c5b0c8b9da8d3dbc8f4768' }, ((this.label && this.label.length > 0) ||
|
|
397
|
+
this.el.querySelector('[slot="label"]')) && (index.h("label", { key: '786269a2bd4a50559cfad72c61f80797e4afc902', htmlFor: this.startInputId }, index.h("slot", { key: 'e1c6ed7d288d21889e1ebdfdf0595d4f43e551f7', name: "label" }, this.label))), index.h("nv-popover", { key: '228966569f5670f1b283c2e45f1c1057811e699d', ref: el => (this.popoverElement = el), id: this.popoverId, triggerMode: "controlled", placement: "bottom-start", open: this.open }, index.h("div", { key: 'ee39e8da7367bceb1fdcaf7f008d780652471e8e', slot: "trigger", class: "input-wrapper" }, index.h("slot", { key: '0555695d16ae919327771c586a291dc1767ed98f', name: "before-input" }), index.h("div", { key: '106aec6a9be06a03497f66407ea8038d5e4be899', class: "input-container" }, index.h("slot", { key: 'e448f8bacd3b383944f862b9dc1b7ea64feb565e', name: "leading-input" }), index.h("div", { key: '52ef48b4d76f063c65daa43865da607273ba6410', class: "range-inputs" }, index.h("input", { key: '899e309f7e100b7b6d12603b229aa4c429ddc1d2', id: this.startInputId, type: "text", placeholder: this.startPlaceholder, name: this.startName, disabled: this.disabled, readOnly: this.readonly, required: this.required, autofocus: this.autofocus, value: this.startValue, onInput: this.handleStartInput, onFocus: this.handleFocus, "data-scope": "date-range" }), index.h("svg", { key: '083bef93159b08aaf5c9f7637fbe459c2017e82f', 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: '2946dbfae81e0b3cdd62f77bb928617d182ae5c1', stroke: "none", d: "M0 0h24v24H0z", fill: "none" }), index.h("path", { key: 'afcf53514d22c9f8bb5d7d09294808f3ca053cc9', d: "M18 9l3 3l-3 3" }), index.h("path", { key: '53fe61cf1c1a5206f22d4c065292680f28fa3c59', d: "M15 12h6" }), index.h("path", { key: '1e138be2146498fa127922dcba9646e2e960a7e3', d: "M6 9l-3 3l3 3" }), index.h("path", { key: '3e324bf333bd69374fccac278386f6cc966fc3bd', d: "M3 12h6" })), index.h("input", { key: 'b7eeab7a9e0071c862528e8fa47c543d0295d331', id: this.endInputId, type: "text", placeholder: this.endPlaceholder, name: this.endName, disabled: this.disabled, readOnly: this.readonly, required: this.required, value: this.endValue, onInput: this.handleEndInput, onFocus: this.handleFocus, "data-scope": "date-range" })), this.error && (index.h("nv-icon", { key: 'f2ab540736820a8fcf7f4dbb973bc3a16b14fa8d', name: "alert-circle", class: "validation", size: "md" })), this.success && (index.h("nv-icon", { key: '91e75c515c4a44a3e499240e4d3c45b7a736429a', name: "circle-check", class: "validation", size: "md" })), index.h("nv-iconbutton", { key: 'a471cb1db59673f07ce493bae59e54ee8ecd8968', 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: '375a0c1848445652c2ef5f20ded877223774f792', name: "after-input" })), index.h("div", { key: '7427c51a78cf38a979b9f7eb4e9a7f49a36279d5', slot: "content" }, index.h("nv-calendar", { key: '1f9ad9bed53d9496f17544c6381824490431c342', ref: el => (this.calendarElement = el), dateFormat: this.dateFormat, rangeValue: this.calendarState, firstDayOfWeek: this.firstDayOfWeek, numberOfCalendars: this.numberOfCalendars, min: this.min, max: this.max, locale: this.locale, shortcutsPlacement: this.shortcutsPlacement, showActions: this.showActions, shortcuts: this.shortcuts, showWeekNumbers: this.showWeekNumbers, disabledDates: this.disabledDates, selectionType: "range", "data-prevent-navigation": "true" }))), ((this.description && this.description.length > 0) ||
|
|
398
|
+
this.el.querySelector('[slot="description"]')) && (index.h("div", { key: 'c964928de34f26fc82619601d0964079b061048f', class: "description" }, index.h("slot", { key: 'f409a5286e1c0ba16f36f062df3df5531dad6296', name: "description" }, this.description))), (this.errorDescription ||
|
|
399
|
+
this.el.querySelector('[slot="error-description"]')) && (index.h("div", { key: '5e8a1b48da516f801372a59e379c5ade77f9761a', hidden: !this.error, class: "error-description" }, this.el.querySelector('[slot="error-description"]') ? (index.h("slot", { name: "error-description" })) : (this.errorDescription))), index.h("slot", { key: '68f37bddcd3208217a26eb230d1f8afdd3552eff' })));
|
|
400
|
+
}
|
|
401
|
+
get el() { return index.getElement(this); }
|
|
402
|
+
static get watchers() { return {
|
|
403
|
+
"value": ["handleValueChange"]
|
|
404
|
+
}; }
|
|
405
|
+
};
|
|
406
|
+
NvFielddaterange.style = NvFielddaterangeStyle0;
|
|
407
|
+
|
|
408
|
+
exports.nv_fielddaterange = NvFielddaterange;
|