@nova-design-system/nova-react 3.29.0 → 3.31.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-BReL3Lsa-DpB_ghPF.js → constants-gOKBmbgZ-CSoZ8z-G.js} +5 -0
- package/dist/cjs/generated/components.server.js +35 -1
- package/dist/cjs/index-BRxlcrvE.js +10395 -0
- package/dist/cjs/index.js +7 -1
- package/dist/cjs/{nv-accordion-item.entry-D1o0gC5w.js → nv-accordion-item.entry-DWi_bEQx.js} +3 -3
- package/dist/cjs/{nv-accordion.entry-DYJtq9Az.js → nv-accordion.entry-Bgn2CRYE.js} +2 -2
- package/dist/cjs/{nv-alert.entry-CMtCdHmk.js → nv-alert.entry-tkzdxYo4.js} +8 -8
- package/dist/cjs/{nv-avatar.entry-B6e7aG4W.js → nv-avatar.entry-C6xqQhws.js} +8 -8
- package/dist/cjs/{nv-badge_2.entry-RD3j0bJM.js → nv-badge_2.entry-poMKx9km.js} +5 -5
- package/dist/cjs/{nv-breadcrumb.entry-DgpqY2fr.js → nv-breadcrumb.entry-BTBUN3X8.js} +2 -2
- package/dist/cjs/{nv-breadcrumbs.entry-CZgcDUw5.js → nv-breadcrumbs.entry-DXdb_Gzf.js} +2 -2
- package/dist/cjs/{nv-button.entry-DR9NaRxG.js → nv-button.entry-IYrV4dVV.js} +7 -7
- package/dist/cjs/{nv-buttongroup.entry-qO8r7WqG.js → nv-buttongroup.entry-DpMhGqzQ.js} +2 -2
- package/dist/cjs/{nv-calendar.entry-DRlv3Xph.js → nv-calendar.entry-Clp-qYdU.js} +9 -9
- package/dist/cjs/{nv-col.entry-B7utJttP.js → nv-col.entry-BgIpEdn6.js} +2 -2
- package/dist/cjs/{nv-datagrid.entry-digYmlnA.js → nv-datagrid.entry-CmnSlQEN.js} +8 -8
- package/dist/cjs/{nv-datagridcolumn.entry-UwaDi-Hr.js → nv-datagridcolumn.entry-CfaOqHSs.js} +2 -2
- package/dist/cjs/{nv-datetest.entry-BJtWaM2T.js → nv-datetest.entry-DL0WPAUH.js} +2 -2
- package/dist/cjs/{nv-datetimetest.entry-WaNPcHxh.js → nv-datetimetest.entry-DoABznI1.js} +1 -1
- package/dist/cjs/{nv-dialog.entry-BI_mFT2G.js → nv-dialog.entry-C95UrJIU.js} +3 -3
- package/dist/cjs/{nv-dialogfooter_2.entry-DU2ClBUR.js → nv-dialogfooter_2.entry-Ccml86Uw.js} +6 -6
- package/dist/cjs/{nv-drawer.entry-BKF4CyOt.js → nv-drawer.entry-cXCjYVTV.js} +3 -3
- package/dist/cjs/{nv-drawerfooter_2.entry-BSyUs7_4.js → nv-drawerfooter_2.entry-Dq0IblnH.js} +6 -6
- package/dist/cjs/{nv-fieldcheckbox.entry-l5FWToQi.js → nv-fieldcheckbox.entry-CnP54xin.js} +5 -5
- package/dist/cjs/{nv-fielddate.entry-BfviesNp.js → nv-fielddate.entry-DZY75-mm.js} +7 -7
- package/dist/cjs/{nv-fielddaterange.entry-BvDkPLXG.js → nv-fielddaterange.entry-DkouN3iA.js} +7 -7
- package/dist/cjs/{nv-fielddropdown.entry-B-nYjuMt.js → nv-fielddropdown.entry-Bc3bobvr.js} +101 -23
- package/dist/cjs/{nv-fielddropdownitem.entry-Dxqyb9DN.js → nv-fielddropdownitem.entry-CmdskK1s.js} +2 -2
- package/dist/cjs/{nv-fieldmultiselect.entry-CgO1RP0W.js → nv-fieldmultiselect.entry-Bc6YFUA_.js} +1 -1
- package/dist/cjs/{nv-fieldnumber.entry-stgdLi7x.js → nv-fieldnumber.entry-DwvjJfV9.js} +5 -5
- package/dist/cjs/{nv-fieldpassword.entry-CHA3JAUd.js → nv-fieldpassword.entry-CUI2Jm-V.js} +5 -5
- package/dist/cjs/{nv-fieldradio.entry-DHavVjB-.js → nv-fieldradio.entry-CnLCvLBh.js} +4 -4
- package/dist/cjs/{nv-fieldselect.entry-Dq5AsOFt.js → nv-fieldselect.entry-DunLjNwe.js} +45 -7
- package/dist/cjs/{nv-fieldslider.entry-SlF3BBUW.js → nv-fieldslider.entry-Cp-6fToR.js} +4 -4
- package/dist/cjs/{nv-fieldtext.entry-BYCc8SyD.js → nv-fieldtext.entry-FJk12WoX.js} +5 -5
- package/dist/cjs/{nv-fieldtextarea.entry-96JCOb9L.js → nv-fieldtextarea.entry-Ci9B5-DX.js} +4 -4
- package/dist/cjs/{nv-fieldtime.entry-BdzjxkaK.js → nv-fieldtime.entry-DCSdECWn.js} +44 -44
- package/dist/cjs/{nv-icon.entry-CSRxi6BH.js → nv-icon.entry-DB18IDaU.js} +9 -9
- package/dist/cjs/{nv-iconbutton_2.entry-BtDxwMFD.js → nv-iconbutton_2.entry-CNR_poEm.js} +3 -3
- package/dist/cjs/{nv-menu.entry-aX39SPH8.js → nv-menu.entry-CxXHuTq3.js} +2 -2
- package/dist/cjs/{nv-menuitem.entry-DzSp52G2.js → nv-menuitem.entry-44XD7nfl.js} +2 -2
- package/dist/cjs/{nv-notification-bullet.entry-D2yOXj46.js → nv-notification-bullet.entry-Cn2OELYw.js} +1 -1
- package/dist/cjs/{nv-notification.entry-BRXHbtT8.js → nv-notification.entry-C8beqUzI.js} +19 -19
- package/dist/cjs/{nv-notificationcontainer.entry-YNIM2_ah.js → nv-notificationcontainer.entry-DgEstiLX.js} +2 -2
- package/dist/cjs/{nv-pagination-nav.entry-uY1nT9aT.js → nv-pagination-nav.entry-CIZPwFeF.js} +2 -2
- package/dist/cjs/{nv-paginationtable.entry-mr5KYXVC.js → nv-paginationtable.entry-woQZpVmb.js} +19 -3
- package/dist/cjs/{nv-popover.entry-_9ARKM70.js → nv-popover.entry-rHUUSzR-.js} +2 -2
- package/dist/cjs/{nv-row.entry-BMQvcqlU.js → nv-row.entry-DaERf8TD.js} +2 -2
- package/dist/cjs/nv-sidebar.entry-BI9me_HP.js +355 -0
- package/dist/cjs/{nv-sidebarcontent.entry-llnRwVuj.js → nv-sidebarcontent.entry-CtARsnjy.js} +2 -2
- package/dist/cjs/{nv-sidebardivider.entry--rQv8d5T.js → nv-sidebardivider.entry-C15Xk11m.js} +2 -2
- package/dist/cjs/{nv-sidebarfooter.entry-C5R0sUI_.js → nv-sidebarfooter.entry-DFMMvv_Q.js} +2 -2
- package/dist/cjs/{nv-sidebargroup.entry-DdrpLbU7.js → nv-sidebargroup.entry-DeWOA-0I.js} +2 -2
- package/dist/cjs/{nv-sidebarheader.entry-HuBPIsyf.js → nv-sidebarheader.entry-HtvbpvnX.js} +2 -2
- package/dist/cjs/{nv-sidebarlogo.entry-TZNPoqnA.js → nv-sidebarlogo.entry-Zxbpttzr.js} +2 -2
- package/dist/cjs/{nv-sidebarnavitem.entry-BWc3mF5I.js → nv-sidebarnavitem.entry-u4rbC1el.js} +3 -3
- package/dist/cjs/{nv-sidebarnavsubitem.entry-DekANwO8.js → nv-sidebarnavsubitem.entry-UouMn7hU.js} +2 -2
- package/dist/cjs/{nv-split.entry-BOwOB8FW.js → nv-split.entry-CUMbQNQB.js} +2 -2
- package/dist/cjs/{nv-stack.entry-CaTiSLGN.js → nv-stack.entry-D_F42KTD.js} +2 -2
- package/dist/cjs/nv-statusindicator.entry-BdRvU3iW.js +42 -0
- package/dist/cjs/{nv-table.entry-LFZaS0Dy.js → nv-table.entry-CKVH76OE.js} +3 -3
- package/dist/cjs/{nv-tableheader.entry-CK50S8xW.js → nv-tableheader.entry-btKwE14F.js} +2 -2
- package/dist/cjs/nv-tag.entry-BxYC7Lgo.js +85 -0
- package/dist/cjs/{nv-timetest.entry-A9elKwkf.js → nv-timetest.entry-CxXMIDZ_.js} +2 -2
- package/dist/cjs/{nv-toggle.entry-BGu-6rEs.js → nv-toggle.entry-C4uo7RRt.js} +3 -3
- package/dist/cjs/{nv-togglebutton.entry-BzAcBOgN.js → nv-togglebutton.entry-DJ-s5lgO.js} +2 -2
- package/dist/cjs/{nv-togglebuttongroup.entry-CIWp7IXc.js → nv-togglebuttongroup.entry-DJOCL_Qx.js} +2 -2
- package/dist/cjs/{nv-tooltip.entry-CoGkSHpv.js → nv-tooltip.entry-DndZWT1U.js} +2 -2
- package/dist/components/NvDatatable/NvDatatable.js +178 -61
- package/dist/components/NvDatatable/expandState.js +8 -0
- package/dist/components/NvDatatable/expandState.test.js +41 -0
- package/dist/components/NvDatatable/paginationState.js +9 -0
- package/dist/components/NvDatatable/paginationState.test.js +84 -0
- package/dist/generated/components.js +25 -2
- package/dist/generated/components.server.js +33 -1
- package/dist/types/components/NvDatatable/NvDatatable.d.ts +1 -1
- package/dist/types/components/NvDatatable/expandState.d.ts +5 -0
- package/dist/types/components/NvDatatable/expandState.test.d.ts +1 -0
- package/dist/types/components/NvDatatable/paginationState.d.ts +9 -0
- package/dist/types/components/NvDatatable/paginationState.test.d.ts +1 -0
- package/dist/types/components/NvDatatable/types.d.ts +17 -1
- package/dist/types/generated/components.d.ts +14 -1
- package/dist/types/generated/components.server.d.ts +14 -1
- package/package.json +1 -1
- package/dist/cjs/index-DgKzi_Pd.js +0 -10208
- package/dist/cjs/nv-sidebar.entry-C4HTjJmz.js +0 -181
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-BRxlcrvE.js');
|
|
4
4
|
var clsxChV9xqsO = require('./clsx-ChV9xqsO-BtxeOLZW.js');
|
|
5
5
|
require('@stencil/react-output-target/runtime');
|
|
6
6
|
require('react');
|
|
@@ -128,7 +128,7 @@ const NvIconbutton = class {
|
|
|
128
128
|
/****************************************************************************/
|
|
129
129
|
//#region RENDER
|
|
130
130
|
render() {
|
|
131
|
-
return (index.h(index.Host, { key: '
|
|
131
|
+
return (index.h(index.Host, { key: 'f206fab4c635b6d27b112cc68bebfc3e66593177', role: "button", type: this.type, tabindex: this.disableTabindex ? -1 : 0, disabled: this.disabled ? true : undefined, class: clsxChV9xqsO.clsx('root', `size-${this.size}`, `emphasis-${this.emphasis}`, this.loading && 'loading', `shape-${this.shape}`), onClick: this.handleClick }, this.loading && index.h("nv-loader", { key: '2ea73a9f618aeda177874d9d628e67e2ecaeec52', size: this.size }), !this.loading && index.h("nv-icon", { key: '8ebed9969c09dedbb7c900b520cb52f28f342adc', name: this.name, size: this.size }), index.h("slot", { key: 'b4d27f55210016a776cb215f2f8788fe4fd7c4a1' })));
|
|
132
132
|
}
|
|
133
133
|
static get formAssociated() { return true; }
|
|
134
134
|
get el() { return index.getElement(this); }
|
|
@@ -162,7 +162,7 @@ const NvLoader = class {
|
|
|
162
162
|
//#region RENDER
|
|
163
163
|
/* <slot> empty to force rendering change */
|
|
164
164
|
render() {
|
|
165
|
-
return (index.h(index.Host, { key: '
|
|
165
|
+
return (index.h(index.Host, { key: '7b918edfcde0ddd6c0d43ad6e2a2457715bd1889', class: clsxChV9xqsO.clsx(this.size && `size-${this.size}`, this.color && `color-${this.color}`) }));
|
|
166
166
|
}
|
|
167
167
|
};
|
|
168
168
|
NvLoader.style = nvLoaderCss();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-BRxlcrvE.js');
|
|
4
4
|
require('@stencil/react-output-target/runtime');
|
|
5
5
|
require('react');
|
|
6
6
|
require('react-dom');
|
|
@@ -192,7 +192,7 @@ const NvMenu = class {
|
|
|
192
192
|
this.triggerElement = this.el.querySelector('[slot="trigger"]');
|
|
193
193
|
}
|
|
194
194
|
render() {
|
|
195
|
-
return (index.h(index.Host, { key: '
|
|
195
|
+
return (index.h(index.Host, { key: '6d6c019a93a9b9b86050676d9cfd6c9bed32f74e' }, index.h("slot", { key: 'cef1a6840042e09583d0b52afe8feb5ffa1596e1', name: "trigger" }), index.h("nv-popover", { key: '1c8e5c2080c18dc64cb1eda46c25de82bd56ffb7', ref: el => (this.popoverElement = el), triggerMode: "click", triggerElement: this.triggerElement, placement: this.placement, nested: this.nested, open: this.open, onOpenChanged: this.handleOpenChanged.bind(this) }, this.items ? (index.h("ul", { slot: "content" }, this.renderMenuItems())) : (index.h("slot", { name: "content" })))));
|
|
196
196
|
}
|
|
197
197
|
get el() { return index.getElement(this); }
|
|
198
198
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-BRxlcrvE.js');
|
|
4
4
|
require('@stencil/react-output-target/runtime');
|
|
5
5
|
require('react');
|
|
6
6
|
require('react-dom');
|
|
@@ -50,7 +50,7 @@ const NvMenuitem = class {
|
|
|
50
50
|
/****************************************************************************/
|
|
51
51
|
//#region RENDER
|
|
52
52
|
render() {
|
|
53
|
-
return (index.h(index.Host, { key: '
|
|
53
|
+
return (index.h(index.Host, { key: '9ae0a9d4520789157d869a8832f622176f9df331', role: "menuitem", tabindex: this.disabled ? '-1' : '0' }, this.icon && index.h("nv-icon", { key: 'a0f76ff34d83238add0cebfb83a1c7f715d9fcb0', name: this.icon }), index.h("slot", { key: '8a5883175325444025efcbd12ecb57c95dfb2ac3' }), this.label && index.h("span", { key: 'da5452a4fdc521cf336a38575c9ab2e49d7b0179', "data-scope": "text" }, this.label), this.shortcut && !this.hasSubmenu && index.h("kbd", { key: 'de40a96181c57c6ea27669c15634a568c6e3ed05' }, this.shortcut), this.hasSubmenu && index.h("nv-icon", { key: 'ff65838b28f0be31356645cfbdd5b7eb95b47266', name: "chevron-right" })));
|
|
54
54
|
}
|
|
55
55
|
get el() { return index.getElement(this); }
|
|
56
56
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var
|
|
3
|
+
var index = require('./index-BRxlcrvE.js');
|
|
4
|
+
var constantsGOKBmbgZ = require('./constants-gOKBmbgZ-CSoZ8z-G.js');
|
|
5
5
|
var collapse_animationDZDm0vSK = require('./collapse.animation-DZDm0vSK-C2TOIhIK.js');
|
|
6
6
|
var fade_animationDcRL9lcm = require('./fade.animation-DcRL9lcm-DAZeHoKN.js');
|
|
7
7
|
require('./style-value-types.es-xlgmw4x8-B1vLqX9m.js');
|
|
@@ -53,18 +53,18 @@ const NvNotification = class {
|
|
|
53
53
|
/****************************************************************************/
|
|
54
54
|
//#region INTERNAL
|
|
55
55
|
this.iconByFeedback = {
|
|
56
|
-
[
|
|
57
|
-
[
|
|
58
|
-
[
|
|
59
|
-
[
|
|
60
|
-
[
|
|
56
|
+
[constantsGOKBmbgZ.FeedbackColors.Warning]: 'alert-circle',
|
|
57
|
+
[constantsGOKBmbgZ.FeedbackColors.Information]: 'info-circle',
|
|
58
|
+
[constantsGOKBmbgZ.FeedbackColors.Success]: 'circle-check',
|
|
59
|
+
[constantsGOKBmbgZ.FeedbackColors.Error]: 'alert-triangle',
|
|
60
|
+
[constantsGOKBmbgZ.FeedbackColors.Neutral]: 'help',
|
|
61
61
|
};
|
|
62
62
|
this.roleByFeedback = {
|
|
63
|
-
[
|
|
64
|
-
[
|
|
65
|
-
[
|
|
66
|
-
[
|
|
67
|
-
[
|
|
63
|
+
[constantsGOKBmbgZ.FeedbackColors.Error]: 'alert',
|
|
64
|
+
[constantsGOKBmbgZ.FeedbackColors.Warning]: 'alert',
|
|
65
|
+
[constantsGOKBmbgZ.FeedbackColors.Information]: 'status',
|
|
66
|
+
[constantsGOKBmbgZ.FeedbackColors.Success]: 'status',
|
|
67
|
+
[constantsGOKBmbgZ.FeedbackColors.Neutral]: 'status',
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
70
|
//#endregion PROPERTIES
|
|
@@ -118,15 +118,15 @@ const NvNotification = class {
|
|
|
118
118
|
}
|
|
119
119
|
getSlideDestination(pos) {
|
|
120
120
|
switch (pos) {
|
|
121
|
-
case
|
|
122
|
-
case
|
|
121
|
+
case constantsGOKBmbgZ.NotificationPosition.TopRight:
|
|
122
|
+
case constantsGOKBmbgZ.NotificationPosition.BottomRight:
|
|
123
123
|
return { axis: 'x', to: 100 }; // right
|
|
124
|
-
case
|
|
125
|
-
case
|
|
124
|
+
case constantsGOKBmbgZ.NotificationPosition.TopLeft:
|
|
125
|
+
case constantsGOKBmbgZ.NotificationPosition.BottomLeft:
|
|
126
126
|
return { axis: 'x', to: -100 }; // left
|
|
127
|
-
case
|
|
127
|
+
case constantsGOKBmbgZ.NotificationPosition.TopCenter:
|
|
128
128
|
return { axis: 'y', to: -100 }; // up
|
|
129
|
-
case
|
|
129
|
+
case constantsGOKBmbgZ.NotificationPosition.BottomCenter:
|
|
130
130
|
return { axis: 'y', to: 100 }; // down
|
|
131
131
|
default:
|
|
132
132
|
return { axis: 'x', to: 100 }; // fallback
|
|
@@ -167,7 +167,7 @@ const NvNotification = class {
|
|
|
167
167
|
/****************************************************************************/
|
|
168
168
|
//#region RENDER
|
|
169
169
|
render() {
|
|
170
|
-
return (index.h(index.Host, { key: '
|
|
170
|
+
return (index.h(index.Host, { key: '963a3af8ccb2c30837117a043fb2448a4dc66495', role: this.getAriaRole(), "aria-live": this.getAriaLive(), "aria-atomic": true, "aria-labelledby": this.getHeadingId() ?? null, "aria-describedby": this.getMessageId() ?? null, tabindex: "-1" }, index.h("div", { key: '6e19a01f8d53bea227582f1675c21c12d1a7999b', "data-scope": "container", ref: el => (this.container = el) }, this.dismissible && (index.h("button", { key: '1e218a93694821570701052167d853bcef9838d8', "data-scope": "dismiss", type: "button", onClick: this.dismiss.bind(this) }, index.h("nv-icon", { key: 'f476ccf71ea7900ce5d6ae00a27704f73d9d6dca', name: "x", size: "sm" }))), index.h("nv-icon", { key: '94e1a29141c622494868fbb9b168768f2d81c009', name: this.icon ?? this.getDefaultIcon(), size: "md", "data-scope": "icon" }), index.h("div", { key: 'a7e807940344cc5cd1313c6243d6397608b15256', "data-scope": "content" }, (this.heading || this.headingSlot) && (index.h("p", { key: 'd901622d9a82c1591052d00049d5ceff79c45d3f', id: this.getHeadingId(), "data-scope": "heading" }, index.h("slot", { key: '4c56f47007bd90cd6bcb02334ca1df663e703d55', name: "heading" }, this.heading))), (this.message || this.messageSlot) && (index.h("p", { key: '579226c99afd50444ea3e8030e8eb6aa3b875379', id: this.getMessageId(), "data-scope": "message" }, index.h("slot", { key: '4d099d8f38269a49500f4e17d9d2cfb7552c4759', name: "content" }, this.message))), this.actionsSlot && (index.h("div", { key: '341d68bf9af3e14805022da7f18760ac1ab09616', "data-scope": "actions" }, index.h("slot", { key: '39d4bbe64673e00a65f650bb311f87e48af53c5f', name: "actions" })))))));
|
|
171
171
|
}
|
|
172
172
|
get el() { return index.getElement(this); }
|
|
173
173
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-BRxlcrvE.js');
|
|
4
4
|
require('@stencil/react-output-target/runtime');
|
|
5
5
|
require('react');
|
|
6
6
|
require('react-dom');
|
|
@@ -21,7 +21,7 @@ const NvNotificationContainer = class {
|
|
|
21
21
|
/****************************************************************************/
|
|
22
22
|
//#region RENDER
|
|
23
23
|
render() {
|
|
24
|
-
return (index.h(index.Host, { key: '
|
|
24
|
+
return (index.h(index.Host, { key: 'd59852ab59c6689f8a8a691293c2f91798360ff9', class: `position-${this.position}` }, index.h("slot", { key: '0758d9cd7b66e21e90f8cf7df13146426749c379' })));
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
NvNotificationContainer.style = nvNotificationcontainerCss();
|
package/dist/cjs/{nv-pagination-nav.entry-uY1nT9aT.js → nv-pagination-nav.entry-CIZPwFeF.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-BRxlcrvE.js');
|
|
4
4
|
require('@stencil/react-output-target/runtime');
|
|
5
5
|
require('react');
|
|
6
6
|
require('react-dom');
|
|
@@ -180,7 +180,7 @@ const NvPaginationNav = class {
|
|
|
180
180
|
render() {
|
|
181
181
|
const isFirstPage = this.currentPage === 1;
|
|
182
182
|
const isLastPage = this.currentPage === this.totalPages;
|
|
183
|
-
return (index.h(index.Host, { key: '
|
|
183
|
+
return (index.h(index.Host, { key: '0286f59b5bea5278e5e9765e8e8f9cf982012967' }, index.h("nav", { key: '90acdb38a7f5856c91008c59d0e33ed40e280413', "data-scope": "pagination-nav", "aria-label": "Pagination navigation" }, this.isOnlyIcon ? (index.h("nv-iconbutton", { name: "chevron-left", size: "md", emphasis: "lower", disabled: isFirstPage, onClick: () => this.handlePageChange(this.currentPage - 1), "data-scope": "previous-iconbutton", "aria-label": this.previousButtonLabel })) : (index.h("nv-button", { size: "md", emphasis: "lower", disabled: isFirstPage, onClick: () => this.handlePageChange(this.currentPage - 1), "data-scope": "previous-button" }, index.h("nv-icon", { slot: "leading-icon", name: "chevron-left" }), this.previousButtonLabel)), index.h("ol", { key: 'e0d45ea0585641912d07224cda2f28da4d403328', "data-scope": "page-list" }, calculatePaginationRange({
|
|
184
184
|
currentPage: this.currentPage,
|
|
185
185
|
totalCount: this.totalCount,
|
|
186
186
|
pageSize: this.pageSize,
|
package/dist/cjs/{nv-paginationtable.entry-mr5KYXVC.js → nv-paginationtable.entry-woQZpVmb.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-BRxlcrvE.js');
|
|
4
4
|
require('@stencil/react-output-target/runtime');
|
|
5
5
|
require('react');
|
|
6
6
|
require('react-dom');
|
|
@@ -40,6 +40,19 @@ function interpolate(template, values, fallback) {
|
|
|
40
40
|
function isFirstPage(pageIndex) {
|
|
41
41
|
return pageIndex === 0;
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Returns the 1-based page number to show in the page label.
|
|
45
|
+
* When there are no pages (empty/filtered-to-zero dataset), returns 0 so
|
|
46
|
+
* the label reads e.g. "Page 0 of 0" instead of "Page 1 of 0".
|
|
47
|
+
* @param {number} pageIndex - Current page index (zero-based)
|
|
48
|
+
* @param {number} pageCount - Total number of pages
|
|
49
|
+
* @returns {number} The page number to display (1-based, or 0 when no pages)
|
|
50
|
+
*/
|
|
51
|
+
function getDisplayPageNumber(pageIndex, pageCount) {
|
|
52
|
+
if (pageCount <= 0)
|
|
53
|
+
return 0;
|
|
54
|
+
return pageIndex + 1;
|
|
55
|
+
}
|
|
43
56
|
/**
|
|
44
57
|
* Checks if navigation to the last/next page is possible
|
|
45
58
|
* @param {number} pageIndex - Current page index (zero-based)
|
|
@@ -212,10 +225,13 @@ const NvPaginationtable = class {
|
|
|
212
225
|
const atFirstPage = isFirstPage(this.pageIndex);
|
|
213
226
|
const atLastPage = isLastPage(this.pageIndex, this.pageCount);
|
|
214
227
|
// Use fallback values to handle undefined props (can happen when frameworks pass undefined explicitly)
|
|
215
|
-
const pageLabel = interpolate(this.labelPage, {
|
|
228
|
+
const pageLabel = interpolate(this.labelPage, {
|
|
229
|
+
pageIndex: getDisplayPageNumber(this.pageIndex, this.pageCount),
|
|
230
|
+
pageCount: this.pageCount,
|
|
231
|
+
}, 'Page {pageIndex} of {pageCount}');
|
|
216
232
|
const totalLabel = interpolate(this.labelTotal, { rowCount: this.rowCount }, 'Total: {rowCount} rows');
|
|
217
233
|
const pageSizeOptions = generatePageSizeOptions(this.labelPageSizeOption ?? '{pageSize} per page');
|
|
218
|
-
return (index.h(index.Host, { key: '
|
|
234
|
+
return (index.h(index.Host, { key: 'bd9f375e9cd70057e07f4a9c2959602deae32595', role: "navigation", "aria-label": "Pagination" }, !this.hideControls && (index.h("div", { key: '0386065df913eb6f2771ca2d2c4298fb366d4ab0', "data-scope": "controls" }, !this.hideFirstLast && (index.h("nv-iconbutton", { key: '3936165ea8dcf0ca31bdf5655227ac78850138da', name: "chevrons-left", emphasis: "lower", size: "sm", disabled: atFirstPage, onClick: () => this.firstPage() })), !this.hidePrevNext && (index.h("nv-iconbutton", { key: '2bd49394589d6774a32b0389268bd411ebfa4e16', name: "chevron-left", emphasis: "lower", size: "sm", disabled: atFirstPage, onClick: () => this.previousPage() })), !this.hidePrevNext && (index.h("nv-iconbutton", { key: '030d56f45acc4021cd7541970c9e5190ed7e6385', name: "chevron-right", emphasis: "lower", size: "sm", disabled: atLastPage, onClick: () => this.nextPage() })), !this.hideFirstLast && (index.h("nv-iconbutton", { key: '720dc8f95504f3b71b7dfd5e674c67d3f059b235', name: "chevrons-right", emphasis: "lower", size: "sm", disabled: atLastPage, onClick: () => this.lastPage() })))), index.h("span", { key: 'd4bf47080fd6e9beb2197b9447b6f8619ab8321d', "data-scope": "page-label" }, pageLabel), index.h("span", { key: '874dc1d70c11a9e1a7553156c0eae64274ce1573', "data-scope": "total" }, totalLabel), index.h("div", { key: 'e7ce034f09df02eab8cbcd425680cf1f3548cc4e', "data-scope": "per-page" }, index.h("nv-fieldselect", { key: '61a7bc328283207597a8633bd77cb66a990b0973', value: String(this.pageSize), onValueChanged: this.handlePageSizeChange, options: pageSizeOptions })), index.h("slot", { key: '69c3590d8d2d2ce3df7ce3f809b7ee6614d58ce5' })));
|
|
219
235
|
}
|
|
220
236
|
static get watchers() { return {
|
|
221
237
|
"pageIndex": [{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-BRxlcrvE.js');
|
|
4
4
|
var fade_animationDcRL9lcm = require('./fade.animation-DcRL9lcm-DAZeHoKN.js');
|
|
5
5
|
var grow_animationD7ep_aVl = require('./grow.animation-D7ep_aVl-BuXEDSK-.js');
|
|
6
6
|
require('./style-value-types.es-xlgmw4x8-B1vLqX9m.js');
|
|
@@ -1962,7 +1962,7 @@ const NvPopover = class {
|
|
|
1962
1962
|
/****************************************************************************/
|
|
1963
1963
|
//#region RENDER
|
|
1964
1964
|
render() {
|
|
1965
|
-
return (index.h(index.Host, { key: '
|
|
1965
|
+
return (index.h(index.Host, { key: 'bf65e878d126fd511b574bf0262dde4f60e89750' }, index.h("slot", { key: '5482a6bc3d6eb3edfa6653623f6c3024c6d150be', name: "trigger" }), index.h("div", { key: '6cd445d44ad05def95647d2898dc19092716a8ee', "data-scope": "popover", "data-strategy": this.strategy, hidden: true, ref: el => (this.popoverElement = el) }, this.hasArrow && (index.h("div", { key: 'b23f0f9709f733a44d239a05b99f965d5ba036fb', "data-scope": "arrow", ref: el => (this.arrowElement = el) })), index.h("slot", { key: '423901f5afaf3418edc8870b4de7b113151c685d', name: "content" }))));
|
|
1966
1966
|
}
|
|
1967
1967
|
get el() { return index.getElement(this); }
|
|
1968
1968
|
static get watchers() { return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-BRxlcrvE.js');
|
|
4
4
|
require('@stencil/react-output-target/runtime');
|
|
5
5
|
require('react');
|
|
6
6
|
require('react-dom');
|
|
@@ -14,7 +14,7 @@ const NvRow = class {
|
|
|
14
14
|
/****************************************************************************/
|
|
15
15
|
//#region RENDER
|
|
16
16
|
render() {
|
|
17
|
-
return (index.h(index.Host, { key: '
|
|
17
|
+
return (index.h(index.Host, { key: 'dd18c6bf2c540a0f9389d32c01ce1bf19417e15a' }, index.h("slot", { key: '2bae51fa253dd71ff2318af8538a64200b7dfef4' })));
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
20
|
NvRow.style = nvRowCss();
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-BRxlcrvE.js');
|
|
4
|
+
require('@stencil/react-output-target/runtime');
|
|
5
|
+
require('react');
|
|
6
|
+
require('react-dom');
|
|
7
|
+
|
|
8
|
+
const nvSidebarCss = () => `nv-sidebarnavitem a,nv-sidebarnavitem a:link,nv-sidebarnavitem a:visited,nv-sidebarnavitem a:hover,nv-sidebarnavitem a:active,nv-sidebarnavsubitem a,nv-sidebarnavsubitem a:link,nv-sidebarnavsubitem a:visited,nv-sidebarnavsubitem a:hover,nv-sidebarnavsubitem a:active{color:inherit !important;text-decoration:none !important}nv-sidebar{display:flex;flex-direction:column;position:relative;height:100vh;background-color:var(--components-sidebar-background);border-right:var(--sidebar-divider-size) solid var(--components-sidebar-border);transition:width 0.3s ease;width:var(--sidebar-width)}nv-sidebar[collapsed]{width:var(--sidebar-width-collapsed)}nv-sidebar[collapsed] [data-hide-on-collapsed]{display:none !important}nv-sidebar[collapsed] .nv-sidebar-container{padding:var(--sidebar-padding-y) var(--sidebar-padding-x-collapsed)}nv-sidebar[resizing]{transition:none}nv-sidebar .nv-sidebar-container{display:flex;flex-direction:column;flex:1;overflow:hidden;padding:var(--sidebar-padding-y) var(--sidebar-padding-x);gap:var(--sidebar-gap-y)}nv-sidebar .nv-sidebar-toggle{position:absolute;top:var(--sidebar-collapsible-button-position-top);right:calc(-1 * var(--sidebar-collapsible-button-position-right));display:flex;align-items:center;justify-content:center;padding:var(--sidebar-collapsible-button-padding);background-color:var(--components-sidebar-background);border:1px solid var(--color-content-low-border);border-radius:var(--radius-rounded-full);cursor:pointer;transition:transform 0.2s ease;z-index:10}nv-sidebar .nv-sidebar-toggle:hover{background-color:var(--color-interaction-container-neutral-background-hover)}nv-sidebar .nv-sidebar-toggle:focus,nv-sidebar .nv-sidebar-toggle:focus-within{outline:none}nv-sidebar .nv-sidebar-toggle:focus-visible,nv-sidebar .nv-sidebar-toggle:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--color-focus-brand);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-sidebar .nv-sidebar-toggle nv-icon{width:var(--sidebar-collapsible-button-icon-size);height:var(--sidebar-collapsible-button-icon-size);color:var(--color-interaction-container-neutral-icon)}nv-sidebar .nv-sidebar-toggle nv-icon:hover{color:var(--color-interaction-container-neutral-icon-hover)}nv-sidebar .nv-sidebar-resize-handle{position:absolute;top:0;right:calc(-1 * var(--sidebar-divider-size));width:4px;height:100%;cursor:col-resize;background-color:transparent;transition:background-color 0.15s ease;z-index:9;user-select:none;touch-action:none}nv-sidebar .nv-sidebar-resize-handle:hover,nv-sidebar .nv-sidebar-resize-handle:focus-visible{background-color:var(--color-interaction-container-branded-high-background)}nv-sidebar .nv-sidebar-resize-handle:focus,nv-sidebar .nv-sidebar-resize-handle:focus-within{outline:none}nv-sidebar .nv-sidebar-resize-handle:focus-visible,nv-sidebar .nv-sidebar-resize-handle:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--color-focus-brand);outline-offset:calc(var(--focus-outline-offset) * 1)}`;
|
|
9
|
+
|
|
10
|
+
const KEYBOARD_STEP = 8;
|
|
11
|
+
const NvSidebar = class {
|
|
12
|
+
constructor(hostRef) {
|
|
13
|
+
index.registerInstance(this, hostRef);
|
|
14
|
+
this.openChanged = index.createEvent(this, "openChanged", 3);
|
|
15
|
+
this.widthChanged = index.createEvent(this, "widthChanged", 3);
|
|
16
|
+
this.resizeStartX = 0;
|
|
17
|
+
this.resizeStartWidth = 0;
|
|
18
|
+
/****************************************************************************/
|
|
19
|
+
//#region PROPERTIES
|
|
20
|
+
/**
|
|
21
|
+
* The type of sidebar behavior.
|
|
22
|
+
* - collapsible: Can be toggled open/closed
|
|
23
|
+
* - persistent: Always visible
|
|
24
|
+
*/
|
|
25
|
+
this.type = 'persistent';
|
|
26
|
+
/**
|
|
27
|
+
* Whether the sidebar is currently open (only applies to collapsible type).
|
|
28
|
+
*/
|
|
29
|
+
// eslint-disable-next-line @stencil-community/ban-default-true
|
|
30
|
+
this.open = true;
|
|
31
|
+
/**
|
|
32
|
+
* Determines the type of notification bullets in the sidebar.
|
|
33
|
+
* - neutral: Uses neutral colors (gray)
|
|
34
|
+
* - brand: Uses brand colors (orange/teal depending on theme)
|
|
35
|
+
*/
|
|
36
|
+
this.notificationIntention = 'brand';
|
|
37
|
+
/**
|
|
38
|
+
* Determines the emphasis of notification bullets in the sidebar.
|
|
39
|
+
* - high: More prominent appearance
|
|
40
|
+
* - low: Less prominent appearance
|
|
41
|
+
*/
|
|
42
|
+
this.notificationEmphasis = 'high';
|
|
43
|
+
/**
|
|
44
|
+
* When true, the sidebar can be resized horizontally by dragging its right edge.
|
|
45
|
+
* Only active when the sidebar is open (not collapsed).
|
|
46
|
+
*/
|
|
47
|
+
this.resizable = false;
|
|
48
|
+
/**
|
|
49
|
+
* Minimum width in pixels when resizing.
|
|
50
|
+
*/
|
|
51
|
+
this.minWidth = 200;
|
|
52
|
+
/**
|
|
53
|
+
* Maximum width in pixels when resizing.
|
|
54
|
+
*/
|
|
55
|
+
this.maxWidth = 480;
|
|
56
|
+
//#endregion PROPERTIES
|
|
57
|
+
/****************************************************************************/
|
|
58
|
+
//#region STATE
|
|
59
|
+
this.resizing = false;
|
|
60
|
+
//#endregion EVENTS
|
|
61
|
+
/****************************************************************************/
|
|
62
|
+
//#region METHODS
|
|
63
|
+
this.handleToggle = () => {
|
|
64
|
+
if (this.type === 'collapsible') {
|
|
65
|
+
// Changing open will trigger @Watch which emits the event
|
|
66
|
+
this.open = !this.open;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
this.handleResizeStart = (event) => {
|
|
70
|
+
if (event.button !== 0)
|
|
71
|
+
return;
|
|
72
|
+
if (this.resizing)
|
|
73
|
+
return;
|
|
74
|
+
if (!this.canResize())
|
|
75
|
+
return;
|
|
76
|
+
event.preventDefault();
|
|
77
|
+
this.resizing = true;
|
|
78
|
+
this.resizeStartX = event.clientX;
|
|
79
|
+
// clientWidth excludes the border, matching the CSS width that drives `--sidebar-width`
|
|
80
|
+
this.resizeStartWidth = this.el.clientWidth;
|
|
81
|
+
// Pointer capture routes subsequent pointer events to the handle even when
|
|
82
|
+
// the pointer leaves it, so releasing outside the window still fires pointerup
|
|
83
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
84
|
+
};
|
|
85
|
+
this.handleResizeMove = (event) => {
|
|
86
|
+
if (!this.resizing || !this.canResize())
|
|
87
|
+
return;
|
|
88
|
+
const delta = event.clientX - this.resizeStartX;
|
|
89
|
+
this.width = this.clampWidth(this.resizeStartWidth + delta);
|
|
90
|
+
};
|
|
91
|
+
this.handleResizeEnd = (event) => {
|
|
92
|
+
if (!this.resizing)
|
|
93
|
+
return;
|
|
94
|
+
this.releasePointerCapture(event);
|
|
95
|
+
this.resizing = false;
|
|
96
|
+
if (this.width != null) {
|
|
97
|
+
this.widthChanged.emit(this.width);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
this.handleResizeCancel = (event) => {
|
|
101
|
+
// Pointer cancel means the interaction was aborted (browser gesture, system
|
|
102
|
+
// event). Release capture and drop the drag, but do not emit widthChanged
|
|
103
|
+
// since the value was not committed by the user.
|
|
104
|
+
if (!this.resizing)
|
|
105
|
+
return;
|
|
106
|
+
this.releasePointerCapture(event);
|
|
107
|
+
this.resizing = false;
|
|
108
|
+
};
|
|
109
|
+
this.cancelResize = () => {
|
|
110
|
+
if (!this.resizing)
|
|
111
|
+
return;
|
|
112
|
+
this.resizing = false;
|
|
113
|
+
};
|
|
114
|
+
this.handleResizeKeyDown = (event) => {
|
|
115
|
+
if (!this.canResize())
|
|
116
|
+
return;
|
|
117
|
+
const [min, max] = this.getBounds();
|
|
118
|
+
const current = this.width ?? this.el.clientWidth;
|
|
119
|
+
let next = null;
|
|
120
|
+
switch (event.key) {
|
|
121
|
+
case 'ArrowLeft':
|
|
122
|
+
next = current - KEYBOARD_STEP;
|
|
123
|
+
break;
|
|
124
|
+
case 'ArrowRight':
|
|
125
|
+
next = current + KEYBOARD_STEP;
|
|
126
|
+
break;
|
|
127
|
+
case 'Home':
|
|
128
|
+
next = min;
|
|
129
|
+
break;
|
|
130
|
+
case 'End':
|
|
131
|
+
next = max;
|
|
132
|
+
break;
|
|
133
|
+
default:
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
event.preventDefault();
|
|
137
|
+
const currentClamped = this.clampWidth(current);
|
|
138
|
+
const nextClamped = this.clampWidth(next);
|
|
139
|
+
if (nextClamped === currentClamped)
|
|
140
|
+
return;
|
|
141
|
+
this.width = nextClamped;
|
|
142
|
+
this.widthChanged.emit(this.width);
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Sets the active state of navigation items based on activePath
|
|
146
|
+
*/
|
|
147
|
+
this.setActiveNavItems = () => {
|
|
148
|
+
if (!this.activePath)
|
|
149
|
+
return;
|
|
150
|
+
// First, check all subitems to find if any matches exactly
|
|
151
|
+
const activeSubitemHrefs = new Set();
|
|
152
|
+
this.el.querySelectorAll('nv-sidebarnavsubitem').forEach(subItem => {
|
|
153
|
+
const link = subItem.querySelector('a');
|
|
154
|
+
const href = link?.getAttribute('href');
|
|
155
|
+
if (href) {
|
|
156
|
+
const isActive = this.activePath === href;
|
|
157
|
+
subItem.active = isActive;
|
|
158
|
+
if (isActive) {
|
|
159
|
+
activeSubitemHrefs.add(href);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
// Then, set nav items active only if:
|
|
164
|
+
// 1. Exact match with activePath AND no subitem matches
|
|
165
|
+
// 2. OR the navitem has no subitems and activePath starts with its href
|
|
166
|
+
this.el.querySelectorAll('nv-sidebarnavitem').forEach(navItem => {
|
|
167
|
+
const link = navItem.querySelector(':scope > a, :scope > .nv-sidebarnavitem-trigger a, .nv-sidebarnavitem-content > a');
|
|
168
|
+
const href = link?.getAttribute('href');
|
|
169
|
+
const hasSubitems = navItem.querySelector('nv-sidebarnavsubitem') !== null;
|
|
170
|
+
if (href) {
|
|
171
|
+
if (hasSubitems) {
|
|
172
|
+
// Parent with subitems: only active if exact match (not when subitem is active)
|
|
173
|
+
navItem.active = this.activePath === href;
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
// Item without subitems: active on exact match
|
|
177
|
+
navItem.active = this.activePath === href;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
this.pendingActiveUpdate = null;
|
|
183
|
+
/**
|
|
184
|
+
* Sets up the MutationObserver to watch for changes in child elements.
|
|
185
|
+
* Only triggers on new nav items being added, not on attribute changes.
|
|
186
|
+
*/
|
|
187
|
+
this.setupMutationObserver = () => {
|
|
188
|
+
this.mutationObserver = new MutationObserver(mutations => {
|
|
189
|
+
// Only react to new nav items being added, ignore other mutations
|
|
190
|
+
const hasNewNavItems = mutations.some(mutation => {
|
|
191
|
+
if (mutation.type !== 'childList')
|
|
192
|
+
return false;
|
|
193
|
+
return Array.from(mutation.addedNodes).some(node => {
|
|
194
|
+
if (node.nodeType !== Node.ELEMENT_NODE)
|
|
195
|
+
return false;
|
|
196
|
+
const el = node;
|
|
197
|
+
return (el.tagName.toLowerCase() === 'nv-sidebarnavitem' ||
|
|
198
|
+
el.tagName.toLowerCase() === 'nv-sidebarnavsubitem' ||
|
|
199
|
+
el.querySelector('nv-sidebarnavitem, nv-sidebarnavsubitem'));
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
if (hasNewNavItems) {
|
|
203
|
+
// Debounce to prevent multiple rapid calls
|
|
204
|
+
if (this.pendingActiveUpdate) {
|
|
205
|
+
clearTimeout(this.pendingActiveUpdate);
|
|
206
|
+
}
|
|
207
|
+
this.pendingActiveUpdate = window.setTimeout(() => {
|
|
208
|
+
this.setActiveNavItems();
|
|
209
|
+
this.pendingActiveUpdate = null;
|
|
210
|
+
}, 50);
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
this.mutationObserver.observe(this.el, {
|
|
214
|
+
childList: true,
|
|
215
|
+
subtree: true,
|
|
216
|
+
});
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
getBounds() {
|
|
220
|
+
// Fall back to the built-in defaults if a consumer passes a non-finite bound
|
|
221
|
+
const rawMin = Number.isFinite(this.minWidth) ? this.minWidth : 200;
|
|
222
|
+
const rawMax = Number.isFinite(this.maxWidth) ? this.maxWidth : 480;
|
|
223
|
+
return [Math.min(rawMin, rawMax), Math.max(rawMin, rawMax)];
|
|
224
|
+
}
|
|
225
|
+
clampWidth(value) {
|
|
226
|
+
const [min, max] = this.getBounds();
|
|
227
|
+
return Math.round(Math.min(Math.max(value, min), max));
|
|
228
|
+
}
|
|
229
|
+
canResize() {
|
|
230
|
+
return this.resizable && !(this.type === 'collapsible' && !this.open);
|
|
231
|
+
}
|
|
232
|
+
getAriaValueNow() {
|
|
233
|
+
if (this.width != null)
|
|
234
|
+
return this.clampWidth(this.width);
|
|
235
|
+
const [min] = this.getBounds();
|
|
236
|
+
return this.clampWidth(this.el?.clientWidth || min);
|
|
237
|
+
}
|
|
238
|
+
applyWidthStyle() {
|
|
239
|
+
if (this.width == null) {
|
|
240
|
+
this.el.style.removeProperty('--sidebar-width');
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
if (!Number.isFinite(this.width)) {
|
|
244
|
+
// Guard against NaN/Infinity which would otherwise loop through @Watch('width') forever
|
|
245
|
+
this.width = undefined;
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
const clamped = this.clampWidth(this.width);
|
|
249
|
+
if (clamped !== this.width) {
|
|
250
|
+
this.width = clamped;
|
|
251
|
+
return; // @Watch('width') will re-enter and apply the clamped value
|
|
252
|
+
}
|
|
253
|
+
this.el.style.setProperty('--sidebar-width', `${clamped}px`);
|
|
254
|
+
}
|
|
255
|
+
releasePointerCapture(event) {
|
|
256
|
+
const target = event.currentTarget;
|
|
257
|
+
if (target?.hasPointerCapture(event.pointerId)) {
|
|
258
|
+
target.releasePointerCapture(event.pointerId);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
handleCollapsedSideEffects(isCollapsed) {
|
|
262
|
+
if (!isCollapsed) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
this.el.querySelectorAll('nv-sidebarnavitem[open]').forEach(navItem => {
|
|
266
|
+
navItem.open = false;
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
//#endregion METHODS
|
|
270
|
+
/****************************************************************************/
|
|
271
|
+
//#region WATCHERS
|
|
272
|
+
onActivePathChanged() {
|
|
273
|
+
this.setActiveNavItems();
|
|
274
|
+
}
|
|
275
|
+
onOpenChanged(newValue, oldValue) {
|
|
276
|
+
this.handleCollapsedSideEffects(this.type === 'collapsible' && !newValue);
|
|
277
|
+
// Cancel any in-progress resize if the sidebar is programmatically collapsed
|
|
278
|
+
if (this.type === 'collapsible' && !newValue) {
|
|
279
|
+
this.cancelResize();
|
|
280
|
+
}
|
|
281
|
+
// Only emit event when open state actually changes (not on re-render with same value)
|
|
282
|
+
if (this.type === 'collapsible' && newValue !== oldValue) {
|
|
283
|
+
this.openChanged.emit(newValue);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
onWidthChanged() {
|
|
287
|
+
this.applyWidthStyle();
|
|
288
|
+
}
|
|
289
|
+
onBoundsChanged() {
|
|
290
|
+
// Re-clamp the current width against the new bounds so visuals and ARIA stay within range
|
|
291
|
+
if (this.width != null) {
|
|
292
|
+
const clamped = this.clampWidth(this.width);
|
|
293
|
+
if (clamped !== this.width) {
|
|
294
|
+
this.width = clamped;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
onResizableChanged(newValue) {
|
|
299
|
+
if (!newValue) {
|
|
300
|
+
this.cancelResize();
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
//#endregion WATCHERS
|
|
304
|
+
/****************************************************************************/
|
|
305
|
+
//#region LIFECYCLE
|
|
306
|
+
componentWillLoad() {
|
|
307
|
+
this.setActiveNavItems();
|
|
308
|
+
this.setupMutationObserver();
|
|
309
|
+
this.handleCollapsedSideEffects(this.type === 'collapsible' && !this.open);
|
|
310
|
+
this.applyWidthStyle();
|
|
311
|
+
}
|
|
312
|
+
disconnectedCallback() {
|
|
313
|
+
if (this.mutationObserver) {
|
|
314
|
+
this.mutationObserver.disconnect();
|
|
315
|
+
}
|
|
316
|
+
if (this.pendingActiveUpdate) {
|
|
317
|
+
clearTimeout(this.pendingActiveUpdate);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
//#endregion LIFECYCLE
|
|
321
|
+
/****************************************************************************/
|
|
322
|
+
//#region RENDER
|
|
323
|
+
render() {
|
|
324
|
+
const isCollapsed = this.type === 'collapsible' && !this.open;
|
|
325
|
+
const showResizeHandle = this.resizable && !isCollapsed;
|
|
326
|
+
const [ariaValueMin, ariaValueMax] = this.getBounds();
|
|
327
|
+
return (index.h(index.Host, { key: '6d43cb441e9477d4146d44af59365848dbbee875', role: "navigation", collapsed: isCollapsed ? true : undefined, resizing: this.resizing ? true : undefined, "notification-intention": this.notificationIntention, "notification-emphasis": this.notificationEmphasis, "aria-expanded": this.type === 'collapsible' ? String(this.open) : undefined }, index.h("div", { key: 'f6c58fbbafdb759499dd5a52e45eebc9ed6e5f4a', class: "nv-sidebar-container" }, index.h("slot", { key: '9ebf341658bb5631858390e3c76e274de72b5448' })), this.type === 'collapsible' && (index.h("button", { key: '1fd482c9157d47a5852395eb99a65f044f3db76a', class: "nv-sidebar-toggle", onClick: this.handleToggle, "aria-label": this.open ? 'Collapse sidebar' : 'Expand sidebar' }, index.h("nv-icon", { key: 'cd0a51cd731fc8c703256c3b781e0f20b14a3e2f', name: this.open
|
|
328
|
+
? 'layout-sidebar-left-collapse'
|
|
329
|
+
: 'layout-sidebar-right-collapse', size: "sm" }))), showResizeHandle && (index.h("div", { key: '75fe0b6d98ad9558b9003c541f255f84a41dbf27', class: "nv-sidebar-resize-handle", role: "separator", "aria-orientation": "vertical", "aria-label": "Resize sidebar", "aria-valuenow": this.getAriaValueNow(), "aria-valuemin": ariaValueMin, "aria-valuemax": ariaValueMax, tabIndex: 0, onPointerDown: this.handleResizeStart, onPointerMove: this.handleResizeMove, onPointerUp: this.handleResizeEnd, onPointerCancel: this.handleResizeCancel, onKeyDown: this.handleResizeKeyDown }))));
|
|
330
|
+
}
|
|
331
|
+
get el() { return index.getElement(this); }
|
|
332
|
+
static get watchers() { return {
|
|
333
|
+
"activePath": [{
|
|
334
|
+
"onActivePathChanged": 0
|
|
335
|
+
}],
|
|
336
|
+
"open": [{
|
|
337
|
+
"onOpenChanged": 0
|
|
338
|
+
}],
|
|
339
|
+
"width": [{
|
|
340
|
+
"onWidthChanged": 0
|
|
341
|
+
}],
|
|
342
|
+
"minWidth": [{
|
|
343
|
+
"onBoundsChanged": 0
|
|
344
|
+
}],
|
|
345
|
+
"maxWidth": [{
|
|
346
|
+
"onBoundsChanged": 0
|
|
347
|
+
}],
|
|
348
|
+
"resizable": [{
|
|
349
|
+
"onResizableChanged": 0
|
|
350
|
+
}]
|
|
351
|
+
}; }
|
|
352
|
+
};
|
|
353
|
+
NvSidebar.style = nvSidebarCss();
|
|
354
|
+
|
|
355
|
+
exports.nv_sidebar = NvSidebar;
|