@nova-design-system/nova-react 3.23.0 → 3.25.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/README.md +1 -0
- package/dist/cjs/dom.utils-CuXVGECR-8VY5SfMZ.js +177 -0
- package/dist/cjs/events.utils-B6GgGra--01N__3wY.js +23 -0
- package/dist/cjs/generated/components.server.js +124 -58
- package/dist/cjs/{grow.animation-CvHGHBL4-DDIEYBK-.js → grow.animation-D7ep_aVl-BuXEDSK-.js} +0 -21
- package/dist/cjs/{i18n.utils-DOZbXX2L-BizoXo6c.js → i18n.utils-IlwlcG9l-ku0bScip.js} +14 -18
- package/dist/cjs/index-DUlunl9a.js +9696 -0
- package/dist/cjs/{nv-dialog.entry-O47Eol_7.js → index.esm-D3eWMME9-CG1TVKfu.js} +1 -296
- package/dist/cjs/index.js +5 -1
- package/dist/cjs/{nv-accordion-item.entry-B_l0-ux0.js → nv-accordion-item.entry-CqnjIt4R.js} +8 -7
- package/dist/cjs/{nv-accordion.entry-BX8_YuZF.js → nv-accordion.entry-Dx7FmGg_.js} +11 -14
- package/dist/cjs/{nv-alert.entry-DCWYR0OK.js → nv-alert.entry-BL3Pdcxd.js} +7 -6
- package/dist/cjs/nv-avatar.entry-2dFR4I9_.js +68 -0
- package/dist/cjs/nv-badge_2.entry-5FShR2Ax.js +218 -0
- package/dist/cjs/nv-breadcrumb.entry-Cfi32bBT.js +49 -0
- package/dist/cjs/nv-breadcrumbs.entry-BSgn3KUO.js +21 -0
- package/dist/cjs/nv-button.entry-BdQQ_LE7.js +166 -0
- package/dist/cjs/{nv-buttongroup.entry-BZaTKN_n.js → nv-buttongroup.entry-BM8CwXFK.js} +13 -7
- package/dist/cjs/{nv-calendar.entry-D9ESuu7C.js → nv-calendar.entry-CeKsMGOa.js} +39 -32
- package/dist/cjs/nv-col.entry-D-h2PGcz.js +38 -0
- package/dist/cjs/{nv-datagrid.entry-DcB5q2oC.js → nv-datagrid.entry-nOBIfqOS.js} +113 -255
- package/dist/cjs/{nv-datagridcolumn.entry-BhKOzXA6.js → nv-datagridcolumn.entry-BAzTU_KM.js} +2 -2
- package/dist/cjs/nv-dialog.entry-Bi2ZVSe2.js +299 -0
- package/dist/cjs/{nv-dialogfooter_2.entry-Dn16bI8a.js → nv-dialogfooter_2.entry-D6lzC-3S.js} +11 -29
- package/dist/cjs/nv-drawer.entry-Dp4AfBiF.js +445 -0
- package/dist/cjs/nv-drawerfooter_2.entry-DpWSsq6d.js +128 -0
- package/dist/cjs/nv-fieldcheckbox.entry-COA3LXnX.js +179 -0
- package/dist/cjs/{nv-fielddate.entry-B4P0U8QG.js → nv-fielddate.entry-B8r5RFXd.js} +20 -21
- package/dist/cjs/{nv-fielddaterange.entry-BORwYJ-k.js → nv-fielddaterange.entry-C6_Kq93P.js} +20 -19
- package/dist/cjs/{nv-fielddropdown.entry-DzBAIynY.js → nv-fielddropdown.entry-B2Dr5zHd.js} +51 -58
- package/dist/cjs/nv-fielddropdownitem.entry-DapivVnR.js +69 -0
- package/dist/cjs/{nv-fieldmultiselect.entry-DiqRreWh.js → nv-fieldmultiselect.entry-DSpQeiPx.js} +45 -49
- package/dist/cjs/nv-fieldnumber.entry-BwxR9sRr.js +189 -0
- package/dist/cjs/nv-fieldpassword.entry-BOSU-Skh.js +167 -0
- package/dist/cjs/nv-fieldradio.entry-ZFafNY5_.js +105 -0
- package/dist/cjs/nv-fieldselect.entry-CfWjQAd9.js +405 -0
- package/dist/cjs/{nv-fieldslider.entry-CozmnUfN.js → nv-fieldslider.entry-dDPcWUxs.js} +34 -16
- package/dist/cjs/nv-fieldtext.entry-Yaa-mkjJ.js +163 -0
- package/dist/cjs/{nv-fieldtextarea.entry-7UrKWDHg.js → nv-fieldtextarea.entry-Dp_l2pKZ.js} +18 -13
- package/dist/cjs/{nv-fieldtime.entry-DakOlLiO.js → nv-fieldtime.entry-CWxi4Uel.js} +38 -40
- package/dist/cjs/{nv-icon.entry-Db00kB2u.js → nv-icon.entry-Dci11W9S.js} +5 -5
- package/dist/cjs/nv-iconbutton_2.entry-A6FKFJT_.js +171 -0
- package/dist/cjs/{nv-menu.entry-CK2HdmBt.js → nv-menu.entry-BHaYP-9M.js} +11 -16
- package/dist/cjs/nv-menuitem.entry-Cm1vvN25.js +59 -0
- package/dist/cjs/nv-notification-bullet.entry-DRlS3Ybc.js +76 -0
- package/dist/cjs/nv-notification.entry-BeDmR-XC.js +176 -0
- package/dist/cjs/nv-notificationcontainer.entry-C3p_87Dg.js +41 -0
- package/dist/cjs/nv-paginationtable.entry-BzEqQOBa.js +231 -0
- package/dist/cjs/{nv-popover.entry-mLdLSp6n.js → nv-popover.entry-D2oFn9vL.js} +118 -46
- package/dist/cjs/nv-row.entry-hV1kxmrr.js +22 -0
- package/dist/cjs/{nv-sidebar.entry-inDVNJ4s.js → nv-sidebar.entry-BJrqJ8K7.js} +12 -8
- package/dist/cjs/nv-sidebarcontent.entry-CPfGF7nx.js +22 -0
- package/dist/cjs/{nv-sidebardivider.entry-D_yern0R.js → nv-sidebardivider.entry-D2wmzHCO.js} +4 -4
- package/dist/cjs/{nv-sidebarfooter.entry-Rkkn9TB_.js → nv-sidebarfooter.entry-C7fqCzjH.js} +4 -4
- package/dist/cjs/nv-sidebargroup.entry-qkXnxhs_.js +23 -0
- package/dist/cjs/{nv-sidebarheader.entry-CYpD_4pI.js → nv-sidebarheader.entry-DBsOmyQ0.js} +4 -4
- package/dist/cjs/{nv-sidebarlogo.entry-BgK03M1v.js → nv-sidebarlogo.entry-902Ht3UR.js} +4 -4
- package/dist/cjs/{nv-sidebarnavitem.entry-DglvcCOD.js → nv-sidebarnavitem.entry-CICrllp8.js} +11 -10
- package/dist/cjs/nv-sidebarnavsubitem.entry-Q9jjU_7D.js +35 -0
- package/dist/cjs/{nv-split.entry-mzg2F66T.js → nv-split.entry-BYIsE2wp.js} +51 -45
- package/dist/cjs/nv-stack.entry-DgE5ASGH.js +31 -0
- package/dist/cjs/{nv-table.entry-DkbNgxtI.js → nv-table.entry-DHXBu2n1.js} +9 -11
- package/dist/cjs/{nv-tableheader.entry-CRVFTQA-.js → nv-tableheader.entry-BijgOxcO.js} +5 -5
- package/dist/cjs/nv-toggle.entry-CMI1WdvV.js +82 -0
- package/dist/cjs/nv-togglebutton.entry-DAPETEmF.js +66 -0
- package/dist/cjs/{nv-togglebuttongroup.entry-BYXX5ejg.js → nv-togglebuttongroup.entry-CzDI1XCr.js} +14 -11
- package/dist/cjs/nv-tooltip.entry-DPoUP9iL.js +56 -0
- package/dist/cjs/slide.animation-CmH5d1of-BZuw607U.js +90 -0
- package/dist/components/NvDatatable/NvDatatable.js +69 -32
- package/dist/generated/components.js +38 -0
- package/dist/generated/components.server.js +120 -58
- package/dist/types/components/NvDatatable/NvDatatable.d.ts +1 -1
- package/dist/types/components/NvDatatable/types.d.ts +13 -3
- package/dist/types/generated/components.d.ts +63 -43
- package/dist/types/generated/components.server.d.ts +63 -43
- package/package.json +2 -2
- package/dist/cjs/index-CtjeeUI-.js +0 -39617
- package/dist/cjs/nv-avatar.entry-C_xZD3Lp.js +0 -68
- package/dist/cjs/nv-badge_2.entry-JjqANStV.js +0 -213
- package/dist/cjs/nv-breadcrumb.entry-DQZDn6cm.js +0 -46
- package/dist/cjs/nv-breadcrumbs.entry-Bz0GjhY_.js +0 -21
- package/dist/cjs/nv-button.entry-Br1DH9Vj.js +0 -164
- package/dist/cjs/nv-col.entry-CfgPMMxS.js +0 -38
- package/dist/cjs/nv-fieldcheckbox.entry-Bx6ArV_b.js +0 -177
- package/dist/cjs/nv-fielddropdownitem.entry-C_17isWd.js +0 -73
- package/dist/cjs/nv-fieldnumber.entry-C9O4UPp3.js +0 -187
- package/dist/cjs/nv-fieldpassword.entry-BfVJNT0A.js +0 -165
- package/dist/cjs/nv-fieldradio.entry-CG22oETM.js +0 -103
- package/dist/cjs/nv-fieldselect.entry-BPQEtrv2.js +0 -397
- package/dist/cjs/nv-fieldtext.entry-BD-z01ru.js +0 -163
- package/dist/cjs/nv-iconbutton_2.entry-CaKCa8NT.js +0 -168
- package/dist/cjs/nv-menuitem.entry-mKMqCAdz.js +0 -60
- package/dist/cjs/nv-notification-bullet.entry-DtbjtFxs.js +0 -77
- package/dist/cjs/nv-notification.entry-CLb0gNu3.js +0 -262
- package/dist/cjs/nv-notificationcontainer.entry-Cijivlm6.js +0 -41
- package/dist/cjs/nv-row.entry-C2C94fcv.js +0 -22
- package/dist/cjs/nv-sidebarcontent.entry-DxoljE15.js +0 -22
- package/dist/cjs/nv-sidebargroup.entry-C1p9qqxr.js +0 -23
- package/dist/cjs/nv-sidebarnavsubitem.entry-Dt1jKmC-.js +0 -35
- package/dist/cjs/nv-stack.entry-nnvjTrBy.js +0 -31
- package/dist/cjs/nv-toggle.entry-oC9TVkr1.js +0 -80
- package/dist/cjs/nv-togglebutton.entry-BTWCzbS9.js +0 -67
- package/dist/cjs/nv-tooltip.entry-OJGxfJEh.js +0 -55
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-DUlunl9a.js');
|
|
4
|
+
var index_esmD3eWMME9 = require('./index.esm-D3eWMME9-CG1TVKfu.js');
|
|
5
|
+
var events_utilsB6GgGra_ = require('./events.utils-B6GgGra--01N__3wY.js');
|
|
6
|
+
var fade_animationDcRL9lcm = require('./fade.animation-DcRL9lcm-DAZeHoKN.js');
|
|
7
|
+
var grow_animationD7ep_aVl = require('./grow.animation-D7ep_aVl-BuXEDSK-.js');
|
|
8
|
+
require('./style-value-types.es-xlgmw4x8-B1vLqX9m.js');
|
|
9
|
+
var timeline_animationCgHCo_Ho = require('./timeline.animation-CgHCo_Ho-KteJaZPb.js');
|
|
10
|
+
var clsxChV9xqsO = require('./clsx-ChV9xqsO-BtxeOLZW.js');
|
|
11
|
+
var constantsBReL3Lsa = require('./constants-BReL3Lsa-DpB_ghPF.js');
|
|
12
|
+
var v4BdYh22OP = require('./v4-BdYh22OP-C1vaJ4yP.js');
|
|
13
|
+
require('@stencil/react-output-target/runtime');
|
|
14
|
+
require('react');
|
|
15
|
+
require('react-dom');
|
|
16
|
+
|
|
17
|
+
const nvDialogCss = () => `nv-dialog dialog{width:100vw;height:100svh;margin:0;max-height:unset;max-width:unset;padding:0;background:color-mix(in srgb, var(--components-overlay-background) 70%, transparent);backdrop-filter:blur(4px)}nv-dialog dialog.full .content{min-width:90vw;width:90vw;max-width:90vw}nv-dialog .backdrop{display:flex;min-height:100%;padding:var(--spacing-3);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)}nv-dialog .backdrop .content{border-radius:var(--radius-rounded-2xl);background:var(--color-level-00-background);min-width:min(90vw, 400px);width:fit-content;max-width:clamp(90vw, min(90vw, 960px), 960px);margin:auto;display:flex;flex-direction:column;align-items:flex-start;height:fit-content;position:relative}nv-dialog .backdrop .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}nv-dialog .backdrop .content .content-body::-webkit-scrollbar{width:6px;height:6px}nv-dialog .backdrop .content .content-body::-webkit-scrollbar-track{background-color:var(--color-level-10-background);border-radius:9999px}nv-dialog .backdrop .content .content-body::-webkit-scrollbar-thumb{background-color:var(--color-gray-200);border-radius:9999px}nv-dialog .backdrop .content .content-body{box-sizing:border-box;padding:var(--dialog-body-padding-y) var(--dialog-body-padding-x);scrollbar-gutter:stable both-edges;font-family:var(--font-family-default), var(--font-family-fallback), sans-serif;font-size:var(--font-size-md);font-style:normal;font-weight:var(--font-weight-low-emphasis);line-height:var(--line-height-base);color:var(--color-content-medium-text);width:100%}`;
|
|
18
|
+
|
|
19
|
+
const NvDialog = class {
|
|
20
|
+
constructor(hostRef) {
|
|
21
|
+
index.registerInstance(this, hostRef);
|
|
22
|
+
this.openChanged = index.createEvent(this, "openChanged", 3);
|
|
23
|
+
this.eventsAttached = false;
|
|
24
|
+
this.triggerClickEvents = [
|
|
25
|
+
['click', this.show],
|
|
26
|
+
[
|
|
27
|
+
'keydown',
|
|
28
|
+
(e) => {
|
|
29
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
30
|
+
e.preventDefault();
|
|
31
|
+
this.show();
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
];
|
|
36
|
+
/**
|
|
37
|
+
* Use this prop to toggle the visibility of the dialog. Set to true to show
|
|
38
|
+
* the dialog and false to hide it.
|
|
39
|
+
*/
|
|
40
|
+
this.open = false;
|
|
41
|
+
/**
|
|
42
|
+
* If true, the dialog cannot be closed by the user.
|
|
43
|
+
*/
|
|
44
|
+
this.undismissable = false;
|
|
45
|
+
/**
|
|
46
|
+
* If true, the dialog will be closed when the backdrop is clicked.
|
|
47
|
+
*/
|
|
48
|
+
this.clickOutside = false;
|
|
49
|
+
/**
|
|
50
|
+
* If true, the dialog visibility is managed manually through methods or the
|
|
51
|
+
* open prop.
|
|
52
|
+
*/
|
|
53
|
+
this.controlled = false;
|
|
54
|
+
/**
|
|
55
|
+
* If true, the dialog takes full width styling.
|
|
56
|
+
*/
|
|
57
|
+
this.full = false;
|
|
58
|
+
/**
|
|
59
|
+
* Controls whether the dialog should automatically focus the first focusable
|
|
60
|
+
* element when opened. When disabled, prevents unwanted tooltip triggers on
|
|
61
|
+
* dialog open.
|
|
62
|
+
*/
|
|
63
|
+
this.autofocus = false;
|
|
64
|
+
/**
|
|
65
|
+
* Checks for and sets up form ID if a form is present
|
|
66
|
+
*/
|
|
67
|
+
this.checkForForm = () => {
|
|
68
|
+
if (!this.form) {
|
|
69
|
+
const formElement = this.el.querySelector('form');
|
|
70
|
+
if (formElement) {
|
|
71
|
+
this.form = this.ensureFormId(formElement);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Handles the native dialog close event.
|
|
77
|
+
*/
|
|
78
|
+
this.handleDialogClose = () => {
|
|
79
|
+
if (this.open) {
|
|
80
|
+
this.close();
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Handles the click event to close the dialog when clickOutside is true.
|
|
85
|
+
* @param {MouseEvent} event - The click event.
|
|
86
|
+
*/
|
|
87
|
+
this.handleDialogClick = (event) => {
|
|
88
|
+
if (!this.clickOutside || this.undismissable)
|
|
89
|
+
return;
|
|
90
|
+
if (this.checkForOpenPopovers())
|
|
91
|
+
return;
|
|
92
|
+
if (event.target === this.backdropElement) {
|
|
93
|
+
this.close();
|
|
94
|
+
event.preventDefault();
|
|
95
|
+
event.stopPropagation();
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
this.checkForOpenPopovers = () => {
|
|
99
|
+
let hasOpenPopover = false;
|
|
100
|
+
this.el.querySelectorAll('nv-popover').forEach(popover => {
|
|
101
|
+
if (popover.hasAttribute('open')) {
|
|
102
|
+
hasOpenPopover = true;
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
return hasOpenPopover;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
//#endregion PROPERTIES
|
|
109
|
+
/****************************************************************************/
|
|
110
|
+
//#region METHODS
|
|
111
|
+
/**
|
|
112
|
+
* Call this method to show the dialog, making it visible on the screen.
|
|
113
|
+
*/
|
|
114
|
+
async show() {
|
|
115
|
+
this.open = true;
|
|
116
|
+
this.preventScroll();
|
|
117
|
+
/** It is recommended to use the .show() or .showModal() method to render
|
|
118
|
+
* dialogs, rather than the open attribute. If a <dialog> is opened using
|
|
119
|
+
* the open attribute, it is non-modal. */
|
|
120
|
+
const { setFadeOut } = fade_animationDcRL9lcm.useFade(this.dialogElement);
|
|
121
|
+
setFadeOut();
|
|
122
|
+
this.dialogElement.showModal();
|
|
123
|
+
const { setGrowIn, growIn } = grow_animationD7ep_aVl.useGrow(this.contentElement, {
|
|
124
|
+
duration: 100,
|
|
125
|
+
amount: 0.9,
|
|
126
|
+
});
|
|
127
|
+
const { fadeIn } = fade_animationDcRL9lcm.useFade(this.dialogElement, {
|
|
128
|
+
duration: 100,
|
|
129
|
+
});
|
|
130
|
+
setGrowIn();
|
|
131
|
+
await timeline_animationCgHCo_Ho.parallel(fadeIn, growIn).start();
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Call this method to hide the dialog, making it disappear from view.
|
|
135
|
+
*/
|
|
136
|
+
async close() {
|
|
137
|
+
this.open = false;
|
|
138
|
+
this.allowScroll();
|
|
139
|
+
const { growOut } = grow_animationD7ep_aVl.useGrow(this.contentElement, {
|
|
140
|
+
duration: 150,
|
|
141
|
+
amount: 0.85,
|
|
142
|
+
});
|
|
143
|
+
const { fadeOut } = fade_animationDcRL9lcm.useFade(this.dialogElement, {
|
|
144
|
+
duration: 150,
|
|
145
|
+
});
|
|
146
|
+
await timeline_animationCgHCo_Ho.parallel(growOut, fadeOut).start();
|
|
147
|
+
this.dialogElement.close();
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Sets the autofocus on the first focusable element in the dialog.
|
|
151
|
+
*/
|
|
152
|
+
setAutofocus() {
|
|
153
|
+
const focusableElements = index_esmD3eWMME9.tabbable(this.dialogElement, {
|
|
154
|
+
displayCheck: 'none',
|
|
155
|
+
});
|
|
156
|
+
if (focusableElements.length > 0) {
|
|
157
|
+
// Convert to array and find element with smallest top and left position
|
|
158
|
+
let topLeftElement = focusableElements[0];
|
|
159
|
+
let topLeftRect = topLeftElement.getBoundingClientRect();
|
|
160
|
+
focusableElements.forEach(element => {
|
|
161
|
+
const rect = element.getBoundingClientRect();
|
|
162
|
+
if (rect.top < topLeftRect.top || rect.left < topLeftRect.left) {
|
|
163
|
+
topLeftElement = element;
|
|
164
|
+
topLeftRect = rect;
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
// Set autofocus attribute on the found element
|
|
168
|
+
topLeftElement.setAttribute('autofocus', 'true');
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Attaches event listeners to the dialog.
|
|
173
|
+
*/
|
|
174
|
+
attachEventListeners() {
|
|
175
|
+
if (this.triggerElement && !this.eventsAttached && !this.controlled) {
|
|
176
|
+
events_utilsB6GgGra_.addEventListeners(this.triggerClickEvents, this.triggerElement, this);
|
|
177
|
+
this.eventsAttached = true;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Prevents the body from scrolling when the dialog is open.
|
|
182
|
+
* Compensates for scrollbar width to prevent layout shift.
|
|
183
|
+
*/
|
|
184
|
+
preventScroll() {
|
|
185
|
+
// Calculate scrollbar width
|
|
186
|
+
const scrollBarWidth = window.innerWidth - document.documentElement.clientWidth;
|
|
187
|
+
// Apply overflow hidden and padding compensation
|
|
188
|
+
document.documentElement.style.overflow = 'hidden';
|
|
189
|
+
document.documentElement.style.paddingRight = `${scrollBarWidth}px`;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Allows the body to scroll when the dialog is closed.
|
|
193
|
+
* Removes the applied overflow and padding styles.
|
|
194
|
+
*/
|
|
195
|
+
allowScroll() {
|
|
196
|
+
// Remove the applied styles
|
|
197
|
+
document.documentElement.style.removeProperty('overflow');
|
|
198
|
+
document.documentElement.style.removeProperty('padding-right');
|
|
199
|
+
}
|
|
200
|
+
ensureFormId(formElement) {
|
|
201
|
+
if (!formElement.id) {
|
|
202
|
+
formElement.id = `dialog-form-${v4BdYh22OP.v4()}`;
|
|
203
|
+
}
|
|
204
|
+
return formElement.id;
|
|
205
|
+
}
|
|
206
|
+
//#endregion EVENTS
|
|
207
|
+
/****************************************************************************/
|
|
208
|
+
//#region WATCHERS
|
|
209
|
+
async handleDialogOpenChange(isOpen) {
|
|
210
|
+
if (isOpen) {
|
|
211
|
+
this.show();
|
|
212
|
+
this.openChanged.emit(isOpen);
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
this.close();
|
|
216
|
+
this.openChanged.emit(isOpen);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
//#endregion WATCHERS
|
|
220
|
+
/****************************************************************************/
|
|
221
|
+
//#region LISTENERS
|
|
222
|
+
/**
|
|
223
|
+
* Handles the keydown event to optionally prevent the native dialog from closing when the escape key is pressed.
|
|
224
|
+
* @param {KeyboardEvent} event - The keydown event.
|
|
225
|
+
*/
|
|
226
|
+
handleKeyDown(event) {
|
|
227
|
+
if (event.key !== 'Escape')
|
|
228
|
+
return;
|
|
229
|
+
if (!this.open)
|
|
230
|
+
return;
|
|
231
|
+
event.preventDefault();
|
|
232
|
+
event.stopPropagation();
|
|
233
|
+
const hasOpenPopover = this.checkForOpenPopovers();
|
|
234
|
+
if (!this.undismissable && !hasOpenPopover) {
|
|
235
|
+
event.preventDefault();
|
|
236
|
+
event.stopPropagation();
|
|
237
|
+
this.close();
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
//#endregion LISTENERS
|
|
241
|
+
/****************************************************************************/
|
|
242
|
+
//#region LIFECYCLE
|
|
243
|
+
/**
|
|
244
|
+
* Lifecycle method that runs before the component loads.
|
|
245
|
+
* Looks for passed header, and footer elements, either by their slot
|
|
246
|
+
* attribute or by their tag name (for dialog header/footer)
|
|
247
|
+
*/
|
|
248
|
+
componentWillLoad() {
|
|
249
|
+
if (!this.headerElement)
|
|
250
|
+
this.headerElement =
|
|
251
|
+
this.el.querySelector('[slot="header"]') ??
|
|
252
|
+
this.el.querySelector('nv-dialogheader');
|
|
253
|
+
if (!this.footerElement)
|
|
254
|
+
this.footerElement =
|
|
255
|
+
this.el.querySelector('[slot="footer"]') ??
|
|
256
|
+
this.el.querySelector('nv-dialogfooter');
|
|
257
|
+
// Initial form check
|
|
258
|
+
this.checkForForm();
|
|
259
|
+
}
|
|
260
|
+
componentDidRender() {
|
|
261
|
+
this.triggerElement = this.el.querySelector('[slot="trigger"]');
|
|
262
|
+
this.attachEventListeners();
|
|
263
|
+
}
|
|
264
|
+
componentDidLoad() {
|
|
265
|
+
if (this.open) {
|
|
266
|
+
this.show();
|
|
267
|
+
}
|
|
268
|
+
// Only set autofocus if the prop is true and no element already has autofocus
|
|
269
|
+
if (this.autofocus && !this.dialogElement.querySelector('[autofocus]')) {
|
|
270
|
+
this.setAutofocus();
|
|
271
|
+
}
|
|
272
|
+
// Additional form check in case form was added after initial load
|
|
273
|
+
this.checkForForm();
|
|
274
|
+
// this.setupContentBodyListeners();
|
|
275
|
+
}
|
|
276
|
+
disconnectedCallback() {
|
|
277
|
+
if (this.triggerElement && !this.eventsAttached && !this.controlled) {
|
|
278
|
+
events_utilsB6GgGra_.removeEventListeners(this.triggerClickEvents, this.triggerElement, this);
|
|
279
|
+
this.eventsAttached = false;
|
|
280
|
+
}
|
|
281
|
+
this.allowScroll();
|
|
282
|
+
}
|
|
283
|
+
//#endregion LIFECYCLE
|
|
284
|
+
/****************************************************************************/
|
|
285
|
+
//#region RENDER
|
|
286
|
+
render() {
|
|
287
|
+
const hasForm = this.form || this.el.querySelector('form');
|
|
288
|
+
return (index.h(index.Host, { key: '3117cc6be5dfcdb0fd561bb7b8cc0179233adca5' }, index.h("slot", { key: '3462bbebcb37fe65ef192b47562ee554263d8e3d', name: "trigger" }), index.h("dialog", { key: '2baee57bc9924ac6a7f0e5511228877283c67b7e', ref: el => (this.dialogElement = el), onClose: this.handleDialogClose, onClick: this.handleDialogClick, role: "dialog", "aria-modal": "true", "aria-labelledby": "dialog-header", "aria-describedby": "dialog-content", class: clsxChV9xqsO.clsx({ full: this.full }) }, index.h("div", { key: '6083efe9e58d402c6df91f57bf45ca2ea77acb3b', class: "backdrop", ref: el => (this.backdropElement = el) }, index.h("div", { key: 'e133552c05d709d9fb95ca97d4fae1fbba135585', class: "content", ref: el => (this.contentElement = el) }, !this.undismissable && (index.h("nv-button", { key: '81830f0546f280cf2401f765252fee0a464fca2e', class: "close-button", emphasis: "lower", size: "sm", onClick: this.handleDialogClose, "aria-label": "Close dialog" }, index.h("nv-icon", { key: '95a5eff054aad7385c440c1c1833d994b21c0583', name: "x", size: "sm" }))), this.headerElement ? (index.h("slot", { name: "header" })) : (index.h("nv-dialogheader", { id: "dialog-header" })), index.h("div", { key: '8ec787b70862976f09f8bbaa2f2acbd743abd9c5', class: "content-body", id: "dialog-content" }, index.h("slot", { key: '6939345af1fa362fe9575948f099cf19dee54590' })), this.footerElement ? (index.h("slot", { name: "footer" })) : (index.h("nv-dialogfooter", { form: this.form, primaryButtonType: hasForm ? constantsBReL3Lsa.ButtonType.Submit : constantsBReL3Lsa.ButtonType.Button, onDialogCanceled: this.handleDialogClose, undismissable: this.undismissable })))))));
|
|
289
|
+
}
|
|
290
|
+
get el() { return index.getElement(this); }
|
|
291
|
+
static get watchers() { return {
|
|
292
|
+
"open": [{
|
|
293
|
+
"handleDialogOpenChange": 0
|
|
294
|
+
}]
|
|
295
|
+
}; }
|
|
296
|
+
};
|
|
297
|
+
NvDialog.style = nvDialogCss();
|
|
298
|
+
|
|
299
|
+
exports.nv_dialog = NvDialog;
|
package/dist/cjs/{nv-dialogfooter_2.entry-Dn16bI8a.js → nv-dialogfooter_2.entry-D6lzC-3S.js}
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-DUlunl9a.js');
|
|
4
4
|
var constantsBReL3Lsa = require('./constants-BReL3Lsa-DpB_ghPF.js');
|
|
5
5
|
require('@stencil/react-output-target/runtime');
|
|
6
6
|
require('react');
|
|
7
7
|
require('react-dom');
|
|
8
8
|
|
|
9
|
-
const nvDialogfooterCss =
|
|
9
|
+
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}`;
|
|
10
10
|
|
|
11
11
|
const NvDialogfooter = class {
|
|
12
12
|
constructor(hostRef) {
|
|
@@ -20,7 +20,6 @@ const NvDialogfooter = class {
|
|
|
20
20
|
this.internals = hostRef.$hostElement$.attachInternals();
|
|
21
21
|
hostRef.$hostElement$["s-ei"] = this.internals;
|
|
22
22
|
}
|
|
23
|
-
this.hasSlot = false;
|
|
24
23
|
/****************************************************************************/
|
|
25
24
|
//#region PROPERTIES
|
|
26
25
|
/**
|
|
@@ -75,37 +74,30 @@ const NvDialogfooter = class {
|
|
|
75
74
|
//#endregion METHODS
|
|
76
75
|
/****************************************************************************/
|
|
77
76
|
//#region LIFECYCLE
|
|
78
|
-
|
|
79
|
-
// Check if there are any child elements that don't have a slot attribute
|
|
80
|
-
this.hasSlot = Array.from(this.el.childNodes).some(node => {
|
|
81
|
-
return (node.nodeType === Node.ELEMENT_NODE &&
|
|
82
|
-
!node.hasAttribute('slot'));
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
componentDidLoad() {
|
|
77
|
+
componentDidRender() {
|
|
86
78
|
// Set the default button type based on the form property
|
|
87
|
-
this.primaryButtonType
|
|
88
|
-
this.
|
|
79
|
+
if (!this.primaryButtonType) {
|
|
80
|
+
this.primaryButtonRef.type = this.form
|
|
89
81
|
? constantsBReL3Lsa.ButtonType.Submit
|
|
90
82
|
: constantsBReL3Lsa.ButtonType.Button;
|
|
83
|
+
}
|
|
91
84
|
}
|
|
92
85
|
//#endregion LIFECYCLE
|
|
93
86
|
/****************************************************************************/
|
|
94
87
|
//#region RENDER
|
|
95
88
|
render() {
|
|
96
|
-
return (index.h(index.Host, { key: '
|
|
89
|
+
return (index.h(index.Host, { key: '31d3490d2a966b28d3f23bf7409186c10463f765' }, index.h("slot", { key: '21c8a3431ad6ec95d7d8467d3a273f730a10984b' }, index.h(index.Fragment, { key: '6400d911813010cc012d1b982f5ebdcb9f589b87' }, !this.undismissable && (index.h("nv-button", { key: '29d8b79619aa6a225b3fe9eb123e166646cb910b', onClick: this.handleCancel, emphasis: "low", size: "sm" }, this.cancelLabel)), index.h("nv-button", { key: '76cd9d05c3830a7d9d8bd040aa4ecb38da190644', ref: el => (this.primaryButtonRef = el), onClick: this.handlePrimary, disabled: this.disabled, danger: this.danger, size: "sm", emphasis: "high", form: this.form, type: this.primaryButtonType }, this.leadingIcon && (index.h("nv-icon", { key: '5ff1d8988d480dff0c12be00962a0470ef8adccf', slot: "leading-icon", name: this.leadingIcon, size: "sm" })), this.primaryLabel, this.trailingIcon && (index.h("nv-icon", { key: 'b1330826bcc205529a301378685ff72d7d3c53f6', slot: "trailing-icon", name: this.trailingIcon, size: "sm" })))))));
|
|
97
90
|
}
|
|
98
91
|
static get formAssociated() { return true; }
|
|
99
92
|
get el() { return index.getElement(this); }
|
|
100
93
|
};
|
|
101
|
-
NvDialogfooter.style = nvDialogfooterCss;
|
|
94
|
+
NvDialogfooter.style = nvDialogfooterCss();
|
|
102
95
|
|
|
103
|
-
const nvDialogheaderCss =
|
|
96
|
+
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:var(--font-family-default), var(--font-family-fallback), sans-serif;font-size:var(--font-size-lg);font-style:normal;font-weight:var(--font-weight-medium-emphasis);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:var(--font-family-default), var(--font-family-fallback), sans-serif;font-size:var(--font-size-sm);font-style:normal;font-weight:var(--font-weight-low-emphasis);line-height:var(--line-height-sm);}`;
|
|
104
97
|
|
|
105
98
|
const NvDialogheader = class {
|
|
106
99
|
constructor(hostRef) {
|
|
107
100
|
index.registerInstance(this, hostRef);
|
|
108
|
-
this.hasSlot = false;
|
|
109
101
|
/****************************************************************************/
|
|
110
102
|
//#region PROPERTIES
|
|
111
103
|
/**
|
|
@@ -115,23 +107,13 @@ const NvDialogheader = class {
|
|
|
115
107
|
}
|
|
116
108
|
//#endregion PROPERTIES
|
|
117
109
|
/****************************************************************************/
|
|
118
|
-
//#region LIFECYCLE
|
|
119
|
-
componentWillLoad() {
|
|
120
|
-
// Check if there are any child elements that don't have a slot attribute
|
|
121
|
-
this.hasSlot = Array.from(this.el.childNodes).some(node => {
|
|
122
|
-
return (node.nodeType === Node.ELEMENT_NODE &&
|
|
123
|
-
!node.hasAttribute('slot'));
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
//#endregion LIFECYCLE
|
|
127
|
-
/****************************************************************************/
|
|
128
110
|
//#region RENDER
|
|
129
111
|
render() {
|
|
130
|
-
return (index.h(index.Host, { key: '
|
|
112
|
+
return (index.h(index.Host, { key: 'a608cbe8b942b1444d973a5f3d8c97183e76fd0a' }, index.h("slot", { key: '525dd320304a01682926208674db6210e4e2dd2a' }, index.h(index.Fragment, { key: '14f7f8e787941dbf2d9e00f8a8a5d2e25d82d056' }, index.h("div", { key: '00131448954f8390e145e458c71705850b19ec48', class: "heading" }, this.heading), index.h("div", { key: '8cd3ee3d6aacb5f54499ea59b9e915efe4c5e33c', class: "subheading" }, this.subheading)))));
|
|
131
113
|
}
|
|
132
114
|
get el() { return index.getElement(this); }
|
|
133
115
|
};
|
|
134
|
-
NvDialogheader.style = nvDialogheaderCss;
|
|
116
|
+
NvDialogheader.style = nvDialogheaderCss();
|
|
135
117
|
|
|
136
118
|
exports.nv_dialogfooter = NvDialogfooter;
|
|
137
119
|
exports.nv_dialogheader = NvDialogheader;
|