@nova-design-system/nova-webcomponents 3.8.0 → 3.9.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.
Files changed (100) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/native.cjs.js +1 -1
  3. package/dist/cjs/nv-dialog.cjs.entry.js +19 -32
  4. package/dist/cjs/nv-dialog.cjs.entry.js.map +1 -1
  5. package/dist/cjs/nv-dialogfooter_2.cjs.entry.js +1 -1
  6. package/dist/cjs/nv-dialogfooter_2.cjs.entry.js.map +1 -1
  7. package/dist/cjs/nv-fieldselect.cjs.entry.js +14 -26
  8. package/dist/cjs/nv-fieldselect.cjs.entry.js.map +1 -1
  9. package/dist/cjs/nv-icon.cjs.entry.js +2 -2
  10. package/dist/cjs/nv-icon.cjs.entry.js.map +1 -1
  11. package/dist/collection/components/nv-dialog/nv-dialog.js +21 -40
  12. package/dist/collection/components/nv-dialog/nv-dialog.js.map +1 -1
  13. package/dist/collection/components/nv-dialogheader/nv-dialogheader.css +1 -0
  14. package/dist/collection/components/nv-fieldselect/nv-fieldselect.css +2 -0
  15. package/dist/collection/components/nv-fieldselect/nv-fieldselect.docs.js +8 -8
  16. package/dist/collection/components/nv-fieldselect/nv-fieldselect.docs.js.map +1 -1
  17. package/dist/collection/components/nv-fieldselect/nv-fieldselect.js +25 -35
  18. package/dist/collection/components/nv-fieldselect/nv-fieldselect.js.map +1 -1
  19. package/dist/collection/components/nv-icon/nv-icon.js +1 -1
  20. package/dist/collection/components/nv-icon/nv-icon.js.map +1 -1
  21. package/dist/components/nv-accordion-item.js +1 -1
  22. package/dist/components/nv-accordion.js +3 -3
  23. package/dist/components/nv-alert.js +1 -1
  24. package/dist/components/nv-avatar.js +1 -1
  25. package/dist/components/nv-badge.js +1 -1
  26. package/dist/components/nv-datagrid.js +2 -2
  27. package/dist/components/nv-dialog.js +23 -36
  28. package/dist/components/nv-dialog.js.map +1 -1
  29. package/dist/components/nv-dialogfooter.js +1 -1
  30. package/dist/components/nv-dialogheader.js +1 -1
  31. package/dist/components/nv-fielddate.js +2 -2
  32. package/dist/components/nv-fielddaterange.js +2 -2
  33. package/dist/components/nv-fielddropdown.js +3 -3
  34. package/dist/components/nv-fielddropdownitem.js +1 -1
  35. package/dist/components/nv-fieldmultiselect.js +3 -3
  36. package/dist/components/nv-fieldnumber.js +1 -1
  37. package/dist/components/nv-fieldpassword.js +2 -2
  38. package/dist/components/nv-fieldselect.js +18 -31
  39. package/dist/components/nv-fieldselect.js.map +1 -1
  40. package/dist/components/nv-fieldslider.js +3 -3
  41. package/dist/components/nv-fieldtext.js +1 -1
  42. package/dist/components/nv-fieldtime.js +2 -2
  43. package/dist/components/nv-icon.js +1 -1
  44. package/dist/components/nv-iconbutton.js +1 -1
  45. package/dist/components/nv-menu.js +2 -2
  46. package/dist/components/nv-menuitem.js +1 -1
  47. package/dist/components/{p-6e2f91ae.js → p-025b8a78.js} +2 -2
  48. package/dist/components/{p-6e2f91ae.js.map → p-025b8a78.js.map} +1 -1
  49. package/dist/components/{p-865725bf.js → p-30f970c3.js} +2 -2
  50. package/dist/components/{p-865725bf.js.map → p-30f970c3.js.map} +1 -1
  51. package/dist/components/{p-f0371d98.js → p-60064345.js} +2 -2
  52. package/dist/components/{p-f0371d98.js.map → p-60064345.js.map} +1 -1
  53. package/dist/components/p-6460318d.js +88 -0
  54. package/dist/components/p-6460318d.js.map +1 -0
  55. package/dist/components/{p-9a209ac7.js → p-68ff562f.js} +2 -2
  56. package/dist/components/{p-9a209ac7.js.map → p-68ff562f.js.map} +1 -1
  57. package/dist/components/{p-abb8f5ae.js → p-6de6866c.js} +2 -2
  58. package/dist/components/{p-abb8f5ae.js.map → p-6de6866c.js.map} +1 -1
  59. package/dist/components/{p-f927f771.js → p-79e6b6a2.js} +3 -3
  60. package/dist/components/{p-f927f771.js.map → p-79e6b6a2.js.map} +1 -1
  61. package/dist/components/{p-7bc65e46.js → p-db4ba1d9.js} +3 -3
  62. package/dist/components/{p-7bc65e46.js.map → p-db4ba1d9.js.map} +1 -1
  63. package/dist/components/{p-fa1988d9.js → p-e4e1a926.js} +2 -2
  64. package/dist/components/{p-fa1988d9.js.map → p-e4e1a926.js.map} +1 -1
  65. package/dist/components/{p-ca130ad2.js → p-ed6686a1.js} +2 -2
  66. package/dist/components/p-ed6686a1.js.map +1 -0
  67. package/dist/esm/loader.js +1 -1
  68. package/dist/esm/native.js +1 -1
  69. package/dist/esm/nv-dialog.entry.js +19 -32
  70. package/dist/esm/nv-dialog.entry.js.map +1 -1
  71. package/dist/esm/nv-dialogfooter_2.entry.js +1 -1
  72. package/dist/esm/nv-dialogfooter_2.entry.js.map +1 -1
  73. package/dist/esm/nv-fieldselect.entry.js +14 -26
  74. package/dist/esm/nv-fieldselect.entry.js.map +1 -1
  75. package/dist/esm/nv-icon.entry.js +2 -2
  76. package/dist/esm/nv-icon.entry.js.map +1 -1
  77. package/dist/native/native.esm.js +1 -1
  78. package/dist/native/native.esm.js.map +1 -1
  79. package/dist/native/{p-baddee4c.entry.js → p-11012998.entry.js} +2 -2
  80. package/dist/native/p-11012998.entry.js.map +1 -0
  81. package/dist/native/{p-12039da4.entry.js → p-b7ec9a1b.entry.js} +2 -2
  82. package/dist/native/p-b7ec9a1b.entry.js.map +1 -0
  83. package/dist/native/p-bc77cac1.entry.js +2 -0
  84. package/dist/native/p-bc77cac1.entry.js.map +1 -0
  85. package/dist/native/{p-9dc1c3e7.entry.js → p-ff248eb8.entry.js} +2 -2
  86. package/dist/native/{p-9dc1c3e7.entry.js.map → p-ff248eb8.entry.js.map} +1 -1
  87. package/dist/types/components/nv-dialog/nv-dialog.d.ts +6 -17
  88. package/dist/types/components/nv-fieldselect/nv-fieldselect.d.ts +22 -9
  89. package/dist/types/components.d.ts +38 -4
  90. package/dist/vscode-data.json +2 -6
  91. package/hydrate/index.js +40 -66
  92. package/hydrate/index.mjs +40 -66
  93. package/package.json +1 -1
  94. package/dist/components/p-9232d306.js +0 -88
  95. package/dist/components/p-9232d306.js.map +0 -1
  96. package/dist/components/p-ca130ad2.js.map +0 -1
  97. package/dist/native/p-12039da4.entry.js.map +0 -1
  98. package/dist/native/p-baddee4c.entry.js.map +0 -1
  99. package/dist/native/p-c65a79a9.entry.js +0 -2
  100. package/dist/native/p-c65a79a9.entry.js.map +0 -1
@@ -27,7 +27,8 @@ export class NvDialog {
27
27
  */
28
28
  this.clickOutside = false;
29
29
  /**
30
- * If true, the dialog visibility is managed manually through methods or the open prop.
30
+ * If true, the dialog visibility is managed manually through methods or the
31
+ * open prop.
31
32
  */
32
33
  this.controlled = false;
33
34
  /**
@@ -35,22 +36,11 @@ export class NvDialog {
35
36
  */
36
37
  this.full = false;
37
38
  /**
38
- * Controls whether the dialog should automatically focus the first focusable element when opened.
39
- * When disabled, prevents unwanted tooltip triggers on dialog open.
39
+ * Controls whether the dialog should automatically focus the first focusable
40
+ * element when opened. When disabled, prevents unwanted tooltip triggers on
41
+ * dialog open.
40
42
  */
41
43
  this.autofocus = false;
42
- /**
43
- * Handles the close button click.
44
- */
45
- this.handleCloseButton = () => {
46
- this.close();
47
- };
48
- /**
49
- * Handles the cancel button click.
50
- */
51
- this.handleCancelButton = () => {
52
- this.close();
53
- };
54
44
  /**
55
45
  * Checks for and sets up form ID if a form is present
56
46
  */
@@ -79,7 +69,6 @@ export class NvDialog {
79
69
  };
80
70
  this.triggerClickEvents = [
81
71
  ['click', this.show],
82
- ['touchstart', this.show],
83
72
  [
84
73
  'keydown',
85
74
  (e) => {
@@ -100,9 +89,10 @@ export class NvDialog {
100
89
  async show() {
101
90
  this.open = true;
102
91
  this.preventScroll();
103
- // It is recommended to use the .show() or .showModal() method to render dialogs, rather than the open attribute. If a <dialog> is opened using the open attribute, it is non-modal.
92
+ /** It is recommended to use the .show() or .showModal() method to render
93
+ * dialogs, rather than the open attribute. If a <dialog> is opened using
94
+ * the open attribute, it is non-modal. */
104
95
  this.dialogElement.showModal();
105
- this.openChanged.emit(this.open);
106
96
  }
107
97
  /**
108
98
  * Call this method to hide the dialog, making it disappear from view.
@@ -111,7 +101,6 @@ export class NvDialog {
111
101
  this.open = false;
112
102
  this.allowScroll();
113
103
  this.dialogElement.close();
114
- this.openChanged.emit(this.open);
115
104
  }
116
105
  /**
117
106
  * Sets the autofocus on the first focusable element in the dialog.
@@ -175,10 +164,15 @@ export class NvDialog {
175
164
  * @param {KeyboardEvent} event - The keydown event.
176
165
  */
177
166
  handleKeyDown(event) {
178
- if (event.key === 'Escape' && this.undismissable) {
167
+ if (event.key !== 'Escape')
168
+ return;
169
+ if (this.undismissable) {
179
170
  event.preventDefault();
180
171
  event.stopPropagation();
181
172
  }
173
+ else {
174
+ this.close();
175
+ }
182
176
  }
183
177
  /**
184
178
  * Handles the click event to close the dialog when clickOutside is true.
@@ -189,24 +183,17 @@ export class NvDialog {
189
183
  return;
190
184
  this.handleClickOutside(event);
191
185
  }
192
- /**
193
- * Handles the touchstart event to close the dialog when clickOutside is true.
194
- * @param {TouchEvent} event - The touchstart event.
195
- */
196
- handleDocumentTouch(event) {
197
- if (!this.clickOutside || this.undismissable)
198
- return;
199
- this.handleClickOutside(event);
200
- }
201
186
  //#endregion EVENTS
202
187
  /****************************************************************************/
203
188
  //#region WATCHERS
204
- async handleDialogOpenChange(open) {
205
- if (open) {
189
+ async handleDialogOpenChange(isOpen) {
190
+ if (isOpen) {
206
191
  this.show();
192
+ this.openChanged.emit(isOpen);
207
193
  }
208
194
  else {
209
195
  this.close();
196
+ this.openChanged.emit(isOpen);
210
197
  }
211
198
  }
212
199
  //#endregion WATCHERS
@@ -259,7 +246,7 @@ export class NvDialog {
259
246
  //#region RENDER
260
247
  render() {
261
248
  const hasForm = this.form || this.el.querySelector('form');
262
- return (h(Host, { key: '8e4a46dd7749656670d5b8eb167aae2108644375' }, h("slot", { key: '954980e2b451c9f5c0e4f09df76c62c1f04ab01e', name: "trigger" }), h("dialog", { key: '8541ad521ae348d26764756e45c668f7aab5c278', 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: 'cd07e78da6f5cb3abd14640b941629bff034ec63', class: "content" }, !this.undismissable && (h("nv-button", { key: '5b610a9d30acd450a273e9dc10a4a29bdf85d58c', class: "close-button", emphasis: "lower", size: "sm", onClick: this.handleCloseButton, "aria-label": "Close dialog" }, h("nv-icon", { key: '4e5841c525221c6c23c699deaeefa7492f57e091', name: "x", size: "sm" }))), this.headerElement ? (h("slot", { name: "header" })) : (h("nv-dialogheader", { id: "dialog-header" })), h("div", { key: 'f09fd0f7013b1c2c912ed7958a8a9cab0016858b', class: "content-body", id: "dialog-content" }, h("slot", { key: 'c3c196c3e8f40acbb29f3fa89d1620e7beaad10c' })), this.footerElement ? (h("slot", { name: "footer" })) : (h("nv-dialogfooter", { form: this.form, primaryButtonType: hasForm ? ButtonType.Submit : ButtonType.Button, onDialogCanceled: this.handleCancelButton, undismissable: this.undismissable }))))));
249
+ 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 }))))));
263
250
  }
264
251
  static get is() { return "nv-dialog"; }
265
252
  static get originalStyleUrls() {
@@ -424,7 +411,7 @@ export class NvDialog {
424
411
  "optional": false,
425
412
  "docs": {
426
413
  "tags": [],
427
- "text": "If true, the dialog visibility is managed manually through methods or the open prop."
414
+ "text": "If true, the dialog visibility is managed manually through methods or the\nopen prop."
428
415
  },
429
416
  "getter": false,
430
417
  "setter": false,
@@ -464,7 +451,7 @@ export class NvDialog {
464
451
  "optional": false,
465
452
  "docs": {
466
453
  "tags": [],
467
- "text": "Controls whether the dialog should automatically focus the first focusable element when opened.\nWhen disabled, prevents unwanted tooltip triggers on dialog open."
454
+ "text": "Controls whether the dialog should automatically focus the first focusable\nelement when opened. When disabled, prevents unwanted tooltip triggers on\ndialog open."
468
455
  },
469
456
  "getter": false,
470
457
  "setter": false,
@@ -553,12 +540,6 @@ export class NvDialog {
553
540
  "target": "document",
554
541
  "capture": false,
555
542
  "passive": false
556
- }, {
557
- "name": "touchstart",
558
- "method": "handleDocumentTouch",
559
- "target": "document",
560
- "capture": false,
561
- "passive": true
562
543
  }];
563
544
  }
564
545
  }
@@ -1 +1 @@
1
- {"version":3,"file":"nv-dialog.js","sourceRoot":"","sources":["../../../src/components/nv-dialog/nv-dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,CAAC,EACD,OAAO,EACP,MAAM,EACN,KAAK,EAEL,KAAK,EACL,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EACL,iBAAiB,EACjB,oBAAoB,GAErB,MAAM,0BAA0B,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I,EAAC,QAAQ,GAAQ,CAC5B,CAAC,CAAC,CAAC,CACF,uBAAiB,EAAE,EAAC,eAAe,GAAmB,CACvD;oBAED,4DAAK,KAAK,EAAC,cAAc,EAAC,EAAE,EAAC,gBAAgB;wBAC3C,8DAAa,CACT;oBAEL,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CACpB,YAAM,IAAI,EAAC,QAAQ,GAAQ,CAC5B,CAAC,CAAC,CAAC,CACF,uBACE,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,iBAAiB,EACf,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,EAEjD,gBAAgB,EAAE,IAAI,CAAC,kBAAkB,EACzC,aAAa,EAAE,IAAI,CAAC,aAAa,GAChB,CACpB,CACG,CACC,CACJ,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Host,\n Prop,\n h,\n Element,\n Method,\n Event,\n EventEmitter,\n Watch,\n Listen,\n} from '@stencil/core';\nimport { tabbable } from 'tabbable';\nimport {\n addEventListeners,\n removeEventListeners,\n type EventsAndListeners,\n} from '../../utils/events.utils';\nimport clsx from 'clsx';\nimport { ButtonType } from '../../utils/constants';\nimport { v4 as uuidv4 } from 'uuid';\n\n/**\n * @slot default - Body of the dialog.\n * @slot trigger - Content to be placed as the trigger, will override the trigger prop.\n * @slot header - Content to be placed as the header, will override the header prop.\n * @slot footer - Content to be placed as the footer, will override the footer prop.\n */\n@Component({\n tag: 'nv-dialog',\n styleUrl: 'nv-dialog.scss',\n shadow: false,\n})\nexport class NvDialog {\n @Element() el: HTMLNvDialogElement;\n private dialogElement!: HTMLDialogElement;\n private eventsAttached = false;\n private form: string;\n\n /****************************************************************************/\n //#region PROPERTIES\n\n /**\n * @internal\n * Accepts a reference to the DOM element acting as the popover trigger. This\n * should be used when the slot for the trigger is not defined.\n */\n @Prop({ reflect: false, mutable: true })\n triggerElement: Element;\n\n /**\n * @internal\n * Accepts a reference to the DOM element acting as the header. This should\n * be used when the slot for the header is not defined.\n */\n @Prop({ reflect: false, mutable: true })\n headerElement: Element;\n\n /**\n * @internal\n * Accepts a reference to the DOM element acting as the footer. This should\n * be used when the slot for the footer is not defined.\n */\n @Prop({ reflect: false, mutable: true })\n footerElement: Element;\n\n /**\n * Use this prop to toggle the visibility of the dialog. Set to true to show\n * the dialog and false to hide it.\n */\n @Prop({ reflect: true, mutable: true })\n open: boolean = false;\n\n /**\n * If true, the dialog cannot be closed by the user.\n */\n @Prop({ reflect: true })\n readonly undismissable: boolean = false;\n\n /**\n * If true, the dialog will be closed when the backdrop is clicked.\n */\n @Prop({ reflect: true })\n readonly clickOutside: boolean = false;\n\n /**\n * If true, the dialog visibility is managed manually through methods or the open prop.\n */\n @Prop({ reflect: true })\n readonly controlled: boolean = false;\n\n /**\n * If true, the dialog takes full width styling.\n */\n @Prop({ reflect: true })\n readonly full: boolean = false;\n\n /**\n * Controls whether the dialog should automatically focus the first focusable element when opened.\n * When disabled, prevents unwanted tooltip triggers on dialog open.\n */\n @Prop({ reflect: true })\n // eslint-disable-next-line @stencil-community/reserved-member-names\n readonly autofocus: boolean = false;\n\n //#endregion PROPERTIES\n /****************************************************************************/\n //#region METHODS\n\n /**\n * Call this method to show the dialog, making it visible on the screen.\n */\n @Method()\n public async show() {\n this.open = true;\n this.preventScroll();\n // It is recommended to use the .show() or .showModal() method to render dialogs, rather than the open attribute. If a <dialog> is opened using the open attribute, it is non-modal.\n this.dialogElement.showModal();\n this.openChanged.emit(this.open);\n }\n\n /**\n * Call this method to hide the dialog, making it disappear from view.\n */\n @Method()\n public async close() {\n this.open = false;\n this.allowScroll();\n this.dialogElement.close();\n this.openChanged.emit(this.open);\n }\n\n /**\n * Handles the close button click.\n */\n private handleCloseButton = () => {\n this.close();\n };\n\n /**\n * Handles the cancel button click.\n */\n private handleCancelButton = () => {\n this.close();\n };\n\n /**\n * Sets the autofocus on the first focusable element in the dialog.\n */\n private setAutofocus() {\n const focusableElements = tabbable(this.dialogElement, {\n displayCheck: 'none',\n });\n\n if (focusableElements.length > 0) {\n // Convert to array and find element with smallest top and left position\n let topLeftElement = focusableElements[0];\n let topLeftRect = topLeftElement.getBoundingClientRect();\n\n focusableElements.forEach(element => {\n const rect = element.getBoundingClientRect();\n if (rect.top < topLeftRect.top || rect.left < topLeftRect.left) {\n topLeftElement = element;\n topLeftRect = rect;\n }\n });\n\n // Set autofocus attribute on the found element\n topLeftElement.setAttribute('autofocus', 'true');\n }\n }\n\n /**\n * Attaches event listeners to the dialog.\n */\n private attachEventListeners() {\n if (this.triggerElement && !this.eventsAttached && !this.controlled) {\n addEventListeners(this.triggerClickEvents, this.triggerElement, this);\n this.eventsAttached = true;\n }\n }\n\n /**\n * Prevents the body from scrolling when the dialog is open.\n * Compensates for scrollbar width to prevent layout shift.\n */\n private preventScroll() {\n // Calculate scrollbar width\n const scrollBarWidth =\n window.innerWidth - document.documentElement.clientWidth;\n\n // Apply overflow hidden and padding compensation\n document.documentElement.style.overflow = 'hidden';\n document.documentElement.style.paddingRight = `${scrollBarWidth}px`;\n }\n\n /**\n * Allows the body to scroll when the dialog is closed.\n * Removes the applied overflow and padding styles.\n */\n private allowScroll() {\n // Remove the applied styles\n document.documentElement.style.removeProperty('overflow');\n document.documentElement.style.removeProperty('padding-right');\n }\n\n private ensureFormId(formElement: HTMLFormElement): string {\n if (!formElement.id) {\n formElement.id = `dialog-form-${uuidv4()}`;\n }\n return formElement.id;\n }\n\n /**\n * Checks for and sets up form ID if a form is present\n */\n private checkForForm = () => {\n if (!this.form) {\n const formElement = this.el.querySelector('form') as HTMLFormElement;\n if (formElement) {\n this.form = this.ensureFormId(formElement);\n }\n }\n };\n\n //#endregion METHODS\n /****************************************************************************/\n //#region EVENTS\n\n /**\n * Emitted when the dialog is closing in order to allow for cleanup, data-capture, etc.\n * @bind open\n */\n @Event()\n openChanged: EventEmitter<boolean>;\n\n /**\n * Handles the native dialog close event.\n */\n private handleDialogClose = () => {\n if (this.open) {\n this.close();\n }\n };\n\n /**\n * Handles the keydown event to optionally prevent the native dialog from closing when the escape key is pressed.\n * @param {KeyboardEvent} event - The keydown event.\n */\n @Listen('keydown', { target: 'document' })\n handleKeyDown(event: KeyboardEvent) {\n if (event.key === 'Escape' && this.undismissable) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n\n /**\n * Handles the click event to close the dialog when clickOutside is true.\n * @param {MouseEvent} event - The click event.\n */\n @Listen('click', { target: 'document' })\n handleDocumentClick(event: MouseEvent) {\n if (!this.clickOutside || this.undismissable) return;\n this.handleClickOutside(event);\n }\n\n /**\n * Handles the touchstart event to close the dialog when clickOutside is true.\n * @param {TouchEvent} event - The touchstart event.\n */\n @Listen('touchstart', { target: 'document' })\n handleDocumentTouch(event: TouchEvent) {\n if (!this.clickOutside || this.undismissable) return;\n this.handleClickOutside(event);\n }\n\n private handleClickOutside = (event: MouseEvent | TouchEvent) => {\n if (event.target === this.dialogElement) {\n this.close();\n event.preventDefault();\n event.stopPropagation();\n }\n };\n\n private triggerClickEvents: EventsAndListeners = [\n ['click', this.show],\n ['touchstart', this.show],\n [\n 'keydown',\n (e: KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n this.show();\n }\n },\n ],\n ];\n\n //#endregion EVENTS\n /****************************************************************************/\n //#region WATCHERS\n\n @Watch('open')\n async handleDialogOpenChange(open: boolean) {\n if (open) {\n this.show();\n } else {\n this.close();\n }\n }\n\n //#endregion WATCHERS\n /****************************************************************************/\n //#region LIFECYCLE\n\n /**\n * Lifecycle method that runs before the component loads.\n * Initializes the trigger, header, and footer elements by finding them in the component's children.\n * Elements are found either by their slot attribute or by their tag name (for dialog header/footer)\n */\n componentWillLoad() {\n this.triggerElement = Array.from(this.el.children).find(child => {\n return child.getAttribute('slot') === 'trigger';\n }) as HTMLElement;\n\n this.headerElement = Array.from(this.el.children).find(child => {\n return (\n child.getAttribute('slot') === 'header' ||\n child.tagName.toLowerCase() === 'nv-dialogheader'\n );\n }) as HTMLElement;\n\n this.footerElement = Array.from(this.el.children).find(child => {\n return (\n child.getAttribute('slot') === 'footer' ||\n child.tagName.toLowerCase() === 'nv-dialogfooter'\n );\n }) as HTMLElement;\n\n // Initial form check\n this.checkForForm();\n }\n\n componentWillUpdate() {\n this.attachEventListeners();\n }\n\n componentDidLoad() {\n if (this.open) {\n this.show();\n }\n // Only set autofocus if the prop is true and no element already has autofocus\n if (this.autofocus && !this.dialogElement.querySelector('[autofocus]')) {\n this.setAutofocus();\n }\n this.attachEventListeners();\n\n // Additional form check in case form was added after initial load\n this.checkForForm();\n }\n\n disconnectedCallback() {\n if (this.triggerElement && !this.eventsAttached && !this.controlled) {\n removeEventListeners(this.triggerClickEvents, this.triggerElement, this);\n this.eventsAttached = false;\n }\n this.allowScroll();\n }\n\n //#endregion LIFECYCLE\n /****************************************************************************/\n //#region RENDER\n\n render() {\n const hasForm = this.form || this.el.querySelector('form');\n\n return (\n <Host>\n <slot name=\"trigger\"></slot>\n\n <dialog\n ref={el => (this.dialogElement = el)}\n onClose={this.handleDialogClose}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby=\"dialog-header\"\n aria-describedby=\"dialog-content\"\n class={clsx({ full: this.full })}\n >\n <div class=\"content\">\n {!this.undismissable && (\n <nv-button\n class=\"close-button\"\n emphasis=\"lower\"\n size=\"sm\"\n onClick={this.handleCloseButton}\n aria-label=\"Close dialog\"\n >\n <nv-icon name=\"x\" size=\"sm\" />\n </nv-button>\n )}\n\n {this.headerElement ? (\n <slot name=\"header\"></slot>\n ) : (\n <nv-dialogheader id=\"dialog-header\"></nv-dialogheader>\n )}\n\n <div class=\"content-body\" id=\"dialog-content\">\n <slot></slot>\n </div>\n\n {this.footerElement ? (\n <slot name=\"footer\"></slot>\n ) : (\n <nv-dialogfooter\n form={this.form}\n primaryButtonType={\n hasForm ? ButtonType.Submit : ButtonType.Button\n }\n onDialogCanceled={this.handleCancelButton}\n undismissable={this.undismissable}\n ></nv-dialogfooter>\n )}\n </div>\n </dialog>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"nv-dialog.js","sourceRoot":"","sources":["../../../src/components/nv-dialog/nv-dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,CAAC,EACD,OAAO,EACP,MAAM,EACN,KAAK,EAEL,KAAK,EACL,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EACL,iBAAiB,EACjB,oBAAoB,GAErB,MAAM,0BAA0B,CAAC;AAClC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAEpC;;;;;GAKG;AAMH,MAAM,OAAO,QAAQ;IALrB;QAQU,mBAAc,GAAG,KAAK,CAAC;QA8B/B;;;WAGG;QAEH,SAAI,GAAY,KAAK,CAAC;QAEtB;;WAEG;QAEM,kBAAa,GAAY,KAAK,CAAC;QAExC;;WAEG;QAEM,iBAAY,GAAY,KAAK,CAAC;QAEvC;;;WAGG;QAEM,eAAU,GAAY,KAAK,CAAC;QAErC;;WAEG;QAEM,SAAI,GAAY,KAAK,CAAC;QAE/B;;;;WAIG;QAGM,cAAS,GAAY,KAAK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;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Host,\n Prop,\n h,\n Element,\n Method,\n Event,\n EventEmitter,\n Watch,\n Listen,\n} from '@stencil/core';\nimport { tabbable } from 'tabbable';\nimport {\n addEventListeners,\n removeEventListeners,\n type EventsAndListeners,\n} from '../../utils/events.utils';\nimport clsx from 'clsx';\nimport { ButtonType } from '../../utils/constants';\nimport { v4 as uuidv4 } from 'uuid';\n\n/**\n * @slot default - Body of the dialog.\n * @slot trigger - Content to be placed as the trigger, will override the trigger prop.\n * @slot header - Content to be placed as the header, will override the header prop.\n * @slot footer - Content to be placed as the footer, will override the footer prop.\n */\n@Component({\n tag: 'nv-dialog',\n styleUrl: 'nv-dialog.scss',\n shadow: false,\n})\nexport class NvDialog {\n @Element() el: HTMLNvDialogElement;\n private dialogElement!: HTMLDialogElement;\n private eventsAttached = false;\n private form: string;\n\n /****************************************************************************/\n //#region PROPERTIES\n\n /**\n * @internal\n * Accepts a reference to the DOM element acting as the popover trigger. This\n * should be used when the slot for the trigger is not defined.\n */\n @Prop({ reflect: false, mutable: true })\n triggerElement: Element;\n\n /**\n * @internal\n * Accepts a reference to the DOM element acting as the header. This should\n * be used when the slot for the header is not defined.\n */\n @Prop({ reflect: false, mutable: true })\n headerElement: Element;\n\n /**\n * @internal\n * Accepts a reference to the DOM element acting as the footer. This should\n * be used when the slot for the footer is not defined.\n */\n @Prop({ reflect: false, mutable: true })\n footerElement: Element;\n\n /**\n * Use this prop to toggle the visibility of the dialog. Set to true to show\n * the dialog and false to hide it.\n */\n @Prop({ reflect: true, mutable: true })\n open: boolean = false;\n\n /**\n * If true, the dialog cannot be closed by the user.\n */\n @Prop({ reflect: true })\n readonly undismissable: boolean = false;\n\n /**\n * If true, the dialog will be closed when the backdrop is clicked.\n */\n @Prop({ reflect: true })\n readonly clickOutside: boolean = false;\n\n /**\n * If true, the dialog visibility is managed manually through methods or the\n * open prop.\n */\n @Prop({ reflect: true })\n readonly controlled: boolean = false;\n\n /**\n * If true, the dialog takes full width styling.\n */\n @Prop({ reflect: true })\n readonly full: boolean = false;\n\n /**\n * Controls whether the dialog should automatically focus the first focusable\n * element when opened. When disabled, prevents unwanted tooltip triggers on\n * dialog open.\n */\n @Prop({ reflect: true })\n // eslint-disable-next-line @stencil-community/reserved-member-names\n readonly autofocus: boolean = false;\n\n //#endregion PROPERTIES\n /****************************************************************************/\n //#region METHODS\n\n /**\n * Call this method to show the dialog, making it visible on the screen.\n */\n @Method()\n public async show() {\n this.open = true;\n this.preventScroll();\n /** It is recommended to use the .show() or .showModal() method to render\n * dialogs, rather than the open attribute. If a <dialog> is opened using\n * the open attribute, it is non-modal. */\n this.dialogElement.showModal();\n }\n\n /**\n * Call this method to hide the dialog, making it disappear from view.\n */\n @Method()\n public async close() {\n this.open = false;\n this.allowScroll();\n this.dialogElement.close();\n }\n\n /**\n * Sets the autofocus on the first focusable element in the dialog.\n */\n private setAutofocus() {\n const focusableElements = tabbable(this.dialogElement, {\n displayCheck: 'none',\n });\n\n if (focusableElements.length > 0) {\n // Convert to array and find element with smallest top and left position\n let topLeftElement = focusableElements[0];\n let topLeftRect = topLeftElement.getBoundingClientRect();\n\n focusableElements.forEach(element => {\n const rect = element.getBoundingClientRect();\n if (rect.top < topLeftRect.top || rect.left < topLeftRect.left) {\n topLeftElement = element;\n topLeftRect = rect;\n }\n });\n\n // Set autofocus attribute on the found element\n topLeftElement.setAttribute('autofocus', 'true');\n }\n }\n\n /**\n * Attaches event listeners to the dialog.\n */\n private attachEventListeners() {\n if (this.triggerElement && !this.eventsAttached && !this.controlled) {\n addEventListeners(this.triggerClickEvents, this.triggerElement, this);\n this.eventsAttached = true;\n }\n }\n\n /**\n * Prevents the body from scrolling when the dialog is open.\n * Compensates for scrollbar width to prevent layout shift.\n */\n private preventScroll() {\n // Calculate scrollbar width\n const scrollBarWidth =\n window.innerWidth - document.documentElement.clientWidth;\n\n // Apply overflow hidden and padding compensation\n document.documentElement.style.overflow = 'hidden';\n document.documentElement.style.paddingRight = `${scrollBarWidth}px`;\n }\n\n /**\n * Allows the body to scroll when the dialog is closed.\n * Removes the applied overflow and padding styles.\n */\n private allowScroll() {\n // Remove the applied styles\n document.documentElement.style.removeProperty('overflow');\n document.documentElement.style.removeProperty('padding-right');\n }\n\n private ensureFormId(formElement: HTMLFormElement): string {\n if (!formElement.id) {\n formElement.id = `dialog-form-${uuidv4()}`;\n }\n return formElement.id;\n }\n\n /**\n * Checks for and sets up form ID if a form is present\n */\n private checkForForm = () => {\n if (!this.form) {\n const formElement = this.el.querySelector('form') as HTMLFormElement;\n if (formElement) {\n this.form = this.ensureFormId(formElement);\n }\n }\n };\n\n //#endregion METHODS\n /****************************************************************************/\n //#region EVENTS\n\n /**\n * Emitted when the dialog is closing in order to allow for cleanup, data-capture, etc.\n * @bind open\n */\n @Event()\n openChanged: EventEmitter<boolean>;\n\n /**\n * Handles the native dialog close event.\n */\n private handleDialogClose = () => {\n if (this.open) {\n this.close();\n }\n };\n\n /**\n * Handles the keydown event to optionally prevent the native dialog from closing when the escape key is pressed.\n * @param {KeyboardEvent} event - The keydown event.\n */\n @Listen('keydown', { target: 'document' })\n handleKeyDown(event: KeyboardEvent) {\n if (event.key !== 'Escape') return;\n\n if (this.undismissable) {\n event.preventDefault();\n event.stopPropagation();\n } else {\n this.close();\n }\n }\n\n /**\n * Handles the click event to close the dialog when clickOutside is true.\n * @param {MouseEvent} event - The click event.\n */\n @Listen('click', { target: 'document' })\n handleDocumentClick(event: MouseEvent) {\n if (!this.clickOutside || this.undismissable) return;\n this.handleClickOutside(event);\n }\n\n private handleClickOutside = (event: MouseEvent) => {\n if (event.target === this.dialogElement) {\n this.close();\n event.preventDefault();\n event.stopPropagation();\n }\n };\n\n private triggerClickEvents: EventsAndListeners = [\n ['click', this.show],\n [\n 'keydown',\n (e: KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n this.show();\n }\n },\n ],\n ];\n\n //#endregion EVENTS\n /****************************************************************************/\n //#region WATCHERS\n\n @Watch('open')\n async handleDialogOpenChange(isOpen: boolean) {\n if (isOpen) {\n this.show();\n this.openChanged.emit(isOpen);\n } else {\n this.close();\n this.openChanged.emit(isOpen);\n }\n }\n\n //#endregion WATCHERS\n /****************************************************************************/\n //#region LIFECYCLE\n\n /**\n * Lifecycle method that runs before the component loads.\n * Initializes the trigger, header, and footer elements by finding them in the component's children.\n * Elements are found either by their slot attribute or by their tag name (for dialog header/footer)\n */\n componentWillLoad() {\n this.triggerElement = Array.from(this.el.children).find(child => {\n return child.getAttribute('slot') === 'trigger';\n }) as HTMLElement;\n\n this.headerElement = Array.from(this.el.children).find(child => {\n return (\n child.getAttribute('slot') === 'header' ||\n child.tagName.toLowerCase() === 'nv-dialogheader'\n );\n }) as HTMLElement;\n\n this.footerElement = Array.from(this.el.children).find(child => {\n return (\n child.getAttribute('slot') === 'footer' ||\n child.tagName.toLowerCase() === 'nv-dialogfooter'\n );\n }) as HTMLElement;\n\n // Initial form check\n this.checkForForm();\n }\n\n componentWillUpdate() {\n this.attachEventListeners();\n }\n\n componentDidLoad() {\n if (this.open) {\n this.show();\n }\n // Only set autofocus if the prop is true and no element already has autofocus\n if (this.autofocus && !this.dialogElement.querySelector('[autofocus]')) {\n this.setAutofocus();\n }\n this.attachEventListeners();\n\n // Additional form check in case form was added after initial load\n this.checkForForm();\n }\n\n disconnectedCallback() {\n if (this.triggerElement && !this.eventsAttached && !this.controlled) {\n removeEventListeners(this.triggerClickEvents, this.triggerElement, this);\n this.eventsAttached = false;\n }\n this.allowScroll();\n }\n\n //#endregion LIFECYCLE\n /****************************************************************************/\n //#region RENDER\n\n render() {\n const hasForm = this.form || this.el.querySelector('form');\n\n return (\n <Host>\n <slot name=\"trigger\"></slot>\n\n <dialog\n ref={el => (this.dialogElement = el)}\n onClose={this.handleDialogClose}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby=\"dialog-header\"\n aria-describedby=\"dialog-content\"\n class={clsx({ full: this.full })}\n >\n <div class=\"content\">\n {!this.undismissable && (\n <nv-button\n class=\"close-button\"\n emphasis=\"lower\"\n size=\"sm\"\n onClick={this.handleDialogClose}\n aria-label=\"Close dialog\"\n >\n <nv-icon name=\"x\" size=\"sm\" />\n </nv-button>\n )}\n\n {this.headerElement ? (\n <slot name=\"header\"></slot>\n ) : (\n <nv-dialogheader id=\"dialog-header\"></nv-dialogheader>\n )}\n\n <div class=\"content-body\" id=\"dialog-content\">\n <slot></slot>\n </div>\n\n {this.footerElement ? (\n <slot name=\"footer\"></slot>\n ) : (\n <nv-dialogfooter\n form={this.form}\n primaryButtonType={\n hasForm ? ButtonType.Submit : ButtonType.Button\n }\n onDialogCanceled={this.handleDialogClose}\n undismissable={this.undismissable}\n ></nv-dialogfooter>\n )}\n </div>\n </dialog>\n </Host>\n );\n }\n}\n"]}
@@ -11,6 +11,7 @@ nv-dialogheader .heading {
11
11
  font-size: var(--font-size-lg);
12
12
  font-style: normal;
13
13
  font-weight: 500;
14
+ padding-right: var(--spacing-7);
14
15
  line-height: var(--leading-px-6); /* 133.333% */
15
16
  letter-spacing: var(--letter-spacing-heading-xs);
16
17
  }
@@ -232,6 +232,8 @@ nv-fieldselect .select-wrapper .select-container select option {
232
232
  font-style: normal;
233
233
  font-weight: 500;
234
234
  line-height: var(--form-field-line-height, 24px);
235
+ background-color: var(--color-level-05-background);
236
+ color: var(--components-form-field-content-text);
235
237
  }
236
238
  nv-fieldselect .select-wrapper .select-container select.hidden {
237
239
  display: none;
@@ -151,30 +151,30 @@ const NvFieldselectDocs = {
151
151
  template: (h("nv-fieldselect", { "data-storybook-args": true }, h("span", { slot: "error-description" }, "Error Description"), h("option", { value: "1" }, "Option 1"), h("option", { value: "2" }, "Option 2"), h("option", { value: "3" }, "Option 3"), h("option", { value: "4" }, "Option 4"))),
152
152
  },
153
153
  {
154
- name: 'Options JSON',
154
+ name: 'Options Array',
155
155
  args: {
156
- label: 'Select with JSON Options',
157
- options: JSON.stringify([
156
+ label: 'Select with Options Array',
157
+ options: [
158
158
  { label: 'Paris', value: 'paris' },
159
159
  { label: 'London', value: 'london' },
160
160
  { label: 'New York', value: 'ny' },
161
161
  { label: 'Tokyo', value: 'tokyo', disabled: true },
162
162
  { label: 'Berlin', value: 'berlin' },
163
- ]),
163
+ ],
164
164
  },
165
165
  template: h("nv-fieldselect", { "data-storybook-args": true }),
166
166
  },
167
167
  {
168
- name: 'Options JSON Preselected',
168
+ name: 'Options Array with Preselection',
169
169
  args: {
170
- label: 'Select with Preselected JSON Option',
171
- options: JSON.stringify([
170
+ label: 'Select with Preselected Option',
171
+ options: [
172
172
  { label: 'Paris', value: 'paris' },
173
173
  { label: 'London', value: 'london', selected: true },
174
174
  { label: 'New York', value: 'ny' },
175
175
  { label: 'Tokyo', value: 'tokyo', disabled: true },
176
176
  { label: 'Berlin', value: 'berlin' },
177
- ]),
177
+ ],
178
178
  },
179
179
  template: h("nv-fieldselect", { "data-storybook-args": true }),
180
180
  },
@@ -1 +1 @@
1
- {"version":3,"file":"nv-fieldselect.docs.js","sourceRoot":"","sources":["../../../src/components/nv-fieldselect/nv-fieldselect.docs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAGlC,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,MAAM,iBAAiB,GAAuC;IAC5D,SAAS,EAAE,gBAAgB;IAC3B,aAAa,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC;IACxC,OAAO,EAAE;QACP;YACE,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,sDAAsD;YACnE,QAAQ,EAAE,CACR;gBACE,cAAQ,KAAK,EAAC,GAAG,eAAkB;gBACnC,cAAQ,KAAK,EAAC,GAAG,eAAkB;gBACnC,cAAQ,KAAK,EAAC,GAAG,eAAkB;gBACnC,cAAQ,KAAK,EAAC,GAAG,eAAkB,CACpB,CAClB;SACF;QACD;YACE,IAAI,EAAE,MAAM,CAA2B,CAAC,CAAC,EA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KAAK,EAAE,qCAAqC;gBAC5C,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;oBACtB,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;oBAClC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;oBACpD,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE;oBAClC,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE;oBAClD,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;iBACrC,CAAC;aACH;YACD,QAAQ,EAAE,oDAAqD;SAChE;KACF;CACF,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import { h } from '@stencil/core';\nimport type { NovaDocs } from '../../nova-docs';\nimport { Components } from '../../components';\nimport { nameof } from '../../utils/class.utils';\n\nconst NvFieldselectDocs: NovaDocs<Components.NvFieldselect> = {\n component: 'nv-fieldselect',\n subcomponents: ['nv-badge', 'nv-button'],\n stories: [\n {\n name: 'Default',\n description: 'A default nv-fieldselect with no specific props set.',\n template: (\n <nv-fieldselect data-storybook-args>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: nameof<Components.NvFieldselect>(x => x.label),\n args: {\n label: 'Select Label',\n },\n template: (\n <nv-fieldselect data-storybook-args>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: nameof<Components.NvFieldselect>(x => x.description),\n args: {\n label: 'Select with Description',\n description: 'This is a description.',\n },\n template: (\n <nv-fieldselect data-storybook-args>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: 'Placeholder',\n description:\n 'Display temporary text inside the select field to give users a hint about what to choose.',\n args: {\n label: 'Select with Placeholder',\n },\n template: (\n <nv-fieldselect data-storybook-args>\n <option value=\"\" disabled>\n Choose an option...\n </option>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: nameof<Components.NvFieldselect>(x => x.value),\n args: {\n label: 'Select Value',\n value: '2',\n },\n template: (\n <nv-fieldselect data-storybook-args>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: nameof<Components.NvFieldselect>(x => x.disabled),\n args: {\n label: 'Disabled Select',\n disabled: true,\n value: '3',\n },\n template: (\n <nv-fieldselect data-storybook-args>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: nameof<Components.NvFieldselect>(x => x.readonly),\n args: {\n label: 'Readonly Select',\n readonly: true,\n value: '1',\n },\n template: (\n <div data-class=\"flex flex-col gap-2\">\n <nv-fieldselect data-storybook-args>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n <nv-fieldselect data-storybook-args multiple={true}>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n </div>\n ),\n },\n {\n name: nameof<Components.NvFieldselect>(x => x.displayValue),\n args: {\n label: 'Readonly Select with Display Label',\n readonly: true,\n displayValue: true,\n value: '1',\n },\n template: (\n <div data-class=\"flex flex-col gap-2\">\n <nv-fieldselect data-storybook-args>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n </nv-fieldselect>\n <nv-fieldselect data-storybook-args multiple={true}>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n </nv-fieldselect>\n </div>\n ),\n },\n {\n name: nameof<Components.NvFieldselect>(x => x.required),\n args: {\n label: 'Required Field',\n required: true,\n },\n template: (\n <nv-fieldselect data-storybook-args>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: nameof<Components.NvFieldselect>(x => x.error),\n args: {\n label: 'Error State',\n error: true,\n },\n template: (\n <nv-fieldselect data-storybook-args>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: nameof<Components.NvFieldselect>(x => x.success),\n args: {\n label: 'Success State',\n success: true,\n },\n template: (\n <nv-fieldselect data-storybook-args>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: nameof<Components.NvFieldselect>(x => x.multiple),\n args: {\n label: 'Multiple Select',\n multiple: true,\n },\n template: (\n <div data-class=\"flex flex-col gap-2\">\n <nv-fieldselect data-storybook-args>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n <nv-fieldselect value=\"1, 2\" data-storybook-args>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n </div>\n ),\n },\n {\n name: nameof<Components.NvFieldselect>(x => x.autofocus),\n args: {\n label: 'Autofocus',\n autofocus: true,\n },\n template: (\n <nv-fieldselect data-storybook-args>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: 'SlotLabel',\n description:\n 'You can use the `label` slot to customize the content of the label.',\n template: (\n <nv-fieldselect data-storybook-args>\n <span slot=\"label\">Label</span>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: nameof<Components.NvFieldtextarea>(x => x.fluid),\n args: {\n label: 'Fluid',\n fluid: true,\n },\n template: (\n <nv-fieldselect data-storybook-args>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: 'SlotDescription',\n description:\n 'You can use the `description` slot to customize the content of the description.',\n args: {\n label: 'Select with Description',\n description: 'This is a description.',\n },\n template: (\n <nv-fieldselect data-storybook-args>\n <span slot=\"description\">Description</span>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: 'SlotBefore',\n description:\n 'You can use the `before` slot to customize the content before the select.',\n template: (\n <nv-fieldselect data-storybook-args>\n <span slot=\"before\">Before</span>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: 'SlotAfter',\n description:\n 'You can use the `after` slot to customize the content after the select.',\n template: (\n <nv-fieldselect data-storybook-args>\n <span slot=\"after\">After</span>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: 'SlotErrorDescription',\n description:\n 'You can use the `error-description` slot to customize the content of the error description.',\n args: {\n label: 'Select with Error',\n error: true,\n errorDescription: 'This is an error.',\n },\n template: (\n <nv-fieldselect data-storybook-args>\n <span slot=\"error-description\">Error Description</span>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: 'Options JSON',\n args: {\n label: 'Select with JSON Options',\n options: JSON.stringify([\n { label: 'Paris', value: 'paris' },\n { label: 'London', value: 'london' },\n { label: 'New York', value: 'ny' },\n { label: 'Tokyo', value: 'tokyo', disabled: true },\n { label: 'Berlin', value: 'berlin' },\n ]),\n },\n template: <nv-fieldselect data-storybook-args></nv-fieldselect>,\n },\n {\n name: 'Options JSON Preselected',\n args: {\n label: 'Select with Preselected JSON Option',\n options: JSON.stringify([\n { label: 'Paris', value: 'paris' },\n { label: 'London', value: 'london', selected: true },\n { label: 'New York', value: 'ny' },\n { label: 'Tokyo', value: 'tokyo', disabled: true },\n { label: 'Berlin', value: 'berlin' },\n ]),\n },\n template: <nv-fieldselect data-storybook-args></nv-fieldselect>,\n },\n ],\n};\n\nexport default NvFieldselectDocs;\n"]}
1
+ {"version":3,"file":"nv-fieldselect.docs.js","sourceRoot":"","sources":["../../../src/components/nv-fieldselect/nv-fieldselect.docs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAGlC,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,MAAM,iBAAiB,GAAuC;IAC5D,SAAS,EAAE,gBAAgB;IAC3B,aAAa,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC;IACxC,OAAO,EAAE;QACP;YACE,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,sDAAsD;YACnE,QAAQ,EAAE,CACR;gBACE,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AQ,EAAE,IAAI,EAAE;oBAClD,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;iBACrC;aACF;YACD,QAAQ,EAAE,oDAAqD;SAChE;QACD;YACE,IAAI,EAAE,iCAAiC;YACvC,IAAI,EAAE;gBACJ,KAAK,EAAE,gCAAgC;gBACvC,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;oBAClC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;oBACpD,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE;oBAClC,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE;oBAClD,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;iBACrC;aACF;YACD,QAAQ,EAAE,oDAAqD;SAChE;KACF;CACF,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import { h } from '@stencil/core';\nimport type { NovaDocs } from '../../nova-docs';\nimport { Components } from '../../components';\nimport { nameof } from '../../utils/class.utils';\n\nconst NvFieldselectDocs: NovaDocs<Components.NvFieldselect> = {\n component: 'nv-fieldselect',\n subcomponents: ['nv-badge', 'nv-button'],\n stories: [\n {\n name: 'Default',\n description: 'A default nv-fieldselect with no specific props set.',\n template: (\n <nv-fieldselect data-storybook-args>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: nameof<Components.NvFieldselect>(x => x.label),\n args: {\n label: 'Select Label',\n },\n template: (\n <nv-fieldselect data-storybook-args>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: nameof<Components.NvFieldselect>(x => x.description),\n args: {\n label: 'Select with Description',\n description: 'This is a description.',\n },\n template: (\n <nv-fieldselect data-storybook-args>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: 'Placeholder',\n description:\n 'Display temporary text inside the select field to give users a hint about what to choose.',\n args: {\n label: 'Select with Placeholder',\n },\n template: (\n <nv-fieldselect data-storybook-args>\n <option value=\"\" disabled>\n Choose an option...\n </option>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: nameof<Components.NvFieldselect>(x => x.value),\n args: {\n label: 'Select Value',\n value: '2',\n },\n template: (\n <nv-fieldselect data-storybook-args>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: nameof<Components.NvFieldselect>(x => x.disabled),\n args: {\n label: 'Disabled Select',\n disabled: true,\n value: '3',\n },\n template: (\n <nv-fieldselect data-storybook-args>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: nameof<Components.NvFieldselect>(x => x.readonly),\n args: {\n label: 'Readonly Select',\n readonly: true,\n value: '1',\n },\n template: (\n <div data-class=\"flex flex-col gap-2\">\n <nv-fieldselect data-storybook-args>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n <nv-fieldselect data-storybook-args multiple={true}>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n </div>\n ),\n },\n {\n name: nameof<Components.NvFieldselect>(x => x.displayValue),\n args: {\n label: 'Readonly Select with Display Label',\n readonly: true,\n displayValue: true,\n value: '1',\n },\n template: (\n <div data-class=\"flex flex-col gap-2\">\n <nv-fieldselect data-storybook-args>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n </nv-fieldselect>\n <nv-fieldselect data-storybook-args multiple={true}>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n </nv-fieldselect>\n </div>\n ),\n },\n {\n name: nameof<Components.NvFieldselect>(x => x.required),\n args: {\n label: 'Required Field',\n required: true,\n },\n template: (\n <nv-fieldselect data-storybook-args>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: nameof<Components.NvFieldselect>(x => x.error),\n args: {\n label: 'Error State',\n error: true,\n },\n template: (\n <nv-fieldselect data-storybook-args>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: nameof<Components.NvFieldselect>(x => x.success),\n args: {\n label: 'Success State',\n success: true,\n },\n template: (\n <nv-fieldselect data-storybook-args>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: nameof<Components.NvFieldselect>(x => x.multiple),\n args: {\n label: 'Multiple Select',\n multiple: true,\n },\n template: (\n <div data-class=\"flex flex-col gap-2\">\n <nv-fieldselect data-storybook-args>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n <nv-fieldselect value=\"1, 2\" data-storybook-args>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n </div>\n ),\n },\n {\n name: nameof<Components.NvFieldselect>(x => x.autofocus),\n args: {\n label: 'Autofocus',\n autofocus: true,\n },\n template: (\n <nv-fieldselect data-storybook-args>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: 'SlotLabel',\n description:\n 'You can use the `label` slot to customize the content of the label.',\n template: (\n <nv-fieldselect data-storybook-args>\n <span slot=\"label\">Label</span>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: nameof<Components.NvFieldtextarea>(x => x.fluid),\n args: {\n label: 'Fluid',\n fluid: true,\n },\n template: (\n <nv-fieldselect data-storybook-args>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: 'SlotDescription',\n description:\n 'You can use the `description` slot to customize the content of the description.',\n args: {\n label: 'Select with Description',\n description: 'This is a description.',\n },\n template: (\n <nv-fieldselect data-storybook-args>\n <span slot=\"description\">Description</span>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: 'SlotBefore',\n description:\n 'You can use the `before` slot to customize the content before the select.',\n template: (\n <nv-fieldselect data-storybook-args>\n <span slot=\"before\">Before</span>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: 'SlotAfter',\n description:\n 'You can use the `after` slot to customize the content after the select.',\n template: (\n <nv-fieldselect data-storybook-args>\n <span slot=\"after\">After</span>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: 'SlotErrorDescription',\n description:\n 'You can use the `error-description` slot to customize the content of the error description.',\n args: {\n label: 'Select with Error',\n error: true,\n errorDescription: 'This is an error.',\n },\n template: (\n <nv-fieldselect data-storybook-args>\n <span slot=\"error-description\">Error Description</span>\n <option value=\"1\">Option 1</option>\n <option value=\"2\">Option 2</option>\n <option value=\"3\">Option 3</option>\n <option value=\"4\">Option 4</option>\n </nv-fieldselect>\n ),\n },\n {\n name: 'Options Array',\n args: {\n label: 'Select with Options Array',\n options: [\n { label: 'Paris', value: 'paris' },\n { label: 'London', value: 'london' },\n { label: 'New York', value: 'ny' },\n { label: 'Tokyo', value: 'tokyo', disabled: true },\n { label: 'Berlin', value: 'berlin' },\n ],\n },\n template: <nv-fieldselect data-storybook-args></nv-fieldselect>,\n },\n {\n name: 'Options Array with Preselection',\n args: {\n label: 'Select with Preselected Option',\n options: [\n { label: 'Paris', value: 'paris' },\n { label: 'London', value: 'london', selected: true },\n { label: 'New York', value: 'ny' },\n { label: 'Tokyo', value: 'tokyo', disabled: true },\n { label: 'Berlin', value: 'berlin' },\n ],\n },\n template: <nv-fieldselect data-storybook-args></nv-fieldselect>,\n },\n ],\n};\n\nexport default NvFieldselectDocs;\n"]}
@@ -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
- * Parse options and update the internal state
173
- * @param {string} newValue - The new value of options
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 (typeof newValue === 'string') {
177
- try {
178
- const parsedOpts = JSON.parse(newValue);
179
- this.parsedOptions = [...parsedOpts];
180
- // Update the value if an option is pre-selected
181
- const selectedOption = parsedOpts.find(opt => opt.selected);
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: 'ff869c177289342a39ae292a530359af940a5669' }, (this.label || this.el.querySelector('[slot="label"]')) && (h("label", { key: '10815f70059de9b1774ccc26b69d441d250e1833', htmlFor: this.inputId }, h("slot", { key: 'afe78cd3671151060fd1e2a37b77c164767908fa', name: "label" }, this.label))), h("div", { key: '064d8f512bc5f11831096d3a092afb00dcfeb1bc', class: "select-wrapper" }, h("slot", { key: 'c12d375bc5a558d25f1eb34343e2ad5fce784558', name: "before-input" }), h("div", { key: 'ffb39cfc0444edc49a4e2b6318990085009d7598', class: "select-container", onClick: this.handleSelectContainerClick }, h("slot", { key: 'd5fccac0e92fe0553b8478a6f5dc9be4591e8c23', name: "leading-input" }), this.internalReadonly && (h("input", { key: '94dc05d08de8120c78fa140df5eb3adc09ce97da', 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
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: '85ffba58429aaa393cc9178e0866a61f85d92103', 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
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.parsedOptions.length > 0 ? (this.parsedOptions.map(option => (h("option", { value: option.value, selected: option.selected, disabled: option.disabled }, option.label)))) : (h("slot", null))), h("div", { key: '694b0306ddaf671faea9dd863bb7f2917b567ffb', class: "select-icons" }, this.error && (h("nv-icon", { key: '4f86b0916dcbfefb24af5e5e2c0ca009ece6193b', name: "alert-circle", class: "validation", size: "md" })), this.success && (h("nv-icon", { key: 'f99ba37d4a70b7c352b4abb0be0b5eb85b4cc947', name: "circle-check", class: "validation", size: "md" })), !this.multiple && (h("nv-iconbutton", { key: 'b152a3b110b0f780b29adcf1efb4aadf98cf81be', name: "chevron-down", size: "md", emphasis: "lower", tabindex: -1 })))), h("slot", { key: '63c6076165bae5d36732179c4a761d5b381076b5', name: "after-input" })), (this.description ||
355
- this.el.querySelector('[slot="description"]')) && (h("div", { key: 'dd3e41b62290c580e050eb5a4742aabc7395cbda', class: "description", id: `${this.inputId}-description` }, h("slot", { key: '87bedab511a8b3d07d6616e4937342b6d272c5f3', name: "description" }, this.description))), (this.errorDescription ||
356
- this.el.querySelector('[slot="error-description"]')) && (h("div", { key: 'd4cf69f5f2446fbbf8ed36910d89c3aa7ac2c826', class: "error-description", id: `${this.inputId}-error` }, h("slot", { key: '2fc8b58658bd406af834dcad378b3b00aca40b22', name: "error-description" }, this.errorDescription)))));
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": "string",
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. Can be passed as a JSON string.\nFormat: [{ label: string, value: string, selected?: boolean, disabled?: boolean }]"
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() {