@nova-design-system/nova-react 3.30.0 → 3.31.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 (74) hide show
  1. package/dist/cjs/generated/components.server.js +2 -0
  2. package/dist/cjs/{index-DXwd3F_r.js → index-BRxlcrvE.js} +273 -269
  3. package/dist/cjs/index.js +1 -1
  4. package/dist/cjs/{nv-accordion-item.entry-CTbduehY.js → nv-accordion-item.entry-DWi_bEQx.js} +1 -1
  5. package/dist/cjs/{nv-accordion.entry-DeaPwIUP.js → nv-accordion.entry-Bgn2CRYE.js} +1 -1
  6. package/dist/cjs/{nv-alert.entry-B5k8RXXD.js → nv-alert.entry-tkzdxYo4.js} +1 -1
  7. package/dist/cjs/{nv-avatar.entry-CJh9bGfN.js → nv-avatar.entry-C6xqQhws.js} +1 -1
  8. package/dist/cjs/{nv-badge_2.entry-BnPPW4rW.js → nv-badge_2.entry-poMKx9km.js} +1 -1
  9. package/dist/cjs/{nv-breadcrumb.entry-DS5GJVCJ.js → nv-breadcrumb.entry-BTBUN3X8.js} +1 -1
  10. package/dist/cjs/{nv-breadcrumbs.entry-CJ835Ba8.js → nv-breadcrumbs.entry-DXdb_Gzf.js} +1 -1
  11. package/dist/cjs/{nv-button.entry-8U0o_X3d.js → nv-button.entry-IYrV4dVV.js} +1 -1
  12. package/dist/cjs/{nv-buttongroup.entry-D5I5d9y0.js → nv-buttongroup.entry-DpMhGqzQ.js} +1 -1
  13. package/dist/cjs/{nv-calendar.entry-C0ggIM3A.js → nv-calendar.entry-Clp-qYdU.js} +1 -1
  14. package/dist/cjs/{nv-col.entry-tIk723nS.js → nv-col.entry-BgIpEdn6.js} +1 -1
  15. package/dist/cjs/{nv-datagrid.entry-Cal_usTi.js → nv-datagrid.entry-CmnSlQEN.js} +1 -1
  16. package/dist/cjs/{nv-datagridcolumn.entry-BLbpwW7Q.js → nv-datagridcolumn.entry-CfaOqHSs.js} +1 -1
  17. package/dist/cjs/{nv-datetest.entry-NQzySOox.js → nv-datetest.entry-DL0WPAUH.js} +1 -1
  18. package/dist/cjs/{nv-datetimetest.entry-Br6j4eAR.js → nv-datetimetest.entry-DoABznI1.js} +1 -1
  19. package/dist/cjs/{nv-dialog.entry-GTDQJaoQ.js → nv-dialog.entry-C95UrJIU.js} +1 -1
  20. package/dist/cjs/{nv-dialogfooter_2.entry-CHY36NHl.js → nv-dialogfooter_2.entry-Ccml86Uw.js} +1 -1
  21. package/dist/cjs/{nv-drawer.entry-C-TZDi4-.js → nv-drawer.entry-cXCjYVTV.js} +1 -1
  22. package/dist/cjs/{nv-drawerfooter_2.entry-DTY4qAnd.js → nv-drawerfooter_2.entry-Dq0IblnH.js} +1 -1
  23. package/dist/cjs/{nv-fieldcheckbox.entry-Qf4gdEnq.js → nv-fieldcheckbox.entry-CnP54xin.js} +1 -1
  24. package/dist/cjs/{nv-fielddate.entry-D1aJmKbh.js → nv-fielddate.entry-DZY75-mm.js} +1 -1
  25. package/dist/cjs/{nv-fielddaterange.entry-Vc-gHwf8.js → nv-fielddaterange.entry-DkouN3iA.js} +1 -1
  26. package/dist/cjs/{nv-fielddropdown.entry-BVVsM71m.js → nv-fielddropdown.entry-Bc3bobvr.js} +101 -23
  27. package/dist/cjs/{nv-fielddropdownitem.entry-DTRonCZJ.js → nv-fielddropdownitem.entry-CmdskK1s.js} +2 -2
  28. package/dist/cjs/{nv-fieldmultiselect.entry-Cvsh_jn7.js → nv-fieldmultiselect.entry-Bc6YFUA_.js} +1 -1
  29. package/dist/cjs/{nv-fieldnumber.entry-jVFZ0wj3.js → nv-fieldnumber.entry-DwvjJfV9.js} +1 -1
  30. package/dist/cjs/{nv-fieldpassword.entry-CQKbWqMe.js → nv-fieldpassword.entry-CUI2Jm-V.js} +1 -1
  31. package/dist/cjs/{nv-fieldradio.entry-FPGOqFBo.js → nv-fieldradio.entry-CnLCvLBh.js} +1 -1
  32. package/dist/cjs/{nv-fieldselect.entry-DJmW4pff.js → nv-fieldselect.entry-DunLjNwe.js} +45 -7
  33. package/dist/cjs/{nv-fieldslider.entry-D71HjSto.js → nv-fieldslider.entry-Cp-6fToR.js} +4 -4
  34. package/dist/cjs/{nv-fieldtext.entry-BxgbvxEW.js → nv-fieldtext.entry-FJk12WoX.js} +5 -5
  35. package/dist/cjs/{nv-fieldtextarea.entry-BDS37zhJ.js → nv-fieldtextarea.entry-Ci9B5-DX.js} +4 -4
  36. package/dist/cjs/{nv-fieldtime.entry-DkWokxdT.js → nv-fieldtime.entry-DCSdECWn.js} +4 -4
  37. package/dist/cjs/{nv-icon.entry-CUemAv89.js → nv-icon.entry-DB18IDaU.js} +3 -3
  38. package/dist/cjs/{nv-iconbutton_2.entry-BLdJr3QV.js → nv-iconbutton_2.entry-CNR_poEm.js} +3 -3
  39. package/dist/cjs/{nv-menu.entry-z4cDNCeX.js → nv-menu.entry-CxXHuTq3.js} +2 -2
  40. package/dist/cjs/{nv-menuitem.entry-4XdONuGl.js → nv-menuitem.entry-44XD7nfl.js} +2 -2
  41. package/dist/cjs/{nv-notification-bullet.entry-B1EK4G_X.js → nv-notification-bullet.entry-Cn2OELYw.js} +1 -1
  42. package/dist/cjs/{nv-notification.entry-BBAQ72f7.js → nv-notification.entry-C8beqUzI.js} +2 -2
  43. package/dist/cjs/{nv-notificationcontainer.entry-CtFunFA9.js → nv-notificationcontainer.entry-DgEstiLX.js} +2 -2
  44. package/dist/cjs/{nv-pagination-nav.entry-DbzEBjoa.js → nv-pagination-nav.entry-CIZPwFeF.js} +2 -2
  45. package/dist/cjs/{nv-paginationtable.entry-DRGsk0DH.js → nv-paginationtable.entry-woQZpVmb.js} +2 -2
  46. package/dist/cjs/{nv-popover.entry-w9o3Y_vT.js → nv-popover.entry-rHUUSzR-.js} +2 -2
  47. package/dist/cjs/{nv-row.entry-Cop4QB1Y.js → nv-row.entry-DaERf8TD.js} +2 -2
  48. package/dist/cjs/{nv-sidebar.entry-96HyTMt9.js → nv-sidebar.entry-BI9me_HP.js} +3 -3
  49. package/dist/cjs/{nv-sidebarcontent.entry-RCkZZp9I.js → nv-sidebarcontent.entry-CtARsnjy.js} +2 -2
  50. package/dist/cjs/{nv-sidebardivider.entry-DY25WqI7.js → nv-sidebardivider.entry-C15Xk11m.js} +2 -2
  51. package/dist/cjs/{nv-sidebarfooter.entry-9BFpNPLP.js → nv-sidebarfooter.entry-DFMMvv_Q.js} +2 -2
  52. package/dist/cjs/{nv-sidebargroup.entry-Cj52DXba.js → nv-sidebargroup.entry-DeWOA-0I.js} +2 -2
  53. package/dist/cjs/{nv-sidebarheader.entry-_WZgNwoi.js → nv-sidebarheader.entry-HtvbpvnX.js} +2 -2
  54. package/dist/cjs/{nv-sidebarlogo.entry-4Zy6k3V5.js → nv-sidebarlogo.entry-Zxbpttzr.js} +2 -2
  55. package/dist/cjs/{nv-sidebarnavitem.entry-fQ9sqxDj.js → nv-sidebarnavitem.entry-u4rbC1el.js} +3 -3
  56. package/dist/cjs/{nv-sidebarnavsubitem.entry-1iBobkME.js → nv-sidebarnavsubitem.entry-UouMn7hU.js} +2 -2
  57. package/dist/cjs/{nv-split.entry-Dfzpge0r.js → nv-split.entry-CUMbQNQB.js} +2 -2
  58. package/dist/cjs/{nv-stack.entry-BnCput1S.js → nv-stack.entry-D_F42KTD.js} +2 -2
  59. package/dist/cjs/{nv-statusindicator.entry-ClPHcTkz.js → nv-statusindicator.entry-BdRvU3iW.js} +2 -2
  60. package/dist/cjs/{nv-table.entry-DsllD6Bz.js → nv-table.entry-CKVH76OE.js} +2 -2
  61. package/dist/cjs/{nv-tableheader.entry-AWCKrpLj.js → nv-tableheader.entry-btKwE14F.js} +2 -2
  62. package/dist/cjs/{nv-tag.entry-BwENpoSV.js → nv-tag.entry-BxYC7Lgo.js} +1 -1
  63. package/dist/cjs/{nv-timetest.entry-BQsV7Qb2.js → nv-timetest.entry-CxXMIDZ_.js} +2 -2
  64. package/dist/cjs/{nv-toggle.entry-a0tSJ6GE.js → nv-toggle.entry-C4uo7RRt.js} +3 -3
  65. package/dist/cjs/{nv-togglebutton.entry-CT8fZr74.js → nv-togglebutton.entry-DJ-s5lgO.js} +2 -2
  66. package/dist/cjs/{nv-togglebuttongroup.entry-BN7WkQ_L.js → nv-togglebuttongroup.entry-DJOCL_Qx.js} +2 -2
  67. package/dist/cjs/{nv-tooltip.entry-xpFqRgZM.js → nv-tooltip.entry-DndZWT1U.js} +2 -2
  68. package/dist/components/NvDatatable/NvDatatable.js +2 -2
  69. package/dist/generated/components.js +5 -1
  70. package/dist/generated/components.server.js +2 -0
  71. package/dist/types/components/NvDatatable/types.d.ts +1 -0
  72. package/dist/types/generated/components.d.ts +2 -0
  73. package/dist/types/generated/components.server.d.ts +2 -0
  74. package/package.json +1 -1
package/dist/cjs/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DXwd3F_r.js');
3
+ var index = require('./index-BRxlcrvE.js');
4
4
  require('@stencil/react-output-target/runtime');
5
5
  require('react');
6
6
  require('react-dom');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DXwd3F_r.js');
3
+ var index = require('./index-BRxlcrvE.js');
4
4
  var collapse_animationDZDm0vSK = require('./collapse.animation-DZDm0vSK-C2TOIhIK.js');
5
5
  require('./style-value-types.es-xlgmw4x8-B1vLqX9m.js');
6
6
  require('@stencil/react-output-target/runtime');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DXwd3F_r.js');
3
+ var index = require('./index-BRxlcrvE.js');
4
4
  require('@stencil/react-output-target/runtime');
5
5
  require('react');
6
6
  require('react-dom');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DXwd3F_r.js');
3
+ var index = require('./index-BRxlcrvE.js');
4
4
  var clsxChV9xqsO = require('./clsx-ChV9xqsO-BtxeOLZW.js');
5
5
  var constantsGOKBmbgZ = require('./constants-gOKBmbgZ-CSoZ8z-G.js');
6
6
  var collapse_animationDZDm0vSK = require('./collapse.animation-DZDm0vSK-C2TOIhIK.js');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DXwd3F_r.js');
3
+ var index = require('./index-BRxlcrvE.js');
4
4
  var clsxChV9xqsO = require('./clsx-ChV9xqsO-BtxeOLZW.js');
5
5
  var constantsGOKBmbgZ = require('./constants-gOKBmbgZ-CSoZ8z-G.js');
6
6
  require('@stencil/react-output-target/runtime');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DXwd3F_r.js');
3
+ var index = require('./index-BRxlcrvE.js');
4
4
  var clsxChV9xqsO = require('./clsx-ChV9xqsO-BtxeOLZW.js');
5
5
  var collapse_animationDZDm0vSK = require('./collapse.animation-DZDm0vSK-C2TOIhIK.js');
6
6
  var fade_animationDcRL9lcm = require('./fade.animation-DcRL9lcm-DAZeHoKN.js');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DXwd3F_r.js');
3
+ var index = require('./index-BRxlcrvE.js');
4
4
  var clsxChV9xqsO = require('./clsx-ChV9xqsO-BtxeOLZW.js');
5
5
  require('@stencil/react-output-target/runtime');
6
6
  require('react');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DXwd3F_r.js');
3
+ var index = require('./index-BRxlcrvE.js');
4
4
  require('@stencil/react-output-target/runtime');
5
5
  require('react');
6
6
  require('react-dom');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DXwd3F_r.js');
3
+ var index = require('./index-BRxlcrvE.js');
4
4
  var constantsGOKBmbgZ = require('./constants-gOKBmbgZ-CSoZ8z-G.js');
5
5
  require('@stencil/react-output-target/runtime');
6
6
  require('react');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DXwd3F_r.js');
3
+ var index = require('./index-BRxlcrvE.js');
4
4
  require('@stencil/react-output-target/runtime');
5
5
  require('react');
6
6
  require('react-dom');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DXwd3F_r.js');
3
+ var index = require('./index-BRxlcrvE.js');
4
4
  var constantsGOKBmbgZ = require('./constants-gOKBmbgZ-CSoZ8z-G.js');
5
5
  var _commonjsHelpersB85MJLTf = require('./_commonjsHelpers-B85MJLTf-CFO10eej.js');
6
6
  require('@stencil/react-output-target/runtime');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DXwd3F_r.js');
3
+ var index = require('./index-BRxlcrvE.js');
4
4
  var clsxChV9xqsO = require('./clsx-ChV9xqsO-BtxeOLZW.js');
5
5
  require('@stencil/react-output-target/runtime');
6
6
  require('react');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DXwd3F_r.js');
3
+ var index = require('./index-BRxlcrvE.js');
4
4
  var dom_utilsCuXVGECR = require('./dom.utils-CuXVGECR-8VY5SfMZ.js');
5
5
  var constantsGOKBmbgZ = require('./constants-gOKBmbgZ-CSoZ8z-G.js');
6
6
  require('@stencil/react-output-target/runtime');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DXwd3F_r.js');
3
+ var index = require('./index-BRxlcrvE.js');
4
4
  require('@stencil/react-output-target/runtime');
5
5
  require('react');
6
6
  require('react-dom');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DXwd3F_r.js');
3
+ var index = require('./index-BRxlcrvE.js');
4
4
  var novaDatetimeCyL2J6O4 = require('./nova-datetime-CyL2J6O4-0Y9g3rfI.js');
5
5
  require('@stencil/react-output-target/runtime');
6
6
  require('react');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DXwd3F_r.js');
3
+ var index = require('./index-BRxlcrvE.js');
4
4
  require('@stencil/react-output-target/runtime');
5
5
  require('react');
6
6
  require('react-dom');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DXwd3F_r.js');
3
+ var index = require('./index-BRxlcrvE.js');
4
4
  var index_esmD3eWMME9 = require('./index.esm-D3eWMME9-CG1TVKfu.js');
5
5
  var events_utilsB6GgGra_ = require('./events.utils-B6GgGra--01N__3wY.js');
6
6
  var fade_animationDcRL9lcm = require('./fade.animation-DcRL9lcm-DAZeHoKN.js');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DXwd3F_r.js');
3
+ var index = require('./index-BRxlcrvE.js');
4
4
  var constantsGOKBmbgZ = require('./constants-gOKBmbgZ-CSoZ8z-G.js');
5
5
  require('@stencil/react-output-target/runtime');
6
6
  require('react');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DXwd3F_r.js');
3
+ var index = require('./index-BRxlcrvE.js');
4
4
  var index_esmD3eWMME9 = require('./index.esm-D3eWMME9-CG1TVKfu.js');
5
5
  var events_utilsB6GgGra_ = require('./events.utils-B6GgGra--01N__3wY.js');
6
6
  var fade_animationDcRL9lcm = require('./fade.animation-DcRL9lcm-DAZeHoKN.js');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DXwd3F_r.js');
3
+ var index = require('./index-BRxlcrvE.js');
4
4
  var constantsGOKBmbgZ = require('./constants-gOKBmbgZ-CSoZ8z-G.js');
5
5
  require('@stencil/react-output-target/runtime');
6
6
  require('react');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DXwd3F_r.js');
3
+ var index = require('./index-BRxlcrvE.js');
4
4
  var clsxChV9xqsO = require('./clsx-ChV9xqsO-BtxeOLZW.js');
5
5
  var v4BdYh22OP = require('./v4-BdYh22OP-C1vaJ4yP.js');
6
6
  require('@stencil/react-output-target/runtime');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DXwd3F_r.js');
3
+ var index = require('./index-BRxlcrvE.js');
4
4
  var inputmaskCSo292ul = require('./inputmask-CSo292ul-DlvupPk6.js');
5
5
  var v4BdYh22OP = require('./v4-BdYh22OP-C1vaJ4yP.js');
6
6
  require('@stencil/react-output-target/runtime');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DXwd3F_r.js');
3
+ var index = require('./index-BRxlcrvE.js');
4
4
  var inputmaskCSo292ul = require('./inputmask-CSo292ul-DlvupPk6.js');
5
5
  var v4BdYh22OP = require('./v4-BdYh22OP-C1vaJ4yP.js');
6
6
  require('@stencil/react-output-target/runtime');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DXwd3F_r.js');
3
+ var index = require('./index-BRxlcrvE.js');
4
4
  var i18n_utilsCR9MpYzU = require('./i18n.utils-CR9MpYzU-ku0bScip.js');
5
5
  var v4BdYh22OP = require('./v4-BdYh22OP-C1vaJ4yP.js');
6
6
  require('@stencil/react-output-target/runtime');
@@ -14,6 +14,7 @@ const NvFielddropdown = class {
14
14
  index.registerInstance(this, hostRef);
15
15
  this.valueChanged = index.createEvent(this, "valueChanged", 3);
16
16
  this.filterTextChanged = index.createEvent(this, "filterTextChanged", 3);
17
+ this.cleared = index.createEvent(this, "cleared", 3);
17
18
  this.openChanged = index.createEvent(this, "openChanged", 3);
18
19
  this.dropdownItemSelected = index.createEvent(this, "dropdownItemSelected", 7);
19
20
  /** Pre-computed search index for efficient filtering */
@@ -85,6 +86,13 @@ const NvFielddropdown = class {
85
86
  * Enables or disables the filtering feature for the dropdown items.
86
87
  */
87
88
  this.filterable = false;
89
+ /**
90
+ * Shows the inline clear (×) button when a value is selected (or when
91
+ * filterable and the user has typed). The programmatic `clear()` method
92
+ * works regardless of this prop — leave it off when you want to manage
93
+ * clearing the selection from outside the component.
94
+ */
95
+ this.clearable = false;
88
96
  /**
89
97
  * When an item is selected by the user, the dropdown will continue to stay
90
98
  * open.
@@ -178,10 +186,35 @@ const NvFielddropdown = class {
178
186
  if (!this.el?.contains(event.target))
179
187
  this.open = false;
180
188
  };
189
+ /**
190
+ * Handles clicks on the inline clear button. When a value is already
191
+ * selected and the user has typed in a filter, clearing should dismiss
192
+ * the filter and revert the input to the selected label rather than
193
+ * wipe the selection. Always emits `cleared` so subscribers see one
194
+ * consistent signal regardless of which path ran.
195
+ * @param {MouseEvent} [event] - The click event from the clear button.
196
+ */
197
+ this.handleClearButtonClick = (event) => {
198
+ // Keyboard-activated clicks have detail === 0; mouse clicks are >= 1.
199
+ // We only restore focus on keyboard activation so we don't steal focus
200
+ // from mouse users (and we don't reopen a closed popover via the focus
201
+ // listener on mouse clicks).
202
+ const isKeyboard = event?.detail === 0;
203
+ if (this.value && this.filterable && this.filterText?.length > 0) {
204
+ this.clearFilter();
205
+ this.cleared.emit();
206
+ if (isKeyboard)
207
+ this.focusField();
208
+ return;
209
+ }
210
+ this.clear();
211
+ if (isKeyboard)
212
+ this.focusField();
213
+ };
181
214
  this.handleFilterInput = () => {
182
215
  this.open = true;
183
- this.filterText = this.inputElement.value;
184
- this.filterTextChanged.emit(this.inputElement.value);
216
+ this.filterText = this.inputElement?.value ?? '';
217
+ this.filterTextChanged.emit(this.filterText);
185
218
  clearTimeout(this.debounceTimer);
186
219
  // Use longer debounce for fuzzy mode (Fuse.js needs more time)
187
220
  // For fuzzy mode, use FUZZY_DEBOUNCE_DELAY (300ms), otherwise use this.debounceDelay
@@ -197,12 +230,12 @@ const NvFielddropdown = class {
197
230
  return '';
198
231
  if (this.filterText?.length)
199
232
  return this.filterText;
200
- if (this.options?.length > 1) {
201
- const matchingItem = this.options.find(option => option.value === this.value);
233
+ if ((this.options?.length ?? 0) > 1) {
234
+ const matchingItem = this.options?.find(option => option.value === this.value);
202
235
  return matchingItem?.label ?? matchingItem?.value ?? this.value;
203
236
  }
204
237
  const items = Array.from(this.el.querySelectorAll('nv-fielddropdownitem'));
205
- const matchingItem = items.find(item => item.value === this.value);
238
+ const matchingItem = this.findItemMatchingValue(items);
206
239
  const selectedLabel = matchingItem
207
240
  ? matchingItem.label ??
208
241
  matchingItem.textContent?.trim() ??
@@ -259,8 +292,13 @@ const NvFielddropdown = class {
259
292
  event.relatedTarget.tagName.includes('NV-FIELDDROPDOWNITEM')) {
260
293
  return;
261
294
  }
262
- if (event.target != this.toggleElement)
263
- this.open = true;
295
+ // Toggle and clear are inline controls inside the trigger that should
296
+ // not open the popover when focused (keyboard or otherwise).
297
+ if (event.target === this.toggleElement)
298
+ return;
299
+ if (event.target === this.clearElement)
300
+ return;
301
+ this.open = true;
264
302
  }
265
303
  handleFocusOut(event) {
266
304
  if (!(event.relatedTarget instanceof Node))
@@ -317,6 +355,32 @@ const NvFielddropdown = class {
317
355
  this.setFilterInputToSelectedValue();
318
356
  }, 0);
319
357
  }
358
+ /**
359
+ * Clears the current selection. Resets the value to an empty string,
360
+ * removes the selected state from items, clears the filter text (when
361
+ * filterable) and emits `valueChanged` (and `filterTextChanged` when the
362
+ * filter was reset). Emits `cleared` when anything was actually reset.
363
+ */
364
+ async clear() {
365
+ const hadValue = Boolean(this.value);
366
+ const hadFilterText = this.filterable && this.filterText?.length > 0;
367
+ if (hadValue) {
368
+ this.value = '';
369
+ this.valueChanged.emit('');
370
+ }
371
+ if (hadFilterText) {
372
+ this.filterText = '';
373
+ this.filterTextChanged.emit('');
374
+ this.filterItems();
375
+ }
376
+ if (hadValue || hadFilterText) {
377
+ this.cleared.emit();
378
+ }
379
+ // Wait for wrapper lifecycle to finish before resetting input display.
380
+ setTimeout(() => {
381
+ this.setFilterInputToSelectedValue();
382
+ }, 0);
383
+ }
320
384
  /**
321
385
  * Toggles the dropdown popover open state
322
386
  * @param {boolean} open - The open state to set, if null, toggles the state
@@ -345,6 +409,21 @@ const NvFielddropdown = class {
345
409
  return (this.inputElement.value = '');
346
410
  this.inputElement.value = this.getSelectedLabel();
347
411
  }
412
+ /**
413
+ * Finds the item that matches the current value. Falls back to matching by
414
+ * label when no item matches by value, so that consumers who pass a value
415
+ * matching only the label (e.g. `<nv-fielddropdownitem label="Item 2">`
416
+ * with `value="Item 2"`) still get the correct selected item.
417
+ * @param {HTMLNvFielddropdownitemElement[]} items - The dropdown items to search.
418
+ * @returns {HTMLNvFielddropdownitemElement | undefined} The matching item, or undefined if no match is found.
419
+ */
420
+ findItemMatchingValue(items) {
421
+ if (!this.value)
422
+ return undefined;
423
+ const value = this.value;
424
+ return (items.find(item => item.value === value) ??
425
+ items.find(item => item.label === value));
426
+ }
348
427
  // Will exclude detached items and data-empty
349
428
  getFilterableItems() {
350
429
  return Array.from(this.el.querySelectorAll('nv-fielddropdownitem:not([data-empty]):not([detached])'));
@@ -589,16 +668,10 @@ const NvFielddropdown = class {
589
668
  }
590
669
  async updateSelectedItem() {
591
670
  const items = this.getAllItems();
592
- if (this.value) {
593
- items.forEach(item => {
594
- if (item.value === this.value) {
595
- item.selected = true;
596
- }
597
- else {
598
- item.selected = false;
599
- }
600
- });
601
- }
671
+ const matchingItem = this.findItemMatchingValue(items);
672
+ items.forEach(item => {
673
+ item.selected = Boolean(this.value) && item === matchingItem;
674
+ });
602
675
  }
603
676
  //#endregion METHODS
604
677
  /****************************************************************************/
@@ -616,7 +689,9 @@ const NvFielddropdown = class {
616
689
  componentDidRender() {
617
690
  // Make sure to show the value when the field is disabled or readonly
618
691
  // as we switch to an input instead of a p in that case
619
- if (!this.filterable && (this.disabled || this.readonly)) {
692
+ if (!this.filterable &&
693
+ (this.disabled || this.readonly) &&
694
+ this.inputElement) {
620
695
  this.inputElement.value = this.getSelectedLabel();
621
696
  }
622
697
  }
@@ -655,11 +730,14 @@ const NvFielddropdown = class {
655
730
  ? ariaRequiredAttrValue === 'true' || ariaRequiredAttrValue === ''
656
731
  : undefined;
657
732
  const useNativeRequired = this.required && (!useAriaRequired || ariaRequiredValue === true);
658
- return (index.h(index.Host, { key: 'a0a129aeee7140680b618e20e0ba2557835d3aee', role: "combobox", "aria-expanded": this.open.toString(), "aria-haspopup": "listbox", "aria-label": this.label }, (this.label || this.el.querySelector('[slot="label"]')) && (index.h("label", { key: 'e84b1cb668cc910b8fe4f81a4939eb6109829983', htmlFor: this.inputId, onClick: this.syncToggleDropdown.bind(this) }, index.h("slot", { key: 'b1e59b97c865e87559f7bad61019a05184d27623', name: "label" }, this.label))), index.h("nv-popover", { key: '31e5b57856dfb48b5c6f212f0f29a95b05eefe06', triggerMode: "controlled", placement: "bottom-start", open: this.open, onOpenChanged: e => this.openChanged.emit(e.detail) }, index.h("div", { key: 'b828839bf1b2c957afee3aaa1a9c9faf34c15bce', class: "input-wrapper", slot: "trigger" }, index.h("slot", { key: 'a0d2cc5c6806ed2694310b2e20fa5d4d218194e1', name: "before-input" }), index.h("div", { key: '812cbc43ba84748db9cbc49eb0f0c22995ac0285', class: "input-container" }, index.h("slot", { key: '0e79dfcd550c09a9cf45ed9cdae36e15a72be285', name: "leading-input" }), this.filterable || this.disabled || this.readonly ? (index.h("input", { "data-scope": "focusable", id: this.inputId, type: "search", ref: e => (this.inputElement = e), autofocus: this.autofocus, autocomplete: this.autocomplete, placeholder: this.placeholder, name: this.name, required: useNativeRequired ? this.required : undefined, ...(ariaRequiredValue !== undefined && {
733
+ return (index.h(index.Host, { key: '83aecee12e5f0fea2ddc293f1631dc4e55ab3764', role: "combobox", "aria-expanded": this.open.toString(), "aria-haspopup": "listbox", "aria-label": this.label }, (this.label || this.el.querySelector('[slot="label"]')) && (index.h("label", { key: 'adfef46ef0163fb3c902df5df70b5c591a6dd7e1', htmlFor: this.inputId, onClick: this.syncToggleDropdown.bind(this) }, index.h("slot", { key: 'ed6bd8cc6fcace8604f934ba197c31589bf5e296', name: "label" }, this.label))), index.h("nv-popover", { key: '9dfa5dd021c2d0803a35b79fd58dd70422dbe6f0', triggerMode: "controlled", placement: "bottom-start", open: this.open, onOpenChanged: e => this.openChanged.emit(e.detail) }, index.h("div", { key: '62024e3fae662f316a932cce628e58e6917fc624', class: "input-wrapper", slot: "trigger" }, index.h("slot", { key: '61fe57f847075dc6e1447cc377e7e8f828700b43', name: "before-input" }), index.h("div", { key: '8139ffe5b0b7d37781c2b435ed1b9c94f2eea9de', class: "input-container" }, index.h("slot", { key: 'ab2515724a53a1b9e4081bd1944130cd435a0a92', name: "leading-input" }), this.filterable || this.disabled || this.readonly ? (index.h("input", { "data-scope": "focusable", id: this.inputId, type: "search", ref: e => (this.inputElement = e), autofocus: this.autofocus, autocomplete: this.autocomplete, placeholder: this.placeholder, name: this.name, required: useNativeRequired ? this.required : undefined, ...(ariaRequiredValue !== undefined && {
659
734
  'aria-required': String(ariaRequiredValue),
660
- }), disabled: this.disabled, readOnly: this.readonly, onInput: this.handleFilterInput })) : (index.h("p", { "data-scope": "focusable", id: this.inputId, ref: el => (this.selectElement = el), class: "non-filterable-text", tabIndex: this.disabled ? -1 : 0 }, this.getSelectedLabel() || this.value || this.placeholder)), this.filterable && this.filterText && (index.h("nv-iconbutton", { key: 'd84df53cffb3eb54d8263f8b83ea325e1806d036', name: "x", size: "md", emphasis: "lower", class: "clear-button", onClick: this.clearFilter.bind(this), "aria-label": "Clear input" })), this.error && (index.h("nv-icon", { key: 'aa47af71684d1143d49acea9f652a75af721ea42', name: "alert-circle", class: "validation", size: "md" })), index.h("nv-iconbutton", { key: 'b3b4f616bfa69a0ec169d38bc4a5997a25bb752a', "data-scope": "toggle-dropdown", ref: el => (this.toggleElement = el), name: this.open ? 'chevron-top' : 'chevron-down', size: "md", emphasis: "lower", "aria-label": this.open ? 'Hide dropdown' : 'Show dropdown', onClick: this.syncToggleDropdown.bind(this), tabIndex: this.disabled ? -1 : 0 })), index.h("slot", { key: '1186748c136a4738a40bedbd9d4e55ce34d43600', name: "after-input" })), index.h("div", { key: 'af5fd84039c5a319b0301e41d42eca46ec599a6d', slot: "content", style: this.maxHeight ? { maxHeight: this.maxHeight } : {} }, this.options?.length > 0 && (index.h("ul", { key: 'b28fae6234d2b5a6d5a350fc91070f2a59c19939' }, this.options.map(option => (index.h("nv-fielddropdownitem", { label: option.label, value: option.value, disabled: option.disabled, selected: option.value === this.value }))))), index.h("slot", { key: '1036fac674f016670b916c09f7892d1600c3998a', name: "content" }))), (this.description ||
661
- this.el.querySelector('[slot="description"]')) && (index.h("div", { key: 'a047c7a480de216be1c83f84e7f52220cc174cc6', class: "description" }, index.h("slot", { key: '01a54b2fd7f5086c7c7247d5b11628e3012d63dd', name: "description" }, this.description))), (this.errorDescription ||
662
- this.el.querySelector('[slot="error-description"]')) && (index.h("div", { key: '4cff548c666ea082738bd7f66878c564126dc60c', hidden: !this.error, class: "error-description" }, index.h("slot", { key: '553170d5254e4841d91eee119756a5466663c5c0', name: "error-description" }, this.errorDescription)))));
735
+ }), disabled: this.disabled, readOnly: this.readonly, onInput: this.handleFilterInput })) : (index.h("p", { "data-scope": "focusable", id: this.inputId, ref: el => (this.selectElement = el), class: "non-filterable-text", tabIndex: this.disabled ? -1 : 0 }, this.getSelectedLabel() || this.value || this.placeholder)), this.clearable &&
736
+ !this.disabled &&
737
+ !this.readonly &&
738
+ (this.value || (this.filterable && this.filterText)) && (index.h("nv-iconbutton", { key: 'b467a3949af859fe4e9d19f810a19a8e1d1834c9', ref: el => (this.clearElement = el), "data-scope": "clear", name: "x", size: "md", emphasis: "lower", class: "clear-button", onMouseDown: (e) => e.preventDefault(), onClick: this.handleClearButtonClick, "aria-label": this.value ? 'Clear selection' : 'Clear input', title: this.value ? 'Clear selection' : 'Clear input' })), this.error && (index.h("nv-icon", { key: '2c05d617da93adddd4994c3063b0e6fe7be017c7', name: "alert-circle", class: "validation", size: "md" })), index.h("nv-iconbutton", { key: '372a295a58b391a61d240d5133b427c3ddf1edba', "data-scope": "toggle-dropdown", ref: el => (this.toggleElement = el), name: this.open ? 'chevron-top' : 'chevron-down', size: "md", emphasis: "lower", "aria-label": this.open ? 'Hide dropdown' : 'Show dropdown', onClick: this.syncToggleDropdown.bind(this), tabIndex: this.disabled ? -1 : 0 })), index.h("slot", { key: '95db16c591f0bf7dec95550260b9d6bcd7e084a9', name: "after-input" })), index.h("div", { key: '46372589dee8ff8509570bd1a3cc33763cf17869', slot: "content", style: this.maxHeight ? { maxHeight: this.maxHeight } : {} }, (this.options?.length ?? 0) > 0 && (index.h("ul", { key: 'dc2840ef3e798291e49ae179a978c5b3d277ffa2' }, this.options?.map(option => (index.h("nv-fielddropdownitem", { label: option.label, value: option.value, disabled: option.disabled, selected: option.value === this.value }))))), index.h("slot", { key: '750ef13e5911fe9bfc9a277b24150a1d3e631d4d', name: "content" }))), (this.description ||
739
+ this.el.querySelector('[slot="description"]')) && (index.h("div", { key: '34e1fbd85f790f0ea38502d10daadabf2c26c493', class: "description" }, index.h("slot", { key: '248779124cefa199c5ee3b664c1a26ddfab0d849', name: "description" }, this.description))), (this.errorDescription ||
740
+ this.el.querySelector('[slot="error-description"]')) && (index.h("div", { key: 'dff99dce8c08ca76a620cf199147a72a0624b3be', hidden: !this.error, class: "error-description" }, index.h("slot", { key: 'fcdbc2a466f9d13593a5fb6d7a2ba719b0df19dd', name: "error-description" }, this.errorDescription)))));
663
741
  }
664
742
  static get formAssociated() { return true; }
665
743
  get el() { return index.getElement(this); }
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DXwd3F_r.js');
3
+ var index = require('./index-BRxlcrvE.js');
4
4
  require('@stencil/react-output-target/runtime');
5
5
  require('react');
6
6
  require('react-dom');
@@ -60,7 +60,7 @@ const NvFielddropdownitem = class {
60
60
  /****************************************************************************/
61
61
  //#region RENDER
62
62
  render() {
63
- return (index.h(index.Host, { key: '9931decf5664d77d8c164859bc4046ca313e13a9', role: "menuitem", tabindex: '-1', onClick: this.handleSelected }, index.h("slot", { key: '21c6457187f8d5d561e2783b212d5230e85a8f8c' }, index.h("div", { key: '751615833fcb1d200abd526d9c80822d7bda30b4', class: "text-wrapper" }, index.h("span", { key: '67a7bcb31cdf32eee18e419e85f28b53b74a4f82', "data-scope": "text" }, this.label))), this.selected && (index.h("nv-icon", { key: '09b1b6f5366f89ca8d03fe51738c627b899bb454', name: "check", "aria-hidden": "true", "data-scope": "selected" }))));
63
+ return (index.h(index.Host, { key: '9931decf5664d77d8c164859bc4046ca313e13a9', role: "menuitem", tabindex: '-1', onClick: this.handleSelected }, this.selected && (index.h("nv-icon", { key: 'aba64f319fb37bc8f471ebd65d00d0f17158fe41', name: "check", "aria-hidden": "true", "data-scope": "selected" })), index.h("slot", { key: 'ffafa2e39d704caa576d59bba459503be10f4ffc' }, index.h("div", { key: '065293dca56bfaec8f89910f88b92a52907fcf28', class: "text-wrapper" }, index.h("span", { key: '2f85b57db26203bc19b32047707f9281a6d906a0', "data-scope": "text" }, this.label)))));
64
64
  }
65
65
  get el() { return index.getElement(this); }
66
66
  };
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DXwd3F_r.js');
3
+ var index = require('./index-BRxlcrvE.js');
4
4
  var i18n_utilsCR9MpYzU = require('./i18n.utils-CR9MpYzU-ku0bScip.js');
5
5
  var v4BdYh22OP = require('./v4-BdYh22OP-C1vaJ4yP.js');
6
6
  require('@stencil/react-output-target/runtime');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DXwd3F_r.js');
3
+ var index = require('./index-BRxlcrvE.js');
4
4
  var v4BdYh22OP = require('./v4-BdYh22OP-C1vaJ4yP.js');
5
5
  require('@stencil/react-output-target/runtime');
6
6
  require('react');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DXwd3F_r.js');
3
+ var index = require('./index-BRxlcrvE.js');
4
4
  var v4BdYh22OP = require('./v4-BdYh22OP-C1vaJ4yP.js');
5
5
  require('@stencil/react-output-target/runtime');
6
6
  require('react');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DXwd3F_r.js');
3
+ var index = require('./index-BRxlcrvE.js');
4
4
  var clsxChV9xqsO = require('./clsx-ChV9xqsO-BtxeOLZW.js');
5
5
  var v4BdYh22OP = require('./v4-BdYh22OP-C1vaJ4yP.js');
6
6
  require('@stencil/react-output-target/runtime');