@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,165 +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 nvFieldpasswordCss = "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-fieldpassword{--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-fieldpassword[fluid]:not([fluid=false]){max-width:unset}nv-fieldpassword[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-fieldpassword[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-fieldpassword[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-fieldpassword[required]:not([required=false]) label::after,nv-fieldpassword[aria-required=true] label::after{content:\"*\";color:var(--components-form-text-required);font-weight:var(--font-weight-high-emphasis)}nv-fieldpassword 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-fieldpassword .input-wrapper{display:flex;flex-wrap:wrap;gap:var(--form-gap-x);align-items:stretch;align-self:stretch}nv-fieldpassword .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-fieldpassword .input-wrapper .input-container:hover{border-color:var(--nv-field-border-hover)}nv-fieldpassword .input-wrapper .input-container:focus-within,nv-fieldpassword .input-wrapper .input-container:focus-within:hover,nv-fieldpassword .input-wrapper .input-container:focus,nv-fieldpassword .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-fieldpassword .input-wrapper .input-container:has(input:read-only){background-color:var(--components-form-field-background-readonly);border-color:var(--nv-field-border-readonly)}nv-fieldpassword .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-fieldpassword .input-wrapper .input-container{position:relative}nv-fieldpassword .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-fieldpassword .input-wrapper .input-container input:focus{outline:none}nv-fieldpassword .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-fieldpassword .input-wrapper .input-container input{}nv-fieldpassword .input-wrapper .input-container input[type=password]::-ms-clear,nv-fieldpassword .input-wrapper .input-container input[type=password]::-ms-reveal{display:none;width:0;height:0}nv-fieldpassword .input-wrapper .input-container>nv-iconbutton{border:0px;border-radius:0px}nv-fieldpassword .input-wrapper .input-container>nv-iconbutton:focus-visible{border-radius:var(--button-md-border-radius);outline-offset:-3px}nv-fieldpassword .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-fieldpassword .input-wrapper .input-container nv-icon.validation{color:var(--nv-field-border-default)}nv-fieldpassword .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-fieldpassword .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)}";
|
|
10
|
-
|
|
11
|
-
const NvFieldpassword = class {
|
|
12
|
-
constructor(hostRef) {
|
|
13
|
-
index.registerInstance(this, hostRef);
|
|
14
|
-
this.valueChanged = index.createEvent(this, "valueChanged", 3);
|
|
15
|
-
/****************************************************************************/
|
|
16
|
-
//#region PROPERTIES
|
|
17
|
-
/**
|
|
18
|
-
* Sets the ID for the input element and the for attribute of the associated
|
|
19
|
-
* label. If no ID is provided, a random one will be automatically generated
|
|
20
|
-
* to ensure unique identification, facilitating proper label association and
|
|
21
|
-
* accessibility.
|
|
22
|
-
*/
|
|
23
|
-
this.inputId = v4BdYh22OP.v4();
|
|
24
|
-
/**
|
|
25
|
-
* The disabled prop lets you turn off the input field so that users can’t
|
|
26
|
-
* type in it. When disabled, the field is grayed out and won’t respond to#
|
|
27
|
-
* clicks or touches.
|
|
28
|
-
*/
|
|
29
|
-
this.disabled = false;
|
|
30
|
-
/**
|
|
31
|
-
* Display the input field’s content without allowing users to change it.
|
|
32
|
-
* Users can still click on it, select, and copy the text, but they won’t be
|
|
33
|
-
* able to type or delete anything.
|
|
34
|
-
*/
|
|
35
|
-
this.readonly = false;
|
|
36
|
-
/**
|
|
37
|
-
* Marks the input field as required, ensuring that the user must fill it out
|
|
38
|
-
* before submitting the form.
|
|
39
|
-
* @note This uses the native HTML `required` attribute, which triggers browser validation.
|
|
40
|
-
*/
|
|
41
|
-
this.required = false;
|
|
42
|
-
/**
|
|
43
|
-
* Marks the input field as required for accessibility purposes without triggering
|
|
44
|
-
* native HTML validation. Use this when implementing custom validation logic.
|
|
45
|
-
* @note When set, this uses `aria-required` instead of the native `required` attribute.
|
|
46
|
-
* This allows developers to implement custom validation while maintaining accessibility.
|
|
47
|
-
* @note If this prop is not explicitly set, the component will check for the HTML attribute
|
|
48
|
-
* 'aria-required' directly to determine if it should be applied.
|
|
49
|
-
*/
|
|
50
|
-
this.ariaRequiredAttr = false;
|
|
51
|
-
/**
|
|
52
|
-
* Alters the input field's appearance to indicate an error, helping users
|
|
53
|
-
* identify fields that need correction.
|
|
54
|
-
* @validator error
|
|
55
|
-
*/
|
|
56
|
-
this.error = false;
|
|
57
|
-
/**
|
|
58
|
-
* Changes the input field’s appearance to indicate successful input or
|
|
59
|
-
* validation.
|
|
60
|
-
*/
|
|
61
|
-
this.success = false;
|
|
62
|
-
/**
|
|
63
|
-
* Defines the type of the input.
|
|
64
|
-
* @default 'text'
|
|
65
|
-
*/
|
|
66
|
-
this.mode = 'text';
|
|
67
|
-
/**
|
|
68
|
-
* The autocomplete prop helps users fill out the input field faster by
|
|
69
|
-
* suggesting entries they’ve used before, like their email or address.
|
|
70
|
-
* You can turn it on to make forms more convenient or off to ensure users
|
|
71
|
-
* always type in fresh data.
|
|
72
|
-
*/
|
|
73
|
-
this.autocomplete = 'off';
|
|
74
|
-
/**
|
|
75
|
-
* Hide the button to show/hide the password.
|
|
76
|
-
*/
|
|
77
|
-
this.hidePasswordIcon = false;
|
|
78
|
-
/**
|
|
79
|
-
* Show/hide the password programmatically.
|
|
80
|
-
*/
|
|
81
|
-
this.showPassword = false;
|
|
82
|
-
/**
|
|
83
|
-
* Applies focus to the input field as soon as the component is mounted. This
|
|
84
|
-
* is equivalent to setting the native autofocus attribute on an <input>
|
|
85
|
-
* element.
|
|
86
|
-
*/
|
|
87
|
-
this.autofocus = false;
|
|
88
|
-
/**
|
|
89
|
-
* Allows the field to stretch and fill the entire width of its container.
|
|
90
|
-
*/
|
|
91
|
-
this.fluid = false;
|
|
92
|
-
//#endregion EVENTS
|
|
93
|
-
/****************************************************************************/
|
|
94
|
-
//#region METHODS
|
|
95
|
-
this.handleInputContainerClick = () => {
|
|
96
|
-
this.inputElement.focus();
|
|
97
|
-
};
|
|
98
|
-
this.togglePasswordVisibility = () => {
|
|
99
|
-
this.showPasswordState = !this.showPasswordState;
|
|
100
|
-
};
|
|
101
|
-
this.handleInput = (event) => {
|
|
102
|
-
const input = event.target;
|
|
103
|
-
this.value = input.value; // Update the input value without worrying about the space
|
|
104
|
-
this.valueChanged.emit(input.value);
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
handleShowPasswordChange(newValue) {
|
|
108
|
-
this.showPasswordState = newValue;
|
|
109
|
-
}
|
|
110
|
-
//#endregion METHODS
|
|
111
|
-
/****************************************************************************/
|
|
112
|
-
//#region LIFECYCLE
|
|
113
|
-
componentWillLoad() {
|
|
114
|
-
this.showPasswordState = this.showPassword;
|
|
115
|
-
}
|
|
116
|
-
//#endregion LIFECYCLE
|
|
117
|
-
/****************************************************************************/
|
|
118
|
-
//#region RENDER
|
|
119
|
-
render() {
|
|
120
|
-
// Check aria-required from multiple sources:
|
|
121
|
-
// 1. JavaScript prop (most reliable)
|
|
122
|
-
// 2. HTML attribute 'aria-required' (direct HTML)
|
|
123
|
-
// 3. HTML attribute 'aria-required-attr' (from JSX kebab-case conversion)
|
|
124
|
-
// Check aria-required from multiple sources:
|
|
125
|
-
// 1. HTML attribute 'aria-required' (direct HTML) - check if explicitly set
|
|
126
|
-
// 2. JavaScript prop (when prop is explicitly set via JavaScript)
|
|
127
|
-
// We use hasAttribute to determine if the attribute was explicitly set by the user,
|
|
128
|
-
// since the prop now defaults to false (to maintain Blazor compatibility)
|
|
129
|
-
const hasAriaRequiredAttr = this.el.hasAttribute('aria-required') ||
|
|
130
|
-
this.el.hasAttribute('aria-required-attr');
|
|
131
|
-
const ariaRequiredFromAttr = hasAriaRequiredAttr
|
|
132
|
-
? this.el.getAttribute('aria-required') ||
|
|
133
|
-
this.el.getAttribute('aria-required-attr')
|
|
134
|
-
: null;
|
|
135
|
-
// Use aria-required if the attribute was explicitly set
|
|
136
|
-
// With reflect: true, setting the prop will also set the attribute
|
|
137
|
-
const useAriaRequired = hasAriaRequiredAttr;
|
|
138
|
-
// Determine the value: use attribute if it exists (prop reflects to attribute via reflect: true)
|
|
139
|
-
// If attribute doesn't exist, the prop was never set and we don't use aria-required
|
|
140
|
-
const ariaRequiredAttrValue = hasAriaRequiredAttr
|
|
141
|
-
? ariaRequiredFromAttr
|
|
142
|
-
: null;
|
|
143
|
-
// Determine which attributes to use
|
|
144
|
-
// If aria-required HTML attribute is present, use it (convert string to boolean)
|
|
145
|
-
// If required is set and aria-required is not "false", use native required
|
|
146
|
-
// If aria-required is "false", don't use native required even if required is set
|
|
147
|
-
const ariaRequiredValue = useAriaRequired
|
|
148
|
-
? ariaRequiredAttrValue === 'true' || ariaRequiredAttrValue === ''
|
|
149
|
-
: undefined;
|
|
150
|
-
const useNativeRequired = this.required && (!useAriaRequired || ariaRequiredValue === true);
|
|
151
|
-
return (index.h(index.Host, { key: '187f0ebbf10b6fc51015e35bf3906eebb4009877' }, (this.label || this.el.querySelector('[slot="label"]')) && (index.h("label", { key: 'bf48decdda3cb09bdc3bb66777d9681ca7fe000d', htmlFor: this.inputId }, index.h("slot", { key: '115f1c66b1b6daa01e5677f83129044244b79a02', name: "label" }, this.label))), index.h("div", { key: 'bb1f612364948b42c1e46c0e068f0fae46200ba8', class: "input-wrapper" }, index.h("slot", { key: '2d7a1398a3a72bf4d30fee5b15f0d4f82671f1de', name: "before-input" }), index.h("div", { key: '900aab152e49d7071c3c886decc7d18d2d04f6ca', class: "input-container", onClick: this.handleInputContainerClick }, index.h("slot", { key: '0ff288dbda29b8b9b19a535f5ef0d9b96e7a7c3a', name: "leading-input" }), index.h("input", { key: 'ef08440e8ac74bbe6d7af446317d1a1baa632770', id: this.inputId, ref: e => (this.inputElement = e), autofocus: this.autofocus, autocomplete: this.autocomplete, placeholder: this.placeholder, name: this.name, type: this.showPasswordState ? 'text' : 'password', inputMode: this.mode, value: this.value, required: useNativeRequired ? this.required : undefined, ...(ariaRequiredValue !== undefined && {
|
|
152
|
-
'aria-required': String(ariaRequiredValue),
|
|
153
|
-
}), maxlength: this.maxlength, minlength: this.minlength, pattern: this.pattern, disabled: this.disabled, readOnly: this.readonly, onInput: this.handleInput }), (this.success || this.error) && (index.h("nv-icon", { key: '3f17aa2d7e3f2a05663b952ea104adbc193100bd', name: this.success ? 'circle-check' : 'alert-circle', class: "validation", size: "md" })), !this.hidePasswordIcon && (index.h("nv-iconbutton", { key: 'f2c5ba947f6284877a4a67b82fac2e66ef722ab2', name: this.showPasswordState ? 'eye' : 'eye-off', size: "md", emphasis: "lower", onClick: this.togglePasswordVisibility, "aria-label": this.showPasswordState ? 'Hide password' : 'Show password', "aria-pressed": this.showPasswordState.toString() }))), index.h("slot", { key: '1c12ce6f14e1dd8dbc5cc22620688d92c275ba15', name: "after-input" })), (this.description ||
|
|
154
|
-
this.el.querySelector('[slot="description"]')) && (index.h("div", { key: '0432c059f5a3c9eacdcde93177a398f4b27b8a88', class: "description" }, index.h("slot", { key: '4a5b18c7a1df0e8d7e6435ebf731a3025ccd5861', name: "description" }, this.description))), (this.errorDescription ||
|
|
155
|
-
this.el.querySelector('[slot="error-description"]')) && (index.h("div", { key: 'ba4986e81220fa41481dc699a52d05ad0b22adc4', hidden: !this.error, class: "error-description" }, index.h("slot", { key: 'af1b29bb3575f3985f788769a97d5ae38ab26fd9', name: "error-description" }, this.errorDescription)))));
|
|
156
|
-
}
|
|
157
|
-
static get formAssociated() { return true; }
|
|
158
|
-
get el() { return index.getElement(this); }
|
|
159
|
-
static get watchers() { return {
|
|
160
|
-
"showPassword": ["handleShowPasswordChange"]
|
|
161
|
-
}; }
|
|
162
|
-
};
|
|
163
|
-
NvFieldpassword.style = nvFieldpasswordCss;
|
|
164
|
-
|
|
165
|
-
exports.nv_fieldpassword = NvFieldpassword;
|
|
@@ -1,103 +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 nvFieldradioCss = "nv-fieldradio{--nv-fieldradio-border-default:var(--components-form-field-border-default);--nv-fieldradio-border-hover:var(--components-form-field-border-hover);--nv-fieldradio-border-focus:var(--components-form-field-border-default);--nv-fieldradio-background-default:var(--components-form-field-background-default);--nv-fieldradio-background-checked:var(--components-form-field-background-checked);--nv-fieldradio-background-disabled:var(--components-form-field-background-disabled);--nv-fieldradio-focus-box-shadow:var(--color-focus-brand);--nv-fieldradio-dot-color-checked:var(--components-form-shape-foreground-default);--nv-fieldradio-dot-color-disabled:var(--components-form-shape-foreground-disabled);--nv-fieldradio-outline-color:var(--color-focus-brand);display:inline-flex;align-items:flex-start;gap:var(--form-gap-x)}nv-fieldradio:not([disabled]) input,nv-fieldradio:not([disabled]) label,nv-fieldradio[disabled=false] input,nv-fieldradio[disabled=false] label{cursor:pointer}nv-fieldradio.error{--nv-fieldradio-border-default:var(--components-form-field-border-error);--nv-fieldradio-border-hover:var(--nv-fieldradio-border-default);--nv-fieldradio-border-focus:var(--components-form-field-border-error);--nv-fieldradio-background-checked:var(--components-form-field-background-error);--nv-fieldradio-focus-box-shadow:var(--color-focus-destructive);--nv-fieldradio-dot-color-checked:var(--components-form-shape-foreground-default);--nv-fieldradio-dot-color-disabled:var(--components-form-field-border-error);--nv-fieldradio-outline-color:var(--color-focus-destructive)}nv-fieldradio.label-placement-before{flex-direction:row-reverse}nv-fieldradio[disabled]{opacity:0.5}nv-fieldradio label{align-self:stretch;color:var(--components-form-text-label-default);font-family:var(--font-family-default), var(--font-family-fallback), sans-serif;font-size:var(--form-label-font-size);font-style:normal;font-weight:var(--form-label-font-weight);line-height:var(--form-label-line-height)}nv-fieldradio input[type=radio]{appearance:none;position:relative;display:flex;width:var(--form-radio-size);height:var(--form-radio-size);padding:var(--form-radio-inner-circle-padding);flex-direction:column;align-items:flex-start;border-radius:var(--radius-rounded-full);border-width:var(--form-radio-border-width);border-style:solid;border-color:var(--nv-fieldradio-border-default);background:var(--nv-fieldradio-background-default)}nv-fieldradio input[type=radio]:hover{border-color:var(--nv-fieldradio-border-hover)}nv-fieldradio input[type=radio]:focus{border-color:var(--nv-fieldradio-border-focus)}nv-fieldradio input[type=radio]:focus,nv-fieldradio input[type=radio]:focus-within{outline:none}nv-fieldradio input[type=radio]:focus-visible,nv-fieldradio input[type=radio]:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--nv-fieldradio-outline-color);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-fieldradio input[type=radio]:checked{background:var(--nv-fieldradio-background-checked);border-color:var(--nv-fieldradio-background-checked)}nv-fieldradio input[type=radio]:checked:hover,nv-fieldradio input[type=radio]:checked:focus{border-color:var(--nv-fieldradio-background-checked);background:var(--nv-fieldradio-background-checked)}nv-fieldradio input[type=radio]:checked::before{content:\"\";position:absolute;top:50%;right:50%;transform:translate(50%, -50%);left:0;width:var(--form-radio-inner-circle-size);height:var(--form-radio-inner-circle-size);flex-shrink:0;border-radius:var(--radius-rounded-full);background:var(--nv-fieldradio-dot-color-checked)}nv-fieldradio input[type=radio]:disabled{border-radius:var(--radius-rounded-full);border-width:var(--form-radio-border-width);border-style:solid;border-color:var(--nv-fieldradio-border-default);background:var(--nv-fieldradio-background-disabled)}nv-fieldradio input[type=radio]:disabled:checked::before{background:var(--nv-fieldradio-dot-color-disabled)}nv-fieldradio input[type=radio]:disabled:hover{border-color:var(--nv-fieldradio-border-default);background:var(--nv-fieldradio-background-disabled)}nv-fieldradio .description{align-self:stretch;color:var(--components-form-text-description-default);font-family:var(--font-family-default), var(--font-family-fallback), sans-serif;font-size:var(--form-description-font-size);font-style:normal;font-weight:var(--form-description-font-weight);line-height:var(--form-description-line-height)}nv-fieldradio .error-description{align-self:stretch;color:var(--components-form-text-description-default);font-family:var(--font-family-default), var(--font-family-fallback), sans-serif;font-size:var(--form-description-font-size);font-style:normal;font-weight:var(--form-description-font-weight);line-height:var(--form-description-line-height);color:var(--components-form-text-description-error)}nv-fieldradio .text-container{display:flex;flex-direction:column;align-items:flex-start;flex:1 0 0}";
|
|
11
|
-
|
|
12
|
-
const NvFieldradio = class {
|
|
13
|
-
constructor(hostRef) {
|
|
14
|
-
index.registerInstance(this, hostRef);
|
|
15
|
-
this.checkedChanged = index.createEvent(this, "checkedChanged", 3);
|
|
16
|
-
/**
|
|
17
|
-
* Set the label placement to before the input
|
|
18
|
-
* @deprecated use labelPlacement instead.
|
|
19
|
-
*/
|
|
20
|
-
this.labelBefore = false;
|
|
21
|
-
//#endregion DEPRECATED
|
|
22
|
-
/****************************************************************************/
|
|
23
|
-
//#region PROPERTIES
|
|
24
|
-
/**
|
|
25
|
-
* Sets the ID for the radio button’s input element and the for attribute of
|
|
26
|
-
* the associated label. If no ID is provided, a random one will be
|
|
27
|
-
* automatically generated to ensure unique identification, facilitating
|
|
28
|
-
* proper label association and accessibility.
|
|
29
|
-
*/
|
|
30
|
-
this.inputId = v4BdYh22OP.v4();
|
|
31
|
-
/**
|
|
32
|
-
* Highlight the radio button with error styling. It helps users quickly
|
|
33
|
-
* identify which option needs attention, improving their form-filling
|
|
34
|
-
* experience by making issues more visible.
|
|
35
|
-
* @validator error
|
|
36
|
-
*/
|
|
37
|
-
this.error = false;
|
|
38
|
-
/**
|
|
39
|
-
* Controls whether the radio button is selected.
|
|
40
|
-
*/
|
|
41
|
-
this.checked = false;
|
|
42
|
-
/**
|
|
43
|
-
* Disables the radio button, making it un-selectable.
|
|
44
|
-
*/
|
|
45
|
-
this.disabled = false;
|
|
46
|
-
/**
|
|
47
|
-
* Applies focus to the input field as soon as the component is mounted. This
|
|
48
|
-
* is equivalent to setting the native autofocus attribute on an <input>
|
|
49
|
-
* element.
|
|
50
|
-
*/
|
|
51
|
-
this.autofocus = false;
|
|
52
|
-
}
|
|
53
|
-
componentWillRender() {
|
|
54
|
-
if (this.message) {
|
|
55
|
-
this.description = this.message;
|
|
56
|
-
}
|
|
57
|
-
if (this.labelBefore) {
|
|
58
|
-
this.labelPlacement = 'before';
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
//#endregion EVENTS
|
|
62
|
-
/****************************************************************************/
|
|
63
|
-
//#region WATCHERS
|
|
64
|
-
/**
|
|
65
|
-
* Watches for changes to the checked state and emits the new value.
|
|
66
|
-
* @param {boolean} checked - The new value of the checked state.
|
|
67
|
-
*/
|
|
68
|
-
handleCheckedChange(checked) {
|
|
69
|
-
this.checkedChanged.emit(checked);
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Listens for the change event on the radio button input element and controls
|
|
73
|
-
* the checked state of the host elements.
|
|
74
|
-
* @param {Event} event - The change event.
|
|
75
|
-
*/
|
|
76
|
-
handleChange(event) {
|
|
77
|
-
const target = event.target;
|
|
78
|
-
if (target?.type === 'radio') {
|
|
79
|
-
Array.from(document.getElementsByTagName('nv-fieldradio')).forEach(element => {
|
|
80
|
-
if (element.name === this.name) {
|
|
81
|
-
element.checked = false;
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
this.checked = target.checked;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
//#endregion WATCHERS
|
|
88
|
-
/****************************************************************************/
|
|
89
|
-
//#region RENDER
|
|
90
|
-
render() {
|
|
91
|
-
return (index.h(index.Host, { key: '3fceb787d8e778b5724361f0a240a63375117941', class: clsxChV9xqsO.clsx(this.labelPlacement === 'before' && 'label-placement-before', this.error && 'error') }, index.h("input", { key: 'a61213ca3fb3251cd02a3716859a0182a07428d7', type: "radio", id: this.inputId, name: this.name, autofocus: this.autofocus, autocomplete: "off", value: this.value, checked: this.checked, disabled: this.disabled }), index.h("div", { key: '4faca6c7d131897671d307053e28ade9e5f398f8', class: "text-container" }, (this.label || this.el.querySelector('[slot="label"]')) && (index.h("label", { key: 'ab93b19fa1fd36d6d0fdae08ac4f935c82d0f355', htmlFor: this.inputId }, index.h("slot", { key: 'f914379ab7738b7ce2856be0738796da23c130c6', name: "label" }, this.label))), (this.description ||
|
|
92
|
-
this.el.querySelector('[slot="description"]')) && (index.h("div", { key: 'fc0d08ba7178252f8ba0c8f958a080f44b8e8a19', class: "description" }, index.h("slot", { key: '2d7936a1322ea9798998900fa92cfac1f574685c', name: "description" }, this.description))), (this.errorDescription ||
|
|
93
|
-
this.el.querySelector('[slot="error-description"]')) && (index.h("div", { key: '39e27f0156df7ec64324012dc815cba251992d6f', hidden: !this.error, class: "error-description" }, index.h("slot", { key: '1d408d03c05c3eeba238aea59c5e6393c3befd82', name: "error-description" }, this.errorDescription))))));
|
|
94
|
-
}
|
|
95
|
-
static get formAssociated() { return true; }
|
|
96
|
-
get el() { return index.getElement(this); }
|
|
97
|
-
static get watchers() { return {
|
|
98
|
-
"checked": ["handleCheckedChange"]
|
|
99
|
-
}; }
|
|
100
|
-
};
|
|
101
|
-
NvFieldradio.style = nvFieldradioCss;
|
|
102
|
-
|
|
103
|
-
exports.nv_fieldradio = NvFieldradio;
|
|
@@ -1,163 +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 nvFieldtextCss = "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-fieldtext{--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-fieldtext[fluid]:not([fluid=false]){max-width:unset}nv-fieldtext[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-fieldtext[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-fieldtext[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-fieldtext[required]:not([required=false]) label::after,nv-fieldtext[aria-required=true] label::after{content:\"*\";color:var(--components-form-text-required);font-weight:var(--font-weight-high-emphasis)}nv-fieldtext>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-fieldtext>.input-wrapper{display:flex;flex-wrap:wrap;gap:var(--form-gap-x);align-items:stretch;align-self:stretch}nv-fieldtext>.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-fieldtext>.input-wrapper .input-container:hover{border-color:var(--nv-field-border-hover)}nv-fieldtext>.input-wrapper .input-container:focus-within,nv-fieldtext>.input-wrapper .input-container:focus-within:hover,nv-fieldtext>.input-wrapper .input-container:focus,nv-fieldtext>.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-fieldtext>.input-wrapper .input-container:has(input:read-only){background-color:var(--components-form-field-background-readonly);border-color:var(--nv-field-border-readonly)}nv-fieldtext>.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-fieldtext>.input-wrapper .input-container>[slot=leading-input]{display:block;margin-left:var(--form-field-padding-x)}nv-fieldtext>.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-fieldtext>.input-wrapper .input-container input:focus{outline:none}nv-fieldtext>.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-fieldtext>.input-wrapper .input-container input{}nv-fieldtext>.input-wrapper .input-container input[type=password]::-ms-clear,nv-fieldtext>.input-wrapper .input-container input[type=password]::-ms-reveal{display:none;width:0;height:0}nv-fieldtext>.input-wrapper .input-container nv-icon.validation{color:var(--nv-field-border-default);margin-right:var(--form-gap-x)}nv-fieldtext>.input-wrapper .input-container>[slot=trailing-input]{display:block;margin-right:var(--form-field-padding-x)}nv-fieldtext>.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-fieldtext>.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)}";
|
|
10
|
-
|
|
11
|
-
const NvFieldtext = 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 type prop lets you specify what kind of information the input field
|
|
27
|
-
* should accept. Choose 'text' for general words or sentences, 'tel' for
|
|
28
|
-
* phone numbers, or 'email' for email addresses. This makes sure users get
|
|
29
|
-
* the right keyboard and validation for what they need to enter.
|
|
30
|
-
*/
|
|
31
|
-
this.type = 'text';
|
|
32
|
-
/**
|
|
33
|
-
* The disabled prop lets you turn off the input field so that users can’t
|
|
34
|
-
* type in it. When disabled, the field is grayed out and won’t respond to
|
|
35
|
-
* clicks or touches.
|
|
36
|
-
*/
|
|
37
|
-
this.disabled = false;
|
|
38
|
-
/**
|
|
39
|
-
* Display the input field’s content without allowing users to change it.
|
|
40
|
-
* Users can still click on it, select, and copy the text, but they won’t be
|
|
41
|
-
* able to type or delete anything.
|
|
42
|
-
*/
|
|
43
|
-
this.readonly = false;
|
|
44
|
-
/**
|
|
45
|
-
* Marks the input field as required, ensuring that the user must fill it out
|
|
46
|
-
* before submitting the form.
|
|
47
|
-
* @note This uses the native HTML `required` attribute, which triggers browser validation.
|
|
48
|
-
*/
|
|
49
|
-
this.required = false;
|
|
50
|
-
/**
|
|
51
|
-
* Marks the input field as required for accessibility purposes without triggering
|
|
52
|
-
* native HTML validation. Use this when implementing custom validation logic.
|
|
53
|
-
* @note When set, this uses `aria-required` instead of the native `required` attribute.
|
|
54
|
-
* This allows developers to implement custom validation while maintaining accessibility.
|
|
55
|
-
* @note If this prop is not explicitly set, the component will check for the HTML attribute
|
|
56
|
-
* 'aria-required' directly to determine if it should be applied.
|
|
57
|
-
*/
|
|
58
|
-
this.ariaRequiredAttr = false;
|
|
59
|
-
/**
|
|
60
|
-
* Alters the input field’s appearance to indicate an error, helping users
|
|
61
|
-
* identify fields that need correction.
|
|
62
|
-
* @validator error
|
|
63
|
-
*/
|
|
64
|
-
this.error = false;
|
|
65
|
-
/**
|
|
66
|
-
* Changes the input field’s appearance to indicate successful input or
|
|
67
|
-
* validation.
|
|
68
|
-
*/
|
|
69
|
-
this.success = false;
|
|
70
|
-
/**
|
|
71
|
-
* When used with the email input type, this prop enables the field to accept
|
|
72
|
-
* multiple email addresses. Users can enter several addresses, separating
|
|
73
|
-
* each one with a comma, allowing the form to handle multiple recipients.
|
|
74
|
-
*/
|
|
75
|
-
this.multiple = false;
|
|
76
|
-
/**
|
|
77
|
-
* Applies focus to the input field as soon as the component is mounted. This
|
|
78
|
-
* is equivalent to setting the native autofocus attribute on an <input>
|
|
79
|
-
* element.
|
|
80
|
-
*/
|
|
81
|
-
this.autofocus = false;
|
|
82
|
-
/**
|
|
83
|
-
* Allows the field to stretch and fill the entire width of its container.
|
|
84
|
-
*/
|
|
85
|
-
this.fluid = false;
|
|
86
|
-
//#endregion EVENTS
|
|
87
|
-
/****************************************************************************/
|
|
88
|
-
//#region METHODS
|
|
89
|
-
/**
|
|
90
|
-
* Handles the input event on the input element.
|
|
91
|
-
* Emits the inputChanged event with the new value.
|
|
92
|
-
* @param {Event} event - Event object of the input event.
|
|
93
|
-
*/
|
|
94
|
-
this.handleInput = (event) => {
|
|
95
|
-
const input = event.target;
|
|
96
|
-
this.value = input.value;
|
|
97
|
-
this.valueChanged.emit(input.value);
|
|
98
|
-
};
|
|
99
|
-
/**
|
|
100
|
-
* Handles focus when the input container is clicked.
|
|
101
|
-
*/
|
|
102
|
-
this.handleInputContainerClick = () => {
|
|
103
|
-
this.inputElement.focus();
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
//#endregion METHODS
|
|
107
|
-
/****************************************************************************/
|
|
108
|
-
//#region LIFECYCLE
|
|
109
|
-
componentWillRender() {
|
|
110
|
-
if (this.textInputType) {
|
|
111
|
-
this.type = this.textInputType;
|
|
112
|
-
}
|
|
113
|
-
if (this.message) {
|
|
114
|
-
this.description = this.message;
|
|
115
|
-
}
|
|
116
|
-
if (this.validation) {
|
|
117
|
-
this.errorDescription = this.validation;
|
|
118
|
-
this.error = true;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
//#endregion LIFECYCLE
|
|
122
|
-
/****************************************************************************/
|
|
123
|
-
//#region RENDER
|
|
124
|
-
render() {
|
|
125
|
-
// Check aria-required from multiple sources:
|
|
126
|
-
// 1. HTML attribute 'aria-required' (direct HTML) - check if explicitly set
|
|
127
|
-
// 2. JavaScript prop (when prop is explicitly set via JavaScript)
|
|
128
|
-
// We use hasAttribute to determine if the attribute was explicitly set by the user,
|
|
129
|
-
// since the prop now defaults to false (to maintain Blazor compatibility)
|
|
130
|
-
const hasAriaRequiredAttr = this.el.hasAttribute('aria-required') ||
|
|
131
|
-
this.el.hasAttribute('aria-required-attr');
|
|
132
|
-
const ariaRequiredFromAttr = hasAriaRequiredAttr
|
|
133
|
-
? this.el.getAttribute('aria-required') ||
|
|
134
|
-
this.el.getAttribute('aria-required-attr')
|
|
135
|
-
: null;
|
|
136
|
-
// Use aria-required if the attribute was explicitly set
|
|
137
|
-
// With reflect: true, setting the prop will also set the attribute
|
|
138
|
-
const useAriaRequired = hasAriaRequiredAttr;
|
|
139
|
-
// Determine the value: use attribute if it exists (prop reflects to attribute via reflect: true)
|
|
140
|
-
// If attribute doesn't exist, the prop was never set and we don't use aria-required
|
|
141
|
-
const ariaRequiredAttrValue = hasAriaRequiredAttr
|
|
142
|
-
? ariaRequiredFromAttr
|
|
143
|
-
: null;
|
|
144
|
-
// Determine which attributes to use
|
|
145
|
-
// If aria-required HTML attribute is present, use it (convert string to boolean)
|
|
146
|
-
// If required is set and aria-required is not "false", use native required
|
|
147
|
-
// If aria-required is "false", don't use native required even if required is set
|
|
148
|
-
const ariaRequiredValue = useAriaRequired
|
|
149
|
-
? ariaRequiredAttrValue === 'true' || ariaRequiredAttrValue === ''
|
|
150
|
-
: undefined;
|
|
151
|
-
const useNativeRequired = this.required && (!useAriaRequired || ariaRequiredValue === true);
|
|
152
|
-
return (index.h(index.Host, { key: '95643ae488ca32bc792ac572fd127f358f881894' }, (this.label || this.el.querySelector('[slot="label"]')) && (index.h("label", { key: '35d52de7041b6297af9feca3c0b19f480cacac54', htmlFor: this.inputId }, index.h("slot", { key: 'd866c825300faf563ded34e1a9960f14522d201f', name: "label" }, this.label))), index.h("div", { key: '923c5a4f9f8c9c2bf269a58896f070e3dba2be08', class: "input-wrapper" }, index.h("slot", { key: '933e05c2a3e4ec0429c90dfd8fc799250b8c8fed', name: "before-input" }), index.h("div", { key: '7cde9f8dd874269ddfca691946de52764764cbb2', class: "input-container", onClick: this.handleInputContainerClick }, index.h("slot", { key: '55a6c1302a71fc5c5ea75708e09751407e3dfd10', name: "leading-input" }), index.h("input", { key: '324c57a9c6c590edb178a8821444842b55f19f2e', id: this.inputId, ref: e => (this.inputElement = e), placeholder: this.placeholder, name: this.name, type: this.type, disabled: this.disabled, readOnly: this.readonly, required: useNativeRequired ? this.required : undefined, ...(ariaRequiredValue !== undefined && {
|
|
153
|
-
'aria-required': String(ariaRequiredValue),
|
|
154
|
-
}), maxlength: this.maxlength, minlength: this.minlength, pattern: this.pattern, autofocus: this.autofocus, autocomplete: this.autocomplete, multiple: this.multiple, value: this.value, onInput: this.handleInput }), index.h("slot", { key: 'cd9558b2939d1b935ac342eef24729a88425dcc9', name: "trailing-input" }), this.error && (index.h("nv-icon", { key: 'd7834369c4b8d7bd095f9f602e176fe8fea0a92e', name: "alert-circle", class: "validation", size: "md" })), this.success && (index.h("nv-icon", { key: '3e6714d10d4d21d6cc4912ea074810e3c11fa0a9', name: "circle-check", class: "validation", size: "md" }))), index.h("slot", { key: 'db6e9212d31d2f8b0d4f1379df6d8c41da96d587', name: "after-input" })), (this.description ||
|
|
155
|
-
this.el.querySelector('[slot="description"]')) && (index.h("div", { key: '829f38f3fa67e7bed5d08f6c9f416fbe39e807b6', class: "description" }, index.h("slot", { key: 'a3c63f1903fcdc25be26725b1f0b0b09dabe54a5', name: "description" }, this.description))), (this.errorDescription ||
|
|
156
|
-
this.el.querySelector('[slot="error-description"]')) && (index.h("div", { key: 'c2150b17c0385a5b2019db64eba7358ed07f62a4', hidden: !this.error, class: "error-description" }, index.h("slot", { key: 'a43078cd173e92fa7b17b0f72f302a3196acd1ba', name: "error-description" }, this.errorDescription)))));
|
|
157
|
-
}
|
|
158
|
-
static get formAssociated() { return true; }
|
|
159
|
-
get el() { return index.getElement(this); }
|
|
160
|
-
};
|
|
161
|
-
NvFieldtext.style = nvFieldtextCss;
|
|
162
|
-
|
|
163
|
-
exports.nv_fieldtext = NvFieldtext;
|