@nova-design-system/nova-react 3.25.0 → 3.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/generated/components.server.js +2 -1
- package/dist/cjs/{index-DUlunl9a.js → index-BeFrXZol.js} +258 -255
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/{nv-accordion-item.entry-CqnjIt4R.js → nv-accordion-item.entry-DtzjLTCo.js} +1 -1
- package/dist/cjs/{nv-accordion.entry-Dx7FmGg_.js → nv-accordion.entry-DRcTfezT.js} +1 -1
- package/dist/cjs/{nv-alert.entry-BL3Pdcxd.js → nv-alert.entry-86bfoXVx.js} +1 -1
- package/dist/cjs/{nv-avatar.entry-2dFR4I9_.js → nv-avatar.entry-mp2LJ6RA.js} +1 -1
- package/dist/cjs/{nv-badge_2.entry-5FShR2Ax.js → nv-badge_2.entry-BrDaHeqh.js} +6 -4
- package/dist/cjs/{nv-breadcrumb.entry-Cfi32bBT.js → nv-breadcrumb.entry-B2q7jJy2.js} +2 -2
- package/dist/cjs/{nv-breadcrumbs.entry-BSgn3KUO.js → nv-breadcrumbs.entry-DKzST1uS.js} +2 -2
- package/dist/cjs/{nv-button.entry-BdQQ_LE7.js → nv-button.entry-CVgcU-bi.js} +2 -2
- package/dist/cjs/{nv-buttongroup.entry-BM8CwXFK.js → nv-buttongroup.entry-CvuBGaGK.js} +3 -3
- package/dist/cjs/{nv-calendar.entry-CeKsMGOa.js → nv-calendar.entry-BCcGhxzJ.js} +3 -12
- package/dist/cjs/{nv-col.entry-D-h2PGcz.js → nv-col.entry-CzTahRVr.js} +2 -2
- package/dist/cjs/{nv-datagrid.entry-nOBIfqOS.js → nv-datagrid.entry-DWZxNqTE.js} +3 -3
- package/dist/cjs/{nv-datagridcolumn.entry-BAzTU_KM.js → nv-datagridcolumn.entry-CzCzmdQl.js} +2 -2
- package/dist/cjs/{nv-dialog.entry-Bi2ZVSe2.js → nv-dialog.entry-ByVD02QB.js} +2 -2
- package/dist/cjs/{nv-dialogfooter_2.entry-D6lzC-3S.js → nv-dialogfooter_2.entry-BmQcYJsD.js} +3 -3
- package/dist/cjs/{nv-drawer.entry-Dp4AfBiF.js → nv-drawer.entry-C15JRJ3N.js} +2 -2
- package/dist/cjs/{nv-drawerfooter_2.entry-DpWSsq6d.js → nv-drawerfooter_2.entry-DuDac_Os.js} +3 -3
- package/dist/cjs/{nv-fieldcheckbox.entry-COA3LXnX.js → nv-fieldcheckbox.entry-CwDOQzSW.js} +6 -6
- package/dist/cjs/{nv-fielddate.entry-B8r5RFXd.js → nv-fielddate.entry-DKICGwc0.js} +7 -7
- package/dist/cjs/{nv-fielddaterange.entry-C6_Kq93P.js → nv-fielddaterange.entry-DGEK8F9p.js} +7 -8
- package/dist/cjs/{nv-fielddropdown.entry-B2Dr5zHd.js → nv-fielddropdown.entry-BLS7lRzD.js} +21 -21
- package/dist/cjs/{nv-fielddropdownitem.entry-DapivVnR.js → nv-fielddropdownitem.entry-Bbfi3A8C.js} +2 -2
- package/dist/cjs/{nv-fieldmultiselect.entry-DSpQeiPx.js → nv-fieldmultiselect.entry-Cpy7HzlZ.js} +17 -17
- package/dist/cjs/{nv-fieldnumber.entry-BwxR9sRr.js → nv-fieldnumber.entry-SbNb4hKr.js} +5 -5
- package/dist/cjs/{nv-fieldpassword.entry-BOSU-Skh.js → nv-fieldpassword.entry-CPsgagjY.js} +5 -5
- package/dist/cjs/nv-fieldradio.entry-DLP-rmKU.js +105 -0
- package/dist/cjs/{nv-fieldselect.entry-CfWjQAd9.js → nv-fieldselect.entry-DOOO03kM.js} +6 -6
- package/dist/cjs/{nv-fieldslider.entry-dDPcWUxs.js → nv-fieldslider.entry-CpVbxkpo.js} +4 -4
- package/dist/cjs/{nv-fieldtext.entry-Yaa-mkjJ.js → nv-fieldtext.entry-BpbG4WHv.js} +5 -5
- package/dist/cjs/{nv-fieldtextarea.entry-Dp_l2pKZ.js → nv-fieldtextarea.entry-BA_RApYN.js} +31 -29
- package/dist/cjs/{nv-fieldtime.entry-CWxi4Uel.js → nv-fieldtime.entry-DaJfwQtC.js} +4 -4
- package/dist/cjs/{nv-icon.entry-Dci11W9S.js → nv-icon.entry-DIi792yJ.js} +2 -2
- package/dist/cjs/{nv-iconbutton_2.entry-A6FKFJT_.js → nv-iconbutton_2.entry-B4xB5WtE.js} +3 -3
- package/dist/cjs/{nv-menu.entry-BHaYP-9M.js → nv-menu.entry-DHWhkWeB.js} +2 -2
- package/dist/cjs/{nv-menuitem.entry-Cm1vvN25.js → nv-menuitem.entry-CQApuT2D.js} +2 -2
- package/dist/cjs/{nv-notification-bullet.entry-DRlS3Ybc.js → nv-notification-bullet.entry-CnYVWE_Z.js} +1 -1
- package/dist/cjs/{nv-notification.entry-BeDmR-XC.js → nv-notification.entry-DraOvzsu.js} +2 -2
- package/dist/cjs/{nv-notificationcontainer.entry-C3p_87Dg.js → nv-notificationcontainer.entry-BDo-rQLL.js} +2 -2
- package/dist/cjs/{nv-paginationtable.entry-BzEqQOBa.js → nv-paginationtable.entry-CS7BhAVe.js} +2 -2
- package/dist/cjs/{nv-popover.entry-D2oFn9vL.js → nv-popover.entry-DSyKCLtF.js} +2 -2
- package/dist/cjs/{nv-row.entry-hV1kxmrr.js → nv-row.entry-D21zN2Vr.js} +2 -2
- package/dist/cjs/{nv-sidebar.entry-BJrqJ8K7.js → nv-sidebar.entry-DpKgnjsJ.js} +2 -2
- package/dist/cjs/{nv-sidebarcontent.entry-CPfGF7nx.js → nv-sidebarcontent.entry-BWFDcui8.js} +2 -2
- package/dist/cjs/{nv-sidebardivider.entry-D2wmzHCO.js → nv-sidebardivider.entry-BSzLq-h3.js} +2 -2
- package/dist/cjs/{nv-sidebarfooter.entry-C7fqCzjH.js → nv-sidebarfooter.entry-C3DLHPSQ.js} +2 -2
- package/dist/cjs/{nv-sidebargroup.entry-qkXnxhs_.js → nv-sidebargroup.entry-BMYLbCql.js} +2 -2
- package/dist/cjs/{nv-sidebarheader.entry-DBsOmyQ0.js → nv-sidebarheader.entry-CkUGD-Tw.js} +2 -2
- package/dist/cjs/{nv-sidebarlogo.entry-902Ht3UR.js → nv-sidebarlogo.entry-BX1-1S1v.js} +2 -2
- package/dist/cjs/{nv-sidebarnavitem.entry-CICrllp8.js → nv-sidebarnavitem.entry-CPwt0Njh.js} +3 -3
- package/dist/cjs/{nv-sidebarnavsubitem.entry-Q9jjU_7D.js → nv-sidebarnavsubitem.entry-HZOTB6Tl.js} +2 -2
- package/dist/cjs/{nv-split.entry-BYIsE2wp.js → nv-split.entry-DdtzktvN.js} +2 -2
- package/dist/cjs/{nv-stack.entry-DgE5ASGH.js → nv-stack.entry-BMLt30Nt.js} +2 -2
- package/dist/cjs/{nv-table.entry-DHXBu2n1.js → nv-table.entry-RTiqKRKM.js} +4 -2
- package/dist/cjs/{nv-tableheader.entry-BijgOxcO.js → nv-tableheader.entry-Ci4qo8eY.js} +2 -2
- package/dist/cjs/nv-toggle.entry-s8B7-8P7.js +82 -0
- package/dist/cjs/{nv-togglebutton.entry-DAPETEmF.js → nv-togglebutton.entry-CyHgU4Wl.js} +2 -2
- package/dist/cjs/{nv-togglebuttongroup.entry-CzDI1XCr.js → nv-togglebuttongroup.entry-Bn_9DsdP.js} +2 -2
- package/dist/cjs/{nv-tooltip.entry-DPoUP9iL.js → nv-tooltip.entry-D6kxXLO-.js} +3 -3
- package/dist/generated/components.server.js +2 -1
- package/dist/providers/NotificationProvider.js +9 -8
- package/dist/types/components/NvDatatable/types.d.ts +1 -0
- package/package.json +7 -4
- package/dist/cjs/nv-fieldradio.entry-ZFafNY5_.js +0 -105
- package/dist/cjs/nv-toggle.entry-CMI1WdvV.js +0 -82
- /package/dist/cjs/{i18n.utils-IlwlcG9l-ku0bScip.js → i18n.utils-CR9MpYzU-ku0bScip.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-BeFrXZol.js');
|
|
4
4
|
require('@stencil/react-output-target/runtime');
|
|
5
5
|
require('react');
|
|
6
6
|
require('react-dom');
|
|
@@ -326,7 +326,7 @@ const NvSplit = class {
|
|
|
326
326
|
/****************************************************************************/
|
|
327
327
|
//#region RENDER
|
|
328
328
|
render() {
|
|
329
|
-
return (index.h(index.Host, { key: '
|
|
329
|
+
return (index.h(index.Host, { key: 'ab2b75b963d3cee109e90fe22e0dfe356a384706', "data-dragging": this.isDragging.toString() }, index.h("slot", { key: 'a7a8258a976029f91ffbce3fa1f90f7ed35409ef', name: "pane" }), index.h("slot", { key: '9af34cb299ff061bec6ba7dfe6e969e093aeb3bc', name: "gutter" })));
|
|
330
330
|
}
|
|
331
331
|
get el() { return index.getElement(this); }
|
|
332
332
|
static get watchers() { return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-BeFrXZol.js');
|
|
4
4
|
var clsxChV9xqsO = require('./clsx-ChV9xqsO-BtxeOLZW.js');
|
|
5
5
|
require('@stencil/react-output-target/runtime');
|
|
6
6
|
require('react');
|
|
@@ -23,7 +23,7 @@ const NvStack = class {
|
|
|
23
23
|
/****************************************************************************/
|
|
24
24
|
//#region RENDER
|
|
25
25
|
render() {
|
|
26
|
-
return (index.h(index.Host, { key: '
|
|
26
|
+
return (index.h(index.Host, { key: '1fe102ad734149231a7058af441e5ee77ef97ca3', class: clsxChV9xqsO.clsx(this.fill && 'nv-stack-fill', this.flex && 'nv-stack-flex', this.full && 'w-full', this.gutter && !this.vertical && `gap-x-${this.gutter}`, this.gutter && this.vertical && `gap-y-${this.gutter}`, this.vertical && 'nv-stack-vertical') }, index.h("slot", { key: 'f7ed597dabd90182887096441ff1258812dfe9fc' })));
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
NvStack.style = nvStackCss();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-BeFrXZol.js');
|
|
4
4
|
require('@stencil/react-output-target/runtime');
|
|
5
5
|
require('react');
|
|
6
6
|
require('react-dom');
|
|
@@ -116,6 +116,8 @@ function releasePointerCapture(cell, pointerId) {
|
|
|
116
116
|
* @param {boolean} prevent - Whether to prevent selection
|
|
117
117
|
*/
|
|
118
118
|
function setUserSelectPrevention(prevent) {
|
|
119
|
+
if (!document)
|
|
120
|
+
return; // SSR & node env fallback safety
|
|
119
121
|
document.body.style.userSelect = prevent ? 'none' : '';
|
|
120
122
|
}
|
|
121
123
|
/**
|
|
@@ -234,7 +236,7 @@ const NvTable = class {
|
|
|
234
236
|
/****************************************************************************/
|
|
235
237
|
//#region RENDER
|
|
236
238
|
render() {
|
|
237
|
-
return (index.h(index.Host, { key: '
|
|
239
|
+
return (index.h(index.Host, { key: '0d5518a54b41c67bdd7c73d5147fd954fb53d388' }, index.h("slot", { key: '8ab65d5dd1ce751fd357b275b84db042b1d9ce2e' })));
|
|
238
240
|
}
|
|
239
241
|
get host() { return index.getElement(this); }
|
|
240
242
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-BeFrXZol.js');
|
|
4
4
|
require('@stencil/react-output-target/runtime');
|
|
5
5
|
require('react');
|
|
6
6
|
require('react-dom');
|
|
@@ -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: '95447cd8ccde74d09226bcdbf645eed309be0fa8', 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: '4e26aa21f080cf23ce42fb72d6777463bd079991' }), this.sortable && (index.h("span", { key: '666254c197e97226d2f1c6830d1216b9457c4acc', class: "sort-icon-wrap", "aria-hidden": "true" }, index.h("nv-iconbutton", { key: '11b2de5c4c270740857094ec8a39f1d392d7246a', 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',
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-BeFrXZol.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 = () => `@charset "UTF-8";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)}@media print{nv-toggle .input-container input[type=checkbox]::after{content:"●";top:calc(50% - 3.5px);width:auto;height:auto;background:none;color:var(--components-toggle-border-default);font-size:calc(var(--form-toggle-switch-dot-default) * 3);line-height:1}nv-toggle .input-container input[type=checkbox]:checked{background:transparent;border-color:var(--components-toggle-border-default-checked)}nv-toggle .input-container input[type=checkbox]:checked::after{content:"●";top:calc(50% - 3.5px);width:auto;height:auto;left:75%;background:none;color:var(--components-toggle-border-default-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: '38dd2a460c82599e2c2bfd6b039eafff0dc6fc67', class: clsxChV9xqsO.clsx(this.labelPlacement === 'before' && 'label-placement-before') }, index.h("div", { key: '4d6bf742f548cc5f92ae84497f12569d9680dcef', class: "input-container" }, index.h("input", { key: '97f54363c17cde48ec226680ee58da012e590b69', 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: 'e4576a0884f02731a3e6d2d20537cfabf411a8fe', class: "text-container" }, (this.label || this.el.querySelector('[slot="label"]')) && (index.h("label", { key: '4744036b0d1e73f350bbc4b6f6e7664bb9361d1e', htmlFor: this.inputId, class: clsxChV9xqsO.clsx(this.hideLabel && 'visually-hidden') }, index.h("slot", { key: '44a2aeb86c840246473bc47e0ba01269af77ef06', name: "label" }, this.label))), (this.description ||
|
|
70
|
+
this.el.querySelector('[slot="description"]')) && (index.h("div", { key: '6e5c3d1721c9db3cffd019c9274294c40793daf0', class: "description" }, index.h("slot", { key: '87c3d35c78ded085cd1ddb5b2874dfae7bd99842', 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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-BeFrXZol.js');
|
|
4
4
|
require('@stencil/react-output-target/runtime');
|
|
5
5
|
require('react');
|
|
6
6
|
require('react-dom');
|
|
@@ -57,7 +57,7 @@ const NvTogglebutton = class {
|
|
|
57
57
|
/****************************************************************************/
|
|
58
58
|
//#region RENDER
|
|
59
59
|
render() {
|
|
60
|
-
return (index.h(index.Host, { key: '
|
|
60
|
+
return (index.h(index.Host, { key: '4af1293d9eb69a3a20d8f30c6b2876c6c29ddc03', role: "button", tabindex: "0", "aria-pressed": String(this.active), onClick: this.handleClick }, index.h("slot", { key: '783fad27c525553cd404c1ffed0ae1305d330de8' })));
|
|
61
61
|
}
|
|
62
62
|
get el() { return index.getElement(this); }
|
|
63
63
|
};
|
package/dist/cjs/{nv-togglebuttongroup.entry-CzDI1XCr.js → nv-togglebuttongroup.entry-Bn_9DsdP.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-BeFrXZol.js');
|
|
4
4
|
require('@stencil/react-output-target/runtime');
|
|
5
5
|
require('react');
|
|
6
6
|
require('react-dom');
|
|
@@ -156,7 +156,7 @@ const NvTogglebuttongroup = class {
|
|
|
156
156
|
/****************************************************************************/
|
|
157
157
|
//#region RENDER
|
|
158
158
|
render() {
|
|
159
|
-
return (index.h(index.Host, { key: '
|
|
159
|
+
return (index.h(index.Host, { key: '1116872815229d09e1e286dd1f12a9787218e207' }, index.h("slot", { key: 'fa5363ec707f38830065718b2423dd8493acdd4e' })));
|
|
160
160
|
}
|
|
161
161
|
get el() { return index.getElement(this); }
|
|
162
162
|
static get watchers() { return {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-BeFrXZol.js');
|
|
4
4
|
require('@stencil/react-output-target/runtime');
|
|
5
5
|
require('react');
|
|
6
6
|
require('react-dom');
|
|
7
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}`;
|
|
8
|
+
const nvTooltipCss = () => `nv-tooltip{display:inline-block;vertical-align:top;position:relative;user-select:none}nv-tooltip:has([fluid]:not([fluid=false])){display:block}nv-tooltip nv-popover{display:block;height:0;min-height:0;overflow:visible}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
9
|
|
|
10
10
|
const NvTooltip = class {
|
|
11
11
|
constructor(hostRef) {
|
|
@@ -47,7 +47,7 @@ const NvTooltip = class {
|
|
|
47
47
|
/****************************************************************************/
|
|
48
48
|
//#region RENDER
|
|
49
49
|
render() {
|
|
50
|
-
return (index.h(index.Host, { key: '
|
|
50
|
+
return (index.h(index.Host, { key: 'bda9ba58186add585457f8fdf4a8e1d6389da01a' }, index.h("nv-popover", { key: 'ac67ea44cebbc8abb9ff4e190668093bb7179222', 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: 'b677689d4a73462b7d16ff7d9f31bfd61e7f47eb', slot: "content" }, this.message), index.h("slot", { key: 'bd1540db065fdeceb89d09d69e1dbf7ad4de728d', name: "content" })), index.h("slot", { key: '648d3c3125b0528cd8e88675122d775ad7cc40d9', ref: el => (this.defaultSlot = el) })));
|
|
51
51
|
}
|
|
52
52
|
get el() { return index.getElement(this); }
|
|
53
53
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as clientComponents from '@nova-design-system/nova-react';
|
|
1
|
+
import * as clientComponents from '@nova-design-system/nova-react/client';
|
|
2
2
|
import { createComponent } from '@stencil/react-output-target/ssr';
|
|
3
3
|
export const serializeShadowRoot = { default: "declarative-shadow-dom" };
|
|
4
4
|
export const NvAccordion = createComponent({
|
|
@@ -656,6 +656,7 @@ export const NvFieldtextarea = createComponent({
|
|
|
656
656
|
rows: 'rows',
|
|
657
657
|
resize: 'resize',
|
|
658
658
|
autosize: 'autosize',
|
|
659
|
+
maxAutoHeight: 'max-auto-height',
|
|
659
660
|
autofocus: 'autofocus',
|
|
660
661
|
fluid: 'fluid'
|
|
661
662
|
},
|
|
@@ -91,14 +91,15 @@ export const NotificationProvider = ({ children, position = DEFAULT_POSITION, ma
|
|
|
91
91
|
};
|
|
92
92
|
return (React.createElement(NotificationContext.Provider, { value: contextValue },
|
|
93
93
|
children,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
94
|
+
typeof document !== 'undefined' &&
|
|
95
|
+
createPortal(React.createElement(NvNotificationcontainer, { position: position, className: className, "data-testid": "notification-container" }, notifications.map((notification) => (React.createElement(NvNotification, { key: notification.id, uid: notification.id, heading: notification.heading, message: notification.message, dismissible: notification.dismissible, emphasis: notification.emphasis, feedback: notification.feedback, icon: notification.icon, onHiddenChanged: (event) => {
|
|
96
|
+
if (event.detail) {
|
|
97
|
+
handleNotificationClose(notification.id);
|
|
98
|
+
}
|
|
99
|
+
}, initiallyHidden: true, ref: notification.ref }, (Boolean(notification.actionSlot) ||
|
|
100
|
+
Boolean(notification.actions.length)) && (React.createElement("div", { slot: "actions" },
|
|
101
|
+
notification.actions.map((action) => (React.createElement(NvButton, { key: action.label, emphasis: "low", size: "md", onClick: action.onClick }, action.label))),
|
|
102
|
+
notification.actionSlot)))))), document.body)));
|
|
102
103
|
};
|
|
103
104
|
export const useNotifications = () => {
|
|
104
105
|
const context = useContext(NotificationContext);
|
|
@@ -11,6 +11,7 @@ export type NvDatatableProps<T> = {
|
|
|
11
11
|
renderPagination?: (api: NvDatatableRenderPaginationAPI) => React.ReactNode;
|
|
12
12
|
renderFiltering?: (api: NvDatatableRenderFilteringAPI) => React.ReactNode;
|
|
13
13
|
stickyHeader?: boolean;
|
|
14
|
+
suppressHydrationWarning?: boolean;
|
|
14
15
|
} & Pick<ComponentProps<'div'>, 'className' | 'style'>;
|
|
15
16
|
export interface NvDatatableColumn<Row, K extends keyof Row = keyof Row, F = Row[K]> {
|
|
16
17
|
field: K;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nova-design-system/nova-react",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.26.0",
|
|
4
4
|
"description": "Nova is a design system created by Elia Group to empower creators to efficiently build solutions that people love to use.",
|
|
5
5
|
"author": "Elia Group",
|
|
6
6
|
"homepage": "https://nova.eliagroup.io",
|
|
@@ -19,12 +19,15 @@
|
|
|
19
19
|
".": {
|
|
20
20
|
"import": "./dist/index.js",
|
|
21
21
|
"require": "./dist/cjs/index.js",
|
|
22
|
-
"types": "./dist/types/index.d.ts"
|
|
23
|
-
"node": "./dist/generated/components.server.js"
|
|
22
|
+
"types": "./dist/types/index.d.ts"
|
|
24
23
|
},
|
|
25
24
|
"./server": {
|
|
26
25
|
"import": "./dist/generated/components.server.js",
|
|
27
26
|
"types": "./dist/types/generated/components.server.d.ts"
|
|
27
|
+
},
|
|
28
|
+
"./client": {
|
|
29
|
+
"import": "./dist/generated/components.js",
|
|
30
|
+
"types": "./dist/types/generated/components.d.ts"
|
|
28
31
|
}
|
|
29
32
|
},
|
|
30
33
|
"publishConfig": {
|
|
@@ -40,7 +43,7 @@
|
|
|
40
43
|
"tsc:watch": "tsc -p . --outDir ./dist --declarationDir ./dist/types --declaration true --watch",
|
|
41
44
|
"storybook": "storybook dev -p 6006",
|
|
42
45
|
"storybook.build": "storybook build -o ../../storybook-static/react",
|
|
43
|
-
"clean": "rimraf dist lib/generated lib/stories/generated lib/stories/components/*-migration.mdx lib/stories/components/*-guide.mdx",
|
|
46
|
+
"clean": "rimraf dist lib/generated lib/stories/generated && shx rm -rf lib/stories/components/*-migration.mdx lib/stories/components/*-guide.mdx",
|
|
44
47
|
"typecheck": "tsc --emitDeclarationOnly false --noEmit"
|
|
45
48
|
},
|
|
46
49
|
"dependencies": {
|
|
@@ -1,105 +0,0 @@
|
|
|
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 nvFieldradioCss = () => `nv-fieldradio{--nv-fieldradio-border-default:var(--components-form-field-border-default);--nv-fieldradio-border-hover:var(--components-form-field-border-hover);--nv-fieldradio-border-focus:var(--components-form-field-border-default);--nv-fieldradio-background-default:var(--components-form-field-background-default);--nv-fieldradio-background-checked:var(--components-form-field-background-checked);--nv-fieldradio-background-disabled:var(--components-form-field-background-disabled);--nv-fieldradio-focus-box-shadow:var(--color-focus-brand);--nv-fieldradio-dot-color-checked:var(--components-form-shape-foreground-default);--nv-fieldradio-dot-color-disabled:var(--components-form-shape-foreground-disabled);--nv-fieldradio-outline-color:var(--color-focus-brand);display:inline-flex;align-items:flex-start;gap:var(--form-gap-x)}nv-fieldradio:not([disabled]) input,nv-fieldradio:not([disabled]) label,nv-fieldradio[disabled=false] input,nv-fieldradio[disabled=false] label{cursor:pointer}nv-fieldradio.error{--nv-fieldradio-border-default:var(--components-form-field-border-error);--nv-fieldradio-border-hover:var(--nv-fieldradio-border-default);--nv-fieldradio-border-focus:var(--components-form-field-border-error);--nv-fieldradio-background-checked:var(--components-form-field-background-error);--nv-fieldradio-focus-box-shadow:var(--color-focus-destructive);--nv-fieldradio-dot-color-checked:var(--components-form-shape-foreground-default);--nv-fieldradio-dot-color-disabled:var(--components-form-field-border-error);--nv-fieldradio-outline-color:var(--color-focus-destructive)}nv-fieldradio.label-placement-before{flex-direction:row-reverse}nv-fieldradio[disabled]{opacity:0.5}nv-fieldradio 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(--form-label-font-weight);line-height:var(--form-label-line-height)}nv-fieldradio input[type=radio]{appearance:none;position:relative;display:flex;width:var(--form-radio-size);height:var(--form-radio-size);padding:var(--form-radio-inner-circle-padding);flex-direction:column;align-items:flex-start;border-radius:var(--radius-rounded-full);border-width:var(--form-radio-border-width);border-style:solid;border-color:var(--nv-fieldradio-border-default);background:var(--nv-fieldradio-background-default)}nv-fieldradio input[type=radio]:hover{border-color:var(--nv-fieldradio-border-hover)}nv-fieldradio input[type=radio]:focus{border-color:var(--nv-fieldradio-border-focus)}nv-fieldradio input[type=radio]:focus,nv-fieldradio input[type=radio]:focus-within{outline:none}nv-fieldradio input[type=radio]:focus-visible,nv-fieldradio input[type=radio]:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--nv-fieldradio-outline-color);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-fieldradio input[type=radio]:checked{background:var(--nv-fieldradio-background-checked);border-color:var(--nv-fieldradio-background-checked)}nv-fieldradio input[type=radio]:checked:hover,nv-fieldradio input[type=radio]:checked:focus{border-color:var(--nv-fieldradio-background-checked);background:var(--nv-fieldradio-background-checked)}nv-fieldradio input[type=radio]:checked::before{content:"";position:absolute;top:50%;right:50%;transform:translate(50%, -50%);left:0;width:var(--form-radio-inner-circle-size);height:var(--form-radio-inner-circle-size);flex-shrink:0;border-radius:var(--radius-rounded-full);background:var(--nv-fieldradio-dot-color-checked)}nv-fieldradio input[type=radio]:disabled{border-radius:var(--radius-rounded-full);border-width:var(--form-radio-border-width);border-style:solid;border-color:var(--nv-fieldradio-border-default);background:var(--nv-fieldradio-background-disabled)}nv-fieldradio input[type=radio]:disabled:checked::before{background:var(--nv-fieldradio-dot-color-disabled)}nv-fieldradio input[type=radio]:disabled:hover{border-color:var(--nv-fieldradio-border-default);background:var(--nv-fieldradio-background-disabled)}nv-fieldradio .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:var(--form-description-font-weight);line-height:var(--form-description-line-height)}nv-fieldradio .error-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:var(--form-description-font-weight);line-height:var(--form-description-line-height);color:var(--components-form-text-description-error)}nv-fieldradio .text-container{display:flex;flex-direction:column;align-items:flex-start;flex:1 0 0}`;
|
|
11
|
-
|
|
12
|
-
const NvFieldradio = class {
|
|
13
|
-
constructor(hostRef) {
|
|
14
|
-
index.registerInstance(this, hostRef);
|
|
15
|
-
this.checkedChanged = index.createEvent(this, "checkedChanged", 3);
|
|
16
|
-
/**
|
|
17
|
-
* Set the label placement to before the input
|
|
18
|
-
* @deprecated use labelPlacement instead.
|
|
19
|
-
*/
|
|
20
|
-
this.labelBefore = false;
|
|
21
|
-
//#endregion DEPRECATED
|
|
22
|
-
/****************************************************************************/
|
|
23
|
-
//#region PROPERTIES
|
|
24
|
-
/**
|
|
25
|
-
* Sets the ID for the radio button’s input element and the for attribute of
|
|
26
|
-
* the associated label. If no ID is provided, a random one will be
|
|
27
|
-
* automatically generated to ensure unique identification, facilitating
|
|
28
|
-
* proper label association and accessibility.
|
|
29
|
-
*/
|
|
30
|
-
this.inputId = v4BdYh22OP.v4();
|
|
31
|
-
/**
|
|
32
|
-
* Highlight the radio button with error styling. It helps users quickly
|
|
33
|
-
* identify which option needs attention, improving their form-filling
|
|
34
|
-
* experience by making issues more visible.
|
|
35
|
-
* @validator error
|
|
36
|
-
*/
|
|
37
|
-
this.error = false;
|
|
38
|
-
/**
|
|
39
|
-
* Controls whether the radio button is selected.
|
|
40
|
-
*/
|
|
41
|
-
this.checked = false;
|
|
42
|
-
/**
|
|
43
|
-
* Disables the radio button, making it un-selectable.
|
|
44
|
-
*/
|
|
45
|
-
this.disabled = false;
|
|
46
|
-
/**
|
|
47
|
-
* Applies focus to the input field as soon as the component is mounted. This
|
|
48
|
-
* is equivalent to setting the native autofocus attribute on an <input>
|
|
49
|
-
* element.
|
|
50
|
-
*/
|
|
51
|
-
this.autofocus = false;
|
|
52
|
-
}
|
|
53
|
-
componentWillRender() {
|
|
54
|
-
if (this.message) {
|
|
55
|
-
this.description = this.message;
|
|
56
|
-
}
|
|
57
|
-
if (this.labelBefore) {
|
|
58
|
-
this.labelPlacement = 'before';
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
//#endregion EVENTS
|
|
62
|
-
/****************************************************************************/
|
|
63
|
-
//#region WATCHERS
|
|
64
|
-
/**
|
|
65
|
-
* Watches for changes to the checked state and emits the new value.
|
|
66
|
-
* @param {boolean} checked - The new value of the checked state.
|
|
67
|
-
*/
|
|
68
|
-
handleCheckedChange(checked) {
|
|
69
|
-
this.checkedChanged.emit(checked);
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Listens for the change event on the radio button input element and controls
|
|
73
|
-
* the checked state of the host elements.
|
|
74
|
-
* @param {Event} event - The change event.
|
|
75
|
-
*/
|
|
76
|
-
handleChange(event) {
|
|
77
|
-
const target = event.target;
|
|
78
|
-
if (target?.type === 'radio') {
|
|
79
|
-
Array.from(document.getElementsByTagName('nv-fieldradio')).forEach(element => {
|
|
80
|
-
if (element.name === this.name) {
|
|
81
|
-
element.checked = false;
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
this.checked = target.checked;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
//#endregion WATCHERS
|
|
88
|
-
/****************************************************************************/
|
|
89
|
-
//#region RENDER
|
|
90
|
-
render() {
|
|
91
|
-
return (index.h(index.Host, { key: 'bae8d6168e0845413655d8b52c14a2c348832616', class: clsxChV9xqsO.clsx(this.labelPlacement === 'before' && 'label-placement-before', this.error && 'error') }, index.h("input", { key: '4d3e7cd78625c3d42025f85be66c8f389501d01e', type: "radio", id: this.inputId, name: this.name, autofocus: this.autofocus, autocomplete: "off", value: this.value, checked: this.checked, disabled: this.disabled }), index.h("div", { key: '2d12f20bc8c0cf4bd3d31916bfeed8a8ef13de37', class: "text-container" }, (this.label || this.el.querySelector('[slot="label"]')) && (index.h("label", { key: '91b2080433d987def3d2ddf45c9817cc5852ebee', htmlFor: this.inputId }, index.h("slot", { key: '61c2209353903495e30bc86a281b0460a8d1ee2e', name: "label" }, this.label))), (this.description ||
|
|
92
|
-
this.el.querySelector('[slot="description"]')) && (index.h("div", { key: 'f33b847894e5ea058ae36bb0fa107c5c28062443', class: "description" }, index.h("slot", { key: '24c4b14000b8dd0738b1c3fdc8c97aebc9f3c03f', name: "description" }, this.description))), (this.errorDescription ||
|
|
93
|
-
this.el.querySelector('[slot="error-description"]')) && (index.h("div", { key: 'bcc07ebfaa0d8dcd3c9a813ccd33322096b5aa82', hidden: !this.error, class: "error-description" }, index.h("slot", { key: '7cd0cb86be513924ccd83a3a93e4d8871ac21b7b', name: "error-description" }, this.errorDescription))))));
|
|
94
|
-
}
|
|
95
|
-
static get formAssociated() { return true; }
|
|
96
|
-
get el() { return index.getElement(this); }
|
|
97
|
-
static get watchers() { return {
|
|
98
|
-
"checked": [{
|
|
99
|
-
"handleCheckedChange": 0
|
|
100
|
-
}]
|
|
101
|
-
}; }
|
|
102
|
-
};
|
|
103
|
-
NvFieldradio.style = nvFieldradioCss();
|
|
104
|
-
|
|
105
|
-
exports.nv_fieldradio = NvFieldradio;
|
|
@@ -1,82 +0,0 @@
|
|
|
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;
|
|
File without changes
|