@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
|
@@ -1,6 +1,6 @@
|
|
|
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');
|
|
@@ -68,7 +68,7 @@ function calculateNewWidth(startWidth, delta, minWidth = TABLE_CONSTANTS.MIN_W)
|
|
|
68
68
|
* @returns {element is HTMLTableCellElement} Type guard for table cell elements
|
|
69
69
|
*/
|
|
70
70
|
function isValidTableCell(element) {
|
|
71
|
-
return
|
|
71
|
+
return element?.tagName === 'TH' || element?.tagName === 'TD';
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
74
|
* Finds the closest table cell element from an event target
|
|
@@ -88,12 +88,11 @@ function getClosestTableCell(target) {
|
|
|
88
88
|
* @returns {boolean} True if capture was successfully set
|
|
89
89
|
*/
|
|
90
90
|
function setPointerCapture(cell, pointerId) {
|
|
91
|
-
var _a;
|
|
92
91
|
try {
|
|
93
|
-
|
|
92
|
+
cell.setPointerCapture?.(pointerId);
|
|
94
93
|
return true;
|
|
95
94
|
}
|
|
96
|
-
catch
|
|
95
|
+
catch {
|
|
97
96
|
return false;
|
|
98
97
|
}
|
|
99
98
|
}
|
|
@@ -104,12 +103,11 @@ function setPointerCapture(cell, pointerId) {
|
|
|
104
103
|
* @returns {boolean} True if release was successful
|
|
105
104
|
*/
|
|
106
105
|
function releasePointerCapture(cell, pointerId) {
|
|
107
|
-
var _a;
|
|
108
106
|
try {
|
|
109
|
-
|
|
107
|
+
cell.releasePointerCapture?.(pointerId);
|
|
110
108
|
return true;
|
|
111
109
|
}
|
|
112
|
-
catch
|
|
110
|
+
catch {
|
|
113
111
|
return false;
|
|
114
112
|
}
|
|
115
113
|
}
|
|
@@ -180,7 +178,7 @@ function updateCellWidthFromResize(state, event, minWidth = TABLE_CONSTANTS.MIN_
|
|
|
180
178
|
setCellWidth(state.resizingCell, newWidth);
|
|
181
179
|
}
|
|
182
180
|
|
|
183
|
-
const nvTableCss =
|
|
181
|
+
const nvTableCss = () => `nv-table table{border-collapse:separate;border-spacing:0;table-layout:fixed;width:max-content;min-width:100%;background:var(--color-level-00-background)}nv-table table thead{background:var(--components-datagrid-header-background)}nv-table table tbody tr:hover td{background:var(--components-datagrid-body-background-hover)}nv-table table tbody tr[data-selected]{background:var(--components-datagrid-body-background-active)}nv-table table td{height:var(--spacing-16);padding:var(--datagrid-cell-body-padding-y) var(--datagrid-cell-body-padding-x) var(--spacing-2) var(--datagrid-cell-body-padding-x);font-size:var(--font-size-md);font-style:normal;font-weight:var(--font-weight-low-emphasis);line-height:var(--line-height-base);background:var(--components-datagrid-body-background-default);border-bottom:1px solid var(--components-datagrid-body-border)}nv-table table th{position:relative;text-align:left;padding:var(--datagrid-cell-header-padding-y) var(--datagrid-cell-header-padding-right) var(--datagrid-cell-header-padding-y) var(--datagrid-cell-header-padding-x);padding-right:calc(var(--datagrid-cell-header-padding-right) + 12px);color:var(--color-content-low-text);font-variant-numeric:lining-nums tabular-nums slashed-zero;font-size:var(--font-size-md);font-style:normal;font-weight:var(--font-weight-high-emphasis);line-height:var(--line-height-base);min-width:40px;border-bottom:1px solid var(--components-datagrid-header-border);background:var(--components-datagrid-header-background)}nv-table table th::after{content:"";position:absolute;top:0;right:0;width:12px;height:50%;transform:translateY(50%);cursor:col-resize;background:linear-gradient(90deg, transparent 0%, transparent calc(50% - 1px), var(--components-datagrid-header-border), calc(50% - 1px), var(--components-datagrid-header-border) calc(50% + 1px), transparent calc(50% + 1px), transparent 100%);opacity:0;transition:opacity 0.05s ease-in-out}nv-table table th[data-grow]{width:unset}nv-table table th:hover::after{opacity:1}nv-table table th[data-no-resize]::after{display:none}nv-table [data-sticky-left]{position:sticky;z-index:1;background:var(--color-level-00-background);left:0;top:0}nv-table [data-sticky-right]{position:sticky;z-index:1;background:var(--color-level-00-background);right:0;top:0}nv-table [data-sticky-top] th{position:sticky;z-index:1;background:var(--color-level-00-background);top:0}`;
|
|
184
182
|
|
|
185
183
|
const NvTable = class {
|
|
186
184
|
constructor(hostRef) {
|
|
@@ -236,10 +234,10 @@ const NvTable = class {
|
|
|
236
234
|
/****************************************************************************/
|
|
237
235
|
//#region RENDER
|
|
238
236
|
render() {
|
|
239
|
-
return (index.h(index.Host, { key: '
|
|
237
|
+
return (index.h(index.Host, { key: 'c6bb094eb2c2300af460f9acd91a8a5121958ded' }, index.h("slot", { key: 'de523656c119a6338558c48cf46ea25df9c446fd' })));
|
|
240
238
|
}
|
|
241
239
|
get host() { return index.getElement(this); }
|
|
242
240
|
};
|
|
243
|
-
NvTable.style = nvTableCss;
|
|
241
|
+
NvTable.style = nvTableCss();
|
|
244
242
|
|
|
245
243
|
exports.nv_table = NvTable;
|
|
@@ -1,11 +1,11 @@
|
|
|
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 nvTableheaderCss =
|
|
8
|
+
const nvTableheaderCss = () => `nv-tableheader{display:inline-flex;width:100%;align-items:center;gap:var(--spacing-2)}nv-tableheader:focus-visible:focus,nv-tableheader:focus-visible:focus-within{outline:none}nv-tableheader:focus-visible:focus-visible,nv-tableheader:focus-visible:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--color-focus-brand);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-tableheader:focus-visible{border-radius:var(--radius-rounded-sm)}nv-tableheader nv-iconbutton{transition:transform 120ms ease, opacity 120ms ease}nv-tableheader nv-iconbutton svg{transition:transform 240ms ease}nv-tableheader nv-iconbutton.is-none{opacity:0.5}nv-tableheader nv-iconbutton.is-desc svg{transform:rotate(180deg)}`;
|
|
9
9
|
|
|
10
10
|
const NvTableheader = class {
|
|
11
11
|
constructor(hostRef) {
|
|
@@ -31,7 +31,7 @@ const NvTableheader = class {
|
|
|
31
31
|
cycleSortDirection(e) {
|
|
32
32
|
if (!this.sortable)
|
|
33
33
|
return;
|
|
34
|
-
e
|
|
34
|
+
e?.preventDefault();
|
|
35
35
|
const next = {
|
|
36
36
|
none: 'asc',
|
|
37
37
|
asc: 'desc',
|
|
@@ -62,7 +62,7 @@ const NvTableheader = class {
|
|
|
62
62
|
/****************************************************************************/
|
|
63
63
|
//#region RENDER
|
|
64
64
|
render() {
|
|
65
|
-
return (index.h(index.Host, { key: '
|
|
65
|
+
return (index.h(index.Host, { key: 'f704401884c7620a37c932f1aba53c5587e3c0c3', role: "columnheader", "aria-sort": this.ariaSort, tabindex: this.sortable ? 0 : undefined, onKeyDown: this.handleKeyDown.bind(this), onClick: this.cycleSortDirection.bind(this) }, index.h("slot", { key: 'e4fce0b4226dde922d621abf7fbf76efa6b0ceeb' }), this.sortable && (index.h("span", { key: '25cf7526f27eb5e4621434bdadcf169ef60811ab', class: "sort-icon-wrap", "aria-hidden": "true" }, index.h("nv-iconbutton", { key: '39745ade1343e6d1e339b4d451abc3a69d644913', disableTabindex: true, name: "arrow-up", size: "xs", emphasis: this.sortDirection === 'none' ? 'lower' : 'low',
|
|
66
66
|
// prevent mousedown from selecting text
|
|
67
67
|
onMouseDown: (e) => e.preventDefault(), class: {
|
|
68
68
|
'is-none': this.sortDirection === 'none',
|
|
@@ -70,6 +70,6 @@ const NvTableheader = class {
|
|
|
70
70
|
} })))));
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
|
-
NvTableheader.style = nvTableheaderCss;
|
|
73
|
+
NvTableheader.style = nvTableheaderCss();
|
|
74
74
|
|
|
75
75
|
exports.nv_tableheader = NvTableheader;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-DUlunl9a.js');
|
|
4
|
+
var clsxChV9xqsO = require('./clsx-ChV9xqsO-BtxeOLZW.js');
|
|
5
|
+
var v4BdYh22OP = require('./v4-BdYh22OP-C1vaJ4yP.js');
|
|
6
|
+
require('@stencil/react-output-target/runtime');
|
|
7
|
+
require('react');
|
|
8
|
+
require('react-dom');
|
|
9
|
+
|
|
10
|
+
const nvToggleCss = () => `nv-toggle{display:inline-flex;align-items:flex-start;gap:var(--form-gap-x);position:relative}nv-toggle:not([disabled],[readonly]) input,nv-toggle:not([disabled],[readonly]) label{cursor:pointer}nv-toggle.label-placement-before{flex-direction:row-reverse}nv-toggle[disabled]{opacity:0.5}nv-toggle label{align-self:stretch;color:var(--components-form-text-label-default);font-family:var(--font-family-default), var(--font-family-fallback), sans-serif;font-size:var(--form-label-font-size);font-style:normal;font-weight:var(--font-weight-medium-emphasis);line-height:var(--form-label-line-height)}nv-toggle label.visually-hidden{position:absolute;padding:0;border:0;overflow:hidden;white-space:nowrap;width:1px;height:1px;margin:-1px;clip:rect(0, 0, 0, 0)}nv-toggle .input-container{position:relative;color:var(--components-form-shape-foreground-default)}nv-toggle .input-container:has(input[type=checkbox]:disabled:not([readonly])){color:var(--components-form-shape-foreground-disabled)}nv-toggle .input-container input[type=checkbox]{appearance:none;position:relative;display:flex;width:var(--form-toggle-width);height:var(--form-toggle-height);flex-direction:column;align-items:flex-start;border-radius:var(--form-toggle-radius);border-width:var(--form-toggle-border-width);border-style:solid;border-color:var(--components-toggle-border-default);background:var(--components-toggle-background-default)}nv-toggle .input-container input[type=checkbox]::after{content:"";display:block;width:var(--form-toggle-switch-dot-default);height:var(--form-toggle-switch-dot-default);background-color:var(--components-toggle-shape-default);border-radius:var(--radius-rounded-full);position:absolute;top:50%;left:25%;transform:translate(-50%, -50%)}nv-toggle .input-container input[type=checkbox]:hover{border-color:var(--components-toggle-border-hover)}nv-toggle .input-container input[type=checkbox]:hover::after{background-color:var(--components-toggle-shape-hover)}nv-toggle .input-container input[type=checkbox]:focus{border-color:var(--components-toggle-border-default)}nv-toggle .input-container input[type=checkbox]:focus::after{background-color:var(--components-toggle-shape-default)}nv-toggle .input-container input[type=checkbox]:focus,nv-toggle .input-container input[type=checkbox]:focus-within{outline:none}nv-toggle .input-container input[type=checkbox]:focus-visible,nv-toggle .input-container input[type=checkbox]:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--color-focus-brand);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-toggle .input-container input[type=checkbox]:checked{background:var(--components-toggle-background-default-checked);border-color:var(--components-toggle-border-default-checked)}nv-toggle .input-container input[type=checkbox]:checked::after{content:"";display:block;width:var(--form-toggle-switch-dot-default);height:var(--form-toggle-switch-dot-default);background-color:var(--components-toggle-shape-default-checked);border-radius:var(--radius-rounded-full);position:absolute;top:50%;left:75%;transform:translate(-50%, -50%)}nv-toggle .input-container input[type=checkbox]:checked:focus{background:var(--components-toggle-background-default-checked);border-color:var(--components-toggle-border-default-checked)}nv-toggle .input-container input[type=checkbox]:disabled:not([readonly]){box-shadow:unset;background:var(--components-toggle-background-disabled);border-color:var(--components-toggle-border-default)}nv-toggle .input-container input[type=checkbox]:disabled:not([readonly]):checked{background:var(--components-toggle-background-disabled-checked);border-color:var(--components-toggle-border-disabled-checked)}nv-toggle .input-container input[type=checkbox]:disabled:not([readonly]):checked::after{background-color:var(--components-toggle-shape-disabled-checked)}nv-toggle .description{align-self:stretch;color:var(--components-form-text-description-default);font-family:var(--font-family-default), var(--font-family-fallback), sans-serif;font-size:var(--form-description-font-size);font-style:normal;font-weight:450;line-height:var(--form-description-line-height)}nv-toggle .text-container{display:flex;flex-direction:column;align-items:flex-start;flex:1 0 0}`;
|
|
11
|
+
|
|
12
|
+
const NvToggle = class {
|
|
13
|
+
constructor(hostRef) {
|
|
14
|
+
index.registerInstance(this, hostRef);
|
|
15
|
+
this.checkedChanged = index.createEvent(this, "checkedChanged", 3);
|
|
16
|
+
/****************************************************************************/
|
|
17
|
+
//#region PROPERTIES
|
|
18
|
+
/**
|
|
19
|
+
* Sets the ID for the radio button’s input element and the for attribute of
|
|
20
|
+
* the associated label. If no ID is provided, a random one will be
|
|
21
|
+
* automatically generated to ensure unique identification, facilitating
|
|
22
|
+
* proper label association and accessibility.
|
|
23
|
+
*/
|
|
24
|
+
this.inputId = v4BdYh22OP.v4();
|
|
25
|
+
/**
|
|
26
|
+
* Hides the label visually while still keeping it available for screen
|
|
27
|
+
* readers.
|
|
28
|
+
*/
|
|
29
|
+
this.hideLabel = false;
|
|
30
|
+
/** Indicates whether the toggle is checked or not. */
|
|
31
|
+
this.checked = false;
|
|
32
|
+
/** Disables the toggle, preventing user interaction. */
|
|
33
|
+
this.disabled = false;
|
|
34
|
+
/**
|
|
35
|
+
* Sets the toggle to read-only, preventing user changes but still allowing
|
|
36
|
+
* focus and selection of text.
|
|
37
|
+
*/
|
|
38
|
+
this.readonly = false;
|
|
39
|
+
}
|
|
40
|
+
//#endregion EVENTS
|
|
41
|
+
/****************************************************************************/
|
|
42
|
+
//#region WATCHERS
|
|
43
|
+
/**
|
|
44
|
+
* Watches for changes to the checked state and emits the new value.
|
|
45
|
+
* @param {boolean} checked - The new value of the checked state.
|
|
46
|
+
*/
|
|
47
|
+
onCheckedChanged(checked) {
|
|
48
|
+
this.checkedChanged.emit(checked);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Listens for the change event on the toggle input element and updates the checked state.
|
|
52
|
+
* the checked state of the host elements.
|
|
53
|
+
* @param {Event} event - The change event.
|
|
54
|
+
*/
|
|
55
|
+
handleChange(event) {
|
|
56
|
+
const target = event.target;
|
|
57
|
+
if (target.type === 'checkbox' && target.id === this.inputId) {
|
|
58
|
+
if (this.readonly || this.disabled) {
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
this.checked = target.checked;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
//#endregion WATCHERS
|
|
66
|
+
/****************************************************************************/
|
|
67
|
+
//#region RENDER
|
|
68
|
+
render() {
|
|
69
|
+
return (index.h(index.Host, { key: '1cc28405c1775d19366fd3a684a834e0ca82cf39', class: clsxChV9xqsO.clsx(this.labelPlacement === 'before' && 'label-placement-before') }, index.h("div", { key: 'cc19babb308cb64a8ff359c68eff673d8486b694', class: "input-container" }, index.h("input", { key: '8222a1abe2196b4e943a7adf338df430df2728fe', type: "checkbox", id: this.inputId, name: this.name, autocomplete: "off", value: this.value, checked: Boolean(this.checked), disabled: this.disabled || this.readonly, readonly: this.readonly })), index.h("div", { key: '46eddca130efc9e6abcef1d6b376281cc1e0544e', class: "text-container" }, (this.label || this.el.querySelector('[slot="label"]')) && (index.h("label", { key: 'c9ccfd1fd1e3d896874984943158f9332a7c26b6', htmlFor: this.inputId, class: clsxChV9xqsO.clsx(this.hideLabel && 'visually-hidden') }, index.h("slot", { key: 'cd657a7eff81775da798b211f1c0983f18ace953', name: "label" }, this.label))), (this.description ||
|
|
70
|
+
this.el.querySelector('[slot="description"]')) && (index.h("div", { key: 'dee3823d764ff864b4f008a43bd0aa8c44b6db13', class: "description" }, index.h("slot", { key: '6dd3815bf94e766b3c3c43be72b6a86ed354987b', name: "description" }, this.description))))));
|
|
71
|
+
}
|
|
72
|
+
static get formAssociated() { return true; }
|
|
73
|
+
get el() { return index.getElement(this); }
|
|
74
|
+
static get watchers() { return {
|
|
75
|
+
"checked": [{
|
|
76
|
+
"onCheckedChanged": 0
|
|
77
|
+
}]
|
|
78
|
+
}; }
|
|
79
|
+
};
|
|
80
|
+
NvToggle.style = nvToggleCss();
|
|
81
|
+
|
|
82
|
+
exports.nv_toggle = NvToggle;
|
|
@@ -0,0 +1,66 @@
|
|
|
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 nvTogglebuttonCss = () => `nv-togglebutton{display:inline-flex;justify-content:center;align-items:center}nv-togglebutton:focus-visible,nv-togglebutton:has(:focus-visible){z-index:1}nv-togglebutton[size=xs]{padding:var(--button-xs-padding-y) var(--button-xs-padding-x);gap:var(--button-xs-gap);border-radius:var(--button-xs-border-radius);line-height:var(--button-xs-line-height);height:var(--button-xs-height);font-size:var(--button-xs-font-size)}nv-togglebutton[size=xs] nv-icon>svg{width:var(--spacing-3);height:var(--spacing-3);stroke-width:1.2px}nv-togglebutton[size=xs]{padding-top:calc(var(--togglegroup-xs-button-padding-y) - var(--togglegroup-stroke));padding-bottom:calc(var(--togglegroup-xs-button-padding-y) - var(--togglegroup-stroke));border-radius:var(--togglegroup-xs-button-radius);height:calc((var(--togglegroup-xs-height)) - var(--togglegroup-inner-space));border-width:0}nv-togglebutton[size=sm]{padding:var(--button-sm-padding-y) var(--button-sm-padding-x);gap:var(--button-sm-gap);border-radius:var(--button-sm-border-radius);line-height:var(--button-sm-line-height);height:var(--button-sm-height);font-size:var(--button-sm-font-size)}nv-togglebutton[size=sm] nv-icon>svg{width:var(--spacing-4);height:var(--spacing-4);stroke-width:1.5px}nv-togglebutton[size=sm]{padding-top:calc(var(--togglegroup-sm-button-padding-y) - var(--togglegroup-stroke));padding-bottom:calc(var(--togglegroup-sm-button-padding-y) - var(--togglegroup-stroke));border-radius:calc(var(--togglegroup-sm-button-radius) + 1px);height:calc((var(--togglegroup-sm-height)) - var(--togglegroup-inner-space));border-width:0}nv-togglebutton[size=md]{padding:var(--button-md-padding-y) var(--button-md-padding-x);gap:var(--button-md-gap);border-radius:var(--button-md-border-radius);line-height:var(--button-md-line-height);height:var(--button-md-height);font-size:var(--button-md-font-size)}nv-togglebutton[size=md] nv-icon>svg{width:var(--spacing-5);height:var(--spacing-5);stroke-width:1.6px}nv-togglebutton[size=md]{padding-top:calc(var(--togglegroup-md-button-padding-y) - var(--togglegroup-stroke));padding-bottom:calc(var(--togglegroup-md-button-padding-y) - var(--togglegroup-stroke));border-radius:calc(var(--togglegroup-md-button-radius) + 1px);height:calc((var(--togglegroup-md-height)) - var(--togglegroup-inner-space));border-width:0}nv-togglebutton[size=lg]{padding:var(--button-lg-padding-y) var(--button-lg-padding-x);gap:var(--button-lg-gap);border-radius:var(--button-lg-border-radius);line-height:var(--button-lg-line-height);height:var(--button-lg-height);font-size:var(--button-lg-font-size)}nv-togglebutton[size=lg] nv-icon>svg{width:var(--spacing-6);height:var(--spacing-6);stroke-width:1.8px}nv-togglebutton[size=lg]{padding-top:calc(var(--togglegroup-lg-button-padding-y) - var(--togglegroup-stroke));padding-bottom:calc(var(--togglegroup-lg-button-padding-y) - var(--togglegroup-stroke));border-radius:calc(var(--togglegroup-lg-button-radius) + 1px);height:calc((var(--togglegroup-lg-height)) - var(--togglegroup-inner-space));border-width:0}nv-togglebutton[emphasis=high]{background:var(--components-button-low-background);border:1px solid var(--components-button-low-border);color:var(--components-button-low-text)}nv-togglebutton[emphasis=high]:hover{background:var(--components-button-low-background-hover);border:1px solid var(--components-button-low-border);color:var(--components-button-low-text-hover)}nv-togglebutton[emphasis=high]:active{background:var(--components-button-low-background-active);border:1px solid var(--components-button-low-border-active);color:var(--components-button-low-text-active)}nv-togglebutton[emphasis=high]:focus,nv-togglebutton[emphasis=high]:focus-within{outline:none}nv-togglebutton[emphasis=high]:focus-visible,nv-togglebutton[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-togglebutton[emphasis=high]:disabled:not([disabled=false]){opacity:0.5;cursor:not-allowed;box-shadow:none}nv-togglebutton[emphasis=high][active]:not([active=false]){background:var(--components-button-low-background-active);border:1px solid var(--components-button-low-border-active);color:var(--components-button-low-text-active)}nv-togglebutton[emphasis=low]{background:var(--components-button-lower-background);border:1px solid var(--components-button-lower-border);color:var(--components-button-lower-text)}nv-togglebutton[emphasis=low]:hover{background:var(--components-button-lower-background-hover);border:1px solid var(--components-button-lower-border);color:var(--components-button-lower-text-hover)}nv-togglebutton[emphasis=low]:active{background:var(--components-button-lower-background-active);border:1px solid var(--components-button-lower-border-active);color:var(--components-button-lower-text-active)}nv-togglebutton[emphasis=low]:focus,nv-togglebutton[emphasis=low]:focus-within{outline:none}nv-togglebutton[emphasis=low]:focus-visible,nv-togglebutton[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-togglebutton[emphasis=low]:disabled:not([disabled=false]){opacity:0.5;cursor:not-allowed;box-shadow:none}nv-togglebutton[emphasis=low][active]:not([active=false]),nv-togglebutton[emphasis=low]:active{background:var(--components-button-lower-background-hover);border:1px solid var(--components-button-lower-border);color:var(--components-button-lower-text-hover)}`;
|
|
9
|
+
|
|
10
|
+
const NvTogglebutton = class {
|
|
11
|
+
constructor(hostRef) {
|
|
12
|
+
index.registerInstance(this, hostRef);
|
|
13
|
+
this.toggled = index.createEvent(this, "toggled", 7);
|
|
14
|
+
/****************************************************************************/
|
|
15
|
+
//#region PROPERTIES
|
|
16
|
+
/**
|
|
17
|
+
* Determines how large or small the togglebutton appears, allowing for
|
|
18
|
+
* customization of the togglebutton's dimensions to fit different design
|
|
19
|
+
* specifications and user needs.
|
|
20
|
+
*/
|
|
21
|
+
this.size = 'md';
|
|
22
|
+
/**
|
|
23
|
+
* Prevents all interaction, rendering the toggle in a non-interactive state.
|
|
24
|
+
*/
|
|
25
|
+
this.disabled = false;
|
|
26
|
+
/**
|
|
27
|
+
* Whether the button is active or not. Will not toggle automatically but
|
|
28
|
+
* needs to be controlled externally.
|
|
29
|
+
*/
|
|
30
|
+
this.active = false;
|
|
31
|
+
/**
|
|
32
|
+
* Make it more or less visually prominent to users.
|
|
33
|
+
*/
|
|
34
|
+
this.emphasis = 'high';
|
|
35
|
+
//#endregion PROPERTIES
|
|
36
|
+
/****************************************************************************/
|
|
37
|
+
//#region METHODS
|
|
38
|
+
this.handleClick = () => {
|
|
39
|
+
if (this.disabled)
|
|
40
|
+
return;
|
|
41
|
+
this.toggled.emit({
|
|
42
|
+
value: this.value,
|
|
43
|
+
active: this.active,
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
//#endregion METHODS
|
|
48
|
+
/****************************************************************************/
|
|
49
|
+
//#region LISTENERS
|
|
50
|
+
handleKeyDown(event) {
|
|
51
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
52
|
+
event.preventDefault();
|
|
53
|
+
this.el.click();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//#endregion EVENTS
|
|
57
|
+
/****************************************************************************/
|
|
58
|
+
//#region RENDER
|
|
59
|
+
render() {
|
|
60
|
+
return (index.h(index.Host, { key: '91a6205cf5e2dae56a7826c9882bf2899d31321c', role: "button", tabindex: "0", "aria-pressed": String(this.active), onClick: this.handleClick }, index.h("slot", { key: 'deea1593ddc2083786e7ff05ce6eafa8daebbee3' })));
|
|
61
|
+
}
|
|
62
|
+
get el() { return index.getElement(this); }
|
|
63
|
+
};
|
|
64
|
+
NvTogglebutton.style = nvTogglebuttonCss();
|
|
65
|
+
|
|
66
|
+
exports.nv_togglebutton = NvTogglebutton;
|
package/dist/cjs/{nv-togglebuttongroup.entry-BYXX5ejg.js → nv-togglebuttongroup.entry-CzDI1XCr.js}
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
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 nvTogglebuttongroupCss =
|
|
8
|
+
const nvTogglebuttongroupCss = () => `nv-togglebuttongroup{display:flex;gap:var(--togglegroup-lg-gap);border-radius:var(--togglegroup-lg-radius);width:fit-content;padding:var(--togglegroup-lg-gap)}nv-togglebuttongroup[emphasis=high]{border:1px solid var(--components-togglegroup-high-border)}nv-togglebuttongroup[emphasis=low]{border:1px solid var(--components-togglegroup-low-border)}nv-togglebuttongroup[size=xs]{padding:calc(var(--togglegroup-xs-padding) - 1px);gap:var(--togglegroup-xs-gap);border-radius:var(--togglegroup-xs-radius);height:var(--togglegroup-xs-height)}nv-togglebuttongroup[size=sm]{padding:calc(var(--togglegroup-sm-padding) - 1px);gap:var(--togglegroup-sm-gap);border-radius:var(--togglegroup-sm-radius);height:var(--togglegroup-sm-height)}nv-togglebuttongroup[size=md]{padding:calc(var(--togglegroup-md-padding) - 1px);gap:var(--togglegroup-md-gap);border-radius:var(--togglegroup-md-radius);height:var(--togglegroup-md-height)}nv-togglebuttongroup[size=lg]{padding:calc(var(--togglegroup-lg-padding) - 1px);gap:var(--togglegroup-lg-gap);border-radius:var(--togglegroup-lg-radius);height:var(--togglegroup-lg-height)}`;
|
|
9
9
|
|
|
10
10
|
const NvTogglebuttongroup = class {
|
|
11
11
|
constructor(hostRef) {
|
|
@@ -38,11 +38,10 @@ const NvTogglebuttongroup = class {
|
|
|
38
38
|
*/
|
|
39
39
|
this.setActiveToggleButtons = () => {
|
|
40
40
|
this.el.querySelectorAll('nv-togglebutton').forEach(toggleButtonEl => {
|
|
41
|
-
var _a;
|
|
42
41
|
const btn = NvTogglebuttongroup.asToggleButton(toggleButtonEl);
|
|
43
42
|
if (!btn)
|
|
44
43
|
return;
|
|
45
|
-
btn.active = (
|
|
44
|
+
btn.active = (this.value ?? []).includes(btn.value);
|
|
46
45
|
});
|
|
47
46
|
};
|
|
48
47
|
/**
|
|
@@ -113,7 +112,6 @@ const NvTogglebuttongroup = class {
|
|
|
113
112
|
onSizeChanged() {
|
|
114
113
|
this.setSizeToggleButtons();
|
|
115
114
|
}
|
|
116
|
-
/* eslint-disable nova/native-event-listener */
|
|
117
115
|
onToggled(event) {
|
|
118
116
|
event.stopPropagation();
|
|
119
117
|
const valueSet = new Set(this.value);
|
|
@@ -140,7 +138,6 @@ const NvTogglebuttongroup = class {
|
|
|
140
138
|
}
|
|
141
139
|
this.value = [...valueSet];
|
|
142
140
|
}
|
|
143
|
-
/* eslint-enable nova/native-event-listener */
|
|
144
141
|
//#endregion WATCHERS
|
|
145
142
|
/****************************************************************************/
|
|
146
143
|
//#region LIFECYCLE
|
|
@@ -159,15 +156,21 @@ const NvTogglebuttongroup = class {
|
|
|
159
156
|
/****************************************************************************/
|
|
160
157
|
//#region RENDER
|
|
161
158
|
render() {
|
|
162
|
-
return (index.h(index.Host, { key: '
|
|
159
|
+
return (index.h(index.Host, { key: '98d0fd8820da9b6a5911330a0396b66a911352f2' }, index.h("slot", { key: 'aa202371d4d63d127d69a6a199451f3c97a65c86' })));
|
|
163
160
|
}
|
|
164
161
|
get el() { return index.getElement(this); }
|
|
165
162
|
static get watchers() { return {
|
|
166
|
-
"value": [
|
|
167
|
-
|
|
168
|
-
|
|
163
|
+
"value": [{
|
|
164
|
+
"onValueChanged": 0
|
|
165
|
+
}],
|
|
166
|
+
"emphasis": [{
|
|
167
|
+
"onEmphasisChanged": 0
|
|
168
|
+
}],
|
|
169
|
+
"size": [{
|
|
170
|
+
"onSizeChanged": 0
|
|
171
|
+
}]
|
|
169
172
|
}; }
|
|
170
173
|
};
|
|
171
|
-
NvTogglebuttongroup.style = nvTogglebuttongroupCss;
|
|
174
|
+
NvTogglebuttongroup.style = nvTogglebuttongroupCss();
|
|
172
175
|
|
|
173
176
|
exports.nv_togglebuttongroup = NvTogglebuttongroup;
|
|
@@ -0,0 +1,56 @@
|
|
|
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 nvTooltipCss = () => `nv-tooltip{display:inline-block;position:relative;user-select:none}nv-tooltip:has([fluid]:not([fluid=false])){display:block}nv-tooltip nv-popover>[data-scope=popover]{background:var(--components-tooltip-background);color:var(--components-tooltip-text);font-weight:var(--font-weight-medium-emphasis);padding:var(--tooltip-padding-y) var(--tooltip-padding-x);font-size:var(--tooltip-font-size);border-radius:var(--tooltip-radius);border:none;box-shadow:0px var(--shadow-y-axis-lg-1) var(--shadow-blur-lg-1) var(--shadow-spread-lg-1) var(--shadow-color-opacity-1), 0px var(--shadow-y-axis-lg-2) var(--shadow-blur-lg-2) var(--shadow-spread-lg-2) var(--shadow-color-opacity-2)}nv-tooltip nv-popover>[data-scope=popover] [data-scope=arrow]{background:var(--components-tooltip-background);box-shadow:none;border:none}`;
|
|
9
|
+
|
|
10
|
+
const NvTooltip = class {
|
|
11
|
+
constructor(hostRef) {
|
|
12
|
+
index.registerInstance(this, hostRef);
|
|
13
|
+
this.openChanged = index.createEvent(this, "openChanged", 3);
|
|
14
|
+
this.defaultSlot = null;
|
|
15
|
+
this.popoverElement = null;
|
|
16
|
+
/**
|
|
17
|
+
* Decides where the tooltip shows up next to the element it’s linked to
|
|
18
|
+
* (above, below, to the sides). If there isn’t enough room, it will adjust
|
|
19
|
+
* it's position on the axis to fit on the screen, so users can always see it.
|
|
20
|
+
*/
|
|
21
|
+
this.placement = 'bottom';
|
|
22
|
+
/**
|
|
23
|
+
* Controls how long (in milliseconds) the tooltip waits to show after you
|
|
24
|
+
* hover over or focus on an element. If you move away before the delay is up,
|
|
25
|
+
* the tooltip won't appear.
|
|
26
|
+
*/
|
|
27
|
+
this.enterDelay = 0;
|
|
28
|
+
/**
|
|
29
|
+
* Sets the positioning strategy for the tooltip. Options include:
|
|
30
|
+
* - `absolute`: Positions the tooltip relative to the trigger element
|
|
31
|
+
* (default).
|
|
32
|
+
* - `fixed`: Positions the tooltip relative to the viewport, useful when you
|
|
33
|
+
* need the tooltip to break out of overflow hidden containers, it will not
|
|
34
|
+
* scroll inside a scroll container due to the fixed positioning.
|
|
35
|
+
*/
|
|
36
|
+
this.strategy = 'absolute';
|
|
37
|
+
}
|
|
38
|
+
//#endregion EVENTS
|
|
39
|
+
/****************************************************************************/
|
|
40
|
+
//#region LIFECYCLE
|
|
41
|
+
componentDidRender() {
|
|
42
|
+
if (this.triggerElement || !this.defaultSlot)
|
|
43
|
+
return;
|
|
44
|
+
this.popoverElement.triggerElement = this.defaultSlot?.nextSibling;
|
|
45
|
+
}
|
|
46
|
+
//#endregion LIFECYCLE
|
|
47
|
+
/****************************************************************************/
|
|
48
|
+
//#region RENDER
|
|
49
|
+
render() {
|
|
50
|
+
return (index.h(index.Host, { key: '1c21198627166da4ff8ad5c0b9cd600587a46d70' }, index.h("nv-popover", { key: '3dfa32fa4789acba5184fefe39d3b82761ede7cb', ref: el => (this.popoverElement = el), triggerMode: "hover", hasArrow: true, placement: this.placement, strategy: this.strategy, triggerElement: this.triggerElement, groupName: 'tooltip', enterDelay: this.enterDelay, onOpenChanged: e => this.openChanged.emit(e.detail) }, index.h("p", { key: '6e2c16e5e691c27a59938ffc6c5cb075251505f8', slot: "content" }, this.message), index.h("slot", { key: 'aba5c81f04ebf9a94538d384d39da76d9cb74cc2', name: "content" })), index.h("slot", { key: '03697bd2cba4d042c09ed628ee2276ee243004de', ref: el => (this.defaultSlot = el) })));
|
|
51
|
+
}
|
|
52
|
+
get el() { return index.getElement(this); }
|
|
53
|
+
};
|
|
54
|
+
NvTooltip.style = nvTooltipCss();
|
|
55
|
+
|
|
56
|
+
exports.nv_tooltip = NvTooltip;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var fade_animationDcRL9lcm = require('./fade.animation-DcRL9lcm-DAZeHoKN.js');
|
|
4
|
+
var styleValueTypes_esXlgmw4x8 = require('./style-value-types.es-xlgmw4x8-B1vLqX9m.js');
|
|
5
|
+
|
|
6
|
+
const useSlide = (node, { duration } = { duration: 200 }) => {
|
|
7
|
+
const nodeStyler = fade_animationDcRL9lcm.index(node);
|
|
8
|
+
/**
|
|
9
|
+
* Will animate the translateX property.
|
|
10
|
+
*
|
|
11
|
+
* @param {object} options - The options for the animation.
|
|
12
|
+
* @param {number} options.from - The starting value for the translateX property.
|
|
13
|
+
* @param {number} options.to - The ending value for the translateX property.
|
|
14
|
+
* @returns {Promise<void>} - A promise that resolves when the animation is
|
|
15
|
+
* complete.
|
|
16
|
+
*/
|
|
17
|
+
const slideX = (options = { from: 0, to: 100 }) => () => {
|
|
18
|
+
return new Promise(resolve => {
|
|
19
|
+
styleValueTypes_esXlgmw4x8.animate({
|
|
20
|
+
from: { x: options.from },
|
|
21
|
+
to: { x: options.to },
|
|
22
|
+
ease: styleValueTypes_esXlgmw4x8.easeOut,
|
|
23
|
+
duration,
|
|
24
|
+
onUpdate(latest) {
|
|
25
|
+
nodeStyler.set({ transform: `translateX(${latest.x}%)` });
|
|
26
|
+
},
|
|
27
|
+
onComplete() {
|
|
28
|
+
resolve();
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Will animate the translateY property.
|
|
35
|
+
*
|
|
36
|
+
* @param {object} options - The options for the animation.
|
|
37
|
+
* @param {number} options.from - The starting value for the translateY property.
|
|
38
|
+
* @param {number} options.to - The ending value for the translateY property.
|
|
39
|
+
* @returns {Promise<void>} - A promise that resolves when the animation is
|
|
40
|
+
* complete.
|
|
41
|
+
*/
|
|
42
|
+
const slideY = (options = { from: 0, to: 100 }) => () => {
|
|
43
|
+
return new Promise(resolve => {
|
|
44
|
+
styleValueTypes_esXlgmw4x8.animate({
|
|
45
|
+
from: { y: options.from },
|
|
46
|
+
to: { y: options.to },
|
|
47
|
+
ease: styleValueTypes_esXlgmw4x8.easeOut,
|
|
48
|
+
duration,
|
|
49
|
+
onUpdate(latest) {
|
|
50
|
+
nodeStyler.set({ transform: `translateY(${latest.y}%)` });
|
|
51
|
+
},
|
|
52
|
+
onComplete() {
|
|
53
|
+
resolve();
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Applies the slideX styles without animating, useful when initial state
|
|
60
|
+
* is slid out.
|
|
61
|
+
*
|
|
62
|
+
* @param {number} amount - The amount to translate the element by.
|
|
63
|
+
* @returns {function} - A function that applies the slideX styles.
|
|
64
|
+
*/
|
|
65
|
+
const setSlideX = (amount = 100) => nodeStyler.set({ transform: `translateX(${amount}%)` });
|
|
66
|
+
/**
|
|
67
|
+
* Applies the slideY styles without animating, useful when initial state
|
|
68
|
+
* is slid out.
|
|
69
|
+
*
|
|
70
|
+
* @param {number} amount - The amount to translate the element by.
|
|
71
|
+
* @returns {function} - A function that applies the slideY styles.
|
|
72
|
+
*/
|
|
73
|
+
const setSlideY = (amount = 100) => nodeStyler.set({ transform: `translateY(${amount}%)` });
|
|
74
|
+
/**
|
|
75
|
+
* Applies the slideIn styles without animating, useful when initial state
|
|
76
|
+
* is slid in.
|
|
77
|
+
*/
|
|
78
|
+
function setSlideReset() {
|
|
79
|
+
nodeStyler.set({ transform: `translateX(${0}%) translateY(${0}%)` });
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
slideX,
|
|
83
|
+
slideY,
|
|
84
|
+
setSlideX,
|
|
85
|
+
setSlideY,
|
|
86
|
+
setSlideReset,
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
exports.useSlide = useSlide;
|