@nova-design-system/nova-react 3.23.0 → 3.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/cjs/dom.utils-CuXVGECR-8VY5SfMZ.js +177 -0
- package/dist/cjs/events.utils-B6GgGra--01N__3wY.js +23 -0
- package/dist/cjs/generated/components.server.js +124 -58
- package/dist/cjs/{grow.animation-CvHGHBL4-DDIEYBK-.js → grow.animation-D7ep_aVl-BuXEDSK-.js} +0 -21
- package/dist/cjs/{i18n.utils-DOZbXX2L-BizoXo6c.js → i18n.utils-IlwlcG9l-ku0bScip.js} +14 -18
- package/dist/cjs/index-DUlunl9a.js +9696 -0
- package/dist/cjs/{nv-dialog.entry-O47Eol_7.js → index.esm-D3eWMME9-CG1TVKfu.js} +1 -296
- package/dist/cjs/index.js +5 -1
- package/dist/cjs/{nv-accordion-item.entry-B_l0-ux0.js → nv-accordion-item.entry-CqnjIt4R.js} +8 -7
- package/dist/cjs/{nv-accordion.entry-BX8_YuZF.js → nv-accordion.entry-Dx7FmGg_.js} +11 -14
- package/dist/cjs/{nv-alert.entry-DCWYR0OK.js → nv-alert.entry-BL3Pdcxd.js} +7 -6
- package/dist/cjs/nv-avatar.entry-2dFR4I9_.js +68 -0
- package/dist/cjs/nv-badge_2.entry-5FShR2Ax.js +218 -0
- package/dist/cjs/nv-breadcrumb.entry-Cfi32bBT.js +49 -0
- package/dist/cjs/nv-breadcrumbs.entry-BSgn3KUO.js +21 -0
- package/dist/cjs/nv-button.entry-BdQQ_LE7.js +166 -0
- package/dist/cjs/{nv-buttongroup.entry-BZaTKN_n.js → nv-buttongroup.entry-BM8CwXFK.js} +13 -7
- package/dist/cjs/{nv-calendar.entry-D9ESuu7C.js → nv-calendar.entry-CeKsMGOa.js} +39 -32
- package/dist/cjs/nv-col.entry-D-h2PGcz.js +38 -0
- package/dist/cjs/{nv-datagrid.entry-DcB5q2oC.js → nv-datagrid.entry-nOBIfqOS.js} +113 -255
- package/dist/cjs/{nv-datagridcolumn.entry-BhKOzXA6.js → nv-datagridcolumn.entry-BAzTU_KM.js} +2 -2
- package/dist/cjs/nv-dialog.entry-Bi2ZVSe2.js +299 -0
- package/dist/cjs/{nv-dialogfooter_2.entry-Dn16bI8a.js → nv-dialogfooter_2.entry-D6lzC-3S.js} +11 -29
- package/dist/cjs/nv-drawer.entry-Dp4AfBiF.js +445 -0
- package/dist/cjs/nv-drawerfooter_2.entry-DpWSsq6d.js +128 -0
- package/dist/cjs/nv-fieldcheckbox.entry-COA3LXnX.js +179 -0
- package/dist/cjs/{nv-fielddate.entry-B4P0U8QG.js → nv-fielddate.entry-B8r5RFXd.js} +20 -21
- package/dist/cjs/{nv-fielddaterange.entry-BORwYJ-k.js → nv-fielddaterange.entry-C6_Kq93P.js} +20 -19
- package/dist/cjs/{nv-fielddropdown.entry-DzBAIynY.js → nv-fielddropdown.entry-B2Dr5zHd.js} +51 -58
- package/dist/cjs/nv-fielddropdownitem.entry-DapivVnR.js +69 -0
- package/dist/cjs/{nv-fieldmultiselect.entry-DiqRreWh.js → nv-fieldmultiselect.entry-DSpQeiPx.js} +45 -49
- package/dist/cjs/nv-fieldnumber.entry-BwxR9sRr.js +189 -0
- package/dist/cjs/nv-fieldpassword.entry-BOSU-Skh.js +167 -0
- package/dist/cjs/nv-fieldradio.entry-ZFafNY5_.js +105 -0
- package/dist/cjs/nv-fieldselect.entry-CfWjQAd9.js +405 -0
- package/dist/cjs/{nv-fieldslider.entry-CozmnUfN.js → nv-fieldslider.entry-dDPcWUxs.js} +34 -16
- package/dist/cjs/nv-fieldtext.entry-Yaa-mkjJ.js +163 -0
- package/dist/cjs/{nv-fieldtextarea.entry-7UrKWDHg.js → nv-fieldtextarea.entry-Dp_l2pKZ.js} +18 -13
- package/dist/cjs/{nv-fieldtime.entry-DakOlLiO.js → nv-fieldtime.entry-CWxi4Uel.js} +38 -40
- package/dist/cjs/{nv-icon.entry-Db00kB2u.js → nv-icon.entry-Dci11W9S.js} +5 -5
- package/dist/cjs/nv-iconbutton_2.entry-A6FKFJT_.js +171 -0
- package/dist/cjs/{nv-menu.entry-CK2HdmBt.js → nv-menu.entry-BHaYP-9M.js} +11 -16
- package/dist/cjs/nv-menuitem.entry-Cm1vvN25.js +59 -0
- package/dist/cjs/nv-notification-bullet.entry-DRlS3Ybc.js +76 -0
- package/dist/cjs/nv-notification.entry-BeDmR-XC.js +176 -0
- package/dist/cjs/nv-notificationcontainer.entry-C3p_87Dg.js +41 -0
- package/dist/cjs/nv-paginationtable.entry-BzEqQOBa.js +231 -0
- package/dist/cjs/{nv-popover.entry-mLdLSp6n.js → nv-popover.entry-D2oFn9vL.js} +118 -46
- package/dist/cjs/nv-row.entry-hV1kxmrr.js +22 -0
- package/dist/cjs/{nv-sidebar.entry-inDVNJ4s.js → nv-sidebar.entry-BJrqJ8K7.js} +12 -8
- package/dist/cjs/nv-sidebarcontent.entry-CPfGF7nx.js +22 -0
- package/dist/cjs/{nv-sidebardivider.entry-D_yern0R.js → nv-sidebardivider.entry-D2wmzHCO.js} +4 -4
- package/dist/cjs/{nv-sidebarfooter.entry-Rkkn9TB_.js → nv-sidebarfooter.entry-C7fqCzjH.js} +4 -4
- package/dist/cjs/nv-sidebargroup.entry-qkXnxhs_.js +23 -0
- package/dist/cjs/{nv-sidebarheader.entry-CYpD_4pI.js → nv-sidebarheader.entry-DBsOmyQ0.js} +4 -4
- package/dist/cjs/{nv-sidebarlogo.entry-BgK03M1v.js → nv-sidebarlogo.entry-902Ht3UR.js} +4 -4
- package/dist/cjs/{nv-sidebarnavitem.entry-DglvcCOD.js → nv-sidebarnavitem.entry-CICrllp8.js} +11 -10
- package/dist/cjs/nv-sidebarnavsubitem.entry-Q9jjU_7D.js +35 -0
- package/dist/cjs/{nv-split.entry-mzg2F66T.js → nv-split.entry-BYIsE2wp.js} +51 -45
- package/dist/cjs/nv-stack.entry-DgE5ASGH.js +31 -0
- package/dist/cjs/{nv-table.entry-DkbNgxtI.js → nv-table.entry-DHXBu2n1.js} +9 -11
- package/dist/cjs/{nv-tableheader.entry-CRVFTQA-.js → nv-tableheader.entry-BijgOxcO.js} +5 -5
- package/dist/cjs/nv-toggle.entry-CMI1WdvV.js +82 -0
- package/dist/cjs/nv-togglebutton.entry-DAPETEmF.js +66 -0
- package/dist/cjs/{nv-togglebuttongroup.entry-BYXX5ejg.js → nv-togglebuttongroup.entry-CzDI1XCr.js} +14 -11
- package/dist/cjs/nv-tooltip.entry-DPoUP9iL.js +56 -0
- package/dist/cjs/slide.animation-CmH5d1of-BZuw607U.js +90 -0
- package/dist/components/NvDatatable/NvDatatable.js +69 -32
- package/dist/generated/components.js +38 -0
- package/dist/generated/components.server.js +120 -58
- package/dist/types/components/NvDatatable/NvDatatable.d.ts +1 -1
- package/dist/types/components/NvDatatable/types.d.ts +13 -3
- package/dist/types/generated/components.d.ts +63 -43
- package/dist/types/generated/components.server.d.ts +63 -43
- package/package.json +2 -2
- package/dist/cjs/index-CtjeeUI-.js +0 -39617
- package/dist/cjs/nv-avatar.entry-C_xZD3Lp.js +0 -68
- package/dist/cjs/nv-badge_2.entry-JjqANStV.js +0 -213
- package/dist/cjs/nv-breadcrumb.entry-DQZDn6cm.js +0 -46
- package/dist/cjs/nv-breadcrumbs.entry-Bz0GjhY_.js +0 -21
- package/dist/cjs/nv-button.entry-Br1DH9Vj.js +0 -164
- package/dist/cjs/nv-col.entry-CfgPMMxS.js +0 -38
- package/dist/cjs/nv-fieldcheckbox.entry-Bx6ArV_b.js +0 -177
- package/dist/cjs/nv-fielddropdownitem.entry-C_17isWd.js +0 -73
- package/dist/cjs/nv-fieldnumber.entry-C9O4UPp3.js +0 -187
- package/dist/cjs/nv-fieldpassword.entry-BfVJNT0A.js +0 -165
- package/dist/cjs/nv-fieldradio.entry-CG22oETM.js +0 -103
- package/dist/cjs/nv-fieldselect.entry-BPQEtrv2.js +0 -397
- package/dist/cjs/nv-fieldtext.entry-BD-z01ru.js +0 -163
- package/dist/cjs/nv-iconbutton_2.entry-CaKCa8NT.js +0 -168
- package/dist/cjs/nv-menuitem.entry-mKMqCAdz.js +0 -60
- package/dist/cjs/nv-notification-bullet.entry-DtbjtFxs.js +0 -77
- package/dist/cjs/nv-notification.entry-CLb0gNu3.js +0 -262
- package/dist/cjs/nv-notificationcontainer.entry-Cijivlm6.js +0 -41
- package/dist/cjs/nv-row.entry-C2C94fcv.js +0 -22
- package/dist/cjs/nv-sidebarcontent.entry-DxoljE15.js +0 -22
- package/dist/cjs/nv-sidebargroup.entry-C1p9qqxr.js +0 -23
- package/dist/cjs/nv-sidebarnavsubitem.entry-Dt1jKmC-.js +0 -35
- package/dist/cjs/nv-stack.entry-nnvjTrBy.js +0 -31
- package/dist/cjs/nv-toggle.entry-oC9TVkr1.js +0 -80
- package/dist/cjs/nv-togglebutton.entry-BTWCzbS9.js +0 -67
- package/dist/cjs/nv-tooltip.entry-OJGxfJEh.js +0 -55
|
@@ -1,397 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var index = require('./index-CtjeeUI-.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 nvFieldselectCss = "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-fieldselect{--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-fieldselect[fluid]:not([fluid=false]){max-width:unset}nv-fieldselect[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-fieldselect[display-value]:not([display-value=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-fieldselect[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-fieldselect[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-fieldselect[required]:not([required=false]) label::after,nv-fieldselect[aria-required=true] label::after{content:\"*\";color:var(--components-form-text-required);font-weight:var(--font-weight-high-emphasis)}nv-fieldselect[multiple]:not([multiple=false]) .select-wrapper>.select-container>.select-icons{top:var(--form-field-padding-y);right:var(--form-field-padding-x)}nv-fieldselect[multiple]:not([multiple=false]) .select-wrapper>.select-container>select{height:100%;box-sizing:border-box;background-color:var(--color-level-05-background);border-radius:var(--form-field-radius)}nv-fieldselect 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-fieldselect .select-wrapper{display:flex;flex-wrap:wrap;align-items:stretch;align-self:stretch}nv-fieldselect .select-wrapper .select-container{position:relative;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);background:var(--nv-field-background);transition:all 150ms ease-out}nv-fieldselect .select-wrapper .select-container:hover{border-color:var(--nv-field-border-hover)}nv-fieldselect .select-wrapper .select-container:focus-within{border-color:var(--nv-field-border-focus);box-shadow:0 0 0 var(--focus-field-stroke) var(--nv-field-focus-box-shadow)}nv-fieldselect .select-wrapper .select-container:has(select:disabled){opacity:0.5;background-color:var(--components-form-field-background-disabled);border-color:var(--nv-field-border-disabled)}nv-fieldselect .select-wrapper .select-container>.select-icons{position:absolute;right:0;top:0;pointer-events:none}nv-fieldselect .select-wrapper .select-container>.select-icons>nv-iconbutton{border:0px;border-radius:0px}nv-fieldselect .select-wrapper .select-container>.select-icons>nv-iconbutton:focus-visible{border-radius:var(--button-md-border-radius);outline-offset:-3px}nv-fieldselect .select-wrapper .select-container>.select-icons>nv-iconbutton:last-of-type{border-top-right-radius:var(--form-field-radius);border-bottom-right-radius:var(--form-field-radius)}nv-fieldselect .select-wrapper .select-container input{display:flex;align-items:center;flex:1 0 0;overflow:hidden;background-color:transparent;color:var(--components-form-field-content-text);padding:var(--form-field-padding-y) 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-fieldselect .select-wrapper .select-container input:focus{outline:none}nv-fieldselect .select-wrapper .select-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-fieldselect .select-wrapper .select-container input{}nv-fieldselect .select-wrapper .select-container input[type=password]::-ms-clear,nv-fieldselect .select-wrapper .select-container input[type=password]::-ms-reveal{display:none;width:0;height:0}nv-fieldselect .select-wrapper .select-container input:read-only{opacity:0.5;background-color:var(--components-form-field-background-readonly, rgba(0, 0, 0, 0.1));border-color:var(--nv-field-border-readonly)}nv-fieldselect .select-wrapper .select-container select{display:flex;align-items:center;flex:1 0 0;overflow:hidden;background-color:transparent;color:var(--components-form-field-content-text);text-overflow:ellipsis;font-size:var(--form-field-font-size);font-style:normal;font-weight:var(--font-weight-medium-emphasis);height:var(--form-field-line-height);padding:var(--form-field-padding-y) var(--form-field-padding-x);box-sizing:content-box;-webkit-appearance:none;-moz-appearance:none;cursor:pointer}nv-fieldselect .select-wrapper .select-container select:focus{outline:none}nv-fieldselect .select-wrapper .select-container select::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-fieldselect .select-wrapper .select-container select option{font-size:var(--form-field-font-size, 16px);font-style:normal;font-weight:var(--font-weight-medium-emphasis);line-height:var(--form-field-line-height, 24px);background-color:var(--color-level-05-background);color:var(--components-form-field-content-text)}nv-fieldselect .select-wrapper .select-container select.hidden{display:none}nv-fieldselect .select-wrapper .select-container nv-icon.readonly-icon{color:var(--nv-field-border-default)}nv-fieldselect .select-wrapper .select-container nv-icon.validation{color:var(--nv-field-border-default)}nv-fieldselect .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-fieldselect .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 NvFieldselect = class {
|
|
12
|
-
constructor(hostRef) {
|
|
13
|
-
index.registerInstance(this, hostRef);
|
|
14
|
-
this.valueChanged = index.createEvent(this, "valueChanged", 3);
|
|
15
|
-
//#endregion DEPRECATED
|
|
16
|
-
/****************************************************************************/
|
|
17
|
-
//#region STATES
|
|
18
|
-
this.computedDisplayValue = '';
|
|
19
|
-
this.internalReadonly = false;
|
|
20
|
-
//#endregion STATES
|
|
21
|
-
/****************************************************************************/
|
|
22
|
-
//#region PROPERTIES
|
|
23
|
-
/**
|
|
24
|
-
* Sets the ID for the select element and the for attribute of the associated
|
|
25
|
-
* label. If no ID is provided, a random one will be automatically generated
|
|
26
|
-
* to ensure unique identification, facilitating proper label association and
|
|
27
|
-
* accessibility.
|
|
28
|
-
*/
|
|
29
|
-
this.inputId = v4BdYh22OP.v4();
|
|
30
|
-
/**
|
|
31
|
-
* The disabled prop lets you turn off the select field so that users can’t
|
|
32
|
-
* choose something. When disabled, the field is grayed out and won’t respond to
|
|
33
|
-
* clicks or touches.
|
|
34
|
-
*/
|
|
35
|
-
this.disabled = false;
|
|
36
|
-
/**
|
|
37
|
-
* Display the select field’s content without allowing users to change it.
|
|
38
|
-
* Users can still click on it, select, and copy the text, but they won’t be
|
|
39
|
-
* able to change or delete anything.
|
|
40
|
-
*/
|
|
41
|
-
this.readonly = false;
|
|
42
|
-
/**
|
|
43
|
-
* Marks the select field as required, ensuring that the user must fill it out
|
|
44
|
-
* before submitting the form.
|
|
45
|
-
* @note This uses the native HTML `required` attribute, which triggers browser validation.
|
|
46
|
-
*/
|
|
47
|
-
this.required = false;
|
|
48
|
-
/**
|
|
49
|
-
* Marks the select field as required for accessibility purposes without triggering
|
|
50
|
-
* native HTML validation. Use this when implementing custom validation logic.
|
|
51
|
-
* @note When set, this uses `aria-required` instead of the native `required` attribute.
|
|
52
|
-
* This allows developers to implement custom validation while maintaining accessibility.
|
|
53
|
-
* @note If this prop is not explicitly set, the component will check for the HTML attribute
|
|
54
|
-
* 'aria-required' directly to determine if it should be applied.
|
|
55
|
-
*/
|
|
56
|
-
this.ariaRequiredAttr = false;
|
|
57
|
-
/**
|
|
58
|
-
* Alters the select field's appearance to indicate an error, helping users
|
|
59
|
-
* identify fields that need correction.
|
|
60
|
-
* @validator error
|
|
61
|
-
*/
|
|
62
|
-
this.error = false;
|
|
63
|
-
/**
|
|
64
|
-
* Changes the select field’s appearance to indicate successful input or
|
|
65
|
-
* validation.
|
|
66
|
-
*/
|
|
67
|
-
this.success = false;
|
|
68
|
-
/**
|
|
69
|
-
* When enabled, allows the select to handle multiple selections.
|
|
70
|
-
*/
|
|
71
|
-
this.multiple = false;
|
|
72
|
-
/**
|
|
73
|
-
* The value of the select field.
|
|
74
|
-
* - If `multiple` is `false`, it's a single string.
|
|
75
|
-
* - If `multiple` is `true`, it's a comma-separated string of selected values.
|
|
76
|
-
*/
|
|
77
|
-
this.value = '';
|
|
78
|
-
/**
|
|
79
|
-
* When enabled, displays the value element instead of the label when readonly.
|
|
80
|
-
* By default, the label is displayed in readonly mode. Also it automatically
|
|
81
|
-
* sets the component to readonly.
|
|
82
|
-
*/
|
|
83
|
-
this.displayValue = false;
|
|
84
|
-
/**
|
|
85
|
-
* Applies focus to the input field as soon as the component is mounted. This
|
|
86
|
-
* is equivalent to setting the native autofocus attribute on a <select>
|
|
87
|
-
* element.
|
|
88
|
-
*/
|
|
89
|
-
this.autofocus = false;
|
|
90
|
-
/**
|
|
91
|
-
* Allows the field to stretch and fill the entire width of its container.
|
|
92
|
-
*/
|
|
93
|
-
this.fluid = false;
|
|
94
|
-
//#endregion WATCHERS
|
|
95
|
-
/****************************************************************************/
|
|
96
|
-
//#region METHODS
|
|
97
|
-
/**
|
|
98
|
-
* Handles the change event on the select element. This method is used to
|
|
99
|
-
* update the value property when the selected options change. It is also
|
|
100
|
-
* used to emit the selectChanged event when the selected value changes.
|
|
101
|
-
* @param {Event} event - The change event on the select element.
|
|
102
|
-
* @emits selectChanged
|
|
103
|
-
*/
|
|
104
|
-
this.handleSelectChange = (event) => {
|
|
105
|
-
const select = event.target;
|
|
106
|
-
let selectedValues = Array.from(select.selectedOptions).map(option => option.value);
|
|
107
|
-
if (!this.multiple) {
|
|
108
|
-
selectedValues = selectedValues.slice(0, 1);
|
|
109
|
-
}
|
|
110
|
-
this.value = this.multiple
|
|
111
|
-
? selectedValues.join(', ')
|
|
112
|
-
: selectedValues[0] || '';
|
|
113
|
-
this.valueChanged.emit(this.value);
|
|
114
|
-
// Update form value
|
|
115
|
-
this.setFormValue();
|
|
116
|
-
};
|
|
117
|
-
/**
|
|
118
|
-
* Handles focus when the select container is clicked.
|
|
119
|
-
*/
|
|
120
|
-
this.handleSelectContainerClick = () => {
|
|
121
|
-
if (!this.internalReadonly && this.selectElement) {
|
|
122
|
-
this.selectElement.focus();
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
//#endregion EVENTS
|
|
127
|
-
/****************************************************************************/
|
|
128
|
-
//#region WATCHERS
|
|
129
|
-
/**
|
|
130
|
-
* Updates the display value when the value property changes. This watcher is
|
|
131
|
-
* used to update the display value when the selected value changes. This is
|
|
132
|
-
* necessary for readonly select fields to display the selected value.
|
|
133
|
-
* @internal This watcher is not intended to be called outside of the component.
|
|
134
|
-
* @param {string} newValue - The new value of the select field.
|
|
135
|
-
*/
|
|
136
|
-
updateDisplayValueWatcher(newValue) {
|
|
137
|
-
this.updateDisplayValue();
|
|
138
|
-
if (this.selectElement) {
|
|
139
|
-
const selectedValues = newValue.split(',').map(val => val.trim());
|
|
140
|
-
const options = this.selectElement.options;
|
|
141
|
-
if (options) {
|
|
142
|
-
Array.from(options).forEach(option => {
|
|
143
|
-
option.selected = this.multiple
|
|
144
|
-
? selectedValues.includes(option.value)
|
|
145
|
-
: option.value === selectedValues[0];
|
|
146
|
-
});
|
|
147
|
-
if (!this.multiple) {
|
|
148
|
-
this.selectElement.value = newValue; // Only set when not multiple
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
this.selectElement.value = selectedValues[0] || '';
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
// Update form value
|
|
156
|
-
this.setFormValue();
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Watcher for the displayValue prop to ensure internalReadonly is true when displayValue is true.
|
|
160
|
-
* @param {boolean} newValue - The new value of displayValue.
|
|
161
|
-
*/
|
|
162
|
-
handleDisplayValueChange(newValue) {
|
|
163
|
-
this.internalReadonly = newValue; // Set internalReadonly to true if displayValue is true
|
|
164
|
-
if (this.readonly) {
|
|
165
|
-
this.internalReadonly = true;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Watcher for the readonly prop to ensure internalReadonly is true when readonly is true.
|
|
170
|
-
* @param {boolean} newValue - The new value of readonly.
|
|
171
|
-
*/
|
|
172
|
-
handleReadonlyChange(newValue) {
|
|
173
|
-
this.internalReadonly = newValue; // Set internalReadonly to true if displayValue is true
|
|
174
|
-
if (this.displayValue) {
|
|
175
|
-
this.internalReadonly = true;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Handle options change and update the internal state
|
|
180
|
-
* @param {typeof this.options} newValue - The new value of options
|
|
181
|
-
*/
|
|
182
|
-
handleOptionsChange(newValue) {
|
|
183
|
-
if (!newValue)
|
|
184
|
-
return;
|
|
185
|
-
// Update the value if an option is pre-selected
|
|
186
|
-
const selectedOption = newValue.find(opt => opt.selected);
|
|
187
|
-
if (selectedOption) {
|
|
188
|
-
this.value = selectedOption.value;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Updates the display value of the select field. This method is used to
|
|
193
|
-
* update the display value when the selected value changes. This is necessary
|
|
194
|
-
* for readonly select fields to display the selected value. This method is
|
|
195
|
-
* called in the componentDidLoad lifecycle hook and the updateDisplayValueWatcher
|
|
196
|
-
* watcher.
|
|
197
|
-
* @internal This method is not intended to be called outside of the component.
|
|
198
|
-
*/
|
|
199
|
-
updateDisplayValue() {
|
|
200
|
-
if (this.internalReadonly && !this.displayValue) {
|
|
201
|
-
if (this.multiple) {
|
|
202
|
-
const selectedLabels = this.value
|
|
203
|
-
.split(',')
|
|
204
|
-
.map(key => key.trim())
|
|
205
|
-
.map(key => this.getLabelFromId(key) || '')
|
|
206
|
-
.filter(label => label !== '');
|
|
207
|
-
this.computedDisplayValue = selectedLabels.join(', ') || '';
|
|
208
|
-
}
|
|
209
|
-
else {
|
|
210
|
-
this.computedDisplayValue = this.getLabelFromId(this.value) || '';
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
else if (this.internalReadonly && this.displayValue) {
|
|
214
|
-
this.computedDisplayValue = this.value || '';
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Retrieves the label from the <option> elements based on the provided key (value).
|
|
219
|
-
* This method uses the id or value attribute directly from the <select> options.
|
|
220
|
-
* @param {string} key - The key (value) for which to find the corresponding label.
|
|
221
|
-
* @returns {string} The label if found; otherwise, an empty string.
|
|
222
|
-
*/
|
|
223
|
-
getLabelFromId(key) {
|
|
224
|
-
this.ensureSelectElement();
|
|
225
|
-
if (!this.selectElement) {
|
|
226
|
-
return '';
|
|
227
|
-
}
|
|
228
|
-
// Cache the option list
|
|
229
|
-
const options = this.selectElement.options;
|
|
230
|
-
if (options) {
|
|
231
|
-
const option = Array.from(options).find(option => option.value === key);
|
|
232
|
-
return option ? option.textContent.trim() || '' : '';
|
|
233
|
-
}
|
|
234
|
-
else {
|
|
235
|
-
return '';
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Sets the value of the form element for form submission. This method is
|
|
240
|
-
* called when the selected value changes or when the value property is set.
|
|
241
|
-
* @internal This method is not intended to be called outside of the component.
|
|
242
|
-
*/
|
|
243
|
-
setFormValue() {
|
|
244
|
-
this.internals.setFormValue(this.value);
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Ensures the select element is available. This method is used to ensure
|
|
248
|
-
* the select element is available before attempting to access it.
|
|
249
|
-
* @internal This method is not intended to be called outside of the component.
|
|
250
|
-
*/
|
|
251
|
-
ensureSelectElement() {
|
|
252
|
-
if (!this.selectElement) {
|
|
253
|
-
this.selectElement = this.el.querySelector('select');
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
//#endregion METHODS
|
|
257
|
-
/****************************************************************************/
|
|
258
|
-
//#region LIFECYCLE
|
|
259
|
-
componentWillRender() {
|
|
260
|
-
this.updateDisplayValue(); // Ensure display value is updated before render
|
|
261
|
-
if (this.message) {
|
|
262
|
-
this.description = this.message;
|
|
263
|
-
}
|
|
264
|
-
if (this.validation) {
|
|
265
|
-
this.errorDescription = this.validation;
|
|
266
|
-
this.error = true;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* Lifecycle method that is called before the component is rendered. This is
|
|
271
|
-
* where the internal state is set up before rendering occurs.
|
|
272
|
-
*/
|
|
273
|
-
componentWillLoad() {
|
|
274
|
-
// Set internalReadonly based on the readonly prop
|
|
275
|
-
this.internalReadonly = this.readonly;
|
|
276
|
-
// Ensure internalReadonly is true if displayValue is true during loading
|
|
277
|
-
if (this.displayValue) {
|
|
278
|
-
this.internalReadonly = true;
|
|
279
|
-
}
|
|
280
|
-
if ('attachInternals' in this.el) {
|
|
281
|
-
this.internals = this.el.attachInternals();
|
|
282
|
-
}
|
|
283
|
-
else {
|
|
284
|
-
// Fallback logic for browsers without attachInternals support
|
|
285
|
-
this.internals = {
|
|
286
|
-
setFormValue: (value) => {
|
|
287
|
-
const formElement = this.el.closest('form');
|
|
288
|
-
if (formElement) {
|
|
289
|
-
const input = document.createElement('input');
|
|
290
|
-
input.type = 'hidden';
|
|
291
|
-
input.name = this.name;
|
|
292
|
-
input.value = value;
|
|
293
|
-
formElement.appendChild(input);
|
|
294
|
-
}
|
|
295
|
-
},
|
|
296
|
-
};
|
|
297
|
-
}
|
|
298
|
-
// Initialize value as an empty string if multiple is true
|
|
299
|
-
if (this.multiple && typeof this.value !== 'string') {
|
|
300
|
-
this.value = '';
|
|
301
|
-
}
|
|
302
|
-
// Parse initial options if present
|
|
303
|
-
if (this.options) {
|
|
304
|
-
this.handleOptionsChange(this.options);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
/**
|
|
308
|
-
* Lifecycle method that is called after the component has been rendered.
|
|
309
|
-
* This is where the display value is updated and the initial select element's
|
|
310
|
-
* state is set.
|
|
311
|
-
*/
|
|
312
|
-
componentDidLoad() {
|
|
313
|
-
this.updateDisplayValue();
|
|
314
|
-
if (this.selectElement) {
|
|
315
|
-
// Only set the value for single selection, skip for multiple
|
|
316
|
-
if (!this.multiple) {
|
|
317
|
-
this.selectElement.value = this.value;
|
|
318
|
-
}
|
|
319
|
-
const selectedValues = this.multiple
|
|
320
|
-
? this.value.split(',').map(v => v.trim())
|
|
321
|
-
: [this.value];
|
|
322
|
-
const options = this.selectElement.options;
|
|
323
|
-
if (options) {
|
|
324
|
-
Array.from(options).forEach(option => {
|
|
325
|
-
option.selected = this.multiple
|
|
326
|
-
? selectedValues.includes(option.value)
|
|
327
|
-
: option.value === selectedValues[0];
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
else {
|
|
331
|
-
// Handle case where there are no options
|
|
332
|
-
this.selectElement.value = selectedValues[0] || '';
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
// Set the initial form value
|
|
336
|
-
this.setFormValue();
|
|
337
|
-
}
|
|
338
|
-
//#endregion LIFECYCLE
|
|
339
|
-
/****************************************************************************/
|
|
340
|
-
//#region RENDERING
|
|
341
|
-
/**
|
|
342
|
-
* The render method creates the HTML structure for the component, including
|
|
343
|
-
* the label, select element, and any error or description messages. It also
|
|
344
|
-
* applies the appropriate CSS classes based on the readonly state and
|
|
345
|
-
* displayValue prop. This method is called when the component is rendered.
|
|
346
|
-
* @returns {HTMLStencilElement} The HTML element to render.
|
|
347
|
-
*/
|
|
348
|
-
render() {
|
|
349
|
-
// Check aria-required from multiple sources:
|
|
350
|
-
// 1. HTML attribute 'aria-required' (direct HTML) - check if explicitly set
|
|
351
|
-
// 2. JavaScript prop (when prop is explicitly set via JavaScript)
|
|
352
|
-
// We use hasAttribute to determine if the attribute was explicitly set by the user,
|
|
353
|
-
// since the prop now defaults to false (to maintain Blazor compatibility)
|
|
354
|
-
const hasAriaRequiredAttr = this.el.hasAttribute('aria-required') ||
|
|
355
|
-
this.el.hasAttribute('aria-required-attr');
|
|
356
|
-
const ariaRequiredFromAttr = hasAriaRequiredAttr
|
|
357
|
-
? this.el.getAttribute('aria-required') ||
|
|
358
|
-
this.el.getAttribute('aria-required-attr')
|
|
359
|
-
: null;
|
|
360
|
-
// Use aria-required if the attribute was explicitly set
|
|
361
|
-
// With reflect: true, setting the prop will also set the attribute
|
|
362
|
-
const useAriaRequired = hasAriaRequiredAttr;
|
|
363
|
-
// Determine the value: use attribute if it exists (prop reflects to attribute via reflect: true)
|
|
364
|
-
// If attribute doesn't exist, the prop was never set and we don't use aria-required
|
|
365
|
-
const ariaRequiredAttrValue = hasAriaRequiredAttr
|
|
366
|
-
? ariaRequiredFromAttr
|
|
367
|
-
: null;
|
|
368
|
-
// Determine which attributes to use
|
|
369
|
-
// If aria-required HTML attribute is present, use it (convert string to boolean)
|
|
370
|
-
// If required is set and aria-required is not "false", use native required
|
|
371
|
-
// If aria-required is "false", don't use native required even if required is set
|
|
372
|
-
const ariaRequiredValue = useAriaRequired
|
|
373
|
-
? ariaRequiredAttrValue === 'true' || ariaRequiredAttrValue === ''
|
|
374
|
-
: undefined;
|
|
375
|
-
const useNativeRequired = this.required && (!useAriaRequired || ariaRequiredValue === true);
|
|
376
|
-
return (index.h(index.Host, { key: '19dc919c517b20e9271019c3c035a5d3965ac500' }, (this.label || this.el.querySelector('[slot="label"]')) && (index.h("label", { key: 'd490a55c4c2bbea30ea5474906e16ac1e0ebf09d', htmlFor: this.inputId }, index.h("slot", { key: 'eaa51f927cc6c16899f806832afe5807948e5aed', name: "label" }, this.label))), index.h("div", { key: '04ee5ad2797e3f315c21359b09a9350c9c69789b', class: "select-wrapper" }, index.h("slot", { key: '7b63bc1fdf20a286635c36f7a1d865365284dd68', name: "before-input" }), index.h("div", { key: 'a98eb2c006fe321bc6f2e28d18afe24641cd4227', class: "select-container", onClick: this.handleSelectContainerClick }, index.h("slot", { key: '2946fafe902e662c5fa37c8a238cd98a04b9e2f5', name: "leading-input" }), this.internalReadonly && (index.h("input", { key: '7512f2cca62e6f4e86bd32b370730e5b630bd8c1', id: this.inputId + '-readonly', type: "text", value: this.computedDisplayValue, readonly: true, class: "readonly-input", "aria-readonly": "true", "aria-label": this.label, "aria-describedby": this.error
|
|
377
|
-
? `${this.inputId}-error`
|
|
378
|
-
: `${this.inputId}-description` })), index.h("select", Object.assign({ key: '6f6c473e866a81ff53baa1c647d3563033d8d71e', id: this.inputId, ref: el => (this.selectElement = el), name: this.name, autofocus: this.autofocus, disabled: this.disabled, required: useNativeRequired ? this.required : undefined }, (ariaRequiredValue !== undefined && {
|
|
379
|
-
'aria-required': String(ariaRequiredValue),
|
|
380
|
-
}), { multiple: this.multiple, onChange: this.handleSelectChange, class: this.internalReadonly ? 'hidden' : '', "aria-label": this.label, "aria-describedby": this.error
|
|
381
|
-
? `${this.inputId}-error`
|
|
382
|
-
: `${this.inputId}-description` }), this.options && this.options.length > 0 ? (this.options.map(option => (index.h("option", { value: option.value, selected: option.selected, disabled: option.disabled }, option.label)))) : (index.h("slot", null))), index.h("div", { key: '11ace2d1d554e07071441a92b751f9f1e40c41b9', class: "select-icons" }, this.error && (index.h("nv-icon", { key: '5fe0c48e595e4e51fd88a1cf3b593349eb8b6880', name: "alert-circle", class: "validation", size: "md" })), this.success && (index.h("nv-icon", { key: '992b8433aa0430828910e9b0d7a5b5bb9cbdde02', name: "circle-check", class: "validation", size: "md" })), !this.multiple && (index.h("nv-iconbutton", { key: 'a1c89dc4437e96680a6d1ddf4db85b478ad52b28', name: "chevron-down", size: "md", emphasis: "lower", tabindex: -1 })))), index.h("slot", { key: 'fe76b1d3caa6addb556d6743626c6bc160d77d53', name: "after-input" })), (this.description ||
|
|
383
|
-
this.el.querySelector('[slot="description"]')) && (index.h("div", { key: '50bd8a56780a1b722d38279bb9f51860bf36e8b6', class: "description", id: `${this.inputId}-description` }, index.h("slot", { key: '3bfc2999c532ec0c8e192a5e442a0294e70cfc8d', name: "description" }, this.description))), (this.errorDescription ||
|
|
384
|
-
this.el.querySelector('[slot="error-description"]')) && (index.h("div", { key: '5e807d931efdd9d3a69c90dee42497234f7c2cda', class: "error-description", id: `${this.inputId}-error` }, index.h("slot", { key: '48db0766450942d8d8ce4cdfa3f80a46d7c18a77', name: "error-description" }, this.errorDescription)))));
|
|
385
|
-
}
|
|
386
|
-
static get formAssociated() { return true; }
|
|
387
|
-
get el() { return index.getElement(this); }
|
|
388
|
-
static get watchers() { return {
|
|
389
|
-
"value": ["updateDisplayValueWatcher"],
|
|
390
|
-
"displayValue": ["handleDisplayValueChange"],
|
|
391
|
-
"readonly": ["handleReadonlyChange"],
|
|
392
|
-
"options": ["handleOptionsChange"]
|
|
393
|
-
}; }
|
|
394
|
-
};
|
|
395
|
-
NvFieldselect.style = nvFieldselectCss;
|
|
396
|
-
|
|
397
|
-
exports.nv_fieldselect = NvFieldselect;
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var index = require('./index-CtjeeUI-.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:var(--form-field-padding-y) 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: '0cbae961a0d59fcba4fb273fb813a690fe66e139' }, (this.label || this.el.querySelector('[slot="label"]')) && (index.h("label", { key: 'e8523abecb5db03407c99bec4aef29292c54b8b9', htmlFor: this.inputId }, index.h("slot", { key: '794b1363cbc29d628c57c14630d929b80f1fea62', name: "label" }, this.label))), index.h("div", { key: 'fa592d4df8d53534d051d874cb640fd42d991a64', class: "input-wrapper" }, index.h("slot", { key: '5473b8c7259be5e51b771f01450a2b07d449d590', name: "before-input" }), index.h("div", { key: '7901740dd1e0e1c11f34c50f72ca0bb6eb0c62e7', class: "input-container", onClick: this.handleInputContainerClick }, index.h("slot", { key: '3894a124bcad3f66cdd50f74781e99720fd3bf3a', name: "leading-input" }), index.h("input", Object.assign({ key: 'c59aa092005df1b24321666e98fa72fd70ac8e55', 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: '0ff21168be1eff0b34f342c9e7adda8d3bb0ea30', name: "trailing-input" }), this.error && (index.h("nv-icon", { key: 'b86f7cb07c86c07273ee0a77e673addef50902e2', name: "alert-circle", class: "validation", size: "md" })), this.success && (index.h("nv-icon", { key: 'f3e1f2bcaf4f009b5d560921e3d3c28e8ae26d41', name: "circle-check", class: "validation", size: "md" }))), index.h("slot", { key: '0e68fd5bb2d4d5c244f4f17b66fda7e73a0868ae', name: "after-input" })), (this.description ||
|
|
155
|
-
this.el.querySelector('[slot="description"]')) && (index.h("div", { key: '6ad45dd3c28d6097ea339279df6a1477e021e633', class: "description" }, index.h("slot", { key: '401cd1e43d57fc357f04bb7009e02bafade6de62', name: "description" }, this.description))), (this.errorDescription ||
|
|
156
|
-
this.el.querySelector('[slot="error-description"]')) && (index.h("div", { key: 'f67e669eed3fe013a18e26588a608afe32d76fba', hidden: !this.error, class: "error-description" }, index.h("slot", { key: '20a32f3a875bc8f036ad133c4b0d87deb5b92b5c', 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;
|