@nova-design-system/nova-react 3.24.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/README.md +1 -0
- package/dist/cjs/dom.utils-CuXVGECR-8VY5SfMZ.js +177 -0
- package/dist/cjs/generated/components.server.js +82 -62
- package/dist/cjs/index-BeFrXZol.js +9699 -0
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/{nv-accordion-item.entry-Bu1tAcCq.js → nv-accordion-item.entry-DtzjLTCo.js} +8 -7
- package/dist/cjs/{nv-accordion.entry-jWjLdX8w.js → nv-accordion.entry-DRcTfezT.js} +10 -8
- package/dist/cjs/{nv-alert.entry-E9ZJay_K.js → nv-alert.entry-86bfoXVx.js} +6 -4
- package/dist/cjs/nv-avatar.entry-mp2LJ6RA.js +68 -0
- package/dist/cjs/nv-badge_2.entry-BrDaHeqh.js +220 -0
- package/dist/cjs/nv-breadcrumb.entry-B2q7jJy2.js +49 -0
- package/dist/cjs/nv-breadcrumbs.entry-DKzST1uS.js +21 -0
- package/dist/cjs/nv-button.entry-CVgcU-bi.js +166 -0
- package/dist/cjs/{nv-buttongroup.entry-CuZCRsnV.js → nv-buttongroup.entry-CvuBGaGK.js} +12 -6
- package/dist/cjs/{nv-calendar.entry-CT3mASW6.js → nv-calendar.entry-BCcGhxzJ.js} +27 -19
- package/dist/cjs/{nv-col.entry--pCxkaTh.js → nv-col.entry-CzTahRVr.js} +3 -3
- package/dist/cjs/{nv-datagrid.entry-CGCEhO8C.js → nv-datagrid.entry-DWZxNqTE.js} +47 -184
- package/dist/cjs/{nv-datagridcolumn.entry-Fsqc7CT_.js → nv-datagridcolumn.entry-CzCzmdQl.js} +1 -1
- package/dist/cjs/{nv-dialog.entry-B6OYcZxQ.js → nv-dialog.entry-ByVD02QB.js} +19 -20
- package/dist/cjs/{nv-dialogfooter_2.entry-C4fP_n2-.js → nv-dialogfooter_2.entry-BmQcYJsD.js} +11 -29
- package/dist/cjs/{nv-drawer.entry-C5O4KvHU.js → nv-drawer.entry-C15JRJ3N.js} +19 -19
- package/dist/cjs/{nv-drawerfooter_2.entry-C-reYJXG.js → nv-drawerfooter_2.entry-DuDac_Os.js} +11 -29
- package/dist/cjs/nv-fieldcheckbox.entry-CwDOQzSW.js +179 -0
- package/dist/cjs/{nv-fielddate.entry-dqZDBVmm.js → nv-fielddate.entry-DKICGwc0.js} +15 -13
- package/dist/cjs/{nv-fielddaterange.entry-wNRasXky.js → nv-fielddaterange.entry-DGEK8F9p.js} +15 -14
- package/dist/cjs/{nv-fielddropdown.entry-BA15piWa.js → nv-fielddropdown.entry-BLS7lRzD.js} +33 -31
- package/dist/cjs/nv-fielddropdownitem.entry-Bbfi3A8C.js +69 -0
- package/dist/cjs/{nv-fieldmultiselect.entry-BWY5xOAd.js → nv-fieldmultiselect.entry-Cpy7HzlZ.js} +28 -24
- package/dist/cjs/nv-fieldnumber.entry-SbNb4hKr.js +189 -0
- package/dist/cjs/nv-fieldpassword.entry-CPsgagjY.js +167 -0
- package/dist/cjs/nv-fieldradio.entry-DLP-rmKU.js +105 -0
- package/dist/cjs/{nv-fieldselect.entry-uUIZ6hmN.js → nv-fieldselect.entry-DOOO03kM.js} +20 -12
- package/dist/cjs/{nv-fieldslider.entry-DnvmxxYY.js → nv-fieldslider.entry-CpVbxkpo.js} +33 -15
- package/dist/cjs/nv-fieldtext.entry-BpbG4WHv.js +163 -0
- package/dist/cjs/nv-fieldtextarea.entry-BA_RApYN.js +245 -0
- package/dist/cjs/{nv-fieldtime.entry-DlMNDTht.js → nv-fieldtime.entry-DaJfwQtC.js} +15 -9
- package/dist/cjs/{nv-icon.entry-CnUkRzaA.js → nv-icon.entry-DIi792yJ.js} +4 -4
- package/dist/cjs/nv-iconbutton_2.entry-B4xB5WtE.js +171 -0
- package/dist/cjs/{nv-menu.entry-Dc_FvIx7.js → nv-menu.entry-DHWhkWeB.js} +9 -13
- package/dist/cjs/nv-menuitem.entry-CQApuT2D.js +59 -0
- package/dist/cjs/nv-notification-bullet.entry-CnYVWE_Z.js +76 -0
- package/dist/cjs/{nv-notification.entry-C3m5p5BL.js → nv-notification.entry-DraOvzsu.js} +4 -4
- package/dist/cjs/nv-notificationcontainer.entry-BDo-rQLL.js +41 -0
- package/dist/cjs/nv-paginationtable.entry-CS7BhAVe.js +231 -0
- package/dist/cjs/{nv-popover.entry-B0c-2rO4.js → nv-popover.entry-DSyKCLtF.js} +105 -33
- package/dist/cjs/nv-row.entry-D21zN2Vr.js +22 -0
- package/dist/cjs/{nv-sidebar.entry-CiN813gQ.js → nv-sidebar.entry-DpKgnjsJ.js} +10 -6
- package/dist/cjs/nv-sidebarcontent.entry-BWFDcui8.js +22 -0
- package/dist/cjs/{nv-sidebardivider.entry-B4EMyca5.js → nv-sidebardivider.entry-BSzLq-h3.js} +4 -4
- package/dist/cjs/{nv-sidebarfooter.entry-CHi4qOFe.js → nv-sidebarfooter.entry-C3DLHPSQ.js} +4 -4
- package/dist/cjs/nv-sidebargroup.entry-BMYLbCql.js +23 -0
- package/dist/cjs/{nv-sidebarheader.entry-_7ch0O3G.js → nv-sidebarheader.entry-CkUGD-Tw.js} +4 -4
- package/dist/cjs/{nv-sidebarlogo.entry-Ch9F-JnT.js → nv-sidebarlogo.entry-BX1-1S1v.js} +4 -4
- package/dist/cjs/{nv-sidebarnavitem.entry-DVrafSMr.js → nv-sidebarnavitem.entry-CPwt0Njh.js} +9 -7
- package/dist/cjs/nv-sidebarnavsubitem.entry-HZOTB6Tl.js +35 -0
- package/dist/cjs/{nv-split.entry-0HTslRAX.js → nv-split.entry-DdtzktvN.js} +10 -6
- package/dist/cjs/nv-stack.entry-BMLt30Nt.js +31 -0
- package/dist/cjs/{nv-table.entry-DH85n8Mc.js → nv-table.entry-RTiqKRKM.js} +6 -4
- package/dist/cjs/{nv-tableheader.entry-CKfocdxD.js → nv-tableheader.entry-Ci4qo8eY.js} +4 -4
- package/dist/cjs/nv-toggle.entry-s8B7-8P7.js +82 -0
- package/dist/cjs/nv-togglebutton.entry-CyHgU4Wl.js +66 -0
- package/dist/cjs/{nv-togglebuttongroup.entry-C0NLbsq7.js → nv-togglebuttongroup.entry-Bn_9DsdP.js} +13 -9
- package/dist/cjs/nv-tooltip.entry-D6kxXLO-.js +56 -0
- package/dist/components/NvDatatable/NvDatatable.js +29 -8
- package/dist/generated/components.js +11 -0
- package/dist/generated/components.server.js +81 -62
- package/dist/providers/NotificationProvider.js +9 -8
- package/dist/types/components/NvDatatable/types.d.ts +6 -0
- package/dist/types/generated/components.d.ts +52 -46
- package/dist/types/generated/components.server.d.ts +52 -46
- package/package.json +7 -4
- package/dist/cjs/index-kU2nW5aN.js +0 -40286
- package/dist/cjs/nv-avatar.entry-CUX7u0kR.js +0 -68
- package/dist/cjs/nv-badge_2.entry-bxpV5gxE.js +0 -213
- package/dist/cjs/nv-breadcrumb.entry-Cbbb9Qeh.js +0 -46
- package/dist/cjs/nv-breadcrumbs.entry-BTqnp9zO.js +0 -21
- package/dist/cjs/nv-button.entry-upWH19y6.js +0 -162
- package/dist/cjs/nv-fieldcheckbox.entry-bk7UNQny.js +0 -177
- package/dist/cjs/nv-fielddropdownitem.entry-DEWaf9dC.js +0 -72
- package/dist/cjs/nv-fieldnumber.entry-DoYORd0d.js +0 -187
- package/dist/cjs/nv-fieldpassword.entry-CPaLj9aD.js +0 -165
- package/dist/cjs/nv-fieldradio.entry-CvUmEaCa.js +0 -103
- package/dist/cjs/nv-fieldtext.entry-BYAJp3n_.js +0 -163
- package/dist/cjs/nv-fieldtextarea.entry-DU2bWYeg.js +0 -237
- package/dist/cjs/nv-iconbutton_2.entry-hqp4AcRq.js +0 -167
- package/dist/cjs/nv-menuitem.entry-DzMhx6c_.js +0 -60
- package/dist/cjs/nv-notification-bullet.entry-BwhHCMQF.js +0 -76
- package/dist/cjs/nv-notificationcontainer.entry-DTRNn7VE.js +0 -41
- package/dist/cjs/nv-row.entry-CdcjVGZv.js +0 -22
- package/dist/cjs/nv-sidebarcontent.entry-D9hpAhK8.js +0 -22
- package/dist/cjs/nv-sidebargroup.entry-RVqrsyIU.js +0 -23
- package/dist/cjs/nv-sidebarnavsubitem.entry-C0XDAzma.js +0 -35
- package/dist/cjs/nv-stack.entry-CqO7uTQf.js +0 -31
- package/dist/cjs/nv-toggle.entry-BHUl76Im.js +0 -80
- package/dist/cjs/nv-togglebutton.entry-D_9COjY-.js +0 -67
- package/dist/cjs/nv-tooltip.entry-BfViGE_U.js +0 -55
- /package/dist/cjs/{i18n.utils-IlwlcG9l-ku0bScip.js → i18n.utils-CR9MpYzU-ku0bScip.js} +0 -0
|
@@ -1,177 +0,0 @@
|
|
|
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,72 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var index = require('./index-kU2nW5aN.js');
|
|
4
|
-
require('@stencil/react-output-target/runtime');
|
|
5
|
-
require('react');
|
|
6
|
-
require('react-dom');
|
|
7
|
-
|
|
8
|
-
const nvFielddropdownitemCss = "nv-fielddropdownitem{display:flex;gap:var(--spacing-2);flex-wrap:wrap;align-items:center;width:100%;padding:var(--list-dropdown-item-padding-y) var(--list-dropdown-item-padding-x);font-weight:var(--menu-contextual-item-font-weight);font-size:var(--list-dropdown-font-size);line-height:var(--list-dropdown-line-height);color:var(--components-list-dropdown-item-label-default);border-radius:var(--list-dropdown-item-radius);transition:background-color 150ms ease-out, color 150ms ease-out;cursor:pointer}nv-fielddropdownitem:hover,nv-fielddropdownitem:focus,nv-fielddropdownitem:focus-within{background-color:var(--components-list-dropdown-item-background-hover);color:var(--components-menu-contextual-item-content-hover)}nv-fielddropdownitem[disabled]:not([disabled=false]){cursor:not-allowed;background-color:unset;color:var(--components-menu-contextual-item-content-disabled)}nv-fielddropdownitem .text-wrapper{display:flex;flex-grow:1;align-items:center;justify-content:space-between}nv-fielddropdownitem [data-scope=text]{flex-grow:1;word-break:break-word;overflow-wrap:break-word;padding-right:var(--spacing-5)}nv-fielddropdownitem nv-icon[data-scope=selected]{color:var(--components-list-dropdown-item-label-default);align-self:center;margin-left:auto;position:absolute;right:var(--list-dropdown-item-padding-y)}";
|
|
9
|
-
|
|
10
|
-
const NvFielddropdownitem = class {
|
|
11
|
-
constructor(hostRef) {
|
|
12
|
-
index.registerInstance(this, hostRef);
|
|
13
|
-
this.dropdownItemSelected = index.createEvent(this, "dropdownItemSelected", 7);
|
|
14
|
-
this.composed = false;
|
|
15
|
-
/****************************************************************************/
|
|
16
|
-
//#region PROPERTIES
|
|
17
|
-
/**
|
|
18
|
-
* Disables the item, preventing any user interaction.
|
|
19
|
-
*/
|
|
20
|
-
this.disabled = false;
|
|
21
|
-
/**
|
|
22
|
-
* Indicates if the item is selected.
|
|
23
|
-
*/
|
|
24
|
-
this.selected = false;
|
|
25
|
-
/**
|
|
26
|
-
* If detached, the item will not be filtered out or change the dropdown's
|
|
27
|
-
* selected item. Useful for actionable items, such as Add New item, etc.
|
|
28
|
-
*/
|
|
29
|
-
this.detached = false;
|
|
30
|
-
//#endregion EVENTS
|
|
31
|
-
/****************************************************************************/
|
|
32
|
-
//#region METHODS
|
|
33
|
-
this.handleSelected = () => {
|
|
34
|
-
if (this.disabled)
|
|
35
|
-
return;
|
|
36
|
-
this.dropdownItemSelected.emit({
|
|
37
|
-
label: this.label,
|
|
38
|
-
value: this.value,
|
|
39
|
-
detached: this.detached,
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
/* eslint-enable nova/event-bubbling */
|
|
44
|
-
handleKeyDown(event) {
|
|
45
|
-
if (event.target !== this.el)
|
|
46
|
-
return;
|
|
47
|
-
if (event.key === 'Enter' || event.key === ' ') {
|
|
48
|
-
event.preventDefault();
|
|
49
|
-
this.handleSelected();
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
//#endregion METHODS
|
|
53
|
-
/****************************************************************************/
|
|
54
|
-
//#region LIFECYCLE
|
|
55
|
-
componentWillLoad() {
|
|
56
|
-
this.composed = Boolean(this.el.children.length);
|
|
57
|
-
if (!this.value) {
|
|
58
|
-
const fallback = this.label ?? this.el.textContent;
|
|
59
|
-
this.value = fallback.replace(/\W+/g, ''); // Remove non-word characters
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
//#endregion LIFECYCLE
|
|
63
|
-
/****************************************************************************/
|
|
64
|
-
//#region RENDER
|
|
65
|
-
render() {
|
|
66
|
-
return (index.h(index.Host, { key: 'a5ff5cb1a34da1d5b023b0d04349a8f5c3333011', role: "menuitem", tabindex: '-1', onClick: this.handleSelected }, index.h("slot", { key: 'dad658fc948771bc75323bca9343b3b5d88d5343' }), !this.composed && (index.h("div", { key: 'e3f3493d33ea392946b1723e2ca2731fec7e337b', class: "text-wrapper" }, index.h("span", { key: '3c86a6beeb5c19f4fc06201d6018f719592ab5e2', "data-scope": "text" }, this.label))), this.selected && (index.h("nv-icon", { key: 'ffc1c5bc56fc312d65c3ea0beab763e5aa1c1c4a', name: "check", "aria-hidden": "true", "data-scope": "selected" }))));
|
|
67
|
-
}
|
|
68
|
-
get el() { return index.getElement(this); }
|
|
69
|
-
};
|
|
70
|
-
NvFielddropdownitem.style = nvFielddropdownitemCss;
|
|
71
|
-
|
|
72
|
-
exports.nv_fielddropdownitem = NvFielddropdownitem;
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var index = require('./index-kU2nW5aN.js');
|
|
4
|
-
var v4BdYh22OP = require('./v4-BdYh22OP-C1vaJ4yP.js');
|
|
5
|
-
require('@stencil/react-output-target/runtime');
|
|
6
|
-
require('react');
|
|
7
|
-
require('react-dom');
|
|
8
|
-
|
|
9
|
-
const nvFieldnumberCss = "/* TODO: integrate this logic in the proper structure */\nnv-fieldslider .slider-container .track-container:has(.thumb:hover) .track-range {\n background: var(--components-slider-track-filled-hover);\n}\nnv-fieldslider .slider-container .track-container:has(.thumb:hover) .thumb {\n border-color: var(--components-slider-track-filled-hover);\n}\nnv-fieldslider .slider-container .track-container:has(.thumb:focus) .track-range {\n background: var(--components-slider-track-filled-focus);\n}\nnv-fieldslider .slider-container .track-container:has(.thumb:focus) .thumb {\n border-color: var(--components-slider-track-filled-focus);\n}\nnv-fieldslider[error] .slider-container .track-container .track .track-range {\n background: var(--components-slider-track-filled-error);\n}\nnv-fieldslider[error] .slider-container .track-container .track .thumb {\n border-color: var(--components-slider-track-filled-error);\n}\nnv-fieldslider[error] .slider-container .track-container .track .thumb:hover {\n border-color: var(--components-slider-track-filled-error);\n outline: calc(var(--focus-outline-stroke) * 1) solid var(--components-slider-track-filled-error);\n outline-offset: calc(var(--focus-outline-offset) * 1);\n background-color: var(--components-slider-handler-background-error);\n}\nnv-fieldslider[error] .slider-container .track-container .track .thumb:focus {\n border-color: var(--components-slider-track-filled-error);\n outline: calc(var(--focus-outline-stroke) * 1) solid var(--components-slider-track-filled-error);\n outline-offset: calc(var(--focus-outline-offset) * 1);\n background-color: var(--components-slider-track-filled-error);\n}\nnv-fieldslider[error] .slider-container .track-container:has(.thumb:hover) .track-range {\n background: var(--components-slider-track-filled-error);\n}\nnv-fieldslider[error] .slider-container .track-container:has(.thumb:hover) .thumb {\n border-color: var(--components-slider-track-filled-error);\n}\n\nnv-fieldnumber {\n --nv-field-border-default: var(--components-form-field-border-default);\n --nv-field-border-hover: var(--components-form-field-border-hover);\n --nv-field-border-focus: var(--components-form-field-border-focus);\n --nv-field-border-disabled: var(--components-form-field-border-default);\n --nv-field-border-readonly: var(--components-form-field-border-default);\n --nv-field-focus-box-shadow: var(--color-focus-brand);\n --nv-field-background: var(--components-form-field-background-default);\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: var(--form-gap-y);\n box-sizing: border-box;\n max-width: 480px;\n}\nnv-fieldnumber[fluid]:not([fluid=false]) {\n max-width: unset;\n}\nnv-fieldnumber[readonly]:not([readonly=false]) {\n --nv-field-border-default: var(--components-form-field-border-readonly);\n --nv-field-border-hover: var(--nv-field-border-default);\n --nv-field-border-focus: var(--components-form-field-border-focus);\n --nv-field-border-disabled: var(--nv-field-border-default);\n --nv-field-border-readonly: var(--nv-field-border-default);\n --nv-field-background: var(--components-form-field-background-readonly);\n}\nnv-fieldnumber[error]:not([error=false]) {\n --nv-field-border-default: var(--components-form-field-border-error);\n --nv-field-border-hover: var(--nv-field-border-default);\n --nv-field-border-focus: var(--nv-field-border-default);\n --nv-field-border-disabled: var(--nv-field-border-default);\n --nv-field-border-readonly: var(--nv-field-border-default);\n --nv-field-focus-box-shadow: var(--color-focus-destructive-in-field);\n}\nnv-fieldnumber[success]:not([success=false]) {\n --nv-field-border-default: var(--components-form-field-border-success);\n --nv-field-border-hover: var(--nv-field-border-default);\n --nv-field-border-focus: var(--nv-field-border-default);\n --nv-field-border-disabled: var(--nv-field-border-default);\n --nv-field-border-readonly: var(--nv-field-border-default);\n --nv-field-focus-box-shadow: var(--color-focus-success);\n}\nnv-fieldnumber[required]:not([required=false]) label::after, nv-fieldnumber[aria-required=true] label::after {\n content: \"*\";\n color: var(--components-form-text-required);\n font-weight: var(--font-weight-high-emphasis);\n}\nnv-fieldnumber label {\n display: flex;\n align-items: center;\n gap: var(--form-label-gap);\n align-self: stretch;\n color: var(--components-form-text-label-default);\n font-family: var(--font-family-default), var(--font-family-fallback), sans-serif;\n font-size: var(--form-label-font-size);\n font-style: normal;\n font-weight: var(--font-weight-medium-emphasis);\n line-height: var(--form-label-line-height);\n}\nnv-fieldnumber .input-wrapper {\n display: flex;\n flex-wrap: wrap;\n gap: var(--form-gap-x);\n align-items: stretch;\n align-self: stretch;\n}\nnv-fieldnumber .input-wrapper .input-container {\n display: flex;\n flex-grow: 1;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n border-radius: var(--form-field-radius);\n border-width: 1px;\n border-style: solid;\n border-color: var(--nv-field-border-default);\n opacity: var(--components-form-opacity-default, 1);\n background: var(--nv-field-background);\n transition: all 150ms ease-out;\n}\nnv-fieldnumber .input-wrapper .input-container:hover {\n border-color: var(--nv-field-border-hover);\n}\nnv-fieldnumber .input-wrapper .input-container:focus-within, nv-fieldnumber .input-wrapper .input-container:focus-within:hover, nv-fieldnumber .input-wrapper .input-container:focus, nv-fieldnumber .input-wrapper .input-container:focus:hover {\n border-color: var(--nv-field-border-focus);\n box-shadow: 0px 0px 0px var(--focus-field-stroke) var(--nv-field-focus-box-shadow);\n}\nnv-fieldnumber .input-wrapper .input-container:has(input:read-only) {\n background-color: var(--components-form-field-background-readonly);\n border-color: var(--nv-field-border-readonly);\n}\nnv-fieldnumber .input-wrapper .input-container:has(input:disabled) {\n opacity: 0.5;\n background-color: var(--components-form-field-background-disabled);\n border-color: var(--nv-field-border-disabled);\n}\nnv-fieldnumber .input-wrapper .input-container {\n container-type: inline-size;\n container-name: field-number-input-container;\n overflow: hidden;\n position: relative;\n}\nnv-fieldnumber .input-wrapper .input-container input {\n display: flex;\n align-items: center;\n flex: 1 0 0;\n overflow: hidden;\n background-color: transparent;\n color: var(--components-form-field-content-text);\n padding: calc(var(--form-field-padding-y) - 1px) var(--form-field-padding-x);\n font-size: var(--form-field-font-size);\n font-style: normal;\n font-weight: var(--font-weight-medium-emphasis);\n line-height: var(--form-field-line-height);\n width: 100%;\n}\nnv-fieldnumber .input-wrapper .input-container input:focus {\n outline: none;\n}\nnv-fieldnumber .input-wrapper .input-container input::placeholder {\n overflow: hidden;\n color: var(--components-form-field-content-placeholder);\n text-overflow: ellipsis;\n font-family: var(--font-family-default), var(--font-family-fallback), sans-serif;\n font-size: var(--form-field-font-size);\n font-style: normal;\n font-weight: var(--font-weight-low-emphasis);\n line-height: var(--form-field-line-height);\n}\nnv-fieldnumber .input-wrapper .input-container input {\n /* Hide Edge built-in password reveal and clear icons */\n}\nnv-fieldnumber .input-wrapper .input-container input[type=password]::-ms-clear, nv-fieldnumber .input-wrapper .input-container input[type=password]::-ms-reveal {\n display: none;\n width: 0;\n height: 0;\n}\nnv-fieldnumber .input-wrapper .input-container input {\n width: 100%;\n appearance: textfield;\n}\nnv-fieldnumber .input-wrapper .input-container input::-webkit-inner-spin-button, nv-fieldnumber .input-wrapper .input-container input::-webkit-outer-spin-button {\n appearance: none;\n margin: 0;\n}\nnv-fieldnumber .input-wrapper .input-container nv-icon.validation {\n color: var(--nv-field-border-default);\n margin-right: var(--form-field-gap);\n}\nnv-fieldnumber .input-wrapper .input-container > nv-iconbutton {\n border: 0px;\n border-radius: 0px;\n}\nnv-fieldnumber .input-wrapper .input-container > nv-iconbutton:focus-visible {\n border-radius: var(--button-md-border-radius);\n outline-offset: -3px;\n}\nnv-fieldnumber .input-wrapper .input-container > nv-iconbutton:last-of-type {\n border-top-right-radius: var(--form-field-radius);\n border-bottom-right-radius: var(--form-field-radius);\n}\nnv-fieldnumber .input-wrapper .input-container .stepper {\n display: flex;\n border-left: var(--notification-border-width-low-emphasis) solid var(--components-form-field-border-readonly);\n}\nnv-fieldnumber .input-wrapper .input-container .stepper > nv-iconbutton {\n border: 0px;\n border-radius: 0px;\n}\nnv-fieldnumber .input-wrapper .input-container .stepper > nv-iconbutton:focus-visible {\n border-radius: var(--button-md-border-radius);\n outline-offset: -3px;\n}\nnv-fieldnumber .input-wrapper .input-container .stepper > nv-iconbutton:last-of-type {\n border-top-right-radius: var(--form-field-radius);\n border-bottom-right-radius: var(--form-field-radius);\n}\nnv-fieldnumber .input-wrapper .input-container .stepper > nv-iconbutton {\n border-radius: 0px;\n}\n@container field-number-input-container (width < 150px) {\n nv-fieldnumber .input-wrapper .input-container .stepper-spacer {\n display: none;\n }\n nv-fieldnumber .input-wrapper .input-container .stepper {\n display: none;\n }\n}\nnv-fieldnumber .description {\n display: flex;\n align-items: center;\n align-self: stretch;\n gap: var(--spacing-1);\n color: var(--components-form-text-description-default);\n font-family: var(--font-family-default), var(--font-family-fallback), sans-serif;\n font-size: var(--form-description-font-size);\n font-style: normal;\n line-height: var(--form-description-line-height);\n}\nnv-fieldnumber .error-description {\n display: flex;\n align-items: center;\n align-self: stretch;\n gap: var(--spacing-1);\n color: var(--components-form-text-description-default);\n font-family: var(--font-family-default), var(--font-family-fallback), sans-serif;\n font-size: var(--form-description-font-size);\n font-style: normal;\n line-height: var(--form-description-line-height);\n color: var(--components-form-text-description-error);\n}";
|
|
10
|
-
|
|
11
|
-
const NvFieldnumber = class {
|
|
12
|
-
constructor(hostRef) {
|
|
13
|
-
index.registerInstance(this, hostRef);
|
|
14
|
-
this.valueChanged = index.createEvent(this, "valueChanged", 3);
|
|
15
|
-
//#endregion DEPRECATED
|
|
16
|
-
/****************************************************************************/
|
|
17
|
-
//#region PROPERTIES
|
|
18
|
-
/**
|
|
19
|
-
* Sets the ID for the input element and the for attribute of the associated
|
|
20
|
-
* label. If no ID is provided, a random one will be automatically generated
|
|
21
|
-
* to ensure unique identification, facilitating proper label association and
|
|
22
|
-
* accessibility.
|
|
23
|
-
*/
|
|
24
|
-
this.inputId = v4BdYh22OP.v4();
|
|
25
|
-
/**
|
|
26
|
-
* The disabled prop lets you turn off the input field so that users can’t
|
|
27
|
-
* type in it. When disabled, the field is grayed out and won’t respond to#
|
|
28
|
-
* clicks or touches.
|
|
29
|
-
*/
|
|
30
|
-
this.disabled = false;
|
|
31
|
-
/**
|
|
32
|
-
* Display the input field’s content without allowing users to change it.
|
|
33
|
-
* Users can still click on it, select, and copy the text, but they won’t be
|
|
34
|
-
* able to type or delete anything.
|
|
35
|
-
*/
|
|
36
|
-
this.readonly = false;
|
|
37
|
-
/**
|
|
38
|
-
* Marks the input field as required, ensuring that the user must fill it out
|
|
39
|
-
* before submitting the form.
|
|
40
|
-
* @note This uses the native HTML `required` attribute, which triggers browser validation.
|
|
41
|
-
*/
|
|
42
|
-
this.required = false;
|
|
43
|
-
/**
|
|
44
|
-
* Marks the input field as required for accessibility purposes without triggering
|
|
45
|
-
* native HTML validation. Use this when implementing custom validation logic.
|
|
46
|
-
* @note When set, this uses `aria-required` instead of the native `required` attribute.
|
|
47
|
-
* This allows developers to implement custom validation while maintaining accessibility.
|
|
48
|
-
* @note If this prop is not explicitly set, the component will check for the HTML attribute
|
|
49
|
-
* 'aria-required' directly to determine if it should be applied.
|
|
50
|
-
*/
|
|
51
|
-
this.ariaRequiredAttr = false;
|
|
52
|
-
/**
|
|
53
|
-
* Alters the input field's appearance to indicate an error, helping users
|
|
54
|
-
* identify fields that need correction.
|
|
55
|
-
* @validator error
|
|
56
|
-
*/
|
|
57
|
-
this.error = false;
|
|
58
|
-
/**
|
|
59
|
-
* Changes the input field’s appearance to indicate successful input or
|
|
60
|
-
* validation.
|
|
61
|
-
*/
|
|
62
|
-
this.success = false;
|
|
63
|
-
/**
|
|
64
|
-
* Define the increment value for the input field. It determines how much the
|
|
65
|
-
* value will increase or decrease when the user clicks the stepper buttons.
|
|
66
|
-
*/
|
|
67
|
-
this.step = 1;
|
|
68
|
-
/**
|
|
69
|
-
* Applies focus to the input field as soon as the component is mounted. This
|
|
70
|
-
* is equivalent to setting the native autofocus attribute on an <input>
|
|
71
|
-
* element.
|
|
72
|
-
*/
|
|
73
|
-
this.autofocus = false;
|
|
74
|
-
/**
|
|
75
|
-
* Allows the field to stretch and fill the entire width of its container.
|
|
76
|
-
*/
|
|
77
|
-
this.fluid = false;
|
|
78
|
-
//#endregion WATCHERS
|
|
79
|
-
/****************************************************************************/
|
|
80
|
-
//#region METHODS
|
|
81
|
-
this.handleInput = (event) => {
|
|
82
|
-
const input = event.target;
|
|
83
|
-
if (input.value === '') {
|
|
84
|
-
this.value = null;
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
const nextValue = input.valueAsNumber;
|
|
88
|
-
if (Number.isNaN(nextValue)) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
this.value = nextValue;
|
|
92
|
-
};
|
|
93
|
-
this.handleInputContainerClick = () => {
|
|
94
|
-
this.inputElement.focus();
|
|
95
|
-
};
|
|
96
|
-
this.handlePlus = () => {
|
|
97
|
-
this.inputElement.stepUp();
|
|
98
|
-
this.value = Number(this.inputElement.value);
|
|
99
|
-
};
|
|
100
|
-
this.handleMinus = () => {
|
|
101
|
-
this.inputElement.stepDown();
|
|
102
|
-
this.value = Number(this.inputElement.value);
|
|
103
|
-
};
|
|
104
|
-
// prevents text selection when clicking the buttons multiple times
|
|
105
|
-
this.preventSelection = (event) => {
|
|
106
|
-
event.preventDefault();
|
|
107
|
-
};
|
|
108
|
-
this.isMinValueReached = () => {
|
|
109
|
-
return (this.min !== undefined &&
|
|
110
|
-
typeof this.value === 'number' &&
|
|
111
|
-
this.value <= this.min);
|
|
112
|
-
};
|
|
113
|
-
this.isMaxValueReached = () => {
|
|
114
|
-
return (this.max !== undefined &&
|
|
115
|
-
typeof this.value === 'number' &&
|
|
116
|
-
this.value >= this.max);
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
//#endregion EVENTS
|
|
120
|
-
/****************************************************************************/
|
|
121
|
-
//#region WATCHERS
|
|
122
|
-
watchValueHandler(newValue) {
|
|
123
|
-
const normalized = typeof newValue === 'number' && !Number.isNaN(newValue) ? newValue : null;
|
|
124
|
-
if (this.lastEmittedValue === normalized) {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
this.lastEmittedValue = normalized;
|
|
128
|
-
this.valueChanged.emit(normalized);
|
|
129
|
-
}
|
|
130
|
-
//#endregion METHODS
|
|
131
|
-
/****************************************************************************/
|
|
132
|
-
//#region LIFECYCLE
|
|
133
|
-
componentWillRender() {
|
|
134
|
-
if (this.message) {
|
|
135
|
-
this.description = this.message;
|
|
136
|
-
}
|
|
137
|
-
if (this.validation) {
|
|
138
|
-
this.errorDescription = this.validation;
|
|
139
|
-
this.error = true;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
//#endregion LIFECYCLE
|
|
143
|
-
/****************************************************************************/
|
|
144
|
-
//#region RENDER
|
|
145
|
-
render() {
|
|
146
|
-
// Check aria-required from multiple sources:
|
|
147
|
-
// 1. HTML attribute 'aria-required' (direct HTML) - check if explicitly set
|
|
148
|
-
// 2. JavaScript prop (when prop is explicitly set via JavaScript)
|
|
149
|
-
// We use hasAttribute to determine if the attribute was explicitly set by the user,
|
|
150
|
-
// since the prop now defaults to false (to maintain Blazor compatibility)
|
|
151
|
-
const hasAriaRequiredAttr = this.el.hasAttribute('aria-required') ||
|
|
152
|
-
this.el.hasAttribute('aria-required-attr');
|
|
153
|
-
const ariaRequiredFromAttr = hasAriaRequiredAttr
|
|
154
|
-
? this.el.getAttribute('aria-required') ||
|
|
155
|
-
this.el.getAttribute('aria-required-attr')
|
|
156
|
-
: null;
|
|
157
|
-
// Use aria-required if the attribute was explicitly set
|
|
158
|
-
// With reflect: true, setting the prop will also set the attribute
|
|
159
|
-
const useAriaRequired = hasAriaRequiredAttr;
|
|
160
|
-
// Determine the value: use attribute if it exists (prop reflects to attribute via reflect: true)
|
|
161
|
-
// If attribute doesn't exist, the prop was never set and we don't use aria-required
|
|
162
|
-
const ariaRequiredAttrValue = hasAriaRequiredAttr
|
|
163
|
-
? ariaRequiredFromAttr
|
|
164
|
-
: null;
|
|
165
|
-
// Determine which attributes to use
|
|
166
|
-
// If aria-required HTML attribute is present, use it (convert string to boolean)
|
|
167
|
-
// If required is set and aria-required is not "false", use native required
|
|
168
|
-
// If aria-required is "false", don't use native required even if required is set
|
|
169
|
-
const ariaRequiredValue = useAriaRequired
|
|
170
|
-
? ariaRequiredAttrValue === 'true' || ariaRequiredAttrValue === ''
|
|
171
|
-
: undefined;
|
|
172
|
-
const useNativeRequired = this.required && (!useAriaRequired || ariaRequiredValue === true);
|
|
173
|
-
return (index.h(index.Host, { key: '7c0ae66de24ba187965d6ea628f79665e6a39ca4' }, (this.label || this.el.querySelector('[slot="label"]')) && (index.h("label", { key: '8a8ee8f77c938e5edecacf154624f1e5c34d189f', htmlFor: this.inputId }, index.h("slot", { key: 'ff042aa89476fc7be75480fc91c0d7183c897d61', name: "label" }, this.label))), index.h("div", { key: '16fb554a86165d869c9807fed9a1743e91ea06c1', class: "input-wrapper" }, index.h("slot", { key: '6527ebde85fc47e7d372e28748c69bab20876e2b', name: "before-input" }), index.h("div", { key: '1f3a79c7f4071c6b28e961d0283bd2d95c698579', class: "input-container", onClick: this.handleInputContainerClick }, index.h("slot", { key: 'a7456a7eef8cb9bb314c5b502fced765c66b1ac1', name: "leading-input" }), index.h("input", { key: '8e1d243b578068c2a05cb2f041aa3b08e4dcf2f5', id: this.inputId, ref: e => (this.inputElement = e), placeholder: this.placeholder, name: this.name, type: "number", autofocus: this.autofocus, required: useNativeRequired ? this.required : undefined, ...(ariaRequiredValue !== undefined && {
|
|
174
|
-
'aria-required': String(ariaRequiredValue),
|
|
175
|
-
}), max: this.max, min: this.min, step: this.step, value: typeof this.value === 'number' ? this.value : undefined, disabled: this.disabled, readOnly: this.readonly, onInput: this.handleInput }), index.h("slot", { key: '09f8e9e4947efbd1f860d3e84bf55fa4aabfe57a', name: "trailing-input" }), this.error && (index.h("nv-icon", { key: 'e568ab2afbc8634baa4b1b86fcb54e624cb4f69f', name: "alert-circle", class: "validation", size: "md" })), this.success && (index.h("nv-icon", { key: 'd55e850ecd077269bc072732e84b98bfe2f888f2', name: "circle-check", class: "validation", size: "md" })), index.h("div", { key: 'd28da44ee36f534274369ec5b7db274bd6a3d2a4', class: "stepper" }, index.h("nv-iconbutton", { key: 'efafb0710346313e9cfaaba3b671031bdc9d3fe8', size: "md", name: "minus", emphasis: "lower", onClick: this.handleMinus, disabled: this.isMinValueReached(), onMouseDown: this.preventSelection, tabindex: "-1" }), index.h("nv-iconbutton", { key: '20d7e4c1db26bab4d0edfc6e8a322db5def9ff98', size: "md", name: "plus", emphasis: "lower", onClick: this.handlePlus, disabled: this.isMaxValueReached(), onMouseDown: this.preventSelection, tabindex: "-1" }))), index.h("slot", { key: '121da9bfad7ac46e4fe88d7cc0581d787f827b3a', name: "after-input" })), (this.description ||
|
|
176
|
-
this.el.querySelector('[slot="description"]')) && (index.h("div", { key: 'b42f0a5399cda2b5f048d90cc9016bbf1e77f55a', class: "description" }, index.h("slot", { key: '0349b6591850a2d21a6e1a740fb40a0ef35a7a5c', name: "description" }, this.description))), (this.errorDescription ||
|
|
177
|
-
this.el.querySelector('[slot="error-description"]')) && (index.h("div", { key: 'cff9902d3c6d1b70ffbc24b739151ddbdc9d4970', hidden: !this.error, class: "error-description" }, index.h("slot", { key: 'f461d3362d4b61b7431a8de73d723ba05f0ed16b', name: "error-description" }, this.errorDescription)))));
|
|
178
|
-
}
|
|
179
|
-
static get formAssociated() { return true; }
|
|
180
|
-
get el() { return index.getElement(this); }
|
|
181
|
-
static get watchers() { return {
|
|
182
|
-
"value": ["watchValueHandler"]
|
|
183
|
-
}; }
|
|
184
|
-
};
|
|
185
|
-
NvFieldnumber.style = nvFieldnumberCss;
|
|
186
|
-
|
|
187
|
-
exports.nv_fieldnumber = NvFieldnumber;
|