@nova-design-system/nova-react 3.22.0 → 3.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/_commonjsHelpers-B85MJLTf-CFO10eej.js +7 -0
- package/dist/cjs/{collapse.animation-6e0b08df-AHWzNGm_.js → collapse.animation-DZDm0vSK-C2TOIhIK.js} +3 -3
- package/dist/cjs/events.utils-B6GgGra--01N__3wY.js +23 -0
- package/dist/cjs/{fade.animation-9b939939-DV--bM4S.js → fade.animation-DcRL9lcm-DAZeHoKN.js} +75 -75
- package/dist/cjs/generated/components.server.js +292 -50
- package/dist/cjs/{grow.animation-24ad5cf8-LUp_ITEx.js → grow.animation-D7ep_aVl-BuXEDSK-.js} +5 -26
- package/dist/cjs/i18n.utils-IlwlcG9l-ku0bScip.js +2494 -0
- package/dist/cjs/{index-WPRkQD3O.js → index-kU2nW5aN.js} +12692 -7009
- package/dist/cjs/{nv-dialog.entry-CDSK9pUH.js → index.esm-D3eWMME9-CG1TVKfu.js} +1 -296
- package/dist/cjs/index.js +15 -1
- package/dist/cjs/inputmask-CSo292ul-DlvupPk6.js +3758 -0
- package/dist/cjs/{nv-accordion-item.entry-BuTvA6w9.js → nv-accordion-item.entry-Bu1tAcCq.js} +11 -10
- package/dist/cjs/{nv-accordion.entry-Dtsfw6He.js → nv-accordion.entry-jWjLdX8w.js} +9 -11
- package/dist/cjs/{nv-alert.entry-TIdfdU7Y.js → nv-alert.entry-E9ZJay_K.js} +22 -23
- package/dist/cjs/{nv-avatar.entry-CaxrhPuw.js → nv-avatar.entry-CUX7u0kR.js} +11 -11
- package/dist/cjs/{nv-badge_2.entry-CfYvTZxX.js → nv-badge_2.entry-bxpV5gxE.js} +24 -24
- package/dist/cjs/{nv-breadcrumb.entry-BCZ4MmfD.js → nv-breadcrumb.entry-Cbbb9Qeh.js} +5 -5
- package/dist/cjs/{nv-breadcrumbs.entry-DwzCE7F6.js → nv-breadcrumbs.entry-BTqnp9zO.js} +3 -3
- package/dist/cjs/{nv-button.entry-Cr_86bcZ.js → nv-button.entry-upWH19y6.js} +12 -14
- package/dist/cjs/{nv-buttongroup.entry-CWjRoHY1.js → nv-buttongroup.entry-CuZCRsnV.js} +3 -3
- package/dist/cjs/{nv-calendar.entry-CXfwNt6G.js → nv-calendar.entry-CT3mASW6.js} +113 -97
- package/dist/cjs/{nv-col.entry-CJLDS3LY.js → nv-col.entry--pCxkaTh.js} +5 -5
- package/dist/cjs/{nv-datagrid.entry-Cns8XSud.js → nv-datagrid.entry-CGCEhO8C.js} +80 -85
- package/dist/cjs/{nv-datagridcolumn.entry-CFFAipHF.js → nv-datagridcolumn.entry-Fsqc7CT_.js} +2 -1
- package/dist/cjs/nv-dialog.entry-B6OYcZxQ.js +300 -0
- package/dist/cjs/{nv-dialogfooter_2.entry-To_dGUn4.js → nv-dialogfooter_2.entry-C4fP_n2-.js} +10 -11
- package/dist/cjs/nv-drawer.entry-C5O4KvHU.js +445 -0
- package/dist/cjs/nv-drawerfooter_2.entry-C-reYJXG.js +146 -0
- package/dist/cjs/nv-fieldcheckbox.entry-bk7UNQny.js +177 -0
- package/dist/cjs/{nv-fielddate.entry-C3pXtMHL.js → nv-fielddate.entry-dqZDBVmm.js} +89 -46
- package/dist/cjs/{nv-fielddaterange.entry-CjVVPEK_.js → nv-fielddaterange.entry-wNRasXky.js} +151 -103
- package/dist/cjs/nv-fielddropdown.entry-BA15piWa.js +678 -0
- package/dist/cjs/{nv-fielddropdownitem.entry-Dah-PaE8.js → nv-fielddropdownitem.entry-DEWaf9dC.js} +7 -7
- package/dist/cjs/{nv-fieldmultiselect.entry-BMLjhqoJ.js → nv-fieldmultiselect.entry-BWY5xOAd.js} +343 -236
- package/dist/cjs/nv-fieldnumber.entry-DoYORd0d.js +187 -0
- package/dist/cjs/nv-fieldpassword.entry-CPaLj9aD.js +165 -0
- package/dist/cjs/{nv-fieldradio.entry-X_2VT1Dj.js → nv-fieldradio.entry-CvUmEaCa.js} +11 -11
- package/dist/cjs/{nv-fieldselect.entry-pSp-2rNn.js → nv-fieldselect.entry-uUIZ6hmN.js} +52 -13
- package/dist/cjs/{nv-fieldslider.entry-pZf7zzLU.js → nv-fieldslider.entry-DnvmxxYY.js} +16 -31
- package/dist/cjs/nv-fieldtext.entry-BYAJp3n_.js +163 -0
- package/dist/cjs/{nv-fieldtextarea.entry-t3Ixxi23.js → nv-fieldtextarea.entry-DU2bWYeg.js} +52 -14
- package/dist/cjs/{nv-fieldtime.entry-DY7D5_6K.js → nv-fieldtime.entry-DlMNDTht.js} +128 -84
- package/dist/cjs/{nv-icon.entry-6oYPSf4c.js → nv-icon.entry-CnUkRzaA.js} +12 -12
- package/dist/cjs/{nv-iconbutton_2.entry-ChULGovr.js → nv-iconbutton_2.entry-hqp4AcRq.js} +10 -12
- package/dist/cjs/{nv-menu.entry-sd0tatWq.js → nv-menu.entry-Dc_FvIx7.js} +18 -32
- package/dist/cjs/{nv-menuitem.entry-CCOqR7UF.js → nv-menuitem.entry-DzMhx6c_.js} +6 -5
- package/dist/cjs/nv-notification-bullet.entry-BwhHCMQF.js +76 -0
- package/dist/cjs/{nv-notification.entry-Cc3zE3yY.js → nv-notification.entry-C3m5p5BL.js} +42 -128
- package/dist/cjs/{nv-notificationcontainer.entry-DV4D6oOH.js → nv-notificationcontainer.entry-DTRNn7VE.js} +4 -4
- package/dist/cjs/{nv-popover.entry-DQSwI2jT.js → nv-popover.entry-B0c-2rO4.js} +51 -47
- package/dist/cjs/{nv-row.entry-UUuMSAY5.js → nv-row.entry-CdcjVGZv.js} +4 -4
- package/dist/cjs/nv-sidebar.entry-CiN813gQ.js +177 -0
- package/dist/cjs/nv-sidebarcontent.entry-D9hpAhK8.js +22 -0
- package/dist/cjs/nv-sidebardivider.entry-B4EMyca5.js +22 -0
- package/dist/cjs/nv-sidebarfooter.entry-CHi4qOFe.js +22 -0
- package/dist/cjs/nv-sidebargroup.entry-RVqrsyIU.js +23 -0
- package/dist/cjs/nv-sidebarheader.entry-_7ch0O3G.js +22 -0
- package/dist/cjs/nv-sidebarlogo.entry-Ch9F-JnT.js +32 -0
- package/dist/cjs/nv-sidebarnavitem.entry-DVrafSMr.js +296 -0
- package/dist/cjs/nv-sidebarnavsubitem.entry-C0XDAzma.js +35 -0
- package/dist/cjs/{nv-split.entry-CYP2bTTM.js → nv-split.entry-0HTslRAX.js} +47 -45
- package/dist/cjs/{nv-stack.entry-D35-75Vw.js → nv-stack.entry-CqO7uTQf.js} +5 -5
- package/dist/cjs/{nv-table.entry-DevWJBnL.js → nv-table.entry-DH85n8Mc.js} +9 -11
- package/dist/cjs/{nv-tableheader.entry-Hs7nUSOC.js → nv-tableheader.entry-CKfocdxD.js} +7 -7
- package/dist/cjs/{nv-toggle.entry-Eje9d--6.js → nv-toggle.entry-BHUl76Im.js} +9 -9
- package/dist/cjs/nv-togglebutton.entry-D_9COjY-.js +67 -0
- package/dist/cjs/{nv-togglebuttongroup.entry-CWN_Ucry.js → nv-togglebuttongroup.entry-C0NLbsq7.js} +10 -8
- package/dist/cjs/{nv-tooltip.entry-BGkKDEFg.js → nv-tooltip.entry-BfViGE_U.js} +5 -5
- package/dist/cjs/slide.animation-CmH5d1of-BZuw607U.js +90 -0
- package/dist/cjs/{style-value-types.es-f5d10b79-D0QCM8OB.js → style-value-types.es-xlgmw4x8-B1vLqX9m.js} +6 -3
- package/dist/cjs/{v4-a79185f4-2n0dOd_Y.js → v4-BdYh22OP-C1vaJ4yP.js} +1 -1
- package/dist/components/NvDatatable/NvDatatable.js +40 -24
- package/dist/generated/components.js +107 -0
- package/dist/generated/components.server.js +260 -50
- package/dist/providers/NotificationProvider.js +3 -4
- package/dist/types/components/NvDatatable/NvDatatable.d.ts +1 -1
- package/dist/types/components/NvDatatable/types.d.ts +8 -3
- package/dist/types/generated/components.d.ts +46 -0
- package/dist/types/generated/components.server.d.ts +46 -0
- package/package.json +2 -2
- package/dist/cjs/_commonjsHelpers-1789f0cf-BJu3ubxk.js +0 -10
- package/dist/cjs/inputmask-edcad3c1-B9Omti4z.js +0 -3749
- package/dist/cjs/nv-fieldcheckbox.entry-fdonR07Z.js +0 -138
- package/dist/cjs/nv-fielddropdown.entry-C9mXuNNj.js +0 -392
- package/dist/cjs/nv-fieldnumber.entry-DBdJviXu.js +0 -148
- package/dist/cjs/nv-fieldpassword.entry-Cim_usSM.js +0 -122
- package/dist/cjs/nv-fieldtext.entry-DlI_ExaV.js +0 -124
- package/dist/cjs/nv-togglebutton.entry-LGI7pIeK.js +0 -56
- /package/dist/cjs/{clsx-297c1ffe-BtxeOLZW.js → clsx-ChV9xqsO-BtxeOLZW.js} +0 -0
- /package/dist/cjs/{constants-69bafca2-DpB_ghPF.js → constants-BReL3Lsa-DpB_ghPF.js} +0 -0
- /package/dist/cjs/{timeline.animation-79215cd4-KteJaZPb.js → timeline.animation-CgHCo_Ho-KteJaZPb.js} +0 -0
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var index = require('./index-WPRkQD3O.js');
|
|
4
|
-
var clsx297c1ffe = require('./clsx-297c1ffe-BtxeOLZW.js');
|
|
5
|
-
var v4A79185f4 = require('./v4-a79185f4-2n0dOd_Y.js');
|
|
6
|
-
require('react');
|
|
7
|
-
require('react-dom');
|
|
8
|
-
|
|
9
|
-
const nvFieldcheckboxCss = "nv-fieldcheckbox{--nv-fieldcheckbox-border-default:var(\n --components-form-field-border-default\n );--nv-fieldcheckbox-border-hover:var(--components-form-field-border-hover);--nv-fieldcheckbox-border-focus:var(--components-form-field-border-default);--nv-fieldcheckbox-background-default:var(\n --components-form-field-background-default\n );--nv-fieldcheckbox-background-checked:var(\n --components-form-field-background-checked\n );--nv-fieldcheckbox-background-disabled:var(\n --components-form-field-background-disabled\n );--nv-fieldcheckbox-focus-box-shadow:var(--color-focus-brand);--nv-fieldcheckbox-color-checked:var(\n --components-form-shape-foreground-default\n );--nv-fieldcheckbox-color-disabled:var(\n --components-form-shape-foreground-disabled\n );--nv-fieldcheckbox-outline-color:var(--color-focus-brand);display:inline-flex;align-items:flex-start;gap:var(--form-gap-x);position:relative}nv-fieldcheckbox:not([disabled],[readonly]) input,nv-fieldcheckbox:not([disabled],[readonly]) label{cursor:pointer}nv-fieldcheckbox.error>.input-container{--nv-fieldcheckbox-border-default:var(--components-form-field-border-error);--nv-fieldcheckbox-border-hover:var(--nv-fieldcheckbox-border-default);--nv-fieldcheckbox-border-focus:var(--components-form-field-border-error);--nv-fieldcheckbox-focus-box-shadow:var(--color-focus-destructive);--nv-fieldcheckbox-color-disabled:var(\n --components-form-shape-foreground-disabled-error\n );--nv-fieldcheckbox-background-checked:var(\n --components-form-field-background-error\n );--nv-fieldcheckbox-outline-color:var(--color-focus-destructive)}nv-fieldcheckbox.label-placement-before{flex-direction:row-reverse}nv-fieldcheckbox[disabled]:not([disabled=false]){opacity:0.5}nv-fieldcheckbox>.input-container{position:relative;color:var(--nv-fieldcheckbox-color-checked)}nv-fieldcheckbox>.input-container input[type=checkbox][readonly]{opacity:0.5}nv-fieldcheckbox>.input-container:has(input[type=checkbox]:disabled:not([readonly])){color:var(--nv-fieldcheckbox-color-disabled)}nv-fieldcheckbox>.input-container input[type=checkbox]{appearance:none;position:relative;display:flex;width:var(--form-checkbox-size);height:var(--form-checkbox-size);flex-direction:column;align-items:flex-start;border-radius:var(--form-checkbox-radius);border-width:var(--form-checkbox-border-width);border-style:solid;border-color:var(--nv-fieldcheckbox-border-default);background:var(--nv-fieldcheckbox-background-default)}nv-fieldcheckbox>.input-container input[type=checkbox]:hover{border-color:var(--nv-fieldcheckbox-border-hover)}nv-fieldcheckbox>.input-container input[type=checkbox]:focus{border-color:var(--nv-fieldcheckbox-border-focus)}nv-fieldcheckbox>.input-container input[type=checkbox]:focus,nv-fieldcheckbox>.input-container input[type=checkbox]:focus-within{outline:none}nv-fieldcheckbox>.input-container input[type=checkbox]:focus-visible,nv-fieldcheckbox>.input-container input[type=checkbox]:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--nv-fieldcheckbox-outline-color);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-fieldcheckbox>.input-container input[type=checkbox]:checked,nv-fieldcheckbox>.input-container input[type=checkbox]:indeterminate{background:var(--nv-fieldcheckbox-background-checked);border-color:var(--nv-fieldcheckbox-background-checked)}nv-fieldcheckbox>.input-container input[type=checkbox]:disabled:not([readonly]){background:var(--nv-fieldcheckbox-background-disabled);border-color:var(--nv-fieldcheckbox-border-default)}nv-fieldcheckbox>.input-container input[type=checkbox][readonly]{opacity:0.5}nv-fieldcheckbox>.input-container .icon{pointer-events:none;position:absolute;top:0;left:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center}nv-fieldcheckbox>.input-container .icon svg{width:var(--form-checkbox-icon-size);height:var(--form-checkbox-icon-size);fill:none;stroke:currentcolor;stroke-width:var(--form-checkbox-icon-stroke);flex-shrink:0}nv-fieldcheckbox>.text-container{display:flex;flex-direction:column;align-items:flex-start;flex:1 0 0}nv-fieldcheckbox>.text-container label{align-self:stretch;text-align:left;color:var(--components-form-text-label-default);font-family:var(--font-family-default), var(--font-family-fallback), sans-serif;font-size:var(--form-label-font-size);font-style:normal;font-weight:var(--form-label-font-weight);line-height:var(--form-label-line-height)}nv-fieldcheckbox>.text-container label.visually-hidden{position:absolute;padding:0;border:0;overflow:hidden;white-space:nowrap;width:1px;height:1px;margin:-1px;clip:rect(0, 0, 0, 0)}nv-fieldcheckbox>.text-container .description{align-self:stretch;color:var(--components-form-text-description-default);font-family:var(--font-family-default), var(--font-family-fallback), sans-serif;font-size:var(--form-description-font-size);font-style:normal;font-weight:var(--form-description-font-weight);line-height:var(--form-description-line-height)}nv-fieldcheckbox>.text-container .error-description{align-self:stretch;color:var(--components-form-text-description-default);font-family:var(--font-family-default), var(--font-family-fallback), sans-serif;font-size:var(--form-description-font-size);font-style:normal;font-weight:var(--form-description-font-weight);line-height:var(--form-description-line-height);color:var(--components-form-text-description-error)}";
|
|
10
|
-
const NvFieldcheckboxStyle0 = nvFieldcheckboxCss;
|
|
11
|
-
|
|
12
|
-
const NvFieldcheckbox = class {
|
|
13
|
-
constructor(hostRef) {
|
|
14
|
-
index.registerInstance(this, hostRef);
|
|
15
|
-
this.checkedChanged = index.createEvent(this, "checkedChanged");
|
|
16
|
-
/**
|
|
17
|
-
* When true, the label will be placed before the checkbox.
|
|
18
|
-
* @deprecated Use `labelPlacement = end` instead.
|
|
19
|
-
* */
|
|
20
|
-
this.labelBefore = false;
|
|
21
|
-
//#endregion DEPRECATED
|
|
22
|
-
/****************************************************************************/
|
|
23
|
-
//#region PROPERTIES
|
|
24
|
-
/**
|
|
25
|
-
* Sets the ID for the radio button’s input element and the for attribute of
|
|
26
|
-
* the associated label. If no ID is provided, a random one will be
|
|
27
|
-
* automatically generated to ensure unique identification, facilitating
|
|
28
|
-
* proper label association and accessibility.
|
|
29
|
-
*/
|
|
30
|
-
this.inputId = v4A79185f4.v4();
|
|
31
|
-
/**
|
|
32
|
-
* Hides the label visually while still keeping it available for screen
|
|
33
|
-
* readers.
|
|
34
|
-
*/
|
|
35
|
-
this.hideLabel = false;
|
|
36
|
-
/**
|
|
37
|
-
* Signals that there is an error associated with the checkbox, which can
|
|
38
|
-
* trigger visual cues.
|
|
39
|
-
* @validator error
|
|
40
|
-
*/
|
|
41
|
-
this.error = false;
|
|
42
|
-
/**
|
|
43
|
-
* Indicates whether the checkbox is checked or not.
|
|
44
|
-
*/
|
|
45
|
-
this.checked = false;
|
|
46
|
-
/**
|
|
47
|
-
* Indicates whether the checkbox is in an indeterminate state, typically used
|
|
48
|
-
* for hierarchical checkboxes.
|
|
49
|
-
*/
|
|
50
|
-
this.indeterminate = false;
|
|
51
|
-
/**
|
|
52
|
-
* Disables the checkbox, preventing user interaction.
|
|
53
|
-
*/
|
|
54
|
-
this.disabled = false;
|
|
55
|
-
/**
|
|
56
|
-
* Sets the checkbox to read-only, preventing user changes but still allowing
|
|
57
|
-
* focus and selection of text.
|
|
58
|
-
*/
|
|
59
|
-
this.readonly = false;
|
|
60
|
-
/**
|
|
61
|
-
* Marks the checkbox as required, indicating that it must be checked for
|
|
62
|
-
* form submission.
|
|
63
|
-
*/
|
|
64
|
-
this.required = false;
|
|
65
|
-
/**
|
|
66
|
-
* Applies focus to the input field as soon as the component is mounted. This
|
|
67
|
-
* is equivalent to setting the native autofocus attribute on an <input>
|
|
68
|
-
* element.
|
|
69
|
-
*/
|
|
70
|
-
this.autofocus = false;
|
|
71
|
-
}
|
|
72
|
-
//#endregion EVENTS
|
|
73
|
-
/****************************************************************************/
|
|
74
|
-
//#region LISTENERS
|
|
75
|
-
/**
|
|
76
|
-
* Listens for the change event on the checkbox input element and updates the
|
|
77
|
-
* checked state.
|
|
78
|
-
* @param {Event} event - The change event.
|
|
79
|
-
*/
|
|
80
|
-
handleChange(event) {
|
|
81
|
-
const target = event.target;
|
|
82
|
-
if (target.type === 'checkbox' && target.id === this.inputId) {
|
|
83
|
-
if (this.readonly || this.disabled) {
|
|
84
|
-
event.preventDefault();
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
if (this.indeterminate) {
|
|
88
|
-
this.indeterminate = false;
|
|
89
|
-
}
|
|
90
|
-
this.checked = target.checked;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
//#endregion LISTENERS
|
|
94
|
-
/****************************************************************************/
|
|
95
|
-
//#region WATCHERS
|
|
96
|
-
/**
|
|
97
|
-
* Watches for changes to the checked state and emits the new value.
|
|
98
|
-
* @param {boolean} checked - The new value of the checked state.
|
|
99
|
-
*/
|
|
100
|
-
onCheckedChanged(checked) {
|
|
101
|
-
this.checkedChanged.emit(checked);
|
|
102
|
-
}
|
|
103
|
-
//#endregion WATCHERS
|
|
104
|
-
/****************************************************************************/
|
|
105
|
-
//#region LIFECYCLE
|
|
106
|
-
componentWillRender() {
|
|
107
|
-
if (this.message) {
|
|
108
|
-
this.description = this.message;
|
|
109
|
-
}
|
|
110
|
-
if (this.labelBefore) {
|
|
111
|
-
this.labelPlacement = 'before';
|
|
112
|
-
}
|
|
113
|
-
if (this.validation) {
|
|
114
|
-
this.errorDescription = this.validation;
|
|
115
|
-
this.error = true;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
//#endregion LIFECYCLE
|
|
119
|
-
/****************************************************************************/
|
|
120
|
-
//#region RENDER
|
|
121
|
-
render() {
|
|
122
|
-
return (index.h(index.Host, { key: '4db161f34d188b5370f28a39ec9637d269719b04', class: clsx297c1ffe.clsx(this.labelPlacement === 'before' && 'label-placement-before', this.error && 'error') }, index.h("div", { key: '7608f50840faf35c4da8dbfcc8240becece6f609', class: "input-container" }, index.h("input", { key: '733ad01f2cadd1e17d6bfc40022ef9ab1db93f0a', type: "checkbox", id: this.inputId, name: this.name, autofocus: this.autofocus, autocomplete: "off", value: this.value, checked: Boolean(this.checked), disabled: this.disabled || this.readonly, readonly: this.readonly && !this.required, required: this.required, indeterminate: this.indeterminate, ref: el => {
|
|
123
|
-
if (el) {
|
|
124
|
-
el.indeterminate = this.indeterminate;
|
|
125
|
-
}
|
|
126
|
-
} }), index.h("span", { key: '81da5960abee0aa2c74f10612d05388e427b3a1a', class: "icon" }, this.checked && !this.indeterminate && (index.h("slot", { key: 'e257ebad9a1c23bc77961645dabe6e0fc8c51440', name: "checked-icon" }, index.h("svg", { key: 'd4005dfd634169aa14140c7eba1e0ac63e28342d', xmlns: "http://www.w3.org/2000/svg", width: "14", height: "14", viewBox: "0 0 14 14", fill: "none" }, index.h("path", { key: '1817c25edf09f09d4317d9e41b52484883c7a943', d: "M11.6667 3.5L5.25004 9.91667L2.33337 7", "stroke-linecap": "round", "stroke-linejoin": "round" })))), this.indeterminate && (index.h("slot", { key: '043148db3518e99f2850ffa4b3622f7ae3c654a7', name: "indeterminate-icon" }, index.h("svg", { key: 'b8a67cfa8d0f880657b62b89ddae7a238b22bc26', class: "indeterminate-svg", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 14 14", fill: "none" }, index.h("path", { key: 'd63f610ff5cca552d295de18dffeda84cbd370ac', d: "M2.9165 7H11.0832", "stroke-linecap": "round", "stroke-linejoin": "round" })))))), index.h("slot", { key: 'e4befe30753cd2f76da4af10e648704068f7ce55' }), index.h("div", { key: '281b4046dbeb8b8dcb05fc154b65ed822fa45960', class: "text-container" }, index.h("slot", { key: '8e40b1e52c55fa45b38bec26e6b20da90c8553ed', name: "main" }, (this.label || this.el.querySelector('[slot="label"]')) && (index.h("label", { key: 'ad2e4a47d1d5a218835b410579e7e93febd08d15', htmlFor: this.inputId, class: clsx297c1ffe.clsx(this.hideLabel && 'visually-hidden') }, index.h("slot", { key: '815d03f2c69465e430178c29a885ad770e2c561f', name: "label" }, this.label))), (this.description ||
|
|
127
|
-
this.el.querySelector('[slot="description"]')) && (index.h("div", { key: '22159e2cb8c4897507da91ebee09502922093ead', class: "description" }, index.h("slot", { key: '61b277015ecb4e0e3b813e45dbb6cd7ebe89506b', name: "description" }, this.description)))), (this.errorDescription ||
|
|
128
|
-
this.el.querySelector('[slot="error-description"]')) && (index.h("div", { key: '924d333e443c943b5fe37f31e3191d231b9d87e1', hidden: !this.error, class: "error-description" }, index.h("slot", { key: '2469d3f6cf2121b489b637138642417d27556740', name: "error-description" }, this.errorDescription))))));
|
|
129
|
-
}
|
|
130
|
-
static get formAssociated() { return true; }
|
|
131
|
-
get el() { return index.getElement(this); }
|
|
132
|
-
static get watchers() { return {
|
|
133
|
-
"checked": ["onCheckedChanged"]
|
|
134
|
-
}; }
|
|
135
|
-
};
|
|
136
|
-
NvFieldcheckbox.style = NvFieldcheckboxStyle0;
|
|
137
|
-
|
|
138
|
-
exports.nv_fieldcheckbox = NvFieldcheckbox;
|
|
@@ -1,392 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var index = require('./index-WPRkQD3O.js');
|
|
4
|
-
var v4A79185f4 = require('./v4-a79185f4-2n0dOd_Y.js');
|
|
5
|
-
require('react');
|
|
6
|
-
require('react-dom');
|
|
7
|
-
|
|
8
|
-
const nvFielddropdownCss = "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-fielddropdown{--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-fielddropdown[fluid]:not([fluid=false]){max-width:unset}nv-fielddropdown[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-fielddropdown[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-fielddropdown[required]:not([required=false]) label::after{content:\"*\";color:var(--components-form-text-required);font-weight:var(--font-weight-high-emphasis)}nv-fielddropdown[hidden]:not([hidden=false]) label{display:none}nv-fielddropdown 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-fielddropdown nv-popover{width:100%;display:block}nv-fielddropdown nv-popover [data-scope=popover]{min-width:100%;width:max-content;max-width:400px;padding:var(--list-dropdown-padding);border-radius:var(--list-dropdown-radius);background-color:var(--components-list-dropdown-background);border:1px solid var(--components-list-dropdown-border)}nv-fielddropdown nv-popover [slot=content]{gap:var(--list-dropdown-gap-y);display:flex;flex-direction:column}nv-fielddropdown nv-popover hr{color:var(--components-list-dropdown-separator)}nv-fielddropdown nv-popover div[slot=content]{max-height:calc(90vh - var(--list-dropdown-padding) * 2);overflow-y:auto;position:relative}nv-fielddropdown nv-popover div[slot=content]::-webkit-scrollbar{width:6px;height:6px}nv-fielddropdown nv-popover div[slot=content]::-webkit-scrollbar-track{background-color:var(--color-level-10-background);border-radius:9999px}nv-fielddropdown nv-popover div[slot=content]::-webkit-scrollbar-thumb{background-color:var(--color-gray-200);border-radius:9999px}nv-fielddropdown .input-wrapper{display:flex;flex-wrap:wrap;gap:var(--form-gap-x);align-items:stretch;align-self:stretch;width:100%}nv-fielddropdown .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;position:relative;width:100%;min-height:40px}nv-fielddropdown .input-container:hover{border-color:var(--nv-field-border-hover)}nv-fielddropdown .input-container:focus-within,nv-fielddropdown .input-container:focus-within:hover,nv-fielddropdown .input-container:focus,nv-fielddropdown .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-fielddropdown .input-container:has(input:read-only){opacity:0.5;background-color:var(--components-form-field-background-readonly);border-color:var(--nv-field-border-readonly)}nv-fielddropdown .input-container:has(input:disabled){opacity:0.5;background-color:var(--components-form-field-background-disabled);border-color:var(--nv-field-border-disabled)}nv-fielddropdown .input-container input[type=search]::-webkit-search-decoration,nv-fielddropdown .input-container input[type=search]::-webkit-search-cancel-button,nv-fielddropdown .input-container input[type=search]::-webkit-search-results-button,nv-fielddropdown .input-container input[type=search]::-webkit-search-results-decoration{-webkit-appearance:none}nv-fielddropdown .input-container input,nv-fielddropdown .input-container p.non-filterable-text{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-fielddropdown .input-container input:focus,nv-fielddropdown .input-container p.non-filterable-text:focus{outline:none}nv-fielddropdown .input-container input::placeholder,nv-fielddropdown .input-container p.non-filterable-text::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-fielddropdown .input-container input[type=password]::-ms-clear,nv-fielddropdown .input-container input[type=password]::-ms-reveal,nv-fielddropdown .input-container p.non-filterable-text[type=password]::-ms-clear,nv-fielddropdown .input-container p.non-filterable-text[type=password]::-ms-reveal{display:none;width:0;height:0}nv-fielddropdown .input-container p.non-filterable-text{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;border-radius:var(--form-field-radius);background-color:var(--nv-field-background);color:var(--components-form-field-content-text);font-size:var(--form-field-font-size);font-weight:var(--font-weight-medium-emphasis);line-height:var(--form-field-line-height);box-sizing:border-box;cursor:pointer;height:100%;min-height:40px}nv-fielddropdown .input-container p.non-filterable-text span{display:inline-block;width:100%;overflow:hidden;text-overflow:ellipsis}nv-fielddropdown .input-container>nv-iconbutton{border:0px;border-radius:0px}nv-fielddropdown .input-container>nv-iconbutton:focus-visible{border-radius:var(--button-md-border-radius);outline-offset:-3px}nv-fielddropdown .input-container>nv-iconbutton:last-of-type{border-top-right-radius:var(--form-field-radius);border-bottom-right-radius:var(--form-field-radius)}nv-fielddropdown .input-container nv-icon.validation{color:var(--nv-field-border-default)}nv-fielddropdown .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-fielddropdown .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)}";
|
|
9
|
-
const NvFielddropdownStyle0 = nvFielddropdownCss;
|
|
10
|
-
|
|
11
|
-
const NvFielddropdown = class {
|
|
12
|
-
constructor(hostRef) {
|
|
13
|
-
index.registerInstance(this, hostRef);
|
|
14
|
-
this.valueChanged = index.createEvent(this, "valueChanged");
|
|
15
|
-
this.filterTextChanged = index.createEvent(this, "filterTextChanged");
|
|
16
|
-
this.openChanged = index.createEvent(this, "openChanged");
|
|
17
|
-
this.dropdownItemSelected = index.createEvent(this, "dropdownItemSelected");
|
|
18
|
-
/****************************************************************************/
|
|
19
|
-
//#region PROPERTIES
|
|
20
|
-
/**
|
|
21
|
-
* Sets the ID for the input element and the for attribute of the associated
|
|
22
|
-
* label. If no ID is provided, a random one will be automatically generated
|
|
23
|
-
* to ensure unique identification, facilitating proper label association and
|
|
24
|
-
* accessibility.
|
|
25
|
-
*/
|
|
26
|
-
this.inputId = v4A79185f4.v4();
|
|
27
|
-
/**
|
|
28
|
-
* The autocomplete prop helps users fill out the input field faster by
|
|
29
|
-
* suggesting entries they've used before, like their email or address.
|
|
30
|
-
* You can turn it on to make forms more convenient or off to ensure users
|
|
31
|
-
* always type in fresh data.
|
|
32
|
-
*/
|
|
33
|
-
this.autocomplete = 'off';
|
|
34
|
-
/**
|
|
35
|
-
* Marks the input field as required, ensuring that the user must fill it out
|
|
36
|
-
* before submitting the form.
|
|
37
|
-
*/
|
|
38
|
-
this.required = false;
|
|
39
|
-
/**
|
|
40
|
-
* Display the input field's content without allowing users to change it.
|
|
41
|
-
* Users can still click on it, select, and copy the text, but they won't be
|
|
42
|
-
* able to type or delete anything.
|
|
43
|
-
*/
|
|
44
|
-
this.readonly = false;
|
|
45
|
-
/**
|
|
46
|
-
* The disabled prop lets you turn off the input field so that users can't
|
|
47
|
-
* type in it. When disabled, the field is grayed out and won't respond to
|
|
48
|
-
* clicks or touches.
|
|
49
|
-
*/
|
|
50
|
-
this.disabled = 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
|
-
* Defines the maximum height of the multiselect list when open.
|
|
59
|
-
*/
|
|
60
|
-
this.maxHeight = '';
|
|
61
|
-
/**
|
|
62
|
-
* The text to display when no items match the filter.
|
|
63
|
-
*/
|
|
64
|
-
this.emptyResult = 'No results found';
|
|
65
|
-
/**
|
|
66
|
-
* Enables or disables the filtering feature for the dropdown items.
|
|
67
|
-
*/
|
|
68
|
-
this.filterable = false;
|
|
69
|
-
/**
|
|
70
|
-
* When an item is selected by the user, the dropdown will continue to stay
|
|
71
|
-
* open.
|
|
72
|
-
*/
|
|
73
|
-
this.openOnSelect = false;
|
|
74
|
-
/**
|
|
75
|
-
* Determines if the component’s filtering behavior is managed externally.
|
|
76
|
-
* When set to true and filterable is enabled, the component won’t
|
|
77
|
-
* automatically filter items. Instead, you must implement your own filtering
|
|
78
|
-
* logic (e.g., server-side search or custom matching) using the
|
|
79
|
-
* filterTextChanged event.
|
|
80
|
-
*/
|
|
81
|
-
this.controlledFilter = false;
|
|
82
|
-
/**
|
|
83
|
-
* Delay in milliseconds before the search is triggered when typing in the
|
|
84
|
-
* filter input.
|
|
85
|
-
* @default 300
|
|
86
|
-
*/
|
|
87
|
-
this.debounceDelay = 300;
|
|
88
|
-
/**
|
|
89
|
-
* Applies focus to the input field as soon as the component is mounted. This
|
|
90
|
-
* is equivalent to setting the native autofocus attribute on an <input>
|
|
91
|
-
* element.
|
|
92
|
-
*/
|
|
93
|
-
this.autofocus = false;
|
|
94
|
-
/**
|
|
95
|
-
* Allows the field to stretch and fill the entire width of its container.
|
|
96
|
-
*/
|
|
97
|
-
this.fluid = false;
|
|
98
|
-
//#endregion PROPERTIES
|
|
99
|
-
/****************************************************************************/
|
|
100
|
-
//#region STATE
|
|
101
|
-
/**
|
|
102
|
-
* The text entered by the user for filtering dropdown items.
|
|
103
|
-
*/
|
|
104
|
-
this.filterText = '';
|
|
105
|
-
this.selectedValues = new Set();
|
|
106
|
-
this.open = false;
|
|
107
|
-
/**
|
|
108
|
-
* Closes the popover when a click is detected outside the component.
|
|
109
|
-
* @param {MouseEvent} event - The click event.
|
|
110
|
-
*/
|
|
111
|
-
this.handleClickOutside = (event) => {
|
|
112
|
-
var _a;
|
|
113
|
-
if (!(event.target instanceof Node))
|
|
114
|
-
return;
|
|
115
|
-
if (!((_a = this.el) === null || _a === void 0 ? void 0 : _a.contains(event.target)))
|
|
116
|
-
this.open = false;
|
|
117
|
-
};
|
|
118
|
-
this.handleFilterInput = () => {
|
|
119
|
-
this.open = true;
|
|
120
|
-
this.filterText = this.inputElement.value;
|
|
121
|
-
this.filterTextChanged.emit(this.inputElement.value);
|
|
122
|
-
clearTimeout(this.debounceTimer);
|
|
123
|
-
this.debounceTimer = window.setTimeout(() => {
|
|
124
|
-
this.filterItems();
|
|
125
|
-
}, this.debounceDelay);
|
|
126
|
-
};
|
|
127
|
-
this.getSelectedLabel = () => {
|
|
128
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
129
|
-
if (!this.value)
|
|
130
|
-
return '';
|
|
131
|
-
if ((_a = this.filterText) === null || _a === void 0 ? void 0 : _a.length)
|
|
132
|
-
return this.filterText;
|
|
133
|
-
if (((_b = this.options) === null || _b === void 0 ? void 0 : _b.length) > 1) {
|
|
134
|
-
const matchingItem = this.options.find(option => option.value === this.value);
|
|
135
|
-
return (_d = (_c = matchingItem === null || matchingItem === void 0 ? void 0 : matchingItem.label) !== null && _c !== void 0 ? _c : matchingItem === null || matchingItem === void 0 ? void 0 : matchingItem.value) !== null && _d !== void 0 ? _d : this.value;
|
|
136
|
-
}
|
|
137
|
-
const items = Array.from(this.el.querySelectorAll('nv-fielddropdownitem'));
|
|
138
|
-
const matchingItem = items.find(item => item.value === this.value);
|
|
139
|
-
const selectedLabel = matchingItem
|
|
140
|
-
? (_g = (_e = matchingItem.label) !== null && _e !== void 0 ? _e : (_f = matchingItem.textContent) === null || _f === void 0 ? void 0 : _f.trim()) !== null && _g !== void 0 ? _g : matchingItem.value
|
|
141
|
-
: '';
|
|
142
|
-
return selectedLabel;
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
//#endregion EVENTS
|
|
146
|
-
/****************************************************************************/
|
|
147
|
-
//#region WATCHERS
|
|
148
|
-
handleOpenChange(newOpen) {
|
|
149
|
-
if (newOpen === false) {
|
|
150
|
-
clearTimeout(this.debounceTimer);
|
|
151
|
-
setTimeout(() => {
|
|
152
|
-
this.clearFilter();
|
|
153
|
-
}, 100);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
handleValueChange() {
|
|
157
|
-
this.updateSelectedItem();
|
|
158
|
-
if (!this.open || !this.filterText)
|
|
159
|
-
this.setFilterInputToSelectedValue();
|
|
160
|
-
}
|
|
161
|
-
handleOptionsChange() {
|
|
162
|
-
this.updateSelectedItem();
|
|
163
|
-
}
|
|
164
|
-
//#endregion WATCHERS
|
|
165
|
-
/****************************************************************************/
|
|
166
|
-
//#region LISTENERS
|
|
167
|
-
handleDropdownItemSelected(event) {
|
|
168
|
-
if (this.disabled || this.readonly)
|
|
169
|
-
return;
|
|
170
|
-
if (!this.openOnSelect)
|
|
171
|
-
this.open = false;
|
|
172
|
-
if (event.detail.detached)
|
|
173
|
-
return;
|
|
174
|
-
const items = this.getAllItems();
|
|
175
|
-
items.forEach(item => {
|
|
176
|
-
if (item !== event.target) {
|
|
177
|
-
item.removeAttribute('selected');
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
item.setAttribute('selected', 'true');
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
this.value = event.detail.value;
|
|
184
|
-
this.setFilterInputToSelectedValue();
|
|
185
|
-
this.valueChanged.emit(event.detail.value);
|
|
186
|
-
}
|
|
187
|
-
handleFocus(event) {
|
|
188
|
-
if (event.relatedTarget instanceof HTMLElement &&
|
|
189
|
-
event.relatedTarget.tagName.includes('NV-FIELDDROPDOWNITEM')) {
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
if (event.target != this.toggleElement)
|
|
193
|
-
this.open = true;
|
|
194
|
-
}
|
|
195
|
-
handleFocusOut(event) {
|
|
196
|
-
if (!(event.relatedTarget instanceof Node))
|
|
197
|
-
return;
|
|
198
|
-
if (this.el.contains(event.relatedTarget))
|
|
199
|
-
return;
|
|
200
|
-
this.open = false;
|
|
201
|
-
}
|
|
202
|
-
handleKeyDown(event) {
|
|
203
|
-
if (event.key === 'Escape') {
|
|
204
|
-
this.focusField();
|
|
205
|
-
this.open = false;
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
if (event.key === ' ') {
|
|
209
|
-
if (event.target == this.selectElement) {
|
|
210
|
-
event.preventDefault(); // Prevent scrolling down
|
|
211
|
-
this.open = true;
|
|
212
|
-
}
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
const items = this.getNavigableItems();
|
|
216
|
-
const highlightedItem = this.getHighlightedItemIndex(items);
|
|
217
|
-
if (event.key === 'ArrowDown') {
|
|
218
|
-
event.preventDefault(); // Prevent scrolling down
|
|
219
|
-
this.open = true;
|
|
220
|
-
const nextIndex = highlightedItem + 1;
|
|
221
|
-
this.updateHighlightedItem(items, nextIndex >= items.length ? 0 : nextIndex);
|
|
222
|
-
}
|
|
223
|
-
if (event.key === 'ArrowUp') {
|
|
224
|
-
event.preventDefault(); // Prevent scrolling up
|
|
225
|
-
this.open = true;
|
|
226
|
-
const nextIndex = highlightedItem - 1;
|
|
227
|
-
this.updateHighlightedItem(items, nextIndex < 0 ? items.length - 1 : nextIndex);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
handleDocumentClick(event) {
|
|
231
|
-
this.handleClickOutside(event);
|
|
232
|
-
}
|
|
233
|
-
//#endregion LISTENERS
|
|
234
|
-
/****************************************************************************/
|
|
235
|
-
//#region METHODS
|
|
236
|
-
/** Clears the filter text */
|
|
237
|
-
async clearFilter() {
|
|
238
|
-
var _a;
|
|
239
|
-
if (!this.filterable)
|
|
240
|
-
return;
|
|
241
|
-
if ((_a = this.filterText) === null || _a === void 0 ? void 0 : _a.length) {
|
|
242
|
-
this.filterText = '';
|
|
243
|
-
this.filterTextChanged.emit(this.filterText);
|
|
244
|
-
}
|
|
245
|
-
this.filterItems();
|
|
246
|
-
// Wait for wrapper lifecycle to finish
|
|
247
|
-
setTimeout(() => {
|
|
248
|
-
this.setFilterInputToSelectedValue();
|
|
249
|
-
}, 0);
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Toggles the dropdown popover open state
|
|
253
|
-
* @param {boolean} open - The open state to set, if null, toggles the state
|
|
254
|
-
*/
|
|
255
|
-
async toggleDropdown(open) {
|
|
256
|
-
if (open !== undefined) {
|
|
257
|
-
setTimeout(() => {
|
|
258
|
-
this.open = open;
|
|
259
|
-
}, 0);
|
|
260
|
-
}
|
|
261
|
-
else {
|
|
262
|
-
setTimeout(() => {
|
|
263
|
-
this.open = !this.open;
|
|
264
|
-
}, 0);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
syncToggleDropdown() {
|
|
268
|
-
this.open = !this.open;
|
|
269
|
-
}
|
|
270
|
-
setFilterInputToSelectedValue() {
|
|
271
|
-
if (!this.filterable && !this.disabled && !this.readonly)
|
|
272
|
-
return;
|
|
273
|
-
if (!this.inputElement)
|
|
274
|
-
return;
|
|
275
|
-
if (!this.value)
|
|
276
|
-
return (this.inputElement.value = '');
|
|
277
|
-
this.inputElement.value = this.getSelectedLabel();
|
|
278
|
-
}
|
|
279
|
-
// Will exclude detached items and data-empty
|
|
280
|
-
getFilterableItems() {
|
|
281
|
-
return Array.from(this.el.querySelectorAll('nv-fielddropdownitem:not([data-empty]):not([detached])'));
|
|
282
|
-
}
|
|
283
|
-
getNavigableItems() {
|
|
284
|
-
return Array.from(this.el.querySelectorAll('nv-fielddropdownitem:not([disabled]):not([hidden])'));
|
|
285
|
-
}
|
|
286
|
-
getAllItems() {
|
|
287
|
-
return Array.from(this.el.querySelectorAll('nv-fielddropdownitem'));
|
|
288
|
-
}
|
|
289
|
-
getHighlightedItemIndex(items) {
|
|
290
|
-
return items.findIndex(item => item.classList.contains('highlighted'));
|
|
291
|
-
}
|
|
292
|
-
updateHighlightedItem(items, index) {
|
|
293
|
-
items.forEach((item, i) => {
|
|
294
|
-
item.classList.remove('highlighted');
|
|
295
|
-
if (i === index) {
|
|
296
|
-
item.classList.add('highlighted');
|
|
297
|
-
item.focus();
|
|
298
|
-
item.scrollIntoView({ block: 'nearest' });
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
focusField() {
|
|
303
|
-
const focusableItem = this.el.querySelector('[data-scope="focusable"]');
|
|
304
|
-
focusableItem === null || focusableItem === void 0 ? void 0 : focusableItem.focus();
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Filter dropdown items based on the text entered by the user.
|
|
308
|
-
* If no items are found, display a message indicating no results.
|
|
309
|
-
*/
|
|
310
|
-
filterItems() {
|
|
311
|
-
var _a, _b;
|
|
312
|
-
if (this.controlledFilter)
|
|
313
|
-
return;
|
|
314
|
-
let hasVisibleItems = false;
|
|
315
|
-
const items = this.getFilterableItems();
|
|
316
|
-
// Remove the "no results found" item if it exists
|
|
317
|
-
(_a = this.el
|
|
318
|
-
.querySelector('nv-fielddropdownitem[data-empty]')) === null || _a === void 0 ? void 0 : _a.remove();
|
|
319
|
-
items.forEach(item => {
|
|
320
|
-
var _a, _b;
|
|
321
|
-
const filterText = this.filterText.toLowerCase();
|
|
322
|
-
const textContent = ((_a = item.textContent) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || '';
|
|
323
|
-
const value = ((_b = item.value) === null || _b === void 0 ? void 0 : _b.toLowerCase()) || '';
|
|
324
|
-
// Either in the value or in the textual content
|
|
325
|
-
const shouldShow = value.includes(filterText) || textContent.includes(filterText);
|
|
326
|
-
if (shouldShow)
|
|
327
|
-
item.removeAttribute('hidden');
|
|
328
|
-
else
|
|
329
|
-
item.setAttribute('hidden', '');
|
|
330
|
-
if (shouldShow) {
|
|
331
|
-
hasVisibleItems = true;
|
|
332
|
-
}
|
|
333
|
-
});
|
|
334
|
-
// If no items are visible, add the "no results found" item
|
|
335
|
-
if (!hasVisibleItems) {
|
|
336
|
-
const emptyItem = document.createElement('nv-fielddropdownitem');
|
|
337
|
-
emptyItem.setAttribute('data-empty', 'true');
|
|
338
|
-
emptyItem.setAttribute('disabled', 'true');
|
|
339
|
-
emptyItem.textContent = this.emptyResult;
|
|
340
|
-
(_b = this.el.querySelector('div[slot="content"] ul')) === null || _b === void 0 ? void 0 : _b.prepend(emptyItem);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
async updateSelectedItem() {
|
|
344
|
-
const items = this.getAllItems();
|
|
345
|
-
if (this.value) {
|
|
346
|
-
items.forEach(item => {
|
|
347
|
-
if (item.value === this.value) {
|
|
348
|
-
item.selected = true;
|
|
349
|
-
}
|
|
350
|
-
else {
|
|
351
|
-
item.selected = false;
|
|
352
|
-
}
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
//#endregion METHODS
|
|
357
|
-
/****************************************************************************/
|
|
358
|
-
//#region LIFECYCLE
|
|
359
|
-
componentDidLoad() {
|
|
360
|
-
this.updateSelectedItem();
|
|
361
|
-
this.setFilterInputToSelectedValue();
|
|
362
|
-
}
|
|
363
|
-
disconnectedCallback() {
|
|
364
|
-
clearTimeout(this.debounceTimer);
|
|
365
|
-
}
|
|
366
|
-
componentDidRender() {
|
|
367
|
-
// Make sure to show the value when the field is disabled or readonly
|
|
368
|
-
// as we switch to an input instead of a p in that case
|
|
369
|
-
if (!this.filterable && (this.disabled || this.readonly)) {
|
|
370
|
-
this.inputElement.value = this.getSelectedLabel();
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
//#endregion LIFECYCLE
|
|
374
|
-
/****************************************************************************/
|
|
375
|
-
//#region RENDER
|
|
376
|
-
render() {
|
|
377
|
-
var _a;
|
|
378
|
-
return (index.h(index.Host, { key: '349904a9bf07fb37c44f0b73c95ae736efb6a3b2', role: "combobox", "aria-expanded": this.open.toString(), "aria-haspopup": "listbox", "aria-label": this.label }, (this.label || this.el.querySelector('[slot="label"]')) && (index.h("label", { key: 'c5f8bb31012cac1c671fdca7b77325b28b7f0fad', htmlFor: this.inputId, onClick: this.syncToggleDropdown.bind(this) }, index.h("slot", { key: 'cec5527d93c3742abbe5cb26d452a0ce061998dc', name: "label" }, this.label))), index.h("nv-popover", { key: '6b5c8d8fc0fe2615ac2703e78faa91a4c8e0f792', triggerMode: "controlled", placement: "bottom-start", open: this.open }, index.h("div", { key: 'f07d22a294703544be6687e11b880d01a29c1629', class: "input-wrapper", slot: "trigger" }, index.h("slot", { key: '4067e496595f3647c6ab30a858011f38da9fe039', name: "before-input" }), index.h("div", { key: 'e13bf4e23b508a3ce621a677509c2052ce6ee146', class: "input-container" }, index.h("slot", { key: '8f26a1ab3d0c7405e4bc16acfcd6ab7f27336816', name: "leading-input" }), this.filterable || this.disabled || this.readonly ? (index.h("input", { "data-scope": "focusable", id: this.inputId, type: "search", ref: e => (this.inputElement = e), autofocus: this.autofocus, autocomplete: this.autocomplete, placeholder: this.placeholder, name: this.name, required: this.required, disabled: this.disabled, readOnly: this.readonly, onInput: this.handleFilterInput })) : (index.h("p", { "data-scope": "focusable", id: this.inputId, ref: el => (this.selectElement = el), class: "non-filterable-text", tabIndex: this.disabled ? -1 : 0 }, this.getSelectedLabel() || this.value || this.placeholder)), this.filterable && this.filterText && (index.h("nv-iconbutton", { key: '715fe5388001e7d005ee4c57f6ea699b2b507dbb', name: "x", size: "md", emphasis: "lower", class: "clear-button", onClick: this.clearFilter.bind(this), "aria-label": "Clear input" })), this.error && (index.h("nv-icon", { key: '18d825c0bfd9b6bf528dbf34f7e7a2f90678fa87', name: "alert-circle", class: "validation", size: "md" })), index.h("nv-iconbutton", { key: 'aee8efcaeb022ca3ef73bbd3085755817e6fae12', "data-scope": "toggle-dropdown", ref: el => (this.toggleElement = el), name: this.open ? 'chevron-top' : 'chevron-down', size: "md", emphasis: "lower", "aria-label": this.open ? 'Hide dropdown' : 'Show dropdown', onClick: this.syncToggleDropdown.bind(this), tabIndex: this.disabled ? -1 : 0 })), index.h("slot", { key: '403e224fadcb71ad15574a100b9892f3b8bfa209', name: "after-input" })), index.h("div", { key: 'b154f9f5bb6b8bc73c2c0fdfeae096586ca43275', slot: "content", style: this.maxHeight ? { maxHeight: this.maxHeight } : {} }, ((_a = this.options) === null || _a === void 0 ? void 0 : _a.length) > 0 && (index.h("ul", { key: 'ae92bb94df44b545ce83644fe3cb4b312f7d3147' }, this.options.map(option => (index.h("nv-fielddropdownitem", { label: option.label, value: option.value, disabled: option.disabled, selected: option.value === this.value }))))), index.h("slot", { key: '8f8a76ba2cfd23cbff34a579222a2e1f8a635142', name: "content" }))), (this.description ||
|
|
379
|
-
this.el.querySelector('[slot="description"]')) && (index.h("div", { key: 'c3b288a86fd98c0cf61bf671524f2a5c0d8ccd47', class: "description" }, index.h("slot", { key: '212e58e32660ef43042c418c09b828ed388f4017', name: "description" }, this.description))), (this.errorDescription ||
|
|
380
|
-
this.el.querySelector('[slot="error-description"]')) && (index.h("div", { key: '0baf91460aac3f2ba5b2d41721fc44c5eeb2f6aa', hidden: !this.error, class: "error-description" }, index.h("slot", { key: '134681ffcf2a86b86bac60ff0ebabbba4e89b380', name: "error-description" }, this.errorDescription)))));
|
|
381
|
-
}
|
|
382
|
-
static get formAssociated() { return true; }
|
|
383
|
-
get el() { return index.getElement(this); }
|
|
384
|
-
static get watchers() { return {
|
|
385
|
-
"open": ["handleOpenChange"],
|
|
386
|
-
"value": ["handleValueChange"],
|
|
387
|
-
"options": ["handleOptionsChange"]
|
|
388
|
-
}; }
|
|
389
|
-
};
|
|
390
|
-
NvFielddropdown.style = NvFielddropdownStyle0;
|
|
391
|
-
|
|
392
|
-
exports.nv_fielddropdown = NvFielddropdown;
|