@nova-design-system/nova-webcomponents 3.0.0-beta.33 → 3.0.0-beta.35

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