@nova-design-system/nova-webcomponents 3.0.0-beta.34 → 3.0.0-beta.36

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 (226) hide show
  1. package/dist/blazor-docs.json +1402 -175
  2. package/dist/cjs/index-ddc37f87.js +12 -12
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/native.cjs.js +1 -1
  5. package/dist/cjs/{nv-badge.cjs.entry.js → nv-badge_2.cjs.entry.js} +43 -1
  6. package/dist/cjs/nv-badge_2.cjs.entry.js.map +1 -0
  7. package/dist/cjs/nv-fieldmultiselect.cjs.entry.js +1067 -0
  8. package/dist/cjs/nv-fieldmultiselect.cjs.entry.js.map +1 -0
  9. package/dist/cjs/nv-fieldnumber.cjs.entry.js +3 -3
  10. package/dist/cjs/nv-fieldpassword.cjs.entry.js +3 -3
  11. package/dist/cjs/nv-fieldradio.cjs.entry.js +3 -3
  12. package/dist/cjs/nv-fieldselect.cjs.entry.js +5 -5
  13. package/dist/cjs/nv-fieldtext.cjs.entry.js +3 -3
  14. package/dist/cjs/nv-fieldtextarea.cjs.entry.js +3 -3
  15. package/dist/cjs/nv-fieldtoggle.cjs.entry.js +2 -2
  16. package/dist/cjs/nv-icon.cjs.entry.js +1 -1
  17. package/dist/cjs/{nv-iconbutton.cjs.entry.js → nv-iconbutton_2.cjs.entry.js} +28 -2
  18. package/dist/cjs/nv-iconbutton_2.cjs.entry.js.map +1 -0
  19. package/dist/cjs/nv-menu.cjs.entry.js +1 -1
  20. package/dist/cjs/nv-menuitem.cjs.entry.js +1 -1
  21. package/dist/cjs/nv-popover.cjs.entry.js +1 -1
  22. package/dist/cjs/nv-row.cjs.entry.js +1 -1
  23. package/dist/cjs/nv-stack.cjs.entry.js +1 -1
  24. package/dist/cjs/nv-table.cjs.entry.js +2 -2
  25. package/dist/cjs/nv-tablebody.cjs.entry.js +1 -1
  26. package/dist/cjs/nv-tablecolumn.cjs.entry.js +1 -1
  27. package/dist/cjs/nv-tabledatacell.cjs.entry.js +1 -1
  28. package/dist/cjs/nv-tablehead.cjs.entry.js +1 -1
  29. package/dist/cjs/nv-tablerow.cjs.entry.js +1 -1
  30. package/dist/cjs/nv-tooltip.cjs.entry.js +1 -1
  31. package/dist/collection/collection-manifest.json +2 -0
  32. package/dist/collection/components/nv-fielddropdownitemcheck/nv-fielddropdownitemcheck.css +12 -0
  33. package/dist/collection/components/nv-fielddropdownitemcheck/nv-fielddropdownitemcheck.docs.js +6 -0
  34. package/dist/collection/components/nv-fielddropdownitemcheck/nv-fielddropdownitemcheck.docs.js.map +1 -0
  35. package/dist/collection/components/nv-fielddropdownitemcheck/nv-fielddropdownitemcheck.js +185 -0
  36. package/dist/collection/components/nv-fielddropdownitemcheck/nv-fielddropdownitemcheck.js.map +1 -0
  37. package/dist/collection/components/nv-fieldmultiselect/nv-fieldmultiselect.css +204 -0
  38. package/dist/collection/components/nv-fieldmultiselect/nv-fieldmultiselect.docs.js +249 -0
  39. package/dist/collection/components/nv-fieldmultiselect/nv-fieldmultiselect.docs.js.map +1 -0
  40. package/dist/collection/components/nv-fieldmultiselect/nv-fieldmultiselect.js +1651 -0
  41. package/dist/collection/components/nv-fieldmultiselect/nv-fieldmultiselect.js.map +1 -0
  42. package/dist/collection/components/nv-fieldnumber/nv-fieldnumber.js +3 -3
  43. package/dist/collection/components/nv-fieldpassword/nv-fieldpassword.js +3 -3
  44. package/dist/collection/components/nv-fieldradio/nv-fieldradio.js +3 -3
  45. package/dist/collection/components/nv-fieldselect/nv-fieldselect.js +5 -5
  46. package/dist/collection/components/nv-fieldtext/nv-fieldtext.js +3 -3
  47. package/dist/collection/components/nv-fieldtextarea/nv-fieldtextarea.js +3 -3
  48. package/dist/collection/components/nv-fieldtoggle/nv-fieldtoggle.js +2 -2
  49. package/dist/collection/components/nv-icon/nv-icon.js +1 -1
  50. package/dist/collection/components/nv-iconbutton/nv-iconbutton.js +1 -1
  51. package/dist/collection/components/nv-loader/nv-loader.js +1 -1
  52. package/dist/collection/components/nv-menu/nv-menu.js +1 -1
  53. package/dist/collection/components/nv-menuitem/nv-menuitem.js +1 -1
  54. package/dist/collection/components/nv-popover/nv-popover.js +1 -1
  55. package/dist/collection/components/nv-row/nv-row.js +1 -1
  56. package/dist/collection/components/nv-stack/nv-stack.js +1 -1
  57. package/dist/collection/components/nv-table/nv-table.js +2 -2
  58. package/dist/collection/components/nv-tablebody/nv-tablebody.js +1 -1
  59. package/dist/collection/components/nv-tablecolumn/nv-tablecolumn.js +1 -1
  60. package/dist/collection/components/nv-tabledatacell/nv-tabledatacell.js +1 -1
  61. package/dist/collection/components/nv-tablehead/nv-tablehead.js +1 -1
  62. package/dist/collection/components/nv-tablerow/nv-tablerow.js +1 -1
  63. package/dist/collection/components/nv-tooltip/nv-tooltip.js +1 -1
  64. package/dist/components/nv-alert.js +1 -1
  65. package/dist/components/nv-avatar.js +1 -1
  66. package/dist/components/nv-badge.js +1 -173
  67. package/dist/components/nv-badge.js.map +1 -1
  68. package/dist/components/nv-breadcrumb.js +3 -3
  69. package/dist/components/nv-button.js +1 -1
  70. package/dist/components/nv-fieldcheckbox.js +1 -152
  71. package/dist/components/nv-fieldcheckbox.js.map +1 -1
  72. package/dist/components/nv-fielddropdown.js +5 -5
  73. package/dist/components/nv-fielddropdownitem.js +1 -1
  74. package/dist/components/nv-fielddropdownitemcheck.d.ts +11 -0
  75. package/dist/components/nv-fielddropdownitemcheck.js +8 -0
  76. package/dist/components/nv-fielddropdownitemcheck.js.map +1 -0
  77. package/dist/components/nv-fieldmultiselect.d.ts +11 -0
  78. package/dist/components/nv-fieldmultiselect.js +1159 -0
  79. package/dist/components/nv-fieldmultiselect.js.map +1 -0
  80. package/dist/components/nv-fieldnumber.js +4 -4
  81. package/dist/components/nv-fieldpassword.js +6 -6
  82. package/dist/components/nv-fieldradio.js +3 -3
  83. package/dist/components/nv-fieldselect.js +6 -6
  84. package/dist/components/nv-fieldtext.js +4 -4
  85. package/dist/components/nv-fieldtextarea.js +3 -3
  86. package/dist/components/nv-fieldtoggle.js +2 -2
  87. package/dist/components/nv-icon.js +1 -1
  88. package/dist/components/nv-iconbutton.js +1 -1
  89. package/dist/components/nv-loader.js +1 -1
  90. package/dist/components/nv-menu.js +2 -2
  91. package/dist/components/nv-menuitem.js +2 -2
  92. package/dist/components/nv-popover.js +1 -1
  93. package/dist/components/nv-row.js +1 -1
  94. package/dist/components/nv-stack.js +1 -1
  95. package/dist/components/nv-table.js +2 -2
  96. package/dist/components/nv-tablebody.js +1 -1
  97. package/dist/components/nv-tablecolumn.js +1 -1
  98. package/dist/components/nv-tabledatacell.js +1 -1
  99. package/dist/components/nv-tablehead.js +1 -1
  100. package/dist/components/nv-tablerow.js +1 -1
  101. package/dist/components/nv-tooltip.js +1 -1
  102. package/dist/components/{p-b7462fc2.js → p-0b30dd1b.js} +2 -2
  103. package/dist/components/{p-b7462fc2.js.map → p-0b30dd1b.js.map} +1 -1
  104. package/dist/{esm/nv-badge.entry.js → components/p-2abfadb8.js} +48 -12
  105. package/dist/components/p-2abfadb8.js.map +1 -0
  106. package/dist/components/{p-a61d9ce8.js → p-5b98036c.js} +2 -2
  107. package/dist/components/{p-a61d9ce8.js.map → p-5b98036c.js.map} +1 -1
  108. package/dist/components/p-63afc71f.js +74 -0
  109. package/dist/components/p-63afc71f.js.map +1 -0
  110. package/dist/components/{p-ce67d70c.js → p-78e7c594.js} +2 -2
  111. package/dist/components/{p-ce67d70c.js.map → p-78e7c594.js.map} +1 -1
  112. package/dist/components/{p-09a2a880.js → p-7a19fef7.js} +2 -2
  113. package/dist/components/{p-09a2a880.js.map → p-7a19fef7.js.map} +1 -1
  114. package/dist/components/{p-e7131c30.js → p-7c0db67e.js} +3 -3
  115. package/dist/components/{p-e7131c30.js.map → p-7c0db67e.js.map} +1 -1
  116. package/dist/components/p-afa1c98e.js +156 -0
  117. package/dist/components/p-afa1c98e.js.map +1 -0
  118. package/dist/components/{p-0cdf2cc7.js → p-d3b1c116.js} +4 -4
  119. package/dist/components/{p-0cdf2cc7.js.map → p-d3b1c116.js.map} +1 -1
  120. package/dist/docs.json +1394 -183
  121. package/dist/esm/index-cd557d0a.js +12 -12
  122. package/dist/esm/loader.js +1 -1
  123. package/dist/esm/native.js +1 -1
  124. package/dist/esm/nv-badge_2.entry.js +182 -0
  125. package/dist/esm/nv-badge_2.entry.js.map +1 -0
  126. package/dist/esm/nv-fieldmultiselect.entry.js +1063 -0
  127. package/dist/esm/nv-fieldmultiselect.entry.js.map +1 -0
  128. package/dist/esm/nv-fieldnumber.entry.js +3 -3
  129. package/dist/esm/nv-fieldpassword.entry.js +3 -3
  130. package/dist/esm/nv-fieldradio.entry.js +3 -3
  131. package/dist/esm/nv-fieldselect.entry.js +5 -5
  132. package/dist/esm/nv-fieldtext.entry.js +3 -3
  133. package/dist/esm/nv-fieldtextarea.entry.js +3 -3
  134. package/dist/esm/nv-fieldtoggle.entry.js +2 -2
  135. package/dist/esm/nv-icon.entry.js +1 -1
  136. package/dist/esm/{nv-iconbutton.entry.js → nv-iconbutton_2.entry.js} +28 -3
  137. package/dist/esm/nv-iconbutton_2.entry.js.map +1 -0
  138. package/dist/esm/nv-menu.entry.js +1 -1
  139. package/dist/esm/nv-menuitem.entry.js +1 -1
  140. package/dist/esm/nv-popover.entry.js +1 -1
  141. package/dist/esm/nv-row.entry.js +1 -1
  142. package/dist/esm/nv-stack.entry.js +1 -1
  143. package/dist/esm/nv-table.entry.js +2 -2
  144. package/dist/esm/nv-tablebody.entry.js +1 -1
  145. package/dist/esm/nv-tablecolumn.entry.js +1 -1
  146. package/dist/esm/nv-tabledatacell.entry.js +1 -1
  147. package/dist/esm/nv-tablehead.entry.js +1 -1
  148. package/dist/esm/nv-tablerow.entry.js +1 -1
  149. package/dist/esm/nv-tooltip.entry.js +1 -1
  150. package/dist/native/native.css +1 -1
  151. package/dist/native/native.esm.js +1 -1
  152. package/dist/native/native.esm.js.map +1 -1
  153. package/dist/native/{p-b902c7c0.entry.js → p-0a9a738c.entry.js} +2 -2
  154. package/dist/native/{p-f1545844.entry.js → p-18b227b5.entry.js} +2 -2
  155. package/dist/native/p-18b227b5.entry.js.map +1 -0
  156. package/dist/native/{p-3e9521a0.entry.js → p-1e2bd4e3.entry.js} +2 -2
  157. package/dist/native/p-225962f2.entry.js +2 -0
  158. package/dist/native/{p-bbc45099.entry.js.map → p-225962f2.entry.js.map} +1 -1
  159. package/dist/native/{p-f2ea8aa9.entry.js → p-3283505f.entry.js} +2 -2
  160. package/dist/native/{p-c59e3500.entry.js → p-3adf0c45.entry.js} +2 -2
  161. package/dist/native/{p-0710efd7.entry.js → p-4e056cd8.entry.js} +2 -2
  162. package/dist/native/p-4ffd5c51.entry.js +2 -0
  163. package/dist/native/{p-6c1b9c89.entry.js.map → p-4ffd5c51.entry.js.map} +1 -1
  164. package/dist/native/{p-ee78addb.entry.js → p-552e7ea4.entry.js} +2 -2
  165. package/dist/native/{p-74778f5f.entry.js → p-575ea40b.entry.js} +2 -2
  166. package/dist/native/p-5f160072.entry.js +2 -0
  167. package/dist/native/{p-10a06059.entry.js → p-6bb2c88f.entry.js} +2 -2
  168. package/dist/native/{p-e56d3715.entry.js → p-6ea62d17.entry.js} +2 -2
  169. package/dist/native/{p-45aa0c68.entry.js → p-788712dd.entry.js} +2 -2
  170. package/dist/native/{p-9cef006d.entry.js → p-7dfb4a60.entry.js} +2 -2
  171. package/dist/native/p-826f1d28.entry.js +2 -0
  172. package/dist/native/p-826f1d28.entry.js.map +1 -0
  173. package/dist/native/p-8ae9aaf1.entry.js +2 -0
  174. package/dist/native/p-967f1aee.entry.js +2 -0
  175. package/dist/native/p-967f1aee.entry.js.map +1 -0
  176. package/dist/native/{p-f4ecacf6.entry.js → p-cd251f91.entry.js} +2 -2
  177. package/dist/native/p-e8d181e6.entry.js +2 -0
  178. package/dist/native/{p-e390557d.entry.js → p-ed825c80.entry.js} +2 -2
  179. package/dist/native/{p-d0f83d1f.entry.js → p-f79752ca.entry.js} +2 -2
  180. package/dist/native/p-fc8cad13.entry.js +2 -0
  181. package/dist/types/components/nv-fielddropdownitemcheck/nv-fielddropdownitemcheck.d.ts +56 -0
  182. package/dist/types/components/nv-fielddropdownitemcheck/nv-fielddropdownitemcheck.docs.d.ts +4 -0
  183. package/dist/types/components/nv-fieldmultiselect/nv-fieldmultiselect.d.ts +404 -0
  184. package/dist/types/components/nv-fieldmultiselect/nv-fieldmultiselect.docs.d.ts +4 -0
  185. package/dist/types/components.d.ts +329 -0
  186. package/dist/vscode-data.json +324 -0
  187. package/hydrate/index.js +1201 -38
  188. package/hydrate/index.mjs +1201 -38
  189. package/package.json +11 -3
  190. package/dist/cjs/nv-badge.cjs.entry.js.map +0 -1
  191. package/dist/cjs/nv-iconbutton.cjs.entry.js.map +0 -1
  192. package/dist/cjs/nv-loader.cjs.entry.js +0 -35
  193. package/dist/cjs/nv-loader.cjs.entry.js.map +0 -1
  194. package/dist/esm/nv-badge.entry.js.map +0 -1
  195. package/dist/esm/nv-iconbutton.entry.js.map +0 -1
  196. package/dist/esm/nv-loader.entry.js +0 -31
  197. package/dist/esm/nv-loader.entry.js.map +0 -1
  198. package/dist/native/p-132b8588.entry.js +0 -2
  199. package/dist/native/p-132b8588.entry.js.map +0 -1
  200. package/dist/native/p-5d67a825.entry.js +0 -2
  201. package/dist/native/p-6c1b9c89.entry.js +0 -2
  202. package/dist/native/p-907c3eda.entry.js +0 -2
  203. package/dist/native/p-91d4b4d7.entry.js +0 -2
  204. package/dist/native/p-a9b6461b.entry.js +0 -2
  205. package/dist/native/p-a9b6461b.entry.js.map +0 -1
  206. package/dist/native/p-bbc45099.entry.js +0 -2
  207. package/dist/native/p-f1545844.entry.js.map +0 -1
  208. package/dist/native/p-f42e87b5.entry.js +0 -2
  209. /package/dist/native/{p-b902c7c0.entry.js.map → p-0a9a738c.entry.js.map} +0 -0
  210. /package/dist/native/{p-3e9521a0.entry.js.map → p-1e2bd4e3.entry.js.map} +0 -0
  211. /package/dist/native/{p-f2ea8aa9.entry.js.map → p-3283505f.entry.js.map} +0 -0
  212. /package/dist/native/{p-c59e3500.entry.js.map → p-3adf0c45.entry.js.map} +0 -0
  213. /package/dist/native/{p-0710efd7.entry.js.map → p-4e056cd8.entry.js.map} +0 -0
  214. /package/dist/native/{p-ee78addb.entry.js.map → p-552e7ea4.entry.js.map} +0 -0
  215. /package/dist/native/{p-74778f5f.entry.js.map → p-575ea40b.entry.js.map} +0 -0
  216. /package/dist/native/{p-5d67a825.entry.js.map → p-5f160072.entry.js.map} +0 -0
  217. /package/dist/native/{p-10a06059.entry.js.map → p-6bb2c88f.entry.js.map} +0 -0
  218. /package/dist/native/{p-e56d3715.entry.js.map → p-6ea62d17.entry.js.map} +0 -0
  219. /package/dist/native/{p-45aa0c68.entry.js.map → p-788712dd.entry.js.map} +0 -0
  220. /package/dist/native/{p-9cef006d.entry.js.map → p-7dfb4a60.entry.js.map} +0 -0
  221. /package/dist/native/{p-907c3eda.entry.js.map → p-8ae9aaf1.entry.js.map} +0 -0
  222. /package/dist/native/{p-f4ecacf6.entry.js.map → p-cd251f91.entry.js.map} +0 -0
  223. /package/dist/native/{p-f42e87b5.entry.js.map → p-e8d181e6.entry.js.map} +0 -0
  224. /package/dist/native/{p-e390557d.entry.js.map → p-ed825c80.entry.js.map} +0 -0
  225. /package/dist/native/{p-d0f83d1f.entry.js.map → p-f79752ca.entry.js.map} +0 -0
  226. /package/dist/native/{p-91d4b4d7.entry.js.map → p-fc8cad13.entry.js.map} +0 -0
@@ -0,0 +1,1063 @@
1
+ import { r as registerInstance, c as createEvent, h, a as Host, g as getElement } from './index-cd557d0a.js';
2
+ import { v as v4 } from './v4-a79185f4.js';
3
+
4
+ const nvFieldmultiselectCss = "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}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)}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 .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;padding:calc(var(--form-field-padding-y) - 1px) var(--form-field-padding-x);justify-content:center;align-items:center;gap:var(--form-field-gap);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);background:var(--nv-field-background);transition:all 150ms ease-out;display:flex;align-items:center;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{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 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);text-overflow:ellipsis;font-size:var(--form-field-font-size);font-style:normal;font-weight:500;line-height:var(--form-field-line-height);width:100%;padding-right:2rem;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 .toggle-dropdown-icon{position:absolute;right:0;top:50%;transform:translateY(-50%);z-index:2}nv-fieldmultiselect .input-container-multiselect nv-icon.validation{color:var(--nv-field-border-default);position:absolute;right:50px}nv-fieldmultiselect .input-container-multiselect.focus-within,nv-fieldmultiselect .input-container-multiselect: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 .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{align-self:stretch;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{align-self:stretch;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)}.input-container-multiselect.focus-within,.input-container-multiselect:hover{border-color:var(--nv-field-border-focus);box-shadow:0px 0px 0px var(--focus-field-stroke) var(--nv-field-focus-box-shadow)}.no-results-message{text-align:center;padding:10px;color:var(--nv-field-error-text, #999)}.multiselect-divider{display:block;width:100%;height:1px;background-color:var(--multiselect-divider-color, #ccc);margin:8px 0}";
5
+ const NvFieldmultiselectStyle0 = nvFieldmultiselectCss;
6
+
7
+ const NvFieldmultiselect = class {
8
+ constructor(hostRef) {
9
+ registerInstance(this, hostRef);
10
+ this.dropdownItemSelected = createEvent(this, "dropdownItemSelected", 7);
11
+ this.valueChanged = createEvent(this, "valueChanged", 7);
12
+ this.multiselectChange = createEvent(this, "multiselectChange", 7);
13
+ /****************************************************************************/
14
+ //#region PROPERTIES
15
+ /**
16
+ * Sets the ID for the input element and the for attribute of the associated
17
+ * label. If no ID is provided, a random one will be automatically generated
18
+ * to ensure unique identification, facilitating proper label association and
19
+ * accessibility.
20
+ */
21
+ this.inputId = v4();
22
+ /**
23
+ * Defines the maximum height of the multiselect list when open.
24
+ */
25
+ this.maxHeight = '200px';
26
+ /**
27
+ * Text for the badge showing the number of selected items.
28
+ */
29
+ this.badgeLabel = '';
30
+ /**
31
+ * The text to display when no items match the filter.
32
+ */
33
+ this.emptyresult = 'No results found';
34
+ /**
35
+ * Marks the input field as required.
36
+ */
37
+ this.required = false;
38
+ /**
39
+ * Alters the input field's appearance to indicate an error.
40
+ */
41
+ this.error = false;
42
+ /**
43
+ * Display the input field's content without allowing users to change it.
44
+ */
45
+ this.readonly = false;
46
+ /**
47
+ * Disables the input field.
48
+ */
49
+ this.disabled = false;
50
+ /**
51
+ * The autocomplete prop for faster input filling.
52
+ */
53
+ this.autocomplete = 'off';
54
+ /**
55
+ * Enables or disables the filtering feature for the multiselect items.
56
+ */
57
+ this.filterable = false;
58
+ /**
59
+ * State of the multiselect popover.
60
+ */
61
+ this.open = false;
62
+ /**
63
+ * Options configuration for the multiselect items.
64
+ */
65
+ this.parsedOptions = [];
66
+ /**
67
+ * List of selected values in the multiselect.
68
+ */
69
+ this.selectedValues = [];
70
+ /**
71
+ * Sorted options for display.
72
+ */
73
+ this.sortedOptions = [];
74
+ /**
75
+ * The text entered by the user for filtering multiselect items.
76
+ */
77
+ this.filterText = '';
78
+ /**
79
+ * Determines whether the multiselect is filterable.
80
+ */
81
+ this.isFilterable = this.filterable;
82
+ /**
83
+ * Delay in milliseconds before the search is triggered when typing in the filter input.
84
+ * @default 300
85
+ */
86
+ this.debounceDelay = 300;
87
+ /**
88
+ * State for the mode of the multiselect.
89
+ * @type {'options' | 'slots'}
90
+ * @default 'options'
91
+ */
92
+ this.modeState = 'options'; // Default value
93
+ this.isHandlingEscape = false;
94
+ /**x
95
+ * Handle badge close for options mode.
96
+ */
97
+ this.handleBadgeCloseOptions = () => {
98
+ this.selectedValues = [];
99
+ this.multiselectChange.emit(this.selectedValues);
100
+ // Uncheck all elements
101
+ const items = Array.from(this.el.querySelectorAll('nv-fielddropdownitemcheck'));
102
+ items.forEach(item => {
103
+ item.checked = false;
104
+ item.style.display = '';
105
+ });
106
+ // Reorder options without the divider since there are no selected elements
107
+ this.parsedOptions = this.parsedOptions.filter(option => !option.isDivider);
108
+ // Reorder options without the divider since there are no selected elements
109
+ this.reorderOptionsContent();
110
+ };
111
+ /**
112
+ * Handle badge close for slots mode.
113
+ */
114
+ this.handleBadgeCloseSlots = () => {
115
+ this.selectedValues = [];
116
+ this.multiselectChange.emit(this.selectedValues);
117
+ // Uncheck all elements
118
+ const items = Array.from(this.el.querySelectorAll('nv-fielddropdownitemcheck'));
119
+ items.forEach(item => {
120
+ item.checked = false;
121
+ item.style.display = '';
122
+ });
123
+ // Reorder slot content
124
+ this.reorderSlotContent();
125
+ };
126
+ /**
127
+ * Handle popover close
128
+ */
129
+ this.handlePopoverClose = () => {
130
+ // If we are handling Escape, ignore this event
131
+ if (this.isHandlingEscape) {
132
+ return;
133
+ }
134
+ this.open = false;
135
+ this.filterText = '';
136
+ // Only reorder based on the mode
137
+ if (this.modeState === 'options') {
138
+ this.reorderOptionsContent();
139
+ }
140
+ else {
141
+ this.reorderSlotContent();
142
+ }
143
+ // Reset filter if needed
144
+ if (this.filterable) {
145
+ this.resetFilter();
146
+ }
147
+ };
148
+ /**
149
+ * Handle input blur for options mode.
150
+ */
151
+ this.handleInputBlurOptions = () => {
152
+ setTimeout(() => {
153
+ if (!this.el.contains(document.activeElement)) {
154
+ // Close the popover without affecting the divider
155
+ this.open = false;
156
+ this.popoverElement.hide();
157
+ // Reset filter if needed
158
+ if (this.filterable) {
159
+ this.filterText = '';
160
+ this.resetFilter();
161
+ }
162
+ }
163
+ }, 150);
164
+ };
165
+ /**
166
+ * Handle click on the input container for options mode.
167
+ * @param {MouseEvent} event - The click event.
168
+ */
169
+ this.handleInputContainerClickOptions = (event) => {
170
+ if (this.disabled || this.readonly) {
171
+ return;
172
+ }
173
+ const target = event.target;
174
+ if (target.tagName === 'P' || target.tagName === 'SPAN') {
175
+ this.open = true;
176
+ this.popoverElement.show();
177
+ const inputContainer = this.el.querySelector('.input-container');
178
+ if (inputContainer) {
179
+ inputContainer.classList.add('focus-within');
180
+ const removeFocusWithin = () => {
181
+ inputContainer.classList.remove('focus-within');
182
+ };
183
+ this.popoverElement.addEventListener('hide', removeFocusWithin);
184
+ }
185
+ }
186
+ };
187
+ /**
188
+ * Handle click on the input container for slots mode.
189
+ * @param {MouseEvent} event - The click event.
190
+ */
191
+ this.handleInputContainerClickSlots = (event) => {
192
+ if (this.disabled || this.readonly) {
193
+ return;
194
+ }
195
+ const target = event.target;
196
+ if (target.tagName === 'P' || target.tagName === 'SPAN') {
197
+ this.open = true;
198
+ this.popoverElement.show();
199
+ const inputContainer = this.el.querySelector('.input-container');
200
+ if (inputContainer) {
201
+ inputContainer.classList.add('focus-within');
202
+ const removeFocusWithin = () => {
203
+ inputContainer.classList.remove('focus-within');
204
+ };
205
+ this.popoverElement.addEventListener('hide', removeFocusWithin);
206
+ }
207
+ }
208
+ };
209
+ /**
210
+ * Handle input change for options mode.
211
+ * @param {Event} event - The input event.
212
+ */
213
+ this.handleInputOptions = (event) => {
214
+ if (!this.filterable)
215
+ return;
216
+ if (this.disabled || this.readonly) {
217
+ return;
218
+ }
219
+ const input = event.target;
220
+ this.value = input.value;
221
+ this.valueChanged.emit(this.value);
222
+ // Clear any existing timer
223
+ if (this.debounceTimer) {
224
+ window.clearTimeout(this.debounceTimer);
225
+ }
226
+ // Set a new timer for filtering
227
+ this.debounceTimer = window.setTimeout(() => {
228
+ this.filterText = input.value.toLowerCase();
229
+ this.filterItemsOption();
230
+ }, this.debounceDelay);
231
+ };
232
+ /**
233
+ * Handle input change for slots mode
234
+ * @param {Event} event - The input event.
235
+ */
236
+ this.handleInputSlots = (event) => {
237
+ if (!this.filterable)
238
+ return;
239
+ if (this.disabled || this.readonly)
240
+ return;
241
+ const input = event.target;
242
+ this.value = input.value;
243
+ this.valueChanged.emit(this.value);
244
+ // Clear any existing timer
245
+ if (this.debounceTimer) {
246
+ window.clearTimeout(this.debounceTimer);
247
+ }
248
+ // Set a new timer for filtering
249
+ this.debounceTimer = window.setTimeout(() => {
250
+ this.filterText = input.value.toLowerCase();
251
+ this.filterSlotsItems();
252
+ }, this.debounceDelay);
253
+ };
254
+ /**
255
+ * Handle input focus for options mode.
256
+ */
257
+ this.handleInputFocusOptions = () => {
258
+ if (this.disabled || this.readonly) {
259
+ return;
260
+ }
261
+ this.open = true;
262
+ };
263
+ /**
264
+ * Handle input focus for slots mode.
265
+ */
266
+ this.handleInputFocusSlots = () => {
267
+ if (this.disabled || this.readonly) {
268
+ return;
269
+ }
270
+ this.open = true;
271
+ };
272
+ /**
273
+ * Handle input blur for slots mode.
274
+ */
275
+ this.handleInputBlurSlots = () => {
276
+ setTimeout(() => {
277
+ if (!this.el.contains(document.activeElement)) {
278
+ // Fermer le popover sans affecter le divider
279
+ this.open = false;
280
+ this.popoverElement.hide();
281
+ // Reset filter if needed
282
+ if (this.filterable) {
283
+ this.filterText = '';
284
+ this.resetFilter();
285
+ }
286
+ }
287
+ }, 150);
288
+ };
289
+ /**
290
+ * Toggle the multiselect popover for options mode.
291
+ */
292
+ this.togglePopoverOptions = () => {
293
+ if (this.disabled || this.readonly) {
294
+ return;
295
+ }
296
+ if (this.open) {
297
+ this.handlePopoverClose();
298
+ }
299
+ else {
300
+ this.open = true;
301
+ this.popoverElement.show();
302
+ if (!this.filterable) {
303
+ this.focusFirstItem();
304
+ }
305
+ }
306
+ };
307
+ /**
308
+ * Toggle the multiselect popover for slots mode.
309
+ */
310
+ this.togglePopoverSlots = () => {
311
+ if (this.disabled || this.readonly) {
312
+ return;
313
+ }
314
+ if (this.open) {
315
+ this.handlePopoverClose();
316
+ }
317
+ else {
318
+ this.open = true;
319
+ this.popoverElement.show();
320
+ if (!this.filterable) {
321
+ this.focusFirstItem();
322
+ }
323
+ }
324
+ };
325
+ }
326
+ //#endregion PROPERTIES
327
+ /****************************************************************************/
328
+ //#region LIFECYCLE
329
+ /**
330
+ * Subscribe to click outside event.
331
+ */
332
+ connectedCallback() {
333
+ document.addEventListener('click', this.handleClickOutside.bind(this));
334
+ }
335
+ /**
336
+ * Set the mode state and handle options change.
337
+ */
338
+ componentWillLoad() {
339
+ this.modeState = this.mode;
340
+ // Don't call handleOptionsChange if we are in slots mode
341
+ if (this.modeState === 'options') {
342
+ this.handleOptionsChange(this.options);
343
+ }
344
+ // Add the listener for the hide event
345
+ requestAnimationFrame(() => {
346
+ if (this.popoverElement) {
347
+ this.popoverElement.addEventListener('hide', () => {
348
+ this.handlePopoverClose();
349
+ });
350
+ }
351
+ });
352
+ // Specific initialization for slots mode
353
+ if (this.modeState === 'slots') {
354
+ Promise.resolve().then(() => {
355
+ const items = Array.from(this.el.querySelectorAll('nv-fielddropdownitemcheck'));
356
+ // Initialize selectedValues with checked items
357
+ this.selectedValues = items
358
+ .filter(item => item.hasAttribute('checked'))
359
+ .map(item => item.getAttribute('value') || '');
360
+ // Force a reorder after initialization
361
+ requestAnimationFrame(() => {
362
+ this.reorderSlotContent();
363
+ });
364
+ });
365
+ }
366
+ // Initialize the sorted options array with the parsed options for initial rendering
367
+ if (this.modeState === 'options') {
368
+ this.sortedOptions = [...this.parsedOptions];
369
+ }
370
+ // Apply filtering if the multiselect is filterable and there is a value
371
+ if (this.filterable && this.value) {
372
+ this.filterText = String(this.value).toLocaleLowerCase();
373
+ this.filterItems();
374
+ }
375
+ else {
376
+ // Reset visibility state of all dropdown items
377
+ this.resetFilter();
378
+ }
379
+ }
380
+ /**
381
+ * Force reorder if options mode in componentDidLoad because of the initial render not trigger @watch
382
+ */
383
+ componentDidLoad() {
384
+ if (this.modeState === 'options') {
385
+ requestAnimationFrame(() => {
386
+ this.reorderOptionsContent();
387
+ });
388
+ }
389
+ }
390
+ /**
391
+ * Unsubscribe from click outside event.
392
+ */
393
+ disconnectedCallback() {
394
+ document.removeEventListener('click', this.handleClickOutside.bind(this));
395
+ // Remove the listener for the hide event
396
+ if (this.popoverElement) {
397
+ this.popoverElement.removeEventListener('hide', () => {
398
+ this.handlePopoverClose();
399
+ });
400
+ }
401
+ }
402
+ /**
403
+ * Emitted when the input loses focus.
404
+ * @param {CustomEvent<boolean>} event - The event object containing the focus state.
405
+ */
406
+ handleOpenChanged(event) {
407
+ // Update the open state of popover
408
+ this.open = event.detail;
409
+ if (this.open) {
410
+ if (this.filterText) {
411
+ this.filterItems();
412
+ }
413
+ }
414
+ else if (this.modeState === 'options') {
415
+ this.reorderOptionsContent();
416
+ }
417
+ else {
418
+ this.reorderSlotContent();
419
+ }
420
+ }
421
+ /**
422
+ * Listen for the `itemChecked` event emitted by child items.
423
+ * @param {CustomEvent<{ value: string; checked: boolean }>} event - The event object containing the selected value and its checked state.
424
+ */
425
+ handleItemChecked(event) {
426
+ if (this.disabled || this.readonly) {
427
+ return;
428
+ }
429
+ const { value, checked } = event.detail;
430
+ if (value !== undefined && value !== null) {
431
+ const newSelectedValues = [...this.selectedValues];
432
+ const valueIndex = newSelectedValues.indexOf(value);
433
+ if (checked && valueIndex === -1) {
434
+ newSelectedValues.push(value);
435
+ }
436
+ else if (!checked && valueIndex > -1) {
437
+ newSelectedValues.splice(valueIndex, 1);
438
+ }
439
+ // Update the state and emit the event only if the selection has changed
440
+ if (JSON.stringify(this.selectedValues) !==
441
+ JSON.stringify(newSelectedValues)) {
442
+ this.selectedValues = newSelectedValues;
443
+ // Use requestAnimationFrame to ensure the state is updated before emitting the event
444
+ requestAnimationFrame(() => {
445
+ this.multiselectChange.emit(this.selectedValues);
446
+ });
447
+ }
448
+ }
449
+ else {
450
+ console.warn('Received itemChecked event with undefined or null value'); // Warning log
451
+ }
452
+ }
453
+ /**
454
+ * Emitted when the options change.
455
+ * @param {string | Array<{label: string, value: string, isDivider?: boolean, disabled?: boolean, description?: string, checked?: boolean}>} newValue - The new value of the options.
456
+ */
457
+ handleOptionsChange(newValue) {
458
+ if (typeof newValue === 'string') {
459
+ try {
460
+ const parsedOpts = JSON.parse(newValue);
461
+ this.selectedValues = parsedOpts
462
+ .filter(option => option.checked)
463
+ .map(option => option.value);
464
+ this.parsedOptions = [...parsedOpts];
465
+ }
466
+ catch (error) {
467
+ console.error('Error parsing options:', error);
468
+ this.parsedOptions = [];
469
+ }
470
+ }
471
+ else if (Array.isArray(newValue)) {
472
+ this.selectedValues = newValue
473
+ .filter(option => option.checked)
474
+ .map(option => option.value);
475
+ this.parsedOptions = [...newValue];
476
+ }
477
+ else {
478
+ this.parsedOptions = [];
479
+ }
480
+ // Wait for the options to be fully loaded
481
+ Promise.resolve().then(() => {
482
+ requestAnimationFrame(() => {
483
+ if (this.modeState === 'options') {
484
+ this.reorderOptionsContent();
485
+ }
486
+ });
487
+ });
488
+ }
489
+ /**
490
+ * Emitted when the value changes.
491
+ */
492
+ watchValueHandler() {
493
+ // Handle value change and update the corresponding multiselect item if it exists
494
+ this.setInitialSelection();
495
+ }
496
+ /**
497
+ * Emitted when the filterable property changes.
498
+ * @param {boolean} newValue - The new value of the filterable property.
499
+ */
500
+ watchFilterableHandler(newValue) {
501
+ this.isFilterable = newValue;
502
+ this.filterable = newValue;
503
+ }
504
+ // Add a listener for the slot content
505
+ handleSlotChange(event) {
506
+ // Check: we only want to reorder if it's the "content" slot
507
+ const slot = event.target;
508
+ if (slot && slot.name === 'content') {
509
+ // To give other platforms (VueJS, React, etc.) time to insert all their items,
510
+ // we place the reorder in a requestAnimationFrame
511
+ requestAnimationFrame(() => {
512
+ this.reorderSlotContent();
513
+ });
514
+ }
515
+ }
516
+ //#endregion EVENTS
517
+ /****************************************************************************/
518
+ //#region METHODS
519
+ /**
520
+ * Retrieves the current filter text entered by the user.
521
+ * @returns {string} The filter text.
522
+ */
523
+ async getFilterText() {
524
+ return this.filterText;
525
+ }
526
+ /**
527
+ * Set the initial selection based on the current value and update the inputElement value.
528
+ */
529
+ setInitialSelection() {
530
+ var _a;
531
+ const items = Array.from(this.el.querySelectorAll('nv-fielddropdownitem'));
532
+ const selectedItem = items.find(item => {
533
+ var _a;
534
+ return item.getAttribute('label') === this.value ||
535
+ item.getAttribute('value') === this.value ||
536
+ ((_a = item.textContent) === null || _a === void 0 ? void 0 : _a.trim()) === this.value;
537
+ });
538
+ // Remove 'selected' from all items first to reset the state
539
+ items.forEach(item => {
540
+ item.removeAttribute('selected');
541
+ item.classList.remove('selected');
542
+ });
543
+ if (selectedItem) {
544
+ // Add the `selected` attribute and `selected` class for visual styling
545
+ selectedItem.setAttribute('selected', 'true');
546
+ selectedItem.classList.add('selected');
547
+ // Update the value and inputElement value to reflect the pre-selected item
548
+ this.value =
549
+ selectedItem.getAttribute('label') ||
550
+ selectedItem.getAttribute('value') ||
551
+ ((_a = selectedItem.textContent) === null || _a === void 0 ? void 0 : _a.trim()) ||
552
+ '';
553
+ if (this.inputElement) {
554
+ this.inputElement.value = this.value;
555
+ }
556
+ }
557
+ }
558
+ /**
559
+ * Reset the filter and make all items visible.
560
+ */
561
+ async resetFilter() {
562
+ const items = Array.from(this.el.querySelectorAll('nv-fielddropdownitemcheck'));
563
+ // Reset visibility state of all dropdown items
564
+ items.forEach(item => {
565
+ item.style.display = '';
566
+ });
567
+ // Clean up filter-related UI elements
568
+ const ul = this.el.querySelector('ul');
569
+ if (ul) {
570
+ const emptyMessage = ul.querySelector('[data-empty]');
571
+ if (emptyMessage)
572
+ emptyMessage.remove();
573
+ // Reorder with divider if needed
574
+ const selectedItems = items.filter(item => this.selectedValues.includes(item.getAttribute('value') || ''));
575
+ const unselectedItems = items.filter(item => !this.selectedValues.includes(item.getAttribute('value') || ''));
576
+ if (selectedItems.length > 0) {
577
+ this.manageDivider(ul, selectedItems, unselectedItems);
578
+ }
579
+ }
580
+ }
581
+ /**
582
+ * Returns the list of selected values.
583
+ * @returns {string[]} The selected values.
584
+ */
585
+ async getSelectedValues() {
586
+ return this.selectedValues;
587
+ }
588
+ /**
589
+ * Reorder the content of the slot.
590
+ */
591
+ reorderSlotContent() {
592
+ if (this.modeState === 'options')
593
+ return;
594
+ const ul = this.el.querySelector('ul');
595
+ if (!ul)
596
+ return;
597
+ // Remove all existing <hr class="multiselect-divider">
598
+ ul.querySelectorAll('hr.multiselect-divider').forEach(divider => divider.remove());
599
+ // Retrieve all items (not hidden)
600
+ const items = Array.from(this.el.querySelectorAll('nv-fielddropdownitemcheck')).filter(item => item.style.display !== 'none');
601
+ // If you possibly have a "No results" message:
602
+ const hasEmptyMessage = ul.querySelector('[data-empty]');
603
+ if (hasEmptyMessage) {
604
+ // if there is a "No results found" message, do not reorder
605
+ return;
606
+ }
607
+ // Separate checked vs unchecked
608
+ const selectedItems = items.filter(item => this.selectedValues.includes(item.getAttribute('value') || ''));
609
+ const unselectedItems = items.filter(item => !this.selectedValues.includes(item.getAttribute('value') || ''));
610
+ // Reinsert CHECKED items FIRST
611
+ // appendChild() moves the element without recreating it
612
+ // this is not trigger a re-rendering of the component in the platforms
613
+ selectedItems.forEach(item => {
614
+ ul.appendChild(item); // <-- The <li> (or <nv-fielddropdownitemcheck>) is just "moved" to the end of the list
615
+ });
616
+ // Add a divider if needed
617
+ if (selectedItems.length > 0 && unselectedItems.length > 0) {
618
+ const divider = document.createElement('hr');
619
+ divider.className = 'multiselect-divider';
620
+ ul.appendChild(divider);
621
+ }
622
+ // Reinsert UNCHECKED items at the end
623
+ unselectedItems.forEach(item => {
624
+ ul.appendChild(item);
625
+ });
626
+ }
627
+ /**
628
+ * Reorder the content for options mode with async handling
629
+ */
630
+ reorderOptionsContent() {
631
+ const ul = this.el.querySelector('ul[role="content"]');
632
+ if (!ul)
633
+ return;
634
+ const items = Array.from(ul.querySelectorAll('nv-fielddropdownitemcheck')).filter(item => item.style.display !== 'none');
635
+ const selectedItems = items.filter(item => this.selectedValues.includes(item.getAttribute('value') || ''));
636
+ const unselectedItems = items.filter(item => !this.selectedValues.includes(item.getAttribute('value') || ''));
637
+ // Reorder the elements
638
+ selectedItems.forEach(item => ul.appendChild(item));
639
+ unselectedItems.forEach(item => ul.appendChild(item));
640
+ // Manage the divider after the reordering
641
+ this.manageDivider(ul, selectedItems, unselectedItems);
642
+ }
643
+ /**
644
+ * Filter multiselect items based on the text entered by the user.
645
+ */
646
+ filterItems() {
647
+ const ul = this.el.querySelector('ul');
648
+ if (!ul)
649
+ return;
650
+ // Remove existing empty message if any
651
+ const existingEmptyMessage = ul.querySelector('[data-empty]');
652
+ if (existingEmptyMessage) {
653
+ existingEmptyMessage.remove();
654
+ }
655
+ if (!this.filterText.trim()) {
656
+ if (this.parsedOptions && this.parsedOptions.length > 0) {
657
+ // Reset options display
658
+ const items = Array.from(ul.querySelectorAll('nv-fielddropdownitemcheck'));
659
+ items.forEach(item => {
660
+ item.style.display = '';
661
+ });
662
+ }
663
+ else {
664
+ // Reset slot items display
665
+ const items = Array.from(this.el.querySelectorAll('nv-fielddropdownitemcheck'));
666
+ items.forEach(item => {
667
+ item.style.display = '';
668
+ });
669
+ }
670
+ // Reorder with divider
671
+ const items = Array.from(ul.querySelectorAll('nv-fielddropdownitemcheck'));
672
+ const selectedItems = items.filter(item => this.selectedValues.includes(item.getAttribute('value') || ''));
673
+ const unselectedItems = items.filter(item => !this.selectedValues.includes(item.getAttribute('value') || ''));
674
+ this.manageDivider(ul, selectedItems, unselectedItems);
675
+ return;
676
+ }
677
+ const normalizedFilter = this.normalizeText(this.filterText);
678
+ let hasVisibleItems = false;
679
+ if (this.parsedOptions && this.parsedOptions.length > 0) {
680
+ // Filter options mode
681
+ const items = Array.from(ul.querySelectorAll('nv-fielddropdownitemcheck'));
682
+ items.forEach(item => {
683
+ const option = this.parsedOptions.find(opt => opt.value === item.getAttribute('value'));
684
+ if (option && !option.isDivider) {
685
+ const matchesFilter = this.normalizeText(option.label).includes(normalizedFilter) ||
686
+ this.normalizeText(option.value).includes(normalizedFilter);
687
+ item.style.display = matchesFilter ? '' : 'none';
688
+ if (matchesFilter)
689
+ hasVisibleItems = true;
690
+ }
691
+ });
692
+ // Manage the divider with the visible items
693
+ const visibleItems = items.filter(item => item.style.display !== 'none');
694
+ const visibleSelected = visibleItems.filter(item => this.selectedValues.includes(item.getAttribute('value') || ''));
695
+ const visibleUnselected = visibleItems.filter(item => !this.selectedValues.includes(item.getAttribute('value') || ''));
696
+ this.manageDivider(ul, visibleSelected, visibleUnselected);
697
+ }
698
+ else {
699
+ // Filter slot items mode
700
+ const items = Array.from(this.el.querySelectorAll('nv-fielddropdownitemcheck'));
701
+ items.forEach(item => {
702
+ const label = item.getAttribute('label') || '';
703
+ const value = item.getAttribute('value') || '';
704
+ const textContent = item.textContent || '';
705
+ const matchesFilter = this.normalizeText(label).includes(normalizedFilter) ||
706
+ this.normalizeText(value).includes(normalizedFilter) ||
707
+ this.normalizeText(textContent).includes(normalizedFilter);
708
+ item.style.display = matchesFilter ? '' : 'none';
709
+ if (matchesFilter)
710
+ hasVisibleItems = true;
711
+ });
712
+ }
713
+ // Add empty message if no items match the filter
714
+ if (!hasVisibleItems) {
715
+ const emptyMessage = document.createElement('li');
716
+ emptyMessage.setAttribute('data-empty', 'true');
717
+ emptyMessage.textContent = this.emptyresult;
718
+ emptyMessage.classList.add('no-results-message');
719
+ ul.appendChild(emptyMessage);
720
+ }
721
+ this.reorderSlotContent();
722
+ }
723
+ /**
724
+ * Filter multiselect items in options mode.
725
+ */
726
+ filterItemsOption() {
727
+ const ul = this.el.querySelector('ul');
728
+ if (!ul)
729
+ return;
730
+ const normalizedFilter = this.normalizeText(this.filterText);
731
+ let hasVisibleItems = false;
732
+ const items = Array.from(ul.querySelectorAll('nv-fielddropdownitemcheck'));
733
+ // Reset items if the filter text is empty
734
+ if (!this.filterText.trim()) {
735
+ // Remove the empty message if it exists
736
+ this.removeEmptyMessageOption(ul);
737
+ items.forEach(item => (item.style.display = ''));
738
+ this.reorderOptionsContent(); // Reorder after reset
739
+ return;
740
+ }
741
+ // Filter the items
742
+ items.forEach(item => {
743
+ const label = item.getAttribute('label') || '';
744
+ const value = item.getAttribute('value') || '';
745
+ const matchesFilter = this.normalizeText(label).includes(normalizedFilter) ||
746
+ this.normalizeText(value).includes(normalizedFilter);
747
+ item.style.display = matchesFilter ? '' : 'none';
748
+ if (matchesFilter)
749
+ hasVisibleItems = true;
750
+ });
751
+ // Manage the divider with the visible items
752
+ const visibleItems = items.filter(item => item.style.display !== 'none');
753
+ const visibleSelected = visibleItems.filter(item => this.selectedValues.includes(item.getAttribute('value') || ''));
754
+ const visibleUnselected = visibleItems.filter(item => !this.selectedValues.includes(item.getAttribute('value') || ''));
755
+ this.manageDivider(ul, visibleSelected, visibleUnselected);
756
+ // Add or remove the empty message based on the case
757
+ if (!hasVisibleItems) {
758
+ this.addEmptyMessageOption(ul);
759
+ }
760
+ else {
761
+ this.removeEmptyMessageOption(ul);
762
+ }
763
+ }
764
+ /**
765
+ * Filter multiselect items in slots mode
766
+ */
767
+ filterSlotsItems() {
768
+ if (this.modeState === 'options')
769
+ return;
770
+ const ul = this.el.querySelector('ul');
771
+ if (!ul)
772
+ return;
773
+ // Remove existing empty message if any
774
+ const existingEmptyMessage = ul.querySelector('[data-empty]');
775
+ if (existingEmptyMessage) {
776
+ existingEmptyMessage.remove();
777
+ }
778
+ // If filter text is empty, reset all items visibility
779
+ if (!this.filterText.trim()) {
780
+ this.resetFilter();
781
+ return;
782
+ }
783
+ const normalizedFilter = this.normalizeText(this.filterText);
784
+ let hasVisibleItems = false;
785
+ // Get all items and preserve them in the DOM
786
+ const items = Array.from(this.el.querySelectorAll('nv-fielddropdownitemcheck'));
787
+ // Instead of removing/reordering, just hide/show items
788
+ items.forEach(item => {
789
+ var _a;
790
+ const label = item.getAttribute('label') || '';
791
+ const value = item.getAttribute('value') || '';
792
+ const textContent = ((_a = item.textContent) === null || _a === void 0 ? void 0 : _a.trim()) || '';
793
+ const matchesFilter = this.normalizeText(label).includes(normalizedFilter) ||
794
+ this.normalizeText(value).includes(normalizedFilter) ||
795
+ this.normalizeText(textContent).includes(normalizedFilter);
796
+ item.style.display = matchesFilter ? '' : 'none';
797
+ if (matchesFilter)
798
+ hasVisibleItems = true;
799
+ });
800
+ // Get visible items after filtering
801
+ const visibleItems = items.filter(item => item.style.display !== 'none');
802
+ const visibleSelectedItems = visibleItems.filter(item => this.selectedValues.includes(item.getAttribute('value') || ''));
803
+ this.manageDivider(ul, visibleSelectedItems, visibleItems.filter(item => !this.selectedValues.includes(item.getAttribute('value') || '')));
804
+ // Add empty message if no items match the filter
805
+ if (!hasVisibleItems) {
806
+ const emptyMessage = document.createElement('li');
807
+ emptyMessage.setAttribute('data-empty', 'true');
808
+ emptyMessage.textContent = this.emptyresult;
809
+ emptyMessage.classList.add('no-results-message');
810
+ ul.appendChild(emptyMessage);
811
+ }
812
+ }
813
+ /**
814
+ * Normalizes text by removing accents and converting to lowercase
815
+ * @param {string} text - The text to normalize
816
+ * @returns {string} The normalized text
817
+ *
818
+ * @example
819
+ * normalizeText("Café Latte") => "cafe latte"
820
+ *
821
+ * @description
822
+ * This function performs text normalization in three steps:
823
+ * 1. Decomposes characters into their base form and combining characters (NFD)
824
+ * 2. Removes all diacritical marks (accents, umlauts, etc.)
825
+ * 3. Converts to lowercase and trims whitespace
826
+ *
827
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize} - MDN documentation on String.normalize()
828
+ * @see {@link https://en.wikipedia.org/wiki/Unicode_equivalence#Normal_forms} - More info about Unicode normalization forms
829
+ */
830
+ normalizeText(text) {
831
+ return text
832
+ .normalize('NFD') // Decompose characters into base + combining characters (e.g., é => e + ´)
833
+ .replace(/[\u0300-\u036f]/g, '') // Remove all diacritical marks (Unicode range for combining characters)
834
+ .toLowerCase() // Convert to lowercase
835
+ .trim(); // Remove leading and trailing whitespace
836
+ }
837
+ /**
838
+ * Handle click outside the component.
839
+ * @param {MouseEvent} event - The click event.
840
+ */
841
+ handleClickOutside(event) {
842
+ if (this.el.contains(event.target) ||
843
+ (this.inputElement && this.inputElement.contains(event.target))) {
844
+ return;
845
+ }
846
+ // Use handlePopoverClose for all cases
847
+ this.handlePopoverClose();
848
+ }
849
+ /**
850
+ * Handle keyboard events & arrow key navigation.
851
+ * If the multiselect is not open, opens it and focuses on the first item if the list is not filterable.
852
+ * If the multiselect is open, handles arrow key navigation and closes it if the focus is outside the component.
853
+ * @param {KeyboardEvent} event - The keyboard event.
854
+ */
855
+ async handleKeyDown(event) {
856
+ if (!this.open) {
857
+ if (event.key === 'ArrowDown') {
858
+ this.open = true;
859
+ this.popoverElement.show();
860
+ // Focus on the first item if the list is not filterable
861
+ if (!this.filterable) {
862
+ requestAnimationFrame(() => {
863
+ this.focusFirstItem();
864
+ });
865
+ }
866
+ event.preventDefault();
867
+ return;
868
+ }
869
+ return;
870
+ }
871
+ const items = Array.from(this.el.querySelectorAll('nv-fielddropdownitemcheck:not([style*="display: none"])'));
872
+ if (items.length === 0) {
873
+ console.warn('No visible items found to navigate');
874
+ return;
875
+ }
876
+ let currentIndex = items.findIndex(item => item.classList.contains('highlighted'));
877
+ if (event.key === 'ArrowDown') {
878
+ event.preventDefault();
879
+ currentIndex =
880
+ currentIndex === -1 ? 0 : (currentIndex + 1) % items.length;
881
+ this.updateHighlightedItem(items, currentIndex);
882
+ }
883
+ else if (event.key === 'ArrowUp') {
884
+ event.preventDefault();
885
+ currentIndex =
886
+ currentIndex === -1
887
+ ? items.length - 1
888
+ : (currentIndex - 1 + items.length) % items.length;
889
+ this.updateHighlightedItem(items, currentIndex);
890
+ }
891
+ else if (event.key === 'Enter' && currentIndex >= 0) {
892
+ event.preventDefault();
893
+ const selectedItem = items[currentIndex];
894
+ // Toggle the checked state
895
+ const isCurrentlyChecked = selectedItem.hasAttribute('checked');
896
+ selectedItem.checked = !isCurrentlyChecked;
897
+ // Trigger a click event to ensure proper event handling
898
+ selectedItem.dispatchEvent(new MouseEvent('click', {
899
+ view: window,
900
+ bubbles: true,
901
+ cancelable: true,
902
+ }));
903
+ }
904
+ else if (event.key === 'Escape') {
905
+ event.preventDefault();
906
+ event.stopPropagation(); // Prevent the event from propagating to the popover
907
+ // Do the reorder and wait a bit before closing
908
+ const handleEscape = async () => {
909
+ this.isHandlingEscape = true; // Disable the hide listener
910
+ if (this.modeState === 'options') {
911
+ this.reorderOptionsContent();
912
+ }
913
+ else {
914
+ this.reorderSlotContent();
915
+ }
916
+ // Wait for the reorder to be applied
917
+ await new Promise(resolve => setTimeout(resolve, 100));
918
+ // Reactivate the hide listener after a short delay
919
+ setTimeout(() => {
920
+ this.isHandlingEscape = false;
921
+ this.open = false;
922
+ this.popoverElement.hide();
923
+ }, 150);
924
+ if (this.inputElement) {
925
+ this.inputElement.blur();
926
+ }
927
+ };
928
+ await handleEscape();
929
+ }
930
+ }
931
+ /**
932
+ * Updates the highlighted item in the dropdown list.
933
+ *
934
+ * @param {(HTMLNvFielddropdownitemElement | HTMLNvFielddropdownitemcheckElement)[]} items - The items to update.
935
+ * @param {number} index - The index of the item to highlight.
936
+ */
937
+ updateHighlightedItem(items, index) {
938
+ items.forEach((item, i) => {
939
+ if (i === index) {
940
+ item.classList.add('highlighted');
941
+ item.setAttribute('tabindex', '0');
942
+ item.scrollIntoView({ block: 'nearest' });
943
+ // Focus on the nv-fieldcheckbox inside
944
+ const checkbox = item.querySelector('nv-fieldcheckbox');
945
+ if (checkbox) {
946
+ checkbox.focus();
947
+ }
948
+ }
949
+ else {
950
+ item.classList.remove('highlighted');
951
+ item.setAttribute('tabindex', '-1');
952
+ }
953
+ });
954
+ }
955
+ /**
956
+ * Focus on the first item in the dropdown list.
957
+ */
958
+ focusFirstItem() {
959
+ const firstItem = this.el.querySelector('nv-fielddropdownitemcheck:not([style*="display: none"])');
960
+ if (firstItem) {
961
+ firstItem.setAttribute('tabindex', '0');
962
+ firstItem.classList.add('highlighted');
963
+ firstItem.scrollIntoView({ block: 'nearest' });
964
+ // Focus on the nv-fieldcheckbox inside
965
+ const checkbox = firstItem.querySelector('nv-fieldcheckbox');
966
+ if (checkbox) {
967
+ checkbox.focus();
968
+ }
969
+ }
970
+ else {
971
+ console.warn('No visible first item found to focus');
972
+ }
973
+ }
974
+ addEmptyMessageOption(ul) {
975
+ const existingMessage = ul.querySelector('[data-empty]');
976
+ if (existingMessage)
977
+ return;
978
+ const emptyMessage = document.createElement('li');
979
+ emptyMessage.setAttribute('data-empty', 'true');
980
+ emptyMessage.textContent = this.emptyresult;
981
+ emptyMessage.classList.add('no-results-message');
982
+ ul.appendChild(emptyMessage);
983
+ }
984
+ removeEmptyMessageOption(ul) {
985
+ const existingMessage = ul.querySelector('[data-empty]');
986
+ if (existingMessage)
987
+ existingMessage.remove();
988
+ }
989
+ /**
990
+ * Watch for changes in the mode prop and update modeState accordingly
991
+ * @param {string} newValue - The new mode value
992
+ */
993
+ handleModeChange(newValue) {
994
+ this.modeState = newValue;
995
+ }
996
+ manageDivider(ul, selectedItems, unselectedItems) {
997
+ let divider = ul.querySelector('hr.multiselect-divider');
998
+ if (!divider) {
999
+ divider = document.createElement('hr');
1000
+ divider.className = 'multiselect-divider';
1001
+ ul.appendChild(divider);
1002
+ }
1003
+ const shouldShowDivider = selectedItems.length > 0 && unselectedItems.length > 0;
1004
+ if (shouldShowDivider) {
1005
+ // Place the divider after the last selected item
1006
+ const lastSelectedItem = selectedItems[selectedItems.length - 1];
1007
+ lastSelectedItem.after(divider);
1008
+ divider.style.display = '';
1009
+ }
1010
+ else {
1011
+ divider.style.display = 'none';
1012
+ }
1013
+ }
1014
+ //#endregion METHODS
1015
+ /****************************************************************************/
1016
+ //#region RENDER
1017
+ /**
1018
+ * Renders the component in options mode
1019
+ * @returns {any} The JSX for options mode
1020
+ */
1021
+ renderOptionsMode() {
1022
+ return (h(Host, null, (this.label || this.el.querySelector('[slot="label"]')) && (h("label", { htmlFor: this.inputId }, h("slot", { name: "label" }, this.label))), h("nv-popover", { ref: el => (this.popoverElement = el), triggerMode: "controlled", placement: "bottom-start", open: this.open }, h("div", { class: "input-wrapper-multiselect", slot: "trigger" }, h("slot", { name: "before-input" }), h("div", { class: "input-container-multiselect" }, h("slot", { name: "leading-input" }), h("nv-badge", { slot: "leading-input", "prevent-auto-close": "true", color: "10", dismissible: this.selectedValues.length > 0, hidden: this.selectedValues.length <= 0, label: `${this.selectedValues.length} ${this.badgeLabel}`, "aria-label": `Clear all ${this.selectedValues.length} ${this.badgeLabel} items`, onCloseClicked: this.handleBadgeCloseOptions }), this.isFilterable || this.disabled || this.readonly ? (h("input", { id: this.inputId, ref: e => (this.inputElement = e), autocomplete: this.autocomplete, placeholder: this.placeholder, name: this.name, value: this.value, required: this.required, disabled: this.disabled, readOnly: this.readonly, onInput: this.handleInputOptions, onFocus: this.handleInputFocusOptions, onBlur: this.handleInputBlurOptions, onKeyDown: this.handleKeyDown })) : (h("p", { id: this.inputId, class: "non-filterable-text", onClick: this.handleInputContainerClickOptions, tabIndex: 0, onKeyDown: this.handleKeyDown, onFocus: this.handleInputFocusOptions, role: "combobox", "aria-expanded": this.open }, h("span", null, this.value || this.placeholder))), h("nv-iconbutton", { class: "toggle-dropdown-icon", name: this.open ? 'chevron-top' : 'chevron-down', size: "md", emphasis: "lower", "aria-label": this.open ? 'Hide dropdown' : 'Show dropdown', "aria-pressed": this.open.toString(), onClick: this.togglePopoverOptions })), h("slot", { name: "after-input" })), h("div", { slot: "content", role: "listbox", "aria-multiselectable": "true", style: { 'max-height': this.maxHeight, 'overflow-y': 'auto' } }, h("ul", { role: "content" }, this.parsedOptions.map(option => (h("nv-fielddropdownitemcheck", { label: option.label, description: option.description, value: option.value, checked: this.selectedValues.includes(option.value), disabled: option.disabled }))), h("hr", { class: "multiselect-divider", style: { display: 'none' } })))), this.renderDescriptions()));
1023
+ }
1024
+ /**
1025
+ * Renders the component in slots mode
1026
+ * @returns {any} The JSX for slots mode
1027
+ */
1028
+ renderSlotsMode() {
1029
+ return (h(Host, null, (this.label || this.el.querySelector('[slot="label"]')) && (h("label", { htmlFor: this.inputId }, h("slot", { name: "label" }, this.label))), h("nv-popover", { ref: el => (this.popoverElement = el), triggerMode: "controlled", placement: "bottom-start", open: this.open }, h("div", { class: "input-wrapper-multiselect", slot: "trigger" }, h("slot", { name: "before-input" }), h("div", { class: "input-container-multiselect", onClick: this.handleInputContainerClickSlots }, h("slot", { name: "leading-input" }, h("p", null, "No leading input")), h("nv-badge", { slot: "leading-input", "prevent-auto-close": "true", color: "10", dismissible: this.selectedValues.length > 0, hidden: this.selectedValues.length <= 0, label: `${this.selectedValues.length} ${this.badgeLabel}`, "aria-label": `Clear all ${this.selectedValues.length} ${this.badgeLabel} items`, onCloseClicked: this.handleBadgeCloseSlots }), this.isFilterable || this.disabled || this.readonly ? (h("input", { id: this.inputId, ref: e => (this.inputElement = e), autocomplete: this.autocomplete, placeholder: this.placeholder, name: this.name, value: this.value, required: this.required, disabled: this.disabled, readOnly: this.readonly, onInput: this.handleInputSlots, onFocus: this.handleInputFocusSlots, onBlur: this.handleInputBlurSlots, onKeyDown: this.handleKeyDown })) : (h("p", { id: this.inputId, class: "non-filterable-text", onClick: this.handleInputContainerClickSlots, tabIndex: 0, onKeyDown: this.handleKeyDown, onFocus: this.handleInputFocusSlots, role: "combobox", "aria-expanded": this.open }, h("span", null, this.value || this.placeholder))), h("nv-iconbutton", { class: "toggle-dropdown-icon", name: this.open ? 'chevron-top' : 'chevron-down', size: "md", emphasis: "lower", "aria-label": this.open ? 'Hide dropdown' : 'Show dropdown', "aria-pressed": this.open.toString(), onClick: this.togglePopoverSlots })), h("slot", { name: "after-input" })), h("div", { slot: "content", role: "listbox", "aria-multiselectable": "true", style: { 'max-height': this.maxHeight, 'overflow-y': 'auto' } }, h("slot", { name: "content" }))), this.renderDescriptions()));
1030
+ }
1031
+ /**
1032
+ * Renders description and error description sections
1033
+ * @returns {any} The JSX for descriptions
1034
+ */
1035
+ renderDescriptions() {
1036
+ return [
1037
+ (this.description || this.el.querySelector('[slot="description"]')) && (h("div", { class: "description" }, h("slot", { name: "description" }, this.description))),
1038
+ (this.errorDescription ||
1039
+ this.el.querySelector('[slot="error-description"]')) && (h("div", { hidden: !this.error, class: "error-description" }, h("slot", { name: "error-description" }, this.errorDescription))),
1040
+ ];
1041
+ }
1042
+ /**
1043
+ * Main render method that decides which mode to render
1044
+ * @returns {any} The JSX for the component
1045
+ */
1046
+ render() {
1047
+ return this.modeState === 'options'
1048
+ ? this.renderOptionsMode()
1049
+ : this.renderSlotsMode();
1050
+ }
1051
+ get el() { return getElement(this); }
1052
+ static get watchers() { return {
1053
+ "options": ["handleOptionsChange"],
1054
+ "value": ["watchValueHandler"],
1055
+ "filterable": ["watchFilterableHandler"],
1056
+ "mode": ["handleModeChange"]
1057
+ }; }
1058
+ };
1059
+ NvFieldmultiselect.style = NvFieldmultiselectStyle0;
1060
+
1061
+ export { NvFieldmultiselect as nv_fieldmultiselect };
1062
+
1063
+ //# sourceMappingURL=nv-fieldmultiselect.entry.js.map