wj-elements 0.7.6 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/dist/animations.js +28 -51
  2. package/dist/animations.js.map +1 -1
  3. package/dist/base-path.js +19 -31
  4. package/dist/base-path.js.map +1 -1
  5. package/dist/custom-elements.json +9053 -9048
  6. package/dist/dark.css +1 -302
  7. package/dist/date.js +16 -36
  8. package/dist/date.js.map +1 -1
  9. package/dist/element-utils.js +20 -81
  10. package/dist/element-utils.js.map +1 -1
  11. package/dist/event.js +49 -165
  12. package/dist/event.js.map +1 -1
  13. package/dist/form-associated-element-BjeJn7j8.js +101 -0
  14. package/dist/{form-associated-element-DEQ4y-jn.js.map → form-associated-element-BjeJn7j8.js.map} +1 -1
  15. package/dist/icon-DmsqtDpL.js +102 -0
  16. package/dist/{icon-CReYMzAK.js.map → icon-DmsqtDpL.js.map} +1 -1
  17. package/dist/light.css +1 -731
  18. package/dist/localize.js +36 -111
  19. package/dist/localize.js.map +1 -1
  20. package/dist/packages/wje-accordion-item/accordion-item.element.d.ts +3 -2
  21. package/dist/packages/wje-img/img.element.d.ts +4 -4
  22. package/dist/permissions.js +14 -41
  23. package/dist/permissions.js.map +1 -1
  24. package/dist/popup.element-CbkhthPP.js +806 -0
  25. package/dist/{popup.element-CwXvVFK7.js.map → popup.element-CbkhthPP.js.map} +1 -1
  26. package/dist/router-links-CNsJ-elb.js +105 -0
  27. package/dist/{router-links-wjqCnncc.js.map → router-links-CNsJ-elb.js.map} +1 -1
  28. package/dist/skeleton.css +1 -197
  29. package/dist/styles.css +1 -866
  30. package/dist/universal-service.js +48 -109
  31. package/dist/universal-service.js.map +1 -1
  32. package/dist/utils.js +11 -18
  33. package/dist/utils.js.map +1 -1
  34. package/dist/web-types.json +698 -698
  35. package/dist/wje-accordion-item.js +33 -106
  36. package/dist/wje-accordion-item.js.map +1 -1
  37. package/dist/wje-accordion.js +19 -84
  38. package/dist/wje-accordion.js.map +1 -1
  39. package/dist/wje-animation.js +37 -4258
  40. package/dist/wje-animation.js.map +1 -1
  41. package/dist/wje-aside.js +9 -34
  42. package/dist/wje-aside.js.map +1 -1
  43. package/dist/wje-avatar.js +36 -126
  44. package/dist/wje-avatar.js.map +1 -1
  45. package/dist/wje-badge.js +10 -52
  46. package/dist/wje-badge.js.map +1 -1
  47. package/dist/wje-breadcrumb.js +205 -668
  48. package/dist/wje-breadcrumb.js.map +1 -1
  49. package/dist/wje-breadcrumbs.js +177 -633
  50. package/dist/wje-breadcrumbs.js.map +1 -1
  51. package/dist/wje-button-group.js +48 -153
  52. package/dist/wje-button-group.js.map +1 -1
  53. package/dist/wje-button.js +92 -413
  54. package/dist/wje-button.js.map +1 -1
  55. package/dist/wje-card-content.js +7 -30
  56. package/dist/wje-card-content.js.map +1 -1
  57. package/dist/wje-card-controls.js +7 -30
  58. package/dist/wje-card-controls.js.map +1 -1
  59. package/dist/wje-card-header.js +7 -30
  60. package/dist/wje-card-header.js.map +1 -1
  61. package/dist/wje-card-subtitle.js +7 -34
  62. package/dist/wje-card-subtitle.js.map +1 -1
  63. package/dist/wje-card-title.js +7 -34
  64. package/dist/wje-card-title.js.map +1 -1
  65. package/dist/wje-card.js +15 -71
  66. package/dist/wje-card.js.map +1 -1
  67. package/dist/wje-carousel-item.js +12 -56
  68. package/dist/wje-carousel-item.js.map +1 -1
  69. package/dist/wje-carousel.js +154 -509
  70. package/dist/wje-carousel.js.map +1 -1
  71. package/dist/wje-checkbox.js +50 -227
  72. package/dist/wje-checkbox.js.map +1 -1
  73. package/dist/wje-chip.js +43 -160
  74. package/dist/wje-chip.js.map +1 -1
  75. package/dist/wje-col.js +7 -20
  76. package/dist/wje-col.js.map +1 -1
  77. package/dist/wje-color-picker.js +445 -1464
  78. package/dist/wje-color-picker.js.map +1 -1
  79. package/dist/wje-container.js +9 -35
  80. package/dist/wje-container.js.map +1 -1
  81. package/dist/wje-copy-button.js +64 -204
  82. package/dist/wje-copy-button.js.map +1 -1
  83. package/dist/wje-dialog.js +85 -553
  84. package/dist/wje-dialog.js.map +1 -1
  85. package/dist/wje-divider.js +7 -34
  86. package/dist/wje-divider.js.map +1 -1
  87. package/dist/wje-dropdown.js +78 -305
  88. package/dist/wje-dropdown.js.map +1 -1
  89. package/dist/wje-element.js +191 -700
  90. package/dist/wje-element.js.map +1 -1
  91. package/dist/wje-file-upload-item.js +51 -156
  92. package/dist/wje-file-upload-item.js.map +1 -1
  93. package/dist/wje-file-upload.js +181 -619
  94. package/dist/wje-file-upload.js.map +1 -1
  95. package/dist/wje-footer.js +7 -31
  96. package/dist/wje-footer.js.map +1 -1
  97. package/dist/wje-form.js +7 -32
  98. package/dist/wje-form.js.map +1 -1
  99. package/dist/wje-format-digital.js +26 -118
  100. package/dist/wje-format-digital.js.map +1 -1
  101. package/dist/wje-grid.js +7 -33
  102. package/dist/wje-grid.js.map +1 -1
  103. package/dist/wje-header.js +9 -35
  104. package/dist/wje-header.js.map +1 -1
  105. package/dist/wje-icon-library.js +12 -18
  106. package/dist/wje-icon-library.js.map +1 -1
  107. package/dist/wje-icon-picker.js +65 -320
  108. package/dist/wje-icon-picker.js.map +1 -1
  109. package/dist/wje-icon.js +1 -1
  110. package/dist/wje-img-comparer.js +37 -114
  111. package/dist/wje-img-comparer.js.map +1 -1
  112. package/dist/wje-img.js +50 -197
  113. package/dist/wje-img.js.map +1 -1
  114. package/dist/wje-infinite-scroll.js +94 -346
  115. package/dist/wje-infinite-scroll.js.map +1 -1
  116. package/dist/wje-input-file.js +23 -84
  117. package/dist/wje-input-file.js.map +1 -1
  118. package/dist/wje-input.js +78 -392
  119. package/dist/wje-input.js.map +1 -1
  120. package/dist/wje-item.js +11 -64
  121. package/dist/wje-item.js.map +1 -1
  122. package/dist/wje-kanban.js +124 -401
  123. package/dist/wje-kanban.js.map +1 -1
  124. package/dist/wje-label.js +9 -32
  125. package/dist/wje-label.js.map +1 -1
  126. package/dist/wje-level-indicator.js +38 -157
  127. package/dist/wje-level-indicator.js.map +1 -1
  128. package/dist/wje-list.js +10 -40
  129. package/dist/wje-list.js.map +1 -1
  130. package/dist/wje-main.js +7 -31
  131. package/dist/wje-main.js.map +1 -1
  132. package/dist/wje-masonry.js +66 -211
  133. package/dist/wje-masonry.js.map +1 -1
  134. package/dist/wje-master.js +45 -161
  135. package/dist/wje-master.js.map +1 -1
  136. package/dist/wje-menu-button.js +10 -38
  137. package/dist/wje-menu-button.js.map +1 -1
  138. package/dist/wje-menu-item.js +127 -577
  139. package/dist/wje-menu-item.js.map +1 -1
  140. package/dist/wje-menu-label.js +9 -35
  141. package/dist/wje-menu-label.js.map +1 -1
  142. package/dist/wje-menu.js +14 -49
  143. package/dist/wje-menu.js.map +1 -1
  144. package/dist/wje-option.js +48 -279
  145. package/dist/wje-option.js.map +1 -1
  146. package/dist/wje-options.js +130 -384
  147. package/dist/wje-options.js.map +1 -1
  148. package/dist/wje-orgchart-group.js +16 -52
  149. package/dist/wje-orgchart-group.js.map +1 -1
  150. package/dist/wje-orgchart-item.js +24 -93
  151. package/dist/wje-orgchart-item.js.map +1 -1
  152. package/dist/wje-orgchart.js +18 -68
  153. package/dist/wje-orgchart.js.map +1 -1
  154. package/dist/wje-pagination.js +113 -397
  155. package/dist/wje-pagination.js.map +1 -1
  156. package/dist/wje-popup.js +3 -3
  157. package/dist/wje-popup.js.map +1 -1
  158. package/dist/wje-progress-bar.js +53 -205
  159. package/dist/wje-progress-bar.js.map +1 -1
  160. package/dist/wje-qr-code.js +398 -2980
  161. package/dist/wje-qr-code.js.map +1 -1
  162. package/dist/wje-radio-group.js +52 -190
  163. package/dist/wje-radio-group.js.map +1 -1
  164. package/dist/wje-radio.js +24 -118
  165. package/dist/wje-radio.js.map +1 -1
  166. package/dist/wje-rate.js +62 -266
  167. package/dist/wje-rate.js.map +1 -1
  168. package/dist/wje-relative-time.js +24 -99
  169. package/dist/wje-relative-time.js.map +1 -1
  170. package/dist/wje-reorder-dropzone.js +9 -31
  171. package/dist/wje-reorder-dropzone.js.map +1 -1
  172. package/dist/wje-reorder-handle.js +67 -204
  173. package/dist/wje-reorder-handle.js.map +1 -1
  174. package/dist/wje-reorder-item.js +14 -44
  175. package/dist/wje-reorder-item.js.map +1 -1
  176. package/dist/wje-reorder.js +61 -246
  177. package/dist/wje-reorder.js.map +1 -1
  178. package/dist/wje-route.js +6 -24
  179. package/dist/wje-route.js.map +1 -1
  180. package/dist/wje-router-link.js +11 -39
  181. package/dist/wje-router-link.js.map +1 -1
  182. package/dist/wje-router-outlet.js +76 -172
  183. package/dist/wje-router-outlet.js.map +1 -1
  184. package/dist/wje-routerx.js +537 -1331
  185. package/dist/wje-routerx.js.map +1 -1
  186. package/dist/wje-row.js +9 -31
  187. package/dist/wje-row.js.map +1 -1
  188. package/dist/wje-select.js +326 -1152
  189. package/dist/wje-select.js.map +1 -1
  190. package/dist/wje-slider.js +44 -225
  191. package/dist/wje-slider.js.map +1 -1
  192. package/dist/wje-sliding-container.js +295 -1319
  193. package/dist/wje-sliding-container.js.map +1 -1
  194. package/dist/wje-split-view.js +35 -121
  195. package/dist/wje-split-view.js.map +1 -1
  196. package/dist/wje-status.js +14 -45
  197. package/dist/wje-status.js.map +1 -1
  198. package/dist/wje-step.js +9 -32
  199. package/dist/wje-step.js.map +1 -1
  200. package/dist/wje-stepper.js +109 -357
  201. package/dist/wje-stepper.js.map +1 -1
  202. package/dist/wje-store.js +67 -360
  203. package/dist/wje-store.js.map +1 -1
  204. package/dist/wje-tab-group.js +85 -314
  205. package/dist/wje-tab-group.js.map +1 -1
  206. package/dist/wje-tab-panel.js +7 -28
  207. package/dist/wje-tab-panel.js.map +1 -1
  208. package/dist/wje-tab.js +21 -198
  209. package/dist/wje-tab.js.map +1 -1
  210. package/dist/wje-textarea.js +64 -264
  211. package/dist/wje-textarea.js.map +1 -1
  212. package/dist/wje-thumbnail.js +10 -51
  213. package/dist/wje-thumbnail.js.map +1 -1
  214. package/dist/wje-toast.js +127 -632
  215. package/dist/wje-toast.js.map +1 -1
  216. package/dist/wje-toggle.js +52 -177
  217. package/dist/wje-toggle.js.map +1 -1
  218. package/dist/wje-toolbar-action.js +128 -456
  219. package/dist/wje-toolbar-action.js.map +1 -1
  220. package/dist/wje-toolbar.js +75 -270
  221. package/dist/wje-toolbar.js.map +1 -1
  222. package/dist/wje-tooltip.js +50 -161
  223. package/dist/wje-tooltip.js.map +1 -1
  224. package/dist/wje-tree-item.js +70 -301
  225. package/dist/wje-tree-item.js.map +1 -1
  226. package/dist/wje-tree.js +145 -489
  227. package/dist/wje-tree.js.map +1 -1
  228. package/dist/wje-visually-hidden.js +7 -34
  229. package/dist/wje-visually-hidden.js.map +1 -1
  230. package/package.json +4 -2
  231. package/dist/form-associated-element-DEQ4y-jn.js +0 -245
  232. package/dist/icon-CReYMzAK.js +0 -245
  233. package/dist/popup.element-CwXvVFK7.js +0 -2133
  234. package/dist/router-links-wjqCnncc.js +0 -156
@@ -9,1279 +9,453 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
11
11
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
12
- var _addedOptions, _htmlOptions, _portaledOptionRecords, _remoteOptionsLoaded, _isRemoteOptionsLoading, _Select_instances, htmlSelectedItem_fn, getSelectedOptions_fn, hasVisibleOptions_fn, updateEmptyState_fn, _applySearchFilter, _handleOptionsLoad, _onMenuItemClickCapture, _syncPortalStyles, copyPortalCustomProperties_fn, syncOptionOwners_fn, portalOptions_fn, _restorePortaledOptions, focusFindInput_fn, syncOptionCheckbox_fn;
13
- import { F as FormAssociatedElement } from "./form-associated-element-DEQ4y-jn.js";
14
- import { event } from "./event.js";
15
- import { Localizer } from "./localize.js";
16
- import Button from "./wje-button.js";
12
+ var _t, _e, _i, _s, _r, _c_instances, m_fn, o_fn, b_fn, c_fn, _h, _p, _n, _a, g_fn, w_fn, v_fn, _l, d_fn, u_fn;
13
+ import { F as t } from "./form-associated-element-BjeJn7j8.js";
14
+ import { event as e } from "./event.js";
15
+ import { Localizer as i } from "./localize.js";
16
+ import s from "./wje-button.js";
17
17
  import "./wje-popup.js";
18
- import { I as Icon } from "./icon-CReYMzAK.js";
19
- import Label from "./wje-label.js";
20
- import Chip from "./wje-chip.js";
21
- import Input from "./wje-input.js";
22
- import Option from "./wje-option.js";
23
- import Options from "./wje-options.js";
24
- import Checkbox from "./wje-checkbox.js";
25
- import { P as Popup } from "./popup.element-CwXvVFK7.js";
26
- const styles = "/*\n[ WJ Select ]\n*/\n\n:host {\n margin-bottom: var(--wje-select-margin-bottom);\n width: 100%;\n display: block;\n [slot='arrow'] {\n transform: rotate(0deg);\n transition: all 0.2s ease-in;\n }\n label {\n margin: var(--wje-select-label-margin);\n padding: var(--wje-select-label-padding);\n display: var(--wje-select-label-display);\n opacity: 1;\n cursor: text;\n transition: opacity 0.2s ease;\n line-height: var(--wje-select-label-line-height);\n font-size: var(--wje-select-label-font-size);\n }\n}\n\n.native-select {\n position: relative;\n &.default {\n .wrapper {\n display: block;\n background-color: var(--wje-select-background);\n border-width: var(--wje-select-border-width);\n border-style: var(--wje-select-border-style);\n border-color: var(--wje-select-border-color);\n border-radius: var(--wje-select-border-radius);\n padding-inline: 0.5rem;\n padding-top: 0.125rem;\n padding-bottom: 0.125rem;\n }\n .input-wrapper {\n padding: 0;\n min-height: 28px;\n margin-top: -4px;\n }\n &.focused {\n wje-label {\n opacity: 0.67;\n font-size: 12px;\n letter-spacing: normal;\n }\n }\n label {\n &.fade {\n opacity: 0.5;\n font-size: 12px;\n letter-spacing: normal;\n }\n }\n }\n &.standard {\n .wrapper {\n height: var(--wje-select-height);\n box-sizing: border-box;\n background-color: var(--wje-select-background);\n border-width: var(--wje-select-border-width);\n border-style: var(--wje-select-border-style);\n border-color: var(--wje-select-border-color);\n border-radius: var(--wje-select-border-radius);\n }\n .input-wrapper {\n background: transparent;\n width: 100%;\n }\n slot[name='error'] {\n position: static;\n\n background: transparent;\n padding: 0.25rem 0;\n left: auto;\n transform: none;\n color: var(--wje-input-color-invalid);\n font-size: 12px;\n line-height: normal;\n }\n }\n}\n\n.wrapper {\n display: flex;\n width: 100%;\n}\n\n.input-wrapper {\n display: grid;\n grid-template-columns: auto minmax(0, 1fr) auto auto auto;\n align-items: center;\n background-color: var(--wje-select-background);\n /*min-height: 28px;*/\n color: var(--wje-select-color);\n line-height: var(--wje-select-line-height);\n appearance: none;\n padding: 2px 0.5rem;\n font-size: 14px !important;\n font-weight: normal;\n vertical-align: middle;\n input[readonly] {\n pointer-events: none;\n caret-color: transparent;\n }\n}\n\ninput {\n color: var(--wje-select-color);\n line-height: var(--wje-select-line-height);\n font-size: 14px !important;\n font-weight: 400;\n letter-spacing: 0.01em;\n border: medium;\n height: 25px;\n min-height: 25px;\n padding: 0;\n background: none;\n box-shadow: none;\n width: 100%;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n outline: 0;\n font-size: 14px !important;\n}\n\n.display-wrapper {\n display: block;\n min-width: 0;\n width: 100%;\n position: relative;\n}\n\n.display-input {\n position: absolute;\n inset: 0;\n opacity: 0;\n pointer-events: none;\n}\n\n.display-text {\n display: block;\n min-width: 0;\n width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: var(--wje-select-color);\n line-height: var(--wje-select-line-height);\n font-size: 14px !important;\n font-weight: 400;\n letter-spacing: 0.01em;\n}\n\n.display-text[data-placeholder-visible]::before {\n content: attr(data-placeholder);\n}\n\n::placeholder {\n opacity: 1;\n}\n\n:host [active] {\n .wrapper {\n border-radius: var(--wje-select-border-radius);\n }\n [slot='arrow'] {\n transform: rotate(180deg);\n transition: all 0.2s ease-in;\n }\n}\n\n.options-wrapper {\n box-sizing: border-box;\n min-width: 100%;\n border-width: var(--wje-select-options-border-width);\n border-style: var(--wje-select-options-border-style);\n border-color: var(--wje-select-options-border-color);\n border-radius: var(--wje-select-options-border-radius);\n margin-top: calc(0px - var(--wje-select-border-width));\n background-color: var(--wje-select-options-background-color);\n overflow: hidden;\n}\n\n.find {\n margin-block: var(--wje-select-find-margin-block);\n margin-inline: var(--wje-select-find-margin-inline);\n width: var(--wje-select-find-width);\n}\n\n.list {\n overflow: auto;\n height: 100%;\n position: relative;\n}\n\n.list:has(.empty:not([hidden])) {\n min-height: 44px;\n}\n\n.empty {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: var(--wje-spacing-small);\n color: var(--wje-select-color);\n text-align: center;\n background-color: var(--wje-select-options-background-color);\n pointer-events: none;\n}\n\n.empty[hidden] {\n display: none;\n}\n\n.options-wrapper:has(.find) .list {\n height: calc(100% - 32px - 2 * var(--wje-select-find-margin-block));\n}\n\n:host([multiple]) input {\n position: absolute;\n z-index: -1;\n top: 0;\n left: 0;\n width: 0;\n height: 0;\n opacity: 0;\n}\n\n:host([multiple]) .display-wrapper {\n display: none;\n}\n\n:host([multiple]) .chips {\n display: flex;\n grid-column: 2;\n grid-row: 1;\n flex: 1 1 auto;\n min-width: 0;\n max-width: 100%;\n align-items: center;\n flex-wrap: nowrap;\n gap: var(--wje-spacing-3x-small);\n overflow: hidden;\n white-space: nowrap;\n}\n\n:host([disabled]) .input-wrapper {\n opacity: 0.5;\n pointer-events: none;\n cursor: not-allowed;\n}\n\n.counter {\n flex: 0 0 auto;\n padding-inline: 0.5rem;\n}\n\nwje-chip {\n --wje-chip-margin: 0 0.25rem 0 0;\n}\n\n:host([multiple]) wje-chip {\n flex: 0 1 auto;\n min-width: var(--wje-select-chip-min-width, 2.5rem);\n max-width: 100%;\n}\n\n:host([multiple]) wje-chip:first-of-type {\n flex-shrink: 10;\n}\n\n:host([multiple]) wje-button[part='clear'] {\n grid-column: 3;\n grid-row: 1;\n}\n\n:host([multiple]) .slot-end {\n grid-column: 4;\n grid-row: 1;\n}\n\n:host([multiple]) [slot='arrow'] {\n grid-column: 5;\n grid-row: 1;\n}\n\nwje-button {\n --wje-padding-top: 0.25rem;\n --wje-padding-start: 0.25rem;\n --wje-padding-end: 0.25rem;\n --wje-padding-bottom: 0.25rem;\n --wje-button-margin-inline: 0 0.25rem;\n}\n\n.slot-start,\n.slot-end {\n &:not(:empty) {\n margin-right: 0.5rem;\n }\n}\n\nslot[name='error'] {\n display: none;\n}\n\n:host([invalid]) slot[name='error'] {\n display: block;\n}\n\nslot[name='error'] {\n display: none;\n position: absolute;\n max-width: 100%;\n min-width: auto;\n border-radius: 50px;\n background-color: var(--wje-select-error-background-color, var(--wje-tooltip-background));\n padding: 0.25rem 0.5rem;\n top: 0;\n left: 50%;\n transform: translate(-50%, -50%);\n color: var(--wje-select-error-color, var(--wje-tooltip-color));\n font-size: var(--wje-font-size-small);\n width: max-content;\n line-height: normal;\n}\n\n.input-hidden{\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n padding: 0;\n margin: 0;\n opacity: 0;\n z-index: -1;\n}\n\n:host([required]) .wrapper::after {\n color: var(--wje-input-color-invalid);\n content: var(--wje-input-required-symbol);\n font-size: 24px;\n position: absolute;\n right: 12px;\n top: 0;\n}\n\n:host([required]) .standard .input-wrapper::after {\n right: 13px;\n top: -20px;\n}\n";
27
- const _Select = class _Select extends FormAssociatedElement {
18
+ import { I as r } from "./icon-DmsqtDpL.js";
19
+ import o from "./wje-label.js";
20
+ import n from "./wje-chip.js";
21
+ import a from "./wje-input.js";
22
+ import l from "./wje-option.js";
23
+ import d from "./wje-options.js";
24
+ import p from "./wje-checkbox.js";
25
+ import { P as h } from "./popup.element-CbkhthPP.js";
26
+ const _c = class _c extends t {
28
27
  constructor() {
29
28
  super();
30
- __privateAdd(this, _Select_instances);
31
- __privateAdd(this, _addedOptions, []);
32
- __privateAdd(this, _htmlOptions, []);
33
- __privateAdd(this, _portaledOptionRecords, []);
34
- __privateAdd(this, _remoteOptionsLoaded, false);
35
- __privateAdd(this, _isRemoteOptionsLoading, false);
36
- /**
37
- * An object representing component dependencies with their respective classes.
38
- * Each property in the object maps a custom component name (as a string key)
39
- * to its corresponding class or constructor.
40
- * @typedef {{[key: string]: Function}} Dependencies
41
- * @property {Function} 'wje-button' Represents the Button component class.
42
- * @property {Function} 'wje-popup' Represents the Popup component class.
43
- * @property {Function} 'wje-icon' Represents the Icon component class.
44
- * @property {Function} 'wje-label' Represents the Label component class.
45
- * @property {Function} 'wje-chip' Represents the Chip component class.
46
- * @property {Function} 'wje-input' Represents the Input component class.
47
- * @property {Function} 'wje-option' Represents the Option component class.
48
- * @property {Function} 'wje-checkbox' Represents the Checkbox component class.
49
- */
50
- __publicField(this, "dependencies", {
51
- "wje-button": Button,
52
- "wje-popup": Popup,
53
- "wje-icon": Icon,
54
- "wje-label": Label,
55
- "wje-chip": Chip,
56
- "wje-input": Input,
57
- "wje-option": Option,
58
- "wje-options": Options,
59
- "wje-checkbox": Checkbox
60
- });
29
+ __privateAdd(this, _c_instances);
30
+ __privateAdd(this, _t, []);
31
+ __privateAdd(this, _e, []);
32
+ __privateAdd(this, _i, []);
33
+ __privateAdd(this, _s, false);
34
+ __privateAdd(this, _r, false);
35
+ __publicField(this, "dependencies", { "wje-button": s, "wje-popup": h, "wje-icon": r, "wje-label": o, "wje-chip": n, "wje-input": a, "wje-option": l, "wje-options": d, "wje-checkbox": p });
61
36
  __publicField(this, "className", "Select");
62
- /**
63
- * Handles the change event for an option element within a select-like component.
64
- * This method processes user interactions with options and updates the state of the component,
65
- * including selection management, validation, and UI updates. Behavior differs based on
66
- * whether the component supports multiple selections.
67
- * Key functionality:
68
- * - Prevents the default behavior, event propagation, and immediate propagation of the event.
69
- * - Retrieves all options within the component.
70
- * - If the component doesn't support multiple selection:
71
- * - Marks only the clicked option as selected and deselects others.
72
- * - Hides the option popup.
73
- * - If the component supports multiple selection:
74
- * - Processes the clicked option without deselecting others.
75
- * - Updates the selected options and triggers validation.
76
- * - Marks the form state as non-pristine.
77
- * - Propagates the validation state to other relevant parts of the component or system.
78
- * @param {Event} e The event object representing the option change interaction.
79
- */
80
- __publicField(this, "optionChange", (e) => {
81
- e.preventDefault();
82
- e.stopPropagation();
83
- e.stopImmediatePropagation();
84
- if (this.readonly || this.disabled) return;
85
- let allOptions = this.getAllOptions();
86
- if (!this.hasAttribute("multiple")) {
87
- allOptions.forEach((option) => {
88
- if (option.value === e.target.value) {
89
- this.processClickedOption(option);
90
- } else {
91
- option.selected = false;
92
- }
93
- });
94
- this.popup.hide(false);
95
- } else {
96
- this.processClickedOption(e.target, true);
97
- }
98
- this.selections();
99
- this.validate(this.selectedOptions);
100
- this.pristine = false;
101
- this.propagateValidation();
37
+ __publicField(this, "optionChange", (t2) => {
38
+ if (t2.preventDefault(), t2.stopPropagation(), t2.stopImmediatePropagation(), this.readonly || this.disabled) return;
39
+ let e2 = this.getAllOptions();
40
+ this.hasAttribute("multiple") ? this.processClickedOption(t2.target, true) : (e2.forEach((e3) => {
41
+ e3.value === t2.target.value ? this.processClickedOption(e3) : e3.selected = false;
42
+ }), this.popup.hide(false)), this.selections(), this.validate(this.selectedOptions), this.pristine = false, this.propagateValidation();
102
43
  });
103
- /**
104
- * Handles the logic for processing the selection state of a clicked option element.
105
- * @function processClickedOption
106
- * @param {Element} option The option element that is clicked.
107
- * @param {boolean} [multiple] A Boolean indicating whether multiple options can be selected. Defaults to false.
108
- * Changes the selected state of the passed option and updates the selected options list.
109
- * Checks if the option already has a "selected" attribute, toggles its state,
110
- * and updates the internal selected options.
111
- */
112
- __publicField(this, "processClickedOption", (option, multiple = false) => {
113
- const isSelected = option.hasAttribute("selected");
114
- option.selected = !isSelected;
115
- this.selectedOptions = __privateMethod(this, _Select_instances, getSelectedOptions_fn).call(this, multiple ? this.selectedOptions : []);
116
- this.syncAria();
44
+ __publicField(this, "processClickedOption", (t2, e2 = false) => {
45
+ const i2 = t2.hasAttribute("selected");
46
+ t2.selected = !i2, this.selectedOptions = __privateMethod(this, _c_instances, o_fn).call(this, e2 ? this.selectedOptions : []), this.syncAria();
117
47
  });
118
- /**
119
- * Handles the removal of a chip element from the DOM and updates the related state.
120
- * @param {Event} e The event object triggered by the chip removal action.
121
- * The target of the event is expected to be the chip element itself.
122
- */
123
- __publicField(this, "removeChip", (e) => {
124
- e.target.parentNode.removeChild(e.target);
125
- this.processClickedOption(e.target.option, true);
126
- this.selections();
48
+ __publicField(this, "removeChip", (t2) => {
49
+ t2.target.parentNode.removeChild(t2.target), this.processClickedOption(t2.target.option, true), this.selections();
127
50
  });
128
- /**
129
- * Filters option elements based on the search input value.
130
- * This function applies a search filter to a list of options. If a `wj-options` element exists and has
131
- * the `lazy` attribute, the search value is passed to the `wj-options` element, enabling infinite scroll
132
- * functionality to handle the filtering. If the `lazy` attribute is not present, it performs a local
133
- * search to show or hide options depending on whether their text content matches the search input.
134
- * @param {Event} e The input event containing the search input value from the user.
135
- */
136
- __privateAdd(this, _applySearchFilter, (e) => {
137
- const optionsElement = this.querySelector("wje-options");
138
- if (optionsElement && optionsElement.hasAttribute("lazy")) {
139
- optionsElement.setAttribute("search", e.target.value);
140
- } else {
141
- let value = e.target.value.trim().toLowerCase();
142
- this.getAllOptions().forEach((option) => {
143
- if (option.textContent.trim().toLowerCase().includes(value)) {
144
- option.style.display = "block";
145
- } else {
146
- option.style.display = "none";
147
- }
148
- });
149
- __privateMethod(this, _Select_instances, updateEmptyState_fn).call(this);
51
+ __privateAdd(this, _h, (t2) => {
52
+ const e2 = this.querySelector("wje-options");
53
+ if (e2 && e2.hasAttribute("lazy")) e2.setAttribute("search", t2.target.value);
54
+ else {
55
+ let e3 = t2.target.value.trim().toLowerCase();
56
+ this.getAllOptions().forEach((t3) => {
57
+ t3.textContent.trim().toLowerCase().includes(e3) ? t3.style.display = "block" : t3.style.display = "none";
58
+ }), __privateMethod(this, _c_instances, c_fn).call(this);
150
59
  }
151
60
  });
152
- __privateAdd(this, _handleOptionsLoad, (e) => {
153
- var _a;
154
- __privateSet(this, _remoteOptionsLoaded, true);
155
- __privateSet(this, _isRemoteOptionsLoading, false);
156
- this.selectedOptions.forEach((option) => {
157
- this.getAllOptions().forEach((el) => {
158
- if (el.value === option.value) {
159
- el.selected = true;
160
- }
61
+ __privateAdd(this, _p, (t2) => {
62
+ var _a2;
63
+ __privateSet(this, _s, true), __privateSet(this, _r, false), this.selectedOptions.forEach((t3) => {
64
+ this.getAllOptions().forEach((e2) => {
65
+ e2.value === t3.value && (e2.selected = true);
161
66
  });
162
67
  });
163
- const attrValue = ((_a = this.getAttribute("value")) == null ? void 0 : _a.split(" ")) || [];
164
- attrValue.forEach((val) => {
165
- const existingOption = Array.from(this.getAllOptions()).find((el) => el.value === val);
166
- if (existingOption) {
167
- existingOption.selected = true;
168
- }
169
- });
170
- this.selectedOptions = __privateMethod(this, _Select_instances, getSelectedOptions_fn).call(this, this.selectedOptions);
171
- this.selections(true);
172
- __privateMethod(this, _Select_instances, updateEmptyState_fn).call(this);
173
- __privateMethod(this, _Select_instances, syncOptionOwners_fn).call(this);
174
- __privateMethod(this, _Select_instances, portalOptions_fn).call(this);
175
- this.list.scrollTo(0, 0);
176
- event.dispatchCustomEvent(this.popup, "wje-popup:content-ready");
68
+ (((_a2 = this.getAttribute("value")) == null ? void 0 : _a2.split(" ")) || []).forEach((t3) => {
69
+ const e2 = Array.from(this.getAllOptions()).find((e3) => e3.value === t3);
70
+ e2 && (e2.selected = true);
71
+ }), this.selectedOptions = __privateMethod(this, _c_instances, o_fn).call(this, this.selectedOptions), this.selections(true), __privateMethod(this, _c_instances, c_fn).call(this), __privateMethod(this, _c_instances, w_fn).call(this), __privateMethod(this, _c_instances, v_fn).call(this), this.list.scrollTo(0, 0), e.dispatchCustomEvent(this.popup, "wje-popup:content-ready");
177
72
  });
178
- /**
179
- * Prevent closing the parent <wje-select>'s popup when a nested <wje-dropdown>
180
- * menu item is clicked. Closes only the dropdown that owns the clicked item.
181
- * This captures the event at the document level (useCapture=true) so it can
182
- * stop the global outside-click logic that would otherwise hide the select's popup.
183
- */
184
- __privateAdd(this, _onMenuItemClickCapture, (e) => {
185
- const target = e.target;
186
- if (!target || !target.closest) return;
187
- const menuItem = target.closest("wje-menu-item");
188
- if (!menuItem) return;
189
- const dropdown = target.closest("wje-dropdown");
190
- if (dropdown && typeof dropdown.hide === "function") {
191
- dropdown.hide();
192
- }
193
- e.stopPropagation();
73
+ __privateAdd(this, _n, (t2) => {
74
+ const e2 = t2.target;
75
+ if (!e2 || !e2.closest) return;
76
+ if (!e2.closest("wje-menu-item")) return;
77
+ const i2 = e2.closest("wje-dropdown");
78
+ i2 && "function" == typeof i2.hide && i2.hide(), t2.stopPropagation();
194
79
  });
195
- __privateAdd(this, _syncPortalStyles, (e) => {
196
- var _a;
197
- const container = (_a = e.detail) == null ? void 0 : _a.container;
198
- if (!(container instanceof HTMLElement)) return;
199
- container.setAttribute("data-wje-select-portal", "");
200
- __privateMethod(this, _Select_instances, copyPortalCustomProperties_fn).call(this, container);
201
- __privateMethod(this, _Select_instances, portalOptions_fn).call(this, container);
202
- if (container.querySelector("style[data-wje-select-portal-style]")) return;
203
- const style = document.createElement("style");
204
- style.setAttribute("data-wje-select-portal-style", "");
205
- style.textContent = _Select.portalStyles;
206
- container.prepend(style);
80
+ __privateAdd(this, _a, (t2) => {
81
+ var _a2;
82
+ const e2 = (_a2 = t2.detail) == null ? void 0 : _a2.container;
83
+ if (!(e2 instanceof HTMLElement)) return;
84
+ if (e2.setAttribute("data-wje-select-portal", ""), __privateMethod(this, _c_instances, g_fn).call(this, e2), __privateMethod(this, _c_instances, v_fn).call(this, e2), e2.querySelector("style[data-wje-select-portal-style]")) return;
85
+ const i2 = document.createElement("style");
86
+ i2.setAttribute("data-wje-select-portal-style", ""), i2.textContent = _c.portalStyles, e2.prepend(i2);
207
87
  });
208
- __privateAdd(this, _restorePortaledOptions, () => {
209
- if (__privateGet(this, _portaledOptionRecords).length === 0) return;
210
- __privateGet(this, _portaledOptionRecords).forEach(({ option, placeholder }) => {
211
- option.removeEventListener("wje-option:change", this.optionChange);
212
- option.removeAttribute("data-wje-select-portaled-option");
213
- if (placeholder.parentNode) {
214
- placeholder.parentNode.insertBefore(option, placeholder);
215
- placeholder.remove();
216
- }
217
- });
218
- __privateSet(this, _portaledOptionRecords, []);
88
+ __privateAdd(this, _l, () => {
89
+ 0 !== __privateGet(this, _i).length && (__privateGet(this, _i).forEach(({ option: t2, placeholder: e2 }) => {
90
+ t2.removeEventListener("wje-option:change", this.optionChange), t2.removeAttribute("data-wje-select-portaled-option"), e2.parentNode && (e2.parentNode.insertBefore(t2, e2), e2.remove());
91
+ }), __privateSet(this, _i, []));
219
92
  });
220
- this.localizer = new Localizer(this);
221
- this.counterEl = null;
222
- this._wasOppened = false;
223
- this.native = null;
224
- this.popup = null;
225
- this.labelElement = null;
226
- this.slotStart = null;
227
- this.slotEnd = null;
228
- this.input = null;
229
- this.displayText = null;
230
- this.chips = null;
231
- this.clear = null;
232
- this.list = null;
233
- this.emptyState = null;
234
- this._value = [];
235
- this._selectedOptions = [];
236
- this._instanceId = ++_Select._instanceId;
93
+ this.localizer = new i(this), this.counterEl = null, this._wasOppened = false, this.native = null, this.popup = null, this.labelElement = null, this.slotStart = null, this.slotEnd = null, this.input = null, this.displayText = null, this.chips = null, this.clear = null, this.list = null, this.emptyState = null, this._value = [], this._selectedOptions = [], this._instanceId = ++_c._instanceId;
94
+ }
95
+ set value(t2) {
96
+ const e2 = new FormData();
97
+ if (t2) {
98
+ let i2 = t2, s2 = t2;
99
+ Array.isArray(i2) ? s2 = i2.join(" ") : i2 = i2.split(" "), i2.forEach((t3) => {
100
+ e2.append(this.name, t3);
101
+ }), t2 = e2, this._value = i2, this.setAttribute("value", s2);
102
+ } else e2.delete(this.name), t2 = e2, this._value = [], this.removeAttribute("value");
103
+ this.internals.setFormValue(t2);
237
104
  }
238
- /**
239
- * Sets the value for the form field. Converts the input value into a FormData object
240
- * if it is not already an array, splitting by spaces if necessary, and sets the
241
- * internal form value as well as the selected values.
242
- * @param {string|Array} value The value to be set. Can be a string (which will be
243
- * split into an array by spaces) or an array of values.
244
- */
245
- set value(value) {
246
- const formData = new FormData();
247
- if (value) {
248
- let data = value;
249
- let dataString = value;
250
- if (!Array.isArray(data)) {
251
- data = data.split(" ");
252
- } else {
253
- dataString = data.join(" ");
254
- }
255
- data.forEach((v) => {
256
- formData.append(this.name, v);
257
- });
258
- value = formData;
259
- this._value = data;
260
- this.setAttribute("value", dataString);
261
- } else {
262
- formData.delete(this.name);
263
- value = formData;
264
- this._value = [];
265
- this.removeAttribute("value");
266
- }
267
- this.internals.setFormValue(value);
268
- }
269
- /**
270
- * Retrieves the current value.
271
- * @returns {any} The value of the `_value` property.
272
- */
273
105
  get value() {
274
106
  return this._value;
275
107
  }
276
- /**
277
- * Sets the maximum number of options allowed.
278
- * @param { number | object} value The value to set as the maximum number of options.
279
- * If null, the 'max-options' attribute will be removed.
280
- */
281
- set maxOptions(value) {
282
- if (value) {
283
- this.setAttribute("max-options", value);
284
- } else {
285
- this.removeAttribute("max-options");
286
- }
108
+ set maxOptions(t2) {
109
+ t2 ? this.setAttribute("max-options", t2) : this.removeAttribute("max-options");
287
110
  }
288
- /**
289
- * Retrieves the maximum number of options allowed.
290
- * Parses the value of the 'max-options' attribute from the element and converts it to a number.
291
- * If the attribute is not present or cannot be converted to a valid number, defaults to 1.
292
- * @returns {number} The maximum number of options, or 0 if the attribute is not set or invalid.
293
- */
294
111
  get maxOptions() {
295
112
  return +this.getAttribute("max-options") || 1;
296
113
  }
297
- /**
298
- * @summary Setter for the defaultValue attribute.
299
- * This method sets the 'value' attribute of the custom input element to the provided value.
300
- * The 'value' attribute represents the default value of the input element.
301
- * @param {string} value The value to set as the default value.
302
- */
303
- set defaultValue(value) {
304
- this.setAttribute("value", value);
114
+ set defaultValue(t2) {
115
+ this.setAttribute("value", t2);
305
116
  }
306
- /**
307
- * @summary Getter for the defaultValue attribute.
308
- * This method retrieves the 'value' attribute of the custom input element.
309
- * The 'value' attribute represents the default value of the input element.
310
- * If the 'value' attribute is not set, it returns an empty string.
311
- * @returns {string} The default value of the input element.
312
- */
313
117
  get defaultValue() {
314
118
  return this.getAttribute("value") ?? "";
315
119
  }
316
- /**
317
- * Sets or removes the `portaled` attribute on the select.
318
- * Mirrors the dropdown API so popup content can be rendered in a portal root.
319
- * @param {boolean|string} value Determines whether and where the popup should be portaled.
320
- */
321
- set portaled(value) {
322
- if (value) {
323
- this.setAttribute("portaled", value);
324
- } else {
325
- this.removeAttribute("portaled");
326
- }
120
+ set portaled(t2) {
121
+ t2 ? this.setAttribute("portaled", t2) : this.removeAttribute("portaled");
327
122
  }
328
- /**
329
- * Getter for the `portaled` attribute value.
330
- * @returns {string} The configured portal target or an empty string for the default body portal.
331
- */
332
123
  get portaled() {
333
124
  return this.getAttribute("portaled") || "";
334
125
  }
335
- /**
336
- * Checks whether popup content should be portaled.
337
- * @returns {boolean} True when the `portaled` attribute is present.
338
- */
339
126
  get isPortaled() {
340
127
  return this.hasAttribute("portaled");
341
128
  }
342
- /**
343
- * Sets the trigger value.
344
- * @param {string} value The trigger value to set.
345
- */
346
- set trigger(value) {
347
- this.setAttribute("trigger", value);
129
+ set trigger(t2) {
130
+ this.setAttribute("trigger", t2);
348
131
  }
349
- /**
350
- * Returns the trigger value.
351
- * @returns {string} The trigger value.
352
- */
353
132
  get trigger() {
354
133
  return this.getAttribute("trigger") || "click";
355
134
  }
356
- /**
357
- * Sets or removes the disabled state for the associated elements.
358
- * @param {boolean} value A boolean indicating whether the elements should be disabled.
359
- * If true, the disabled attribute is added to the elements. If false, the disabled attribute is removed.
360
- */
361
- set disabled(value) {
362
- var _a, _b, _c, _d, _e, _f;
363
- if (value) {
364
- this.setAttribute("disabled", "");
365
- (_a = this.input) == null ? void 0 : _a.setAttribute("disabled", "");
366
- (_b = this.displayInput) == null ? void 0 : _b.setAttribute("disabled", "");
367
- (_c = this.popup) == null ? void 0 : _c.setAttribute("disabled", "");
368
- } else {
369
- this.removeAttribute("disabled");
370
- (_d = this.input) == null ? void 0 : _d.removeAttribute("disabled");
371
- (_e = this.displayInput) == null ? void 0 : _e.removeAttribute("disabled");
372
- (_f = this.popup) == null ? void 0 : _f.removeAttribute("disabled");
373
- }
135
+ set disabled(t2) {
136
+ var _a2, _b, _c2, _d, _e2, _f;
137
+ t2 ? (this.setAttribute("disabled", ""), (_a2 = this.input) == null ? void 0 : _a2.setAttribute("disabled", ""), (_b = this.displayInput) == null ? void 0 : _b.setAttribute("disabled", ""), (_c2 = this.popup) == null ? void 0 : _c2.setAttribute("disabled", "")) : (this.removeAttribute("disabled"), (_d = this.input) == null ? void 0 : _d.removeAttribute("disabled"), (_e2 = this.displayInput) == null ? void 0 : _e2.removeAttribute("disabled"), (_f = this.popup) == null ? void 0 : _f.removeAttribute("disabled"));
374
138
  }
375
- /**
376
- * Retrieves the current state of the 'disabled' attribute.
377
- * @returns {boolean} Returns true if the 'disabled' attribute is present, otherwise false.
378
- */
379
139
  get disabled() {
380
140
  return this.hasAttribute("disabled");
381
141
  }
382
- /**
383
- * Sets the readonly state of the element. When set to true,
384
- * the element and its associated inputs are marked as readonly or disabled.
385
- * When set to false, the readonly and disabled attributes are removed,
386
- * allowing user interaction.
387
- * @param {boolean} value A boolean value indicating whether to set the
388
- * element and its associated inputs to readonly (true) or not (false).
389
- */
390
- set readonly(value) {
391
- var _a, _b, _c, _d, _e, _f;
392
- if (value) {
393
- this.setAttribute("readonly", "");
394
- (_a = this.input) == null ? void 0 : _a.setAttribute("readonly", "");
395
- (_b = this.displayInput) == null ? void 0 : _b.setAttribute("readonly", "");
396
- (_c = this.popup) == null ? void 0 : _c.setAttribute("disabled", "");
397
- } else {
398
- this.removeAttribute("readonly");
399
- (_d = this.input) == null ? void 0 : _d.removeAttribute("readonly");
400
- (_e = this.displayInput) == null ? void 0 : _e.removeAttribute("readonly");
401
- (_f = this.popup) == null ? void 0 : _f.removeAttribute("disabled");
402
- }
142
+ set readonly(t2) {
143
+ var _a2, _b, _c2, _d, _e2, _f;
144
+ t2 ? (this.setAttribute("readonly", ""), (_a2 = this.input) == null ? void 0 : _a2.setAttribute("readonly", ""), (_b = this.displayInput) == null ? void 0 : _b.setAttribute("readonly", ""), (_c2 = this.popup) == null ? void 0 : _c2.setAttribute("disabled", "")) : (this.removeAttribute("readonly"), (_d = this.input) == null ? void 0 : _d.removeAttribute("readonly"), (_e2 = this.displayInput) == null ? void 0 : _e2.removeAttribute("readonly"), (_f = this.popup) == null ? void 0 : _f.removeAttribute("disabled"));
403
145
  }
404
- /**
405
- * Checks if the 'readonly' attribute is present on the element.
406
- * @returns {boolean} Returns true if the 'readonly' attribute is set, otherwise false.
407
- */
408
146
  get readonly() {
409
147
  return this.hasAttribute("readonly");
410
148
  }
411
- /**
412
- * Sets the maximum height value for the element.
413
- * If a value is provided, it sets the 'max-height' attribute on the element.
414
- * If no value is provided, it removes the 'max-height' attribute from the element.
415
- * @param {string|null} value The maximum height to be set. If null or undefined, the attribute is removed.
416
- */
417
- set maxHeight(value) {
418
- if (value) {
419
- this.setAttribute("max-height", value);
420
- } else {
421
- this.removeAttribute("max-height");
422
- }
149
+ set maxHeight(t2) {
150
+ t2 ? this.setAttribute("max-height", t2) : this.removeAttribute("max-height");
423
151
  }
424
- /**
425
- * Retrieves the maximum height value, which is determined by the 'max-height' attribute.
426
- * If the attribute is not set, a default value of '200px' is returned.
427
- * @returns {string} The maximum height value as a string.
428
- */
429
152
  get maxHeight() {
430
153
  return this.getAttribute("max-height") || "auto";
431
154
  }
432
- /**
433
- * Sets the offset attribute for the element.
434
- * @param {string} value The value to assign to the offset attribute.
435
- */
436
- set offset(value) {
437
- this.setAttribute("offset", value);
155
+ set offset(t2) {
156
+ this.setAttribute("offset", t2);
438
157
  }
439
- /**
440
- * Gets the value of the offset attribute of the current element.
441
- * If the offset attribute is not present, returns a default value of '0'.
442
- * @returns {string} The value of the offset attribute or the default value '0'.
443
- */
444
158
  get offset() {
445
159
  return this.getAttribute("offset") || "5";
446
160
  }
447
- /**
448
- * Sets the selected options for the object.
449
- * @param {Array|object} value The new value for the selected options. It can be an array or object containing the selected options.
450
- */
451
- set selectedOptions(value) {
452
- this._selectedOptions = value;
161
+ set selectedOptions(t2) {
162
+ this._selectedOptions = t2;
453
163
  }
454
- /**
455
- * Retrieves the selected options.
456
- * @returns {Array} An array containing the currently selected options. If no options are selected, an empty array is returned.
457
- */
458
164
  get selectedOptions() {
459
165
  return this._selectedOptions || [];
460
166
  }
461
- /**
462
- * Sets the `lazy` attribute on the element. If the provided value is truthy, the `lazy` attribute is added. If the value is falsy, the `lazy` attribute is removed.
463
- * @param {boolean} value A boolean value indicating whether to add or remove the `lazy` attribute. If `true`, the attribute is added; if `false`, it is removed.
464
- */
465
- set lazy(value) {
466
- if (value) {
467
- this.setAttribute("lazy", "");
468
- } else {
469
- this.removeAttribute("lazy");
470
- }
167
+ set lazy(t2) {
168
+ t2 ? this.setAttribute("lazy", "") : this.removeAttribute("lazy");
471
169
  }
472
- /**
473
- * Getter for the 'lazy' property.
474
- * @returns {boolean} Returns true if the 'lazy' attribute is present on the element, otherwise false.
475
- */
476
170
  get lazy() {
477
171
  return this.hasAttribute("lazy");
478
172
  }
479
- /**
480
- * Sets or removes the 'no-size' attribute on an element.
481
- * @param {boolean} value A boolean indicating whether to add or remove the 'no-size' attribute. If true, the attribute is added; if false, the attribute is removed.
482
- */
483
- set noSize(value) {
484
- if (value) {
485
- this.setAttribute("no-size", "");
486
- } else {
487
- this.removeAttribute("no-size");
488
- }
173
+ set noSize(t2) {
174
+ t2 ? this.setAttribute("no-size", "") : this.removeAttribute("no-size");
489
175
  }
490
- /**
491
- * Gets the value of the 'no-size' attribute for the element.
492
- * @returns {boolean} True if the 'no-size' attribute is present, otherwise false.
493
- */
494
176
  get noSize() {
495
177
  return this.hasAttribute("no-size");
496
178
  }
497
- /**
498
- * Getter for the customErrorDisplay attribute.
499
- * @returns {boolean} Whether the attribute is present.
500
- */
501
179
  get customErrorDisplay() {
502
180
  return this.hasAttribute("custom-error-display");
503
181
  }
504
- /**
505
- * Retrieves the complete list of options available for the component.
506
- * The options are determined by combining elements from various sources, including loaded options, added options, and HTML-sourced options.
507
- * If a `wje-options` element is present within the component, its loaded options are included in the merged list.
508
- * In the absence of a `wje-options` element, duplicates among the added and HTML options are removed, retaining their order.
509
- * @returns {Array<object>} An array containing all the available options, combining the loaded, added, and HTML-based options, with duplicates removed where applicable.
510
- */
511
182
  get options() {
512
183
  if (this.querySelector("wje-options")) {
513
- const allOptions = [...this.querySelector("wje-options").loadedOptions, ...__privateGet(this, _addedOptions), ...__privateGet(this, _htmlOptions)];
514
- return allOptions;
515
- } else {
516
- const allOptions = [...__privateGet(this, _addedOptions), ...__privateGet(this, _htmlOptions)];
517
- return Array.from(
518
- new Map(allOptions.reverse().map((obj) => [obj.value, obj])).values()
519
- ).reverse();
184
+ return [...this.querySelector("wje-options").loadedOptions, ...__privateGet(this, _t), ...__privateGet(this, _e)];
185
+ }
186
+ {
187
+ const t2 = [...__privateGet(this, _t), ...__privateGet(this, _e)];
188
+ return Array.from(new Map(t2.reverse().map((t3) => [t3.value, t3])).values()).reverse();
520
189
  }
521
190
  }
522
- /**
523
- * Returns the CSS styles for the component.
524
- * @static
525
- * @returns {CSSStyleSheet}
526
- */
527
191
  static get cssStyleSheet() {
528
- return styles;
192
+ return ":host{margin-bottom:var(--wje-select-margin-bottom);width:100%;display:block}:host [slot=arrow]{transform:rotate(0);transition:all .2s ease-in}:host label{margin:var(--wje-select-label-margin);padding:var(--wje-select-label-padding);display:var(--wje-select-label-display);opacity:1;cursor:text;transition:opacity .2s ease;line-height:var(--wje-select-label-line-height);font-size:var(--wje-select-label-font-size)}.native-select{position:relative}.native-select.default .wrapper{display:block;background-color:var(--wje-select-background);border-width:var(--wje-select-border-width);border-style:var(--wje-select-border-style);border-color:var(--wje-select-border-color);border-radius:var(--wje-select-border-radius);padding-inline:.5rem;padding-top:.125rem;padding-bottom:.125rem}.native-select.default .input-wrapper{padding:0;min-height:28px;margin-top:-4px}.native-select.default.focused wje-label{opacity:.67;font-size:12px;letter-spacing:normal}.native-select.default label.fade{opacity:.5;font-size:12px;letter-spacing:normal}.native-select.standard .wrapper{height:var(--wje-select-height);box-sizing:border-box;background-color:var(--wje-select-background);border-width:var(--wje-select-border-width);border-style:var(--wje-select-border-style);border-color:var(--wje-select-border-color);border-radius:var(--wje-select-border-radius)}.native-select.standard .input-wrapper{background:transparent;width:100%}.native-select.standard slot[name=error]{position:static;background:transparent;padding:.25rem 0;left:auto;transform:none;color:var(--wje-input-color-invalid);font-size:12px;line-height:normal}.wrapper{display:flex;width:100%}.input-wrapper{display:grid;grid-template-columns:auto minmax(0,1fr) auto auto auto;align-items:center;background-color:var(--wje-select-background);color:var(--wje-select-color);line-height:var(--wje-select-line-height);-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:2px .5rem;font-size:14px!important;font-weight:400;vertical-align:middle}.input-wrapper input[readonly]{pointer-events:none;caret-color:transparent}input{color:var(--wje-select-color);line-height:var(--wje-select-line-height);font-weight:400;letter-spacing:.01em;border:medium;height:25px;min-height:25px;padding:0;background:none;box-shadow:none;width:100%;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;outline:0;font-size:14px!important}.display-wrapper{display:block;min-width:0;width:100%;position:relative}.display-input{position:absolute;top:0;right:0;bottom:0;left:0;opacity:0;pointer-events:none}.display-text{display:block;min-width:0;width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--wje-select-color);line-height:var(--wje-select-line-height);font-size:14px!important;font-weight:400;letter-spacing:.01em}.display-text[data-placeholder-visible]:before{content:attr(data-placeholder)}::placeholder{opacity:1}:host [active] .wrapper{border-radius:var(--wje-select-border-radius)}:host [active] [slot=arrow]{transform:rotate(180deg);transition:all .2s ease-in}.options-wrapper{box-sizing:border-box;min-width:100%;border-width:var(--wje-select-options-border-width);border-style:var(--wje-select-options-border-style);border-color:var(--wje-select-options-border-color);border-radius:var(--wje-select-options-border-radius);margin-top:calc(0px - var(--wje-select-border-width));background-color:var(--wje-select-options-background-color);overflow:hidden}.find{margin-block:var(--wje-select-find-margin-block);margin-inline:var(--wje-select-find-margin-inline);width:var(--wje-select-find-width)}.list{overflow:auto;height:100%;position:relative}.list:has(.empty:not([hidden])){min-height:44px}.empty{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;padding:var(--wje-spacing-small);color:var(--wje-select-color);text-align:center;background-color:var(--wje-select-options-background-color);pointer-events:none}.empty[hidden]{display:none}.options-wrapper:has(.find) .list{height:calc(100% - 32px - 2 * var(--wje-select-find-margin-block))}:host([multiple]) input{position:absolute;z-index:-1;top:0;left:0;width:0;height:0;opacity:0}:host([multiple]) .display-wrapper{display:none}:host([multiple]) .chips{display:flex;grid-column:2;grid-row:1;flex:1 1 auto;min-width:0;max-width:100%;align-items:center;flex-wrap:nowrap;gap:var(--wje-spacing-3x-small);overflow:hidden;white-space:nowrap}:host([disabled]) .input-wrapper{opacity:.5;pointer-events:none;cursor:not-allowed}.counter{flex:0 0 auto;padding-inline:.5rem}wje-chip{--wje-chip-margin: 0 .25rem 0 0}:host([multiple]) wje-chip{flex:0 1 auto;min-width:var(--wje-select-chip-min-width, 2.5rem);max-width:100%}:host([multiple]) wje-chip:first-of-type{flex-shrink:10}:host([multiple]) wje-button[part=clear]{grid-column:3;grid-row:1}:host([multiple]) .slot-end{grid-column:4;grid-row:1}:host([multiple]) [slot=arrow]{grid-column:5;grid-row:1}wje-button{--wje-padding-top: .25rem;--wje-padding-start: .25rem;--wje-padding-end: .25rem;--wje-padding-bottom: .25rem;--wje-button-margin-inline: 0 .25rem}.slot-start:not(:empty),.slot-end:not(:empty){margin-right:.5rem}slot[name=error]{display:none}:host([invalid]) slot[name=error]{display:block}slot[name=error]{display:none;position:absolute;max-width:100%;min-width:auto;border-radius:50px;background-color:var(--wje-select-error-background-color, var(--wje-tooltip-background));padding:.25rem .5rem;top:0;left:50%;transform:translate(-50%,-50%);color:var(--wje-select-error-color, var(--wje-tooltip-color));font-size:var(--wje-font-size-small);width:max-content;line-height:normal}.input-hidden{position:absolute;top:0;left:0;width:100%;height:100%;padding:0;margin:0;opacity:0;z-index:-1}:host([required]) .wrapper:after{color:var(--wje-input-color-invalid);content:var(--wje-input-required-symbol);font-size:24px;position:absolute;right:12px;top:0}:host([required]) .standard .input-wrapper:after{right:13px;top:-20px}";
529
193
  }
530
- /**
531
- * Returns the list of attributes to observe for changes.
532
- * @static
533
- * @returns {Array<string>}
534
- */
535
194
  static get observedAttributes() {
536
195
  return ["active", "disabled", "readonly", "portaled"];
537
196
  }
538
- /**
539
- * Sets up the attributes for the component.
540
- */
541
197
  setupAttributes() {
542
- this.isShadowRoot = "open";
543
- this.syncAria();
198
+ this.isShadowRoot = "open", this.syncAria();
544
199
  }
545
200
  beforeDraw() {
546
- if (this.hasAttribute("value")) {
547
- this.value = this.getAttribute("value");
548
- } else {
549
- const selectedOptions = __privateMethod(this, _Select_instances, getSelectedOptions_fn).call(this);
550
- if (selectedOptions.length > 0) {
551
- const values = selectedOptions.map((opt) => opt.value);
552
- this.value = this.hasAttribute("multiple") ? values : values[0];
201
+ if (this.hasAttribute("value")) this.value = this.getAttribute("value");
202
+ else {
203
+ const t2 = __privateMethod(this, _c_instances, o_fn).call(this);
204
+ if (t2.length > 0) {
205
+ const e2 = t2.map((t3) => t3.value);
206
+ this.value = this.hasAttribute("multiple") ? e2 : e2[0];
553
207
  }
554
208
  }
555
209
  }
556
- /**
557
- * Draws the component for the select.
558
- * @returns {DocumentFragment}
559
- */
560
210
  draw() {
561
- let fragment = document.createDocumentFragment();
211
+ let t2 = document.createDocumentFragment();
562
212
  this.classList.add("wje-placement", this.placement ? "wje-" + this.placement : "wje-start");
563
- let native = document.createElement("div");
564
- native.setAttribute("part", "native");
565
- native.classList.add("native-select", this.variant || "default");
566
- let wrapper = document.createElement("div");
567
- wrapper.classList.add("wrapper");
568
- wrapper.setAttribute("slot", "anchor");
569
- let label = document.createElement("label");
570
- label.setAttribute("part", "label");
571
- label.innerText = this.label || "";
572
- let inputWrapper = document.createElement("div");
573
- inputWrapper.setAttribute("part", "input-wrapper");
574
- inputWrapper.classList.add("input-wrapper");
575
- let slotStart = document.createElement("div");
576
- slotStart.classList.add("slot-start");
577
- let input = document.createElement("input");
578
- input.setAttribute("type", "text");
579
- input.value = this.value.join(" ").trim();
580
- input.classList.add("input-hidden");
581
- let display = document.createElement("input");
582
- display.setAttribute("type", "text");
583
- display.setAttribute("part", "input");
584
- display.setAttribute("autocomplete", "off");
585
- display.setAttribute("readonly", "");
586
- display.setAttribute("placeholder", this.placeholder || "");
587
- display.classList.add("display-input");
588
- let displayWrapper = document.createElement("span");
589
- displayWrapper.classList.add("display-wrapper");
590
- let displayText = document.createElement("span");
591
- displayText.setAttribute("part", "input selected-text");
592
- displayText.classList.add("display-text");
593
- displayText.dataset.placeholder = this.placeholder || "";
594
- displayText.toggleAttribute("data-placeholder-visible", Boolean(this.placeholder));
595
- displayText.setAttribute("aria-hidden", "true");
596
- displayWrapper.append(display, displayText);
597
- if (this.required) {
598
- input.setAttribute("required", "");
599
- display.setAttribute("required", "");
600
- }
601
- if (this.disabled) {
602
- input.setAttribute("disabled", "");
603
- display.setAttribute("disabled", "");
604
- }
605
- if (this.readonly) {
606
- input.setAttribute("readonly", "");
607
- display.setAttribute("readonly", "");
608
- }
609
- let slotEnd = document.createElement("div");
610
- slotEnd.classList.add("slot-end");
611
- let arrow = document.createElement("wje-icon");
612
- arrow.setAttribute("name", "chevron-down");
613
- arrow.setAttribute("slot", "arrow");
614
- let chips = document.createElement("div");
615
- chips.classList.add("chips");
616
- chips.innerText = this.placeholder || "";
617
- let optionsWrapper = document.createElement("div");
618
- optionsWrapper.setAttribute("part", "options-wrapper");
619
- optionsWrapper.classList.add("options-wrapper");
620
- optionsWrapper.style.setProperty("height", this.maxHeight);
621
- let list = document.createElement("div");
622
- list.classList.add("list");
623
- this._ariaListId = this.id ? `${this.id}-listbox` : `wje-select-${this._instanceId}-listbox`;
624
- list.id = this._ariaListId;
625
- list.setAttribute("role", "listbox");
626
- if (this.hasAttribute("multiple")) list.setAttribute("aria-multiselectable", "true");
627
- let slot = document.createElement("slot");
628
- let emptyState = document.createElement("div");
629
- emptyState.setAttribute("part", "empty");
630
- emptyState.setAttribute("role", "option");
631
- emptyState.setAttribute("aria-disabled", "true");
632
- emptyState.setAttribute("aria-selected", "false");
633
- emptyState.classList.add("empty");
634
- emptyState.hidden = true;
635
- emptyState.textContent = this.localizer.translate("wj.select.empty");
636
- let clear = document.createElement("wje-button");
637
- clear.setAttribute("fill", "link");
638
- clear.setAttribute("part", "clear");
639
- clear.setAttribute("stop-propagation", "");
640
- let clearIcon = document.createElement("wje-icon");
641
- clearIcon.setAttribute("name", "x");
642
- let error = document.createElement("div");
643
- error.setAttribute("slot", "error");
644
- let errorSlot = document.createElement("slot");
645
- errorSlot.setAttribute("name", "error");
646
- const optionsElement = this.querySelector("wje-options");
647
- const hasRemoteOptions = optionsElement instanceof HTMLElement;
648
- if (hasRemoteOptions) {
649
- __privateSet(this, _isRemoteOptionsLoading, !__privateGet(this, _remoteOptionsLoaded));
650
- } else {
651
- __privateSet(this, _remoteOptionsLoaded, false);
652
- __privateSet(this, _isRemoteOptionsLoading, false);
653
- }
654
- let popup = document.createElement("wje-popup");
655
- popup.setAttribute("placement", "bottom-start");
656
- if (!this.noSize) {
657
- popup.setAttribute("size", "");
658
- popup.contentAwareSize = true;
659
- popup.style.setProperty("--wje-popup-loader-inset", "var(--wje-select-options-border-width, 1px)");
660
- }
661
- popup.setAttribute("part", "popup");
662
- popup.setAttribute("offset", this.offset);
663
- if (this.isPortaled) {
664
- popup.setAttribute("portal", this.portaled);
665
- }
666
- if (this.lazy && !this._wasOppened || hasRemoteOptions && !__privateGet(this, _remoteOptionsLoaded)) {
667
- popup.setAttribute("loader", "");
668
- } else {
669
- popup.removeAttribute("loader");
670
- }
671
- if (this.disabled) {
672
- popup.setAttribute("disabled", "");
673
- } else {
674
- popup.removeAttribute("disabled");
675
- }
676
- if (this.variant === "standard") {
677
- if (this.hasAttribute("label")) native.appendChild(label);
678
- } else {
679
- wrapper.appendChild(label);
680
- }
681
- inputWrapper.append(slotStart);
682
- inputWrapper.append(displayWrapper);
683
- inputWrapper.append(input);
684
- clear.append(clearIcon);
685
- if (this.hasAttribute("multiple")) inputWrapper.append(chips);
686
- if (this.hasAttribute("clearable")) inputWrapper.append(clear);
687
- inputWrapper.appendChild(slotEnd);
688
- inputWrapper.appendChild(arrow);
689
- list.append(slot, emptyState);
690
- if (this.hasAttribute("find")) {
691
- let find = document.createElement("wje-input");
692
- find.setAttribute("variant", "standard");
693
- find.setAttribute("placeholder", "Hľadať");
694
- find.setAttribute("part", "find");
695
- find.clearable = true;
696
- find.classList.add("find");
697
- optionsWrapper.append(find);
698
- this.findEl = find;
699
- }
700
- let slotFooter = document.createElement("slot");
701
- slotFooter.setAttribute("name", "footer");
702
- optionsWrapper.append(list);
703
- optionsWrapper.append(slotFooter);
704
- wrapper.append(inputWrapper);
705
- popup.append(wrapper);
706
- popup.append(optionsWrapper);
707
- if (this.trigger === "click") popup.setAttribute("manual", "");
708
- this.append(error);
709
- native.append(popup);
710
- native.append(errorSlot);
711
- fragment.appendChild(native);
712
- this.native = native;
713
- this.popup = popup;
714
- this.labelElement = label;
715
- this.slotStart = slotStart;
716
- this.slotEnd = slotEnd;
717
- this.input = input;
718
- this.displayInput = display;
719
- this.displayText = displayText;
720
- this.chips = chips;
721
- this.clear = clear;
722
- this.list = list;
723
- this.emptyState = emptyState;
724
- this.slotFooter = slotFooter;
725
- this.syncAria();
726
- return fragment;
213
+ let e2 = document.createElement("div");
214
+ e2.setAttribute("part", "native"), e2.classList.add("native-select", this.variant || "default");
215
+ let i2 = document.createElement("div");
216
+ i2.classList.add("wrapper"), i2.setAttribute("slot", "anchor");
217
+ let s2 = document.createElement("label");
218
+ s2.setAttribute("part", "label"), s2.innerText = this.label || "";
219
+ let r2 = document.createElement("div");
220
+ r2.setAttribute("part", "input-wrapper"), r2.classList.add("input-wrapper");
221
+ let o2 = document.createElement("div");
222
+ o2.classList.add("slot-start");
223
+ let n2 = document.createElement("input");
224
+ n2.setAttribute("type", "text"), n2.value = this.value.join(" ").trim(), n2.classList.add("input-hidden");
225
+ let a2 = document.createElement("input");
226
+ a2.setAttribute("type", "text"), a2.setAttribute("part", "input"), a2.setAttribute("autocomplete", "off"), a2.setAttribute("readonly", ""), a2.setAttribute("placeholder", this.placeholder || ""), a2.classList.add("display-input");
227
+ let l2 = document.createElement("span");
228
+ l2.classList.add("display-wrapper");
229
+ let d2 = document.createElement("span");
230
+ d2.setAttribute("part", "input selected-text"), d2.classList.add("display-text"), d2.dataset.placeholder = this.placeholder || "", d2.toggleAttribute("data-placeholder-visible", Boolean(this.placeholder)), d2.setAttribute("aria-hidden", "true"), l2.append(a2, d2), this.required && (n2.setAttribute("required", ""), a2.setAttribute("required", "")), this.disabled && (n2.setAttribute("disabled", ""), a2.setAttribute("disabled", "")), this.readonly && (n2.setAttribute("readonly", ""), a2.setAttribute("readonly", ""));
231
+ let p2 = document.createElement("div");
232
+ p2.classList.add("slot-end");
233
+ let h2 = document.createElement("wje-icon");
234
+ h2.setAttribute("name", "chevron-down"), h2.setAttribute("slot", "arrow");
235
+ let c2 = document.createElement("div");
236
+ c2.classList.add("chips"), c2.innerText = this.placeholder || "";
237
+ let u = document.createElement("div");
238
+ u.setAttribute("part", "options-wrapper"), u.classList.add("options-wrapper"), u.style.setProperty("height", this.maxHeight);
239
+ let m = document.createElement("div");
240
+ m.classList.add("list"), this._ariaListId = this.id ? `${this.id}-listbox` : `wje-select-${this._instanceId}-listbox`, m.id = this._ariaListId, m.setAttribute("role", "listbox"), this.hasAttribute("multiple") && m.setAttribute("aria-multiselectable", "true");
241
+ let b = document.createElement("slot"), w = document.createElement("div");
242
+ w.setAttribute("part", "empty"), w.setAttribute("role", "option"), w.setAttribute("aria-disabled", "true"), w.setAttribute("aria-selected", "false"), w.classList.add("empty"), w.hidden = true, w.textContent = this.localizer.translate("wj.select.empty");
243
+ let v = document.createElement("wje-button");
244
+ v.setAttribute("fill", "link"), v.setAttribute("part", "clear"), v.setAttribute("stop-propagation", "");
245
+ let g = document.createElement("wje-icon");
246
+ g.setAttribute("name", "x");
247
+ let f = document.createElement("div");
248
+ f.setAttribute("slot", "error");
249
+ let y = document.createElement("slot");
250
+ y.setAttribute("name", "error");
251
+ const A = this.querySelector("wje-options") instanceof HTMLElement;
252
+ A ? __privateSet(this, _r, !__privateGet(this, _s)) : (__privateSet(this, _s, false), __privateSet(this, _r, false));
253
+ let j = document.createElement("wje-popup");
254
+ if (j.setAttribute("placement", "bottom-start"), this.noSize || (j.setAttribute("size", ""), j.contentAwareSize = true, j.style.setProperty("--wje-popup-loader-inset", "var(--wje-select-options-border-width, 1px)")), j.setAttribute("part", "popup"), j.setAttribute("offset", this.offset), this.isPortaled && j.setAttribute("portal", this.portaled), this.lazy && !this._wasOppened || A && !__privateGet(this, _s) ? j.setAttribute("loader", "") : j.removeAttribute("loader"), this.disabled ? j.setAttribute("disabled", "") : j.removeAttribute("disabled"), "standard" === this.variant ? this.hasAttribute("label") && e2.appendChild(s2) : i2.appendChild(s2), r2.append(o2), r2.append(l2), r2.append(n2), v.append(g), this.hasAttribute("multiple") && r2.append(c2), this.hasAttribute("clearable") && r2.append(v), r2.appendChild(p2), r2.appendChild(h2), m.append(b, w), this.hasAttribute("find")) {
255
+ let t3 = document.createElement("wje-input");
256
+ t3.setAttribute("variant", "standard"), t3.setAttribute("placeholder", "Hľadať"), t3.setAttribute("part", "find"), t3.clearable = true, t3.classList.add("find"), u.append(t3), this.findEl = t3;
257
+ }
258
+ let x = document.createElement("slot");
259
+ return x.setAttribute("name", "footer"), u.append(m), u.append(x), i2.append(r2), j.append(i2), j.append(u), "click" === this.trigger && j.setAttribute("manual", ""), this.append(f), e2.append(j), e2.append(y), t2.appendChild(e2), this.native = e2, this.popup = j, this.labelElement = s2, this.slotStart = o2, this.slotEnd = p2, this.input = n2, this.displayInput = a2, this.displayText = d2, this.chips = c2, this.clear = v, this.list = m, this.emptyState = w, this.slotFooter = x, this.syncAria(), t2;
727
260
  }
728
- /**
729
- * Executes post-render logic for the custom element.
730
- * This includes validation, event listener registration, managing custom attributes, and
731
- * handling options initialization for the component.
732
- * @returns {void} This method does not return any value.
733
- */
734
261
  afterDraw() {
735
- var _a, _b;
736
- document.addEventListener("mousedown", __privateGet(this, _onMenuItemClickCapture), true);
737
- this.validate();
738
- if (this.hasAttribute("invalid")) {
739
- this.showInvalidMessage();
740
- }
741
- this.syncAria();
742
- (_a = this.getAllOptions()) == null ? void 0 : _a.forEach((option) => {
743
- option.ownerSelect = this;
744
- this.optionCheckSlot(option);
745
- });
746
- event.addListener(this.popup, "wje-router:rebind", null, __privateGet(this, _syncPortalStyles));
747
- event.addListener(this.popup, "wje-portal:restored", null, __privateGet(this, _restorePortaledOptions));
748
- this.selectedOptions = __privateMethod(this, _Select_instances, getSelectedOptions_fn).call(this);
749
- this.selectOptions(this.value, true);
750
- if (this.lazy) {
751
- event.addListener(this.popup, "wje-popup:show", null, (e) => {
752
- if (this._wasOppened) return;
753
- this._wasOppened = true;
754
- const optionsElement = this.querySelector("wje-options");
755
- optionsElement.setAttribute("lazy", "");
756
- optionsElement.setAttribute("attached", "");
757
- });
758
- }
759
- event.addListener(this.popup, "wje-popup:aftershow", null, () => {
760
- const assignedElements = this.slotFooter.assignedElements();
761
- if (assignedElements.length > 0) {
762
- const el = assignedElements[0];
763
- const rect = el.getBoundingClientRect();
764
- let totalHeight = 0;
262
+ var _a2, _b;
263
+ document.addEventListener("mousedown", __privateGet(this, _n), true), this.validate(), this.hasAttribute("invalid") && this.showInvalidMessage(), this.syncAria(), (_a2 = this.getAllOptions()) == null ? void 0 : _a2.forEach((t2) => {
264
+ t2.ownerSelect = this, this.optionCheckSlot(t2);
265
+ }), e.addListener(this.popup, "wje-router:rebind", null, __privateGet(this, _a)), e.addListener(this.popup, "wje-portal:restored", null, __privateGet(this, _l)), this.selectedOptions = __privateMethod(this, _c_instances, o_fn).call(this), this.selectOptions(this.value, true), this.lazy && e.addListener(this.popup, "wje-popup:show", null, (t2) => {
266
+ if (this._wasOppened) return;
267
+ this._wasOppened = true;
268
+ const e2 = this.querySelector("wje-options");
269
+ e2.setAttribute("lazy", ""), e2.setAttribute("attached", "");
270
+ }), e.addListener(this.popup, "wje-popup:aftershow", null, () => {
271
+ const t2 = this.slotFooter.assignedElements();
272
+ if (t2.length > 0) {
273
+ const e2 = t2[0].getBoundingClientRect();
274
+ let i2 = 0;
765
275
  if (this.hasAttribute("find")) {
766
- let style = getComputedStyle(this.findEl);
767
- let height = this.findEl.offsetHeight;
768
- let marginTop = parseFloat(style.marginTop);
769
- let marginBottom = parseFloat(style.marginBottom);
770
- totalHeight = height + marginTop + marginBottom;
276
+ let t3 = getComputedStyle(this.findEl);
277
+ i2 = this.findEl.offsetHeight + parseFloat(t3.marginTop) + parseFloat(t3.marginBottom);
771
278
  }
772
- let subtractHeight = rect.height + totalHeight;
773
- this.list.style.height = `calc(100% - ${subtractHeight}px)`;
279
+ let s2 = e2.height + i2;
280
+ this.list.style.height = `calc(100% - ${s2}px)`;
774
281
  }
775
- __privateMethod(this, _Select_instances, focusFindInput_fn).call(this);
776
- });
777
- __privateSet(this, _htmlOptions, Array.from(this.querySelectorAll(":scope > wje-option")).map((option) => {
778
- return {
779
- value: option.value,
780
- text: option.textContent.trim()
781
- };
782
- }));
783
- this.input.addEventListener("focus", (e) => {
784
- var _a2;
785
- (_a2 = this.labelElement) == null ? void 0 : _a2.classList.add("fade");
786
- this.native.classList.add("focused");
787
- });
788
- this.input.addEventListener("blur", (e) => {
789
- var _a2;
790
- this.native.classList.remove("focused");
791
- if (!e.target.value) (_a2 = this.labelElement) == null ? void 0 : _a2.classList.remove("fade");
792
- });
793
- this.input.addEventListener("input", (e) => {
282
+ __privateMethod(this, _c_instances, d_fn).call(this);
283
+ }), __privateSet(this, _e, Array.from(this.querySelectorAll(":scope > wje-option")).map((t2) => ({ value: t2.value, text: t2.textContent.trim() }))), this.input.addEventListener("focus", (t2) => {
284
+ var _a3;
285
+ (_a3 = this.labelElement) == null ? void 0 : _a3.classList.add("fade"), this.native.classList.add("focused");
286
+ }), this.input.addEventListener("blur", (t2) => {
287
+ var _a3;
288
+ this.native.classList.remove("focused"), t2.target.value || ((_a3 = this.labelElement) == null ? void 0 : _a3.classList.remove("fade"));
289
+ }), this.input.addEventListener("input", (t2) => {
794
290
  this.propagateValidation();
795
- });
796
- this.addEventListener("wje-option:change", this.optionChange);
797
- event.addListener(this.popup, "wje-popup:show", null, () => this.syncAria());
798
- event.addListener(this.popup, "wje-popup:hide", null, () => this.syncAria());
799
- this.addEventListener("invalid", (e) => {
800
- this.invalid = true;
801
- this.pristine = false;
802
- this.showInvalidMessage();
803
- if (this.customErrorDisplay) {
804
- e.preventDefault();
805
- }
806
- });
807
- (_b = this.clear) == null ? void 0 : _b.addEventListener("wje-button:click", (e) => {
808
- if (this.readonly || this.disabled) return;
809
- e.preventDefault();
810
- e.stopPropagation();
811
- this.clearSelections();
812
- });
813
- this.list.addEventListener("wje-options:load", __privateGet(this, _handleOptionsLoad));
814
- this.addEventListener("wje-options:load", __privateGet(this, _handleOptionsLoad));
815
- if (this.hasAttribute("find") && this.findEl instanceof HTMLElement) {
816
- event.addListener(this.findEl, "keyup", "", __privateGet(this, _applySearchFilter));
817
- event.addListener(this.findEl, "wje-input:clear", "", __privateGet(this, _applySearchFilter));
818
- }
819
- __privateMethod(this, _Select_instances, updateEmptyState_fn).call(this);
291
+ }), this.addEventListener("wje-option:change", this.optionChange), e.addListener(this.popup, "wje-popup:show", null, () => this.syncAria()), e.addListener(this.popup, "wje-popup:hide", null, () => this.syncAria()), this.addEventListener("invalid", (t2) => {
292
+ this.invalid = true, this.pristine = false, this.showInvalidMessage(), this.customErrorDisplay && t2.preventDefault();
293
+ }), (_b = this.clear) == null ? void 0 : _b.addEventListener("wje-button:click", (t2) => {
294
+ this.readonly || this.disabled || (t2.preventDefault(), t2.stopPropagation(), this.clearSelections());
295
+ }), this.list.addEventListener("wje-options:load", __privateGet(this, _p)), this.addEventListener("wje-options:load", __privateGet(this, _p)), this.hasAttribute("find") && this.findEl instanceof HTMLElement && (e.addListener(this.findEl, "keyup", "", __privateGet(this, _h)), e.addListener(this.findEl, "wje-input:clear", "", __privateGet(this, _h))), __privateMethod(this, _c_instances, c_fn).call(this);
820
296
  }
821
- /**
822
- * Returns all the options as HTML.
823
- * @returns {NodeList} The options as HTML.
824
- */
825
297
  getAllOptions() {
826
- const localOptions = Array.from(this.querySelectorAll("wje-option"));
827
- const portaledOptions = __privateGet(this, _portaledOptionRecords).map(({ option }) => option);
828
- return Array.from(/* @__PURE__ */ new Set([...localOptions, ...portaledOptions]));
829
- }
830
- /**
831
- * Handles changes in the selection for a component, updating internal values, input fields,
832
- * and visual presentation (like chips or slots) as per the given selection options.
833
- * @param {Array|null} options The collection of selected option elements. If null, no options are selected.
834
- * @param {number} length The total number of selected options.
835
- * @returns {void}
836
- */
837
- selectionChanged(options = null, length = 0) {
838
- var _a, _b, _c;
839
- if (this.hasAttribute("multiple")) {
840
- this.value = options.map((el) => el.value).reverse();
841
- this.input.value = this.value.map((a) => a).join(" ").trim();
842
- if (this.placeholder && length === 0) {
843
- this.chips.innerHTML = this.placeholder;
844
- } else {
845
- if (options !== null) Array.from(options).slice(0, +this.maxOptions).forEach((option) => this.chips.appendChild(this.getChip(option)));
846
- if (this.counterEl instanceof HTMLElement || !this.maxOptions || length > +this.maxOptions) {
847
- this.counter();
848
- }
849
- }
850
- this.getAllOptions().forEach((o) => __privateMethod(this, _Select_instances, syncOptionCheckbox_fn).call(this, o));
851
- } else {
852
- const option = options == null ? void 0 : options.at(0);
853
- this.value = ((_a = options == null ? void 0 : options.map((el) => el.value)) == null ? void 0 : _a.at(0)) || "";
854
- this.input.value = this.value[0] || "";
855
- const displayValue = ((_c = (_b = options[0]) == null ? void 0 : _b.textContent) == null ? void 0 : _c.trim()) || "";
856
- this.displayInput.value = displayValue;
857
- this.displayText.textContent = displayValue;
858
- this.displayText.toggleAttribute("data-placeholder-visible", !displayValue && Boolean(this.placeholder));
859
- this.slotStart.innerHTML = "";
860
- this.slotEnd.innerHTML = "";
861
- if (option && option instanceof HTMLElement) {
862
- let optionSlotStart = option == null ? void 0 : option.querySelector("wje-option > [slot=start]");
863
- if (optionSlotStart) {
864
- setTimeout(() => {
865
- this.slotStart.append(optionSlotStart.cloneNode(true));
866
- }, 0);
867
- }
868
- let optionSlotEnd = option == null ? void 0 : option.querySelector("wje-option > [slot=end]");
869
- if (optionSlotEnd && optionSlotEnd instanceof HTMLElement && optionSlotEnd.tagName !== "WJE-DROPDOWN" && optionSlotEnd.tagName !== "WJE-BUTTON") {
870
- setTimeout(() => {
871
- this.slotEnd.append(optionSlotEnd.cloneNode(true));
872
- }, 0);
873
- }
298
+ const t2 = Array.from(this.querySelectorAll("wje-option")), e2 = __privateGet(this, _i).map(({ option: t3 }) => t3);
299
+ return Array.from(/* @__PURE__ */ new Set([...t2, ...e2]));
300
+ }
301
+ selectionChanged(t2 = null, e2 = 0) {
302
+ var _a2, _b, _c2;
303
+ if (this.hasAttribute("multiple")) this.value = t2.map((t3) => t3.value).reverse(), this.input.value = this.value.map((t3) => t3).join(" ").trim(), this.placeholder && 0 === e2 ? this.chips.innerHTML = this.placeholder : (null !== t2 && Array.from(t2).slice(0, +this.maxOptions).forEach((t3) => this.chips.appendChild(this.getChip(t3))), (this.counterEl instanceof HTMLElement || !this.maxOptions || e2 > +this.maxOptions) && this.counter()), this.getAllOptions().forEach((t3) => __privateMethod(this, _c_instances, u_fn).call(this, t3));
304
+ else {
305
+ const e3 = t2 == null ? void 0 : t2.at(0);
306
+ this.value = ((_a2 = t2 == null ? void 0 : t2.map((t3) => t3.value)) == null ? void 0 : _a2.at(0)) || "", this.input.value = this.value[0] || "";
307
+ const i2 = ((_c2 = (_b = t2[0]) == null ? void 0 : _b.textContent) == null ? void 0 : _c2.trim()) || "";
308
+ if (this.displayInput.value = i2, this.displayText.textContent = i2, this.displayText.toggleAttribute("data-placeholder-visible", !i2 && Boolean(this.placeholder)), this.slotStart.innerHTML = "", this.slotEnd.innerHTML = "", e3 && e3 instanceof HTMLElement) {
309
+ let t3 = e3 == null ? void 0 : e3.querySelector("wje-option > [slot=start]");
310
+ t3 && setTimeout(() => {
311
+ this.slotStart.append(t3.cloneNode(true));
312
+ }, 0);
313
+ let i3 = e3 == null ? void 0 : e3.querySelector("wje-option > [slot=end]");
314
+ i3 && i3 instanceof HTMLElement && "WJE-DROPDOWN" !== i3.tagName && "WJE-BUTTON" !== i3.tagName && setTimeout(() => {
315
+ this.slotEnd.append(i3.cloneNode(true));
316
+ }, 0);
874
317
  }
875
318
  }
876
319
  this.syncAria();
877
320
  }
878
- /**
879
- * Handles the logic for updating selections based on the current selected options,
880
- * updating chips content, and dispatching change events if necessary.
881
- * @param {boolean} [silence] If true, suppresses the dispatch of a custom change event.
882
- * @returns {void} This method does not return a value.
883
- */
884
- selections(silence = false) {
885
- if (this.selectedOptions.length >= +this.maxOptions) {
886
- this.counterEl = null;
887
- }
888
- if (this.chips) {
889
- this.chips.innerHTML = "";
890
- }
891
- if (this.selectedOptions.length > 0) {
892
- this.selectionChanged(this.selectedOptions, this.selectedOptions.length);
893
- } else {
894
- this.selectionChanged(this.selectedOptions);
895
- }
896
- if (silence) return;
897
- event.dispatchCustomEvent(this, "wje-select:change");
321
+ selections(t2 = false) {
322
+ this.selectedOptions.length >= +this.maxOptions && (this.counterEl = null), this.chips && (this.chips.innerHTML = ""), this.selectedOptions.length > 0 ? this.selectionChanged(this.selectedOptions, this.selectedOptions.length) : this.selectionChanged(this.selectedOptions), t2 || e.dispatchCustomEvent(this, "wje-select:change");
898
323
  }
899
- /**
900
- * Updates the counter element to reflect the current state of selected values relative to the maximum allowed options.
901
- * If the maximum options are selected, the counter element is removed. If it does not already exist and needs to be displayed, it is created.
902
- * @returns {void} Does not return a value.
903
- */
904
324
  counter() {
905
- if (this.counterEl && this.value.length === +this.maxOptions) {
906
- this.counterEl.remove();
907
- this.counterEl = null;
908
- return;
909
- }
910
- if (!this.counterEl) {
911
- this.counterEl = document.createElement("span");
912
- this.counterEl.classList.add("counter");
913
- this.chips.appendChild(this.counterEl);
914
- }
915
- this.counterEl.innerText = `+${this.value.length - +this.maxOptions}`;
916
- }
917
- /**
918
- * Creates and returns a chip element with specified properties and a label.
919
- * @param {object} option The configuration object for the chip. Typically includes properties such as value and textContent to set up the chip's label and data.
920
- * @returns {HTMLElement} The newly created chip element with a label and default properties.
921
- */
922
- getChip(option) {
923
- let chip = document.createElement("wje-chip");
924
- chip.size = "small";
925
- chip.removable = !this.readonly;
926
- chip.round = true;
927
- chip.addEventListener("wje:chip-remove", this.removeChip);
928
- chip.option = option;
929
- let label = document.createElement("wje-label");
930
- label.innerText = __privateMethod(this, _Select_instances, htmlSelectedItem_fn).call(this, option.value);
931
- chip.appendChild(label);
932
- return chip;
933
- }
934
- /**
935
- * Generates an HTML option element based on the provided item and mapping.
936
- * @param {object} item The item to generate the option for.
937
- * @param {object} [map] The mapping object that specifies the properties of the item to use for the option's value and text.
938
- * @param {string} [map.value] The property of the item to use for the option's value.
939
- * @param {string} [map.text] The property of the item to use for the option's text.
940
- * @returns {HTMLElement} The generated HTML option element.
941
- */
942
- htmlOption(item, map = { value: "value", text: "text" }) {
943
- let option = document.createElement("wje-option");
944
- if (item[map.value] === null) {
945
- console.warn(`The item ${JSON.stringify(item)} does not have the property ${map.value}`);
946
- }
947
- if (item[map.text] === null) {
948
- console.warn(`The item ${JSON.stringify(item)} does not have the property ${map.text}`);
949
- }
950
- option.setAttribute("value", item[map.value] ?? "");
951
- option.innerText = item[map.text] ?? "";
952
- __privateGet(this, _addedOptions).push({ [map.value]: item[map.value], [map.text]: item[map.text] });
953
- return option;
954
- }
955
- /**
956
- * Returns the provided item.
957
- * @param {any} item The item to be returned.
958
- * @returns {any} The same item that was passed as input.
959
- */
960
- htmlSelectedItem(item) {
961
- return item;
962
- }
963
- /**
964
- * Adds a new option to the component.
965
- * @param {object} optionData The data used to create the new option.
966
- * @param {boolean} [silent] Whether the addition should trigger events or not.
967
- * @param {object} [map] Mapping of keys to identify value and text in the optionData.
968
- * @param {string} [map.value] The key in optionData that represents the value of the option.
969
- * @param {string} [map.text] The key in optionData that represents the text of the option.
970
- * @returns {void}
971
- */
972
- addOption(optionData, silent = false, map = { value: "value", text: "text" }) {
973
- if (!optionData) return;
974
- const optionsElement = this.querySelector("wje-options");
975
- if (optionsElement) {
976
- optionsElement.addOption(optionData, silent, map);
977
- __privateMethod(this, _Select_instances, updateEmptyState_fn).call(this);
978
- return;
979
- }
980
- let option = this.htmlOption(optionData, map);
981
- this.appendChild(option);
982
- __privateMethod(this, _Select_instances, updateEmptyState_fn).call(this);
983
- }
984
- /**
985
- * Adds one or more options to a collection. If the input is an array, it adds each option within the array.
986
- * Otherwise, it adds a single option.
987
- * @param {Array | object} optionsData The data representing the options to be added. It can be a single object or an array of objects.
988
- * @param {boolean} [silent] Optional flag to determine if events or notifications should be suppressed while adding options.
989
- * @param {object} [map] An optional mapping object specifying how to map data properties to value and text for the options.
990
- * @param {string} [map.value] The property in the optionsData that represents the value of the option.
991
- * @param {string} [map.text] The property in the optionsData that represents the text of the option.
992
- * @returns {void}
993
- */
994
- addOptions(optionsData, silent = false, map = { value: "value", text: "text" }) {
995
- if (!Array.isArray(optionsData)) {
996
- this.addOption(optionsData, silent, map);
997
- } else {
998
- optionsData.forEach((item) => {
999
- this.addOption(item, silent, map);
1000
- });
1001
- }
325
+ if (this.counterEl && this.value.length === +this.maxOptions) return this.counterEl.remove(), void (this.counterEl = null);
326
+ this.counterEl || (this.counterEl = document.createElement("span"), this.counterEl.classList.add("counter"), this.chips.appendChild(this.counterEl)), this.counterEl.innerText = "+" + (this.value.length - +this.maxOptions);
327
+ }
328
+ getChip(t2) {
329
+ let e2 = document.createElement("wje-chip");
330
+ e2.size = "small", e2.removable = !this.readonly, e2.round = true, e2.addEventListener("wje:chip-remove", this.removeChip), e2.option = t2;
331
+ let i2 = document.createElement("wje-label");
332
+ return i2.innerText = __privateMethod(this, _c_instances, m_fn).call(this, t2.value), e2.appendChild(i2), e2;
333
+ }
334
+ htmlOption(t2, e2 = { value: "value", text: "text" }) {
335
+ let i2 = document.createElement("wje-option");
336
+ return null === t2[e2.value] && console.warn(`The item ${JSON.stringify(t2)} does not have the property ${e2.value}`), null === t2[e2.text] && console.warn(`The item ${JSON.stringify(t2)} does not have the property ${e2.text}`), i2.setAttribute("value", t2[e2.value] ?? ""), i2.innerText = t2[e2.text] ?? "", __privateGet(this, _t).push({ [e2.value]: t2[e2.value], [e2.text]: t2[e2.text] }), i2;
337
+ }
338
+ htmlSelectedItem(t2) {
339
+ return t2;
340
+ }
341
+ addOption(t2, e2 = false, i2 = { value: "value", text: "text" }) {
342
+ if (!t2) return;
343
+ const s2 = this.querySelector("wje-options");
344
+ if (s2) return s2.addOption(t2, e2, i2), void __privateMethod(this, _c_instances, c_fn).call(this);
345
+ let r2 = this.htmlOption(t2, i2);
346
+ this.appendChild(r2), __privateMethod(this, _c_instances, c_fn).call(this);
347
+ }
348
+ addOptions(t2, e2 = false, i2 = { value: "value", text: "text" }) {
349
+ Array.isArray(t2) ? t2.forEach((t3) => {
350
+ this.addOption(t3, e2, i2);
351
+ }) : this.addOption(t2, e2, i2);
352
+ }
353
+ selectOption(t2, e2 = false) {
354
+ if (!t2) return;
355
+ const i2 = this.querySelector(`wje-option[value="${t2}"]`);
356
+ i2 && (e2 ? (i2.hasAttribute("selected") || (i2.selected = true), this.selectedOptions = __privateMethod(this, _c_instances, o_fn).call(this, this.hasAttribute("multiple") ? this.selectedOptions : [])) : this.processClickedOption(i2, this.hasAttribute("multiple")), this.drawingStatus > this.drawingStatuses.START && this.selections(e2));
357
+ }
358
+ selectOptions(t2, e2 = false) {
359
+ Array.isArray(t2) ? t2.forEach((t3) => {
360
+ this.selectOption(t3, e2);
361
+ }) : this.selectOption(t2, e2);
362
+ }
363
+ optionCheckSlot(t2) {
364
+ var _a2;
365
+ let e2 = t2.querySelector('[slot="check"]');
366
+ if (e2 && "WJE-CHECKBOX" !== e2.tagName) return;
367
+ if (e2 && "WJE-CHECKBOX" === e2.tagName) {
368
+ const i3 = t2.hasAttribute("selected");
369
+ return e2.checked = i3, void (i3 ? e2.setAttribute("checked", "") : e2.removeAttribute("checked"));
370
+ }
371
+ let i2 = (_a2 = this.querySelector("template")) == null ? void 0 : _a2.content.querySelector('[slot="check"]');
372
+ if (!i2) return void console.warn('Icon with slot "check" was not found.');
373
+ let s2 = i2.cloneNode(true);
374
+ t2.append(s2);
1002
375
  }
1003
- /**
1004
- * Selects an option from the available options within the component.
1005
- * @param {string} value The value of the option to be selected.
1006
- * @param {boolean} [silent] Determines whether the selection should trigger notification or updates. Defaults to false.
1007
- * @returns {void} Does not return a value.
1008
- */
1009
- selectOption(value, silent = false) {
1010
- if (!value) return;
1011
- const option = this.querySelector(`wje-option[value="${value}"]`);
1012
- if (!option) return;
1013
- if (silent) {
1014
- if (!option.hasAttribute("selected")) {
1015
- option.selected = true;
1016
- }
1017
- this.selectedOptions = __privateMethod(this, _Select_instances, getSelectedOptions_fn).call(this, this.hasAttribute("multiple") ? this.selectedOptions : []);
1018
- } else {
1019
- this.processClickedOption(option, this.hasAttribute("multiple"));
1020
- }
1021
- if (this.drawingStatus > this.drawingStatuses.START) {
1022
- this.selections(silent);
1023
- }
1024
- }
1025
- /**
1026
- * Selects multiple options based on the provided values. If a single value is provided, it selects that option.
1027
- * If an array of values is provided, it iterates through the array and selects each option.
1028
- * @param {any|any[]} values A single value or an array of values to be selected.
1029
- * @param {boolean} [silent] Determines whether the selection action should occur silently without triggering other side effects or events.
1030
- * @returns {void} This method does not return a value.
1031
- */
1032
- selectOptions(values, silent = false) {
1033
- if (!Array.isArray(values)) {
1034
- this.selectOption(values, silent);
1035
- } else {
1036
- values.forEach((value) => {
1037
- this.selectOption(value, silent);
1038
- });
1039
- }
1040
- }
1041
- /**
1042
- * Clones and appends an icon with the "check" slot to the specified option element.
1043
- * If the option already contains a custom element with slot="check" (e.g. <wje-status slot="check">),
1044
- * it is left untouched and no template icon is added.
1045
- * @param {HTMLElement} option The target HTML element to which the cloned "check" icon will be appended.
1046
- * @returns {void} This method does not return a value, but it modifies the DOM by appending a cloned "check" icon to the provided option element.
1047
- */
1048
- optionCheckSlot(option) {
1049
- var _a;
1050
- let existingCheckSlot = option.querySelector('[slot="check"]');
1051
- if (existingCheckSlot && existingCheckSlot.tagName !== "WJE-CHECKBOX") {
1052
- return;
1053
- }
1054
- if (existingCheckSlot && existingCheckSlot.tagName === "WJE-CHECKBOX") {
1055
- const isSelectedExisting = option.hasAttribute("selected");
1056
- existingCheckSlot.checked = isSelectedExisting;
1057
- if (isSelectedExisting) {
1058
- existingCheckSlot.setAttribute("checked", "");
1059
- } else {
1060
- existingCheckSlot.removeAttribute("checked");
1061
- }
1062
- return;
1063
- }
1064
- let icon = (_a = this.querySelector("template")) == null ? void 0 : _a.content.querySelector('[slot="check"]');
1065
- if (!icon) {
1066
- console.warn('Icon with slot "check" was not found.');
1067
- return;
1068
- }
1069
- let iconClone = icon.cloneNode(true);
1070
- option.append(iconClone);
1071
- }
1072
- /**
1073
- * Clears all selected options and resets selections.
1074
- * The method ensures that all options are deselected, updates the internal state, validates the selections,
1075
- * propagates the validation status, and indicates invalid state if necessary.
1076
- * @returns {void} No value is returned by this method.
1077
- */
1078
376
  clearSelections() {
1079
- this.selectedOptions = [];
1080
- this.getAllOptions().forEach((option) => {
1081
- option.selected = false;
1082
- });
1083
- this.selections();
1084
- this.validate();
1085
- this.propagateValidation();
1086
- if (this.hasAttribute("invalid")) {
1087
- this.showInvalidMessage();
1088
- }
377
+ this.selectedOptions = [], this.getAllOptions().forEach((t2) => {
378
+ t2.selected = false;
379
+ }), this.selections(), this.validate(), this.propagateValidation(), this.hasAttribute("invalid") && this.showInvalidMessage();
1089
380
  }
1090
381
  disconnectedCallback() {
1091
- __privateGet(this, _restorePortaledOptions).call(this);
1092
- document.removeEventListener("mousedown", __privateGet(this, _onMenuItemClickCapture), true);
382
+ __privateGet(this, _l).call(this), document.removeEventListener("mousedown", __privateGet(this, _n), true);
1093
383
  }
1094
- /**
1095
- * Syncs ARIA attributes on the host element.
1096
- */
1097
384
  syncAria() {
1098
- var _a;
1099
- const expanded = ((_a = this.popup) == null ? void 0 : _a.hasAttribute("active")) || this.classList.contains("active");
1100
- this.setAriaState({
1101
- role: "combobox",
1102
- haspopup: "listbox",
1103
- expanded,
1104
- controls: this._ariaListId,
1105
- disabled: this.disabled,
1106
- required: this.required,
1107
- invalid: this.invalid || this.hasAttribute("invalid")
1108
- });
385
+ var _a2;
386
+ const t2 = ((_a2 = this.popup) == null ? void 0 : _a2.hasAttribute("active")) || this.classList.contains("active");
387
+ this.setAriaState({ role: "combobox", haspopup: "listbox", expanded: t2, controls: this._ariaListId, disabled: this.disabled, required: this.required, invalid: this.invalid || this.hasAttribute("invalid") });
1109
388
  }
1110
389
  };
1111
- _addedOptions = new WeakMap();
1112
- _htmlOptions = new WeakMap();
1113
- _portaledOptionRecords = new WeakMap();
1114
- _remoteOptionsLoaded = new WeakMap();
1115
- _isRemoteOptionsLoading = new WeakMap();
1116
- _Select_instances = new WeakSet();
1117
- /**
1118
- * Processes the given item and retrieves the corresponding value from the selected options.
1119
- * @param {string} item The key to search for in the selected options.
1120
- * @returns {string} The text content associated with the selected item, or an empty string if not found.
1121
- */
1122
- htmlSelectedItem_fn = function(item) {
1123
- var _a;
1124
- const keyValue = "value";
1125
- const textValue = "textContent";
1126
- const value = ((_a = this.selectedOptions.find((option) => option[keyValue] === item)) == null ? void 0 : _a[textValue]) ?? "";
1127
- return this.htmlSelectedItem(value);
390
+ _t = new WeakMap();
391
+ _e = new WeakMap();
392
+ _i = new WeakMap();
393
+ _s = new WeakMap();
394
+ _r = new WeakMap();
395
+ _c_instances = new WeakSet();
396
+ m_fn = function(t2) {
397
+ var _a2;
398
+ const e2 = ((_a2 = this.selectedOptions.find((e3) => e3.value === t2)) == null ? void 0 : _a2.textContent) ?? "";
399
+ return this.htmlSelectedItem(e2);
1128
400
  };
1129
- /**
1130
- * Retrieves the selected options while retaining selections that are temporarily absent from the rendered list.
1131
- * Lazy search and pagination replace option elements, so the currently rendered DOM cannot be the sole source of
1132
- * truth for a multiple selection. Rendered options override retained options with the same value, including when
1133
- * a rendered option has been explicitly deselected.
1134
- * @param {Array<Element>} [retainedOptions] Previously selected option elements that may no longer be rendered.
1135
- * @returns {Array<Element>} An array of selected option elements, deduplicated by value.
1136
- */
1137
- getSelectedOptions_fn = function(retainedOptions = []) {
1138
- const renderedOptions = this.getAllOptions();
1139
- const renderedValues = new Set(renderedOptions.map((option) => option.value));
1140
- const selectedByValue = new Map(
1141
- renderedOptions.filter((option) => option.hasAttribute("selected")).map((option) => [option.value, option])
1142
- );
1143
- retainedOptions.forEach((option) => {
1144
- if ((option == null ? void 0 : option.hasAttribute("selected")) && !renderedValues.has(option.value)) {
1145
- selectedByValue.set(option.value, option);
1146
- }
1147
- });
1148
- return Array.from(selectedByValue.values());
401
+ o_fn = function(t2 = []) {
402
+ const e2 = this.getAllOptions(), i2 = new Set(e2.map((t3) => t3.value)), s2 = new Map(e2.filter((t3) => t3.hasAttribute("selected")).map((t3) => [t3.value, t3]));
403
+ return t2.forEach((t3) => {
404
+ (t3 == null ? void 0 : t3.hasAttribute("selected")) && !i2.has(t3.value) && s2.set(t3.value, t3);
405
+ }), Array.from(s2.values());
1149
406
  };
1150
- /**
1151
- * Determines whether the select currently contains at least one visible option.
1152
- * @returns {boolean} Returns true when at least one option is visible, otherwise false.
1153
- */
1154
- hasVisibleOptions_fn = function() {
1155
- return Array.from(this.getAllOptions()).some((option) => {
1156
- if (option.hidden || option.hasAttribute("hidden")) {
1157
- return false;
1158
- }
1159
- return getComputedStyle(option).display !== "none";
1160
- });
407
+ b_fn = function() {
408
+ return Array.from(this.getAllOptions()).some((t2) => !t2.hidden && !t2.hasAttribute("hidden") && "none" !== getComputedStyle(t2).display);
1161
409
  };
1162
- /**
1163
- * Toggles the empty state message based on whether any visible options are available.
1164
- * @returns {void} Does not return a value.
1165
- */
1166
- updateEmptyState_fn = function() {
1167
- if (!(this.emptyState instanceof HTMLElement)) return;
1168
- if (__privateGet(this, _isRemoteOptionsLoading)) {
1169
- this.emptyState.hidden = true;
1170
- return;
1171
- }
1172
- this.emptyState.hidden = __privateMethod(this, _Select_instances, hasVisibleOptions_fn).call(this);
410
+ c_fn = function() {
411
+ this.emptyState instanceof HTMLElement && (__privateGet(this, _r) ? this.emptyState.hidden = true : this.emptyState.hidden = __privateMethod(this, _c_instances, b_fn).call(this));
1173
412
  };
1174
- _applySearchFilter = new WeakMap();
1175
- _handleOptionsLoad = new WeakMap();
1176
- _onMenuItemClickCapture = new WeakMap();
1177
- _syncPortalStyles = new WeakMap();
1178
- copyPortalCustomProperties_fn = function(container) {
1179
- const style = getComputedStyle(this);
1180
- for (let i = 0; i < style.length; i++) {
1181
- const prop = style[i];
1182
- if (prop.startsWith("--")) {
1183
- container.style.setProperty(prop, style.getPropertyValue(prop));
1184
- }
413
+ _h = new WeakMap();
414
+ _p = new WeakMap();
415
+ _n = new WeakMap();
416
+ _a = new WeakMap();
417
+ g_fn = function(t2) {
418
+ const e2 = getComputedStyle(this);
419
+ for (let i2 = 0; i2 < e2.length; i2++) {
420
+ const s2 = e2[i2];
421
+ s2.startsWith("--") && t2.style.setProperty(s2, e2.getPropertyValue(s2));
1185
422
  }
1186
423
  };
1187
- syncOptionOwners_fn = function() {
1188
- this.getAllOptions().forEach((option) => {
1189
- option.ownerSelect = this;
424
+ w_fn = function() {
425
+ this.getAllOptions().forEach((t2) => {
426
+ t2.ownerSelect = this;
1190
427
  });
1191
428
  };
1192
- portalOptions_fn = function(container = ((_a) => (_a = this.popup) == null ? void 0 : _a._portalContainer)()) {
1193
- if (!(container instanceof HTMLElement)) return;
1194
- const list = container.querySelector(".list");
1195
- if (!(list instanceof HTMLElement)) return;
1196
- const options = this.getAllOptions();
1197
- options.forEach((option) => {
1198
- if (__privateGet(this, _portaledOptionRecords).some((record) => record.option === option)) return;
1199
- if (!option.parentNode) return;
1200
- const placeholder = document.createComment("wje-select-portaled-option");
1201
- option.parentNode.insertBefore(placeholder, option);
1202
- option.ownerSelect = this;
1203
- option.setAttribute("data-wje-select-portaled-option", "");
1204
- option.addEventListener("wje-option:change", this.optionChange);
1205
- __privateGet(this, _portaledOptionRecords).push({ option, placeholder });
1206
- list.insertBefore(option, this.emptyState);
429
+ v_fn = function(t2 = ((_a2) => (_a2 = this.popup) == null ? void 0 : _a2._portalContainer)()) {
430
+ if (!(t2 instanceof HTMLElement)) return;
431
+ const e2 = t2.querySelector(".list");
432
+ if (!(e2 instanceof HTMLElement)) return;
433
+ this.getAllOptions().forEach((t3) => {
434
+ if (__privateGet(this, _i).some((e3) => e3.option === t3)) return;
435
+ if (!t3.parentNode) return;
436
+ const i2 = document.createComment("wje-select-portaled-option");
437
+ t3.parentNode.insertBefore(i2, t3), t3.ownerSelect = this, t3.setAttribute("data-wje-select-portaled-option", ""), t3.addEventListener("wje-option:change", this.optionChange), __privateGet(this, _i).push({ option: t3, placeholder: i2 }), e2.insertBefore(t3, this.emptyState);
1207
438
  });
1208
439
  };
1209
- _restorePortaledOptions = new WeakMap();
1210
- focusFindInput_fn = function() {
1211
- if (!this.hasAttribute("find") || !(this.findEl instanceof HTMLElement)) return;
1212
- requestAnimationFrame(() => {
1213
- var _a;
1214
- const input = this.findEl.input || ((_a = this.findEl.shadowRoot) == null ? void 0 : _a.querySelector("input"));
1215
- if (input instanceof HTMLElement) {
1216
- input.focus();
1217
- }
440
+ _l = new WeakMap();
441
+ d_fn = function() {
442
+ this.hasAttribute("find") && this.findEl instanceof HTMLElement && requestAnimationFrame(() => {
443
+ var _a2;
444
+ const t2 = this.findEl.input || ((_a2 = this.findEl.shadowRoot) == null ? void 0 : _a2.querySelector("input"));
445
+ t2 instanceof HTMLElement && t2.focus();
1218
446
  });
1219
447
  };
1220
- syncOptionCheckbox_fn = function(option) {
1221
- const checkbox = option.querySelector('wje-checkbox[slot="check"]');
1222
- if (!checkbox) return;
1223
- const isSelected = option.hasAttribute("selected");
1224
- checkbox.checked = isSelected;
1225
- if (isSelected) {
1226
- checkbox.setAttribute("checked", "");
1227
- } else {
1228
- checkbox.removeAttribute("checked");
1229
- }
448
+ u_fn = function(t2) {
449
+ const e2 = t2.querySelector('wje-checkbox[slot="check"]');
450
+ if (!e2) return;
451
+ const i2 = t2.hasAttribute("selected");
452
+ e2.checked = i2, i2 ? e2.setAttribute("checked", "") : e2.removeAttribute("checked");
1230
453
  };
1231
- __publicField(_Select, "_instanceId", 0);
1232
- __publicField(_Select, "portalStyles", `
1233
- [data-wje-select-portal] .options-wrapper {
1234
- box-sizing: border-box;
1235
- min-width: 100%;
1236
- border-width: var(--wje-select-options-border-width, 1px);
1237
- border-style: var(--wje-select-options-border-style, solid);
1238
- border-color: var(--wje-select-options-border-color, var(--wje-border-color, #dcdfe3));
1239
- border-radius: var(--wje-select-options-border-radius, var(--wje-border-radius, 4px));
1240
- margin-top: calc(0px - var(--wje-select-border-width, 1px));
1241
- background-color: var(--wje-select-options-background-color, var(--wje-color-contrast-0, #fff));
1242
- overflow: hidden;
1243
- }
1244
-
1245
- [data-wje-select-portal] .find {
1246
- margin-block: var(--wje-select-find-margin-block, .5rem);
1247
- margin-inline: var(--wje-select-find-margin-inline, .5rem);
1248
- width: var(--wje-select-find-width, calc(100% - 1rem));
1249
- }
1250
-
1251
- [data-wje-select-portal] .list {
1252
- overflow: auto;
1253
- height: 100%;
1254
- position: relative;
1255
- }
1256
-
1257
- [data-wje-select-portal] .list:has(.empty:not([hidden])) {
1258
- min-height: 44px;
1259
- }
1260
-
1261
- [data-wje-select-portal] .empty {
1262
- position: absolute;
1263
- inset: 0;
1264
- display: flex;
1265
- align-items: center;
1266
- justify-content: center;
1267
- padding: var(--wje-spacing-small, 1rem);
1268
- color: var(--wje-select-color, inherit);
1269
- text-align: center;
1270
- background-color: var(--wje-select-options-background-color, var(--wje-color-contrast-0, #fff));
1271
- pointer-events: none;
1272
- }
1273
-
1274
- [data-wje-select-portal] .empty[hidden] {
1275
- display: none;
1276
- }
1277
-
1278
- [data-wje-select-portal] .options-wrapper:has(.find) .list {
1279
- height: calc(100% - 32px - 2 * var(--wje-select-find-margin-block, .5rem));
1280
- }
1281
- `);
1282
- let Select = _Select;
1283
- Select.define("wje-select", Select);
454
+ __publicField(_c, "_instanceId", 0);
455
+ __publicField(_c, "portalStyles", "\n [data-wje-select-portal] .options-wrapper {\n box-sizing: border-box;\n min-width: 100%;\n border-width: var(--wje-select-options-border-width, 1px);\n border-style: var(--wje-select-options-border-style, solid);\n border-color: var(--wje-select-options-border-color, var(--wje-border-color, #dcdfe3));\n border-radius: var(--wje-select-options-border-radius, var(--wje-border-radius, 4px));\n margin-top: calc(0px - var(--wje-select-border-width, 1px));\n background-color: var(--wje-select-options-background-color, var(--wje-color-contrast-0, #fff));\n overflow: hidden;\n }\n\n [data-wje-select-portal] .find {\n margin-block: var(--wje-select-find-margin-block, .5rem);\n margin-inline: var(--wje-select-find-margin-inline, .5rem);\n width: var(--wje-select-find-width, calc(100% - 1rem));\n }\n\n [data-wje-select-portal] .list {\n overflow: auto;\n height: 100%;\n position: relative;\n }\n\n [data-wje-select-portal] .list:has(.empty:not([hidden])) {\n min-height: 44px;\n }\n\n [data-wje-select-portal] .empty {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: var(--wje-spacing-small, 1rem);\n color: var(--wje-select-color, inherit);\n text-align: center;\n background-color: var(--wje-select-options-background-color, var(--wje-color-contrast-0, #fff));\n pointer-events: none;\n }\n\n [data-wje-select-portal] .empty[hidden] {\n display: none;\n }\n\n [data-wje-select-portal] .options-wrapper:has(.find) .list {\n height: calc(100% - 32px - 2 * var(--wje-select-find-margin-block, .5rem));\n }\n ");
456
+ let c = _c;
457
+ c.define("wje-select", c);
1284
458
  export {
1285
- Select as default
459
+ c as default
1286
460
  };
1287
461
  //# sourceMappingURL=wje-select.js.map