@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,171 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-DUlunl9a.js');
|
|
4
|
+
var clsxChV9xqsO = require('./clsx-ChV9xqsO-BtxeOLZW.js');
|
|
5
|
+
require('@stencil/react-output-target/runtime');
|
|
6
|
+
require('react');
|
|
7
|
+
require('react-dom');
|
|
8
|
+
|
|
9
|
+
const nvIconbuttonCss = () => `nv-iconbutton.root{display:inline-flex;justify-content:center;align-items:center;font-style:normal;font-weight:var(--font-weight-medium-emphasis);font-family:var(--font-family-default), var(--font-family-fallback), sans-serif;transition:background-color 150ms ease-out;height:fit-content;width:fit-content}nv-iconbutton.size-xs{padding:calc(var(--button-xs-icon-button-padding) - 1px);gap:var(--button-xs-gap);border-radius:var(--button-xs-border-radius);line-height:var(--button-xs-line-height);font-size:var(--button-xs-font-size)}nv-iconbutton.size-sm{padding:calc(var(--button-sm-icon-button-padding) - 1px);gap:var(--button-sm-gap);border-radius:var(--button-sm-border-radius);line-height:var(--button-sm-line-height);font-size:var(--button-sm-font-size)}nv-iconbutton.size-md{padding:calc(var(--button-md-icon-button-padding) - 1px);gap:var(--button-md-gap);border-radius:var(--button-md-border-radius);line-height:var(--button-md-line-height);font-size:var(--button-md-font-size)}nv-iconbutton.size-lg{padding:calc(var(--button-lg-icon-button-padding) - 1px);gap:var(--button-lg-gap);border-radius:var(--button-lg-border-radius);line-height:var(--button-lg-line-height);font-size:var(--button-lg-font-size)}nv-iconbutton.emphasis-high{background:var(--components-button-high-background);border:1px solid var(--components-button-high-border);color:var(--components-button-high-text)}nv-iconbutton.emphasis-high:hover{background:var(--components-button-high-background-hover);color:var(--components-button-high-text-hover)}nv-iconbutton.emphasis-high:focus,nv-iconbutton.emphasis-high:focus-within{outline:none}nv-iconbutton.emphasis-high:focus-visible,nv-iconbutton.emphasis-high:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--color-focus-brand);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-iconbutton.emphasis-high:disabled{background:var(--components-button-high-background);color:var(--components-button-high-text);opacity:0.5;cursor:not-allowed;box-shadow:none}nv-iconbutton.emphasis-high nv-icon>svg{color:var(--components-button-high-icon)}nv-iconbutton.emphasis-medium{background:var(--components-button-medium-background);border:1px solid var(--components-button-medium-border);color:var(--components-button-medium-text)}nv-iconbutton.emphasis-medium:hover{background:var(--components-button-medium-background-hover);color:var(--components-button-medium-text-hover)}nv-iconbutton.emphasis-medium:focus,nv-iconbutton.emphasis-medium:focus-within{outline:none}nv-iconbutton.emphasis-medium:focus-visible,nv-iconbutton.emphasis-medium:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--color-focus-brand);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-iconbutton.emphasis-medium:disabled{background:var(--components-button-medium-background);color:var(--components-button-medium-text);opacity:0.5;cursor:not-allowed;box-shadow:none}nv-iconbutton.emphasis-medium nv-icon>svg{color:var(--components-button-medium-icon)}nv-iconbutton.emphasis-low{background:var(--components-button-low-background);border:1px solid var(--components-button-low-border);color:var(--components-button-low-text)}nv-iconbutton.emphasis-low:hover{background:var(--components-button-low-background-hover);color:var(--components-button-low-text-hover)}nv-iconbutton.emphasis-low:focus,nv-iconbutton.emphasis-low:focus-within{outline:none}nv-iconbutton.emphasis-low:focus-visible,nv-iconbutton.emphasis-low:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--color-focus-brand);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-iconbutton.emphasis-low:disabled{background:var(--components-button-low-background);color:var(--components-button-low-text);opacity:0.5;cursor:not-allowed;box-shadow:none}nv-iconbutton.emphasis-low nv-icon>svg{color:var(--components-button-low-icon)}nv-iconbutton.emphasis-lower{background:var(--components-button-lower-background);border:1px solid var(--components-button-lower-border);color:var(--components-button-lower-text)}nv-iconbutton.emphasis-lower:hover{background:var(--components-button-lower-background-hover);color:var(--components-button-lower-text-hover)}nv-iconbutton.emphasis-lower:focus,nv-iconbutton.emphasis-lower:focus-within{outline:none}nv-iconbutton.emphasis-lower:focus-visible,nv-iconbutton.emphasis-lower:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--color-focus-brand);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-iconbutton.emphasis-lower:disabled{background:var(--components-button-lower-background);color:var(--components-button-lower-text);opacity:0.5;cursor:not-allowed;box-shadow:none}nv-iconbutton.emphasis-lower nv-icon>svg{color:var(--components-button-lower-icon)}nv-iconbutton.loading [slot=leading-icon]{display:none}nv-iconbutton.shape-rounded{border-radius:var(--radius-rounded-full)}`;
|
|
10
|
+
|
|
11
|
+
const NvIconbutton = class {
|
|
12
|
+
constructor(hostRef) {
|
|
13
|
+
index.registerInstance(this, hostRef);
|
|
14
|
+
if (hostRef.$hostElement$["s-ei"]) {
|
|
15
|
+
this.internals = hostRef.$hostElement$["s-ei"];
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
this.internals = hostRef.$hostElement$.attachInternals();
|
|
19
|
+
hostRef.$hostElement$["s-ei"] = this.internals;
|
|
20
|
+
}
|
|
21
|
+
/****************************************************************************/
|
|
22
|
+
//#region PROPERTIES
|
|
23
|
+
/**
|
|
24
|
+
* Determines how large or small the button appears, allowing for
|
|
25
|
+
* customization of the button's dimensions to fit different design
|
|
26
|
+
* specifications and user needs.
|
|
27
|
+
*/
|
|
28
|
+
this.size = 'md';
|
|
29
|
+
/**
|
|
30
|
+
* Adjusts the button’s emphasis to make it more or less visually prominent
|
|
31
|
+
* to users. Use this to draw attention to important actions or reduce focus
|
|
32
|
+
* on less critical ones.
|
|
33
|
+
*/
|
|
34
|
+
this.emphasis = 'high';
|
|
35
|
+
/**
|
|
36
|
+
* Set this to true to show a spinner on the button, letting users know that
|
|
37
|
+
* their action is being processed. It helps improve user experience by
|
|
38
|
+
* indicating ongoing activities. The icon is not displayed when the button
|
|
39
|
+
* is loading. Also, the button is disabled. If you want to disable the
|
|
40
|
+
* button, it is not possible. It is automatically disabled when loading.
|
|
41
|
+
*/
|
|
42
|
+
this.loading = false;
|
|
43
|
+
/**
|
|
44
|
+
* Disables the button, preventing user interaction.
|
|
45
|
+
*/
|
|
46
|
+
this.disabled = false;
|
|
47
|
+
/**
|
|
48
|
+
* Makes the button look active when it’s within a compatible component
|
|
49
|
+
* like a button group.
|
|
50
|
+
*/
|
|
51
|
+
this.active = false;
|
|
52
|
+
/**
|
|
53
|
+
* Sets the button type to control its function in forms. Use 'submit' to send
|
|
54
|
+
* form data, 'reset' to clear the form, or 'button' for a standard button
|
|
55
|
+
* that doesn’t interact with form submission by default.
|
|
56
|
+
*/
|
|
57
|
+
this.type = 'button';
|
|
58
|
+
/**
|
|
59
|
+
* Sets the shape of the button. Choose between square and rounded.
|
|
60
|
+
*/
|
|
61
|
+
this.shape = 'square';
|
|
62
|
+
/**
|
|
63
|
+
* Use this to make the button skip-able when users navigate with the keyboard.
|
|
64
|
+
* The button remains clickable but won’t be reached via the Tab key.
|
|
65
|
+
*/
|
|
66
|
+
this.disableTabindex = false;
|
|
67
|
+
//#endregion PROPERTIES
|
|
68
|
+
/****************************************************************************/
|
|
69
|
+
//#region METHODS
|
|
70
|
+
/**
|
|
71
|
+
* Handles form-related actions when the button is clicked.
|
|
72
|
+
* - Submits the form if the button type is 'submit'.
|
|
73
|
+
* - Resets the form if the button type is 'reset'.
|
|
74
|
+
* @param {Event} event - The click event.
|
|
75
|
+
*/
|
|
76
|
+
this.handleClick = (event) => {
|
|
77
|
+
if (this.disabled) {
|
|
78
|
+
event.preventDefault();
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (this.type === 'submit') {
|
|
82
|
+
this.internals?.form?.requestSubmit();
|
|
83
|
+
}
|
|
84
|
+
if (this.type === 'reset') {
|
|
85
|
+
this.internals?.form?.reset();
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
//#endregion METHODS
|
|
90
|
+
/****************************************************************************/
|
|
91
|
+
//#region WATCHERS
|
|
92
|
+
handleLoadingChange(loading) {
|
|
93
|
+
this.loading = loading;
|
|
94
|
+
this.disabled = loading;
|
|
95
|
+
}
|
|
96
|
+
handleDisabledChange(disabled) {
|
|
97
|
+
if (this.loading) {
|
|
98
|
+
this.disabled = this.loading;
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
this.disabled = disabled;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
//#endregion WATCHERS
|
|
105
|
+
/****************************************************************************/
|
|
106
|
+
//#region EVENTS
|
|
107
|
+
handleKeyDown(event) {
|
|
108
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
109
|
+
event.preventDefault();
|
|
110
|
+
this.el.click();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
handleTouchStart(event) {
|
|
114
|
+
if (event.touches.length > 1)
|
|
115
|
+
return;
|
|
116
|
+
event.preventDefault();
|
|
117
|
+
this.el.click();
|
|
118
|
+
}
|
|
119
|
+
//#endregion EVENTS
|
|
120
|
+
/****************************************************************************/
|
|
121
|
+
//#region LIFECYCLE
|
|
122
|
+
componentWillLoad() {
|
|
123
|
+
if (this.loading) {
|
|
124
|
+
this.disabled = this.loading;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
//#endregion LIFECYCLE
|
|
128
|
+
/****************************************************************************/
|
|
129
|
+
//#region RENDER
|
|
130
|
+
render() {
|
|
131
|
+
return (index.h(index.Host, { key: '06b48253c77b09ae1259f72ad7698c9f9ddcd750', 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: '5b4117978546581bfb217a0595dec6c736369955', size: this.size }), !this.loading && index.h("nv-icon", { key: 'f2f0da0fae0d0fde955cc2f766cb98a3058ffb7e', name: this.name, size: this.size }), index.h("slot", { key: '8d59cdf4be11216ff4a0a607bea4970128faa214' })));
|
|
132
|
+
}
|
|
133
|
+
static get formAssociated() { return true; }
|
|
134
|
+
get el() { return index.getElement(this); }
|
|
135
|
+
static get watchers() { return {
|
|
136
|
+
"loading": [{
|
|
137
|
+
"handleLoadingChange": 0
|
|
138
|
+
}],
|
|
139
|
+
"disabled": [{
|
|
140
|
+
"handleDisabledChange": 0
|
|
141
|
+
}]
|
|
142
|
+
}; }
|
|
143
|
+
};
|
|
144
|
+
NvIconbutton.style = nvIconbuttonCss();
|
|
145
|
+
|
|
146
|
+
const nvLoaderCss = () => `@keyframes rotation{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}nv-loader{display:inline-block;position:relative;aspect-ratio:1/1;border-radius:9999px;color:inherit}nv-loader.size-xs{width:var(--loader-size-xs);height:var(--loader-size-xs)}nv-loader.size-xs::before,nv-loader.size-xs::after{content:" ";position:absolute;top:0;left:0;border-radius:inherit;width:100%;height:100%}nv-loader.size-xs::before{content:" ";border:calc(var(--loader-size-xs) / 10) solid;opacity:0.3}nv-loader.size-xs::after{content:" ";border-top:calc(var(--loader-size-xs) / 10) solid transparent;border-left:calc(var(--loader-size-xs) / 10) solid transparent;border-right:calc(var(--loader-size-xs) / 10) solid transparent;border-bottom:calc(var(--loader-size-xs) / 10) solid;animation:rotation 1s linear infinite}nv-loader.size-sm{width:var(--loader-size-sm);height:var(--loader-size-sm)}nv-loader.size-sm::before,nv-loader.size-sm::after{content:" ";position:absolute;top:0;left:0;border-radius:inherit;width:100%;height:100%}nv-loader.size-sm::before{content:" ";border:calc(var(--loader-size-sm) / 10) solid;opacity:0.3}nv-loader.size-sm::after{content:" ";border-top:calc(var(--loader-size-sm) / 10) solid transparent;border-left:calc(var(--loader-size-sm) / 10) solid transparent;border-right:calc(var(--loader-size-sm) / 10) solid transparent;border-bottom:calc(var(--loader-size-sm) / 10) solid;animation:rotation 1s linear infinite}nv-loader.size-md{width:var(--loader-size-md);height:var(--loader-size-md)}nv-loader.size-md::before,nv-loader.size-md::after{content:" ";position:absolute;top:0;left:0;border-radius:inherit;width:100%;height:100%}nv-loader.size-md::before{content:" ";border:calc(var(--loader-size-md) / 10) solid;opacity:0.3}nv-loader.size-md::after{content:" ";border-top:calc(var(--loader-size-md) / 10) solid transparent;border-left:calc(var(--loader-size-md) / 10) solid transparent;border-right:calc(var(--loader-size-md) / 10) solid transparent;border-bottom:calc(var(--loader-size-md) / 10) solid;animation:rotation 1s linear infinite}nv-loader.size-lg{width:var(--loader-size-lg);height:var(--loader-size-lg)}nv-loader.size-lg::before,nv-loader.size-lg::after{content:" ";position:absolute;top:0;left:0;border-radius:inherit;width:100%;height:100%}nv-loader.size-lg::before{content:" ";border:calc(var(--loader-size-lg) / 10) solid;opacity:0.3}nv-loader.size-lg::after{content:" ";border-top:calc(var(--loader-size-lg) / 10) solid transparent;border-left:calc(var(--loader-size-lg) / 10) solid transparent;border-right:calc(var(--loader-size-lg) / 10) solid transparent;border-bottom:calc(var(--loader-size-lg) / 10) solid;animation:rotation 1s linear infinite}nv-loader.size-xl{width:var(--loader-size-xl);height:var(--loader-size-xl)}nv-loader.size-xl::before,nv-loader.size-xl::after{content:" ";position:absolute;top:0;left:0;border-radius:inherit;width:100%;height:100%}nv-loader.size-xl::before{content:" ";border:calc(var(--loader-size-xl) / 10) solid;opacity:0.3}nv-loader.size-xl::after{content:" ";border-top:calc(var(--loader-size-xl) / 10) solid transparent;border-left:calc(var(--loader-size-xl) / 10) solid transparent;border-right:calc(var(--loader-size-xl) / 10) solid transparent;border-bottom:calc(var(--loader-size-xl) / 10) solid;animation:rotation 1s linear infinite}nv-loader.color-brand::before{border-color:var(--components-loader-brand-background);opacity:1}nv-loader.color-brand::after{border-bottom-color:var(--components-loader-brand-foreground)}nv-loader.color-white::before{border-color:var(--components-loader-white-background);opacity:1}nv-loader.color-white::after{border-bottom-color:var(--components-loader-white-foreground)}`;
|
|
147
|
+
|
|
148
|
+
const NvLoader = class {
|
|
149
|
+
constructor(hostRef) {
|
|
150
|
+
index.registerInstance(this, hostRef);
|
|
151
|
+
/****************************************************************************/
|
|
152
|
+
//#region PROPERTIES
|
|
153
|
+
/**
|
|
154
|
+
* Choose the size of the loader to best fit your application’s needs, whether
|
|
155
|
+
* it’s a small spinner for subtle loading indicators or a large one for more
|
|
156
|
+
* prominent displays.
|
|
157
|
+
*/
|
|
158
|
+
this.size = 'md';
|
|
159
|
+
}
|
|
160
|
+
//#endregion PROPERTIES
|
|
161
|
+
/****************************************************************************/
|
|
162
|
+
//#region RENDER
|
|
163
|
+
/* <slot> empty to force rendering change */
|
|
164
|
+
render() {
|
|
165
|
+
return (index.h(index.Host, { key: '0e617a9043f912160b40255feba5c5a9140f1703', class: clsxChV9xqsO.clsx(this.size && `size-${this.size}`, this.color && `color-${this.color}`) }));
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
NvLoader.style = nvLoaderCss();
|
|
169
|
+
|
|
170
|
+
exports.nv_iconbutton = NvIconbutton;
|
|
171
|
+
exports.nv_loader = NvLoader;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-DUlunl9a.js');
|
|
4
4
|
require('@stencil/react-output-target/runtime');
|
|
5
5
|
require('react');
|
|
6
6
|
require('react-dom');
|
|
7
7
|
|
|
8
|
-
const nvMenuCss =
|
|
8
|
+
const nvMenuCss = () => `nv-menuitem{display:flex;align-items:center;max-width:300px;width:100vw;font-size:var(--menu-contextual-item-font-size);font-weight:var(--menu-contextual-item-font-weight);color:var(--components-menu-contextual-item-content);border-radius:var(--menu-contextual-item-radius);gap:var(--menu-contextual-item-gap-x);padding:var(--menu-contextual-item-padding-y) var(--menu-contextual-item-padding-x);transition:background-color 150ms ease-out;cursor:pointer}nv-menuitem:hover,nv-menuitem:focus,nv-menuitem:focus-within{background-color:var(--components-menu-contextual-item-background-hover);color:var(--components-menu-contextual-item-content-hover)}nv-menuitem *{pointer-events:none}nv-menuitem kbd{color:var(--components-menu-contextual-item-shortcut)}nv-menuitem [data-scope=text]{margin-right:auto}nv-menuitem[disabled]:not([disabled=false]){cursor:unset;background-color:unset;color:var(--components-menu-contextual-item-content-disabled)}nv-menu{display:inline-block;position:relative}nv-menu:has([fluid]:not([fluid=false])){display:block}nv-menu nv-popover{display:unset}nv-menu nv-popover [data-scope=popover]{background-color:transparent !important;padding:0 !important}nv-menu [slot=content]{padding:var(--menu-contextual-padding-y) var(--menu-contextual-padding-x);border-radius:var(--menu-contextual-radius);gap:var(--menu-contextual-gap-y);background-color:var(--components-menu-contextual-background);border-color:var(--components-menu-contextual-border);display:flex;flex-direction:column}nv-menu nv-menu[open]:not([open=false])>nv-menuitem{background-color:var(--components-menu-contextual-item-background-hover);color:var(--components-menu-contextual-item-content-hover)}nv-menu hr{display:block;margin:var(--menu-contextual-divider-padding-top) var(--menu-contextual-divider-padding-x) var(--menu-contextual-divider-padding-bottom) var(--menu-contextual-divider-padding-x)}`;
|
|
9
9
|
|
|
10
10
|
const NvMenu = class {
|
|
11
11
|
constructor(hostRef) {
|
|
12
12
|
index.registerInstance(this, hostRef);
|
|
13
|
-
this.menuitemSelected = index.createEvent(this, "menuitemSelected",
|
|
13
|
+
this.menuitemSelected = index.createEvent(this, "menuitemSelected", 7);
|
|
14
14
|
this.isHandlingKeyDown = false;
|
|
15
15
|
/****************************************************************************/
|
|
16
16
|
//#region PROPERTIES
|
|
@@ -45,11 +45,10 @@ const NvMenu = class {
|
|
|
45
45
|
*/
|
|
46
46
|
this.renderMenuItems = () => {
|
|
47
47
|
return this.items.map(item => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return (index.h("nv-menu", { nested: true, placement: "right-start", items: item.submenuItems }, index.h("nv-menuitem", { slot: "trigger", hasSubmenu: true, disabled: item.disabled, icon: item.icon, shortcut: item.shortcut, id: item.value, name: item.label, label: item.label, onMenuitemSelected: e => this.menuitemSelected.emit(e.detail) })));
|
|
48
|
+
if (item.hasSubmenu && item.submenuItems?.length > 0) {
|
|
49
|
+
return (index.h("nv-menu", { nested: true, placement: "right-start", items: item.submenuItems }, index.h("nv-menuitem", { slot: "trigger", hasSubmenu: true, disabled: item.disabled, icon: item.icon, shortcut: item.shortcut, id: item.value, name: item.label, label: item.label })));
|
|
51
50
|
}
|
|
52
|
-
return (index.h("nv-menuitem", { disabled: item.disabled, icon: item.icon, shortcut: item.shortcut, id: item.value, name: item.label, label: item.label
|
|
51
|
+
return (index.h("nv-menuitem", { disabled: item.disabled, icon: item.icon, shortcut: item.shortcut, id: item.value, name: item.label, label: item.label }));
|
|
53
52
|
});
|
|
54
53
|
};
|
|
55
54
|
}
|
|
@@ -84,7 +83,6 @@ const NvMenu = class {
|
|
|
84
83
|
//#endregion EVENTS
|
|
85
84
|
/****************************************************************************/
|
|
86
85
|
//#region LISTENERS
|
|
87
|
-
/* eslint-disable nova/native-event-listener */
|
|
88
86
|
handleMenuItemSelect(event) {
|
|
89
87
|
if (this.disableCloseOnSelect)
|
|
90
88
|
return;
|
|
@@ -92,7 +90,6 @@ const NvMenu = class {
|
|
|
92
90
|
return;
|
|
93
91
|
this.open = false;
|
|
94
92
|
}
|
|
95
|
-
/* eslint-enable nova/native-event-listener */
|
|
96
93
|
handleKeydown(event) {
|
|
97
94
|
// If the menu is not open, check if the trigger is focused
|
|
98
95
|
// and the user presses Enter or ArrowDown, open the menu
|
|
@@ -129,7 +126,7 @@ const NvMenu = class {
|
|
|
129
126
|
return;
|
|
130
127
|
}
|
|
131
128
|
const menuContent = this.el.querySelector('[slot="content"]');
|
|
132
|
-
const menuItems = Array.from(menuContent.childNodes).filter(item =>
|
|
129
|
+
const menuItems = Array.from(menuContent.childNodes).filter(item => item.matches?.('nv-menuitem, nv-menu'));
|
|
133
130
|
let currentIndex = menuItems.indexOf(document.activeElement);
|
|
134
131
|
if (currentIndex === -1)
|
|
135
132
|
currentIndex = menuItems.indexOf(document.activeElement.parentElement);
|
|
@@ -191,16 +188,14 @@ const NvMenu = class {
|
|
|
191
188
|
//#endregion LISTENERS
|
|
192
189
|
/****************************************************************************/
|
|
193
190
|
//#region LIFECYCLE
|
|
194
|
-
|
|
195
|
-
this.triggerElement =
|
|
196
|
-
return child.getAttribute('slot') === 'trigger';
|
|
197
|
-
});
|
|
191
|
+
componentWillRender() {
|
|
192
|
+
this.triggerElement = this.el.querySelector('[slot="trigger"]');
|
|
198
193
|
}
|
|
199
194
|
render() {
|
|
200
|
-
return (index.h(index.Host, { key: '
|
|
195
|
+
return (index.h(index.Host, { key: 'de2604e6681418f23352dc436ac6dfb64d3d3a8d' }, index.h("slot", { key: '26afcd55842377b82a3f6d1f63d2f87eff4f6001', name: "trigger" }), index.h("nv-popover", { key: '03466649d538b909070feb3c50e18a35ee7dda19', 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" })))));
|
|
201
196
|
}
|
|
202
197
|
get el() { return index.getElement(this); }
|
|
203
198
|
};
|
|
204
|
-
NvMenu.style = nvMenuCss;
|
|
199
|
+
NvMenu.style = nvMenuCss();
|
|
205
200
|
|
|
206
201
|
exports.nv_menu = NvMenu;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-DUlunl9a.js');
|
|
4
|
+
require('@stencil/react-output-target/runtime');
|
|
5
|
+
require('react');
|
|
6
|
+
require('react-dom');
|
|
7
|
+
|
|
8
|
+
const nvMenuitemCss = () => `nv-menuitem{display:flex;align-items:center;max-width:300px;width:100vw;font-size:var(--menu-contextual-item-font-size);font-weight:var(--menu-contextual-item-font-weight);color:var(--components-menu-contextual-item-content);border-radius:var(--menu-contextual-item-radius);gap:var(--menu-contextual-item-gap-x);padding:var(--menu-contextual-item-padding-y) var(--menu-contextual-item-padding-x);transition:background-color 150ms ease-out;cursor:pointer}nv-menuitem:hover,nv-menuitem:focus,nv-menuitem:focus-within{background-color:var(--components-menu-contextual-item-background-hover);color:var(--components-menu-contextual-item-content-hover)}nv-menuitem *{pointer-events:none}nv-menuitem kbd{color:var(--components-menu-contextual-item-shortcut)}nv-menuitem [data-scope=text]{margin-right:auto}nv-menuitem[disabled]:not([disabled=false]){cursor:unset;background-color:unset;color:var(--components-menu-contextual-item-content-disabled)}`;
|
|
9
|
+
|
|
10
|
+
const NvMenuitem = class {
|
|
11
|
+
constructor(hostRef) {
|
|
12
|
+
index.registerInstance(this, hostRef);
|
|
13
|
+
this.menuitemSelected = index.createEvent(this, "menuitemSelected", 7);
|
|
14
|
+
/**
|
|
15
|
+
* Disables the item, preventing user interaction.
|
|
16
|
+
*/
|
|
17
|
+
this.disabled = false;
|
|
18
|
+
/**
|
|
19
|
+
* If the menu item has a submenu, the a caret icon will be displayed.
|
|
20
|
+
*/
|
|
21
|
+
this.hasSubmenu = false;
|
|
22
|
+
}
|
|
23
|
+
handleMenuItemSelect(event) {
|
|
24
|
+
// If the element is disabled, stop propagation
|
|
25
|
+
if (this.disabled) {
|
|
26
|
+
event.stopPropagation();
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
this.menuitemSelected.emit({
|
|
30
|
+
id: this.el.id,
|
|
31
|
+
name: this.name,
|
|
32
|
+
hasSubmenu: this.hasSubmenu,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
handleClick(event) {
|
|
36
|
+
this.handleMenuItemSelect(event);
|
|
37
|
+
}
|
|
38
|
+
handleKeyDown(event) {
|
|
39
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
40
|
+
const activeElement = document.activeElement;
|
|
41
|
+
if (activeElement &&
|
|
42
|
+
activeElement.tagName === 'NV-MENUITEM' &&
|
|
43
|
+
!activeElement.hasAttribute('has-submenu')) {
|
|
44
|
+
event.preventDefault();
|
|
45
|
+
this.el.click();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//#endregion EVENTS
|
|
50
|
+
/****************************************************************************/
|
|
51
|
+
//#region RENDER
|
|
52
|
+
render() {
|
|
53
|
+
return (index.h(index.Host, { key: '3c05131caa0ee794ee2bbbd9c3a9d589d1fde266', role: "menuitem", tabindex: this.disabled ? '-1' : '0' }, this.icon && index.h("nv-icon", { key: '5d9e236545a19a4291885d26bbc13fed02d3e4bd', name: this.icon }), index.h("slot", { key: 'b020591899e341c5775f662dcdcd1a9894ab85a1' }), this.label && index.h("span", { key: '4984519ed9fefbb1647739ae0eeb4087ff320a01', "data-scope": "text" }, this.label), this.shortcut && !this.hasSubmenu && index.h("kbd", { key: 'bd3e3e3544e7efafa4eaedc212e88e55ad7ea4d0' }, this.shortcut), this.hasSubmenu && index.h("nv-icon", { key: '7b928e7c9ea2892061915ace6c08d3cccbf1655e', name: "chevron-right" })));
|
|
54
|
+
}
|
|
55
|
+
get el() { return index.getElement(this); }
|
|
56
|
+
};
|
|
57
|
+
NvMenuitem.style = nvMenuitemCss();
|
|
58
|
+
|
|
59
|
+
exports.nv_menuitem = NvMenuitem;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-DUlunl9a.js');
|
|
4
|
+
require('@stencil/react-output-target/runtime');
|
|
5
|
+
require('react');
|
|
6
|
+
require('react-dom');
|
|
7
|
+
|
|
8
|
+
const nvNotificationBulletCss = () => `nv-notification-bullet{display:inline-flex;align-items:center;justify-content:center;min-width:var(--sidebar-notification-bullet-size);max-width:var(--sidebar-notification-bullet-size);height:var(--sidebar-notification-bullet-size);padding:0 var(--spacing-1);border-radius:var(--radius-rounded-full);font-size:var(--sidebar-notification-bullet-font-size);font-weight:var(--sidebar-notification-bullet-font-weight);white-space:nowrap;flex-shrink:0;position:relative;}nv-notification-bullet.nv-notification-bullet-brand .nv-notification-bullet{display:inline-flex;align-items:center;justify-content:center;min-width:var(--sidebar-notification-bullet-size);max-width:var(--sidebar-notification-bullet-size);height:var(--sidebar-notification-bullet-size);padding:0 var(--spacing-1);border-radius:var(--radius-rounded-full);font-size:var(--sidebar-notification-bullet-font-size);font-weight:var(--sidebar-notification-bullet-font-weight);white-space:nowrap;flex-shrink:0}nv-notification-bullet.nv-notification-bullet-brand .nv-notification-bullet.nv-notification-bullet-high{background-color:var(--color-brand-500);color:var(--color-feedback-neutral-high-contrast-title)}nv-notification-bullet.nv-notification-bullet-brand .nv-notification-bullet.nv-notification-bullet-low{background-color:var(--color-brand-50);color:var(--color-brand-600);border:1px solid var(--color-brand-600)}nv-notification-bullet{}nv-notification-bullet.nv-notification-bullet-neutral{display:inline-flex;align-items:center;justify-content:center;min-width:var(--sidebar-notification-bullet-size);max-width:var(--sidebar-notification-bullet-size);height:var(--sidebar-notification-bullet-size);padding:0 var(--spacing-1);border-radius:var(--radius-rounded-full);font-size:var(--sidebar-notification-bullet-font-size);font-weight:var(--sidebar-notification-bullet-font-weight);white-space:nowrap;flex-shrink:0}nv-notification-bullet.nv-notification-bullet-neutral .nv-notification-bullet.nv-notification-bullet-high{background-color:var(--color-feedback-neutral-high-contrast-background);color:var(--color-feedback-neutral-high-contrast-title)}nv-notification-bullet.nv-notification-bullet-neutral .nv-notification-bullet.nv-notification-bullet-low{background-color:var(--color-feedback-neutral-low-background);color:var(--color-feedback-neutral-low-text);border-radius:var(--radius-rounded-full)}nv-notification-bullet{}nv-notification-bullet.nv-notification-bullet-with-cross-border::before{content:"";position:absolute;top:55%;left:45%;transform:translate(-50%, -50%);width:calc(var(--sidebar-notification-bullet-size) + 1.5px);height:calc(var(--sidebar-notification-bullet-size) * 1.5);border-radius:var(--radius-rounded-full);background-color:var(--nv-component-background, var(--nv-sidebarnavitem-background, var(--color-interaction-container-neutral-background)));z-index:-1;pointer-events:none}nv-notification-bullet{}nv-sidebar[collapsed] nv-notification-bullet.nv-notification-bullet-with-cross-border::before{width:calc(var(--sidebar-notification-bullet-size-reduced) * 1.5);height:calc(var(--sidebar-notification-bullet-size-reduced) * 1.5)}nv-notification-bullet{}nv-notification-bullet .nv-notification-bullet.nv-notification-bullet-reduced,nv-sidebar[collapsed] nv-notification-bullet .nv-notification-bullet{width:var(--sidebar-notification-bullet-size-reduced);height:var(--sidebar-notification-bullet-size-reduced);min-width:var(--sidebar-notification-bullet-size-reduced);max-width:var(--sidebar-notification-bullet-size-reduced);min-height:var(--sidebar-notification-bullet-size-reduced);max-height:var(--sidebar-notification-bullet-size-reduced);padding:0;font-size:0}`;
|
|
9
|
+
|
|
10
|
+
const NvNotificationBullet = class {
|
|
11
|
+
constructor(hostRef) {
|
|
12
|
+
index.registerInstance(this, hostRef);
|
|
13
|
+
/**
|
|
14
|
+
* Determines the size of the notification bullet.
|
|
15
|
+
* - default: Normal size with text visible
|
|
16
|
+
* - reduced: Smaller size, text hidden (just a dot)
|
|
17
|
+
*/
|
|
18
|
+
this.size = 'default';
|
|
19
|
+
/**
|
|
20
|
+
* Allows to add a border to add contrast on background.
|
|
21
|
+
*/
|
|
22
|
+
this.contrastingBorder = false;
|
|
23
|
+
}
|
|
24
|
+
//#endregion PROPERTIES
|
|
25
|
+
/****************************************************************************/
|
|
26
|
+
//#region METHODS
|
|
27
|
+
getIntention() {
|
|
28
|
+
if (this.intention) {
|
|
29
|
+
return this.intention;
|
|
30
|
+
}
|
|
31
|
+
// Inherit from parent nv-sidebar
|
|
32
|
+
const sidebar = this.el.closest('nv-sidebar');
|
|
33
|
+
if (sidebar) {
|
|
34
|
+
const sidebarIntention = sidebar.getAttribute('notification-intention');
|
|
35
|
+
if (sidebarIntention === 'neutral' || sidebarIntention === 'brand') {
|
|
36
|
+
return sidebarIntention;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return 'brand'; // Default fallback
|
|
40
|
+
}
|
|
41
|
+
getEmphasis() {
|
|
42
|
+
if (this.emphasis) {
|
|
43
|
+
return this.emphasis;
|
|
44
|
+
}
|
|
45
|
+
// Inherit from parent nv-sidebar
|
|
46
|
+
const sidebar = this.el.closest('nv-sidebar');
|
|
47
|
+
if (sidebar) {
|
|
48
|
+
const sidebarEmphasis = sidebar.getAttribute('notification-emphasis');
|
|
49
|
+
if (sidebarEmphasis === 'high' || sidebarEmphasis === 'low') {
|
|
50
|
+
return sidebarEmphasis;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return 'high'; // Default fallback
|
|
54
|
+
}
|
|
55
|
+
//#region RENDER
|
|
56
|
+
render() {
|
|
57
|
+
const displayCount = this.count ?? 0;
|
|
58
|
+
const displayText = displayCount > 99 ? '99+' : String(displayCount);
|
|
59
|
+
if (displayCount <= 0) {
|
|
60
|
+
return index.h(index.Host, { style: { display: 'none' } });
|
|
61
|
+
}
|
|
62
|
+
const sizeClass = this.size === 'reduced' ? 'nv-notification-bullet-reduced' : '';
|
|
63
|
+
const intention = this.getIntention();
|
|
64
|
+
const emphasis = this.getEmphasis();
|
|
65
|
+
const intentionClass = `nv-notification-bullet-${intention}`;
|
|
66
|
+
const emphasisClass = `nv-notification-bullet-${emphasis}`;
|
|
67
|
+
const borderClass = this.contrastingBorder
|
|
68
|
+
? 'nv-notification-bullet-with-border'
|
|
69
|
+
: '';
|
|
70
|
+
return (index.h(index.Host, { class: `${intentionClass} ${borderClass ? 'nv-notification-bullet-with-cross-border' : ''}` }, index.h("span", { class: `nv-notification-bullet ${emphasisClass} ${sizeClass} ${borderClass}`, "aria-label": `${displayCount} notifications` }, displayText)));
|
|
71
|
+
}
|
|
72
|
+
get el() { return index.getElement(this); }
|
|
73
|
+
};
|
|
74
|
+
NvNotificationBullet.style = nvNotificationBulletCss();
|
|
75
|
+
|
|
76
|
+
exports.nv_notification_bullet = NvNotificationBullet;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-DUlunl9a.js');
|
|
4
|
+
var constantsBReL3Lsa = require('./constants-BReL3Lsa-DpB_ghPF.js');
|
|
5
|
+
var collapse_animationDZDm0vSK = require('./collapse.animation-DZDm0vSK-C2TOIhIK.js');
|
|
6
|
+
var fade_animationDcRL9lcm = require('./fade.animation-DcRL9lcm-DAZeHoKN.js');
|
|
7
|
+
require('./style-value-types.es-xlgmw4x8-B1vLqX9m.js');
|
|
8
|
+
var slide_animationCmH5d1of = require('./slide.animation-CmH5d1of-BZuw607U.js');
|
|
9
|
+
var timeline_animationCgHCo_Ho = require('./timeline.animation-CgHCo_Ho-KteJaZPb.js');
|
|
10
|
+
var v4BdYh22OP = require('./v4-BdYh22OP-C1vaJ4yP.js');
|
|
11
|
+
require('@stencil/react-output-target/runtime');
|
|
12
|
+
require('react');
|
|
13
|
+
require('react-dom');
|
|
14
|
+
|
|
15
|
+
const nvNotificationCss = () => `nv-notification{display:block}nv-notification [data-scope=container]{display:flex;position:relative;max-width:512px;width:100%;padding:var(--notification-padding);align-items:flex-start;gap:var(--notification-gap-x);border-radius:var(--notification-radius);border-style:solid;box-shadow:0 var(--shadow-y-axis-lg-1, 4px) var(--shadow-blur-lg-1, 6px) var(--shadow-spread-lg-1, -2px) var(--shadow-color-opacity-1, rgba(14, 14, 14, 0.06)), 0 var(--shadow-y-axis-lg-2, 10px) var(--shadow-blur-lg-2, 15px) var(--shadow-spread-lg-2, -3px) var(--shadow-color-opacity-2, rgba(14, 14, 14, 0.1))}nv-notification [data-scope=container] [data-scope=icon]{flex-shrink:0}nv-notification [data-scope=container] [data-scope=dismiss]{padding:var(--button-sm-icon-button-padding, 8px);justify-content:center;align-items:center;gap:var(--button-sm-gap, 6px);display:flex;position:absolute;right:8px;top:8px;border-radius:var(--button-sm-border-radius, 4px);background:var(--components-button-lower-background, rgba(255, 255, 255, 0));color:var(--components-button-lower-icon)}nv-notification [data-scope=container] [data-scope=content]{display:flex;padding-right:var(--notification-padding-right);flex-direction:column;align-items:flex-start;gap:var(--notification-gap-y);flex:1 0 0}nv-notification [data-scope=container] [data-scope=content] [data-scope=heading]{display:flex;align-items:flex-start;gap:var(--notification-gap-x);align-self:stretch;color:var(--components-notification-content-title);font-size:var(--notification-title-font-size);font-style:normal;font-weight:var(--font-weight-medium-emphasis);line-height:20px;}nv-notification [data-scope=container] [data-scope=content] [data-scope=message]{display:flex;flex-direction:column;align-items:flex-start;gap:var(--notification-gap-y);align-self:stretch;color:var(--components-notification-content-description);font-variant-numeric:lining-nums tabular-nums slashed-zero;font-size:var(--font-size-sm, 14px);font-style:normal;font-weight:var(--font-weight-low-emphasis);line-height:var(--line-height-sm, 20px)}nv-notification [data-scope=container] [data-scope=content] [data-scope=actions]{display:flex;padding:var(--spacing-2, 8px) 0;padding-bottom:0px;align-items:flex-start;gap:var(--notification-gap-x);align-self:stretch;margin-left:calc(-1 * var(--button-sm-padding-x))}nv-notification[feedback=information] [data-scope=container]{background-color:var(--components-notification-information-background);border-color:var(--components-notification-information-border)}nv-notification[feedback=information] [data-scope=container] [data-scope=icon]{color:var(--components-notification-information-icon)}nv-notification[feedback=information]>[data-scope=close]:focus,nv-notification[feedback=information]>[data-scope=close]:focus-within{outline:none}nv-notification[feedback=information]>[data-scope=close]:focus-visible,nv-notification[feedback=information]>[data-scope=close]:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-notification-information-border);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-notification[feedback=warning] [data-scope=container]{background-color:var(--components-notification-warning-background);border-color:var(--components-notification-warning-border)}nv-notification[feedback=warning] [data-scope=container] [data-scope=icon]{color:var(--components-notification-warning-icon)}nv-notification[feedback=warning]>[data-scope=close]:focus,nv-notification[feedback=warning]>[data-scope=close]:focus-within{outline:none}nv-notification[feedback=warning]>[data-scope=close]:focus-visible,nv-notification[feedback=warning]>[data-scope=close]:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-notification-warning-border);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-notification[feedback=error] [data-scope=container]{background-color:var(--components-notification-error-background);border-color:var(--components-notification-error-border)}nv-notification[feedback=error] [data-scope=container] [data-scope=icon]{color:var(--components-notification-error-icon)}nv-notification[feedback=error]>[data-scope=close]:focus,nv-notification[feedback=error]>[data-scope=close]:focus-within{outline:none}nv-notification[feedback=error]>[data-scope=close]:focus-visible,nv-notification[feedback=error]>[data-scope=close]:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-notification-error-border);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-notification[feedback=success] [data-scope=container]{background-color:var(--components-notification-success-background);border-color:var(--components-notification-success-border)}nv-notification[feedback=success] [data-scope=container] [data-scope=icon]{color:var(--components-notification-success-icon)}nv-notification[feedback=success]>[data-scope=close]:focus,nv-notification[feedback=success]>[data-scope=close]:focus-within{outline:none}nv-notification[feedback=success]>[data-scope=close]:focus-visible,nv-notification[feedback=success]>[data-scope=close]:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-notification-success-border);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-notification[feedback=neutral] [data-scope=container]{background-color:var(--components-notification-neutral-background);border-color:var(--components-notification-neutral-border)}nv-notification[feedback=neutral] [data-scope=container] [data-scope=icon]{color:var(--components-notification-neutral-icon)}nv-notification[feedback=neutral]>[data-scope=close]:focus,nv-notification[feedback=neutral]>[data-scope=close]:focus-within{outline:none}nv-notification[feedback=neutral]>[data-scope=close]:focus-visible,nv-notification[feedback=neutral]>[data-scope=close]:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-notification-neutral-border);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-notification[emphasis=high] [data-scope=container]{border-width:1px;border-left-width:var(--notification-border-width-high-emphasis);padding-left:calc(var(--notification-padding) - var(--notification-border-width-high-emphasis) + 1px)}nv-notification[emphasis=medium] [data-scope=container]{border-width:var(--notification-border-width-low-emphasis);border-color:var(--color-content-low-border, #E3E3E3)}`;
|
|
16
|
+
|
|
17
|
+
const NvNotification = class {
|
|
18
|
+
constructor(hostRef) {
|
|
19
|
+
index.registerInstance(this, hostRef);
|
|
20
|
+
this.hiddenChanged = index.createEvent(this, "hiddenChanged", 3);
|
|
21
|
+
/****************************************************************************/
|
|
22
|
+
//#region PROPERTIES
|
|
23
|
+
/**
|
|
24
|
+
* Set a unique ID for the notification. Used for aria attributes and managing
|
|
25
|
+
* multiple notifications.
|
|
26
|
+
*/
|
|
27
|
+
this.uid = v4BdYh22OP.v4();
|
|
28
|
+
/**
|
|
29
|
+
* Specifies the notification type which determines the color and default icon.
|
|
30
|
+
*/
|
|
31
|
+
this.feedback = 'information';
|
|
32
|
+
/**
|
|
33
|
+
* Adjusts the emphasis to make the notification more or less visually
|
|
34
|
+
* prominent to users. Use this to draw attention to important actions or
|
|
35
|
+
* reduce focus on less critical ones
|
|
36
|
+
*/
|
|
37
|
+
this.emphasis = 'medium';
|
|
38
|
+
/**
|
|
39
|
+
* Allows the notification to be dismissed via a close button (x). The
|
|
40
|
+
* notification is not dismissible unless explicitly enabled.
|
|
41
|
+
*/
|
|
42
|
+
this.dismissible = false;
|
|
43
|
+
/**
|
|
44
|
+
* Controls the visibility of the notification.
|
|
45
|
+
*/
|
|
46
|
+
this.hidden = false; // eslint-disable-line @stencil-community/reserved-member-names
|
|
47
|
+
/**
|
|
48
|
+
* When true, the notification will be hidden initially, but internal changes
|
|
49
|
+
* will not be in a controlled state. Good for animating the notification in.
|
|
50
|
+
*/
|
|
51
|
+
this.initiallyHidden = false;
|
|
52
|
+
//#endregion EVENTS
|
|
53
|
+
/****************************************************************************/
|
|
54
|
+
//#region INTERNAL
|
|
55
|
+
this.iconByFeedback = {
|
|
56
|
+
[constantsBReL3Lsa.FeedbackColors.Warning]: 'alert-circle',
|
|
57
|
+
[constantsBReL3Lsa.FeedbackColors.Information]: 'info-circle',
|
|
58
|
+
[constantsBReL3Lsa.FeedbackColors.Success]: 'circle-check',
|
|
59
|
+
[constantsBReL3Lsa.FeedbackColors.Error]: 'alert-triangle',
|
|
60
|
+
[constantsBReL3Lsa.FeedbackColors.Neutral]: 'help',
|
|
61
|
+
};
|
|
62
|
+
this.roleByFeedback = {
|
|
63
|
+
[constantsBReL3Lsa.FeedbackColors.Error]: 'alert',
|
|
64
|
+
[constantsBReL3Lsa.FeedbackColors.Warning]: 'alert',
|
|
65
|
+
[constantsBReL3Lsa.FeedbackColors.Information]: 'status',
|
|
66
|
+
[constantsBReL3Lsa.FeedbackColors.Success]: 'status',
|
|
67
|
+
[constantsBReL3Lsa.FeedbackColors.Neutral]: 'status',
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
//#endregion PROPERTIES
|
|
71
|
+
/****************************************************************************/
|
|
72
|
+
//#region METHODS
|
|
73
|
+
/**
|
|
74
|
+
* Dismisses the notification with an animation, after the animation is
|
|
75
|
+
* complete, the hiddenChanged event will be emitted with the value of true,
|
|
76
|
+
* and the hidden prop will be set to true.
|
|
77
|
+
*/
|
|
78
|
+
async dismiss() {
|
|
79
|
+
await this.dismissAnimation();
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Sets the hidden prop to false, and shows the notification with an
|
|
83
|
+
* animation, after the animation is complete, the hiddenChanged event will be
|
|
84
|
+
* emitted with the value of false.
|
|
85
|
+
*/
|
|
86
|
+
async show() {
|
|
87
|
+
await this.showAnimation();
|
|
88
|
+
}
|
|
89
|
+
getDefaultIcon() {
|
|
90
|
+
return this.iconByFeedback[this.feedback] ?? 'info-circle';
|
|
91
|
+
}
|
|
92
|
+
getAriaRole() {
|
|
93
|
+
return this.roleByFeedback[this.feedback] ?? 'status';
|
|
94
|
+
}
|
|
95
|
+
getAriaLive() {
|
|
96
|
+
return this.getAriaRole() === 'alert' ? 'assertive' : 'polite';
|
|
97
|
+
}
|
|
98
|
+
getHeadingId() {
|
|
99
|
+
return this.heading ? `nv-notification-${this.uid}-heading` : null;
|
|
100
|
+
}
|
|
101
|
+
getMessageId() {
|
|
102
|
+
return this.message ? `nv-notification-${this.uid}-message` : null;
|
|
103
|
+
}
|
|
104
|
+
async showAnimation() {
|
|
105
|
+
this.hidden = false;
|
|
106
|
+
const { setFadeIn } = fade_animationDcRL9lcm.useFade(this.container);
|
|
107
|
+
const { expand } = collapse_animationDZDm0vSK.useCollapse(this.el, {
|
|
108
|
+
duration: 300,
|
|
109
|
+
overflow: 'visible',
|
|
110
|
+
});
|
|
111
|
+
const { slideY, setSlideY } = slide_animationCmH5d1of.useSlide(this.container, {
|
|
112
|
+
duration: 300,
|
|
113
|
+
});
|
|
114
|
+
setSlideY(-100);
|
|
115
|
+
setFadeIn();
|
|
116
|
+
await timeline_animationCgHCo_Ho.parallel(slideY({ from: -100, to: 0 }), expand).start();
|
|
117
|
+
this.hiddenChanged.emit(false);
|
|
118
|
+
}
|
|
119
|
+
getSlideDestination(pos) {
|
|
120
|
+
switch (pos) {
|
|
121
|
+
case constantsBReL3Lsa.NotificationPosition.TopRight:
|
|
122
|
+
case constantsBReL3Lsa.NotificationPosition.BottomRight:
|
|
123
|
+
return { axis: 'x', to: 100 }; // right
|
|
124
|
+
case constantsBReL3Lsa.NotificationPosition.TopLeft:
|
|
125
|
+
case constantsBReL3Lsa.NotificationPosition.BottomLeft:
|
|
126
|
+
return { axis: 'x', to: -100 }; // left
|
|
127
|
+
case constantsBReL3Lsa.NotificationPosition.TopCenter:
|
|
128
|
+
return { axis: 'y', to: -100 }; // up
|
|
129
|
+
case constantsBReL3Lsa.NotificationPosition.BottomCenter:
|
|
130
|
+
return { axis: 'y', to: 100 }; // down
|
|
131
|
+
default:
|
|
132
|
+
return { axis: 'x', to: 100 }; // fallback
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
async dismissAnimation() {
|
|
136
|
+
const position = this.el
|
|
137
|
+
.closest('nv-notificationcontainer')
|
|
138
|
+
?.getAttribute('position');
|
|
139
|
+
const destination = this.getSlideDestination(position);
|
|
140
|
+
const { fadeOut } = fade_animationDcRL9lcm.useFade(this.container, { duration: 300 });
|
|
141
|
+
const { slideX, slideY, setSlideReset } = slide_animationCmH5d1of.useSlide(this.container, {
|
|
142
|
+
duration: 500,
|
|
143
|
+
});
|
|
144
|
+
const { collapse } = collapse_animationDZDm0vSK.useCollapse(this.el, {
|
|
145
|
+
duration: 500,
|
|
146
|
+
overflow: 'visible',
|
|
147
|
+
});
|
|
148
|
+
const slide = destination.axis === 'x'
|
|
149
|
+
? slideX({ from: 0, to: destination.to })
|
|
150
|
+
: slideY({ from: 0, to: destination.to });
|
|
151
|
+
setSlideReset();
|
|
152
|
+
await timeline_animationCgHCo_Ho.parallel(fadeOut, slide, collapse).start();
|
|
153
|
+
this.hidden = true;
|
|
154
|
+
this.hiddenChanged.emit(true);
|
|
155
|
+
}
|
|
156
|
+
//#endregion INTERNAL
|
|
157
|
+
/****************************************************************************/
|
|
158
|
+
//#region LIFECYCLE
|
|
159
|
+
componentWillLoad() {
|
|
160
|
+
this.headingSlot = this.el.querySelector('[slot="heading"]');
|
|
161
|
+
this.messageSlot = this.el.querySelector('[slot="content"]');
|
|
162
|
+
this.actionsSlot = this.el.querySelector('[slot="actions"]');
|
|
163
|
+
if (this.initiallyHidden)
|
|
164
|
+
this.hidden = true;
|
|
165
|
+
}
|
|
166
|
+
//#endregion LIFECYCLE
|
|
167
|
+
/****************************************************************************/
|
|
168
|
+
//#region RENDER
|
|
169
|
+
render() {
|
|
170
|
+
return (index.h(index.Host, { key: 'f8d336b349e7a71862bfa058022deee6fcf0a956', 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: 'e75e6bd61a041bac249d77459ebcb3ac98dc54b7', "data-scope": "container", ref: el => (this.container = el) }, this.dismissible && (index.h("button", { key: 'b87bf092486682914d8c22612cb93c1f12027753', "data-scope": "dismiss", type: "button", onClick: this.dismiss.bind(this) }, index.h("nv-icon", { key: '95436607fe33bb5fc899af9dd430413b99c4615f', name: "x", size: "sm" }))), index.h("nv-icon", { key: '9962cdd859425b7c542fee370b637288aeb9a63f', name: this.icon ?? this.getDefaultIcon(), size: "md", "data-scope": "icon" }), index.h("div", { key: '8056d8d40228eea6de9dd8cc243f1a99b5fb23c1', "data-scope": "content" }, (this.heading || this.headingSlot) && (index.h("p", { key: '4d13e9d221f3ca0f7dbba81afdb77a6e57c55983', id: this.getHeadingId(), "data-scope": "heading" }, index.h("slot", { key: '6ab11ef7c73caa7864c44c58870c3ee7519e48a4', name: "heading" }, this.heading))), (this.message || this.messageSlot) && (index.h("p", { key: '8002e001201393026b28a55c17d51568e4d60aa3', id: this.getMessageId(), "data-scope": "message" }, index.h("slot", { key: 'ae7bac61287736609a9101c185d7ef3a6f0aee5d', name: "content" }, this.message))), this.actionsSlot && (index.h("div", { key: '7116aaf907928256e971c737730d1908bdb72b6a', "data-scope": "actions" }, index.h("slot", { key: 'ffe5530dccfbdea2b26646b376c22c008c67f77c', name: "actions" })))))));
|
|
171
|
+
}
|
|
172
|
+
get el() { return index.getElement(this); }
|
|
173
|
+
};
|
|
174
|
+
NvNotification.style = nvNotificationCss();
|
|
175
|
+
|
|
176
|
+
exports.nv_notification = NvNotification;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-DUlunl9a.js');
|
|
4
|
+
require('@stencil/react-output-target/runtime');
|
|
5
|
+
require('react');
|
|
6
|
+
require('react-dom');
|
|
7
|
+
|
|
8
|
+
const nvNotificationcontainerCss = () => `nv-notificationcontainer{position:fixed;display:flex;flex-direction:column;padding:var(--spacing-2);padding-top:0;z-index:9999;pointer-events:none;width:100%;max-width:512px}nv-notificationcontainer.position-top-right{top:0;right:0}nv-notificationcontainer.position-top-right nv-notification{margin-top:var(--spacing-2)}nv-notificationcontainer.position-top-left{top:0;left:0}nv-notificationcontainer.position-top-left nv-notification{margin-bottom:var(--spacing-2)}nv-notificationcontainer.position-top-center{top:0;left:50%;transform:translateX(-50%)}nv-notificationcontainer.position-top-center nv-notification{margin-bottom:var(--spacing-2)}nv-notificationcontainer.position-bottom-right{bottom:0;right:0;flex-direction:column-reverse}nv-notificationcontainer.position-bottom-right nv-notification{margin-top:var(--spacing-2)}nv-notificationcontainer.position-bottom-left{bottom:0;left:0;flex-direction:column-reverse}nv-notificationcontainer.position-bottom-left nv-notification{margin-top:var(--spacing-2)}nv-notificationcontainer.position-bottom-center{bottom:0;left:50%;transform:translateX(-50%);flex-direction:column-reverse}nv-notificationcontainer.position-bottom-center nv-notification{margin-top:var(--spacing-2)}nv-notificationcontainer>*{pointer-events:auto}`;
|
|
9
|
+
|
|
10
|
+
const NvNotificationContainer = class {
|
|
11
|
+
constructor(hostRef) {
|
|
12
|
+
index.registerInstance(this, hostRef);
|
|
13
|
+
/****************************************************************************/
|
|
14
|
+
//#region PROPERTIES
|
|
15
|
+
/**
|
|
16
|
+
* Position of the notification container on the screen.
|
|
17
|
+
*/
|
|
18
|
+
this.position = 'top-right';
|
|
19
|
+
}
|
|
20
|
+
//#endregion PROPERTIES
|
|
21
|
+
/****************************************************************************/
|
|
22
|
+
//#region METHODS
|
|
23
|
+
//#endregion METHODS
|
|
24
|
+
/****************************************************************************/
|
|
25
|
+
//#region WATCHERS
|
|
26
|
+
//#endregion WATCHERS
|
|
27
|
+
/****************************************************************************/
|
|
28
|
+
//#region LIFECYCLE
|
|
29
|
+
//#endregion LIFECYCLE
|
|
30
|
+
/****************************************************************************/
|
|
31
|
+
//#region EVENTS
|
|
32
|
+
//#endregion EVENTS
|
|
33
|
+
/****************************************************************************/
|
|
34
|
+
//#region RENDER
|
|
35
|
+
render() {
|
|
36
|
+
return (index.h(index.Host, { key: 'a3fd9f89cf68fbd203b2bc669a85c3e33a9b9cb7', class: `position-${this.position}` }, index.h("slot", { key: '972e9722ec2ac5d909066d46ab9a9d3de4626ee6' })));
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
NvNotificationContainer.style = nvNotificationcontainerCss();
|
|
40
|
+
|
|
41
|
+
exports.nv_notificationcontainer = NvNotificationContainer;
|