@nova-design-system/nova-react 3.22.0 → 3.24.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/_commonjsHelpers-B85MJLTf-CFO10eej.js +7 -0
- package/dist/cjs/{collapse.animation-6e0b08df-AHWzNGm_.js → collapse.animation-DZDm0vSK-C2TOIhIK.js} +3 -3
- package/dist/cjs/events.utils-B6GgGra--01N__3wY.js +23 -0
- package/dist/cjs/{fade.animation-9b939939-DV--bM4S.js → fade.animation-DcRL9lcm-DAZeHoKN.js} +75 -75
- package/dist/cjs/generated/components.server.js +292 -50
- package/dist/cjs/{grow.animation-24ad5cf8-LUp_ITEx.js → grow.animation-D7ep_aVl-BuXEDSK-.js} +5 -26
- package/dist/cjs/i18n.utils-IlwlcG9l-ku0bScip.js +2494 -0
- package/dist/cjs/{index-WPRkQD3O.js → index-kU2nW5aN.js} +12692 -7009
- package/dist/cjs/{nv-dialog.entry-CDSK9pUH.js → index.esm-D3eWMME9-CG1TVKfu.js} +1 -296
- package/dist/cjs/index.js +15 -1
- package/dist/cjs/inputmask-CSo292ul-DlvupPk6.js +3758 -0
- package/dist/cjs/{nv-accordion-item.entry-BuTvA6w9.js → nv-accordion-item.entry-Bu1tAcCq.js} +11 -10
- package/dist/cjs/{nv-accordion.entry-Dtsfw6He.js → nv-accordion.entry-jWjLdX8w.js} +9 -11
- package/dist/cjs/{nv-alert.entry-TIdfdU7Y.js → nv-alert.entry-E9ZJay_K.js} +22 -23
- package/dist/cjs/{nv-avatar.entry-CaxrhPuw.js → nv-avatar.entry-CUX7u0kR.js} +11 -11
- package/dist/cjs/{nv-badge_2.entry-CfYvTZxX.js → nv-badge_2.entry-bxpV5gxE.js} +24 -24
- package/dist/cjs/{nv-breadcrumb.entry-BCZ4MmfD.js → nv-breadcrumb.entry-Cbbb9Qeh.js} +5 -5
- package/dist/cjs/{nv-breadcrumbs.entry-DwzCE7F6.js → nv-breadcrumbs.entry-BTqnp9zO.js} +3 -3
- package/dist/cjs/{nv-button.entry-Cr_86bcZ.js → nv-button.entry-upWH19y6.js} +12 -14
- package/dist/cjs/{nv-buttongroup.entry-CWjRoHY1.js → nv-buttongroup.entry-CuZCRsnV.js} +3 -3
- package/dist/cjs/{nv-calendar.entry-CXfwNt6G.js → nv-calendar.entry-CT3mASW6.js} +113 -97
- package/dist/cjs/{nv-col.entry-CJLDS3LY.js → nv-col.entry--pCxkaTh.js} +5 -5
- package/dist/cjs/{nv-datagrid.entry-Cns8XSud.js → nv-datagrid.entry-CGCEhO8C.js} +80 -85
- package/dist/cjs/{nv-datagridcolumn.entry-CFFAipHF.js → nv-datagridcolumn.entry-Fsqc7CT_.js} +2 -1
- package/dist/cjs/nv-dialog.entry-B6OYcZxQ.js +300 -0
- package/dist/cjs/{nv-dialogfooter_2.entry-To_dGUn4.js → nv-dialogfooter_2.entry-C4fP_n2-.js} +10 -11
- package/dist/cjs/nv-drawer.entry-C5O4KvHU.js +445 -0
- package/dist/cjs/nv-drawerfooter_2.entry-C-reYJXG.js +146 -0
- package/dist/cjs/nv-fieldcheckbox.entry-bk7UNQny.js +177 -0
- package/dist/cjs/{nv-fielddate.entry-C3pXtMHL.js → nv-fielddate.entry-dqZDBVmm.js} +89 -46
- package/dist/cjs/{nv-fielddaterange.entry-CjVVPEK_.js → nv-fielddaterange.entry-wNRasXky.js} +151 -103
- package/dist/cjs/nv-fielddropdown.entry-BA15piWa.js +678 -0
- package/dist/cjs/{nv-fielddropdownitem.entry-Dah-PaE8.js → nv-fielddropdownitem.entry-DEWaf9dC.js} +7 -7
- package/dist/cjs/{nv-fieldmultiselect.entry-BMLjhqoJ.js → nv-fieldmultiselect.entry-BWY5xOAd.js} +343 -236
- package/dist/cjs/nv-fieldnumber.entry-DoYORd0d.js +187 -0
- package/dist/cjs/nv-fieldpassword.entry-CPaLj9aD.js +165 -0
- package/dist/cjs/{nv-fieldradio.entry-X_2VT1Dj.js → nv-fieldradio.entry-CvUmEaCa.js} +11 -11
- package/dist/cjs/{nv-fieldselect.entry-pSp-2rNn.js → nv-fieldselect.entry-uUIZ6hmN.js} +52 -13
- package/dist/cjs/{nv-fieldslider.entry-pZf7zzLU.js → nv-fieldslider.entry-DnvmxxYY.js} +16 -31
- package/dist/cjs/nv-fieldtext.entry-BYAJp3n_.js +163 -0
- package/dist/cjs/{nv-fieldtextarea.entry-t3Ixxi23.js → nv-fieldtextarea.entry-DU2bWYeg.js} +52 -14
- package/dist/cjs/{nv-fieldtime.entry-DY7D5_6K.js → nv-fieldtime.entry-DlMNDTht.js} +128 -84
- package/dist/cjs/{nv-icon.entry-6oYPSf4c.js → nv-icon.entry-CnUkRzaA.js} +12 -12
- package/dist/cjs/{nv-iconbutton_2.entry-ChULGovr.js → nv-iconbutton_2.entry-hqp4AcRq.js} +10 -12
- package/dist/cjs/{nv-menu.entry-sd0tatWq.js → nv-menu.entry-Dc_FvIx7.js} +18 -32
- package/dist/cjs/{nv-menuitem.entry-CCOqR7UF.js → nv-menuitem.entry-DzMhx6c_.js} +6 -5
- package/dist/cjs/nv-notification-bullet.entry-BwhHCMQF.js +76 -0
- package/dist/cjs/{nv-notification.entry-Cc3zE3yY.js → nv-notification.entry-C3m5p5BL.js} +42 -128
- package/dist/cjs/{nv-notificationcontainer.entry-DV4D6oOH.js → nv-notificationcontainer.entry-DTRNn7VE.js} +4 -4
- package/dist/cjs/{nv-popover.entry-DQSwI2jT.js → nv-popover.entry-B0c-2rO4.js} +51 -47
- package/dist/cjs/{nv-row.entry-UUuMSAY5.js → nv-row.entry-CdcjVGZv.js} +4 -4
- package/dist/cjs/nv-sidebar.entry-CiN813gQ.js +177 -0
- package/dist/cjs/nv-sidebarcontent.entry-D9hpAhK8.js +22 -0
- package/dist/cjs/nv-sidebardivider.entry-B4EMyca5.js +22 -0
- package/dist/cjs/nv-sidebarfooter.entry-CHi4qOFe.js +22 -0
- package/dist/cjs/nv-sidebargroup.entry-RVqrsyIU.js +23 -0
- package/dist/cjs/nv-sidebarheader.entry-_7ch0O3G.js +22 -0
- package/dist/cjs/nv-sidebarlogo.entry-Ch9F-JnT.js +32 -0
- package/dist/cjs/nv-sidebarnavitem.entry-DVrafSMr.js +296 -0
- package/dist/cjs/nv-sidebarnavsubitem.entry-C0XDAzma.js +35 -0
- package/dist/cjs/{nv-split.entry-CYP2bTTM.js → nv-split.entry-0HTslRAX.js} +47 -45
- package/dist/cjs/{nv-stack.entry-D35-75Vw.js → nv-stack.entry-CqO7uTQf.js} +5 -5
- package/dist/cjs/{nv-table.entry-DevWJBnL.js → nv-table.entry-DH85n8Mc.js} +9 -11
- package/dist/cjs/{nv-tableheader.entry-Hs7nUSOC.js → nv-tableheader.entry-CKfocdxD.js} +7 -7
- package/dist/cjs/{nv-toggle.entry-Eje9d--6.js → nv-toggle.entry-BHUl76Im.js} +9 -9
- package/dist/cjs/nv-togglebutton.entry-D_9COjY-.js +67 -0
- package/dist/cjs/{nv-togglebuttongroup.entry-CWN_Ucry.js → nv-togglebuttongroup.entry-C0NLbsq7.js} +10 -8
- package/dist/cjs/{nv-tooltip.entry-BGkKDEFg.js → nv-tooltip.entry-BfViGE_U.js} +5 -5
- package/dist/cjs/slide.animation-CmH5d1of-BZuw607U.js +90 -0
- package/dist/cjs/{style-value-types.es-f5d10b79-D0QCM8OB.js → style-value-types.es-xlgmw4x8-B1vLqX9m.js} +6 -3
- package/dist/cjs/{v4-a79185f4-2n0dOd_Y.js → v4-BdYh22OP-C1vaJ4yP.js} +1 -1
- package/dist/components/NvDatatable/NvDatatable.js +40 -24
- package/dist/generated/components.js +107 -0
- package/dist/generated/components.server.js +260 -50
- package/dist/providers/NotificationProvider.js +3 -4
- package/dist/types/components/NvDatatable/NvDatatable.d.ts +1 -1
- package/dist/types/components/NvDatatable/types.d.ts +8 -3
- package/dist/types/generated/components.d.ts +46 -0
- package/dist/types/generated/components.server.d.ts +46 -0
- package/package.json +2 -2
- package/dist/cjs/_commonjsHelpers-1789f0cf-BJu3ubxk.js +0 -10
- package/dist/cjs/inputmask-edcad3c1-B9Omti4z.js +0 -3749
- package/dist/cjs/nv-fieldcheckbox.entry-fdonR07Z.js +0 -138
- package/dist/cjs/nv-fielddropdown.entry-C9mXuNNj.js +0 -392
- package/dist/cjs/nv-fieldnumber.entry-DBdJviXu.js +0 -148
- package/dist/cjs/nv-fieldpassword.entry-Cim_usSM.js +0 -122
- package/dist/cjs/nv-fieldtext.entry-DlI_ExaV.js +0 -124
- package/dist/cjs/nv-togglebutton.entry-LGI7pIeK.js +0 -56
- /package/dist/cjs/{clsx-297c1ffe-BtxeOLZW.js → clsx-ChV9xqsO-BtxeOLZW.js} +0 -0
- /package/dist/cjs/{constants-69bafca2-DpB_ghPF.js → constants-BReL3Lsa-DpB_ghPF.js} +0 -0
- /package/dist/cjs/{timeline.animation-79215cd4-KteJaZPb.js → timeline.animation-CgHCo_Ho-KteJaZPb.js} +0 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-kU2nW5aN.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 nvFieldcheckboxCss = "nv-fieldslider .slider-container .track-container:has(.thumb:hover) .track-range{background:var(--components-slider-track-filled-hover)}nv-fieldslider .slider-container .track-container:has(.thumb:hover) .thumb{border-color:var(--components-slider-track-filled-hover)}nv-fieldslider .slider-container .track-container:has(.thumb:focus) .track-range{background:var(--components-slider-track-filled-focus)}nv-fieldslider .slider-container .track-container:has(.thumb:focus) .thumb{border-color:var(--components-slider-track-filled-focus)}nv-fieldslider[error] .slider-container .track-container .track .track-range{background:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb{border-color:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb:hover{border-color:var(--components-slider-track-filled-error);outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-slider-track-filled-error);outline-offset:calc(var(--focus-outline-offset) * 1);background-color:var(--components-slider-handler-background-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb:focus{border-color:var(--components-slider-track-filled-error);outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-slider-track-filled-error);outline-offset:calc(var(--focus-outline-offset) * 1);background-color:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container:has(.thumb:hover) .track-range{background:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container:has(.thumb:hover) .thumb{border-color:var(--components-slider-track-filled-error)}nv-fieldcheckbox{--nv-fieldcheckbox-border-default:var(\n --components-form-field-border-default\n );--nv-fieldcheckbox-border-hover:var(--components-form-field-border-hover);--nv-fieldcheckbox-border-focus:var(--components-form-field-border-default);--nv-fieldcheckbox-background-default:var(\n --components-form-field-background-default\n );--nv-fieldcheckbox-background-checked:var(\n --components-form-field-background-checked\n );--nv-fieldcheckbox-background-disabled:var(\n --components-form-field-background-disabled\n );--nv-fieldcheckbox-focus-box-shadow:var(--color-focus-brand);--nv-fieldcheckbox-color-checked:var(\n --components-form-shape-foreground-default\n );--nv-fieldcheckbox-color-disabled:var(\n --components-form-shape-foreground-disabled\n );--nv-fieldcheckbox-outline-color:var(--color-focus-brand);display:inline-flex;align-items:flex-start;gap:var(--form-gap-x);position:relative}nv-fieldcheckbox:not([disabled],[readonly]) input,nv-fieldcheckbox:not([disabled],[readonly]) label{cursor:pointer}nv-fieldcheckbox.error>.input-container{--nv-fieldcheckbox-border-default:var(--components-form-field-border-error);--nv-fieldcheckbox-border-hover:var(--nv-fieldcheckbox-border-default);--nv-fieldcheckbox-border-focus:var(--components-form-field-border-error);--nv-fieldcheckbox-focus-box-shadow:var(--color-focus-destructive);--nv-fieldcheckbox-color-disabled:var(\n --components-form-shape-foreground-disabled-error\n );--nv-fieldcheckbox-background-checked:var(\n --components-form-field-background-error\n );--nv-fieldcheckbox-outline-color:var(--color-focus-destructive)}nv-fieldcheckbox.label-placement-before{flex-direction:row-reverse}nv-fieldcheckbox[disabled]:not([disabled=false]){opacity:0.5}nv-fieldcheckbox>.input-container{position:relative;color:var(--nv-fieldcheckbox-color-checked)}nv-fieldcheckbox>.input-container input[type=checkbox][readonly]{opacity:0.5}nv-fieldcheckbox>.input-container:has(input[type=checkbox]:disabled:not([readonly])){color:var(--nv-fieldcheckbox-color-disabled)}nv-fieldcheckbox>.input-container input[type=checkbox]{appearance:none;position:relative;display:flex;width:var(--form-checkbox-size);height:var(--form-checkbox-size);flex-direction:column;align-items:flex-start;border-radius:var(--form-checkbox-radius);border-width:var(--form-checkbox-border-width);border-style:solid;border-color:var(--nv-fieldcheckbox-border-default);background:var(--nv-fieldcheckbox-background-default)}nv-fieldcheckbox>.input-container input[type=checkbox]:hover{border-color:var(--nv-fieldcheckbox-border-hover)}nv-fieldcheckbox>.input-container input[type=checkbox]:focus{border-color:var(--nv-fieldcheckbox-border-focus)}nv-fieldcheckbox>.input-container input[type=checkbox]:focus,nv-fieldcheckbox>.input-container input[type=checkbox]:focus-within{outline:none}nv-fieldcheckbox>.input-container input[type=checkbox]:focus-visible,nv-fieldcheckbox>.input-container input[type=checkbox]:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--nv-fieldcheckbox-outline-color);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-fieldcheckbox>.input-container input[type=checkbox]:checked,nv-fieldcheckbox>.input-container input[type=checkbox]:indeterminate{background:var(--nv-fieldcheckbox-background-checked);border-color:var(--nv-fieldcheckbox-background-checked)}nv-fieldcheckbox>.input-container input[type=checkbox]:disabled:not([readonly]){background:var(--nv-fieldcheckbox-background-disabled);border-color:var(--nv-fieldcheckbox-border-default)}nv-fieldcheckbox>.input-container input[type=checkbox][readonly]{opacity:0.5}nv-fieldcheckbox>.input-container .icon{pointer-events:none;position:absolute;top:0;left:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center}nv-fieldcheckbox>.input-container .icon svg{width:var(--form-checkbox-icon-size);height:var(--form-checkbox-icon-size);fill:none;stroke:currentcolor;stroke-width:var(--form-checkbox-icon-stroke);flex-shrink:0}nv-fieldcheckbox[required]:not([required=false])>.text-container label::after,nv-fieldcheckbox[aria-required=true]>.text-container label::after{content:\"*\";color:var(--components-form-text-required);font-weight:var(--font-weight-high-emphasis)}nv-fieldcheckbox>.text-container{display:flex;flex-direction:column;align-items:flex-start;flex:1 0 0}nv-fieldcheckbox>.text-container label{align-self:stretch;text-align:left;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-fieldcheckbox>.text-container 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-fieldcheckbox>.text-container .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-fieldcheckbox>.text-container .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)}";
|
|
11
|
+
|
|
12
|
+
const NvFieldcheckbox = class {
|
|
13
|
+
constructor(hostRef) {
|
|
14
|
+
index.registerInstance(this, hostRef);
|
|
15
|
+
this.checkedChanged = index.createEvent(this, "checkedChanged", 3);
|
|
16
|
+
/**
|
|
17
|
+
* When true, the label will be placed before the checkbox.
|
|
18
|
+
* @deprecated Use `labelPlacement = end` 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
|
+
* Hides the label visually while still keeping it available for screen
|
|
33
|
+
* readers.
|
|
34
|
+
*/
|
|
35
|
+
this.hideLabel = false;
|
|
36
|
+
/**
|
|
37
|
+
* Signals that there is an error associated with the checkbox, which can
|
|
38
|
+
* trigger visual cues.
|
|
39
|
+
* @validator error
|
|
40
|
+
*/
|
|
41
|
+
this.error = false;
|
|
42
|
+
/**
|
|
43
|
+
* Indicates whether the checkbox is checked or not.
|
|
44
|
+
*/
|
|
45
|
+
this.checked = false;
|
|
46
|
+
/**
|
|
47
|
+
* Indicates whether the checkbox is in an indeterminate state, typically used
|
|
48
|
+
* for hierarchical checkboxes.
|
|
49
|
+
*/
|
|
50
|
+
this.indeterminate = false;
|
|
51
|
+
/**
|
|
52
|
+
* Disables the checkbox, preventing user interaction.
|
|
53
|
+
*/
|
|
54
|
+
this.disabled = false;
|
|
55
|
+
/**
|
|
56
|
+
* Sets the checkbox to read-only, preventing user changes but still allowing
|
|
57
|
+
* focus and selection of text.
|
|
58
|
+
*/
|
|
59
|
+
this.readonly = false;
|
|
60
|
+
/**
|
|
61
|
+
* Marks the checkbox as required, indicating that it must be checked for
|
|
62
|
+
* form submission.
|
|
63
|
+
* @note This uses the native HTML `required` attribute, which triggers browser validation.
|
|
64
|
+
*/
|
|
65
|
+
this.required = false;
|
|
66
|
+
/**
|
|
67
|
+
* Marks the checkbox as required for accessibility purposes without triggering
|
|
68
|
+
* native HTML validation. Use this when implementing custom validation logic.
|
|
69
|
+
* @note When set, this uses `aria-required` instead of the native `required` attribute.
|
|
70
|
+
* This allows developers to implement custom validation while maintaining accessibility.
|
|
71
|
+
* @note If this prop is not explicitly set, the component will check for the HTML attribute
|
|
72
|
+
* 'aria-required' directly to determine if it should be applied.
|
|
73
|
+
*/
|
|
74
|
+
this.ariaRequiredAttr = false;
|
|
75
|
+
/**
|
|
76
|
+
* Applies focus to the input field as soon as the component is mounted. This
|
|
77
|
+
* is equivalent to setting the native autofocus attribute on an <input>
|
|
78
|
+
* element.
|
|
79
|
+
*/
|
|
80
|
+
this.autofocus = false;
|
|
81
|
+
}
|
|
82
|
+
//#endregion EVENTS
|
|
83
|
+
/****************************************************************************/
|
|
84
|
+
//#region LISTENERS
|
|
85
|
+
/**
|
|
86
|
+
* Listens for the change event on the checkbox input element and updates the
|
|
87
|
+
* checked state.
|
|
88
|
+
* @param {Event} event - The change event.
|
|
89
|
+
*/
|
|
90
|
+
handleChange(event) {
|
|
91
|
+
const target = event.target;
|
|
92
|
+
if (target.type === 'checkbox' && target.id === this.inputId) {
|
|
93
|
+
if (this.readonly || this.disabled) {
|
|
94
|
+
event.preventDefault();
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (this.indeterminate) {
|
|
98
|
+
this.indeterminate = false;
|
|
99
|
+
}
|
|
100
|
+
this.checked = target.checked;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
//#endregion LISTENERS
|
|
104
|
+
/****************************************************************************/
|
|
105
|
+
//#region WATCHERS
|
|
106
|
+
/**
|
|
107
|
+
* Watches for changes to the checked state and emits the new value.
|
|
108
|
+
* @param {boolean} checked - The new value of the checked state.
|
|
109
|
+
*/
|
|
110
|
+
onCheckedChanged(checked) {
|
|
111
|
+
this.checkedChanged.emit(checked);
|
|
112
|
+
}
|
|
113
|
+
//#endregion WATCHERS
|
|
114
|
+
/****************************************************************************/
|
|
115
|
+
//#region LIFECYCLE
|
|
116
|
+
componentWillRender() {
|
|
117
|
+
if (this.message) {
|
|
118
|
+
this.description = this.message;
|
|
119
|
+
}
|
|
120
|
+
if (this.labelBefore) {
|
|
121
|
+
this.labelPlacement = 'before';
|
|
122
|
+
}
|
|
123
|
+
if (this.validation) {
|
|
124
|
+
this.errorDescription = this.validation;
|
|
125
|
+
this.error = true;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
//#endregion LIFECYCLE
|
|
129
|
+
/****************************************************************************/
|
|
130
|
+
//#region RENDER
|
|
131
|
+
render() {
|
|
132
|
+
// Check aria-required from multiple sources:
|
|
133
|
+
// 1. HTML attribute 'aria-required' (direct HTML) - check if explicitly set
|
|
134
|
+
// 2. JavaScript prop (when prop is explicitly set via JavaScript)
|
|
135
|
+
// We use hasAttribute to determine if the attribute was explicitly set by the user,
|
|
136
|
+
// since the prop now defaults to false (to maintain Blazor compatibility)
|
|
137
|
+
const hasAriaRequiredAttr = this.el.hasAttribute('aria-required') ||
|
|
138
|
+
this.el.hasAttribute('aria-required-attr');
|
|
139
|
+
const ariaRequiredFromAttr = hasAriaRequiredAttr
|
|
140
|
+
? this.el.getAttribute('aria-required') ||
|
|
141
|
+
this.el.getAttribute('aria-required-attr')
|
|
142
|
+
: null;
|
|
143
|
+
// Use aria-required if the attribute was explicitly set
|
|
144
|
+
// With reflect: true, setting the prop will also set the attribute
|
|
145
|
+
const useAriaRequired = hasAriaRequiredAttr;
|
|
146
|
+
// Determine the value: use attribute if it exists (prop reflects to attribute via reflect: true)
|
|
147
|
+
// If attribute doesn't exist, the prop was never set and we don't use aria-required
|
|
148
|
+
const ariaRequiredAttrValue = hasAriaRequiredAttr
|
|
149
|
+
? ariaRequiredFromAttr
|
|
150
|
+
: null;
|
|
151
|
+
// Determine which attributes to use
|
|
152
|
+
// If aria-required HTML attribute is present, use it (convert string to boolean)
|
|
153
|
+
// If required is set and aria-required is not "false", use native required
|
|
154
|
+
// If aria-required is "false", don't use native required even if required is set
|
|
155
|
+
const ariaRequiredValue = useAriaRequired
|
|
156
|
+
? ariaRequiredAttrValue === 'true' || ariaRequiredAttrValue === ''
|
|
157
|
+
: undefined;
|
|
158
|
+
const useNativeRequired = this.required && (!useAriaRequired || ariaRequiredValue === true);
|
|
159
|
+
return (index.h(index.Host, { key: 'a652f9f7dcf00323548c79c9ca1f5fe1ef403279', class: clsxChV9xqsO.clsx(this.labelPlacement === 'before' && 'label-placement-before', this.error && 'error') }, index.h("div", { key: '84057811ecdd93b46e4f33868e8c8cc0ea340125', class: "input-container" }, index.h("input", { key: 'da53b190076395852c2f08be8da16c3a9c53fbaa', type: "checkbox", id: this.inputId, name: this.name, autofocus: this.autofocus, autocomplete: "off", value: this.value, checked: Boolean(this.checked), disabled: this.disabled || this.readonly, readonly: this.readonly && !useNativeRequired, required: useNativeRequired ? this.required : undefined, ...(ariaRequiredValue !== undefined && {
|
|
160
|
+
'aria-required': String(ariaRequiredValue),
|
|
161
|
+
}), indeterminate: this.indeterminate, ref: el => {
|
|
162
|
+
if (el) {
|
|
163
|
+
el.indeterminate = this.indeterminate;
|
|
164
|
+
}
|
|
165
|
+
} }), index.h("span", { key: 'c1263f5094377623504381d52b78769033d13a63', class: "icon" }, this.checked && !this.indeterminate && (index.h("slot", { key: '49f9639d08ade9a197e283d3677d294ae01369e9', name: "checked-icon" }, index.h("svg", { key: '9ad3cefe29f5e12d26912679d290441e6f9765d0', xmlns: "http://www.w3.org/2000/svg", width: "14", height: "14", viewBox: "0 0 14 14", fill: "none" }, index.h("path", { key: 'b3cf7a393ee5b797310ad338afb5abd3bfd9cfaa', d: "M11.6667 3.5L5.25004 9.91667L2.33337 7", "stroke-linecap": "round", "stroke-linejoin": "round" })))), this.indeterminate && (index.h("slot", { key: 'e4a615810324cdc3a14d11dcdaf2e06c9ea8538e', name: "indeterminate-icon" }, index.h("svg", { key: '50230f9244694641bbb38411a886e563dc5952f5', class: "indeterminate-svg", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 14 14", fill: "none" }, index.h("path", { key: '8cfb893ef82d5d91c270bc5c029d320a8ca7f276', d: "M2.9165 7H11.0832", "stroke-linecap": "round", "stroke-linejoin": "round" })))))), index.h("slot", { key: '328cef43f740ad18f2666805ba9e755687aa987c' }), index.h("div", { key: 'b380cefbf5c97d62d77b9940ef2e241c22764302', class: "text-container" }, index.h("slot", { key: 'd3f7fb813ada2cfef74e6068eb5a1304bc28396a', name: "main" }, (this.label || this.el.querySelector('[slot="label"]')) && (index.h("label", { key: 'cf7d3f46915b2d149c6dc4c7cce3b3741c3e952f', htmlFor: this.inputId, class: clsxChV9xqsO.clsx(this.hideLabel && 'visually-hidden') }, index.h("slot", { key: '9c57662513ef680545bcdf8d93c7e92ce4259054', name: "label" }, this.label))), (this.description ||
|
|
166
|
+
this.el.querySelector('[slot="description"]')) && (index.h("div", { key: '352e1a7f2a09867e36d91f16102ea8be158d0ad7', class: "description" }, index.h("slot", { key: '79e8d147440e4563ca8e966b4f553307c7b5ec1a', name: "description" }, this.description)))), (this.errorDescription ||
|
|
167
|
+
this.el.querySelector('[slot="error-description"]')) && (index.h("div", { key: 'a8cb608dd9f36efedbfb6f82042c61a487ad227f', hidden: !this.error, class: "error-description" }, index.h("slot", { key: '3720f914db04c45cb2e5323a129dd05c9ce3fdfb', name: "error-description" }, this.errorDescription))))));
|
|
168
|
+
}
|
|
169
|
+
static get formAssociated() { return true; }
|
|
170
|
+
get el() { return index.getElement(this); }
|
|
171
|
+
static get watchers() { return {
|
|
172
|
+
"checked": ["onCheckedChanged"]
|
|
173
|
+
}; }
|
|
174
|
+
};
|
|
175
|
+
NvFieldcheckbox.style = nvFieldcheckboxCss;
|
|
176
|
+
|
|
177
|
+
exports.nv_fieldcheckbox = NvFieldcheckbox;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var index = require('./index-kU2nW5aN.js');
|
|
4
|
+
var inputmaskCSo292ul = require('./inputmask-CSo292ul-DlvupPk6.js');
|
|
5
|
+
var v4BdYh22OP = require('./v4-BdYh22OP-C1vaJ4yP.js');
|
|
6
|
+
require('@stencil/react-output-target/runtime');
|
|
6
7
|
require('react');
|
|
7
8
|
require('react-dom');
|
|
8
|
-
require('./_commonjsHelpers-
|
|
9
|
+
require('./_commonjsHelpers-B85MJLTf-CFO10eej.js');
|
|
9
10
|
|
|
10
|
-
const nvFielddateCss = "nv-fieldslider .slider-container .track-container:has(.thumb:hover) .track-range{background:var(--components-slider-track-filled-hover)}nv-fieldslider .slider-container .track-container:has(.thumb:hover) .thumb{border-color:var(--components-slider-track-filled-hover)}nv-fieldslider .slider-container .track-container:has(.thumb:focus) .track-range{background:var(--components-slider-track-filled-focus)}nv-fieldslider .slider-container .track-container:has(.thumb:focus) .thumb{border-color:var(--components-slider-track-filled-focus)}nv-fieldslider[error] .slider-container .track-container .track .track-range{background:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb{border-color:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb:hover{border-color:var(--components-slider-track-filled-error);outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-slider-track-filled-error);outline-offset:calc(var(--focus-outline-offset) * 1);background-color:var(--components-slider-handler-background-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb:focus{border-color:var(--components-slider-track-filled-error);outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-slider-track-filled-error);outline-offset:calc(var(--focus-outline-offset) * 1);background-color:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container:has(.thumb:hover) .track-range{background:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container:has(.thumb:hover) .thumb{border-color:var(--components-slider-track-filled-error)}nv-fielddate{--nv-field-border-default:var(--components-form-field-border-default);--nv-field-border-hover:var(--components-form-field-border-hover);--nv-field-border-focus:var(--components-form-field-border-focus);--nv-field-border-disabled:var(--components-form-field-border-default);--nv-field-border-readonly:var(--components-form-field-border-default);--nv-field-focus-box-shadow:var(--color-focus-brand);--nv-field-background:var(--components-form-field-background-default);display:flex;flex-direction:column;align-items:flex-start;gap:var(--form-gap-y);box-sizing:border-box;max-width:480px}nv-fielddate[fluid]:not([fluid=false]){max-width:unset}nv-fielddate[readonly]:not([readonly=false]){--nv-field-border-default:var(--components-form-field-border-readonly);--nv-field-border-hover:var(--nv-field-border-default);--nv-field-border-focus:var(--components-form-field-border-focus);--nv-field-border-disabled:var(--nv-field-border-default);--nv-field-border-readonly:var(--nv-field-border-default);--nv-field-background:var(--components-form-field-background-readonly)}nv-fielddate[error]:not([error=false]){--nv-field-border-default:var(--components-form-field-border-error);--nv-field-border-hover:var(--nv-field-border-default);--nv-field-border-focus:var(--nv-field-border-default);--nv-field-border-disabled:var(--nv-field-border-default);--nv-field-border-readonly:var(--nv-field-border-default);--nv-field-focus-box-shadow:var(--color-focus-destructive-in-field)}nv-fielddate[success]:not([success=false]){--nv-field-border-default:var(--components-form-field-border-success);--nv-field-border-hover:var(--nv-field-border-default);--nv-field-border-focus:var(--nv-field-border-default);--nv-field-border-disabled:var(--nv-field-border-default);--nv-field-border-readonly:var(--nv-field-border-default);--nv-field-focus-box-shadow:var(--color-focus-success)}nv-fielddate[required]:not([required=false]) label::after{content:\"*\";color:var(--components-form-text-required);font-weight:var(--font-weight-high-emphasis)}nv-fielddate label{display:flex;align-items:center;gap:var(--form-label-gap);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-fielddate nv-popover{width:100%;display:block}nv-fielddate nv-popover [data-scope=popover]{padding:0;background-color:var(--components-list-dropdown-background);border:1px solid var(--components-list-dropdown-border);width:auto}nv-fielddate nv-popover [slot=content]{display:block;width:100%}nv-fielddate nv-popover .datepicker-container{border:none}nv-fielddate .input-wrapper{display:flex;flex-wrap:wrap;gap:var(--form-gap-x);align-items:stretch;align-self:stretch;display:flex;align-items:center;gap:8px}nv-fielddate .input-wrapper .input-container{display:flex;flex-grow:1;justify-content:center;align-items:center;align-self:stretch;border-radius:var(--form-field-radius);border-width:1px;border-style:solid;border-color:var(--nv-field-border-default);opacity:var(--components-form-opacity-default, 1);background:var(--nv-field-background);transition:all 150ms ease-out}nv-fielddate .input-wrapper .input-container:hover{border-color:var(--nv-field-border-hover)}nv-fielddate .input-wrapper .input-container:focus-within,nv-fielddate .input-wrapper .input-container:focus-within:hover,nv-fielddate .input-wrapper .input-container:focus,nv-fielddate .input-wrapper .input-container:focus:hover{border-color:var(--nv-field-border-focus);box-shadow:0px 0px 0px var(--focus-field-stroke) var(--nv-field-focus-box-shadow)}nv-fielddate .input-wrapper .input-container:has(input:read-only){
|
|
11
|
-
const NvFielddateStyle0 = nvFielddateCss;
|
|
11
|
+
const nvFielddateCss = "nv-fieldslider .slider-container .track-container:has(.thumb:hover) .track-range{background:var(--components-slider-track-filled-hover)}nv-fieldslider .slider-container .track-container:has(.thumb:hover) .thumb{border-color:var(--components-slider-track-filled-hover)}nv-fieldslider .slider-container .track-container:has(.thumb:focus) .track-range{background:var(--components-slider-track-filled-focus)}nv-fieldslider .slider-container .track-container:has(.thumb:focus) .thumb{border-color:var(--components-slider-track-filled-focus)}nv-fieldslider[error] .slider-container .track-container .track .track-range{background:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb{border-color:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb:hover{border-color:var(--components-slider-track-filled-error);outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-slider-track-filled-error);outline-offset:calc(var(--focus-outline-offset) * 1);background-color:var(--components-slider-handler-background-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb:focus{border-color:var(--components-slider-track-filled-error);outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-slider-track-filled-error);outline-offset:calc(var(--focus-outline-offset) * 1);background-color:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container:has(.thumb:hover) .track-range{background:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container:has(.thumb:hover) .thumb{border-color:var(--components-slider-track-filled-error)}nv-fielddate{--nv-field-border-default:var(--components-form-field-border-default);--nv-field-border-hover:var(--components-form-field-border-hover);--nv-field-border-focus:var(--components-form-field-border-focus);--nv-field-border-disabled:var(--components-form-field-border-default);--nv-field-border-readonly:var(--components-form-field-border-default);--nv-field-focus-box-shadow:var(--color-focus-brand);--nv-field-background:var(--components-form-field-background-default);display:flex;flex-direction:column;align-items:flex-start;gap:var(--form-gap-y);box-sizing:border-box;max-width:480px}nv-fielddate[fluid]:not([fluid=false]){max-width:unset}nv-fielddate[readonly]:not([readonly=false]){--nv-field-border-default:var(--components-form-field-border-readonly);--nv-field-border-hover:var(--nv-field-border-default);--nv-field-border-focus:var(--components-form-field-border-focus);--nv-field-border-disabled:var(--nv-field-border-default);--nv-field-border-readonly:var(--nv-field-border-default);--nv-field-background:var(--components-form-field-background-readonly)}nv-fielddate[error]:not([error=false]){--nv-field-border-default:var(--components-form-field-border-error);--nv-field-border-hover:var(--nv-field-border-default);--nv-field-border-focus:var(--nv-field-border-default);--nv-field-border-disabled:var(--nv-field-border-default);--nv-field-border-readonly:var(--nv-field-border-default);--nv-field-focus-box-shadow:var(--color-focus-destructive-in-field)}nv-fielddate[success]:not([success=false]){--nv-field-border-default:var(--components-form-field-border-success);--nv-field-border-hover:var(--nv-field-border-default);--nv-field-border-focus:var(--nv-field-border-default);--nv-field-border-disabled:var(--nv-field-border-default);--nv-field-border-readonly:var(--nv-field-border-default);--nv-field-focus-box-shadow:var(--color-focus-success)}nv-fielddate[required]:not([required=false]) label::after,nv-fielddate[aria-required=true] label::after{content:\"*\";color:var(--components-form-text-required);font-weight:var(--font-weight-high-emphasis)}nv-fielddate label{display:flex;align-items:center;gap:var(--form-label-gap);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-fielddate nv-popover{width:100%;display:block}nv-fielddate nv-popover [data-scope=popover]{padding:0;background-color:var(--components-list-dropdown-background);border:1px solid var(--components-list-dropdown-border);width:auto}nv-fielddate nv-popover [slot=content]{display:block;width:100%}nv-fielddate nv-popover .datepicker-container{border:none}nv-fielddate .input-wrapper{display:flex;flex-wrap:wrap;gap:var(--form-gap-x);align-items:stretch;align-self:stretch;display:flex;align-items:center;gap:8px}nv-fielddate .input-wrapper .input-container{display:flex;flex-grow:1;justify-content:center;align-items:center;align-self:stretch;border-radius:var(--form-field-radius);border-width:1px;border-style:solid;border-color:var(--nv-field-border-default);opacity:var(--components-form-opacity-default, 1);background:var(--nv-field-background);transition:all 150ms ease-out}nv-fielddate .input-wrapper .input-container:hover{border-color:var(--nv-field-border-hover)}nv-fielddate .input-wrapper .input-container:focus-within,nv-fielddate .input-wrapper .input-container:focus-within:hover,nv-fielddate .input-wrapper .input-container:focus,nv-fielddate .input-wrapper .input-container:focus:hover{border-color:var(--nv-field-border-focus);box-shadow:0px 0px 0px var(--focus-field-stroke) var(--nv-field-focus-box-shadow)}nv-fielddate .input-wrapper .input-container:has(input:read-only){background-color:var(--components-form-field-background-readonly);border-color:var(--nv-field-border-readonly)}nv-fielddate .input-wrapper .input-container:has(input:disabled){opacity:0.5;background-color:var(--components-form-field-background-disabled);border-color:var(--nv-field-border-disabled)}nv-fielddate .input-wrapper .input-container input{display:flex;align-items:center;flex:1 0 0;overflow:hidden;background-color:transparent;color:var(--components-form-field-content-text);padding:calc(var(--form-field-padding-y) - 1px) var(--form-field-padding-x);font-size:var(--form-field-font-size);font-style:normal;font-weight:var(--font-weight-medium-emphasis);line-height:var(--form-field-line-height);width:100%}nv-fielddate .input-wrapper .input-container input:focus{outline:none}nv-fielddate .input-wrapper .input-container input::placeholder{overflow:hidden;color:var(--components-form-field-content-placeholder);text-overflow:ellipsis;font-family:var(--font-family-default), var(--font-family-fallback), sans-serif;font-size:var(--form-field-font-size);font-style:normal;font-weight:var(--font-weight-low-emphasis);line-height:var(--form-field-line-height)}nv-fielddate .input-wrapper .input-container input{}nv-fielddate .input-wrapper .input-container input[type=password]::-ms-clear,nv-fielddate .input-wrapper .input-container input[type=password]::-ms-reveal{display:none;width:0;height:0}nv-fielddate .input-wrapper .input-container input{font-feature-settings:\"tnum\";font-family:\"TTNorms Pro Mono\", monospace}nv-fielddate .input-wrapper .input-container>nv-iconbutton{border:0px;border-radius:0px}nv-fielddate .input-wrapper .input-container>nv-iconbutton:focus-visible{border-radius:var(--button-md-border-radius);outline-offset:-3px}nv-fielddate .input-wrapper .input-container>nv-iconbutton:last-of-type{border-top-right-radius:var(--form-field-radius);border-bottom-right-radius:var(--form-field-radius)}nv-fielddate .input-wrapper .input-container nv-icon.validation{color:var(--nv-field-border-default)}nv-fielddate .description{display:flex;align-items:center;align-self:stretch;gap:var(--spacing-1);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;line-height:var(--form-description-line-height)}nv-fielddate .error-description{display:flex;align-items:center;align-self:stretch;gap:var(--spacing-1);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;line-height:var(--form-description-line-height);color:var(--components-form-text-description-error)}";
|
|
12
12
|
|
|
13
13
|
const NvFielddate = class {
|
|
14
14
|
constructor(hostRef) {
|
|
15
15
|
index.registerInstance(this, hostRef);
|
|
16
|
-
this.valueChanged = index.createEvent(this, "valueChanged");
|
|
17
|
-
this.popoverId =
|
|
16
|
+
this.valueChanged = index.createEvent(this, "valueChanged", 3);
|
|
17
|
+
this.popoverId = v4BdYh22OP.v4();
|
|
18
18
|
/****************************************************************************/
|
|
19
19
|
//#region PROPERTIES
|
|
20
20
|
/**
|
|
21
21
|
* Sets the ID for the input element and the for attribute of the associated
|
|
22
22
|
* label. If no ID is provided, a random one will be automatically generated.
|
|
23
23
|
*/
|
|
24
|
-
this.inputId =
|
|
24
|
+
this.inputId = v4BdYh22OP.v4();
|
|
25
25
|
/**
|
|
26
26
|
* Disables the input field.
|
|
27
27
|
*/
|
|
@@ -32,8 +32,18 @@ const NvFielddate = class {
|
|
|
32
32
|
this.readonly = false;
|
|
33
33
|
/**
|
|
34
34
|
* Marks the input field as required.
|
|
35
|
+
* @note This uses the native HTML `required` attribute, which triggers browser validation.
|
|
35
36
|
*/
|
|
36
37
|
this.required = false;
|
|
38
|
+
/**
|
|
39
|
+
* Marks the input field as required for accessibility purposes without triggering
|
|
40
|
+
* native HTML validation. Use this when implementing custom validation logic.
|
|
41
|
+
* @note When set, this uses `aria-required` instead of the native `required` attribute.
|
|
42
|
+
* This allows developers to implement custom validation while maintaining accessibility.
|
|
43
|
+
* @note If this prop is not explicitly set, the component will check for the HTML attribute
|
|
44
|
+
* 'aria-required' directly to determine if it should be applied.
|
|
45
|
+
*/
|
|
46
|
+
this.ariaRequiredAttr = false;
|
|
37
47
|
/**
|
|
38
48
|
* Indicates an error state.
|
|
39
49
|
*/
|
|
@@ -106,10 +116,9 @@ const NvFielddate = class {
|
|
|
106
116
|
* @param {MouseEvent} event - The click event.
|
|
107
117
|
*/
|
|
108
118
|
this.handleClickOutside = (event) => {
|
|
109
|
-
var _a;
|
|
110
119
|
if (!(event.target instanceof Node))
|
|
111
120
|
return;
|
|
112
|
-
if (!
|
|
121
|
+
if (!this.el?.contains(event.target))
|
|
113
122
|
this.open = false;
|
|
114
123
|
};
|
|
115
124
|
/**
|
|
@@ -230,11 +239,10 @@ const NvFielddate = class {
|
|
|
230
239
|
this.open = false;
|
|
231
240
|
}
|
|
232
241
|
updateMask() {
|
|
233
|
-
var _a, _b;
|
|
234
242
|
if (!this.inputElement)
|
|
235
243
|
return;
|
|
236
|
-
|
|
237
|
-
const inputMask = new
|
|
244
|
+
this.inputElement.inputmask?.remove?.();
|
|
245
|
+
const inputMask = new inputmaskCSo292ul.Inputmask({
|
|
238
246
|
alias: 'datetime',
|
|
239
247
|
inputFormat: this.convertToInputmaskFormat(this.dateFormat),
|
|
240
248
|
placeholder: this.convertToInputmaskFormat(this.dateFormat),
|
|
@@ -244,8 +252,7 @@ const NvFielddate = class {
|
|
|
244
252
|
clearMaskOnLostFocus: !this.open,
|
|
245
253
|
postValidation: true,
|
|
246
254
|
oncomplete: (e) => {
|
|
247
|
-
|
|
248
|
-
const newValue = (_a = e.target) === null || _a === void 0 ? void 0 : _a.value;
|
|
255
|
+
const newValue = e.target?.value;
|
|
249
256
|
// Only emit if the value actually changed
|
|
250
257
|
if (this.value !== newValue) {
|
|
251
258
|
this.singleValue = newValue;
|
|
@@ -256,6 +263,28 @@ const NvFielddate = class {
|
|
|
256
263
|
});
|
|
257
264
|
inputMask.mask(this.inputElement);
|
|
258
265
|
}
|
|
266
|
+
/**
|
|
267
|
+
* Handles the single date selection event from nv-calendar.
|
|
268
|
+
* Updates the input value and closes the popover.
|
|
269
|
+
* @param {CustomEvent} event - The event from nv-calendar.
|
|
270
|
+
*/
|
|
271
|
+
handleSingleDateChange(event) {
|
|
272
|
+
const value = event.detail;
|
|
273
|
+
const previousValue = this.value;
|
|
274
|
+
this.singleValue = value;
|
|
275
|
+
this.value = value;
|
|
276
|
+
// Set the input value directly when calendar is used
|
|
277
|
+
if (this.inputElement) {
|
|
278
|
+
this.inputElement.value = value;
|
|
279
|
+
}
|
|
280
|
+
// Only emit valueChanged if the value actually changed
|
|
281
|
+
if (previousValue !== value) {
|
|
282
|
+
this.valueChanged.emit(value);
|
|
283
|
+
}
|
|
284
|
+
if (!this.showActions) {
|
|
285
|
+
this.open = false;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
259
288
|
//#endregion METHODS
|
|
260
289
|
/****************************************************************************/
|
|
261
290
|
//#region LIFECYCLE
|
|
@@ -314,31 +343,12 @@ const NvFielddate = class {
|
|
|
314
343
|
//#endregion WATCHERS
|
|
315
344
|
/****************************************************************************/
|
|
316
345
|
//#region LISTENERS
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
* @param {CustomEvent} event - The event from nv-calendar.
|
|
321
|
-
*/
|
|
322
|
-
handleSingleDateChange(event) {
|
|
323
|
-
const value = event.detail;
|
|
324
|
-
const previousValue = this.value;
|
|
325
|
-
this.singleValue = value;
|
|
326
|
-
this.value = value;
|
|
327
|
-
// Set the input value directly when calendar is used
|
|
328
|
-
if (this.inputElement) {
|
|
329
|
-
this.inputElement.value = value;
|
|
330
|
-
}
|
|
331
|
-
// Only emit valueChanged if the value actually changed
|
|
332
|
-
if (previousValue !== value) {
|
|
333
|
-
this.valueChanged.emit(value);
|
|
334
|
-
}
|
|
335
|
-
if (!this.showActions) {
|
|
336
|
-
this.open = false;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
handleClosePopover() {
|
|
346
|
+
/* eslint-disable nova/native-event-listener */
|
|
347
|
+
handleClosePopover(event) {
|
|
348
|
+
event.stopPropagation();
|
|
340
349
|
this.open = false;
|
|
341
350
|
}
|
|
351
|
+
/* eslint-enable nova/native-event-listener */
|
|
342
352
|
handleDocumentClick(event) {
|
|
343
353
|
this.handleClickOutside(event);
|
|
344
354
|
}
|
|
@@ -365,13 +375,46 @@ const NvFielddate = class {
|
|
|
365
375
|
/****************************************************************************/
|
|
366
376
|
//#region RENDER
|
|
367
377
|
render() {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
378
|
+
// Check aria-required from multiple sources:
|
|
379
|
+
// 1. JavaScript prop (most reliable)
|
|
380
|
+
// 2. HTML attribute 'aria-required' (direct HTML)
|
|
381
|
+
// 3. HTML attribute 'aria-required-attr' (from JSX kebab-case conversion)
|
|
382
|
+
// Check aria-required from multiple sources:
|
|
383
|
+
// 1. HTML attribute 'aria-required' (direct HTML) - check if explicitly set
|
|
384
|
+
// 2. JavaScript prop (when prop is explicitly set via JavaScript)
|
|
385
|
+
// We use hasAttribute to determine if the attribute was explicitly set by the user,
|
|
386
|
+
// since the prop now defaults to false (to maintain Blazor compatibility)
|
|
387
|
+
const hasAriaRequiredAttr = this.el.hasAttribute('aria-required') ||
|
|
388
|
+
this.el.hasAttribute('aria-required-attr');
|
|
389
|
+
const ariaRequiredFromAttr = hasAriaRequiredAttr
|
|
390
|
+
? this.el.getAttribute('aria-required') ||
|
|
391
|
+
this.el.getAttribute('aria-required-attr')
|
|
392
|
+
: null;
|
|
393
|
+
// Use aria-required if the attribute was explicitly set
|
|
394
|
+
// With reflect: true, setting the prop will also set the attribute
|
|
395
|
+
const useAriaRequired = hasAriaRequiredAttr;
|
|
396
|
+
// Determine the value: use attribute if it exists (prop reflects to attribute via reflect: true)
|
|
397
|
+
// If attribute doesn't exist, the prop was never set and we don't use aria-required
|
|
398
|
+
const ariaRequiredAttrValue = hasAriaRequiredAttr
|
|
399
|
+
? ariaRequiredFromAttr
|
|
400
|
+
: null;
|
|
401
|
+
// Determine which attributes to use
|
|
402
|
+
// If aria-required HTML attribute is present, use it (convert string to boolean)
|
|
403
|
+
// If required is set and aria-required is not "false", use native required
|
|
404
|
+
// If aria-required is "false", don't use native required even if required is set
|
|
405
|
+
const ariaRequiredValue = useAriaRequired
|
|
406
|
+
? ariaRequiredAttrValue === 'true' || ariaRequiredAttrValue === ''
|
|
407
|
+
: undefined;
|
|
408
|
+
const useNativeRequired = this.required && (!useAriaRequired || ariaRequiredValue === true);
|
|
409
|
+
return (index.h(index.Host, { key: 'fb961f31f6876b229d0efc6a7fa5aea2c7a36240' }, ((this.label && this.label.length > 0) ||
|
|
410
|
+
this.el.querySelector('[slot="label"]')) && (index.h("label", { key: '329694103150940fd18587f17b4c8626e11a11a1', htmlFor: this.inputId }, index.h("slot", { key: '08cbbe78114ec70094021a411cf0615f3b2058df', name: "label" }, this.label))), index.h("nv-popover", { key: '8edefb4873bbe454e7cc867b0a7d6213d03c63b5', ref: this.setPopoverRef, id: this.popoverId, triggerMode: "controlled", placement: "bottom-start", open: this.open }, index.h("div", { key: '7661e762b552132a15b83a275105d4f75da79800', slot: "trigger", class: "input-wrapper" }, index.h("slot", { key: '206505eea392922ba402a0cccb9e7b62f71a4c65', name: "before-input" }), index.h("div", { key: 'c6889d4e31f6f8251d06cd1e3aefd31bf1574e26', class: "input-container", onClick: this.handleInputContainerClick }, index.h("slot", { key: '2b6bd21e537faefe054c741d1832669b70a040de', name: "leading-input" }), index.h("input", { key: '76b8f66e58a53dc67ed131f733a268a4ea3b7ca6', id: this.inputId, ref: this.setInputRef, placeholder: this.placeholder ||
|
|
411
|
+
this.convertToInputmaskFormat(this.dateFormat), name: this.name, disabled: this.disabled, readOnly: this.readonly, required: useNativeRequired ? this.required : undefined, ...(ariaRequiredValue !== undefined && {
|
|
412
|
+
'aria-required': String(ariaRequiredValue),
|
|
413
|
+
}), autofocus: this.autofocus, onInput: this.handleInput, onFocus: this.handleFocus, "data-scope": "date" }), this.error && (index.h("nv-icon", { key: '6f9bf3ef1836292f4400dfeb95a6bfc5723e623f', name: "alert-circle", class: "validation", size: "md" })), this.success && (index.h("nv-icon", { key: '84e3c9a2b9401d4eaf148548b215b96d893d8b07', name: "circle-check", class: "validation", size: "md" })), index.h("nv-iconbutton", { key: '51f58c493301263ddc073fa44953c72069d2aadf', class: "toggle-calendar-icon", name: "calendar" //{this.open ? 'chevron-top' : 'chevron-down'}
|
|
371
414
|
,
|
|
372
|
-
size: "md", emphasis: "lower", "aria-label": this.open ? 'Hide calendar' : 'Show calendar', onClick: this.toggleCalendar, tabIndex: this.disabled ? -1 : 0 })), index.h("slot", { key: '
|
|
373
|
-
this.el.querySelector('[slot="description"]')) && (index.h("div", { key: '
|
|
374
|
-
this.el.querySelector('[slot="error-description"]')) && (index.h("div", { key: '
|
|
415
|
+
size: "md", emphasis: "lower", "aria-label": this.open ? 'Hide calendar' : 'Show calendar', onClick: this.toggleCalendar, tabIndex: this.disabled ? -1 : 0 })), index.h("slot", { key: '7b791512f5d2b281ef5b2c366fa09828be2e7d78', name: "after-input" })), index.h("div", { key: '76f5a26675b877c7c7518d52b759fb5b0ffac542', slot: "content" }, index.h("nv-calendar", { key: '7911d656739fe93ca9d633611a1889a7cd26484c', onSingleDateChange: this.handleSingleDateChange.bind(this), dateFormat: this.dateFormat, singleValue: this.singleValue, firstDayOfWeek: this.firstDayOfWeek, numberOfCalendars: this.numberOfCalendars, min: this.min, max: this.max, locale: this.locale, shortcutsPlacement: this.shortcutsPlacement, showActions: this.showActions, shortcuts: this.shortcuts, showWeekNumbers: this.showWeekNumbers, disabledDates: this.disabledDates, onValueChanged: this.handleCalendarValueChanged }))), ((this.description && this.description.length > 0) ||
|
|
416
|
+
this.el.querySelector('[slot="description"]')) && (index.h("div", { key: '94939789941e6b805d459a03b15762c18012448e', class: "description" }, index.h("slot", { key: '1f4866126915efb5a704cb7b7a851dfd1bc23c5c', name: "description" }, this.description))), (this.errorDescription ||
|
|
417
|
+
this.el.querySelector('[slot="error-description"]')) && (index.h("div", { key: 'b374441b023180272694d25e77c83b340eb34ad9', hidden: !this.error, class: "error-description" }, this.el.querySelector('[slot="error-description"]') ? (index.h("slot", { name: "error-description" })) : (this.errorDescription))), index.h("slot", { key: '68e29aa346382002655080163c351586eab3b27f' })));
|
|
375
418
|
}
|
|
376
419
|
get el() { return index.getElement(this); }
|
|
377
420
|
static get watchers() { return {
|
|
@@ -379,6 +422,6 @@ const NvFielddate = class {
|
|
|
379
422
|
"open": ["handleOpenChange"]
|
|
380
423
|
}; }
|
|
381
424
|
};
|
|
382
|
-
NvFielddate.style =
|
|
425
|
+
NvFielddate.style = nvFielddateCss;
|
|
383
426
|
|
|
384
427
|
exports.nv_fielddate = NvFielddate;
|