@nova-design-system/nova-react 3.8.0 → 3.9.1
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-Bb1XKZGx.js → index-BtjpbnUr.js} +204 -237
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/{nv-accordion-item.entry-C5661fm-.js → nv-accordion-item.entry-Dr_2iHhQ.js} +1 -1
- package/dist/cjs/{nv-accordion.entry-CP_zsF6b.js → nv-accordion.entry-CYVpcwuY.js} +1 -1
- package/dist/cjs/{nv-alert.entry-D_p0AAmo.js → nv-alert.entry-C_H-R9wb.js} +1 -1
- package/dist/cjs/{nv-avatar.entry-BnilI7zk.js → nv-avatar.entry-BeSOqGvb.js} +1 -1
- package/dist/cjs/{nv-badge_2.entry-ChSAhfAs.js → nv-badge_2.entry-BGWUswPo.js} +1 -1
- package/dist/cjs/{nv-breadcrumb.entry-Buou7RzA.js → nv-breadcrumb.entry-yQozUTFi.js} +1 -1
- package/dist/cjs/{nv-breadcrumbs.entry-8F3MtWWO.js → nv-breadcrumbs.entry-Qar1fOI7.js} +1 -1
- package/dist/cjs/{nv-button.entry-ChGTpHXs.js → nv-button.entry-M_c4r8PX.js} +1 -1
- package/dist/cjs/{nv-calendar.entry-6F5iqww_.js → nv-calendar.entry-DFE372aB.js} +10 -4
- package/dist/cjs/{nv-col.entry-D_uhyhgW.js → nv-col.entry-Bi8pH33J.js} +1 -1
- package/dist/cjs/{nv-datagrid.entry-CcHlFYFE.js → nv-datagrid.entry-B-blFDg-.js} +1 -1
- package/dist/cjs/{nv-datagridcolumn.entry-BfWZGDa6.js → nv-datagridcolumn.entry-CAzB7NtB.js} +1 -1
- package/dist/cjs/{nv-dialog.entry-BsBvypIE.js → nv-dialog.entry-Bdw3O22w.js} +20 -33
- package/dist/cjs/{nv-dialogfooter_2.entry-CRLL5Dgd.js → nv-dialogfooter_2.entry-BTUrxVzn.js} +2 -2
- package/dist/cjs/{nv-fieldcheckbox.entry-Bq5qfost.js → nv-fieldcheckbox.entry-DNzC8s-J.js} +1 -1
- package/dist/cjs/{nv-fielddate.entry-CovA2_W4.js → nv-fielddate.entry-BI8REINj.js} +63 -95
- package/dist/cjs/{nv-fielddaterange.entry-DYUoBivt.js → nv-fielddaterange.entry-B7mtEV97.js} +53 -34
- package/dist/cjs/{nv-fielddropdown.entry-BoQNqqD1.js → nv-fielddropdown.entry-Cz7yuHTj.js} +1 -1
- package/dist/cjs/{nv-fielddropdownitem.entry-PjgKcj17.js → nv-fielddropdownitem.entry-CH_C4Dr-.js} +1 -1
- package/dist/cjs/{nv-fieldmultiselect.entry-DYoxBuHi.js → nv-fieldmultiselect.entry-BqEdEUR0.js} +1 -1
- package/dist/cjs/{nv-fieldnumber.entry-7gqmeRyL.js → nv-fieldnumber.entry-BhRb8v1L.js} +1 -1
- package/dist/cjs/{nv-fieldpassword.entry-Dkd4jwfO.js → nv-fieldpassword.entry-BL4T90zr.js} +1 -1
- package/dist/cjs/{nv-fieldradio.entry-Bvod-7bv.js → nv-fieldradio.entry-D-x10Pri.js} +1 -1
- package/dist/cjs/{nv-fieldselect.entry-DF_mKXpV.js → nv-fieldselect.entry-B-kynHlw.js} +15 -27
- package/dist/cjs/{nv-fieldslider.entry-RindpJRB.js → nv-fieldslider.entry-D6X0LJKJ.js} +1 -1
- package/dist/cjs/{nv-fieldtext.entry-DyA5rIaN.js → nv-fieldtext.entry-xR41AQcM.js} +1 -1
- package/dist/cjs/{nv-fieldtextarea.entry-B0AebkE0.js → nv-fieldtextarea.entry-4mqhSSHM.js} +1 -1
- package/dist/cjs/{nv-fieldtime.entry-DZzNBYkw.js → nv-fieldtime.entry-S3r7RYwN.js} +1 -1
- package/dist/cjs/nv-icon.entry-C2t6pj-B.js +79 -0
- package/dist/cjs/{nv-iconbutton_2.entry-jD1sVaAa.js → nv-iconbutton_2.entry-Cv1d6ktl.js} +1 -1
- package/dist/cjs/{nv-menu.entry-DsX3fpng.js → nv-menu.entry-J_Ytq1Kn.js} +1 -1
- package/dist/cjs/{nv-menuitem.entry-CF5tWPyu.js → nv-menuitem.entry-DpOO9tMo.js} +1 -1
- package/dist/cjs/{nv-popover.entry-B0OYp4lU.js → nv-popover.entry-BZJHJXSA.js} +1 -1
- package/dist/cjs/{nv-row.entry-D_OqCwin.js → nv-row.entry-D4qBjtBv.js} +1 -1
- package/dist/cjs/{nv-stack.entry-Bn_KHqkn.js → nv-stack.entry-DOc6ZvMZ.js} +1 -1
- package/dist/cjs/{nv-table.entry-Cm2muhHl.js → nv-table.entry-7-TxQSlH.js} +1 -1
- package/dist/cjs/{nv-tablecolumn.entry-OkY7JWJW.js → nv-tablecolumn.entry-Bd4xWDYD.js} +1 -1
- package/dist/cjs/{nv-toggle.entry-GveVeY_m.js → nv-toggle.entry-DJmXXavz.js} +1 -1
- package/dist/cjs/{nv-tooltip.entry-Dg5r_8bW.js → nv-tooltip.entry-D9nl_ejz.js} +1 -1
- package/dist/generated/components.server.js +0 -1
- package/package.json +1 -1
- package/dist/cjs/nv-icon.entry-DxLyBjnd.js +0 -79
package/dist/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-BtjpbnUr.js');
|
|
4
4
|
require('react');
|
|
5
5
|
|
|
6
6
|
const nvAccordionCss = "nv-accordion{display:block;border:var(--spacing-px) solid var(--color-content-low-border);border-radius:var(--radius-rounded-lg)}nv-accordion .nv-accordion__footer{padding:var(--spacing-3);background:var(--color-level-05-background);border-radius:0 0 var(--radius-rounded-lg) var(--radius-rounded-lg);margin-top:calc(var(--spacing-px) * -1);border-top:var(--spacing-px) solid var(--color-content-low-border)}nv-accordion .nv-accordion__footer:empty{display:none}";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-BtjpbnUr.js');
|
|
4
4
|
var clsx297c1ffe = require('./clsx-297c1ffe-BtxeOLZW.js');
|
|
5
5
|
var constants4faa1fae = require('./constants-4faa1fae-BzFAKCkR.js');
|
|
6
6
|
var collapse_animation16e3af45 = require('./collapse.animation-16e3af45-CChx_tQJ.js');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-BtjpbnUr.js');
|
|
4
4
|
var clsx297c1ffe = require('./clsx-297c1ffe-BtxeOLZW.js');
|
|
5
5
|
var collapse_animation16e3af45 = require('./collapse.animation-16e3af45-CChx_tQJ.js');
|
|
6
6
|
var fade_animation71e8e34c = require('./fade.animation-71e8e34c-BAw_TYsB.js');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-BtjpbnUr.js');
|
|
4
4
|
require('react');
|
|
5
5
|
|
|
6
6
|
const nvBreadcrumbsCss = "nv-breadcrumbs{display:block}nv-breadcrumbs>ol{display:flex;flex-wrap:wrap;align-items:center;gap:var(--breadcrumb-padding-y)}nv-breadcrumbs nv-breadcrumb:last-child [data-scope=separator],nv-breadcrumbs nv-breadcrumb:last-child [slot=separator]{display:none}";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-BtjpbnUr.js');
|
|
4
4
|
var constants4faa1fae = require('./constants-4faa1fae-BzFAKCkR.js');
|
|
5
5
|
var _commonjsHelpers1789f0cf = require('./_commonjsHelpers-1789f0cf-BJu3ubxk.js');
|
|
6
6
|
require('react');
|
|
@@ -498,6 +498,12 @@ const NvCalendar = class {
|
|
|
498
498
|
.split(',')
|
|
499
499
|
.map(v => v.trim())
|
|
500
500
|
.filter(Boolean);
|
|
501
|
+
if (this.selectionType === 'range' && values.length < 2) {
|
|
502
|
+
console.warn(`Invalid date range format: ${value}`);
|
|
503
|
+
this.startDate = null;
|
|
504
|
+
this.endDate = null;
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
501
507
|
if (this.selectionType === 'single' && values.length >= 1) {
|
|
502
508
|
const parsedDate = parseDate(values[0], this.dateFormat);
|
|
503
509
|
if (parsedDate) {
|
|
@@ -542,7 +548,7 @@ const NvCalendar = class {
|
|
|
542
548
|
}
|
|
543
549
|
else {
|
|
544
550
|
// Handle malformed dates gracefully - reset state
|
|
545
|
-
console.warn(`Invalid date range format: ${values[0]}, ${values[1]}`);
|
|
551
|
+
console.warn(`Invalid date range format: ${values === null || values === void 0 ? void 0 : values[0]}, ${values === null || values === void 0 ? void 0 : values[1]}`);
|
|
546
552
|
this.startDate = null;
|
|
547
553
|
this.endDate = null;
|
|
548
554
|
if (!this.showActions) {
|
|
@@ -1305,8 +1311,8 @@ const NvCalendar = class {
|
|
|
1305
1311
|
* @slot default - Child content of the component.
|
|
1306
1312
|
*/
|
|
1307
1313
|
render() {
|
|
1308
|
-
return (index.h(index.Host, { key: '
|
|
1309
|
-
this.hasActions) && (index.h("div", { key: '
|
|
1314
|
+
return (index.h(index.Host, { key: '492526a4a9ed114aba804db45f49847b1db58c9f' }, index.h("div", { key: '632759b4eb6c65c3b082b707fba75568ed351e49', class: "datepicker-root" }, index.h("div", { key: '8dc6160dec8ed46e2d2f70e3154cd73cbaeee586', class: `datepicker-container ${this.numberOfCalendars === 1 ? 'datepicker-container-single' : ''}` }, index.h("div", { key: '55b1c7f8bcda0785ca63a1572bfebc628a3971d5', class: `datepicker-wrapper ${this.numberOfCalendars === 1 ? 'single' : ''}` }, this.shortcutsPlacement === 'left' && this.renderShortcuts(), Array.from({ length: this.numberOfCalendars }, (_, index) => this.renderCalendar(index, index)), this.shortcutsPlacement === 'right' && this.renderShortcuts()), ((this.hasShortcuts && this.shortcutsPlacement === 'bottom') ||
|
|
1315
|
+
this.hasActions) && (index.h("div", { key: '7234a6d497fccdcab8923b5235f591f24061c92d', class: "datepicker-controls" }, this.shortcutsPlacement === 'bottom' && this.renderShortcuts(), this.hasActions && this.renderActions())))), index.h("slot", { key: '1a23c6e92ffbc8ca64b42ff41ed6d106a3697e7f' })));
|
|
1310
1316
|
}
|
|
1311
1317
|
get el() { return index.getElement(this); }
|
|
1312
1318
|
static get watchers() { return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-BtjpbnUr.js');
|
|
4
4
|
var dom_utilsAc71e0ef = require('./dom.utils-ac71e0ef-CmIwRr6O.js');
|
|
5
5
|
var constants4faa1fae = require('./constants-4faa1fae-BzFAKCkR.js');
|
|
6
6
|
require('react');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-BtjpbnUr.js');
|
|
4
4
|
var events_utilsFe1d907f = require('./events.utils-fe1d907f-01N__3wY.js');
|
|
5
5
|
var clsx297c1ffe = require('./clsx-297c1ffe-BtxeOLZW.js');
|
|
6
6
|
var constants4faa1fae = require('./constants-4faa1fae-BzFAKCkR.js');
|
|
@@ -563,7 +563,8 @@ const NvDialog = class {
|
|
|
563
563
|
*/
|
|
564
564
|
this.clickOutside = false;
|
|
565
565
|
/**
|
|
566
|
-
* If true, the dialog visibility is managed manually through methods or the
|
|
566
|
+
* If true, the dialog visibility is managed manually through methods or the
|
|
567
|
+
* open prop.
|
|
567
568
|
*/
|
|
568
569
|
this.controlled = false;
|
|
569
570
|
/**
|
|
@@ -571,22 +572,11 @@ const NvDialog = class {
|
|
|
571
572
|
*/
|
|
572
573
|
this.full = false;
|
|
573
574
|
/**
|
|
574
|
-
* Controls whether the dialog should automatically focus the first focusable
|
|
575
|
-
* When disabled, prevents unwanted tooltip triggers on
|
|
575
|
+
* Controls whether the dialog should automatically focus the first focusable
|
|
576
|
+
* element when opened. When disabled, prevents unwanted tooltip triggers on
|
|
577
|
+
* dialog open.
|
|
576
578
|
*/
|
|
577
579
|
this.autofocus = false;
|
|
578
|
-
/**
|
|
579
|
-
* Handles the close button click.
|
|
580
|
-
*/
|
|
581
|
-
this.handleCloseButton = () => {
|
|
582
|
-
this.close();
|
|
583
|
-
};
|
|
584
|
-
/**
|
|
585
|
-
* Handles the cancel button click.
|
|
586
|
-
*/
|
|
587
|
-
this.handleCancelButton = () => {
|
|
588
|
-
this.close();
|
|
589
|
-
};
|
|
590
580
|
/**
|
|
591
581
|
* Checks for and sets up form ID if a form is present
|
|
592
582
|
*/
|
|
@@ -615,7 +605,6 @@ const NvDialog = class {
|
|
|
615
605
|
};
|
|
616
606
|
this.triggerClickEvents = [
|
|
617
607
|
['click', this.show],
|
|
618
|
-
['touchstart', this.show],
|
|
619
608
|
[
|
|
620
609
|
'keydown',
|
|
621
610
|
(e) => {
|
|
@@ -636,9 +625,10 @@ const NvDialog = class {
|
|
|
636
625
|
async show() {
|
|
637
626
|
this.open = true;
|
|
638
627
|
this.preventScroll();
|
|
639
|
-
|
|
628
|
+
/** It is recommended to use the .show() or .showModal() method to render
|
|
629
|
+
* dialogs, rather than the open attribute. If a <dialog> is opened using
|
|
630
|
+
* the open attribute, it is non-modal. */
|
|
640
631
|
this.dialogElement.showModal();
|
|
641
|
-
this.openChanged.emit(this.open);
|
|
642
632
|
}
|
|
643
633
|
/**
|
|
644
634
|
* Call this method to hide the dialog, making it disappear from view.
|
|
@@ -647,7 +637,6 @@ const NvDialog = class {
|
|
|
647
637
|
this.open = false;
|
|
648
638
|
this.allowScroll();
|
|
649
639
|
this.dialogElement.close();
|
|
650
|
-
this.openChanged.emit(this.open);
|
|
651
640
|
}
|
|
652
641
|
/**
|
|
653
642
|
* Sets the autofocus on the first focusable element in the dialog.
|
|
@@ -711,10 +700,15 @@ const NvDialog = class {
|
|
|
711
700
|
* @param {KeyboardEvent} event - The keydown event.
|
|
712
701
|
*/
|
|
713
702
|
handleKeyDown(event) {
|
|
714
|
-
if (event.key
|
|
703
|
+
if (event.key !== 'Escape')
|
|
704
|
+
return;
|
|
705
|
+
if (this.undismissable) {
|
|
715
706
|
event.preventDefault();
|
|
716
707
|
event.stopPropagation();
|
|
717
708
|
}
|
|
709
|
+
else {
|
|
710
|
+
this.close();
|
|
711
|
+
}
|
|
718
712
|
}
|
|
719
713
|
/**
|
|
720
714
|
* Handles the click event to close the dialog when clickOutside is true.
|
|
@@ -725,24 +719,17 @@ const NvDialog = class {
|
|
|
725
719
|
return;
|
|
726
720
|
this.handleClickOutside(event);
|
|
727
721
|
}
|
|
728
|
-
/**
|
|
729
|
-
* Handles the touchstart event to close the dialog when clickOutside is true.
|
|
730
|
-
* @param {TouchEvent} event - The touchstart event.
|
|
731
|
-
*/
|
|
732
|
-
handleDocumentTouch(event) {
|
|
733
|
-
if (!this.clickOutside || this.undismissable)
|
|
734
|
-
return;
|
|
735
|
-
this.handleClickOutside(event);
|
|
736
|
-
}
|
|
737
722
|
//#endregion EVENTS
|
|
738
723
|
/****************************************************************************/
|
|
739
724
|
//#region WATCHERS
|
|
740
|
-
async handleDialogOpenChange(
|
|
741
|
-
if (
|
|
725
|
+
async handleDialogOpenChange(isOpen) {
|
|
726
|
+
if (isOpen) {
|
|
742
727
|
this.show();
|
|
728
|
+
this.openChanged.emit(isOpen);
|
|
743
729
|
}
|
|
744
730
|
else {
|
|
745
731
|
this.close();
|
|
732
|
+
this.openChanged.emit(isOpen);
|
|
746
733
|
}
|
|
747
734
|
}
|
|
748
735
|
//#endregion WATCHERS
|
|
@@ -795,7 +782,7 @@ const NvDialog = class {
|
|
|
795
782
|
//#region RENDER
|
|
796
783
|
render() {
|
|
797
784
|
const hasForm = this.form || this.el.querySelector('form');
|
|
798
|
-
return (index.h(index.Host, { key: '
|
|
785
|
+
return (index.h(index.Host, { key: '7ee864d4f6df5a503bff43353a7b32f29fdb285e' }, index.h("slot", { key: 'dc13563074a0339bbd488baf00a74428d6ef4812', name: "trigger" }), index.h("dialog", { key: 'c5781d389cf728469ece1cef977a8370101cf85a', 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: 'bd5b0f19c639a5f9e5767b1a95b9b07870f18df2', class: "content" }, !this.undismissable && (index.h("nv-button", { key: '5163f2027391b0207f4128290f6755f302d90070', class: "close-button", emphasis: "lower", size: "sm", onClick: this.handleDialogClose, "aria-label": "Close dialog" }, index.h("nv-icon", { key: '646d222572ec015bcaf0a957937420f3ca4fb917', name: "x", size: "sm" }))), this.headerElement ? (index.h("slot", { name: "header" })) : (index.h("nv-dialogheader", { id: "dialog-header" })), index.h("div", { key: 'bde55c33725d002ac934b63c079c34024248be52', class: "content-body", id: "dialog-content" }, index.h("slot", { key: '1ff4c4e01282d08d1a99d274483c55e398d14ffd' })), this.footerElement ? (index.h("slot", { name: "footer" })) : (index.h("nv-dialogfooter", { form: this.form, primaryButtonType: hasForm ? constants4faa1fae.ButtonType.Submit : constants4faa1fae.ButtonType.Button, onDialogCanceled: this.handleDialogClose, undismissable: this.undismissable }))))));
|
|
799
786
|
}
|
|
800
787
|
get el() { return index.getElement(this); }
|
|
801
788
|
static get watchers() { return {
|
package/dist/cjs/{nv-dialogfooter_2.entry-CRLL5Dgd.js → nv-dialogfooter_2.entry-BTUrxVzn.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-BtjpbnUr.js');
|
|
4
4
|
var constants4faa1fae = require('./constants-4faa1fae-BzFAKCkR.js');
|
|
5
5
|
require('react');
|
|
6
6
|
|
|
@@ -96,7 +96,7 @@ const NvDialogfooter = class {
|
|
|
96
96
|
};
|
|
97
97
|
NvDialogfooter.style = NvDialogfooterStyle0;
|
|
98
98
|
|
|
99
|
-
const nvDialogheaderCss = "nv-dialogheader{padding:var(--dialog-header-padding-top) var(--dialog-header-padding-x) var(--dialog-header-padding-bottom) var(--dialog-header-padding-x);justify-content:space-between;align-items:flex-start;align-self:stretch}nv-dialogheader .heading{color:var(--color-content-high-text);font-family:\"TT Norms Pro\", sans-serif;font-size:var(--font-size-lg);font-style:normal;font-weight:500;line-height:var(--leading-px-6);letter-spacing:var(--letter-spacing-heading-xs)}nv-dialogheader .subheading{color:var(--color-content-low-text);font-family:\"TT Norms Pro\", sans-serif;font-size:var(--font-size-sm);font-style:normal;font-weight:400;line-height:var(--line-height-sm);}";
|
|
99
|
+
const nvDialogheaderCss = "nv-dialogheader{padding:var(--dialog-header-padding-top) var(--dialog-header-padding-x) var(--dialog-header-padding-bottom) var(--dialog-header-padding-x);justify-content:space-between;align-items:flex-start;align-self:stretch}nv-dialogheader .heading{color:var(--color-content-high-text);font-family:\"TT Norms Pro\", sans-serif;font-size:var(--font-size-lg);font-style:normal;font-weight:500;padding-right:var(--spacing-7);line-height:var(--leading-px-6);letter-spacing:var(--letter-spacing-heading-xs)}nv-dialogheader .subheading{color:var(--color-content-low-text);font-family:\"TT Norms Pro\", sans-serif;font-size:var(--font-size-sm);font-style:normal;font-weight:400;line-height:var(--line-height-sm);}";
|
|
100
100
|
const NvDialogheaderStyle0 = nvDialogheaderCss;
|
|
101
101
|
|
|
102
102
|
const NvDialogheader = class {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-BtjpbnUr.js');
|
|
4
4
|
var inputmaskEdcad3c1 = require('./inputmask-edcad3c1-B9Omti4z.js');
|
|
5
5
|
var v4A79185f4 = require('./v4-a79185f4-2n0dOd_Y.js');
|
|
6
6
|
require('react');
|
|
@@ -49,8 +49,6 @@ const NvFielddate = class {
|
|
|
49
49
|
* The initial value of the input (date in string format).
|
|
50
50
|
* @bind value
|
|
51
51
|
*/
|
|
52
|
-
// eslint-disable-next-line @stencil-community/own-props-must-be-private
|
|
53
|
-
// eslint-disable-next-line @stencil-community/strict-mutable
|
|
54
52
|
this.value = '';
|
|
55
53
|
/**
|
|
56
54
|
* The current value of the input date in string format.
|
|
@@ -122,18 +120,10 @@ const NvFielddate = class {
|
|
|
122
120
|
return;
|
|
123
121
|
}
|
|
124
122
|
this.inputElement.focus();
|
|
125
|
-
// Select the first characters based on the date format
|
|
126
|
-
const format = this.dateFormat;
|
|
127
|
-
if (format.startsWith('DD') || format.startsWith('MM')) {
|
|
128
|
-
this.inputElement.setSelectionRange(0, 2);
|
|
129
|
-
}
|
|
130
|
-
else if (format.startsWith('YYYY')) {
|
|
131
|
-
this.inputElement.setSelectionRange(0, 4);
|
|
132
|
-
}
|
|
133
123
|
};
|
|
134
124
|
/**
|
|
135
125
|
* Handles the input event on the input element.
|
|
136
|
-
* Updates the singleValue and emits the valueChanged event.
|
|
126
|
+
* Updates the singleValue and emits the valueChanged event if empty.
|
|
137
127
|
* @param {Event} event - The input event.
|
|
138
128
|
*/
|
|
139
129
|
this.handleInput = (event) => {
|
|
@@ -142,74 +132,10 @@ const NvFielddate = class {
|
|
|
142
132
|
return;
|
|
143
133
|
}
|
|
144
134
|
const input = event.target;
|
|
145
|
-
const previousValue = this.value;
|
|
146
135
|
this.singleValue = input.value;
|
|
147
136
|
this.value = input.value;
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
this.valueChanged.emit(input.value);
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
/**
|
|
154
|
-
* Initializes the input mask.
|
|
155
|
-
*/
|
|
156
|
-
this.initializeInputMask = () => {
|
|
157
|
-
this.currentPlaceholder = '';
|
|
158
|
-
if (this.inputElement.inputmask) {
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
const inputMask = new inputmaskEdcad3c1.Inputmask({
|
|
162
|
-
alias: 'datetime',
|
|
163
|
-
inputFormat: this.convertToInputmaskFormat(this.dateFormat),
|
|
164
|
-
placeholder: ' ',
|
|
165
|
-
prefillYear: false,
|
|
166
|
-
clearIncomplete: false,
|
|
167
|
-
showMaskOnHover: false,
|
|
168
|
-
showMaskOnFocus: false,
|
|
169
|
-
clearMaskOnLostFocus: false,
|
|
170
|
-
insertMode: true,
|
|
171
|
-
rightAlign: false,
|
|
172
|
-
oncomplete: function (e) {
|
|
173
|
-
const input = e.target;
|
|
174
|
-
const event = new CustomEvent('input', { bubbles: true });
|
|
175
|
-
input.dispatchEvent(event);
|
|
176
|
-
},
|
|
177
|
-
});
|
|
178
|
-
inputMask.mask(this.inputElement);
|
|
179
|
-
// Set the value after applying the mask
|
|
180
|
-
if (this.inputElement.name === this.name && this.singleValue) {
|
|
181
|
-
requestAnimationFrame(() => {
|
|
182
|
-
this.inputElement.value = this.singleValue;
|
|
183
|
-
const event = new CustomEvent('input', { bubbles: true });
|
|
184
|
-
this.inputElement.dispatchEvent(event);
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
/**
|
|
189
|
-
* Handles keydown events on the input before the mask is initialized.
|
|
190
|
-
* Initializes the mask on the first number input.
|
|
191
|
-
* @param {KeyboardEvent} event - The keyboard event.
|
|
192
|
-
*/
|
|
193
|
-
this.handleKeydownBeforeMask = (event) => {
|
|
194
|
-
const allowedKeys = [
|
|
195
|
-
'Backspace',
|
|
196
|
-
'Delete',
|
|
197
|
-
'Tab',
|
|
198
|
-
'ArrowLeft',
|
|
199
|
-
'ArrowRight',
|
|
200
|
-
'ArrowUp',
|
|
201
|
-
'ArrowDown',
|
|
202
|
-
'Home',
|
|
203
|
-
'End',
|
|
204
|
-
];
|
|
205
|
-
if (/\d/.test(event.key)) {
|
|
206
|
-
this.initializeInputMask();
|
|
207
|
-
this.inputElement.removeEventListener('keydown', this.handleKeydownBeforeMask);
|
|
208
|
-
}
|
|
209
|
-
else if (!allowedKeys.includes(event.key) &&
|
|
210
|
-
!event.metaKey &&
|
|
211
|
-
!event.ctrlKey) {
|
|
212
|
-
event.preventDefault();
|
|
137
|
+
if (this.value === '') {
|
|
138
|
+
this.valueChanged.emit('');
|
|
213
139
|
}
|
|
214
140
|
};
|
|
215
141
|
/**
|
|
@@ -222,17 +148,8 @@ const NvFielddate = class {
|
|
|
222
148
|
event.target.blur();
|
|
223
149
|
return;
|
|
224
150
|
}
|
|
225
|
-
if (!this.inputElement.inputmask) {
|
|
226
|
-
this.inputElement.addEventListener('keydown', this.handleKeydownBeforeMask);
|
|
227
|
-
}
|
|
228
151
|
this.open = true;
|
|
229
152
|
};
|
|
230
|
-
/**
|
|
231
|
-
* Handles blur events on the input element.
|
|
232
|
-
*/
|
|
233
|
-
this.handleBlur = () => {
|
|
234
|
-
this.inputElement.removeEventListener('keydown', this.handleKeydownBeforeMask);
|
|
235
|
-
};
|
|
236
153
|
/**
|
|
237
154
|
* Prevents the valueChanged event from the calendar from propagating up.
|
|
238
155
|
* @param {CustomEvent} event - The valueChanged event from nv-calendar.
|
|
@@ -307,6 +224,27 @@ const NvFielddate = class {
|
|
|
307
224
|
// Close the popover if open
|
|
308
225
|
this.open = false;
|
|
309
226
|
}
|
|
227
|
+
updateMask() {
|
|
228
|
+
var _a, _b;
|
|
229
|
+
if (!this.inputElement)
|
|
230
|
+
return;
|
|
231
|
+
(_b = (_a = this.inputElement.inputmask) === null || _a === void 0 ? void 0 : _a.remove) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
232
|
+
const inputMask = new inputmaskEdcad3c1.Inputmask({
|
|
233
|
+
alias: 'datetime',
|
|
234
|
+
inputFormat: this.convertToInputmaskFormat(this.dateFormat),
|
|
235
|
+
placeholder: this.convertToInputmaskFormat(this.dateFormat),
|
|
236
|
+
clearIncomplete: false,
|
|
237
|
+
showMaskOnHover: false,
|
|
238
|
+
showMaskOnFocus: true,
|
|
239
|
+
clearMaskOnLostFocus: !this.open,
|
|
240
|
+
postValidation: true,
|
|
241
|
+
oncomplete: (e) => {
|
|
242
|
+
var _a;
|
|
243
|
+
this.valueChanged.emit((_a = e.target) === null || _a === void 0 ? void 0 : _a.value);
|
|
244
|
+
},
|
|
245
|
+
});
|
|
246
|
+
inputMask.mask(this.inputElement);
|
|
247
|
+
}
|
|
310
248
|
//#endregion METHODS
|
|
311
249
|
/****************************************************************************/
|
|
312
250
|
//#region LIFECYCLE
|
|
@@ -317,10 +255,26 @@ const NvFielddate = class {
|
|
|
317
255
|
if (this.value) {
|
|
318
256
|
this.singleValue = this.value;
|
|
319
257
|
}
|
|
320
|
-
this.currentPlaceholder = this.placeholder || this.dateFormat;
|
|
321
258
|
}
|
|
322
259
|
componentDidLoad() {
|
|
323
|
-
|
|
260
|
+
this.updateMask();
|
|
261
|
+
// Set the initial value after applying the mask
|
|
262
|
+
if (this.inputElement.name === this.name && this.singleValue) {
|
|
263
|
+
requestAnimationFrame(() => {
|
|
264
|
+
this.inputElement.value = this.singleValue;
|
|
265
|
+
const event = new CustomEvent('input', { bubbles: true });
|
|
266
|
+
this.inputElement.dispatchEvent(event);
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
componentDidRender() {
|
|
271
|
+
// Only set value on initial render when there's no existing value in the input
|
|
272
|
+
if (this.singleValue && this.inputElement && !this.inputElement.value) {
|
|
273
|
+
requestAnimationFrame(() => {
|
|
274
|
+
this.inputElement.value = this.singleValue;
|
|
275
|
+
this.inputElement.setAttribute('value', this.singleValue);
|
|
276
|
+
});
|
|
277
|
+
}
|
|
324
278
|
}
|
|
325
279
|
disconnectedCallback() {
|
|
326
280
|
document.removeEventListener('click', this.handleClickOutside);
|
|
@@ -339,6 +293,10 @@ const NvFielddate = class {
|
|
|
339
293
|
const previousValue = this.value;
|
|
340
294
|
this.singleValue = value;
|
|
341
295
|
this.value = value;
|
|
296
|
+
// Set the input value directly when calendar is used
|
|
297
|
+
if (this.inputElement) {
|
|
298
|
+
this.inputElement.value = value;
|
|
299
|
+
}
|
|
342
300
|
// Only emit valueChanged if the value actually changed
|
|
343
301
|
if (previousValue !== value) {
|
|
344
302
|
this.valueChanged.emit(value);
|
|
@@ -367,21 +325,31 @@ const NvFielddate = class {
|
|
|
367
325
|
}
|
|
368
326
|
handleValueChange(newValue) {
|
|
369
327
|
this.singleValue = newValue;
|
|
328
|
+
// Only set input value if it's different from current input value
|
|
329
|
+
// This prevents interfering with user typing
|
|
330
|
+
if (this.inputElement && this.inputElement.value !== newValue) {
|
|
331
|
+
this.inputElement.value = newValue;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
handleOpenChange() {
|
|
335
|
+
this.updateMask();
|
|
370
336
|
}
|
|
371
337
|
//#endregion EVENTS
|
|
372
338
|
/****************************************************************************/
|
|
373
339
|
//#region RENDER
|
|
374
340
|
render() {
|
|
375
|
-
return (index.h(index.Host, { key: '
|
|
376
|
-
this.el.querySelector('[slot="label"]')) && (index.h("label", { key: '
|
|
341
|
+
return (index.h(index.Host, { key: 'e72afd15f69aa6267cc9444e63fae12e4cfcf05b' }, ((this.label && this.label.length > 0) ||
|
|
342
|
+
this.el.querySelector('[slot="label"]')) && (index.h("label", { key: 'bc13c15f74ac4dbe4b326fe479dcd9a6fb20cf40', htmlFor: this.inputId }, index.h("slot", { key: '30ae9788e7768adc9da95e0b89a3f6f7027e625f', name: "label" }, this.label))), index.h("nv-popover", { key: 'e043d7b021d1d7ee206d231a1cfc7b4541091ae5', ref: this.setPopoverRef, id: this.popoverId, triggerMode: "controlled", placement: "bottom-start", open: this.open }, index.h("div", { key: '75682a712a8276bc24b285a48ef2312aae9f5097', slot: "trigger", class: "input-wrapper" }, index.h("slot", { key: '17593b316a870a5edbbc50eb4bb9441759309612', name: "before-input" }), index.h("div", { key: '0eb576fbe4a800ed7e1583810986e5f7f07e175a', class: "input-container", onClick: this.handleInputContainerClick }, index.h("slot", { key: 'c058ea07757486cf69621deba85ebbec3b075779', name: "leading-input" }), index.h("input", { key: '4c31a633358ff96f774a7862507c4c40301062cb', id: this.inputId, ref: this.setInputRef, placeholder: this.placeholder ||
|
|
343
|
+
this.convertToInputmaskFormat(this.dateFormat), name: this.name, disabled: this.disabled, readOnly: this.readonly, required: this.required, autofocus: this.autofocus, onInput: this.handleInput, onFocus: this.handleFocus, "data-scope": "date" }), this.error && (index.h("nv-icon", { key: '036392f177a0c10f609e7b555c3e7f256cd63962', name: "alert-circle", class: "validation", size: "md" })), this.success && (index.h("nv-icon", { key: '5a74ecdd55177d8cda55e8afdb05978e23450346', name: "circle-check", class: "validation", size: "md" })), index.h("nv-iconbutton", { key: 'e07f8b69d1810430cffff071d39ca7c72a15ccaf', class: "toggle-calendar-icon", name: "calendar" //{this.open ? 'chevron-top' : 'chevron-down'}
|
|
377
344
|
,
|
|
378
|
-
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: '
|
|
379
|
-
this.el.querySelector('[slot="description"]')) && (index.h("div", { key: '
|
|
380
|
-
this.el.querySelector('[slot="error-description"]')) && (index.h("div", { key: '
|
|
345
|
+
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: 'a84e382a534735adb22741df1751d9c70c050b69', name: "after-input" })), index.h("div", { key: '29a3ca7ed69a772497590595fc82a78fddf0c32a', slot: "content" }, index.h("nv-calendar", { key: '6797dab38dba23f7396aadcbf5281aefdabd891f', 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) ||
|
|
346
|
+
this.el.querySelector('[slot="description"]')) && (index.h("div", { key: '1799cd4dc4f6ca4b520277c080574af089816a9b', class: "description" }, index.h("slot", { key: 'eb2d9ac73687786e589f5a90791763f4465d1d20', name: "description" }, this.description))), (this.errorDescription ||
|
|
347
|
+
this.el.querySelector('[slot="error-description"]')) && (index.h("div", { key: '7c25fc8369b6bc948d7b233eb5b58451b02cbc62', hidden: !this.error, class: "error-description" }, this.el.querySelector('[slot="error-description"]') ? (index.h("slot", { name: "error-description" })) : (this.errorDescription))), index.h("slot", { key: '1499ea51b0e2d283037bf71aae6da242839c0e49' })));
|
|
381
348
|
}
|
|
382
349
|
get el() { return index.getElement(this); }
|
|
383
350
|
static get watchers() { return {
|
|
384
|
-
"value": ["handleValueChange"]
|
|
351
|
+
"value": ["handleValueChange"],
|
|
352
|
+
"open": ["handleOpenChange"]
|
|
385
353
|
}; }
|
|
386
354
|
};
|
|
387
355
|
NvFielddate.style = NvFielddateStyle0;
|