@nova-design-system/nova-webcomponents 3.8.0 → 3.9.1
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/loader.cjs.js +1 -1
- package/dist/cjs/native.cjs.js +1 -1
- package/dist/cjs/nv-calendar.cjs.entry.js +9 -3
- package/dist/cjs/nv-calendar.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-dialog.cjs.entry.js +19 -32
- package/dist/cjs/nv-dialog.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-dialogfooter_2.cjs.entry.js +1 -1
- package/dist/cjs/nv-dialogfooter_2.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fielddate.cjs.entry.js +62 -94
- package/dist/cjs/nv-fielddate.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fielddaterange.cjs.entry.js +52 -33
- package/dist/cjs/nv-fielddaterange.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fieldselect.cjs.entry.js +14 -26
- package/dist/cjs/nv-fieldselect.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-icon.cjs.entry.js +2 -2
- package/dist/cjs/nv-icon.cjs.entry.js.map +1 -1
- package/dist/collection/components/nv-calendar/nv-calendar.js +9 -3
- package/dist/collection/components/nv-calendar/nv-calendar.js.map +1 -1
- package/dist/collection/components/nv-dialog/nv-dialog.js +21 -40
- package/dist/collection/components/nv-dialog/nv-dialog.js.map +1 -1
- package/dist/collection/components/nv-dialogheader/nv-dialogheader.css +1 -0
- package/dist/collection/components/nv-fielddate/nv-fielddate.js +63 -94
- package/dist/collection/components/nv-fielddate/nv-fielddate.js.map +1 -1
- package/dist/collection/components/nv-fielddaterange/nv-fielddaterange.js +52 -33
- package/dist/collection/components/nv-fielddaterange/nv-fielddaterange.js.map +1 -1
- package/dist/collection/components/nv-fieldselect/nv-fieldselect.css +2 -0
- package/dist/collection/components/nv-fieldselect/nv-fieldselect.docs.js +8 -8
- package/dist/collection/components/nv-fieldselect/nv-fieldselect.docs.js.map +1 -1
- package/dist/collection/components/nv-fieldselect/nv-fieldselect.js +25 -35
- package/dist/collection/components/nv-fieldselect/nv-fieldselect.js.map +1 -1
- package/dist/collection/components/nv-icon/nv-icon.js +1 -1
- package/dist/collection/components/nv-icon/nv-icon.js.map +1 -1
- package/dist/components/nv-accordion-item.js +1 -1
- package/dist/components/nv-accordion.js +3 -3
- package/dist/components/nv-alert.js +1 -1
- package/dist/components/nv-avatar.js +1 -1
- package/dist/components/nv-badge.js +1 -1
- package/dist/components/nv-calendar.js +1 -1
- package/dist/components/nv-datagrid.js +2 -2
- package/dist/components/nv-dialog.js +23 -36
- package/dist/components/nv-dialog.js.map +1 -1
- package/dist/components/nv-dialogfooter.js +1 -1
- package/dist/components/nv-dialogheader.js +1 -1
- package/dist/components/nv-fielddate.js +68 -100
- package/dist/components/nv-fielddate.js.map +1 -1
- package/dist/components/nv-fielddaterange.js +56 -37
- package/dist/components/nv-fielddaterange.js.map +1 -1
- package/dist/components/nv-fielddropdown.js +3 -3
- package/dist/components/nv-fielddropdownitem.js +1 -1
- package/dist/components/nv-fieldmultiselect.js +3 -3
- package/dist/components/nv-fieldnumber.js +1 -1
- package/dist/components/nv-fieldpassword.js +2 -2
- package/dist/components/nv-fieldselect.js +18 -31
- package/dist/components/nv-fieldselect.js.map +1 -1
- package/dist/components/nv-fieldslider.js +3 -3
- package/dist/components/nv-fieldtext.js +1 -1
- package/dist/components/nv-fieldtime.js +2 -2
- package/dist/components/nv-icon.js +1 -1
- package/dist/components/nv-iconbutton.js +1 -1
- package/dist/components/nv-menu.js +2 -2
- package/dist/components/nv-menuitem.js +1 -1
- package/dist/components/{p-6e2f91ae.js → p-025b8a78.js} +2 -2
- package/dist/components/{p-6e2f91ae.js.map → p-025b8a78.js.map} +1 -1
- package/dist/components/{p-865725bf.js → p-30f970c3.js} +2 -2
- package/dist/components/{p-865725bf.js.map → p-30f970c3.js.map} +1 -1
- package/dist/components/{p-f0371d98.js → p-60064345.js} +2 -2
- package/dist/components/{p-f0371d98.js.map → p-60064345.js.map} +1 -1
- package/dist/components/p-6460318d.js +88 -0
- package/dist/components/p-6460318d.js.map +1 -0
- package/dist/components/{p-9a209ac7.js → p-68ff562f.js} +2 -2
- package/dist/components/{p-9a209ac7.js.map → p-68ff562f.js.map} +1 -1
- package/dist/components/{p-abb8f5ae.js → p-6de6866c.js} +2 -2
- package/dist/components/{p-abb8f5ae.js.map → p-6de6866c.js.map} +1 -1
- package/dist/components/{p-f927f771.js → p-79e6b6a2.js} +3 -3
- package/dist/components/{p-f927f771.js.map → p-79e6b6a2.js.map} +1 -1
- package/dist/components/{p-d32b75ac.js → p-82e5674c.js} +10 -4
- package/dist/components/p-82e5674c.js.map +1 -0
- package/dist/components/{p-7bc65e46.js → p-db4ba1d9.js} +3 -3
- package/dist/components/{p-7bc65e46.js.map → p-db4ba1d9.js.map} +1 -1
- package/dist/components/{p-fa1988d9.js → p-e4e1a926.js} +2 -2
- package/dist/components/{p-fa1988d9.js.map → p-e4e1a926.js.map} +1 -1
- package/dist/components/{p-ca130ad2.js → p-ed6686a1.js} +2 -2
- package/dist/components/p-ed6686a1.js.map +1 -0
- package/dist/components/{p-91a558eb.js → p-f1df2634.js} +2 -2
- package/dist/components/{p-91a558eb.js.map → p-f1df2634.js.map} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/native.js +1 -1
- package/dist/esm/nv-calendar.entry.js +9 -3
- package/dist/esm/nv-calendar.entry.js.map +1 -1
- package/dist/esm/nv-dialog.entry.js +19 -32
- package/dist/esm/nv-dialog.entry.js.map +1 -1
- package/dist/esm/nv-dialogfooter_2.entry.js +1 -1
- package/dist/esm/nv-dialogfooter_2.entry.js.map +1 -1
- package/dist/esm/nv-fielddate.entry.js +62 -94
- package/dist/esm/nv-fielddate.entry.js.map +1 -1
- package/dist/esm/nv-fielddaterange.entry.js +52 -33
- package/dist/esm/nv-fielddaterange.entry.js.map +1 -1
- package/dist/esm/nv-fieldselect.entry.js +14 -26
- package/dist/esm/nv-fieldselect.entry.js.map +1 -1
- package/dist/esm/nv-icon.entry.js +2 -2
- package/dist/esm/nv-icon.entry.js.map +1 -1
- package/dist/native/native.esm.js +1 -1
- package/dist/native/native.esm.js.map +1 -1
- package/dist/native/{p-baddee4c.entry.js → p-11012998.entry.js} +2 -2
- package/dist/native/p-11012998.entry.js.map +1 -0
- package/dist/native/{p-dc34da69.entry.js → p-4a533dd8.entry.js} +2 -2
- package/dist/native/p-4a533dd8.entry.js.map +1 -0
- package/dist/native/{p-f687e05c.entry.js → p-55cd3d62.entry.js} +2 -2
- package/dist/native/p-55cd3d62.entry.js.map +1 -0
- package/dist/native/{p-516da423.entry.js → p-9ea3d30d.entry.js} +2 -2
- package/dist/native/p-9ea3d30d.entry.js.map +1 -0
- package/dist/native/{p-12039da4.entry.js → p-b7ec9a1b.entry.js} +2 -2
- package/dist/native/p-b7ec9a1b.entry.js.map +1 -0
- package/dist/native/p-bc77cac1.entry.js +2 -0
- package/dist/native/p-bc77cac1.entry.js.map +1 -0
- package/dist/native/{p-9dc1c3e7.entry.js → p-ff248eb8.entry.js} +2 -2
- package/dist/native/{p-9dc1c3e7.entry.js.map → p-ff248eb8.entry.js.map} +1 -1
- package/dist/types/components/nv-dialog/nv-dialog.d.ts +6 -17
- package/dist/types/components/nv-fielddate/nv-fielddate.d.ts +4 -19
- package/dist/types/components/nv-fielddaterange/nv-fielddaterange.d.ts +1 -0
- package/dist/types/components/nv-fieldselect/nv-fieldselect.d.ts +22 -9
- package/dist/types/components.d.ts +38 -4
- package/dist/vscode-data.json +2 -6
- package/hydrate/index.js +163 -197
- package/hydrate/index.mjs +163 -197
- package/package.json +1 -1
- package/dist/components/p-9232d306.js +0 -88
- package/dist/components/p-9232d306.js.map +0 -1
- package/dist/components/p-ca130ad2.js.map +0 -1
- package/dist/components/p-d32b75ac.js.map +0 -1
- package/dist/native/p-12039da4.entry.js.map +0 -1
- package/dist/native/p-516da423.entry.js.map +0 -1
- package/dist/native/p-baddee4c.entry.js.map +0 -1
- package/dist/native/p-c65a79a9.entry.js +0 -2
- package/dist/native/p-c65a79a9.entry.js.map +0 -1
- package/dist/native/p-dc34da69.entry.js.map +0 -1
- package/dist/native/p-f687e05c.entry.js.map +0 -1
|
@@ -16,10 +16,6 @@ export class NvFieldselect {
|
|
|
16
16
|
//#region STATES
|
|
17
17
|
this.computedDisplayValue = '';
|
|
18
18
|
this.internalReadonly = false;
|
|
19
|
-
/**
|
|
20
|
-
* Parsed options stored internally
|
|
21
|
-
*/
|
|
22
|
-
this.parsedOptions = [];
|
|
23
19
|
//#endregion STATES
|
|
24
20
|
/****************************************************************************/
|
|
25
21
|
//#region PROPERTIES
|
|
@@ -169,24 +165,16 @@ export class NvFieldselect {
|
|
|
169
165
|
}
|
|
170
166
|
}
|
|
171
167
|
/**
|
|
172
|
-
*
|
|
173
|
-
* @param {
|
|
168
|
+
* Handle options change and update the internal state
|
|
169
|
+
* @param {typeof this.options} newValue - The new value of options
|
|
174
170
|
*/
|
|
175
171
|
handleOptionsChange(newValue) {
|
|
176
|
-
if (
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
if (selectedOption) {
|
|
183
|
-
this.value = selectedOption.value;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
catch (error) {
|
|
187
|
-
console.error('Error parsing options:', error);
|
|
188
|
-
this.parsedOptions = [];
|
|
189
|
-
}
|
|
172
|
+
if (!newValue)
|
|
173
|
+
return;
|
|
174
|
+
// Update the value if an option is pre-selected
|
|
175
|
+
const selectedOption = newValue.find(opt => opt.selected);
|
|
176
|
+
if (selectedOption) {
|
|
177
|
+
this.value = selectedOption.value;
|
|
190
178
|
}
|
|
191
179
|
}
|
|
192
180
|
/**
|
|
@@ -347,13 +335,13 @@ export class NvFieldselect {
|
|
|
347
335
|
* @returns {HTMLStencilElement} The HTML element to render.
|
|
348
336
|
*/
|
|
349
337
|
render() {
|
|
350
|
-
return (h(Host, { key: '
|
|
338
|
+
return (h(Host, { key: '6db1f2e159308d8b1e78932522c62f73e78db893' }, (this.label || this.el.querySelector('[slot="label"]')) && (h("label", { key: 'c329b6bb95018b0d9e574516ca8e801ea82828be', htmlFor: this.inputId }, h("slot", { key: '94d57fd7026986a8ef86dacffb70f0e590c8d2d7', name: "label" }, this.label))), h("div", { key: 'fca0df783ac46ebd16aa8b6e8db1450d81d2a0e7', class: "select-wrapper" }, h("slot", { key: 'bd944f336912516b83f32f58bd76a7ff80de2fb6', name: "before-input" }), h("div", { key: '42729a7ba192d85fa76abef9b928c98e514f7ff3', class: "select-container", onClick: this.handleSelectContainerClick }, h("slot", { key: '90ca0a9446a62a756e19b0b71db10fe8147eba25', name: "leading-input" }), this.internalReadonly && (h("input", { key: '55b2cf61b1ad07479a104c8d2ff4f46f41dd1677', 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
|
|
351
339
|
? `${this.inputId}-error`
|
|
352
|
-
: `${this.inputId}-description` })), h("select", { key: '
|
|
340
|
+
: `${this.inputId}-description` })), h("select", { key: '482be9d241679ad9f77f199c00b4a8d0434ac91e', id: this.inputId, ref: el => (this.selectElement = el), name: this.name, autofocus: this.autofocus, disabled: this.disabled, required: this.required, multiple: this.multiple, onChange: this.handleSelectChange, class: this.internalReadonly ? 'hidden' : '', "aria-label": this.label, "aria-describedby": this.error
|
|
353
341
|
? `${this.inputId}-error`
|
|
354
|
-
: `${this.inputId}-description` }, this.
|
|
355
|
-
this.el.querySelector('[slot="description"]')) && (h("div", { key: '
|
|
356
|
-
this.el.querySelector('[slot="error-description"]')) && (h("div", { key: '
|
|
342
|
+
: `${this.inputId}-description` }, this.options && this.options.length > 0 ? (this.options.map(option => (h("option", { value: option.value, selected: option.selected, disabled: option.disabled }, option.label)))) : (h("slot", null))), h("div", { key: '17a31f45608536be911f3fca1e28e11caac7a065', class: "select-icons" }, this.error && (h("nv-icon", { key: 'f8f6f1545d87cfdf174755da82780356480de737', name: "alert-circle", class: "validation", size: "md" })), this.success && (h("nv-icon", { key: 'f79e5968a6fc70cf56c07223a8a569648d77c082', name: "circle-check", class: "validation", size: "md" })), !this.multiple && (h("nv-iconbutton", { key: 'd7f2c576a6c6c5d964f692c1f520d0e71af82f35', name: "chevron-down", size: "md", emphasis: "lower", tabindex: -1 })))), h("slot", { key: '852c05430b705347f473899ff884725b511d527d', name: "after-input" })), (this.description ||
|
|
343
|
+
this.el.querySelector('[slot="description"]')) && (h("div", { key: '3f98fb2ee526fae3c74f2e2dd78d5f10b9e13475', class: "description", id: `${this.inputId}-description` }, h("slot", { key: '268191d3ffc3191d7c946d805c6cd58dc1855dda', name: "description" }, this.description))), (this.errorDescription ||
|
|
344
|
+
this.el.querySelector('[slot="error-description"]')) && (h("div", { key: '24b5935d22d7971f6aa5922a1fa8c47b8beb069f', class: "error-description", id: `${this.inputId}-error` }, h("slot", { key: '5492aecb0537f91f8cf38430b4048bb7bd13edf8', name: "error-description" }, this.errorDescription)))));
|
|
357
345
|
}
|
|
358
346
|
static get is() { return "nv-fieldselect"; }
|
|
359
347
|
static get formAssociated() { return true; }
|
|
@@ -414,23 +402,26 @@ export class NvFieldselect {
|
|
|
414
402
|
"reflect": true
|
|
415
403
|
},
|
|
416
404
|
"options": {
|
|
417
|
-
"type": "
|
|
405
|
+
"type": "unknown",
|
|
418
406
|
"mutable": false,
|
|
419
407
|
"complexType": {
|
|
420
|
-
"original": "string",
|
|
421
|
-
"resolved": "string",
|
|
422
|
-
"references": {
|
|
408
|
+
"original": "Array<{\n /**\n * The label of the option\n */\n label: string;\n /**\n * The value of the option\n */\n value: string;\n /**\n * Whether the option is selected\n */\n selected?: boolean;\n /**\n * Whether the option is disabled\n */\n disabled?: boolean;\n }>",
|
|
409
|
+
"resolved": "{ label: string; value: string; selected?: boolean; disabled?: boolean; }[]",
|
|
410
|
+
"references": {
|
|
411
|
+
"Array": {
|
|
412
|
+
"location": "global",
|
|
413
|
+
"id": "global::Array"
|
|
414
|
+
}
|
|
415
|
+
}
|
|
423
416
|
},
|
|
424
417
|
"required": false,
|
|
425
418
|
"optional": true,
|
|
426
419
|
"docs": {
|
|
427
420
|
"tags": [],
|
|
428
|
-
"text": "Options to display in the select
|
|
421
|
+
"text": "Options to display in the select.\nFormat: [{ label: string, value: string, selected?: boolean, disabled?: boolean }]"
|
|
429
422
|
},
|
|
430
423
|
"getter": false,
|
|
431
|
-
"setter": false
|
|
432
|
-
"attribute": "options",
|
|
433
|
-
"reflect": true
|
|
424
|
+
"setter": false
|
|
434
425
|
},
|
|
435
426
|
"inputId": {
|
|
436
427
|
"type": "string",
|
|
@@ -739,8 +730,7 @@ export class NvFieldselect {
|
|
|
739
730
|
static get states() {
|
|
740
731
|
return {
|
|
741
732
|
"computedDisplayValue": {},
|
|
742
|
-
"internalReadonly": {}
|
|
743
|
-
"parsedOptions": {}
|
|
733
|
+
"internalReadonly": {}
|
|
744
734
|
};
|
|
745
735
|
}
|
|
746
736
|
static get events() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nv-fieldselect.js","sourceRoot":"","sources":["../../../src/components/nv-fieldselect/nv-fieldselect.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,CAAC,EACD,IAAI,EACJ,KAAK,EAEL,KAAK,EACL,OAAO,EACP,KAAK,GACN,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAEpC;;;;;;;;GAQG;AAOH,MAAM,OAAO,aAAa;IAN1B;QA4BE,uBAAuB;QACvB,8EAA8E;QAC9E,gBAAgB;QAGR,yBAAoB,GAAW,EAAE,CAAC;QAGlC,qBAAgB,GAAY,KAAK,CAAC;QAS1C;;WAEG;QAEK,kBAAa,GAiBhB,EAAE,CAAC;QAER,mBAAmB;QACnB,8EAA8E;QAC9E,oBAAoB;QAEpB;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGF","sourcesContent":["import {\n Component,\n Host,\n h,\n Prop,\n Event,\n EventEmitter,\n Watch,\n Element,\n State,\n} from '@stencil/core';\nimport { v4 as uuidv4 } from 'uuid';\n\n/**\n * @slot default - Content to be placed inside the select element.\n * @slot leading-input - Content to be placed before the select input, within the select container.\n * @slot before-input - Content to be placed before the select input, outside the select container.\n * @slot after-input - Content to be placed after the select input, outside the select container.\n * @slot label - Content to be placed as the label, will override the label prop.\n * @slot description - Content to be placed as the description, will override the description prop.\n * @slot error-description - Content to be placed as the error description, will override the errorDescription prop.\n */\n@Component({\n tag: 'nv-fieldselect',\n shadow: false,\n formAssociated: true,\n styleUrl: 'nv-fieldselect.scss',\n})\nexport class NvFieldselect {\n @Element() el: HTMLNvFieldselectElement;\n private selectElement!: HTMLSelectElement;\n private internals: ElementInternals;\n\n /****************************************************************************/\n //#region DEPRECATED\n\n /**\n * Message defines a 'hint ' message for the Select Field.\n * @deprecated Use `description` instead.\n */\n @Prop({ reflect: true })\n readonly message: string;\n\n /**\n * Add the message to the validation state.\n * @deprecated Use `errorDescription` and set the error prop instead.\n */\n @Prop({ reflect: true })\n readonly validation: string;\n\n //#endregion DEPRECATED\n /****************************************************************************/\n //#region STATES\n\n @State()\n private computedDisplayValue: string = '';\n\n @State()\n private internalReadonly: boolean = false;\n\n /**\n * Options to display in the select. Can be passed as a JSON string.\n * Format: [{ label: string, value: string, selected?: boolean, disabled?: boolean }]\n */\n @Prop({ reflect: true })\n readonly options?: string;\n\n /**\n * Parsed options stored internally\n */\n @State()\n private parsedOptions: Array<{\n /**\n * The label of the option\n */\n label: string;\n /**\n * The value of the option\n */\n value: string;\n /**\n * Whether the option is selected\n */\n selected?: boolean;\n /**\n * Whether the option is disabled\n */\n disabled?: boolean;\n }> = [];\n\n //#endregion STATES\n /****************************************************************************/\n //#region PROPERTIES\n\n /**\n * Sets the ID for the select element and the for attribute of the associated\n * label. If no ID is provided, a random one will be automatically generated\n * to ensure unique identification, facilitating proper label association and\n * accessibility.\n */\n @Prop({ reflect: true })\n readonly inputId: string = uuidv4();\n\n /**\n * Lets you define the text that explains what users should choose in the\n * select field. It’s a crucial element for making forms clear and\n * user-friendly.\n */\n @Prop({ reflect: true })\n readonly label?: string;\n\n /**\n * Add helpful hints or extra information under the select field. This is\n * where you can clarify what users should choose or provide additional\n * instructions, making the form easier to fill out correctly.\n */\n @Prop({ reflect: true, mutable: true })\n description?: string;\n\n /**\n * Defines the name attribute of the select field, which is crucial for form\n * submission. This value is used as the key in the key-value pair sent to\n * the server, representing the selected data in form submissions. It should be\n * unique within the form to avoid conflicts\n */\n @Prop({ reflect: true })\n readonly name: string;\n\n /**\n * The disabled prop lets you turn off the select field so that users can’t\n * choose something. When disabled, the field is grayed out and won’t respond to\n * clicks or touches.\n */\n @Prop({ reflect: true })\n readonly disabled: boolean = false;\n\n /**\n * Display the select field’s content without allowing users to change it.\n * Users can still click on it, select, and copy the text, but they won’t be\n * able to change or delete anything.\n */\n @Prop({ reflect: true })\n readonly readonly: boolean = false;\n\n /**\n * Marks the select field as required, ensuring that the user must fill it out\n * before submitting the form.\n */\n @Prop({ reflect: true })\n readonly required: boolean = false;\n\n /**\n * Alters the select field’s appearance to indicate an error, helping users\n * identify fields that need correction.\n * @validator error\n */\n @Prop({ reflect: true, mutable: true })\n error: boolean = false;\n\n /**\n * Show a helpful message under the select field when there’s a problem. It\n * explains what’s wrong and how users can fix it, making the error easier to\n * understand and resolve.\n * @validator message\n */\n @Prop({ reflect: true, mutable: true })\n errorDescription: string;\n\n /**\n * Changes the select field’s appearance to indicate successful input or\n * validation.\n */\n @Prop({ reflect: true })\n readonly success: boolean = false;\n\n /**\n * When enabled, allows the select to handle multiple selections.\n */\n @Prop({ reflect: true })\n readonly multiple: boolean = false;\n\n /**\n * The value of the select field.\n * - If `multiple` is `false`, it's a single string.\n * - If `multiple` is `true`, it's a comma-separated string of selected values.\n */\n @Prop({ reflect: true, mutable: true })\n value: string = '';\n\n /**\n * When enabled, displays the value element instead of the label when readonly.\n * By default, the label is displayed in readonly mode. Also it automatically\n * sets the component to readonly.\n */\n @Prop({ reflect: true })\n readonly displayValue: boolean = false;\n\n /**\n * Applies focus to the input field as soon as the component is mounted. This\n * is equivalent to setting the native autofocus attribute on a <select>\n * element.\n */\n @Prop({ reflect: true })\n // eslint-disable-next-line @stencil-community/reserved-member-names\n readonly autofocus: boolean = false;\n\n /**\n * Allows the field to stretch and fill the entire width of its container.\n */\n @Prop({ reflect: true })\n readonly fluid: boolean = false;\n\n //#endregion PROPERTIES\n /****************************************************************************/\n //#region EVENTS\n\n /**\n * Emitted when the selected value changes.\n * @bind value\n */\n @Event()\n valueChanged: EventEmitter<string>; // Emit as a string\n\n //#endregion EVENTS\n /****************************************************************************/\n //#region WATCHERS\n\n /**\n * Updates the display value when the value property changes. This watcher is\n * used to update the display value when the selected value changes. This is\n * necessary for readonly select fields to display the selected value.\n * @internal This watcher is not intended to be called outside of the component.\n * @param {string} newValue - The new value of the select field.\n */\n @Watch('value')\n updateDisplayValueWatcher(newValue: string) {\n this.updateDisplayValue();\n\n if (this.selectElement) {\n const selectedValues = newValue.split(',').map(val => val.trim());\n const options = this.selectElement.options;\n\n if (options) {\n Array.from(options).forEach(option => {\n option.selected = this.multiple\n ? selectedValues.includes(option.value)\n : option.value === selectedValues[0];\n });\n\n if (!this.multiple) {\n this.selectElement.value = newValue; // Only set when not multiple\n }\n } else {\n this.selectElement.value = selectedValues[0] || '';\n }\n }\n\n // Update form value\n this.setFormValue();\n }\n\n /**\n * Watcher for the displayValue prop to ensure internalReadonly is true when displayValue is true.\n * @param {boolean} newValue - The new value of displayValue.\n */\n @Watch('displayValue')\n handleDisplayValueChange(newValue: boolean) {\n this.internalReadonly = newValue; // Set internalReadonly to true if displayValue is true\n\n if (this.readonly) {\n this.internalReadonly = true;\n }\n }\n\n /**\n * Watcher for the readonly prop to ensure internalReadonly is true when readonly is true.\n * @param {boolean} newValue - The new value of readonly.\n */\n @Watch('readonly')\n handleReadonlyChange(newValue: boolean) {\n this.internalReadonly = newValue; // Set internalReadonly to true if displayValue is true\n\n if (this.displayValue) {\n this.internalReadonly = true;\n }\n }\n\n /**\n * Parse options and update the internal state\n * @param {string} newValue - The new value of options\n */\n @Watch('options')\n handleOptionsChange(newValue: string) {\n if (typeof newValue === 'string') {\n try {\n const parsedOpts = JSON.parse(newValue);\n this.parsedOptions = [...parsedOpts];\n\n // Update the value if an option is pre-selected\n const selectedOption = parsedOpts.find(opt => opt.selected);\n if (selectedOption) {\n this.value = selectedOption.value;\n }\n } catch (error) {\n console.error('Error parsing options:', error);\n this.parsedOptions = [];\n }\n }\n }\n\n //#endregion WATCHERS\n /****************************************************************************/\n //#region METHODS\n\n /**\n * Handles the change event on the select element. This method is used to\n * update the value property when the selected options change. It is also\n * used to emit the selectChanged event when the selected value changes.\n * @param {Event} event - The change event on the select element.\n * @emits selectChanged\n */\n private readonly handleSelectChange = (event: Event) => {\n const select = event.target as HTMLSelectElement;\n let selectedValues: string[] = Array.from(select.selectedOptions).map(\n option => option.value,\n );\n\n if (!this.multiple) {\n selectedValues = selectedValues.slice(0, 1);\n }\n\n this.value = this.multiple\n ? selectedValues.join(', ')\n : selectedValues[0] || '';\n this.valueChanged.emit(this.value);\n\n // Update form value\n this.setFormValue();\n };\n\n /**\n * Handles focus when the select container is clicked.\n */\n private readonly handleSelectContainerClick = () => {\n if (!this.internalReadonly && this.selectElement) {\n this.selectElement.focus();\n }\n };\n\n /**\n * Updates the display value of the select field. This method is used to\n * update the display value when the selected value changes. This is necessary\n * for readonly select fields to display the selected value. This method is\n * called in the componentDidLoad lifecycle hook and the updateDisplayValueWatcher\n * watcher.\n * @internal This method is not intended to be called outside of the component.\n */\n private updateDisplayValue(): void {\n if (this.internalReadonly && !this.displayValue) {\n if (this.multiple) {\n const selectedLabels = this.value\n .split(',')\n .map(key => key.trim())\n .map(key => this.getLabelFromId(key) || '')\n .filter(label => label !== '');\n this.computedDisplayValue = selectedLabels.join(', ') || '';\n } else {\n this.computedDisplayValue = this.getLabelFromId(this.value) || '';\n }\n } else if (this.internalReadonly && this.displayValue) {\n this.computedDisplayValue = this.value || '';\n }\n }\n\n /**\n * Retrieves the label from the <option> elements based on the provided key (value).\n * This method uses the id or value attribute directly from the <select> options.\n * @param {string} key - The key (value) for which to find the corresponding label.\n * @returns {string} The label if found; otherwise, an empty string.\n */\n private getLabelFromId(key: string): string {\n this.ensureSelectElement();\n if (!this.selectElement) {\n return '';\n }\n\n // Cache the option list\n const options = this.selectElement.options;\n\n if (options) {\n const option = Array.from(options).find(option => option.value === key);\n return option ? option.textContent.trim() || '' : '';\n } else {\n return '';\n }\n }\n\n /**\n * Sets the value of the form element for form submission. This method is\n * called when the selected value changes or when the value property is set.\n * @internal This method is not intended to be called outside of the component.\n */\n private setFormValue(): void {\n this.internals.setFormValue(this.value);\n }\n\n /**\n * Ensures the select element is available. This method is used to ensure\n * the select element is available before attempting to access it.\n * @internal This method is not intended to be called outside of the component.\n */\n private ensureSelectElement(): void {\n if (!this.selectElement) {\n this.selectElement = this.el.querySelector('select') as HTMLSelectElement;\n }\n }\n\n //#endregion METHODS\n /****************************************************************************/\n //#region LIFECYCLE\n\n componentWillRender() {\n this.updateDisplayValue(); // Ensure display value is updated before render\n\n if (this.message) {\n this.description = this.message;\n }\n\n if (this.validation) {\n this.errorDescription = this.validation;\n this.error = true;\n }\n }\n\n /**\n * Lifecycle method that is called before the component is rendered. This is\n * where the internal state is set up before rendering occurs.\n */\n componentWillLoad() {\n // Set internalReadonly based on the readonly prop\n this.internalReadonly = this.readonly;\n\n // Ensure internalReadonly is true if displayValue is true during loading\n if (this.displayValue) {\n this.internalReadonly = true;\n }\n\n if ('attachInternals' in this.el) {\n this.internals = (\n this.el as HTMLElement & {\n /**\n * Attach the element to the form internals.\n * @returns {ElementInternals} - The element internals object.\n */\n attachInternals: () => ElementInternals;\n }\n ).attachInternals();\n } else {\n // Fallback logic for browsers without attachInternals support\n this.internals = {\n setFormValue: (value: string) => {\n const formElement = this.el.closest('form');\n if (formElement) {\n const input = document.createElement('input');\n input.type = 'hidden';\n input.name = this.name;\n input.value = value;\n formElement.appendChild(input);\n }\n },\n } as ElementInternals;\n }\n\n // Initialize value as an empty string if multiple is true\n if (this.multiple && typeof this.value !== 'string') {\n this.value = '';\n }\n\n // Parse initial options if present\n if (this.options) {\n this.handleOptionsChange(this.options);\n }\n }\n\n /**\n * Lifecycle method that is called after the component has been rendered.\n * This is where the display value is updated and the initial select element's\n * state is set.\n */\n componentDidLoad() {\n this.updateDisplayValue();\n\n if (this.selectElement) {\n // Only set the value for single selection, skip for multiple\n if (!this.multiple) {\n this.selectElement.value = this.value;\n }\n\n const selectedValues = this.multiple\n ? this.value.split(',').map(v => v.trim())\n : [this.value];\n\n const options = this.selectElement.options;\n\n if (options) {\n Array.from(options).forEach(option => {\n option.selected = this.multiple\n ? selectedValues.includes(option.value)\n : option.value === selectedValues[0];\n });\n } else {\n // Handle case where there are no options\n this.selectElement.value = selectedValues[0] || '';\n }\n }\n\n // Set the initial form value\n this.setFormValue();\n }\n\n //#endregion LIFECYCLE\n /****************************************************************************/\n //#region RENDERING\n\n /**\n * The render method creates the HTML structure for the component, including\n * the label, select element, and any error or description messages. It also\n * applies the appropriate CSS classes based on the readonly state and\n * displayValue prop. This method is called when the component is rendered.\n * @returns {HTMLStencilElement} The HTML element to render.\n */\n render() {\n return (\n <Host>\n {(this.label || this.el.querySelector('[slot=\"label\"]')) && (\n <label htmlFor={this.inputId}>\n <slot name=\"label\">{this.label}</slot>\n </label>\n )}\n\n <div class=\"select-wrapper\">\n <slot name=\"before-input\"></slot>\n\n <div\n class=\"select-container\"\n onClick={this.handleSelectContainerClick}\n >\n <slot name=\"leading-input\"></slot>\n\n {this.internalReadonly && (\n <input\n id={this.inputId + '-readonly'}\n type=\"text\"\n value={this.computedDisplayValue}\n readonly\n class=\"readonly-input\"\n aria-readonly=\"true\"\n aria-label={this.label}\n aria-describedby={\n this.error\n ? `${this.inputId}-error`\n : `${this.inputId}-description`\n }\n />\n )}\n\n <select\n id={this.inputId}\n ref={el => (this.selectElement = el)}\n name={this.name}\n autofocus={this.autofocus}\n disabled={this.disabled}\n required={this.required}\n multiple={this.multiple}\n onChange={this.handleSelectChange}\n class={this.internalReadonly ? 'hidden' : ''}\n aria-label={this.label}\n aria-describedby={\n this.error\n ? `${this.inputId}-error`\n : `${this.inputId}-description`\n }\n >\n {this.parsedOptions.length > 0 ? (\n this.parsedOptions.map(option => (\n <option\n value={option.value}\n selected={option.selected}\n disabled={option.disabled}\n >\n {option.label}\n </option>\n ))\n ) : (\n <slot />\n )}\n </select>\n <div class=\"select-icons\">\n {this.error && (\n <nv-icon name=\"alert-circle\" class=\"validation\" size=\"md\" />\n )}\n {this.success && (\n <nv-icon name=\"circle-check\" class=\"validation\" size=\"md\" />\n )}\n\n {!this.multiple && (\n <nv-iconbutton\n name=\"chevron-down\"\n size=\"md\"\n emphasis=\"lower\"\n tabindex={-1}\n />\n )}\n </div>\n </div>\n\n <slot name=\"after-input\"></slot>\n </div>\n\n {(this.description ||\n this.el.querySelector('[slot=\"description\"]')) && (\n <div class=\"description\" id={`${this.inputId}-description`}>\n <slot name=\"description\">{this.description}</slot>\n </div>\n )}\n\n {(this.errorDescription ||\n this.el.querySelector('[slot=\"error-description\"]')) && (\n <div class=\"error-description\" id={`${this.inputId}-error`}>\n <slot name=\"error-description\">{this.errorDescription}</slot>\n </div>\n )}\n </Host>\n );\n }\n\n //#endregion RENDERING\n}\n"]}
|
|
1
|
+
{"version":3,"file":"nv-fieldselect.js","sourceRoot":"","sources":["../../../src/components/nv-fieldselect/nv-fieldselect.tsx"],"names":[],"mapp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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGF","sourcesContent":["import {\n Component,\n Host,\n h,\n Prop,\n Event,\n EventEmitter,\n Watch,\n Element,\n State,\n} from '@stencil/core';\nimport { v4 as uuidv4 } from 'uuid';\n\n/**\n * @slot default - Content to be placed inside the select element.\n * @slot leading-input - Content to be placed before the select input, within the select container.\n * @slot before-input - Content to be placed before the select input, outside the select container.\n * @slot after-input - Content to be placed after the select input, outside the select container.\n * @slot label - Content to be placed as the label, will override the label prop.\n * @slot description - Content to be placed as the description, will override the description prop.\n * @slot error-description - Content to be placed as the error description, will override the errorDescription prop.\n */\n@Component({\n tag: 'nv-fieldselect',\n shadow: false,\n formAssociated: true,\n styleUrl: 'nv-fieldselect.scss',\n})\nexport class NvFieldselect {\n @Element() el: HTMLNvFieldselectElement;\n private selectElement!: HTMLSelectElement;\n private internals: ElementInternals;\n\n /****************************************************************************/\n //#region DEPRECATED\n\n /**\n * Message defines a 'hint ' message for the Select Field.\n * @deprecated Use `description` instead.\n */\n @Prop({ reflect: true })\n readonly message: string;\n\n /**\n * Add the message to the validation state.\n * @deprecated Use `errorDescription` and set the error prop instead.\n */\n @Prop({ reflect: true })\n readonly validation: string;\n\n //#endregion DEPRECATED\n /****************************************************************************/\n //#region STATES\n\n @State()\n private computedDisplayValue: string = '';\n\n @State()\n private internalReadonly: boolean = false;\n\n /**\n * Options to display in the select.\n * Format: [{ label: string, value: string, selected?: boolean, disabled?: boolean }]\n */\n @Prop({ reflect: false })\n readonly options?: Array<{\n /**\n * The label of the option\n */\n label: string;\n /**\n * The value of the option\n */\n value: string;\n /**\n * Whether the option is selected\n */\n selected?: boolean;\n /**\n * Whether the option is disabled\n */\n disabled?: boolean;\n }>;\n\n //#endregion STATES\n /****************************************************************************/\n //#region PROPERTIES\n\n /**\n * Sets the ID for the select element and the for attribute of the associated\n * label. If no ID is provided, a random one will be automatically generated\n * to ensure unique identification, facilitating proper label association and\n * accessibility.\n */\n @Prop({ reflect: true })\n readonly inputId: string = uuidv4();\n\n /**\n * Lets you define the text that explains what users should choose in the\n * select field. It’s a crucial element for making forms clear and\n * user-friendly.\n */\n @Prop({ reflect: true })\n readonly label?: string;\n\n /**\n * Add helpful hints or extra information under the select field. This is\n * where you can clarify what users should choose or provide additional\n * instructions, making the form easier to fill out correctly.\n */\n @Prop({ reflect: true, mutable: true })\n description?: string;\n\n /**\n * Defines the name attribute of the select field, which is crucial for form\n * submission. This value is used as the key in the key-value pair sent to\n * the server, representing the selected data in form submissions. It should be\n * unique within the form to avoid conflicts\n */\n @Prop({ reflect: true })\n readonly name: string;\n\n /**\n * The disabled prop lets you turn off the select field so that users can’t\n * choose something. When disabled, the field is grayed out and won’t respond to\n * clicks or touches.\n */\n @Prop({ reflect: true })\n readonly disabled: boolean = false;\n\n /**\n * Display the select field’s content without allowing users to change it.\n * Users can still click on it, select, and copy the text, but they won’t be\n * able to change or delete anything.\n */\n @Prop({ reflect: true })\n readonly readonly: boolean = false;\n\n /**\n * Marks the select field as required, ensuring that the user must fill it out\n * before submitting the form.\n */\n @Prop({ reflect: true })\n readonly required: boolean = false;\n\n /**\n * Alters the select field’s appearance to indicate an error, helping users\n * identify fields that need correction.\n * @validator error\n */\n @Prop({ reflect: true, mutable: true })\n error: boolean = false;\n\n /**\n * Show a helpful message under the select field when there’s a problem. It\n * explains what’s wrong and how users can fix it, making the error easier to\n * understand and resolve.\n * @validator message\n */\n @Prop({ reflect: true, mutable: true })\n errorDescription: string;\n\n /**\n * Changes the select field’s appearance to indicate successful input or\n * validation.\n */\n @Prop({ reflect: true })\n readonly success: boolean = false;\n\n /**\n * When enabled, allows the select to handle multiple selections.\n */\n @Prop({ reflect: true })\n readonly multiple: boolean = false;\n\n /**\n * The value of the select field.\n * - If `multiple` is `false`, it's a single string.\n * - If `multiple` is `true`, it's a comma-separated string of selected values.\n */\n @Prop({ reflect: true, mutable: true })\n value: string = '';\n\n /**\n * When enabled, displays the value element instead of the label when readonly.\n * By default, the label is displayed in readonly mode. Also it automatically\n * sets the component to readonly.\n */\n @Prop({ reflect: true })\n readonly displayValue: boolean = false;\n\n /**\n * Applies focus to the input field as soon as the component is mounted. This\n * is equivalent to setting the native autofocus attribute on a <select>\n * element.\n */\n @Prop({ reflect: true })\n // eslint-disable-next-line @stencil-community/reserved-member-names\n readonly autofocus: boolean = false;\n\n /**\n * Allows the field to stretch and fill the entire width of its container.\n */\n @Prop({ reflect: true })\n readonly fluid: boolean = false;\n\n //#endregion PROPERTIES\n /****************************************************************************/\n //#region EVENTS\n\n /**\n * Emitted when the selected value changes.\n * @bind value\n */\n @Event()\n valueChanged: EventEmitter<string>; // Emit as a string\n\n //#endregion EVENTS\n /****************************************************************************/\n //#region WATCHERS\n\n /**\n * Updates the display value when the value property changes. This watcher is\n * used to update the display value when the selected value changes. This is\n * necessary for readonly select fields to display the selected value.\n * @internal This watcher is not intended to be called outside of the component.\n * @param {string} newValue - The new value of the select field.\n */\n @Watch('value')\n updateDisplayValueWatcher(newValue: string) {\n this.updateDisplayValue();\n\n if (this.selectElement) {\n const selectedValues = newValue.split(',').map(val => val.trim());\n const options = this.selectElement.options;\n\n if (options) {\n Array.from(options).forEach(option => {\n option.selected = this.multiple\n ? selectedValues.includes(option.value)\n : option.value === selectedValues[0];\n });\n\n if (!this.multiple) {\n this.selectElement.value = newValue; // Only set when not multiple\n }\n } else {\n this.selectElement.value = selectedValues[0] || '';\n }\n }\n\n // Update form value\n this.setFormValue();\n }\n\n /**\n * Watcher for the displayValue prop to ensure internalReadonly is true when displayValue is true.\n * @param {boolean} newValue - The new value of displayValue.\n */\n @Watch('displayValue')\n handleDisplayValueChange(newValue: boolean) {\n this.internalReadonly = newValue; // Set internalReadonly to true if displayValue is true\n\n if (this.readonly) {\n this.internalReadonly = true;\n }\n }\n\n /**\n * Watcher for the readonly prop to ensure internalReadonly is true when readonly is true.\n * @param {boolean} newValue - The new value of readonly.\n */\n @Watch('readonly')\n handleReadonlyChange(newValue: boolean) {\n this.internalReadonly = newValue; // Set internalReadonly to true if displayValue is true\n\n if (this.displayValue) {\n this.internalReadonly = true;\n }\n }\n\n /**\n * Handle options change and update the internal state\n * @param {typeof this.options} newValue - The new value of options\n */\n @Watch('options')\n handleOptionsChange(newValue: typeof this.options) {\n if (!newValue) return;\n\n // Update the value if an option is pre-selected\n const selectedOption = newValue.find(opt => opt.selected);\n if (selectedOption) {\n this.value = selectedOption.value;\n }\n }\n\n //#endregion WATCHERS\n /****************************************************************************/\n //#region METHODS\n\n /**\n * Handles the change event on the select element. This method is used to\n * update the value property when the selected options change. It is also\n * used to emit the selectChanged event when the selected value changes.\n * @param {Event} event - The change event on the select element.\n * @emits selectChanged\n */\n private readonly handleSelectChange = (event: Event) => {\n const select = event.target as HTMLSelectElement;\n let selectedValues: string[] = Array.from(select.selectedOptions).map(\n option => option.value,\n );\n\n if (!this.multiple) {\n selectedValues = selectedValues.slice(0, 1);\n }\n\n this.value = this.multiple\n ? selectedValues.join(', ')\n : selectedValues[0] || '';\n this.valueChanged.emit(this.value);\n\n // Update form value\n this.setFormValue();\n };\n\n /**\n * Handles focus when the select container is clicked.\n */\n private readonly handleSelectContainerClick = () => {\n if (!this.internalReadonly && this.selectElement) {\n this.selectElement.focus();\n }\n };\n\n /**\n * Updates the display value of the select field. This method is used to\n * update the display value when the selected value changes. This is necessary\n * for readonly select fields to display the selected value. This method is\n * called in the componentDidLoad lifecycle hook and the updateDisplayValueWatcher\n * watcher.\n * @internal This method is not intended to be called outside of the component.\n */\n private updateDisplayValue(): void {\n if (this.internalReadonly && !this.displayValue) {\n if (this.multiple) {\n const selectedLabels = this.value\n .split(',')\n .map(key => key.trim())\n .map(key => this.getLabelFromId(key) || '')\n .filter(label => label !== '');\n this.computedDisplayValue = selectedLabels.join(', ') || '';\n } else {\n this.computedDisplayValue = this.getLabelFromId(this.value) || '';\n }\n } else if (this.internalReadonly && this.displayValue) {\n this.computedDisplayValue = this.value || '';\n }\n }\n\n /**\n * Retrieves the label from the <option> elements based on the provided key (value).\n * This method uses the id or value attribute directly from the <select> options.\n * @param {string} key - The key (value) for which to find the corresponding label.\n * @returns {string} The label if found; otherwise, an empty string.\n */\n private getLabelFromId(key: string): string {\n this.ensureSelectElement();\n if (!this.selectElement) {\n return '';\n }\n\n // Cache the option list\n const options = this.selectElement.options;\n\n if (options) {\n const option = Array.from(options).find(option => option.value === key);\n return option ? option.textContent.trim() || '' : '';\n } else {\n return '';\n }\n }\n\n /**\n * Sets the value of the form element for form submission. This method is\n * called when the selected value changes or when the value property is set.\n * @internal This method is not intended to be called outside of the component.\n */\n private setFormValue(): void {\n this.internals.setFormValue(this.value);\n }\n\n /**\n * Ensures the select element is available. This method is used to ensure\n * the select element is available before attempting to access it.\n * @internal This method is not intended to be called outside of the component.\n */\n private ensureSelectElement(): void {\n if (!this.selectElement) {\n this.selectElement = this.el.querySelector('select') as HTMLSelectElement;\n }\n }\n\n //#endregion METHODS\n /****************************************************************************/\n //#region LIFECYCLE\n\n componentWillRender() {\n this.updateDisplayValue(); // Ensure display value is updated before render\n\n if (this.message) {\n this.description = this.message;\n }\n\n if (this.validation) {\n this.errorDescription = this.validation;\n this.error = true;\n }\n }\n\n /**\n * Lifecycle method that is called before the component is rendered. This is\n * where the internal state is set up before rendering occurs.\n */\n componentWillLoad() {\n // Set internalReadonly based on the readonly prop\n this.internalReadonly = this.readonly;\n\n // Ensure internalReadonly is true if displayValue is true during loading\n if (this.displayValue) {\n this.internalReadonly = true;\n }\n\n if ('attachInternals' in this.el) {\n this.internals = (\n this.el as HTMLElement & {\n /**\n * Attach the element to the form internals.\n * @returns {ElementInternals} - The element internals object.\n */\n attachInternals: () => ElementInternals;\n }\n ).attachInternals();\n } else {\n // Fallback logic for browsers without attachInternals support\n this.internals = {\n setFormValue: (value: string) => {\n const formElement = this.el.closest('form');\n if (formElement) {\n const input = document.createElement('input');\n input.type = 'hidden';\n input.name = this.name;\n input.value = value;\n formElement.appendChild(input);\n }\n },\n } as ElementInternals;\n }\n\n // Initialize value as an empty string if multiple is true\n if (this.multiple && typeof this.value !== 'string') {\n this.value = '';\n }\n\n // Parse initial options if present\n if (this.options) {\n this.handleOptionsChange(this.options);\n }\n }\n\n /**\n * Lifecycle method that is called after the component has been rendered.\n * This is where the display value is updated and the initial select element's\n * state is set.\n */\n componentDidLoad() {\n this.updateDisplayValue();\n\n if (this.selectElement) {\n // Only set the value for single selection, skip for multiple\n if (!this.multiple) {\n this.selectElement.value = this.value;\n }\n\n const selectedValues = this.multiple\n ? this.value.split(',').map(v => v.trim())\n : [this.value];\n\n const options = this.selectElement.options;\n\n if (options) {\n Array.from(options).forEach(option => {\n option.selected = this.multiple\n ? selectedValues.includes(option.value)\n : option.value === selectedValues[0];\n });\n } else {\n // Handle case where there are no options\n this.selectElement.value = selectedValues[0] || '';\n }\n }\n\n // Set the initial form value\n this.setFormValue();\n }\n\n //#endregion LIFECYCLE\n /****************************************************************************/\n //#region RENDERING\n\n /**\n * The render method creates the HTML structure for the component, including\n * the label, select element, and any error or description messages. It also\n * applies the appropriate CSS classes based on the readonly state and\n * displayValue prop. This method is called when the component is rendered.\n * @returns {HTMLStencilElement} The HTML element to render.\n */\n render() {\n return (\n <Host>\n {(this.label || this.el.querySelector('[slot=\"label\"]')) && (\n <label htmlFor={this.inputId}>\n <slot name=\"label\">{this.label}</slot>\n </label>\n )}\n\n <div class=\"select-wrapper\">\n <slot name=\"before-input\"></slot>\n\n <div\n class=\"select-container\"\n onClick={this.handleSelectContainerClick}\n >\n <slot name=\"leading-input\"></slot>\n\n {this.internalReadonly && (\n <input\n id={this.inputId + '-readonly'}\n type=\"text\"\n value={this.computedDisplayValue}\n readonly\n class=\"readonly-input\"\n aria-readonly=\"true\"\n aria-label={this.label}\n aria-describedby={\n this.error\n ? `${this.inputId}-error`\n : `${this.inputId}-description`\n }\n />\n )}\n\n <select\n id={this.inputId}\n ref={el => (this.selectElement = el)}\n name={this.name}\n autofocus={this.autofocus}\n disabled={this.disabled}\n required={this.required}\n multiple={this.multiple}\n onChange={this.handleSelectChange}\n class={this.internalReadonly ? 'hidden' : ''}\n aria-label={this.label}\n aria-describedby={\n this.error\n ? `${this.inputId}-error`\n : `${this.inputId}-description`\n }\n >\n {this.options && this.options.length > 0 ? (\n this.options.map(option => (\n <option\n value={option.value}\n selected={option.selected}\n disabled={option.disabled}\n >\n {option.label}\n </option>\n ))\n ) : (\n <slot />\n )}\n </select>\n <div class=\"select-icons\">\n {this.error && (\n <nv-icon name=\"alert-circle\" class=\"validation\" size=\"md\" />\n )}\n {this.success && (\n <nv-icon name=\"circle-check\" class=\"validation\" size=\"md\" />\n )}\n\n {!this.multiple && (\n <nv-iconbutton\n name=\"chevron-down\"\n size=\"md\"\n emphasis=\"lower\"\n tabindex={-1}\n />\n )}\n </div>\n </div>\n\n <slot name=\"after-input\"></slot>\n </div>\n\n {(this.description ||\n this.el.querySelector('[slot=\"description\"]')) && (\n <div class=\"description\" id={`${this.inputId}-description`}>\n <slot name=\"description\">{this.description}</slot>\n </div>\n )}\n\n {(this.errorDescription ||\n this.el.querySelector('[slot=\"error-description\"]')) && (\n <div class=\"error-description\" id={`${this.inputId}-error`}>\n <slot name=\"error-description\">{this.errorDescription}</slot>\n </div>\n )}\n </Host>\n );\n }\n\n //#endregion RENDERING\n}\n"]}
|
|
@@ -48,7 +48,7 @@ export class NvIcon {
|
|
|
48
48
|
/****************************************************************************/
|
|
49
49
|
//#region RENDER
|
|
50
50
|
render() {
|
|
51
|
-
return (h(Host, { key: '8cb4ada2454c7e9676cd088397eb4416ccab2d82', class: clsx(this.color && `${this.color}`), role: "img", "aria-label": `${this.name}-icon` }, h("svg", { key: '4934c79fa096935be509ff6a641361dac44a4a9f', stroke: "currentColor", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", class: `nv-icon-${this.size}` }, h("use", { key: '
|
|
51
|
+
return (h(Host, { key: '8cb4ada2454c7e9676cd088397eb4416ccab2d82', class: clsx(this.color && `${this.color}`), role: "img", "aria-label": `${this.name}-icon` }, h("svg", { key: '4934c79fa096935be509ff6a641361dac44a4a9f', stroke: "currentColor", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", class: `nv-icon-${this.size}` }, h("use", { key: 'fd1463bd985a473937d6d3035edf83a8d5baf92d', href: `#nvicon_${this.name}` }))));
|
|
52
52
|
}
|
|
53
53
|
static get is() { return "nv-icon"; }
|
|
54
54
|
static get originalStyleUrls() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nv-icon.js","sourceRoot":"","sources":["../../../src/components/nv-icon/nv-icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,UAAU,MAAM,4DAA4D,CAAC;AAGpF,OAAO,EAAE,aAAa,EAA4B,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAOxD,MAAM,OAAO,MAAM;IALnB;QA0FE;;WAEG;QAEH,SAAI,GAAuB,IAAI,CAAC;KAiCjC;IAzHC;;OAEG;IACK,MAAM,CAAC,mBAAmB;QAChC,IAAI,CAAC,QAAQ;YAAE,OAAO,CAAC,iCAAiC;QAExD,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,gBAAgB,CAAC,EAAE,CAAC;YAC/C,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CA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op } from '@stencil/core';\nimport clsx from 'clsx';\n\nimport iconSprite from '@nova-design-system/nova-base/assets/icons/icon-sprite.svg';\n\nimport { IconName } from './nv-icons';\nimport { SemanticSizes, DeprecatedSemanticColors } from '../../utils/constants';\nimport { dataURIToString } from '../../utils/uri.utils';\n\n@Component({\n tag: 'nv-icon',\n styleUrl: 'styles/nv-icon.scss',\n shadow: false,\n})\nexport class NvIcon {\n /**\n * Ensures the icon sprite is loaded into the document.\n */\n private static ensureSpriteInlined(): void {\n if (!document) return; // SSR & node env fallback safety\n\n if (!document.getElementById('nv-icon-sprite')) {\n const container = document.createElement('div');\n container.id = 'nv-icon-sprite';\n container.style.display = 'none';\n container.innerHTML = dataURIToString(iconSprite);\n document.body.appendChild(container);\n }\n }\n\n /****************************************************************************/\n //#region DEPRECATED\n\n /**\n * Set size to ExtraSmall.\n * @deprecated use size instead.\n */\n @Prop({ reflect: true })\n readonly xsmall: boolean;\n /**\n * Set size to Small.\n * @deprecated use size instead.\n */\n @Prop({ reflect: true })\n readonly small: boolean;\n /**\n * Set size to Medium.\n * @deprecated use size instead.\n */\n @Prop({ reflect: true })\n readonly medium: boolean;\n /**\n * Set size to Large.\n * @deprecated use size instead.\n */\n @Prop({ reflect: true })\n readonly large: boolean;\n /**\n * Set size to ExtraLarge.\n * @deprecated use size instead.\n */\n @Prop({ reflect: true })\n readonly xlarge: boolean;\n /**\n * Set color of the icon.\n * @deprecated use class names instead.\n */\n @Prop({ reflect: true })\n readonly color: `${DeprecatedSemanticColors}`;\n\n componentWillRender() {\n if (this.xsmall) {\n this.size = SemanticSizes.ExtraSmall;\n }\n if (this.small) {\n this.size = SemanticSizes.Small;\n }\n if (this.medium) {\n this.size = SemanticSizes.Medium;\n }\n if (this.large) {\n this.size = SemanticSizes.Large;\n }\n if (this.xlarge) {\n this.size = SemanticSizes.ExtraLarge;\n }\n }\n\n //#endregion DEPRECATED\n /****************************************************************************/\n //#region PROPERTIES\n\n /**\n * Choose the icon you want to display. This also sets the aria-label for\n * improved accessibility, helping users who rely on screen readers.\n */\n @Prop({ reflect: true })\n readonly name: `${IconName}` | string;\n\n /**\n * Adjust the size of the icon to fit your design needs.\n */\n @Prop({ mutable: true, reflect: true })\n size: `${SemanticSizes}` = 'md';\n\n componentWillLoad() {\n NvIcon.ensureSpriteInlined();\n }\n\n //#endregion PROPERTIES\n /****************************************************************************/\n //#region RENDER\n\n render() {\n return (\n <Host\n class={clsx(this.color && `${this.color}`)}\n role=\"img\"\n aria-label={`${this.name}-icon`}\n >\n <svg\n stroke=\"currentColor\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n class={`nv-icon-${this.size}`}\n >\n <use href={`#nvicon_${this.name}`} />\n </svg>\n </Host>\n );\n }\n\n //#endregion RENDER\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as NvAccordionItem$1, d as defineCustomElement$1 } from './p-
|
|
1
|
+
import { N as NvAccordionItem$1, d as defineCustomElement$1 } from './p-79e6b6a2.js';
|
|
2
2
|
|
|
3
3
|
const NvAccordionItem = NvAccordionItem$1;
|
|
4
4
|
const defineCustomElement = defineCustomElement$1;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, c as createEvent, h, d as Host } from './p-aff3ed68.js';
|
|
2
|
-
import { d as defineCustomElement$5 } from './p-
|
|
3
|
-
import { d as defineCustomElement$4 } from './p-
|
|
4
|
-
import { d as defineCustomElement$3 } from './p-
|
|
2
|
+
import { d as defineCustomElement$5 } from './p-79e6b6a2.js';
|
|
3
|
+
import { d as defineCustomElement$4 } from './p-6460318d.js';
|
|
4
|
+
import { d as defineCustomElement$3 } from './p-025b8a78.js';
|
|
5
5
|
import { d as defineCustomElement$2 } from './p-dfd2d4f0.js';
|
|
6
6
|
|
|
7
7
|
const nvAccordionCss = "nv-accordion{display:block;border:var(--spacing-px) solid var(--color-content-low-border);border-radius:var(--radius-rounded-lg)}nv-accordion .nv-accordion__footer{padding:var(--spacing-3);background:var(--color-level-05-background);border-radius:0 0 var(--radius-rounded-lg) var(--radius-rounded-lg);margin-top:calc(var(--spacing-px) * -1);border-top:var(--spacing-px) solid var(--color-content-low-border)}nv-accordion .nv-accordion__footer:empty{display:none}";
|
|
@@ -5,7 +5,7 @@ import { u as useCollapse } from './p-9a263d0e.js';
|
|
|
5
5
|
import { u as useFade } from './p-1cbacdba.js';
|
|
6
6
|
import './p-09cdd71f.js';
|
|
7
7
|
import { t as timeline } from './p-15aeab4d.js';
|
|
8
|
-
import { d as defineCustomElement$2 } from './p-
|
|
8
|
+
import { d as defineCustomElement$2 } from './p-6460318d.js';
|
|
9
9
|
|
|
10
10
|
const nvAlertCss = "nv-alert{display:flex !important;align-items:flex-start;position:relative;gap:var(--alert-gap-x);border-radius:var(--alert-radius);font-family:\"TT Norms Pro\", \"Montserrat\", sans-serif}nv-alert>nv-icon{margin-left:var(--alert-icon-position-x);margin-top:var(--alert-icon-position-y)}nv-alert.hidden{display:none !important}nv-alert.feedback-information{background-color:var(--components-alert-information-background);border:1px solid var(--components-alert-information-border) !important}nv-alert.feedback-information>.close:focus,nv-alert.feedback-information>.close:focus-within{outline:none}nv-alert.feedback-information>.close:focus-visible,nv-alert.feedback-information>.close:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-alert-information-border);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-alert.feedback-warning{background-color:var(--components-alert-warning-background);border:1px solid var(--components-alert-warning-border) !important}nv-alert.feedback-warning>.close:focus,nv-alert.feedback-warning>.close:focus-within{outline:none}nv-alert.feedback-warning>.close:focus-visible,nv-alert.feedback-warning>.close:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-alert-warning-border);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-alert.feedback-error{background-color:var(--components-alert-error-background);border:1px solid var(--components-alert-error-border) !important}nv-alert.feedback-error>.close:focus,nv-alert.feedback-error>.close:focus-within{outline:none}nv-alert.feedback-error>.close:focus-visible,nv-alert.feedback-error>.close:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-alert-error-border);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-alert.feedback-success{background-color:var(--components-alert-success-background);border:1px solid var(--components-alert-success-border) !important}nv-alert.feedback-success>.close:focus,nv-alert.feedback-success>.close:focus-within{outline:none}nv-alert.feedback-success>.close:focus-visible,nv-alert.feedback-success>.close:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-alert-success-border);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-alert.feedback-neutral{background-color:var(--components-alert-neutral-background);border:1px solid var(--components-alert-neutral-border) !important}nv-alert.feedback-neutral>.close:focus,nv-alert.feedback-neutral>.close:focus-within{outline:none}nv-alert.feedback-neutral>.close:focus-visible,nv-alert.feedback-neutral>.close:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-alert-neutral-border);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-alert>nv-icon.icon-information{color:var(--components-alert-information-icon)}nv-alert>nv-icon.icon-warning{color:var(--components-alert-warning-icon)}nv-alert>nv-icon.icon-error{color:var(--components-alert-error-icon)}nv-alert>nv-icon.icon-success{color:var(--components-alert-success-icon)}nv-alert>nv-icon.icon-neutral{color:var(--components-alert-neutral-icon)}nv-alert>.content{display:flex;padding:var(--alert-padding);padding-left:0;flex-direction:column;gap:var(--alert-gap-y)}nv-alert>.content>.heading{color:var(--components-alert-content-title);font-size:var(--alert-heading-font-size);line-height:var(--alert-heading-line-height);font-weight:var(--alert-heading-font-weight)}nv-alert>.content>.message{color:var(--components-alert-content-description);font-size:var(--alert-message-font-size);line-height:var(--alert-message-line-height)}nv-alert>.close{border-radius:var(--alert-radius);position:absolute;display:flex;top:var(--alert-icon-position-y);right:var(--alert-icon-position-x);padding:0;border:none;background:none;cursor:pointer}";
|
|
11
11
|
const NvAlertStyle0 = nvAlertCss;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, h, d as Host } from './p-aff3ed68.js';
|
|
2
2
|
import { c as clsx } from './p-8a1a6e56.js';
|
|
3
3
|
import { S as SemanticSizes } from './p-1f505531.js';
|
|
4
|
-
import { d as defineCustomElement$2 } from './p-
|
|
4
|
+
import { d as defineCustomElement$2 } from './p-6460318d.js';
|
|
5
5
|
|
|
6
6
|
const nvAvatarCss = "nv-avatar{align-items:center !important;background-color:var(--components-avatar-background-1);border-radius:var(--radius-rounded-full) !important;display:flex !important;flex-shrink:0 !important;font-family:\"TT Norms Pro\", sans-serif;font-style:normal;font-weight:var(--font-weight-medium-emphasis);justify-content:center !important;leading-trim:both;line-height:1 !important;text-align:center;text-edge:cap;text-transform:uppercase}nv-avatar.avatar-color-1{background-color:var(--components-avatar-background-1);color:var(--components-avatar-content-1)}nv-avatar.avatar-color-2{background-color:var(--components-avatar-background-2);color:var(--components-avatar-content-2)}nv-avatar.avatar-color-3{background-color:var(--components-avatar-background-3);color:var(--components-avatar-content-3)}nv-avatar.avatar-color-4{background-color:var(--components-avatar-background-4);color:var(--components-avatar-content-4)}nv-avatar.avatar-color-5{background-color:var(--components-avatar-background-5);color:var(--components-avatar-content-5)}nv-avatar.avatar-color-6{background-color:var(--components-avatar-background-6);color:var(--components-avatar-content-6)}nv-avatar.avatar-color-7{background-color:var(--components-avatar-background-7);color:var(--components-avatar-content-7)}nv-avatar.avatar-color-8{background-color:var(--components-avatar-background-8);color:var(--components-avatar-content-8)}nv-avatar.avatar-color-9{background-color:var(--components-avatar-background-9);color:var(--components-avatar-content-9)}nv-avatar.avatar-color-10{background-color:var(--components-avatar-background-10);color:var(--components-avatar-content-10)}nv-avatar img{height:100%;width:100%;object-fit:cover;object-position:center;border-radius:50%}nv-avatar.avatar-xs{width:var(--avatar-xs-size);height:var(--avatar-xs-size);font-size:var(--avatar-xs-font-size);line-height:var(--avatar-xs-font-size)}nv-avatar.avatar-xs nv-icon>svg{width:var(--spacing-3);height:var(--spacing-3);stroke-width:1.2px}nv-avatar.avatar-sm{width:var(--avatar-sm-size);height:var(--avatar-sm-size);font-size:var(--avatar-sm-font-size);line-height:var(--avatar-sm-font-size)}nv-avatar.avatar-sm nv-icon>svg{width:var(--spacing-4);height:var(--spacing-4);stroke-width:1.5px}nv-avatar.avatar-md{width:var(--avatar-md-size);height:var(--avatar-md-size);font-size:var(--avatar-md-font-size);line-height:var(--avatar-md-font-size)}nv-avatar.avatar-md nv-icon>svg{width:var(--spacing-5);height:var(--spacing-5);stroke-width:1.6px}nv-avatar.avatar-lg{width:var(--avatar-lg-size);height:var(--avatar-lg-size);font-size:var(--avatar-lg-font-size);line-height:var(--avatar-lg-font-size)}nv-avatar.avatar-lg nv-icon>svg{width:var(--spacing-6);height:var(--spacing-6);stroke-width:1.8px}nv-avatar.avatar-xl{width:var(--avatar-xl-size);height:var(--avatar-xl-size);font-size:var(--avatar-xl-font-size);line-height:var(--avatar-xl-font-size)}nv-avatar.avatar-xl nv-icon>svg{width:var(--spacing-7);height:var(--spacing-7);stroke-width:1.9px}";
|
|
7
7
|
const NvAvatarStyle0 = nvAvatarCss;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, c as createEvent, h, d as Host } from './p-aff3ed68.js';
|
|
2
2
|
import { d as deepCopyElement, e as excludedProps } from './p-cb34aa4f.js';
|
|
3
3
|
import { d as SortingPossibility } from './p-1f505531.js';
|
|
4
|
-
import { d as defineCustomElement$3 } from './p-
|
|
5
|
-
import { d as defineCustomElement$2 } from './p-
|
|
4
|
+
import { d as defineCustomElement$3 } from './p-68ff562f.js';
|
|
5
|
+
import { d as defineCustomElement$2 } from './p-6460318d.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* table-core
|
|
@@ -3,9 +3,9 @@ import { a as addEventListeners, r as removeEventListeners } from './p-d429a343.
|
|
|
3
3
|
import { c as clsx } from './p-8a1a6e56.js';
|
|
4
4
|
import { B as ButtonType } from './p-1f505531.js';
|
|
5
5
|
import { d as defineCustomElement$6 } from './p-5d5668f0.js';
|
|
6
|
-
import { d as defineCustomElement$5 } from './p-
|
|
7
|
-
import { d as defineCustomElement$4 } from './p-
|
|
8
|
-
import { d as defineCustomElement$3 } from './p-
|
|
6
|
+
import { d as defineCustomElement$5 } from './p-6de6866c.js';
|
|
7
|
+
import { d as defineCustomElement$4 } from './p-ed6686a1.js';
|
|
8
|
+
import { d as defineCustomElement$3 } from './p-6460318d.js';
|
|
9
9
|
import { d as defineCustomElement$2 } from './p-dfd2d4f0.js';
|
|
10
10
|
import { v as v4 } from './p-f5ff676c.js';
|
|
11
11
|
|
|
@@ -566,7 +566,8 @@ const NvDialog$1 = /*@__PURE__*/ proxyCustomElement(class NvDialog extends H {
|
|
|
566
566
|
*/
|
|
567
567
|
this.clickOutside = false;
|
|
568
568
|
/**
|
|
569
|
-
* If true, the dialog visibility is managed manually through methods or the
|
|
569
|
+
* If true, the dialog visibility is managed manually through methods or the
|
|
570
|
+
* open prop.
|
|
570
571
|
*/
|
|
571
572
|
this.controlled = false;
|
|
572
573
|
/**
|
|
@@ -574,22 +575,11 @@ const NvDialog$1 = /*@__PURE__*/ proxyCustomElement(class NvDialog extends H {
|
|
|
574
575
|
*/
|
|
575
576
|
this.full = false;
|
|
576
577
|
/**
|
|
577
|
-
* Controls whether the dialog should automatically focus the first focusable
|
|
578
|
-
* When disabled, prevents unwanted tooltip triggers on
|
|
578
|
+
* Controls whether the dialog should automatically focus the first focusable
|
|
579
|
+
* element when opened. When disabled, prevents unwanted tooltip triggers on
|
|
580
|
+
* dialog open.
|
|
579
581
|
*/
|
|
580
582
|
this.autofocus = false;
|
|
581
|
-
/**
|
|
582
|
-
* Handles the close button click.
|
|
583
|
-
*/
|
|
584
|
-
this.handleCloseButton = () => {
|
|
585
|
-
this.close();
|
|
586
|
-
};
|
|
587
|
-
/**
|
|
588
|
-
* Handles the cancel button click.
|
|
589
|
-
*/
|
|
590
|
-
this.handleCancelButton = () => {
|
|
591
|
-
this.close();
|
|
592
|
-
};
|
|
593
583
|
/**
|
|
594
584
|
* Checks for and sets up form ID if a form is present
|
|
595
585
|
*/
|
|
@@ -618,7 +608,6 @@ const NvDialog$1 = /*@__PURE__*/ proxyCustomElement(class NvDialog extends H {
|
|
|
618
608
|
};
|
|
619
609
|
this.triggerClickEvents = [
|
|
620
610
|
['click', this.show],
|
|
621
|
-
['touchstart', this.show],
|
|
622
611
|
[
|
|
623
612
|
'keydown',
|
|
624
613
|
(e) => {
|
|
@@ -639,9 +628,10 @@ const NvDialog$1 = /*@__PURE__*/ proxyCustomElement(class NvDialog extends H {
|
|
|
639
628
|
async show() {
|
|
640
629
|
this.open = true;
|
|
641
630
|
this.preventScroll();
|
|
642
|
-
|
|
631
|
+
/** It is recommended to use the .show() or .showModal() method to render
|
|
632
|
+
* dialogs, rather than the open attribute. If a <dialog> is opened using
|
|
633
|
+
* the open attribute, it is non-modal. */
|
|
643
634
|
this.dialogElement.showModal();
|
|
644
|
-
this.openChanged.emit(this.open);
|
|
645
635
|
}
|
|
646
636
|
/**
|
|
647
637
|
* Call this method to hide the dialog, making it disappear from view.
|
|
@@ -650,7 +640,6 @@ const NvDialog$1 = /*@__PURE__*/ proxyCustomElement(class NvDialog extends H {
|
|
|
650
640
|
this.open = false;
|
|
651
641
|
this.allowScroll();
|
|
652
642
|
this.dialogElement.close();
|
|
653
|
-
this.openChanged.emit(this.open);
|
|
654
643
|
}
|
|
655
644
|
/**
|
|
656
645
|
* Sets the autofocus on the first focusable element in the dialog.
|
|
@@ -714,10 +703,15 @@ const NvDialog$1 = /*@__PURE__*/ proxyCustomElement(class NvDialog extends H {
|
|
|
714
703
|
* @param {KeyboardEvent} event - The keydown event.
|
|
715
704
|
*/
|
|
716
705
|
handleKeyDown(event) {
|
|
717
|
-
if (event.key
|
|
706
|
+
if (event.key !== 'Escape')
|
|
707
|
+
return;
|
|
708
|
+
if (this.undismissable) {
|
|
718
709
|
event.preventDefault();
|
|
719
710
|
event.stopPropagation();
|
|
720
711
|
}
|
|
712
|
+
else {
|
|
713
|
+
this.close();
|
|
714
|
+
}
|
|
721
715
|
}
|
|
722
716
|
/**
|
|
723
717
|
* Handles the click event to close the dialog when clickOutside is true.
|
|
@@ -728,24 +722,17 @@ const NvDialog$1 = /*@__PURE__*/ proxyCustomElement(class NvDialog extends H {
|
|
|
728
722
|
return;
|
|
729
723
|
this.handleClickOutside(event);
|
|
730
724
|
}
|
|
731
|
-
/**
|
|
732
|
-
* Handles the touchstart event to close the dialog when clickOutside is true.
|
|
733
|
-
* @param {TouchEvent} event - The touchstart event.
|
|
734
|
-
*/
|
|
735
|
-
handleDocumentTouch(event) {
|
|
736
|
-
if (!this.clickOutside || this.undismissable)
|
|
737
|
-
return;
|
|
738
|
-
this.handleClickOutside(event);
|
|
739
|
-
}
|
|
740
725
|
//#endregion EVENTS
|
|
741
726
|
/****************************************************************************/
|
|
742
727
|
//#region WATCHERS
|
|
743
|
-
async handleDialogOpenChange(
|
|
744
|
-
if (
|
|
728
|
+
async handleDialogOpenChange(isOpen) {
|
|
729
|
+
if (isOpen) {
|
|
745
730
|
this.show();
|
|
731
|
+
this.openChanged.emit(isOpen);
|
|
746
732
|
}
|
|
747
733
|
else {
|
|
748
734
|
this.close();
|
|
735
|
+
this.openChanged.emit(isOpen);
|
|
749
736
|
}
|
|
750
737
|
}
|
|
751
738
|
//#endregion WATCHERS
|
|
@@ -798,7 +785,7 @@ const NvDialog$1 = /*@__PURE__*/ proxyCustomElement(class NvDialog extends H {
|
|
|
798
785
|
//#region RENDER
|
|
799
786
|
render() {
|
|
800
787
|
const hasForm = this.form || this.el.querySelector('form');
|
|
801
|
-
return (h(Host, { key: '
|
|
788
|
+
return (h(Host, { key: '7ee864d4f6df5a503bff43353a7b32f29fdb285e' }, h("slot", { key: 'dc13563074a0339bbd488baf00a74428d6ef4812', name: "trigger" }), h("dialog", { key: 'c5781d389cf728469ece1cef977a8370101cf85a', ref: el => (this.dialogElement = el), onClose: this.handleDialogClose, role: "dialog", "aria-modal": "true", "aria-labelledby": "dialog-header", "aria-describedby": "dialog-content", class: clsx({ full: this.full }) }, h("div", { key: 'bd5b0f19c639a5f9e5767b1a95b9b07870f18df2', class: "content" }, !this.undismissable && (h("nv-button", { key: '5163f2027391b0207f4128290f6755f302d90070', class: "close-button", emphasis: "lower", size: "sm", onClick: this.handleDialogClose, "aria-label": "Close dialog" }, h("nv-icon", { key: '646d222572ec015bcaf0a957937420f3ca4fb917', name: "x", size: "sm" }))), this.headerElement ? (h("slot", { name: "header" })) : (h("nv-dialogheader", { id: "dialog-header" })), h("div", { key: 'bde55c33725d002ac934b63c079c34024248be52', class: "content-body", id: "dialog-content" }, h("slot", { key: '1ff4c4e01282d08d1a99d274483c55e398d14ffd' })), this.footerElement ? (h("slot", { name: "footer" })) : (h("nv-dialogfooter", { form: this.form, primaryButtonType: hasForm ? ButtonType.Submit : ButtonType.Button, onDialogCanceled: this.handleDialogClose, undismissable: this.undismissable }))))));
|
|
802
789
|
}
|
|
803
790
|
get el() { return this; }
|
|
804
791
|
static get watchers() { return {
|
|
@@ -817,7 +804,7 @@ const NvDialog$1 = /*@__PURE__*/ proxyCustomElement(class NvDialog extends H {
|
|
|
817
804
|
"autofocus": [516],
|
|
818
805
|
"show": [64],
|
|
819
806
|
"close": [64]
|
|
820
|
-
}, [[4, "keydown", "handleKeyDown"], [4, "click", "handleDocumentClick"]
|
|
807
|
+
}, [[4, "keydown", "handleKeyDown"], [4, "click", "handleDocumentClick"]], {
|
|
821
808
|
"open": ["handleDialogOpenChange"]
|
|
822
809
|
}]);
|
|
823
810
|
function defineCustomElement$1() {
|