@nova-design-system/nova-react 3.14.0 → 3.16.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 (67) hide show
  1. package/dist/cjs/{collapse.animation-acda1bf5-BuORVmQv.js → collapse.animation-6e0b08df-AHWzNGm_.js} +4 -1
  2. package/dist/cjs/{constants-d0f19e7b-s0SCO_vi.js → constants-69bafca2-DpB_ghPF.js} +9 -0
  3. package/dist/cjs/{fade.animation-eb454088-Bma0SpTf.js → fade.animation-9b939939-DV--bM4S.js} +2 -2
  4. package/dist/cjs/{index-CKAZvszR.js → index-7K7BV1CP.js} +4676 -1345
  5. package/dist/cjs/index.js +10 -2
  6. package/dist/cjs/{nv-accordion-item.entry-CjBcmF8t.js → nv-accordion-item.entry-C-9tYw-c.js} +6 -5
  7. package/dist/cjs/{nv-accordion.entry-CRk2Wvt3.js → nv-accordion.entry-BA3mTIdj.js} +7 -6
  8. package/dist/cjs/{nv-alert.entry-D5qB5xZg.js → nv-alert.entry-Bic-YGW1.js} +13 -12
  9. package/dist/cjs/nv-avatar.entry-C-yd0YlD.js +68 -0
  10. package/dist/cjs/{nv-badge_2.entry-BDuX1qOQ.js → nv-badge_2.entry-B_8yvNXL.js} +11 -10
  11. package/dist/cjs/{nv-breadcrumb.entry-BE9U6AF_.js → nv-breadcrumb.entry-BCTbG942.js} +3 -2
  12. package/dist/cjs/{nv-breadcrumbs.entry-DJXqtmMR.js → nv-breadcrumbs.entry-C9B5Baf7.js} +2 -1
  13. package/dist/cjs/nv-button.entry-DgX8Bwmq.js +165 -0
  14. package/dist/cjs/{nv-buttongroup.entry-C0Zc2lOi.js → nv-buttongroup.entry-CKhZN_Yf.js} +2 -1
  15. package/dist/cjs/{nv-calendar.entry-NbVLStMN.js → nv-calendar.entry-E6Pk83WA.js} +8 -7
  16. package/dist/cjs/{nv-col.entry-ahFf8a1Z.js → nv-col.entry-CkZpukX9.js} +2 -1
  17. package/dist/cjs/{nv-datagrid.entry-C-MJXEdi.js → nv-datagrid.entry-RsfP7vbC.js} +183 -15
  18. package/dist/cjs/{nv-datagridcolumn.entry-CxU7soW7.js → nv-datagridcolumn.entry-D4VrDWo9.js} +2 -1
  19. package/dist/cjs/{nv-dialog.entry-WlnaC-w2.js → nv-dialog.entry-BhtWpYHl.js} +34 -30
  20. package/dist/cjs/{nv-dialogfooter_2.entry-CEWmTnJc.js → nv-dialogfooter_2.entry-BXLYmzYl.js} +6 -5
  21. package/dist/cjs/{nv-fieldcheckbox.entry-BYhFVrYb.js → nv-fieldcheckbox.entry-D96Nm6DZ.js} +3 -2
  22. package/dist/cjs/{nv-fielddate.entry-DVVnRiOT.js → nv-fielddate.entry-ty37R9jF.js} +52 -26
  23. package/dist/cjs/{nv-fielddaterange.entry-Cb4X5Q-C.js → nv-fielddaterange.entry-BSIRu_mq.js} +69 -42
  24. package/dist/cjs/{nv-fielddropdown.entry-D2PKGkpx.js → nv-fielddropdown.entry-CUzvIoZZ.js} +34 -7
  25. package/dist/cjs/{nv-fielddropdownitem.entry-BqgMRnIc.js → nv-fielddropdownitem.entry-D-GTxLNk.js} +2 -1
  26. package/dist/cjs/{nv-fieldmultiselect.entry-Dzw4c9wO.js → nv-fieldmultiselect.entry-DFY2bf6s.js} +188 -156
  27. package/dist/cjs/{nv-fieldnumber.entry-Cm5g6tw7.js → nv-fieldnumber.entry-CILclJ7Q.js} +3 -2
  28. package/dist/cjs/{nv-fieldpassword.entry-BMI5M4RR.js → nv-fieldpassword.entry-CdR-NM8e.js} +3 -2
  29. package/dist/cjs/{nv-fieldradio.entry-BrCJvkMR.js → nv-fieldradio.entry-lC4scIvU.js} +3 -2
  30. package/dist/cjs/{nv-fieldselect.entry-Cz76Y4Fb.js → nv-fieldselect.entry-CYu6870F.js} +3 -2
  31. package/dist/cjs/{nv-fieldslider.entry-C2ynnMK8.js → nv-fieldslider.entry-DOuJAR6P.js} +3 -2
  32. package/dist/cjs/{nv-fieldtext.entry-B6ciu2fU.js → nv-fieldtext.entry-BFLUiPa4.js} +3 -2
  33. package/dist/cjs/{nv-fieldtextarea.entry-BL_gMvTp.js → nv-fieldtextarea.entry-BeI0k97G.js} +3 -2
  34. package/dist/cjs/{nv-fieldtime.entry-Be5fujXA.js → nv-fieldtime.entry-C28EAKki.js} +82 -68
  35. package/dist/cjs/nv-icon.entry-BXgjUpe_.js +80 -0
  36. package/dist/cjs/{nv-iconbutton_2.entry-Dlk96yHi.js → nv-iconbutton_2.entry-CpIkxrp9.js} +3 -2
  37. package/dist/cjs/{nv-menu.entry-CDn1Tk9J.js → nv-menu.entry-as-NOsF-.js} +25 -9
  38. package/dist/cjs/{nv-menuitem.entry-DIkQnha9.js → nv-menuitem.entry-D8KAh6nr.js} +2 -1
  39. package/dist/cjs/nv-notification.entry-C-_jV-DL.js +262 -0
  40. package/dist/cjs/nv-notificationcontainer.entry-CMn42loT.js +41 -0
  41. package/dist/cjs/{nv-popover.entry-Bz9ZWGlN.js → nv-popover.entry--BhEBSir.js} +72 -65
  42. package/dist/cjs/{nv-row.entry-iJGXINmZ.js → nv-row.entry-BxhcK9aY.js} +3 -2
  43. package/dist/cjs/{nv-stack.entry-CifEjR2g.js → nv-stack.entry-C3DF9jJZ.js} +3 -2
  44. package/dist/cjs/nv-table.entry-pfEGt2KH.js +245 -0
  45. package/dist/cjs/nv-toggle.entry-ChpqtQtn.js +80 -0
  46. package/dist/cjs/{nv-togglebutton.entry-X4eLeP-C.js → nv-togglebutton.entry-DE7CKmeN.js} +3 -2
  47. package/dist/cjs/{nv-togglebuttongroup.entry-BYO58vql.js → nv-togglebuttongroup.entry-BJPjdmHD.js} +3 -2
  48. package/dist/cjs/{nv-tooltip.entry-DaxjQSt1.js → nv-tooltip.entry-D9-Fga6C.js} +3 -2
  49. package/dist/components/NvDatatable.js +45 -0
  50. package/dist/generated/components.js +10 -10
  51. package/dist/generated/components.server.js +9 -17
  52. package/dist/index.js +2 -0
  53. package/dist/providers/NotificationProvider.js +83 -0
  54. package/dist/types/components/NvDatatable.d.ts +25 -0
  55. package/dist/types/generated/components.d.ts +5 -12
  56. package/dist/types/generated/components.server.d.ts +5 -12
  57. package/dist/types/index.d.ts +2 -0
  58. package/dist/types/providers/NotificationProvider.d.ts +36 -0
  59. package/package.json +7 -3
  60. package/dist/cjs/dom.utils-ac71e0ef-CmIwRr6O.js +0 -168
  61. package/dist/cjs/nv-avatar.entry-CuNYdZl_.js +0 -67
  62. package/dist/cjs/nv-button.entry-CF5IDcG3.js +0 -164
  63. package/dist/cjs/nv-icon.entry-C-wbfOy3.js +0 -79
  64. package/dist/cjs/nv-notification.entry-BiwnZCkF.js +0 -178
  65. package/dist/cjs/nv-table.entry-Dxg0j3fe.js +0 -338
  66. package/dist/cjs/nv-tablecolumn.entry--29MFEe9.js +0 -18
  67. package/dist/cjs/nv-toggle.entry-D0eQoEqf.js +0 -79
@@ -1,10 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-CKAZvszR.js');
3
+ var index = require('./index-7K7BV1CP.js');
4
4
  var v4A79185f4 = require('./v4-a79185f4-2n0dOd_Y.js');
5
5
  require('react');
6
+ require('react-dom');
6
7
 
7
- const nvFieldmultiselectCss = "nv-fieldslider .slider-container .track-container:has(.thumb:hover) .track-range{background:var(--components-slider-track-filled-hover)}nv-fieldslider .slider-container .track-container:has(.thumb:hover) .thumb{border-color:var(--components-slider-track-filled-hover)}nv-fieldslider .slider-container .track-container:has(.thumb:focus) .track-range{background:var(--components-slider-track-filled-focus)}nv-fieldslider .slider-container .track-container:has(.thumb:focus) .thumb{border-color:var(--components-slider-track-filled-focus)}nv-fieldslider[error] .slider-container .track-container .track .track-range{background:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb{border-color:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb:hover{border-color:var(--components-slider-track-filled-error);outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-slider-track-filled-error);outline-offset:calc(var(--focus-outline-offset) * 1);background-color:var(--components-slider-handler-background-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb:focus{border-color:var(--components-slider-track-filled-error);outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-slider-track-filled-error);outline-offset:calc(var(--focus-outline-offset) * 1);background-color:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container:has(.thumb:hover) .track-range{background:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container:has(.thumb:hover) .thumb{border-color:var(--components-slider-track-filled-error)}nv-fieldslider .slider-container .track-container:has(.thumb:hover) .track-range{background:var(--components-slider-track-filled-hover)}nv-fieldslider .slider-container .track-container:has(.thumb:hover) .thumb{border-color:var(--components-slider-track-filled-hover)}nv-fieldslider .slider-container .track-container:has(.thumb:focus) .track-range{background:var(--components-slider-track-filled-focus)}nv-fieldslider .slider-container .track-container:has(.thumb:focus) .thumb{border-color:var(--components-slider-track-filled-focus)}nv-fieldslider[error] .slider-container .track-container .track .track-range{background:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb{border-color:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb:hover{border-color:var(--components-slider-track-filled-error);outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-slider-track-filled-error);outline-offset:calc(var(--focus-outline-offset) * 1);background-color:var(--components-slider-handler-background-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb:focus{border-color:var(--components-slider-track-filled-error);outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-slider-track-filled-error);outline-offset:calc(var(--focus-outline-offset) * 1);background-color:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container:has(.thumb:hover) .track-range{background:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container:has(.thumb:hover) .thumb{border-color:var(--components-slider-track-filled-error)}nv-fieldmultiselect{--nv-field-border-default:var(--components-form-field-border-default);--nv-field-border-hover:var(--components-form-field-border-hover);--nv-field-border-focus:var(--components-form-field-border-focus);--nv-field-border-disabled:var(--components-form-field-border-default);--nv-field-border-readonly:var(--components-form-field-border-default);--nv-field-focus-box-shadow:var(--color-focus-brand);--nv-field-background:var(--components-form-field-background-default);display:flex;flex-direction:column;align-items:flex-start;gap:var(--form-gap-y);box-sizing:border-box;max-width:480px}nv-fieldmultiselect[fluid]:not([fluid=false]){max-width:unset}nv-fieldmultiselect[readonly]:not([readonly=false]){--nv-field-border-default:var(--components-form-field-border-readonly);--nv-field-border-hover:var(--nv-field-border-default);--nv-field-border-focus:var(--components-form-field-border-focus);--nv-field-border-disabled:var(--nv-field-border-default);--nv-field-border-readonly:var(--nv-field-border-default);--nv-field-background:var(--components-form-field-background-readonly)}nv-fieldmultiselect[error]:not([error=false]){--nv-field-border-default:var(--components-form-field-border-error);--nv-field-border-hover:var(--nv-field-border-default);--nv-field-border-focus:var(--nv-field-border-default);--nv-field-border-disabled:var(--nv-field-border-default);--nv-field-border-readonly:var(--nv-field-border-default);--nv-field-focus-box-shadow:var(--color-focus-destructive-in-field)}nv-fieldmultiselect[required]:not([required=false]) label::after{content:\"*\";color:var(--components-form-text-required);font-weight:700}nv-fieldmultiselect label{display:flex;align-items:center;gap:var(--form-label-gap);align-self:stretch;color:var(--components-form-text-label-default);font-family:\"TT Norms Pro\", sans-serif;font-size:var(--form-label-font-size);font-style:normal;font-weight:500;line-height:var(--form-label-line-height)}nv-fieldmultiselect nv-popover{width:100%;display:block}nv-fieldmultiselect nv-popover [data-scope=popover]{width:100%;padding:var(--list-dropdown-padding);border-radius:var(--list-dropdown-radius);background-color:var(--components-list-dropdown-background);border:1px solid var(--components-list-dropdown-border)}nv-fieldmultiselect nv-popover [slot=content]{gap:var(--list-dropdown-gap-y);display:flex;flex-direction:column}nv-fieldmultiselect nv-popover hr{color:var(--components-list-dropdown-separator)}nv-fieldmultiselect nv-popover div[slot=content]{max-height:calc(90vh - var(--list-dropdown-padding) * 2);overflow-y:auto;position:relative}nv-fieldmultiselect nv-popover div[slot=content]::-webkit-scrollbar{width:6px;height:6px}nv-fieldmultiselect nv-popover div[slot=content]::-webkit-scrollbar-track{background-color:var(--color-level-10-background);border-radius:9999px}nv-fieldmultiselect nv-popover div[slot=content]::-webkit-scrollbar-thumb{background-color:var(--color-gray-200);border-radius:9999px}nv-fieldmultiselect .input-wrapper-multiselect{display:flex;flex-wrap:wrap;gap:var(--form-gap-x);align-items:stretch;align-self:stretch;width:100%}nv-fieldmultiselect .input-container-multiselect{display:flex;flex-grow:1;justify-content:center;align-items:center;align-self:stretch;border-radius:var(--form-field-radius);border-width:1px;border-style:solid;border-color:var(--nv-field-border-default);opacity:var(--components-form-opacity-default, 1);background:var(--nv-field-background);transition:all 150ms ease-out;position:relative;width:100%;min-height:40px}nv-fieldmultiselect .input-container-multiselect:hover{border-color:var(--nv-field-border-hover)}nv-fieldmultiselect .input-container-multiselect:focus-within,nv-fieldmultiselect .input-container-multiselect:focus-within:hover,nv-fieldmultiselect .input-container-multiselect:focus,nv-fieldmultiselect .input-container-multiselect:focus:hover{border-color:var(--nv-field-border-focus);box-shadow:0px 0px 0px var(--focus-field-stroke) var(--nv-field-focus-box-shadow)}nv-fieldmultiselect .input-container-multiselect:has(input:read-only){opacity:0.5;background-color:var(--components-form-field-background-readonly);border-color:var(--nv-field-border-readonly)}nv-fieldmultiselect .input-container-multiselect:has(input:disabled){opacity:0.5;background-color:var(--components-form-field-background-disabled);border-color:var(--nv-field-border-disabled)}nv-fieldmultiselect .input-container-multiselect>nv-badge{margin-left:var(--form-field-padding-x)}nv-fieldmultiselect .input-container-multiselect input,nv-fieldmultiselect .input-container-multiselect p.non-filterable-text{display:flex;align-items:center;flex:1 0 0;overflow:hidden;background-color:transparent;color:var(--components-form-field-content-text);padding:var(--form-field-padding-y) var(--form-field-padding-x);font-size:var(--form-field-font-size);font-style:normal;font-weight:500;line-height:var(--form-field-line-height);width:100%;width:100%;flex-grow:1;margin:0;min-height:100%;box-sizing:border-box}nv-fieldmultiselect .input-container-multiselect input:focus,nv-fieldmultiselect .input-container-multiselect p.non-filterable-text:focus{outline:none}nv-fieldmultiselect .input-container-multiselect input::placeholder,nv-fieldmultiselect .input-container-multiselect p.non-filterable-text::placeholder{overflow:hidden;color:var(--components-form-field-content-placeholder);text-overflow:ellipsis;font-family:\"TT Norms Pro\", sans-serif;font-size:var(--form-field-font-size);font-style:normal;font-weight:400;line-height:var(--form-field-line-height)}nv-fieldmultiselect .input-container-multiselect input[type=password]::-ms-clear,nv-fieldmultiselect .input-container-multiselect input[type=password]::-ms-reveal,nv-fieldmultiselect .input-container-multiselect p.non-filterable-text[type=password]::-ms-clear,nv-fieldmultiselect .input-container-multiselect p.non-filterable-text[type=password]::-ms-reveal{display:none;width:0;height:0}nv-fieldmultiselect .input-container-multiselect>nv-iconbutton{border:0px;border-radius:0px}nv-fieldmultiselect .input-container-multiselect>nv-iconbutton:focus-visible{border-radius:var(--button-md-border-radius);outline-offset:-3px}nv-fieldmultiselect .input-container-multiselect>nv-iconbutton:last-of-type{border-top-right-radius:var(--form-field-radius);border-bottom-right-radius:var(--form-field-radius)}nv-fieldmultiselect .input-container-multiselect nv-icon.validation{color:var(--nv-field-border-default)}nv-fieldmultiselect .non-filterable-text{display:block;border-radius:var(--form-field-radius);background-color:var(--nv-field-background);color:var(--components-form-field-content-text);font-size:var(--form-field-font-size);font-weight:500;line-height:var(--form-field-line-height);box-sizing:border-box;cursor:pointer;height:100%;min-height:40px}nv-fieldmultiselect .non-filterable-text span{display:inline-block;width:100%;overflow:hidden;text-overflow:ellipsis}nv-fieldmultiselect .description{display:flex;align-items:center;align-self:stretch;gap:var(--spacing-1);color:var(--components-form-text-description-default);font-family:\"TT Norms Pro\", sans-serif;font-size:var(--form-description-font-size);font-style:normal;line-height:var(--form-description-line-height)}nv-fieldmultiselect .error-description{display:flex;align-items:center;align-self:stretch;gap:var(--spacing-1);color:var(--components-form-text-description-default);font-family:\"TT Norms Pro\", sans-serif;font-size:var(--form-description-font-size);font-style:normal;line-height:var(--form-description-line-height);color:var(--components-form-text-description-error)}.no-results-message{cursor:not-allowed;background-color:unset;color:var(--components-menu-contextual-item-content-disabled);padding:var(--list-dropdown-item-padding-y) var(--list-dropdown-item-padding-x)}.multiselect-divider{display:block;width:100%;height:1px;background-color:var(--components-list-dropdown-separator);margin:var(--list-dropdown-item-padding-y) 0;border:0}.select-all-container{position:sticky;top:0;background-color:var(--components-list-dropdown-background);border-bottom:1px solid var(--components-list-dropdown-separator);padding:var(--list-dropdown-item-padding-y) var(--list-dropdown-item-padding-x);z-index:10;margin-bottom:0}.select-all-container .select-all-header{display:flex;align-items:center;gap:var(--form-field-gap)}.select-all-container .select-all-header nv-fieldcheckbox{flex:1;margin:0}.select-all-container .select-all-header nv-iconbutton,.select-all-container .select-all-header nv-button{flex-shrink:0;margin-left:auto}.select-all-container .select-all-header nv-button{justify-content:center}";
8
+ const nvFieldmultiselectCss = "nv-fieldslider .slider-container .track-container:has(.thumb:hover) .track-range{background:var(--components-slider-track-filled-hover)}nv-fieldslider .slider-container .track-container:has(.thumb:hover) .thumb{border-color:var(--components-slider-track-filled-hover)}nv-fieldslider .slider-container .track-container:has(.thumb:focus) .track-range{background:var(--components-slider-track-filled-focus)}nv-fieldslider .slider-container .track-container:has(.thumb:focus) .thumb{border-color:var(--components-slider-track-filled-focus)}nv-fieldslider[error] .slider-container .track-container .track .track-range{background:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb{border-color:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb:hover{border-color:var(--components-slider-track-filled-error);outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-slider-track-filled-error);outline-offset:calc(var(--focus-outline-offset) * 1);background-color:var(--components-slider-handler-background-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb:focus{border-color:var(--components-slider-track-filled-error);outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-slider-track-filled-error);outline-offset:calc(var(--focus-outline-offset) * 1);background-color:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container:has(.thumb:hover) .track-range{background:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container:has(.thumb:hover) .thumb{border-color:var(--components-slider-track-filled-error)}nv-fieldslider .slider-container .track-container:has(.thumb:hover) .track-range{background:var(--components-slider-track-filled-hover)}nv-fieldslider .slider-container .track-container:has(.thumb:hover) .thumb{border-color:var(--components-slider-track-filled-hover)}nv-fieldslider .slider-container .track-container:has(.thumb:focus) .track-range{background:var(--components-slider-track-filled-focus)}nv-fieldslider .slider-container .track-container:has(.thumb:focus) .thumb{border-color:var(--components-slider-track-filled-focus)}nv-fieldslider[error] .slider-container .track-container .track .track-range{background:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb{border-color:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb:hover{border-color:var(--components-slider-track-filled-error);outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-slider-track-filled-error);outline-offset:calc(var(--focus-outline-offset) * 1);background-color:var(--components-slider-handler-background-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb:focus{border-color:var(--components-slider-track-filled-error);outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-slider-track-filled-error);outline-offset:calc(var(--focus-outline-offset) * 1);background-color:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container:has(.thumb:hover) .track-range{background:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container:has(.thumb:hover) .thumb{border-color:var(--components-slider-track-filled-error)}nv-fieldmultiselect{--nv-field-border-default:var(--components-form-field-border-default);--nv-field-border-hover:var(--components-form-field-border-hover);--nv-field-border-focus:var(--components-form-field-border-focus);--nv-field-border-disabled:var(--components-form-field-border-default);--nv-field-border-readonly:var(--components-form-field-border-default);--nv-field-focus-box-shadow:var(--color-focus-brand);--nv-field-background:var(--components-form-field-background-default);display:flex;flex-direction:column;align-items:flex-start;gap:var(--form-gap-y);box-sizing:border-box;max-width:480px}nv-fieldmultiselect[fluid]:not([fluid=false]){max-width:unset}nv-fieldmultiselect[readonly]:not([readonly=false]){--nv-field-border-default:var(--components-form-field-border-readonly);--nv-field-border-hover:var(--nv-field-border-default);--nv-field-border-focus:var(--components-form-field-border-focus);--nv-field-border-disabled:var(--nv-field-border-default);--nv-field-border-readonly:var(--nv-field-border-default);--nv-field-background:var(--components-form-field-background-readonly)}nv-fieldmultiselect[error]:not([error=false]){--nv-field-border-default:var(--components-form-field-border-error);--nv-field-border-hover:var(--nv-field-border-default);--nv-field-border-focus:var(--nv-field-border-default);--nv-field-border-disabled:var(--nv-field-border-default);--nv-field-border-readonly:var(--nv-field-border-default);--nv-field-focus-box-shadow:var(--color-focus-destructive-in-field)}nv-fieldmultiselect[required]:not([required=false]) label::after{content:\"*\";color:var(--components-form-text-required);font-weight:var(--font-weight-high-emphasis)}nv-fieldmultiselect label{display:flex;align-items:center;gap:var(--form-label-gap);align-self:stretch;color:var(--components-form-text-label-default);font-family:var(--font-family-default), var(--font-family-fallback), sans-serif;font-size:var(--form-label-font-size);font-style:normal;font-weight:var(--font-weight-medium-emphasis);line-height:var(--form-label-line-height)}nv-fieldmultiselect nv-popover{width:100%;display:block}nv-fieldmultiselect nv-popover [data-scope=popover]{width:100%;padding:var(--list-dropdown-padding);border-radius:var(--list-dropdown-radius);background-color:var(--components-list-dropdown-background);border:1px solid var(--components-list-dropdown-border)}nv-fieldmultiselect nv-popover [slot=content]{gap:var(--list-dropdown-gap-y);display:flex;flex-direction:column}nv-fieldmultiselect nv-popover hr{color:var(--components-list-dropdown-separator)}nv-fieldmultiselect nv-popover div[slot=content]{max-height:calc(90vh - var(--list-dropdown-padding) * 2);overflow-y:auto;position:relative}nv-fieldmultiselect nv-popover div[slot=content]::-webkit-scrollbar{width:6px;height:6px}nv-fieldmultiselect nv-popover div[slot=content]::-webkit-scrollbar-track{background-color:var(--color-level-10-background);border-radius:9999px}nv-fieldmultiselect nv-popover div[slot=content]::-webkit-scrollbar-thumb{background-color:var(--color-gray-200);border-radius:9999px}nv-fieldmultiselect .input-wrapper-multiselect{display:flex;flex-wrap:wrap;gap:var(--form-gap-x);align-items:stretch;align-self:stretch;width:100%}nv-fieldmultiselect .input-container-multiselect{display:flex;flex-grow:1;justify-content:center;align-items:center;align-self:stretch;border-radius:var(--form-field-radius);border-width:1px;border-style:solid;border-color:var(--nv-field-border-default);opacity:var(--components-form-opacity-default, 1);background:var(--nv-field-background);transition:all 150ms ease-out;position:relative;width:100%;min-height:40px}nv-fieldmultiselect .input-container-multiselect:hover{border-color:var(--nv-field-border-hover)}nv-fieldmultiselect .input-container-multiselect:focus-within,nv-fieldmultiselect .input-container-multiselect:focus-within:hover,nv-fieldmultiselect .input-container-multiselect:focus,nv-fieldmultiselect .input-container-multiselect:focus:hover{border-color:var(--nv-field-border-focus);box-shadow:0px 0px 0px var(--focus-field-stroke) var(--nv-field-focus-box-shadow)}nv-fieldmultiselect .input-container-multiselect:has(input:read-only){opacity:0.5;background-color:var(--components-form-field-background-readonly);border-color:var(--nv-field-border-readonly)}nv-fieldmultiselect .input-container-multiselect:has(input:disabled){opacity:0.5;background-color:var(--components-form-field-background-disabled);border-color:var(--nv-field-border-disabled)}nv-fieldmultiselect .input-container-multiselect>nv-badge{margin-left:var(--form-field-padding-x)}nv-fieldmultiselect .input-container-multiselect input,nv-fieldmultiselect .input-container-multiselect p.non-filterable-text{display:flex;align-items:center;flex:1 0 0;overflow:hidden;background-color:transparent;color:var(--components-form-field-content-text);padding:var(--form-field-padding-y) var(--form-field-padding-x);font-size:var(--form-field-font-size);font-style:normal;font-weight:var(--font-weight-medium-emphasis);line-height:var(--form-field-line-height);width:100%;width:100%;flex-grow:1;margin:0;min-height:100%;box-sizing:border-box}nv-fieldmultiselect .input-container-multiselect input:focus,nv-fieldmultiselect .input-container-multiselect p.non-filterable-text:focus{outline:none}nv-fieldmultiselect .input-container-multiselect input::placeholder,nv-fieldmultiselect .input-container-multiselect p.non-filterable-text::placeholder{overflow:hidden;color:var(--components-form-field-content-placeholder);text-overflow:ellipsis;font-family:var(--font-family-default), var(--font-family-fallback), sans-serif;font-size:var(--form-field-font-size);font-style:normal;font-weight:var(--font-weight-low-emphasis);line-height:var(--form-field-line-height)}nv-fieldmultiselect .input-container-multiselect input[type=password]::-ms-clear,nv-fieldmultiselect .input-container-multiselect input[type=password]::-ms-reveal,nv-fieldmultiselect .input-container-multiselect p.non-filterable-text[type=password]::-ms-clear,nv-fieldmultiselect .input-container-multiselect p.non-filterable-text[type=password]::-ms-reveal{display:none;width:0;height:0}nv-fieldmultiselect .input-container-multiselect>nv-iconbutton{border:0px;border-radius:0px}nv-fieldmultiselect .input-container-multiselect>nv-iconbutton:focus-visible{border-radius:var(--button-md-border-radius);outline-offset:-3px}nv-fieldmultiselect .input-container-multiselect>nv-iconbutton:last-of-type{border-top-right-radius:var(--form-field-radius);border-bottom-right-radius:var(--form-field-radius)}nv-fieldmultiselect .input-container-multiselect nv-icon.validation{color:var(--nv-field-border-default)}nv-fieldmultiselect .non-filterable-text{display:block;border-radius:var(--form-field-radius);background-color:var(--nv-field-background);color:var(--components-form-field-content-text);font-size:var(--form-field-font-size);font-weight:var(--font-weight-medium-emphasis);line-height:var(--form-field-line-height);box-sizing:border-box;cursor:pointer;height:100%;min-height:40px}nv-fieldmultiselect .non-filterable-text span{display:inline-block;width:100%;overflow:hidden;text-overflow:ellipsis}nv-fieldmultiselect .description{display:flex;align-items:center;align-self:stretch;gap:var(--spacing-1);color:var(--components-form-text-description-default);font-family:var(--font-family-default), var(--font-family-fallback), sans-serif;font-size:var(--form-description-font-size);font-style:normal;line-height:var(--form-description-line-height)}nv-fieldmultiselect .error-description{display:flex;align-items:center;align-self:stretch;gap:var(--spacing-1);color:var(--components-form-text-description-default);font-family:var(--font-family-default), var(--font-family-fallback), sans-serif;font-size:var(--form-description-font-size);font-style:normal;line-height:var(--form-description-line-height);color:var(--components-form-text-description-error)}.no-results-message{cursor:not-allowed;background-color:unset;color:var(--components-menu-contextual-item-content-disabled);padding:var(--list-dropdown-item-padding-y) var(--list-dropdown-item-padding-x)}.multiselect-divider{display:block;width:100%;height:1px;background-color:var(--components-list-dropdown-separator);margin:var(--list-dropdown-item-padding-y) 0;border:0}.select-all-container{position:sticky;top:0;background-color:var(--components-list-dropdown-background);border-bottom:1px solid var(--components-list-dropdown-separator);padding:var(--list-dropdown-item-padding-y) var(--list-dropdown-item-padding-x);z-index:10;margin-bottom:0}.select-all-container .select-all-header{display:flex;align-items:center;gap:var(--form-field-gap)}.select-all-container .select-all-header nv-fieldcheckbox{flex:1;margin:0}.select-all-container .select-all-header nv-iconbutton,.select-all-container .select-all-header nv-button{flex-shrink:0;margin-left:auto}.select-all-container .select-all-header nv-button{justify-content:center}";
8
9
  const NvFieldmultiselectStyle0 = nvFieldmultiselectCss;
9
10
 
10
11
  const NvFieldmultiselect = class {
@@ -13,6 +14,8 @@ const NvFieldmultiselect = class {
13
14
  this.valueChanged = index.createEvent(this, "valueChanged");
14
15
  this.filterTextChanged = index.createEvent(this, "filterTextChanged");
15
16
  this.isBulkOperation = false;
17
+ // Add the flag to the class
18
+ this.preventBlurClose = false;
16
19
  /**
17
20
  * Sets the ID for the input element and the for attribute of the associated
18
21
  * label. If no ID is provided, a random one will be automatically generated
@@ -118,11 +121,6 @@ const NvFieldmultiselect = class {
118
121
  * Controls the visibility of the select all section.
119
122
  */
120
123
  this.isSelectAllSectionVisible = true;
121
- // Add the flag to the class
122
- this.preventBlurClose = false;
123
- this.handleMouseDownPreventBlur = () => {
124
- this.preventBlurClose = true;
125
- };
126
124
  /**
127
125
  * Handle badge close for options mode.
128
126
  */
@@ -166,17 +164,16 @@ const NvFieldmultiselect = class {
166
164
  if (this.isHandlingEscape) {
167
165
  return;
168
166
  }
169
- // Reset filter if needed, but preserve the filter text
170
- if (this.filterable) {
171
- this.resetFilter();
172
- }
167
+ // Filter reset is handled in handleOpenChanged; no need to repeat
173
168
  };
174
169
  /**
175
170
  * Clear the filter text
176
171
  */
177
172
  this.clearFilterText = () => {
178
- this.filterText = '';
179
- this.filterTextChanged.emit('');
173
+ if (this.filterText !== '') {
174
+ this.filterText = '';
175
+ this.filterTextChanged.emit('');
176
+ }
180
177
  this.resetFilter();
181
178
  this.hasFilterResults = true;
182
179
  };
@@ -190,11 +187,9 @@ const NvFieldmultiselect = class {
190
187
  return; // Don't close the popover
191
188
  }
192
189
  if (!this.el.contains(document.activeElement)) {
193
- // Close the popover without affecting the divider
194
- this.open = false;
195
- // Clear filter text when focus is lost
190
+ this.open = false; // Close the popover on blur
196
191
  if (this.filterable) {
197
- this.clearFilterText();
192
+ this.clearFilterText(); // Clear filter text on blur
198
193
  }
199
194
  }
200
195
  }, 150);
@@ -307,17 +302,14 @@ const NvFieldmultiselect = class {
307
302
  */
308
303
  this.handleInputBlurSlots = () => {
309
304
  setTimeout(() => {
310
- // Honor preventBlurClose to avoid closing when interacting inside the popover
311
305
  if (this.preventBlurClose) {
312
306
  this.preventBlurClose = false;
313
307
  return; // Don't close the popover
314
308
  }
315
309
  if (!this.el.contains(document.activeElement)) {
316
- // Close the popover without affecting the divider
317
- this.open = false;
318
- // Clear filter text when focus is lost
310
+ this.open = false; // Close the popover on blur
319
311
  if (this.filterable) {
320
- this.clearFilterText();
312
+ this.clearFilterText(); // Clear filter text on blur
321
313
  }
322
314
  }
323
315
  }, 150);
@@ -444,6 +436,9 @@ const NvFieldmultiselect = class {
444
436
  const shouldSelectAll = currentState === 'unchecked' || currentState === 'indeterminate';
445
437
  this.toggleSelectAllSlots(shouldSelectAll);
446
438
  };
439
+ this.handleMouseDownPreventBlur = () => {
440
+ this.preventBlurClose = true;
441
+ };
447
442
  //#endregion METHODS
448
443
  /****************************************************************************/
449
444
  //#region RENDER
@@ -452,7 +447,8 @@ const NvFieldmultiselect = class {
452
447
  * @returns {any} The JSX for options mode
453
448
  */
454
449
  this.renderOptionsMode = () => {
455
- return (index.h(index.Host, { "aria-label": this.label }, (this.label || this.el.querySelector('[slot="label"]')) && (index.h("label", { htmlFor: this.inputId }, index.h("slot", { name: "label" }, this.label))), index.h("nv-popover", { ref: el => (this.popoverElement = el), triggerMode: "controlled", placement: "bottom-start", open: this.open }, index.h("div", { class: "input-wrapper-multiselect", slot: "trigger" }, index.h("slot", { name: "before-input" }), index.h("div", { class: "input-container-multiselect" }, index.h("slot", { name: "leading-input" }), this.value.length > 0 && (index.h("nv-badge", { slot: "leading-input", "prevent-auto-close": true, color: "10", dismissible: this.value.length > 0, label: `${this.value.length} ${this.badgeLabel}`, "aria-label": `Clear all ${this.value.length} ${this.badgeLabel} items`, onCloseClicked: this.handleBadgeCloseOptions })), this.filterable || this.disabled || this.readonly ? (index.h("input", { type: "text", id: this.inputId, ref: e => (this.inputElement = e), autofocus: this.autofocus, autocomplete: this.autocomplete, placeholder: this.placeholder, name: this.name, value: this.filterText, required: this.required, disabled: this.disabled, readOnly: this.readonly, onInput: this.handleInputOptions, onFocus: this.handleInputFocusOptions, onBlur: this.handleInputBlurOptions, onKeyDown: this.handleKeyDown, "data-scope": "focusable", "aria-label": this.label, "aria-controls": `${this.inputId}-listbox` })) : (index.h(index.Fragment, null, index.h("input", { id: this.inputId, type: "text", style: {
450
+ var _a, _b, _c, _d;
451
+ return (index.h(index.Host, { "aria-label": this.label }, (this.label || this.el.querySelector('[slot="label"]')) && (index.h("label", { htmlFor: this.inputId }, index.h("slot", { name: "label" }, this.label))), index.h("nv-popover", { ref: el => (this.popoverElement = el), triggerMode: "controlled", placement: "bottom-start", open: this.open }, index.h("div", { class: "input-wrapper-multiselect", slot: "trigger" }, index.h("slot", { name: "before-input" }), index.h("div", { class: "input-container-multiselect" }, index.h("slot", { name: "leading-input" }), (((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) || 0) > 0 && (index.h("nv-badge", { slot: "leading-input", "prevent-auto-close": true, color: "10", dismissible: (((_b = this.value) === null || _b === void 0 ? void 0 : _b.length) || 0) > 0, label: `${((_c = this.value) === null || _c === void 0 ? void 0 : _c.length) || 0} ${this.badgeLabel}`, "aria-label": `Clear all ${((_d = this.value) === null || _d === void 0 ? void 0 : _d.length) || 0} ${this.badgeLabel} items`, onCloseClicked: this.handleBadgeCloseOptions })), this.filterable || this.disabled || this.readonly ? (index.h("input", { type: "text", id: this.inputId, ref: e => (this.inputElement = e), autofocus: this.autofocus, autocomplete: this.autocomplete, placeholder: this.placeholder, name: this.name, value: this.filterText, required: this.required, disabled: this.disabled, readOnly: this.readonly, onInput: this.handleInputOptions, onFocus: this.handleInputFocusOptions, onBlur: this.handleInputBlurOptions, onKeyDown: this.handleKeyDown, "data-scope": "focusable", "aria-label": this.label, "aria-controls": `${this.inputId}-listbox` })) : (index.h(index.Fragment, null, index.h("input", { id: this.inputId, type: "text", style: {
456
452
  position: 'absolute',
457
453
  opacity: '0',
458
454
  width: '0',
@@ -461,14 +457,15 @@ const NvFieldmultiselect = class {
461
457
  }, tabIndex: -1, "aria-hidden": "true", autoComplete: this.autocomplete, name: this.name, onFocus: this.handleInputFocusOptions }), index.h("p", { id: this.inputId, class: "non-filterable-text", onClick: this.handleInputContainerClickOptions, tabIndex: 0, onKeyDown: this.handleKeyDown, onFocus: this.handleInputFocusOptions, "aria-label": this.label, "aria-controls": `${this.inputId}-listbox`, "data-scope": "focusable", role: "button" }, index.h("span", null, this.placeholder)))), this.error && (index.h("nv-icon", { name: "alert-circle", class: "validation", size: "md" })), this.filterable && this.filterText.length > 0 && (index.h("nv-iconbutton", { "data-scope": "clear-filter", name: "x", size: "md", emphasis: "lower", "aria-label": "Clear filter text", tabindex: "-1", title: "Clear filter text", onMouseDown: this.handleMouseDownPreventBlur, onClick: this.clearFilterText })), index.h("nv-iconbutton", { "data-scope": "toggle-dropdown", name: this.open ? 'chevron-top' : 'chevron-down', size: "md", emphasis: "lower", "aria-label": this.open ? 'Hide dropdown' : 'Show dropdown', title: this.open ? 'Hide dropdown' : 'Show dropdown', onMouseDown: this.handleMouseDownPreventBlur, onClick: this.togglePopoverOptions })), index.h("slot", { name: "after-input" })), index.h("div", { id: `${this.inputId}-listbox`, slot: "content", style: this.maxHeight ? { maxHeight: this.maxHeight } : {}, onMouseDown: this.handleMouseDownPreventBlur }, this.shouldShowToggleAllOptionsButton() && (index.h("div", { class: "select-all-container" }, index.h("div", { class: "select-all-header" }, this.isSelectAllSectionVisible && (index.h("nv-fieldcheckbox", { checked: this.getSelectAllCheckboxStateOptions() === 'checked', indeterminate: this.getSelectAllCheckboxStateOptions() ===
462
458
  'indeterminate', label: this.getSelectAllCheckboxStateOptions() === 'unchecked'
463
459
  ? this.selectAllLabel
464
- : this.deselectAllLabel, onMouseDown: this.handleMouseDownPreventBlur, onClick: this.handleSelectAllCheckboxOptionsClick }))))), index.h("ul", { role: "listbox", "aria-multiselectable": "true" }, this.options.map(option => (index.h("nv-fielddropdownitemcheck", { role: "option", label: option.label, description: option.description, value: option.value, checked: this.value.includes(option.value), disabled: option.disabled })))))), this.renderDescriptions()));
460
+ : this.deselectAllLabel, onMouseDown: this.handleMouseDownPreventBlur, onClick: this.handleSelectAllCheckboxOptionsClick }))))), index.h("ul", { role: "listbox", "aria-multiselectable": "true" }, this.options.map(option => (index.h("nv-fielddropdownitemcheck", { role: "option", label: option.label, description: option.description, value: option.value, checked: (this.value || []).includes(option.value), disabled: option.disabled })))))), this.renderDescriptions()));
465
461
  };
466
462
  /**
467
463
  * Renders the component in slots mode
468
464
  * @returns {any} The JSX for slots mode
469
465
  */
470
466
  this.renderSlotsMode = () => {
471
- return (index.h(index.Host, { "aria-label": this.label }, (this.label || this.el.querySelector('[slot="label"]')) && (index.h("label", { htmlFor: this.inputId }, index.h("slot", { name: "label" }, this.label))), index.h("nv-popover", { ref: el => (this.popoverElement = el), triggerMode: "controlled", placement: "bottom-start", open: this.open }, index.h("div", { class: "input-wrapper-multiselect", slot: "trigger" }, index.h("slot", { name: "before-input" }), index.h("div", { class: "input-container-multiselect", onClick: this.handleInputContainerClickSlots }, index.h("slot", { name: "leading-input" }), this.value.length > 0 && (index.h("nv-badge", { slot: "leading-input", "prevent-auto-close": true, color: "10", dismissible: this.value.length > 0, label: `${this.value.length} ${this.badgeLabel}`, "aria-label": `Clear all ${this.value.length} ${this.badgeLabel} items`, onCloseClicked: this.handleBadgeCloseSlots })), this.filterable || this.disabled || this.readonly ? (index.h("input", { id: this.inputId, ref: e => (this.inputElement = e), autocomplete: this.autocomplete, placeholder: this.placeholder, name: this.name, value: this.filterText, required: this.required, disabled: this.disabled, readOnly: this.readonly, onInput: this.handleInputSlots, onFocus: this.handleInputFocusSlots, onBlur: this.handleInputBlurSlots, onKeyDown: this.handleKeyDown, "data-scope": "focusable", "aria-label": this.label, "aria-controls": `${this.inputId}-listbox` })) : (index.h(index.Fragment, null, index.h("input", { id: this.inputId, type: "text", style: {
467
+ var _a, _b, _c, _d;
468
+ return (index.h(index.Host, { "aria-label": this.label }, (this.label || this.el.querySelector('[slot="label"]')) && (index.h("label", { htmlFor: this.inputId }, index.h("slot", { name: "label" }, this.label))), index.h("nv-popover", { ref: el => (this.popoverElement = el), triggerMode: "controlled", placement: "bottom-start", open: this.open }, index.h("div", { class: "input-wrapper-multiselect", slot: "trigger" }, index.h("slot", { name: "before-input" }), index.h("div", { class: "input-container-multiselect", onClick: this.handleInputContainerClickSlots }, index.h("slot", { name: "leading-input" }), (((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) || 0) > 0 && (index.h("nv-badge", { slot: "leading-input", "prevent-auto-close": true, color: "10", dismissible: (((_b = this.value) === null || _b === void 0 ? void 0 : _b.length) || 0) > 0, label: `${((_c = this.value) === null || _c === void 0 ? void 0 : _c.length) || 0} ${this.badgeLabel}`, "aria-label": `Clear all ${((_d = this.value) === null || _d === void 0 ? void 0 : _d.length) || 0} ${this.badgeLabel} items`, onCloseClicked: this.handleBadgeCloseSlots })), this.filterable || this.disabled || this.readonly ? (index.h("input", { id: this.inputId, ref: e => (this.inputElement = e), autocomplete: this.autocomplete, placeholder: this.placeholder, name: this.name, value: this.filterText, required: this.required, disabled: this.disabled, readOnly: this.readonly, onInput: this.handleInputSlots, onFocus: this.handleInputFocusSlots, onBlur: this.handleInputBlurSlots, onKeyDown: this.handleKeyDown, "data-scope": "focusable", "aria-label": this.label, "aria-controls": `${this.inputId}-listbox` })) : (index.h(index.Fragment, null, index.h("input", { id: this.inputId, type: "text", style: {
472
469
  position: 'absolute',
473
470
  opacity: '0',
474
471
  width: '0',
@@ -488,7 +485,7 @@ const NvFieldmultiselect = class {
488
485
  return;
489
486
  // If the parent has set a value prop, use it. Otherwise, derive from checked options.
490
487
  // (Assume: if value is undefined, it's not set by parent; if it's an array, it's set.)
491
- if (this.value === undefined || this.value.length === 0) {
488
+ if (!this.value || this.value.length === 0) {
492
489
  this.value = newValue
493
490
  .filter(option => option.checked)
494
491
  .map(option => option.value);
@@ -496,7 +493,7 @@ const NvFieldmultiselect = class {
496
493
  else {
497
494
  // If value is set, ensure checked states in options match value
498
495
  newValue.forEach(option => {
499
- option.checked = this.value.includes(option.value);
496
+ option.checked = (this.value || []).includes(option.value);
500
497
  });
501
498
  }
502
499
  this.reorderOptionsContent();
@@ -513,10 +510,24 @@ const NvFieldmultiselect = class {
513
510
  // Also, update options checked state if options exist
514
511
  if (this.options) {
515
512
  this.options.forEach(option => {
516
- option.checked = this.value.includes(option.value);
513
+ option.checked = (this.value || []).includes(option.value);
517
514
  });
518
515
  }
519
516
  }
517
+ handleOpenChange(newOpen) {
518
+ // React to external changes, e.g., reorder or filter
519
+ if (newOpen) {
520
+ if (this.options) {
521
+ this.reorderOptionsContent();
522
+ }
523
+ else {
524
+ this.reorderSlotContent();
525
+ }
526
+ if (this.filterText) {
527
+ this.filterItems();
528
+ }
529
+ }
530
+ }
520
531
  //#endregion WATCHERS
521
532
  /****************************************************************************/
522
533
  //#region LISTENERS
@@ -527,23 +538,33 @@ const NvFieldmultiselect = class {
527
538
  handleOpenChanged(event) {
528
539
  // Stop propagation to prevent the event from affecting parent components like dialogs
529
540
  event.stopPropagation();
530
- // Update `open` based on the popover state
531
- this.open = event.detail;
532
- if (this.open) {
533
- // Filter items only if there is filter text
534
- if (this.filterText) {
535
- this.filterItems();
541
+ // Only update if the event comes from our popover
542
+ if (event.target === this.popoverElement) {
543
+ // Only update if open state differs to avoid redundant actions
544
+ if (this.open !== event.detail) {
545
+ this.open = event.detail;
546
+ if (this.open) {
547
+ // Filter items only if there is filter text
548
+ if (this.filterText) {
549
+ this.filterItems();
550
+ }
551
+ }
552
+ else {
553
+ // Clear filter text on close if filterable
554
+ if (this.filterable) {
555
+ this.clearFilterText();
556
+ }
557
+ this.handlePopoverClose();
558
+ }
559
+ // Reorder content as needed
560
+ if (this.options) {
561
+ this.reorderOptionsContent();
562
+ }
563
+ else {
564
+ this.reorderSlotContent();
565
+ }
536
566
  }
537
567
  }
538
- else {
539
- this.handlePopoverClose();
540
- }
541
- if (this.options) {
542
- this.reorderOptionsContent();
543
- }
544
- else {
545
- this.reorderSlotContent();
546
- }
547
568
  }
548
569
  /**
549
570
  * Listen for the `itemChecked` event emitted by child items.
@@ -556,7 +577,7 @@ const NvFieldmultiselect = class {
556
577
  }
557
578
  const { value, checked } = event.detail;
558
579
  if (value !== undefined && value !== null) {
559
- const newValue = [...this.value];
580
+ const newValue = [...(this.value || [])];
560
581
  const valueIndex = newValue.indexOf(value);
561
582
  let hasChanged = false;
562
583
  if (checked && valueIndex === -1) {
@@ -593,6 +614,86 @@ const NvFieldmultiselect = class {
593
614
  });
594
615
  }
595
616
  }
617
+ /**
618
+ * Handle keyboard events & arrow key navigation.
619
+ * If the multiselect is not open, opens it and focuses on the first item if the list is not filterable.
620
+ * If the multiselect is open, handles arrow key navigation and closes it if the focus is outside the component.
621
+ * @param {KeyboardEvent} event - The keyboard event.
622
+ */
623
+ async handleKeyDown(event) {
624
+ if (!this.open) {
625
+ if (event.key === 'ArrowDown') {
626
+ this.open = true;
627
+ // Focus on the first item if the list is not filterable
628
+ if (!this.filterable) {
629
+ requestAnimationFrame(() => {
630
+ this.focusFirstItem();
631
+ });
632
+ }
633
+ event.preventDefault();
634
+ return;
635
+ }
636
+ return;
637
+ }
638
+ const items = Array.from(this.el.querySelectorAll('nv-fielddropdownitemcheck:not([style*="display: none"])'));
639
+ if (items.length === 0) {
640
+ console.warn('No visible items found to navigate');
641
+ return;
642
+ }
643
+ let currentIndex = items.findIndex(item => item.classList.contains('highlighted'));
644
+ if (event.key === 'ArrowDown') {
645
+ event.preventDefault();
646
+ currentIndex =
647
+ currentIndex === -1 ? 0 : (currentIndex + 1) % items.length;
648
+ this.updateHighlightedItem(items, currentIndex);
649
+ }
650
+ else if (event.key === 'ArrowUp') {
651
+ event.preventDefault();
652
+ currentIndex =
653
+ currentIndex === -1
654
+ ? items.length - 1
655
+ : (currentIndex - 1 + items.length) % items.length;
656
+ this.updateHighlightedItem(items, currentIndex);
657
+ }
658
+ else if (event.key === 'Enter' && currentIndex >= 0) {
659
+ event.preventDefault();
660
+ const selectedItem = items[currentIndex];
661
+ // Toggle the checked state
662
+ const isCurrentlyChecked = selectedItem.hasAttribute('checked');
663
+ selectedItem.checked = !isCurrentlyChecked;
664
+ // Trigger a click event to ensure proper event handling
665
+ selectedItem.dispatchEvent(new MouseEvent('click', {
666
+ view: window,
667
+ bubbles: true,
668
+ cancelable: true,
669
+ }));
670
+ }
671
+ else if (event.key === 'Escape') {
672
+ event.preventDefault();
673
+ event.stopPropagation(); // Prevent the event from propagating to the popover
674
+ // Do the reorder and wait a bit before closing
675
+ const handleEscape = async () => {
676
+ this.isHandlingEscape = true; // Disable the hide listener
677
+ if (this.options) {
678
+ this.reorderOptionsContent();
679
+ }
680
+ else {
681
+ this.reorderSlotContent();
682
+ }
683
+ // Wait for the reorder to be applied
684
+ await new Promise(resolve => setTimeout(resolve, 100));
685
+ // Reactivate the hide listener after a short delay
686
+ setTimeout(() => {
687
+ this.isHandlingEscape = false;
688
+ this.open = false;
689
+ }, 150);
690
+ if (this.inputElement) {
691
+ this.inputElement.blur();
692
+ }
693
+ };
694
+ await handleEscape();
695
+ }
696
+ }
596
697
  //#endregion LISTENERS
597
698
  /****************************************************************************/
598
699
  //#region LIFECYCLE
@@ -689,8 +790,8 @@ const NvFieldmultiselect = class {
689
790
  if (emptyMessage)
690
791
  emptyMessage.remove();
691
792
  // Reorder with divider if needed
692
- const selectedItems = items.filter(item => this.value.includes(item.getAttribute('value') || ''));
693
- const unselectedItems = items.filter(item => !this.value.includes(item.getAttribute('value') || ''));
793
+ const selectedItems = items.filter(item => (this.value || []).includes(item.getAttribute('value') || ''));
794
+ const unselectedItems = items.filter(item => !(this.value || []).includes(item.getAttribute('value') || ''));
694
795
  if (selectedItems.length > 0) {
695
796
  this.manageDivider(ul, selectedItems, unselectedItems);
696
797
  }
@@ -775,8 +876,8 @@ const NvFieldmultiselect = class {
775
876
  return;
776
877
  }
777
878
  // Separate checked vs unchecked
778
- const selectedItems = items.filter(item => this.value.includes(item.getAttribute('value') || ''));
779
- const unselectedItems = items.filter(item => !this.value.includes(item.getAttribute('value') || ''));
879
+ const selectedItems = items.filter(item => (this.value || []).includes(item.getAttribute('value') || ''));
880
+ const unselectedItems = items.filter(item => !(this.value || []).includes(item.getAttribute('value') || ''));
780
881
  // Reinsert CHECKED items FIRST
781
882
  // appendChild() moves the element without recreating it
782
883
  // this is not trigger a re-rendering of the component in the platforms
@@ -802,8 +903,8 @@ const NvFieldmultiselect = class {
802
903
  if (!ul)
803
904
  return;
804
905
  const items = Array.from(ul.querySelectorAll('nv-fielddropdownitemcheck')).filter(item => item.style.display !== 'none');
805
- const selectedItems = items.filter(item => this.value.includes(item.getAttribute('value') || ''));
806
- const unselectedItems = items.filter(item => !this.value.includes(item.getAttribute('value') || ''));
906
+ const selectedItems = items.filter(item => (this.value || []).includes(item.getAttribute('value') || ''));
907
+ const unselectedItems = items.filter(item => !(this.value || []).includes(item.getAttribute('value') || ''));
807
908
  // Reorder the elements
808
909
  selectedItems.forEach(item => ul.appendChild(item));
809
910
  unselectedItems.forEach(item => ul.appendChild(item));
@@ -839,8 +940,8 @@ const NvFieldmultiselect = class {
839
940
  }
840
941
  // Reorder with divider
841
942
  const items = Array.from(ul.querySelectorAll('nv-fielddropdownitemcheck'));
842
- const selectedItems = items.filter(item => this.value.includes(item.getAttribute('value') || ''));
843
- const unselectedItems = items.filter(item => !this.value.includes(item.getAttribute('value') || ''));
943
+ const selectedItems = items.filter(item => (this.value || []).includes(item.getAttribute('value') || ''));
944
+ const unselectedItems = items.filter(item => !(this.value || []).includes(item.getAttribute('value') || ''));
844
945
  this.manageDivider(ul, selectedItems, unselectedItems);
845
946
  return;
846
947
  }
@@ -861,8 +962,8 @@ const NvFieldmultiselect = class {
861
962
  });
862
963
  // Manage the divider with the visible items
863
964
  const visibleItems = items.filter(item => item.style.display !== 'none');
864
- const visibleSelected = visibleItems.filter(item => this.value.includes(item.getAttribute('value') || ''));
865
- const visibleUnselected = visibleItems.filter(item => !this.value.includes(item.getAttribute('value') || ''));
965
+ const visibleSelected = visibleItems.filter(item => (this.value || []).includes(item.getAttribute('value') || ''));
966
+ const visibleUnselected = visibleItems.filter(item => !(this.value || []).includes(item.getAttribute('value') || ''));
866
967
  this.manageDivider(ul, visibleSelected, visibleUnselected);
867
968
  }
868
969
  else {
@@ -902,31 +1003,39 @@ const NvFieldmultiselect = class {
902
1003
  const items = Array.from(ul.querySelectorAll('nv-fielddropdownitemcheck'));
903
1004
  // Reset items if the filter text is empty
904
1005
  if (!this.filterText.trim()) {
905
- // Remove the empty message if it exists
906
1006
  this.removeEmptyMessageOption(ul);
907
- items.forEach(item => (item.style.display = ''));
908
- this.reorderOptionsContent(); // Reorder after reset
909
- this.hasFilterResults = true; // Reset filter means we have results
1007
+ items.forEach(item => {
1008
+ item.style.display = '';
1009
+ item.removeAttribute('aria-hidden'); // Ensure accessibility
1010
+ });
1011
+ this.reorderOptionsContent();
1012
+ this.hasFilterResults = true;
910
1013
  return;
911
1014
  }
912
1015
  // Filter the items
913
1016
  items.forEach(item => {
914
- const label = item.getAttribute('label') || '';
915
- const value = item.getAttribute('value') || '';
916
- const matchesFilter = this.normalizeText(label).includes(normalizedFilter) ||
917
- this.normalizeText(value).includes(normalizedFilter);
918
- item.style.display = matchesFilter ? '' : 'none';
919
- if (matchesFilter)
920
- hasVisibleItems = true;
1017
+ const option = this.options.find(opt => opt.value === item.getAttribute('value'));
1018
+ if (option && !option.isDivider) {
1019
+ const matchesFilter = this.normalizeText(option.label).includes(normalizedFilter) ||
1020
+ this.normalizeText(option.value).includes(normalizedFilter);
1021
+ item.style.display = matchesFilter ? '' : 'none';
1022
+ item.setAttribute('aria-hidden', matchesFilter ? 'false' : 'true'); // Update accessibility
1023
+ if (matchesFilter)
1024
+ hasVisibleItems = true;
1025
+ }
1026
+ else {
1027
+ item.style.display = 'none'; // Hide dividers during filtering
1028
+ item.setAttribute('aria-hidden', 'true');
1029
+ }
921
1030
  });
922
1031
  // Update the filter results state
923
1032
  this.hasFilterResults = hasVisibleItems;
924
1033
  // Manage the divider with the visible items
925
1034
  const visibleItems = items.filter(item => item.style.display !== 'none');
926
- const visibleSelected = visibleItems.filter(item => this.value.includes(item.getAttribute('value') || ''));
927
- const visibleUnselected = visibleItems.filter(item => !this.value.includes(item.getAttribute('value') || ''));
1035
+ const visibleSelected = visibleItems.filter(item => (this.value || []).includes(item.getAttribute('value') || ''));
1036
+ const visibleUnselected = visibleItems.filter(item => !(this.value || []).includes(item.getAttribute('value') || ''));
928
1037
  this.manageDivider(ul, visibleSelected, visibleUnselected);
929
- // Add or remove the empty message based on the case
1038
+ // Add or remove the empty message
930
1039
  if (!hasVisibleItems) {
931
1040
  this.addEmptyMessageOption(ul);
932
1041
  }
@@ -975,8 +1084,8 @@ const NvFieldmultiselect = class {
975
1084
  this.hasFilterResults = hasVisibleItems;
976
1085
  // Get visible items after filtering
977
1086
  const visibleItems = items.filter(item => item.style.display !== 'none');
978
- const visibleSelectedItems = visibleItems.filter(item => this.value.includes(item.getAttribute('value') || ''));
979
- this.manageDivider(ul, visibleSelectedItems, visibleItems.filter(item => !this.value.includes(item.getAttribute('value') || '')));
1087
+ const visibleSelectedItems = visibleItems.filter(item => (this.value || []).includes(item.getAttribute('value') || ''));
1088
+ this.manageDivider(ul, visibleSelectedItems, visibleItems.filter(item => !(this.value || []).includes(item.getAttribute('value') || '')));
980
1089
  // Add empty message if no items match the filter
981
1090
  if (!hasVisibleItems) {
982
1091
  const emptyMessage = document.createElement('li');
@@ -1017,86 +1126,6 @@ const NvFieldmultiselect = class {
1017
1126
  }
1018
1127
  this.open = false;
1019
1128
  }
1020
- /**
1021
- * Handle keyboard events & arrow key navigation.
1022
- * If the multiselect is not open, opens it and focuses on the first item if the list is not filterable.
1023
- * If the multiselect is open, handles arrow key navigation and closes it if the focus is outside the component.
1024
- * @param {KeyboardEvent} event - The keyboard event.
1025
- */
1026
- async handleKeyDown(event) {
1027
- if (!this.open) {
1028
- if (event.key === 'ArrowDown') {
1029
- this.open = true;
1030
- // Focus on the first item if the list is not filterable
1031
- if (!this.filterable) {
1032
- requestAnimationFrame(() => {
1033
- this.focusFirstItem();
1034
- });
1035
- }
1036
- event.preventDefault();
1037
- return;
1038
- }
1039
- return;
1040
- }
1041
- const items = Array.from(this.el.querySelectorAll('nv-fielddropdownitemcheck:not([style*="display: none"])'));
1042
- if (items.length === 0) {
1043
- console.warn('No visible items found to navigate');
1044
- return;
1045
- }
1046
- let currentIndex = items.findIndex(item => item.classList.contains('highlighted'));
1047
- if (event.key === 'ArrowDown') {
1048
- event.preventDefault();
1049
- currentIndex =
1050
- currentIndex === -1 ? 0 : (currentIndex + 1) % items.length;
1051
- this.updateHighlightedItem(items, currentIndex);
1052
- }
1053
- else if (event.key === 'ArrowUp') {
1054
- event.preventDefault();
1055
- currentIndex =
1056
- currentIndex === -1
1057
- ? items.length - 1
1058
- : (currentIndex - 1 + items.length) % items.length;
1059
- this.updateHighlightedItem(items, currentIndex);
1060
- }
1061
- else if (event.key === 'Enter' && currentIndex >= 0) {
1062
- event.preventDefault();
1063
- const selectedItem = items[currentIndex];
1064
- // Toggle the checked state
1065
- const isCurrentlyChecked = selectedItem.hasAttribute('checked');
1066
- selectedItem.checked = !isCurrentlyChecked;
1067
- // Trigger a click event to ensure proper event handling
1068
- selectedItem.dispatchEvent(new MouseEvent('click', {
1069
- view: window,
1070
- bubbles: true,
1071
- cancelable: true,
1072
- }));
1073
- }
1074
- else if (event.key === 'Escape') {
1075
- event.preventDefault();
1076
- event.stopPropagation(); // Prevent the event from propagating to the popover
1077
- // Do the reorder and wait a bit before closing
1078
- const handleEscape = async () => {
1079
- this.isHandlingEscape = true; // Disable the hide listener
1080
- if (this.options) {
1081
- this.reorderOptionsContent();
1082
- }
1083
- else {
1084
- this.reorderSlotContent();
1085
- }
1086
- // Wait for the reorder to be applied
1087
- await new Promise(resolve => setTimeout(resolve, 100));
1088
- // Reactivate the hide listener after a short delay
1089
- setTimeout(() => {
1090
- this.isHandlingEscape = false;
1091
- this.open = false;
1092
- }, 150);
1093
- if (this.inputElement) {
1094
- this.inputElement.blur();
1095
- }
1096
- };
1097
- await handleEscape();
1098
- }
1099
- }
1100
1129
  /**
1101
1130
  * Updates the highlighted item in the dropdown list.
1102
1131
  *
@@ -1186,7 +1215,7 @@ const NvFieldmultiselect = class {
1186
1215
  items.forEach(item => {
1187
1216
  // Get the effective value: use explicit value if present, otherwise use label
1188
1217
  const itemValue = item.getAttribute('value') || item.getAttribute('label') || '';
1189
- const shouldBeChecked = this.value.includes(itemValue);
1218
+ const shouldBeChecked = (this.value || []).includes(itemValue);
1190
1219
  // Only update if the checked state differs to avoid triggering unnecessary events
1191
1220
  if (item.checked !== shouldBeChecked) {
1192
1221
  // Set attribute and property, but avoid triggering itemChecked during bulk
@@ -1226,8 +1255,10 @@ const NvFieldmultiselect = class {
1226
1255
  getVisibleEnabledOptionItems() {
1227
1256
  const allItems = Array.from(this.el.querySelectorAll('nv-fielddropdownitemcheck'));
1228
1257
  const visibleItems = allItems.filter(item => {
1229
- const isHidden = item.style.display === 'none';
1230
- const isDisabled = item.hasAttribute('disabled');
1258
+ const isHidden = item.style.display === 'none' ||
1259
+ item.getAttribute('aria-hidden') === 'true';
1260
+ const isDisabled = item.hasAttribute('disabled') ||
1261
+ item.getAttribute('disabled') === 'true';
1231
1262
  return !isHidden && !isDisabled;
1232
1263
  });
1233
1264
  return visibleItems
@@ -1254,7 +1285,7 @@ const NvFieldmultiselect = class {
1254
1285
  const visibleOptionValues = this.getVisibleEnabledOptionItems();
1255
1286
  if (visibleOptionValues.length === 0)
1256
1287
  return 'unchecked';
1257
- const selectedVisibleOptions = visibleOptionValues.filter(value => this.value.includes(value));
1288
+ const selectedVisibleOptions = visibleOptionValues.filter(value => (this.value || []).includes(value));
1258
1289
  if (selectedVisibleOptions.length === 0)
1259
1290
  return 'unchecked';
1260
1291
  if (selectedVisibleOptions.length === visibleOptionValues.length)
@@ -1274,7 +1305,7 @@ const NvFieldmultiselect = class {
1274
1305
  return 'unchecked';
1275
1306
  const selectedItems = items.filter(item => {
1276
1307
  const itemValue = item.getAttribute('value') || item.getAttribute('label') || '';
1277
- return itemValue !== '' && this.value.includes(itemValue);
1308
+ return itemValue !== '' && (this.value || []).includes(itemValue);
1278
1309
  });
1279
1310
  if (selectedItems.length === 0)
1280
1311
  return 'unchecked';
@@ -1325,7 +1356,8 @@ const NvFieldmultiselect = class {
1325
1356
  get el() { return index.getElement(this); }
1326
1357
  static get watchers() { return {
1327
1358
  "options": ["handleOptionsChange"],
1328
- "value": ["watchValueHandler"]
1359
+ "value": ["watchValueHandler"],
1360
+ "open": ["handleOpenChange"]
1329
1361
  }; }
1330
1362
  };
1331
1363
  NvFieldmultiselect.style = NvFieldmultiselectStyle0;