le-kit 0.5.2 → 0.5.4

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 (475) hide show
  1. package/LLM_CONTEXT.md +22 -33
  2. package/package.json +3 -1
  3. package/readme.md +2 -0
  4. package/dist/cjs/index-BzadfLTc.js +0 -1864
  5. package/dist/cjs/index-BzadfLTc.js.map +0 -1
  6. package/dist/cjs/index.cjs.js +0 -124
  7. package/dist/cjs/index.cjs.js.map +0 -1
  8. package/dist/cjs/le-bar_16.cjs.entry.js +0 -3709
  9. package/dist/cjs/le-box.cjs.entry.js +0 -184
  10. package/dist/cjs/le-card.cjs.entry.js +0 -29
  11. package/dist/cjs/le-code-input.cjs.entry.js +0 -181
  12. package/dist/cjs/le-combobox.cjs.entry.js +0 -237
  13. package/dist/cjs/le-header-placeholder.cjs.entry.js +0 -18
  14. package/dist/cjs/le-kit.cjs.js +0 -27
  15. package/dist/cjs/le-kit.cjs.js.map +0 -1
  16. package/dist/cjs/le-multiselect.cjs.entry.js +0 -306
  17. package/dist/cjs/le-number-input.cjs.entry.js +0 -202
  18. package/dist/cjs/le-round-progress.cjs.entry.js +0 -106
  19. package/dist/cjs/le-segmented-control.cjs.entry.js +0 -245
  20. package/dist/cjs/le-side-panel-toggle.cjs.entry.js +0 -229
  21. package/dist/cjs/le-side-panel.cjs.entry.js +0 -546
  22. package/dist/cjs/le-stack.cjs.entry.js +0 -135
  23. package/dist/cjs/le-tab-bar.cjs.entry.js +0 -242
  24. package/dist/cjs/le-tab-panel.cjs.entry.js +0 -100
  25. package/dist/cjs/le-tab.cjs.entry.js +0 -136
  26. package/dist/cjs/le-tabs.cjs.entry.js +0 -307
  27. package/dist/cjs/le-tag.cjs.entry.js +0 -68
  28. package/dist/cjs/le-text.cjs.entry.js +0 -335
  29. package/dist/cjs/le-turntable.cjs.entry.js +0 -139
  30. package/dist/cjs/loader.cjs.js +0 -15
  31. package/dist/cjs/loader.cjs.js.map +0 -1
  32. package/dist/cjs/utils-Dxx9WhWK.js +0 -152
  33. package/dist/cjs/utils-Dxx9WhWK.js.map +0 -1
  34. package/dist/collection/assets/icons/chevron-down.svg +0 -3
  35. package/dist/collection/collection-manifest.json +0 -47
  36. package/dist/collection/components/le-bar/le-bar.css +0 -255
  37. package/dist/collection/components/le-bar/le-bar.js +0 -680
  38. package/dist/collection/components/le-bar/le-bar.js.map +0 -1
  39. package/dist/collection/components/le-box/le-box.css +0 -37
  40. package/dist/collection/components/le-box/le-box.js +0 -614
  41. package/dist/collection/components/le-box/le-box.js.map +0 -1
  42. package/dist/collection/components/le-button/le-button.css +0 -290
  43. package/dist/collection/components/le-button/le-button.js +0 -460
  44. package/dist/collection/components/le-button/le-button.js.map +0 -1
  45. package/dist/collection/components/le-card/le-card.css +0 -74
  46. package/dist/collection/components/le-card/le-card.js +0 -102
  47. package/dist/collection/components/le-card/le-card.js.map +0 -1
  48. package/dist/collection/components/le-checkbox/le-checkbox.css +0 -93
  49. package/dist/collection/components/le-checkbox/le-checkbox.js +0 -192
  50. package/dist/collection/components/le-checkbox/le-checkbox.js.map +0 -1
  51. package/dist/collection/components/le-code-input/le-code-input.css +0 -106
  52. package/dist/collection/components/le-code-input/le-code-input.js +0 -466
  53. package/dist/collection/components/le-code-input/le-code-input.js.map +0 -1
  54. package/dist/collection/components/le-collapse/le-collapse.css +0 -31
  55. package/dist/collection/components/le-collapse/le-collapse.js +0 -184
  56. package/dist/collection/components/le-collapse/le-collapse.js.map +0 -1
  57. package/dist/collection/components/le-combobox/le-combobox.css +0 -144
  58. package/dist/collection/components/le-combobox/le-combobox.js +0 -659
  59. package/dist/collection/components/le-combobox/le-combobox.js.map +0 -1
  60. package/dist/collection/components/le-component/le-component.css +0 -189
  61. package/dist/collection/components/le-component/le-component.js +0 -367
  62. package/dist/collection/components/le-component/le-component.js.map +0 -1
  63. package/dist/collection/components/le-current-heading/le-current-heading.css +0 -13
  64. package/dist/collection/components/le-current-heading/le-current-heading.js +0 -130
  65. package/dist/collection/components/le-current-heading/le-current-heading.js.map +0 -1
  66. package/dist/collection/components/le-dropdown-base/le-dropdown-base.css +0 -167
  67. package/dist/collection/components/le-dropdown-base/le-dropdown-base.js +0 -761
  68. package/dist/collection/components/le-dropdown-base/le-dropdown-base.js.map +0 -1
  69. package/dist/collection/components/le-header/le-header.css +0 -120
  70. package/dist/collection/components/le-header/le-header.js +0 -508
  71. package/dist/collection/components/le-header/le-header.js.map +0 -1
  72. package/dist/collection/components/le-header-placeholder/le-header-placeholder.js +0 -21
  73. package/dist/collection/components/le-header-placeholder/le-header-placeholder.js.map +0 -1
  74. package/dist/collection/components/le-icon/le-icon.css +0 -13
  75. package/dist/collection/components/le-icon/le-icon.js +0 -185
  76. package/dist/collection/components/le-icon/le-icon.js.map +0 -1
  77. package/dist/collection/components/le-multiselect/le-multiselect.css +0 -163
  78. package/dist/collection/components/le-multiselect/le-multiselect.js +0 -734
  79. package/dist/collection/components/le-multiselect/le-multiselect.js.map +0 -1
  80. package/dist/collection/components/le-navigation/le-navigation.css +0 -330
  81. package/dist/collection/components/le-navigation/le-navigation.js +0 -700
  82. package/dist/collection/components/le-navigation/le-navigation.js.map +0 -1
  83. package/dist/collection/components/le-number-input/le-number-input.css +0 -135
  84. package/dist/collection/components/le-number-input/le-number-input.js +0 -515
  85. package/dist/collection/components/le-number-input/le-number-input.js.map +0 -1
  86. package/dist/collection/components/le-popover/le-popover.css +0 -163
  87. package/dist/collection/components/le-popover/le-popover.js +0 -853
  88. package/dist/collection/components/le-popover/le-popover.js.map +0 -1
  89. package/dist/collection/components/le-popup/le-popup.api.js +0 -102
  90. package/dist/collection/components/le-popup/le-popup.api.js.map +0 -1
  91. package/dist/collection/components/le-popup/le-popup.css +0 -222
  92. package/dist/collection/components/le-popup/le-popup.js +0 -626
  93. package/dist/collection/components/le-popup/le-popup.js.map +0 -1
  94. package/dist/collection/components/le-round-progress/le-round-progress.css +0 -34
  95. package/dist/collection/components/le-round-progress/le-round-progress.js +0 -184
  96. package/dist/collection/components/le-round-progress/le-round-progress.js.map +0 -1
  97. package/dist/collection/components/le-scroll-progress/le-scroll-progress.css +0 -29
  98. package/dist/collection/components/le-scroll-progress/le-scroll-progress.js +0 -186
  99. package/dist/collection/components/le-scroll-progress/le-scroll-progress.js.map +0 -1
  100. package/dist/collection/components/le-segmented-control/le-segmented-control.css +0 -78
  101. package/dist/collection/components/le-segmented-control/le-segmented-control.js +0 -445
  102. package/dist/collection/components/le-segmented-control/le-segmented-control.js.map +0 -1
  103. package/dist/collection/components/le-select/le-select.css +0 -121
  104. package/dist/collection/components/le-select/le-select.js +0 -578
  105. package/dist/collection/components/le-select/le-select.js.map +0 -1
  106. package/dist/collection/components/le-side-panel/le-side-panel.css +0 -193
  107. package/dist/collection/components/le-side-panel/le-side-panel.js +0 -953
  108. package/dist/collection/components/le-side-panel/le-side-panel.js.map +0 -1
  109. package/dist/collection/components/le-side-panel-toggle/le-side-panel-toggle.js +0 -610
  110. package/dist/collection/components/le-side-panel-toggle/le-side-panel-toggle.js.map +0 -1
  111. package/dist/collection/components/le-slot/le-slot.default.css +0 -222
  112. package/dist/collection/components/le-slot/le-slot.js +0 -638
  113. package/dist/collection/components/le-slot/le-slot.js.map +0 -1
  114. package/dist/collection/components/le-stack/le-stack.default.css +0 -37
  115. package/dist/collection/components/le-stack/le-stack.js +0 -389
  116. package/dist/collection/components/le-stack/le-stack.js.map +0 -1
  117. package/dist/collection/components/le-string-input/le-string-input.css +0 -83
  118. package/dist/collection/components/le-string-input/le-string-input.js +0 -413
  119. package/dist/collection/components/le-string-input/le-string-input.js.map +0 -1
  120. package/dist/collection/components/le-tab/le-tab.css +0 -289
  121. package/dist/collection/components/le-tab/le-tab.js +0 -565
  122. package/dist/collection/components/le-tab/le-tab.js.map +0 -1
  123. package/dist/collection/components/le-tab-bar/le-tab-bar.css +0 -89
  124. package/dist/collection/components/le-tab-bar/le-tab-bar.js +0 -467
  125. package/dist/collection/components/le-tab-bar/le-tab-bar.js.map +0 -1
  126. package/dist/collection/components/le-tab-panel/le-tab-panel.css +0 -30
  127. package/dist/collection/components/le-tab-panel/le-tab-panel.js +0 -302
  128. package/dist/collection/components/le-tab-panel/le-tab-panel.js.map +0 -1
  129. package/dist/collection/components/le-tabs/le-tabs.css +0 -146
  130. package/dist/collection/components/le-tabs/le-tabs.js +0 -588
  131. package/dist/collection/components/le-tabs/le-tabs.js.map +0 -1
  132. package/dist/collection/components/le-tag/le-tag.css +0 -139
  133. package/dist/collection/components/le-tag/le-tag.js +0 -266
  134. package/dist/collection/components/le-tag/le-tag.js.map +0 -1
  135. package/dist/collection/components/le-text/le-text.css +0 -169
  136. package/dist/collection/components/le-text/le-text.js +0 -475
  137. package/dist/collection/components/le-text/le-text.js.map +0 -1
  138. package/dist/collection/components/le-turntable/le-turntable.css +0 -10
  139. package/dist/collection/components/le-turntable/le-turntable.js +0 -210
  140. package/dist/collection/components/le-turntable/le-turntable.js.map +0 -1
  141. package/dist/collection/dist/components/assets/custom-elements.json +0 -11935
  142. package/dist/collection/dist/components/assets/icons/chevron-down.json +0 -13
  143. package/dist/collection/dist/components/assets/icons/chevron-down.svg +0 -3
  144. package/dist/collection/dist/components/assets/icons/ellipsis-horizontal.json +0 -14
  145. package/dist/collection/dist/components/assets/icons/ellipsis-vertical.json +0 -14
  146. package/dist/collection/dist/components/assets/icons/hamburger.json +0 -14
  147. package/dist/collection/dist/components/assets/icons/side-panel.json +0 -61
  148. package/dist/collection/dist/themes/base.css +0 -89
  149. package/dist/collection/dist/themes/dark.css +0 -104
  150. package/dist/collection/dist/themes/default.css +0 -112
  151. package/dist/collection/dist/themes/gradient.css +0 -104
  152. package/dist/collection/dist/themes/index.css +0 -76
  153. package/dist/collection/dist/themes/minimal.css +0 -104
  154. package/dist/collection/dist/themes/warm.css +0 -104
  155. package/dist/collection/global/app.js +0 -177
  156. package/dist/collection/global/app.js.map +0 -1
  157. package/dist/collection/index.js +0 -16
  158. package/dist/collection/index.js.map +0 -1
  159. package/dist/collection/types/blocks.js +0 -115
  160. package/dist/collection/types/blocks.js.map +0 -1
  161. package/dist/collection/types/options.js +0 -2
  162. package/dist/collection/types/options.js.map +0 -1
  163. package/dist/collection/utils/utils.js +0 -141
  164. package/dist/collection/utils/utils.js.map +0 -1
  165. package/dist/components/app.js +0 -180
  166. package/dist/components/app.js.map +0 -1
  167. package/dist/components/assets/custom-elements.json +0 -11935
  168. package/dist/components/assets/icons/chevron-down.json +0 -13
  169. package/dist/components/assets/icons/chevron-down.svg +0 -3
  170. package/dist/components/assets/icons/ellipsis-horizontal.json +0 -14
  171. package/dist/components/assets/icons/ellipsis-vertical.json +0 -14
  172. package/dist/components/assets/icons/hamburger.json +0 -14
  173. package/dist/components/assets/icons/side-panel.json +0 -61
  174. package/dist/components/index.d.ts +0 -33
  175. package/dist/components/index.js +0 -12
  176. package/dist/components/index.js.map +0 -1
  177. package/dist/components/le-bar.d.ts +0 -11
  178. package/dist/components/le-bar.js +0 -9
  179. package/dist/components/le-bar.js.map +0 -1
  180. package/dist/components/le-bar2.js +0 -506
  181. package/dist/components/le-bar2.js.map +0 -1
  182. package/dist/components/le-box.d.ts +0 -11
  183. package/dist/components/le-box.js +0 -273
  184. package/dist/components/le-box.js.map +0 -1
  185. package/dist/components/le-button.d.ts +0 -11
  186. package/dist/components/le-button.js +0 -9
  187. package/dist/components/le-button.js.map +0 -1
  188. package/dist/components/le-button2.js +0 -1791
  189. package/dist/components/le-button2.js.map +0 -1
  190. package/dist/components/le-card.d.ts +0 -11
  191. package/dist/components/le-card.js +0 -100
  192. package/dist/components/le-card.js.map +0 -1
  193. package/dist/components/le-checkbox.d.ts +0 -11
  194. package/dist/components/le-checkbox.js +0 -9
  195. package/dist/components/le-checkbox.js.map +0 -1
  196. package/dist/components/le-code-input.d.ts +0 -11
  197. package/dist/components/le-code-input.js +0 -265
  198. package/dist/components/le-code-input.js.map +0 -1
  199. package/dist/components/le-collapse.d.ts +0 -11
  200. package/dist/components/le-collapse.js +0 -9
  201. package/dist/components/le-collapse.js.map +0 -1
  202. package/dist/components/le-collapse2.js +0 -138
  203. package/dist/components/le-collapse2.js.map +0 -1
  204. package/dist/components/le-combobox.d.ts +0 -11
  205. package/dist/components/le-combobox.js +0 -326
  206. package/dist/components/le-combobox.js.map +0 -1
  207. package/dist/components/le-component.d.ts +0 -11
  208. package/dist/components/le-component.js +0 -9
  209. package/dist/components/le-component.js.map +0 -1
  210. package/dist/components/le-current-heading.d.ts +0 -11
  211. package/dist/components/le-current-heading.js +0 -93
  212. package/dist/components/le-current-heading.js.map +0 -1
  213. package/dist/components/le-dropdown-base.d.ts +0 -11
  214. package/dist/components/le-dropdown-base.js +0 -9
  215. package/dist/components/le-dropdown-base.js.map +0 -1
  216. package/dist/components/le-dropdown-base2.js +0 -393
  217. package/dist/components/le-dropdown-base2.js.map +0 -1
  218. package/dist/components/le-header-placeholder.d.ts +0 -11
  219. package/dist/components/le-header-placeholder.js +0 -37
  220. package/dist/components/le-header-placeholder.js.map +0 -1
  221. package/dist/components/le-header.d.ts +0 -11
  222. package/dist/components/le-header.js +0 -349
  223. package/dist/components/le-header.js.map +0 -1
  224. package/dist/components/le-icon.d.ts +0 -11
  225. package/dist/components/le-icon.js +0 -9
  226. package/dist/components/le-icon.js.map +0 -1
  227. package/dist/components/le-icon2.js +0 -150
  228. package/dist/components/le-icon2.js.map +0 -1
  229. package/dist/components/le-multiselect.d.ts +0 -11
  230. package/dist/components/le-multiselect.js +0 -405
  231. package/dist/components/le-multiselect.js.map +0 -1
  232. package/dist/components/le-navigation.d.ts +0 -11
  233. package/dist/components/le-navigation.js +0 -502
  234. package/dist/components/le-navigation.js.map +0 -1
  235. package/dist/components/le-number-input.d.ts +0 -11
  236. package/dist/components/le-number-input.js +0 -288
  237. package/dist/components/le-number-input.js.map +0 -1
  238. package/dist/components/le-popover.d.ts +0 -11
  239. package/dist/components/le-popover.js +0 -9
  240. package/dist/components/le-popover.js.map +0 -1
  241. package/dist/components/le-popover2.js +0 -667
  242. package/dist/components/le-popover2.js.map +0 -1
  243. package/dist/components/le-popup.api.js +0 -106
  244. package/dist/components/le-popup.api.js.map +0 -1
  245. package/dist/components/le-popup.d.ts +0 -11
  246. package/dist/components/le-popup.js +0 -9
  247. package/dist/components/le-popup.js.map +0 -1
  248. package/dist/components/le-round-progress.d.ts +0 -11
  249. package/dist/components/le-round-progress.js +0 -135
  250. package/dist/components/le-round-progress.js.map +0 -1
  251. package/dist/components/le-scroll-progress.d.ts +0 -11
  252. package/dist/components/le-scroll-progress.js +0 -142
  253. package/dist/components/le-scroll-progress.js.map +0 -1
  254. package/dist/components/le-segmented-control.d.ts +0 -11
  255. package/dist/components/le-segmented-control.js +0 -331
  256. package/dist/components/le-segmented-control.js.map +0 -1
  257. package/dist/components/le-select.d.ts +0 -11
  258. package/dist/components/le-select.js +0 -9
  259. package/dist/components/le-select.js.map +0 -1
  260. package/dist/components/le-side-panel-toggle.d.ts +0 -11
  261. package/dist/components/le-side-panel-toggle.js +0 -9
  262. package/dist/components/le-side-panel-toggle.js.map +0 -1
  263. package/dist/components/le-side-panel-toggle2.js +0 -311
  264. package/dist/components/le-side-panel-toggle2.js.map +0 -1
  265. package/dist/components/le-side-panel.d.ts +0 -11
  266. package/dist/components/le-side-panel.js +0 -660
  267. package/dist/components/le-side-panel.js.map +0 -1
  268. package/dist/components/le-slot.d.ts +0 -11
  269. package/dist/components/le-slot.js +0 -9
  270. package/dist/components/le-slot.js.map +0 -1
  271. package/dist/components/le-stack.d.ts +0 -11
  272. package/dist/components/le-stack.js +0 -215
  273. package/dist/components/le-stack.js.map +0 -1
  274. package/dist/components/le-string-input.d.ts +0 -11
  275. package/dist/components/le-string-input.js +0 -9
  276. package/dist/components/le-string-input.js.map +0 -1
  277. package/dist/components/le-tab-bar.d.ts +0 -11
  278. package/dist/components/le-tab-bar.js +0 -330
  279. package/dist/components/le-tab-bar.js.map +0 -1
  280. package/dist/components/le-tab-panel.d.ts +0 -11
  281. package/dist/components/le-tab-panel.js +0 -182
  282. package/dist/components/le-tab-panel.js.map +0 -1
  283. package/dist/components/le-tab.d.ts +0 -11
  284. package/dist/components/le-tab.js +0 -9
  285. package/dist/components/le-tab.js.map +0 -1
  286. package/dist/components/le-tab2.js +0 -220
  287. package/dist/components/le-tab2.js.map +0 -1
  288. package/dist/components/le-tabs.d.ts +0 -11
  289. package/dist/components/le-tabs.js +0 -397
  290. package/dist/components/le-tabs.js.map +0 -1
  291. package/dist/components/le-tag.d.ts +0 -11
  292. package/dist/components/le-tag.js +0 -9
  293. package/dist/components/le-tag.js.map +0 -1
  294. package/dist/components/le-tag2.js +0 -141
  295. package/dist/components/le-tag2.js.map +0 -1
  296. package/dist/components/le-text.d.ts +0 -11
  297. package/dist/components/le-text.js +0 -415
  298. package/dist/components/le-text.js.map +0 -1
  299. package/dist/components/le-turntable.d.ts +0 -11
  300. package/dist/components/le-turntable.js +0 -164
  301. package/dist/components/le-turntable.js.map +0 -1
  302. package/dist/components/utils.js +0 -146
  303. package/dist/components/utils.js.map +0 -1
  304. package/dist/docs.d.ts +0 -443
  305. package/dist/docs.json +0 -14289
  306. package/dist/esm/index-DFTm5BqT.js +0 -1844
  307. package/dist/esm/index-DFTm5BqT.js.map +0 -1
  308. package/dist/esm/index.js +0 -109
  309. package/dist/esm/index.js.map +0 -1
  310. package/dist/esm/le-bar_16.entry.js +0 -3692
  311. package/dist/esm/le-box.entry.js +0 -182
  312. package/dist/esm/le-box.entry.js.map +0 -1
  313. package/dist/esm/le-card.entry.js +0 -27
  314. package/dist/esm/le-card.entry.js.map +0 -1
  315. package/dist/esm/le-code-input.entry.js +0 -179
  316. package/dist/esm/le-code-input.entry.js.map +0 -1
  317. package/dist/esm/le-combobox.entry.js +0 -235
  318. package/dist/esm/le-combobox.entry.js.map +0 -1
  319. package/dist/esm/le-header-placeholder.entry.js +0 -16
  320. package/dist/esm/le-header-placeholder.entry.js.map +0 -1
  321. package/dist/esm/le-kit.js +0 -23
  322. package/dist/esm/le-kit.js.map +0 -1
  323. package/dist/esm/le-multiselect.entry.js +0 -304
  324. package/dist/esm/le-multiselect.entry.js.map +0 -1
  325. package/dist/esm/le-number-input.entry.js +0 -200
  326. package/dist/esm/le-number-input.entry.js.map +0 -1
  327. package/dist/esm/le-round-progress.entry.js +0 -104
  328. package/dist/esm/le-round-progress.entry.js.map +0 -1
  329. package/dist/esm/le-segmented-control.entry.js +0 -243
  330. package/dist/esm/le-segmented-control.entry.js.map +0 -1
  331. package/dist/esm/le-side-panel-toggle.entry.js +0 -227
  332. package/dist/esm/le-side-panel-toggle.entry.js.map +0 -1
  333. package/dist/esm/le-side-panel.entry.js +0 -544
  334. package/dist/esm/le-side-panel.entry.js.map +0 -1
  335. package/dist/esm/le-stack.entry.js +0 -133
  336. package/dist/esm/le-stack.entry.js.map +0 -1
  337. package/dist/esm/le-tab-bar.entry.js +0 -240
  338. package/dist/esm/le-tab-bar.entry.js.map +0 -1
  339. package/dist/esm/le-tab-panel.entry.js +0 -98
  340. package/dist/esm/le-tab-panel.entry.js.map +0 -1
  341. package/dist/esm/le-tab.entry.js +0 -134
  342. package/dist/esm/le-tab.entry.js.map +0 -1
  343. package/dist/esm/le-tabs.entry.js +0 -305
  344. package/dist/esm/le-tabs.entry.js.map +0 -1
  345. package/dist/esm/le-tag.entry.js +0 -66
  346. package/dist/esm/le-tag.entry.js.map +0 -1
  347. package/dist/esm/le-text.entry.js +0 -333
  348. package/dist/esm/le-text.entry.js.map +0 -1
  349. package/dist/esm/le-turntable.entry.js +0 -137
  350. package/dist/esm/le-turntable.entry.js.map +0 -1
  351. package/dist/esm/loader.js +0 -13
  352. package/dist/esm/loader.js.map +0 -1
  353. package/dist/esm/utils-DZYCZLrF.js +0 -146
  354. package/dist/esm/utils-DZYCZLrF.js.map +0 -1
  355. package/dist/index.cjs.js +0 -1
  356. package/dist/index.js +0 -1
  357. package/dist/le-kit/dist/components/assets/custom-elements.json +0 -11935
  358. package/dist/le-kit/dist/components/assets/icons/chevron-down.json +0 -13
  359. package/dist/le-kit/dist/components/assets/icons/chevron-down.svg +0 -3
  360. package/dist/le-kit/dist/components/assets/icons/ellipsis-horizontal.json +0 -14
  361. package/dist/le-kit/dist/components/assets/icons/ellipsis-vertical.json +0 -14
  362. package/dist/le-kit/dist/components/assets/icons/hamburger.json +0 -14
  363. package/dist/le-kit/dist/components/assets/icons/side-panel.json +0 -61
  364. package/dist/le-kit/dist/themes/base.css +0 -89
  365. package/dist/le-kit/dist/themes/dark.css +0 -104
  366. package/dist/le-kit/dist/themes/default.css +0 -112
  367. package/dist/le-kit/dist/themes/gradient.css +0 -104
  368. package/dist/le-kit/dist/themes/index.css +0 -76
  369. package/dist/le-kit/dist/themes/minimal.css +0 -104
  370. package/dist/le-kit/dist/themes/warm.css +0 -104
  371. package/dist/le-kit/index.esm.js +0 -2
  372. package/dist/le-kit/index.esm.js.map +0 -1
  373. package/dist/le-kit/le-kit.css +0 -1
  374. package/dist/le-kit/le-kit.esm.js +0 -2
  375. package/dist/le-kit/le-kit.esm.js.map +0 -1
  376. package/dist/le-kit/loader.esm.js.map +0 -1
  377. package/dist/le-kit/p-221d379a.entry.js +0 -2
  378. package/dist/le-kit/p-221d379a.entry.js.map +0 -1
  379. package/dist/le-kit/p-24112ca3.entry.js +0 -2
  380. package/dist/le-kit/p-24112ca3.entry.js.map +0 -1
  381. package/dist/le-kit/p-2c6d080d.entry.js +0 -2
  382. package/dist/le-kit/p-2c6d080d.entry.js.map +0 -1
  383. package/dist/le-kit/p-46276e77.entry.js +0 -2
  384. package/dist/le-kit/p-46276e77.entry.js.map +0 -1
  385. package/dist/le-kit/p-516c8531.entry.js +0 -2
  386. package/dist/le-kit/p-516c8531.entry.js.map +0 -1
  387. package/dist/le-kit/p-6ae60ba5.entry.js +0 -2
  388. package/dist/le-kit/p-6ae60ba5.entry.js.map +0 -1
  389. package/dist/le-kit/p-6b69f9a2.entry.js +0 -2
  390. package/dist/le-kit/p-6b69f9a2.entry.js.map +0 -1
  391. package/dist/le-kit/p-6d14306f.entry.js +0 -2
  392. package/dist/le-kit/p-6d14306f.entry.js.map +0 -1
  393. package/dist/le-kit/p-7bcdf2d4.entry.js +0 -2
  394. package/dist/le-kit/p-7bcdf2d4.entry.js.map +0 -1
  395. package/dist/le-kit/p-7cf1e23c.entry.js +0 -2
  396. package/dist/le-kit/p-7cf1e23c.entry.js.map +0 -1
  397. package/dist/le-kit/p-85f2fd4d.entry.js +0 -2
  398. package/dist/le-kit/p-85f2fd4d.entry.js.map +0 -1
  399. package/dist/le-kit/p-98242429.entry.js +0 -2
  400. package/dist/le-kit/p-98242429.entry.js.map +0 -1
  401. package/dist/le-kit/p-D8RYDS9p.js +0 -2
  402. package/dist/le-kit/p-D8RYDS9p.js.map +0 -1
  403. package/dist/le-kit/p-DFTm5BqT.js +0 -3
  404. package/dist/le-kit/p-DFTm5BqT.js.map +0 -1
  405. package/dist/le-kit/p-ab6c1def.entry.js +0 -2
  406. package/dist/le-kit/p-ab6c1def.entry.js.map +0 -1
  407. package/dist/le-kit/p-ae4ead64.entry.js +0 -2
  408. package/dist/le-kit/p-ae4ead64.entry.js.map +0 -1
  409. package/dist/le-kit/p-b05d4511.entry.js +0 -2
  410. package/dist/le-kit/p-b05d4511.entry.js.map +0 -1
  411. package/dist/le-kit/p-b6ac02ff.entry.js +0 -2
  412. package/dist/le-kit/p-b6ac02ff.entry.js.map +0 -1
  413. package/dist/le-kit/p-c24769e2.entry.js +0 -2
  414. package/dist/le-kit/p-c24769e2.entry.js.map +0 -1
  415. package/dist/le-kit/p-dc0445ad.entry.js +0 -2
  416. package/dist/le-kit/p-dc0445ad.entry.js.map +0 -1
  417. package/dist/le-kit/p-eb5286f2.entry.js +0 -2
  418. package/dist/le-kit/p-eb5286f2.entry.js.map +0 -1
  419. package/dist/le-kit/p-f78b1ee6.entry.js +0 -2
  420. package/dist/le-kit/p-f78b1ee6.entry.js.map +0 -1
  421. package/dist/themes/base.css +0 -89
  422. package/dist/themes/dark.css +0 -104
  423. package/dist/themes/default.css +0 -112
  424. package/dist/themes/gradient.css +0 -104
  425. package/dist/themes/index.css +0 -76
  426. package/dist/themes/minimal.css +0 -104
  427. package/dist/themes/warm.css +0 -104
  428. package/dist/types/components/le-bar/le-bar.d.ts +0 -131
  429. package/dist/types/components/le-box/le-box.d.ts +0 -111
  430. package/dist/types/components/le-button/le-button.d.ts +0 -93
  431. package/dist/types/components/le-card/le-card.d.ts +0 -37
  432. package/dist/types/components/le-checkbox/le-checkbox.d.ts +0 -46
  433. package/dist/types/components/le-code-input/le-code-input.d.ts +0 -102
  434. package/dist/types/components/le-collapse/le-collapse.d.ts +0 -43
  435. package/dist/types/components/le-combobox/le-combobox.d.ts +0 -128
  436. package/dist/types/components/le-component/le-component.d.ts +0 -115
  437. package/dist/types/components/le-current-heading/le-current-heading.d.ts +0 -25
  438. package/dist/types/components/le-dropdown-base/le-dropdown-base.d.ts +0 -118
  439. package/dist/types/components/le-header/le-header.d.ts +0 -115
  440. package/dist/types/components/le-header-placeholder/le-header-placeholder.d.ts +0 -13
  441. package/dist/types/components/le-icon/le-icon.d.ts +0 -28
  442. package/dist/types/components/le-multiselect/le-multiselect.d.ts +0 -143
  443. package/dist/types/components/le-navigation/le-navigation.d.ts +0 -125
  444. package/dist/types/components/le-number-input/le-number-input.d.ts +0 -106
  445. package/dist/types/components/le-popover/le-popover.d.ts +0 -129
  446. package/dist/types/components/le-popup/le-popup.api.d.ts +0 -73
  447. package/dist/types/components/le-popup/le-popup.d.ts +0 -127
  448. package/dist/types/components/le-round-progress/le-round-progress.d.ts +0 -37
  449. package/dist/types/components/le-scroll-progress/le-scroll-progress.d.ts +0 -40
  450. package/dist/types/components/le-segmented-control/le-segmented-control.d.ts +0 -82
  451. package/dist/types/components/le-select/le-select.d.ts +0 -125
  452. package/dist/types/components/le-side-panel/le-side-panel.d.ts +0 -100
  453. package/dist/types/components/le-side-panel-toggle/le-side-panel-toggle.d.ts +0 -48
  454. package/dist/types/components/le-slot/le-slot.d.ts +0 -149
  455. package/dist/types/components/le-stack/le-stack.d.ts +0 -73
  456. package/dist/types/components/le-string-input/le-string-input.d.ts +0 -91
  457. package/dist/types/components/le-tab/le-tab.d.ts +0 -116
  458. package/dist/types/components/le-tab-bar/le-tab-bar.d.ts +0 -88
  459. package/dist/types/components/le-tab-panel/le-tab-panel.d.ts +0 -75
  460. package/dist/types/components/le-tabs/le-tabs.d.ts +0 -108
  461. package/dist/types/components/le-tag/le-tag.d.ts +0 -78
  462. package/dist/types/components/le-text/le-text.d.ts +0 -141
  463. package/dist/types/components/le-turntable/le-turntable.d.ts +0 -55
  464. package/dist/types/components.d.ts +0 -5716
  465. package/dist/types/global/app.d.ts +0 -96
  466. package/dist/types/index.d.ts +0 -16
  467. package/dist/types/stencil-public-runtime.d.ts +0 -1799
  468. package/dist/types/types/blocks.d.ts +0 -136
  469. package/dist/types/types/options.d.ts +0 -143
  470. package/dist/types/utils/utils.d.ts +0 -54
  471. package/loader/cdn.js +0 -1
  472. package/loader/index.cjs.js +0 -1
  473. package/loader/index.d.ts +0 -24
  474. package/loader/index.es2017.js +0 -1
  475. package/loader/index.js +0 -2
@@ -1,3692 +0,0 @@
1
- import { r as registerInstance, c as createEvent, a as getElement, h, H as Host, F as Fragment, e as getLeKitConfig, f as getAssetPath, i as getAssetBasePath } from './index-DFTm5BqT.js';
2
- import { g as generateId, c as classnames, o as observeModeChanges } from './utils-DZYCZLrF.js';
3
- import { leConfirm } from './index.js';
4
-
5
- const leBarCss = () => `:host{display:block;--le-bar-gap:var(--le-spacing-2);--le-bar-padding:var(--le-spacing-2);--le-bar-min-height:2.5rem;--le-bar-background:transparent;--le-bar-border-color:var(--le-color-border);--le-bar-border-radius:var(--le-radius-md);--le-bar-button-size:2rem;--le-bar-button-color:var(--le-color-text-primary);--le-bar-button-hover-bg:var(--le-color-gray-100);--le-bar-button-border-radius:var(--le-radius-sm);--le-bar-arrow-size:1.5rem;--le-bar-popover-min-width:200px;--le-bar-popover-gap:var(--le-spacing-1)}.bar-container{display:flex;align-items:center;gap:var(--le-bar-gap);min-height:var(--le-bar-min-height);background:var(--le-bar-background);border-radius:var(--le-bar-border-radius);padding:var(--le-bar-padding)}.bar-container.align-start{justify-content:flex-start}.bar-container.align-end .bar-items{justify-content:flex-end}.bar-container.align-center .bar-items{justify-content:center}.bar-container.align-stretch .bar-items{justify-content:space-evenly}.bar-items{display:flex;flex-wrap:wrap;align-items:center;gap:var(--le-bar-gap);overflow:hidden;min-width:0;flex:1 1 0%;position:relative}.bar-items[style*="height"]{overflow:hidden}.bar-items.is-scrollable{flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;scroll-behavior:smooth;scroll-snap-type:x mandatory;-webkit-overflow-scrolling:touch;scrollbar-width:none;-ms-overflow-style:none}.bar-items.is-scrollable::-webkit-scrollbar{display:none}.bar-items.is-scrollable ::slotted(*){scroll-snap-align:start;flex-shrink:0}.bar-items.is-wrapping{flex-wrap:wrap;overflow:visible;height:auto !important}.bar-controls{display:flex;align-items:center;gap:var(--le-spacing-1);flex-shrink:0}.bar-controls-start{order:-1}.bar-controls-end{order:1}.bar-more-button,.bar-hamburger-button,.bar-all-menu-button{display:inline-flex;align-items:center;justify-content:center;width:var(--le-bar-button-size);height:var(--le-bar-button-size);padding:0;border:none;background:transparent;color:var(--le-bar-button-color);border-radius:var(--le-bar-button-border-radius);cursor:pointer;transition:background-color 0.15s ease}.bar-more-button:hover,.bar-hamburger-button:hover,.bar-all-menu-button:hover{background:var(--le-bar-button-hover-bg)}.bar-more-button:focus-visible,.bar-hamburger-button:focus-visible,.bar-all-menu-button:focus-visible{outline:2px solid var(--le-color-focus);outline-offset:2px}.bar-arrow{display:inline-flex;align-items:center;justify-content:center;width:var(--le-bar-arrow-size);height:var(--le-bar-arrow-size);padding:0;border:none;background:transparent;color:var(--le-bar-button-color);border-radius:var(--le-bar-button-border-radius);cursor:pointer;transition:background-color 0.15s ease, opacity 0.15s ease}.bar-arrow:hover:not(:disabled){background:var(--le-bar-button-hover-bg)}.bar-arrow:focus-visible{outline:2px solid var(--le-color-focus);outline-offset:2px}.bar-arrow:disabled,.bar-arrow.disabled{opacity:0.3;cursor:not-allowed}.arrow-icon-start{transform:rotate(90deg)}.arrow-icon-end{transform:rotate(-90deg)}.bar-overflow-trigger,.bar-all-menu-trigger{display:inline-flex}.bar-popover-content{display:flex;flex-direction:column;gap:var(--le-bar-popover-gap);min-width:var(--le-bar-popover-min-width);padding:var(--le-spacing-2)}.bar-popover-item{cursor:pointer}.bar-popover-item:hover{background:var(--le-bar-button-hover-bg);border-radius:var(--le-bar-button-border-radius)}:host(.hamburger-active) .bar-items{visibility:hidden;pointer-events:none}`;
6
-
7
- const LeBar = class {
8
- constructor(hostRef) {
9
- registerInstance(this, hostRef);
10
- this.leBarOverflowChange = createEvent(this, "leBarOverflowChange");
11
- }
12
- get el() { return getElement(this); }
13
- /**
14
- * Overflow behavior when items don't fit on one row.
15
- * - `more`: Overflow items appear in a "more" dropdown
16
- * - `scroll`: Items scroll horizontally with optional arrows
17
- * - `hamburger`: All items go into a hamburger menu if any overflow
18
- * - `wrap`: Items wrap to additional rows
19
- */
20
- overflow = 'more';
21
- /**
22
- * Alignment of items within the bar (maps to justify-content).
23
- */
24
- alignItems = 'start';
25
- /**
26
- * Show scroll arrows when overflow is "scroll".
27
- */
28
- arrows = false;
29
- /**
30
- * Disable the internal overflow popover.
31
- * When true, the bar still detects overflow and hides items,
32
- * but doesn't render its own popover. Use this when providing
33
- * custom overflow handling via the leBarOverflowChange event.
34
- */
35
- disablePopover = false;
36
- /**
37
- * Minimum number of visible items required when using "more" overflow mode.
38
- * If fewer items would be visible, the bar falls back to hamburger mode.
39
- * Only applies when overflow is "more".
40
- */
41
- minVisibleItems = 0;
42
- /**
43
- * Show an "all items" menu button.
44
- * - `false`: Don't show
45
- * - `true` or `'end'`: Show at end
46
- * - `'start'`: Show at start
47
- */
48
- showAllMenu = false;
49
- /**
50
- * Emitted when overflow state changes.
51
- */
52
- leBarOverflowChange;
53
- /** Whether the hamburger/more popover is open */
54
- popoverOpen = false;
55
- /** Whether hamburger mode is active (for hamburger overflow) */
56
- hamburgerActive = false;
57
- /** IDs of items that are overflowing */
58
- overflowingIds = new Set();
59
- /** Whether we can scroll left */
60
- canScrollStart = false;
61
- /** Whether we can scroll right */
62
- canScrollEnd = false;
63
- /** Whether the all-menu popover is open */
64
- allMenuOpen = false;
65
- /** Current height of the items container (for overflow handling) */
66
- containerHeight = null;
67
- itemsContainerEl;
68
- moreButtonEl;
69
- resizeObserver;
70
- mutationObserver;
71
- instanceId = generateId('le-bar');
72
- // Map to track item elements and their IDs
73
- itemMap = new Map();
74
- // Prevent multiple recalculations in the same frame
75
- pendingRecalc = null;
76
- handleOverflowChange() {
77
- this.resetOverflowState();
78
- this.scheduleOverflowRecalc();
79
- }
80
- handleSlotChange() {
81
- this.scheduleOverflowRecalc();
82
- }
83
- connectedCallback() {
84
- this.setupObservers();
85
- }
86
- componentDidLoad() {
87
- this.scheduleOverflowRecalc();
88
- }
89
- componentDidRender() {
90
- // Recalculate after render in case children changed
91
- this.scheduleOverflowRecalc();
92
- }
93
- disconnectedCallback() {
94
- this.resizeObserver?.disconnect();
95
- this.mutationObserver?.disconnect();
96
- }
97
- /**
98
- * Force recalculation of overflow state.
99
- */
100
- async recalculate() {
101
- this.computeOverflow();
102
- }
103
- setupObservers() {
104
- // ResizeObserver for container size changes
105
- if (typeof ResizeObserver !== 'undefined') {
106
- this.resizeObserver = new ResizeObserver(() => {
107
- this.computeOverflow();
108
- this.updateScrollState();
109
- });
110
- }
111
- // MutationObserver for child changes
112
- this.mutationObserver = new MutationObserver(() => {
113
- this.scheduleOverflowRecalc();
114
- });
115
- this.mutationObserver.observe(this.el, {
116
- childList: true,
117
- subtree: false,
118
- });
119
- }
120
- observeContainer(el) {
121
- if (!this.resizeObserver)
122
- return;
123
- this.resizeObserver.disconnect();
124
- if (el)
125
- this.resizeObserver.observe(el);
126
- }
127
- scheduleOverflowRecalc() {
128
- // Debounce recalculations to prevent infinite loops
129
- if (this.pendingRecalc !== null) {
130
- cancelAnimationFrame(this.pendingRecalc);
131
- }
132
- this.pendingRecalc = requestAnimationFrame(() => {
133
- this.pendingRecalc = null;
134
- this.computeOverflow();
135
- });
136
- }
137
- resetOverflowState() {
138
- this.hamburgerActive = false;
139
- this.overflowingIds = new Set();
140
- this.containerHeight = null;
141
- this.popoverOpen = false;
142
- }
143
- getSlottedItems() {
144
- // Get direct children from the light DOM (excluding named slot elements)
145
- return Array.from(this.el.children).filter((el) => el instanceof HTMLElement && !el.hasAttribute('slot'));
146
- }
147
- getItemId(el, index) {
148
- return el.id || el.dataset.barId || `${this.instanceId}-item-${index}`;
149
- }
150
- computeOverflow() {
151
- if (this.overflow === 'wrap' || this.overflow === 'scroll') {
152
- // No overflow handling needed for wrap/scroll modes
153
- this.resetOverflowState();
154
- this.updateScrollState();
155
- return;
156
- }
157
- const container = this.itemsContainerEl;
158
- if (!container)
159
- return;
160
- const items = this.getSlottedItems();
161
- if (items.length === 0) {
162
- this.resetOverflowState();
163
- return;
164
- }
165
- // Build item map
166
- this.itemMap.clear();
167
- items.forEach((item, index) => {
168
- const id = this.getItemId(item, index);
169
- this.itemMap.set(id, item);
170
- });
171
- // Get the position of items to determine which are on the first row
172
- const itemRects = items.map((item, index) => ({
173
- item,
174
- id: this.getItemId(item, index),
175
- rect: item.getBoundingClientRect(),
176
- }));
177
- if (itemRects.length === 0) {
178
- return;
179
- }
180
- // Find the first row's top position (accounting for vertical alignment)
181
- const containerRect = container.getBoundingClientRect();
182
- const topValues = itemRects.map(i => i.rect.top - containerRect.top);
183
- const minTop = Math.min(...topValues);
184
- // Items are on the first row if their top is close to minTop
185
- // Allow some tolerance for alignment differences
186
- const tolerance = 15;
187
- const firstRowItems = itemRects.filter(i => i.rect.top - containerRect.top <= minTop + tolerance);
188
- const overflowItems = itemRects.filter(i => i.rect.top - containerRect.top > minTop + tolerance);
189
- // Calculate the height of the first row
190
- const firstRowBottom = firstRowItems.length > 0
191
- ? Math.max(...firstRowItems.map(i => i.rect.bottom - containerRect.top))
192
- : 0;
193
- if (this.overflow === 'hamburger') {
194
- // In hamburger mode, if ANY item overflows, all go into the menu
195
- const shouldHamburger = overflowItems.length > 0;
196
- if (shouldHamburger !== this.hamburgerActive) {
197
- this.hamburgerActive = shouldHamburger;
198
- this.emitOverflowChange();
199
- }
200
- // Set height to show only first row (or hide all if hamburger is active)
201
- if (shouldHamburger && firstRowBottom > 0) {
202
- this.containerHeight = firstRowBottom;
203
- }
204
- else {
205
- this.containerHeight = null;
206
- }
207
- }
208
- else {
209
- // 'more' mode
210
- let newOverflowingIds = new Set(overflowItems.map(i => i.id));
211
- // Check if we need to make room for the "more" button
212
- if (newOverflowingIds.size > 0 && this.moreButtonEl) {
213
- const moreRect = this.moreButtonEl.getBoundingClientRect();
214
- const moreTop = moreRect.top - containerRect.top;
215
- // If "more" button is not on the first row, we need to hide one more item
216
- if (moreTop > minTop + tolerance) {
217
- // Find the last visible item and move it to overflow
218
- const lastVisible = firstRowItems[firstRowItems.length - 1];
219
- if (lastVisible) {
220
- newOverflowingIds.add(lastVisible.id);
221
- }
222
- }
223
- }
224
- // Check if we should fallback to hamburger mode
225
- // This happens when minVisibleItems is set and fewer items would be visible
226
- const visibleCount = items.length - newOverflowingIds.size;
227
- const shouldFallbackToHamburger = this.minVisibleItems > 0 &&
228
- newOverflowingIds.size > 0 &&
229
- visibleCount < this.minVisibleItems;
230
- if (shouldFallbackToHamburger) {
231
- // Switch to hamburger mode - all items go into the menu
232
- if (!this.hamburgerActive) {
233
- this.hamburgerActive = true;
234
- this.overflowingIds = new Set();
235
- this.emitOverflowChange();
236
- }
237
- // Set height to show only first row
238
- if (firstRowBottom > 0) {
239
- this.containerHeight = firstRowBottom;
240
- }
241
- else {
242
- this.containerHeight = null;
243
- }
244
- return;
245
- }
246
- // Not falling back to hamburger - ensure hamburgerActive is false
247
- if (this.hamburgerActive) {
248
- this.hamburgerActive = false;
249
- }
250
- // Check if overflow state changed
251
- const hasChanged = (newOverflowingIds?.size ?? 0) !== (this.overflowingIds?.size ?? 0) ||
252
- ![...newOverflowingIds].every(id => this.overflowingIds?.has(id));
253
- if (hasChanged) {
254
- this.overflowingIds = newOverflowingIds;
255
- this.emitOverflowChange();
256
- }
257
- // Set container height to show only first row
258
- if ((newOverflowingIds?.size ?? 0) > 0 && firstRowBottom > 0) {
259
- this.containerHeight = firstRowBottom;
260
- }
261
- else {
262
- this.containerHeight = null;
263
- }
264
- }
265
- }
266
- emitOverflowChange() {
267
- this.leBarOverflowChange.emit({
268
- overflowingIds: [...(this.overflowingIds ?? [])],
269
- hamburgerActive: this.hamburgerActive,
270
- });
271
- }
272
- updateScrollState() {
273
- if (this.overflow !== 'scroll' || !this.itemsContainerEl) {
274
- this.canScrollStart = false;
275
- this.canScrollEnd = false;
276
- return;
277
- }
278
- const el = this.itemsContainerEl;
279
- this.canScrollStart = el.scrollLeft > 0;
280
- this.canScrollEnd = el.scrollLeft < el.scrollWidth - el.clientWidth - 1;
281
- }
282
- handleScroll = () => {
283
- this.updateScrollState();
284
- };
285
- scrollToStart = () => {
286
- if (!this.itemsContainerEl)
287
- return;
288
- const items = this.getSlottedItems();
289
- const container = this.itemsContainerEl;
290
- // Find the scroll position of the previous item
291
- const currentScroll = container.scrollLeft;
292
- let targetScroll = 0;
293
- for (let i = items.length - 1; i >= 0; i--) {
294
- const item = items[i];
295
- // Calculate item's left edge relative to container's scroll position
296
- const itemLeft = item.offsetLeft - container.offsetLeft;
297
- // If this item starts before current scroll position, scroll to it
298
- if (itemLeft < currentScroll - 1) {
299
- targetScroll = itemLeft;
300
- break;
301
- }
302
- }
303
- container.scrollTo({ left: targetScroll, behavior: 'smooth' });
304
- // Update scroll state after animation
305
- setTimeout(() => this.updateScrollState(), 300);
306
- };
307
- scrollToEnd = () => {
308
- if (!this.itemsContainerEl)
309
- return;
310
- const container = this.itemsContainerEl;
311
- const items = this.getSlottedItems();
312
- if (items.length === 0)
313
- return;
314
- const containerWidth = container.clientWidth;
315
- const currentScroll = container.scrollLeft;
316
- let targetScroll = container.scrollWidth - containerWidth;
317
- for (const item of items) {
318
- // Calculate item's right edge relative to container
319
- const itemLeft = item.offsetLeft - container.offsetLeft;
320
- // If this is the next item to scroll to from left to right then scroll to it
321
- if (itemLeft > currentScroll + 1) {
322
- targetScroll = itemLeft;
323
- break;
324
- }
325
- }
326
- container.scrollTo({ left: Math.max(0, targetScroll), behavior: 'smooth' });
327
- // Update scroll state after animation
328
- setTimeout(() => this.updateScrollState(), 300);
329
- };
330
- togglePopover = () => {
331
- this.popoverOpen = !this.popoverOpen;
332
- };
333
- closePopover = () => {
334
- this.popoverOpen = false;
335
- };
336
- toggleAllMenu = () => {
337
- this.allMenuOpen = !this.allMenuOpen;
338
- };
339
- closeAllMenu = () => {
340
- this.allMenuOpen = false;
341
- };
342
- handleItemClick = (_e, id) => {
343
- // Close popover when an item inside is clicked
344
- const originalItem = this.itemMap.get(id);
345
- if (originalItem) {
346
- // Clone the click to the original item
347
- const cloneEvent = new MouseEvent('click', {
348
- bubbles: true,
349
- cancelable: true,
350
- view: window,
351
- });
352
- originalItem.dispatchEvent(cloneEvent);
353
- }
354
- this.closePopover();
355
- this.closeAllMenu();
356
- };
357
- renderMoreButton() {
358
- const hasSlottedMore = this.el.querySelector('[slot="more"]');
359
- return (h("button", { class: "bar-more-button", part: "more-button", ref: el => (this.moreButtonEl = el), onClick: this.togglePopover, "aria-expanded": String(this.popoverOpen), "aria-haspopup": "true" }, hasSlottedMore ? h("slot", { name: "more" }) : h("le-icon", { name: "ellipsis-horizontal" })));
360
- }
361
- renderHamburgerButton() {
362
- const hasSlottedHamburger = this.el.querySelector('[slot="hamburger"]');
363
- return (h("button", { class: "bar-hamburger-button", part: "hamburger-button", onClick: this.togglePopover, "aria-expanded": String(this.popoverOpen), "aria-haspopup": "true" }, hasSlottedHamburger ? h("slot", { name: "hamburger" }) : h("le-icon", { name: "hamburger" })));
364
- }
365
- renderScrollArrows() {
366
- if (!this.arrows || this.overflow !== 'scroll')
367
- return null;
368
- const hasSlottedStartArrow = this.el.querySelector('[slot="start-arrow"]');
369
- const hasSlottedEndArrow = this.el.querySelector('[slot="end-arrow"]');
370
- return [
371
- h("button", { class: classnames('bar-arrow', 'bar-arrow-start', {
372
- disabled: !this.canScrollStart,
373
- }), part: "arrow-start", onClick: this.scrollToStart, disabled: !this.canScrollStart, "aria-label": "Scroll to start" }, hasSlottedStartArrow ? (h("slot", { name: "start-arrow" })) : (h("le-icon", { name: "chevron-down", class: "arrow-icon-start" }))),
374
- h("button", { class: classnames('bar-arrow', 'bar-arrow-end', {
375
- disabled: !this.canScrollEnd,
376
- }), part: "arrow-end", onClick: this.scrollToEnd, disabled: !this.canScrollEnd, "aria-label": "Scroll to end" }, hasSlottedEndArrow ? (h("slot", { name: "end-arrow" })) : (h("le-icon", { name: "chevron-down", class: "arrow-icon-end" }))),
377
- ];
378
- }
379
- renderAllMenuButton() {
380
- if (!this.showAllMenu)
381
- return null;
382
- const hasSlottedAllMenu = this.el.querySelector('[slot="all-menu"]');
383
- return (h("button", { class: "bar-all-menu-button", part: "all-menu-button", onClick: this.toggleAllMenu, "aria-expanded": String(this.allMenuOpen), "aria-haspopup": "true" }, hasSlottedAllMenu ? h("slot", { name: "all-menu" }) : h("le-icon", { name: "hamburger" })));
384
- }
385
- renderPopoverContent(itemsToShow) {
386
- return (h("div", { class: "bar-popover-content", part: "popover-content" }, itemsToShow.map(({ id, item }) => (h("div", { class: "bar-popover-item", key: id, onClick: (e) => this.handleItemClick(e, id), innerHTML: item.outerHTML })))));
387
- }
388
- renderOverflowPopover() {
389
- if (this.overflow !== 'more' && this.overflow !== 'hamburger')
390
- return null;
391
- const items = this.getSlottedItems();
392
- let itemsToShow = [];
393
- if (this.overflow === 'hamburger' && this.hamburgerActive) {
394
- // Show all items in hamburger mode
395
- itemsToShow = items.map((item, index) => ({
396
- id: this.getItemId(item, index),
397
- item,
398
- }));
399
- }
400
- else if (this.overflow === 'more' && (this.overflowingIds?.size ?? 0) > 0) {
401
- // Show only overflowing items
402
- itemsToShow = items
403
- .map((item, index) => ({
404
- id: this.getItemId(item, index),
405
- item,
406
- }))
407
- .filter(({ id }) => this.overflowingIds?.has(id));
408
- }
409
- if (itemsToShow.length === 0)
410
- return null;
411
- return (h("le-popover", { mode: "default", open: this.popoverOpen, position: "bottom", align: "end", showClose: false, closeOnClickOutside: true, closeOnEscape: true, onLePopoverClose: this.closePopover }, h("div", { slot: "trigger", class: "bar-overflow-trigger" }, this.overflow === 'hamburger' ? this.renderHamburgerButton() : this.renderMoreButton()), this.renderPopoverContent(itemsToShow)));
412
- }
413
- renderAllMenuPopover() {
414
- if (!this.showAllMenu)
415
- return null;
416
- const items = this.getSlottedItems();
417
- const itemsToShow = items.map((item, index) => ({
418
- id: this.getItemId(item, index),
419
- item,
420
- }));
421
- const position = this.showAllMenu === 'start' ? 'start' : 'end';
422
- return (h("le-popover", { mode: "default", open: this.allMenuOpen, position: "bottom", align: position, showClose: false, closeOnClickOutside: true, closeOnEscape: true, onLePopoverClose: this.closeAllMenu }, h("div", { slot: "trigger", class: "bar-all-menu-trigger" }, this.renderAllMenuButton()), this.renderPopoverContent(itemsToShow)));
423
- }
424
- render() {
425
- const showOverflowButton = !this.disablePopover &&
426
- ((this.overflow === 'more' && (this.overflowingIds?.size ?? 0) > 0) ||
427
- (this.overflow === 'hamburger' && this.hamburgerActive));
428
- const containerStyle = {};
429
- if (this.containerHeight !== null &&
430
- (this.overflow === 'more' || this.overflow === 'hamburger')) {
431
- containerStyle.height = `${this.containerHeight}px`;
432
- }
433
- const showAllMenuAtStart = this.showAllMenu === 'start';
434
- const showAllMenuAtEnd = this.showAllMenu === true || this.showAllMenu === 'end';
435
- return (h(Host, { key: '56d04e4504ed7ce1d8e78a825c71c71c074d0b62', class: classnames({
436
- 'overflow-more': this.overflow === 'more',
437
- 'overflow-scroll': this.overflow === 'scroll',
438
- 'overflow-hamburger': this.overflow === 'hamburger',
439
- 'overflow-wrap': this.overflow === 'wrap',
440
- 'hamburger-active': this.hamburgerActive,
441
- 'has-overflow': (this.overflowingIds?.size ?? 0) > 0 || this.hamburgerActive,
442
- }) }, h("div", { key: '4e7aeb4c84a9964e19012c3d05827fa8406988b0', class: classnames('bar-container', {
443
- [`align-${this.alignItems}`]: true,
444
- }), part: "container" }, this.overflow === 'scroll' && this.arrows && (h("div", { key: '2e3ae04c00e88e5055216dbc5b6d53574c450470', class: "bar-controls bar-controls-start" }, this.renderScrollArrows()?.[0])), showAllMenuAtStart && (h("div", { key: '9628c8dc2b15d9358baad63b19c75fd933eeb19a', class: "bar-controls bar-controls-start" }, this.renderAllMenuPopover())), h("div", { key: 'd1feb9603d0ff4247852aadb62cb920a5f5a1921', class: classnames('bar-items', {
445
- 'is-scrollable': this.overflow === 'scroll',
446
- 'is-wrapping': this.overflow === 'wrap',
447
- }), style: containerStyle, ref: el => {
448
- this.itemsContainerEl = el;
449
- this.observeContainer(el);
450
- }, onScroll: this.overflow === 'scroll' ? this.handleScroll : undefined }, h("slot", { key: '338698e038b9df4c7b163017ceb0675b834160e4' })), showOverflowButton && (h("div", { key: 'd619fcda1b0c28247af60899f73cc076b0517787', class: "bar-controls bar-controls-end" }, this.renderOverflowPopover())), showAllMenuAtEnd && (h("div", { key: 'fd9fef90194aabb8d48e77c8f7615daa5d7297ac', class: "bar-controls bar-controls-end" }, this.renderAllMenuPopover())), this.overflow === 'scroll' && this.arrows && (h("div", { key: 'bcffb914e2788767c3765351a3eeae771f3e115f', class: "bar-controls bar-controls-end" }, this.renderScrollArrows()?.[1])))));
451
- }
452
- static get watchers() { return {
453
- "overflow": ["handleOverflowChange"]
454
- }; }
455
- };
456
- LeBar.style = leBarCss();
457
-
458
- const leButtonCss = () => `:host{display:inline-block;--le-button-border-radius:var(--le-radius-md);--le-button-padding-x:var(--le-spacing-3);--le-button-padding-y:var(--le-spacing-1);--le-button-padding:var(--le-button-padding-y) var(--le-button-padding-x);--le-button-small-padding:0.25rem;--le-button-font-size:var(--le-font-size-md);--le-button-font-weight:var(--le-font-weight-medium);--le-button-transition:var(--le-transition-fast);--le-transition-easing:ease-in-out;--le-button-icon-aspect-ratio:1;--le-button-color:var(--le-color-primary-contrast);--_btn-bg:var(--le-color-primary);--_btn-bg-hover:var(--le-color-primary-dark);--_btn-bg-system:var(--le-color-black);--_btn-color:var(--le-button-color);--_btn-border-color:var(--le-color-primary)}:host([full-width]){display:block;width:100%}.le-button-container{display:inline-flex;flex-direction:row;align-items:center;justify-content:center;gap:var(--le-spacing-3);width:100%;padding:var(--le-button-padding);border:1px solid var(--_btn-border-color);border-radius:var(--le-button-border-radius);background:var(--_btn-bg);color:var(--_btn-color);font-family:var(--le-font-family-base);font-size:var(--le-button-font-size);font-weight:var(--le-button-font-weight);line-height:var(--le-line-height-tight);text-decoration:none;cursor:pointer;transition:background-color var(--le-button-transition) var(--le-transition-easing),
459
- border-color var(--le-button-transition) var(--le-transition-easing),
460
- box-shadow var(--le-button-transition) var(--le-transition-easing),
461
- transform var(--le-button-transition) var(--le-transition-easing)}.le-button-container:hover:not(:disabled){background:var(--_btn-bg-hover);border-color:var(--_btn-bg-hover)}.le-button-container:active:not(:disabled){box-shadow:inset 0 0 5px color-mix(in srgb, var(--_btn-bg) 50%, transparent)}.le-button-container:focus-visible{outline:2px solid var(--le-color-focus);outline-offset:2px}.le-button-container:disabled{opacity:0.5;cursor:not-allowed}.le-button-label{display:inline-flex;flex-direction:row;align-items:center;justify-content:center;gap:var(--le-spacing-2)}:host(.color-primary){--_btn-bg:var(--le-color-primary);--_btn-bg-hover:var(--le-color-primary-dark);--_btn-color:var(--le-button-color);--_btn-border-color:var(--le-color-primary)}:host(.color-secondary){--_btn-bg:var(--le-color-secondary);--_btn-bg-hover:var(--le-color-secondary-dark);--_btn-color:var(--le-color-secondary-contrast);--_btn-border-color:var(--le-color-secondary)}:host(.color-success){--_btn-bg:var(--le-color-success);--_btn-bg-hover:var(--le-color-success-dark);--_btn-color:var(--le-color-success-contrast);--_btn-border-color:var(--le-color-success)}:host(.color-warning){--_btn-bg:var(--le-color-warning);--_btn-bg-hover:var(--le-color-warning-dark);--_btn-color:var(--le-color-warning-contrast);--_btn-border-color:var(--le-color-warning)}:host(.color-danger){--_btn-bg:var(--le-color-danger);--_btn-bg-hover:var(--le-color-danger-dark);--_btn-color:var(--le-color-danger-contrast);--_btn-border-color:var(--le-color-danger)}:host(.color-info){--_btn-bg:var(--le-color-info);--_btn-bg-hover:var(--le-color-info-dark);--_btn-color:var(--le-color-info-contrast);--_btn-border-color:var(--le-color-info)}:host(.variant-solid) .le-button-container{box-shadow:var(--le-shadow-sm)}:host(.variant-solid) .le-button-container:hover:not(:disabled){box-shadow:var(--le-shadow-md)}:host(.variant-outlined) .le-button-container{background:transparent;color:var(--_btn-bg);border-color:color-mix(in srgb, var(--_btn-border-color) 33%, transparent)}:host(.variant-outlined) .le-button-container:hover:not(:disabled){border-color:var(--_btn-border-color)}:host(.variant-clear) .le-button-container{background:transparent;color:var(--_btn-bg);border-color:transparent}:host(.variant-clear) .le-button-container:hover:not(:disabled){background:var(--le-color-gray-100);border-color:transparent}:host(.variant-system) .le-button-container{background:transparent;color:var(--_btn-bg-system);border-color:transparent}:host(.size-small){--le-button-padding-x:0.4rem;--le-button-padding-y:0.3rem;--le-button-padding-top:0.35rem;--le-button-font-size:var(--le-button-small-font-size, var(--le-font-size-xs))}:host(.size-large){--le-button-padding-x:0.9rem;--le-button-padding-y:0.6rem;--le-button-font-size:var(--le-font-size-xl)}:host(.full-width){display:block;width:100%}:host(.selected) .le-button-container{box-shadow:inset 0 0 4px var(--le-color-shadow)}:host(.variant-outlined.selected) .le-button-container,:host(.variant-clear.selected) .le-button-container{background:var(--_btn-bg);color:var(--_btn-color)}:host(.icon-only) .le-button-container{padding:var(--le-button-icon-only-padding, 0.5rem);padding-bottom:var(--le-button-icon-only-padding, 0.6rem);aspect-ratio:var(--le-button-icon-aspect-ratio, 1)}:host(.icon-only.size-small) .le-button-container{padding:var(--le-button-small-padding, 0.25rem)}:host(.icon-only.size-large) .le-button-container{padding:0.75rem}:host(.icon-only) .content{display:none}.content{display:inline}.content:empty{display:none}.icon-start,.icon-only,.icon-end{display:flex;align-items:center;justify-content:center}.icon-start:empty,.icon-only:empty,.icon-end:empty{display:none}::slotted([slot="icon-start"]),::slotted([slot="icon-only"]),::slotted([slot="icon-end"]){display:flex;align-items:center;justify-content:center;width:1.125em;height:1.125em}.le-button-align-start{justify-content:flex-start}.le-button-align-center{justify-content:center}.le-button-align-space-between{justify-content:space-between}.le-button-align-end{justify-content:flex-end}`;
462
-
463
- const LeButton = class {
464
- constructor(hostRef) {
465
- registerInstance(this, hostRef);
466
- this.leClick = createEvent(this, "click");
467
- }
468
- get el() { return getElement(this); }
469
- /**
470
- * Mode of the popover should be 'default' for internal use
471
- */
472
- mode;
473
- /**
474
- * Button variant style
475
- * @allowedValues solid | outlined | clear
476
- */
477
- variant = 'solid';
478
- /**
479
- * Button color theme (uses theme semantic colors)
480
- * @allowedValues primary | secondary | success | warning | danger | info
481
- */
482
- color = 'primary';
483
- /**
484
- * Button size
485
- * @allowedValues small | medium | large
486
- */
487
- size = 'medium';
488
- /**
489
- * Whether the button is in a selected/active state
490
- */
491
- selected = false;
492
- /**
493
- * Whether the button takes full width of its container
494
- */
495
- fullWidth = false;
496
- /**
497
- * Icon only button image or emoji
498
- * if this prop is set, the button will render only the icon slot
499
- */
500
- iconOnly;
501
- /**
502
- * Start icon image or emoji
503
- */
504
- iconStart;
505
- /**
506
- * End icon image or emoji
507
- */
508
- iconEnd;
509
- /**
510
- * Whether the button is disabled
511
- */
512
- disabled = false;
513
- /**
514
- * The button type attribute
515
- * @allowedValues button | submit | reset
516
- */
517
- type = 'button';
518
- /**
519
- * Optional href to make the button act as a link
520
- */
521
- href;
522
- /**
523
- * Link target when href is set
524
- */
525
- target;
526
- /**
527
- * Alignment of the button label without the end icon
528
- * @allowedValues start | center | space-between | end
529
- */
530
- align = 'center';
531
- /**
532
- * Emitted when the button is clicked.
533
- * This is a custom event that wraps the native click but ensures the target is the le-button.
534
- */
535
- leClick;
536
- handleClick = (event) => {
537
- // We stop the internal button click from bubbling up
538
- event.stopPropagation();
539
- if (this.disabled) {
540
- event.preventDefault();
541
- return;
542
- }
543
- // And emit our own click event from the host element
544
- this.leClick.emit(event);
545
- };
546
- render() {
547
- const classes = classnames(`variant-${this.variant}`, `color-${this.color}`, `size-${this.size}`, {
548
- 'selected': this.selected,
549
- 'full-width': this.fullWidth,
550
- 'icon-only': this.iconOnly,
551
- 'disabled': this.disabled,
552
- });
553
- const TagType = this.href ? 'a' : 'button';
554
- const attrs = this.href
555
- ? { href: this.href, target: this.target, role: 'button' }
556
- : { type: this.type, disabled: this.disabled };
557
- return (h(Host, { key: 'a42aef03b5faf34f47b50dff799316a6815babd5', class: classes }, h("le-component", { key: '86ef8acf04d43e829b83d3e225f210acefc99515', component: "le-button" }, h(TagType, { key: '44145a5244577aab167c103501b788f0088799e3', class: classnames('le-button-container', `le-button-align-${this.align}`), part: "button", ...attrs, onClick: this.handleClick }, this.iconOnly !== undefined ? (h("slot", { name: "icon-only" }, typeof this.iconOnly === 'string' ? this.iconOnly : null)) : (h(Fragment, null, h("span", { class: "le-button-label" }, this.iconStart && (h("span", { class: "icon-start", part: "icon-start" }, this.iconStart)), h("le-slot", { name: "", description: "Button text", type: "text", class: "content", part: "content" }, h("slot", null))), this.iconEnd && (h("span", { class: "icon-end", part: "icon-end" }, this.iconEnd))))))));
558
- }
559
- };
560
- LeButton.style = leButtonCss();
561
-
562
- const leCheckboxCss = () => `:host{display:block;--le-checkbox-size:18px;--le-checkbox-color:var(--le-color-primary, #007bff);--le-checkbox-label-color:var(--le-color-text-primary, #333);--le-checkbox-desc-color:var(--le-color-text-secondary, #666);--le-checkbox-border-radius:var(--le-radius-sm, 2px);--le-checkbox-marker-color:var(--le-color-surface, #fff)}.le-checkbox-wrapper{display:flex;flex-direction:column;gap:4px}.le-checkbox-label{display:inline-flex;align-items:flex-start;gap:8px;cursor:pointer;user-select:none}:host([disabled]) .le-checkbox-label{cursor:not-allowed;opacity:0.6}.le-checkbox-input{display:flex;align-items:center;justify-content:center;min-height:1.4em}input[type="checkbox"]{appearance:none;-webkit-appearance:none;width:var(--le-checkbox-size);height:var(--le-checkbox-size);border:var(--le-border-width, 2px) solid var(--le-checkbox-color);border-radius:var(--le-checkbox-border-radius);margin:0;margin-top:2px;position:relative;cursor:inherit;background-color:transparent;transition:background-color 0.2s, border-color 0.2s}input[type="checkbox"]:checked{background-color:var(--le-checkbox-color)}input[type="checkbox"]:checked::after{content:'';position:absolute;left:0;top:0;bottom:calc(var(--le-checkbox-size) / 5);right:0;margin:auto;width:calc(var(--le-checkbox-size) / 4);height:calc(var(--le-checkbox-size) / 2);border:solid var(--le-checkbox-marker-color, #fff);border-width:0 calc(var(--le-checkbox-size) / 10) calc(var(--le-checkbox-size) / 10) 0;transform:rotate(45deg)}input[type="checkbox"]:focus-visible{outline:2px solid var(--le-color-focus);outline-offset:2px}.le-checkbox-text{flex:1;flex-wrap:wrap;color:var(--le-checkbox-label-color);line-height:1.5;text-align:start}.le-checkbox-description{margin-left:calc(var(--le-checkbox-size) + 8px);font-size:0.875em;color:var(--le-checkbox-desc-color);line-height:1.4}:host [slot="description"]{margin:0}`;
563
-
564
- const LeCheckbox = class {
565
- constructor(hostRef) {
566
- registerInstance(this, hostRef);
567
- this.leChange = createEvent(this, "change");
568
- }
569
- get el() { return getElement(this); }
570
- /**
571
- * Whether the checkbox is checked
572
- */
573
- checked = false;
574
- /**
575
- * Whether the checkbox is disabled
576
- */
577
- disabled = false;
578
- /**
579
- * The name of the checkbox input
580
- */
581
- name;
582
- /**
583
- * The value of the checkbox input
584
- */
585
- value;
586
- /**
587
- * External ID for linking with external systems (e.g. database ID, PDF form field ID)
588
- */
589
- externalId;
590
- /**
591
- * Emitted when the checked state changes
592
- */
593
- leChange;
594
- handleChange = (event) => {
595
- // We stop the internal button click from bubbling up
596
- event.stopPropagation();
597
- if (this.disabled) {
598
- event.preventDefault();
599
- return;
600
- }
601
- const input = event.target;
602
- this.checked = input.checked;
603
- this.leChange.emit({
604
- checked: this.checked,
605
- value: this.value,
606
- name: this.name,
607
- externalId: this.externalId
608
- });
609
- };
610
- render() {
611
- return (h("le-component", { key: 'cb04cc6a990ee321dd7e8fca2f0bf56c76a865fa', component: "le-checkbox", hostClass: classnames({ 'disabled': this.disabled }) }, h("div", { key: '1b8737eb0d572ba5fdf8c2cfc5ced4af5ef30997', class: "le-checkbox-wrapper" }, h("label", { key: '1d26d68565ade32489f2fade8120c7b8ad75b251', class: "le-checkbox-label" }, h("span", { key: '7e6b5e610c9f16c36b93c57284891366e6b3b756', class: "le-checkbox-input" }, h("input", { key: 'a12a374aa69526d802f36f00b0ae4bcd4ed27bc3', type: "checkbox", name: this.name, value: this.value, checked: this.checked, disabled: this.disabled, onChange: this.handleChange })), h("span", { key: 'e4ea1f85102c99751f9853b8e23fbd40ebd24780', class: "le-checkbox-text" }, h("le-slot", { key: 'cdda2111e4dfa6d7270280bac305255980842d48', name: "", type: "text", tag: "span" }, h("slot", { key: '32f57155d7a56f48e5780e37ea1ccac308db6848' })))), h("div", { key: '37d54d8c87b90987653f66a319958849893e7d91', class: "le-checkbox-description" }, h("le-slot", { key: 'fceedc24ef6a3561120456e9b387801a40c5919c', name: "description", type: "text", tag: "div", label: "Description" }, h("slot", { key: 'f1f87b7192565831a2f20428e8e2c0a974166dfd', name: "description" }))))));
612
- }
613
- };
614
- LeCheckbox.style = leCheckboxCss();
615
-
616
- const leCollapseCss = () => `:host{--le-collapse-duration:var(--le-transition-normal);display:grid;grid-template-rows:1fr;opacity:1;transition:grid-template-rows var(--le-collapse-duration),
617
- opacity var(--le-collapse-duration)}:host([data-open="false"]),:host([closed]){grid-template-rows:0fr;opacity:0}:host([no-fading][data-open="false"]),:host([no-fading][closed]){opacity:1}.region{display:flex;flex-direction:column;justify-content:flex-end;overflow:hidden}.region.scroll-down{justify-content:flex-start}`;
618
-
619
- const LeCollapse = class {
620
- constructor(hostRef) {
621
- registerInstance(this, hostRef);
622
- }
623
- get el() { return getElement(this); }
624
- /**
625
- * Since Stencil boolean props default to `false` when the attribute is missing.
626
- * instead of `open` defaulting to `true`, using a `closed` prop.
627
- */
628
- closed = false;
629
- /** Whether the content should scroll down from the top when open. */
630
- scrollDown = false;
631
- /** Stop fading the content when collapsing/expanding. */
632
- noFading = false;
633
- /** If true, collapse/expand based on the nearest header shrink event. */
634
- collapseOnHeaderShrink = false;
635
- /**
636
- * Handles `leHeaderShrinkChange` events from the `le-header`.
637
- * In case multiple headers are present, only the nearest one in the DOM tree is used.
638
- */
639
- handleHeaderShrink(ev) {
640
- const e = ev;
641
- this.headerShrunk = !!e.detail?.shrunk;
642
- }
643
- headerShrunk = false;
644
- componentDidLoad() {
645
- this.applyOpenState();
646
- }
647
- onOpenChange() {
648
- this.applyOpenState();
649
- }
650
- onDrivenStateChange() {
651
- this.applyOpenState();
652
- }
653
- shouldBeOpen() {
654
- if (this.closed)
655
- return false;
656
- if (this.collapseOnHeaderShrink && this.headerShrunk)
657
- return false;
658
- return true;
659
- }
660
- applyOpenState() {
661
- const nextOpen = this.shouldBeOpen();
662
- this.el.toggleAttribute('data-open', nextOpen);
663
- }
664
- render() {
665
- return (h(Host, { key: 'e0882ec40ed132dbd6eeaa43da4aff03b6e45352', "data-open": this.shouldBeOpen() ? 'true' : 'false' }, h("le-component", { key: '55c98e5382ddd6b5ef8a8f506f9a2901fc0b48ce', component: "le-collapse" }, h("div", { key: '0bcfa5aada8a7a6f9c86011e6a3dfa5bbb5e08c4', class: { 'region': true, 'scroll-down': this.scrollDown }, part: "region" }, h("slot", { key: '7b762e372802512a287ae98d4aeecdb3160bb54e' })))));
666
- }
667
- static get watchers() { return {
668
- "open": ["onOpenChange"],
669
- "headerShrunk": ["onDrivenStateChange"]
670
- }; }
671
- };
672
- LeCollapse.style = leCollapseCss();
673
-
674
- const leComponentCss = () => `:host{display:contents}:host(.admin-mode){display:block}.le-component-wrapper{position:relative;border:2px dashed var(--le-admin-border-color, #90caf9);border-radius:var(--le-radius-md, 8px);background:var(--le-admin-bg, rgba(144, 202, 249, 0.05));transition:border-color 0.2s ease, box-shadow 0.2s ease}.le-component-wrapper:hover{border-color:var(--le-admin-border-hover, #42a5f5);box-shadow:0 0 0 2px var(--le-admin-glow, rgba(66, 165, 245, 0.2))}.le-component-header{display:flex;align-items:center;justify-content:space-between;gap:var(--le-spacing-1, 4px);padding:0 0 0 var(--le-spacing-1, 4px);background:var(--le-admin-header-bg, rgba(144, 202, 249, 0.15));border-bottom:1px solid var(--le-admin-border-color, #90caf9);border-radius:var(--le-radius-md, 8px) var(--le-radius-md, 8px) 0 0;font-size:var(--le-font-size-xs, 11px)}.le-component-name{font-weight:var(--le-font-weight-medium, 500);color:var(--le-admin-text, #1976d2);text-transform:capitalize;text-align:start;overflow:hidden;width:0;flex:1 1 0%}.le-component-content{padding:var(--le-space-xs, 4px)}.le-component-trigger{font-size:24px;line-height:0px;width:12px;height:12px}.le-component-button{width:20px}.property-editor{display:flex;flex-direction:column;gap:var(--le-space-sm, 8px);max-width:380px}.property-field{display:flex;flex-direction:column;gap:var(--le-space-xs, 4px)}.property-field label{display:flex;flex-direction:column;gap:2px;font-size:var(--le-font-size-sm, 13px);font-weight:var(--le-font-weight-medium, 500);color:var(--le-color-text, #333)}.property-hint{font-size:var(--le-font-size-xs, 11px);font-weight:normal;color:var(--le-color-text-secondary, #666);line-height:1.3}.property-field input[type="text"],.property-field input[type="number"],.property-field select{padding:var(--le-space-xs, 4px) var(--le-space-sm, 8px);border:1px solid var(--le-color-border, #ddd);border-radius:var(--le-radius-md, 7px);font-size:var(--le-font-size-sm, 13px);font-family:inherit;background:var(--le-color-surface, #fff);color:var(--le-color-text, #333);transition:border-color 0.15s ease, box-shadow 0.15s ease}.property-field input:focus,.property-field select:focus{outline:none;border-color:var(--le-color-primary, #1976d2);box-shadow:0 0 0 2px var(--le-color-primary-light, rgba(25, 118, 210, 0.2))}.property-field--checkbox{flex-direction:column}.property-field--checkbox label{flex-direction:row;align-items:center;gap:var(--le-space-sm, 8px);cursor:pointer}.property-field--checkbox input[type="checkbox"]{width:16px;height:16px;margin:0;cursor:pointer;accent-color:var(--le-color-primary, #1976d2)}.property-field--checkbox .property-hint{margin-left:24px}.no-properties{margin:0;padding:var(--le-space-sm, 8px);font-size:var(--le-font-size-sm, 13px);color:var(--le-color-text-secondary, #666);text-align:center}.property-editor-container{display:flex;flex-direction:column;gap:var(--le-space-md, 12px)}.property-editor-actions{padding-top:var(--le-space-sm, 8px);border-top:1px solid var(--le-color-border, #e5e5e5)}.delete-component-btn{display:flex;align-items:center;justify-content:center;gap:var(--le-space-xs, 4px);width:100%;padding:var(--le-space-sm, 8px) var(--le-space-md, 12px);border:1px solid var(--le-color-danger, #e53935);border-radius:var(--le-radius-md, 6px);background:transparent;color:var(--le-color-danger, #e53935);font-size:var(--le-font-size-sm, 13px);font-weight:500;cursor:pointer;transition:background-color 0.15s, color 0.15s}.delete-component-btn:hover{background:var(--le-color-danger, #e53935);color:white}.delete-component-btn:active{opacity:0.9}`;
675
-
676
- const LeComponent = class {
677
- constructor(hostRef) {
678
- registerInstance(this, hostRef);
679
- }
680
- get el() { return getElement(this); }
681
- /**
682
- * The tag name of the component (e.g., 'le-card').
683
- * Used to look up property metadata and display the component name.
684
- */
685
- component;
686
- /**
687
- * Optional display name for the component.
688
- * If not provided, the tag name will be formatted as the display name.
689
- */
690
- displayName;
691
- /**
692
- * Classes to apply to the host element.
693
- * Allows parent components to pass their styling classes.
694
- */
695
- hostClass;
696
- /**
697
- * Inline styles to apply to the host element.
698
- * Allows parent components to pass dynamic styles (e.g., flex properties).
699
- */
700
- hostStyle;
701
- /**
702
- * Reference to the host element (found automatically from parent)
703
- */
704
- hostElement;
705
- /**
706
- * Internal state to track admin mode
707
- */
708
- adminMode = false;
709
- /**
710
- * Component metadata loaded from Custom Elements Manifest
711
- */
712
- componentMeta = null;
713
- /**
714
- * Current property values of the host component
715
- */
716
- propertyValues = {};
717
- disconnectModeObserver;
718
- connectedCallback() {
719
- // Find the host element - le-component is rendered inside the component's shadow DOM,
720
- // so we need to find the shadow root's host element
721
- this.findHostElement();
722
- this.disconnectModeObserver = observeModeChanges(this.el, mode => {
723
- this.adminMode = mode === 'admin';
724
- // Load metadata and refresh property values only when entering admin mode
725
- if (this.adminMode) {
726
- if (!this.componentMeta) {
727
- this.loadComponentMetadata();
728
- }
729
- else {
730
- this.readPropertyValues();
731
- }
732
- }
733
- });
734
- }
735
- /**
736
- * Find the host element by traversing up through shadow DOM
737
- */
738
- findHostElement() {
739
- // Get the shadow root that contains this le-component
740
- const rootNode = this.el.getRootNode();
741
- if (rootNode instanceof ShadowRoot) {
742
- // The host of this shadow root is our target component (e.g., le-card)
743
- this.hostElement = rootNode.host;
744
- }
745
- }
746
- componentDidLoad() {
747
- // Read initial property values from the host element
748
- this.readPropertyValues();
749
- }
750
- disconnectedCallback() {
751
- this.disconnectModeObserver?.();
752
- }
753
- /**
754
- * Formats a tag name into a display name
755
- * e.g., 'le-card' -> 'Card'
756
- */
757
- formatDisplayName(tagName) {
758
- if (!tagName || typeof tagName !== 'string')
759
- return 'unknown';
760
- return tagName
761
- .replace(/^le-/, '') // Remove 'le-' prefix
762
- .split('-')
763
- .map(word => word.charAt(0).toUpperCase() + word.slice(1))
764
- .join(' ');
765
- }
766
- /**
767
- * Load component metadata from the Custom Elements Manifest
768
- */
769
- async loadComponentMetadata() {
770
- try {
771
- // Fetch the manifest from configured URL
772
- const { manifestFile } = getLeKitConfig();
773
- const manifestFileResolved = getAssetPath(`./assets/${manifestFile}`);
774
- const response = await fetch(manifestFileResolved);
775
- const manifest = await response.json();
776
- // Find the component definition
777
- for (const module of manifest.modules) {
778
- for (const declaration of module.declarations || []) {
779
- if (declaration.tagName === this.component) {
780
- const attributes = (declaration.attributes || []).filter((attr) => !this.isInternalAttribute(attr.name));
781
- this.componentMeta = {
782
- tagName: declaration.tagName,
783
- description: declaration.description,
784
- attributes,
785
- };
786
- // console.log(`[le-component] Loaded metadata for ${this.component}:`, this.componentMeta);
787
- // Read property values after metadata is loaded
788
- this.readPropertyValues();
789
- return;
790
- }
791
- }
792
- }
793
- // console.warn(`[le-component] No metadata found for component: ${this.component}`);
794
- }
795
- catch (error) {
796
- // console.warn(`[le-component] Failed to load metadata for component: ${this.component}`, error);
797
- }
798
- }
799
- /**
800
- * Check if an attribute is internal (should not be shown in editor)
801
- */
802
- isInternalAttribute(name) {
803
- const internalAttrs = ['mode', 'theme', 'class', 'style', 'id', 'slot'];
804
- return internalAttrs.includes(name);
805
- }
806
- /**
807
- * Read current property values from the host element
808
- */
809
- readPropertyValues() {
810
- if (!this.hostElement || !this.componentMeta)
811
- return;
812
- const values = {};
813
- for (const attr of this.componentMeta.attributes) {
814
- const value = this.hostElement.getAttribute(attr.name);
815
- values[attr.name] = this.parseAttributeValue(value, attr.type?.text);
816
- }
817
- this.propertyValues = values;
818
- }
819
- /**
820
- * Parse an attribute value based on its type
821
- */
822
- parseAttributeValue(value, type) {
823
- if (value === null)
824
- return undefined;
825
- if (type === 'boolean') {
826
- return value !== null && value !== 'false';
827
- }
828
- if (type === 'number') {
829
- return parseFloat(value);
830
- }
831
- return value;
832
- }
833
- /**
834
- * Handle property value changes from the editor
835
- */
836
- handlePropertyChange(attrName, value, type) {
837
- if (!this.hostElement)
838
- return;
839
- // Update the host element's attribute
840
- if (type === 'boolean') {
841
- if (value) {
842
- this.hostElement.setAttribute(attrName, '');
843
- }
844
- else {
845
- this.hostElement.removeAttribute(attrName);
846
- }
847
- }
848
- else if (value === undefined || value === '') {
849
- this.hostElement.removeAttribute(attrName);
850
- }
851
- else {
852
- this.hostElement.setAttribute(attrName, String(value));
853
- }
854
- // Update local state
855
- this.propertyValues = { ...this.propertyValues, [attrName]: value };
856
- // update the host element the way the parent element mutation observer would catch it?
857
- }
858
- /**
859
- * Delete this component from the DOM
860
- */
861
- deleteComponent() {
862
- if (!this.hostElement)
863
- return;
864
- // Confirm deletion
865
- const name = this.displayName || this.formatDisplayName(this.component);
866
- if (!leConfirm(`Delete this ${name}?`))
867
- return;
868
- // Remove the host element from its parent
869
- const parent = this.hostElement.parentElement;
870
- if (parent) {
871
- this.hostElement.remove();
872
- }
873
- }
874
- /**
875
- * Render the property editor form
876
- */
877
- renderPropertyEditor() {
878
- const hasProperties = this.componentMeta && this.componentMeta.attributes.length > 0;
879
- return (h("div", { class: "property-editor-container" }, hasProperties ? (h("form", { class: "property-editor", onSubmit: e => e.preventDefault() }, this.componentMeta.attributes.map(attr => this.renderPropertyField(attr)))) : (h("p", { class: "no-properties" }, "No editable properties")), h("div", { class: "property-editor-actions" }, h("le-button", { type: "button", variant: "outlined", color: "danger", "full-width": true, onClick: () => this.deleteComponent() }, h("span", { slot: "icon-start" }, "\uD83D\uDDD1\uFE0F"), h("span", null, "Delete Component")))));
880
- }
881
- /**
882
- * Render a single property field based on its type
883
- */
884
- renderPropertyField(attr) {
885
- const value = this.propertyValues[attr.name];
886
- const type = attr.type?.text || 'string';
887
- // Check if type is a union of string literals (e.g., "'default' | 'outlined' | 'elevated'")
888
- const enumMatch = type.match(/^'[^']+'/);
889
- if (enumMatch) {
890
- const options = type.split('|').map(opt => opt.trim().replace(/'/g, ''));
891
- return (h("div", { class: "property-field" }, h("label", { htmlFor: `prop-${attr.name}` }, attr.name, attr.description && h("span", { class: "property-hint" }, attr.description)), h("le-select", { options: [...options.map(opt => ({ label: opt, value: opt }))], "full-width": true, value: value ?? attr.default?.replace(/'/g, ''), placeholder: attr.default?.replace(/'/g, ''), onChange: (e) => this.handlePropertyChange(attr.name, e.detail.value, type) })));
892
- }
893
- // Boolean type
894
- if (type === 'boolean') {
895
- return (h("div", { class: "property-field property-field--checkbox" }, h("le-checkbox", { name: `prop-${attr.name}`, checked: value === true || value === '', onChange: e => this.handlePropertyChange(attr.name, e.target.checked, type) }, attr.name, attr.description && h("div", { slot: "description" }, attr.description))));
896
- }
897
- // Number type
898
- if (type === 'number') {
899
- return (h("div", { class: "property-field" }, h("label", { htmlFor: `prop-${attr.name}` }, attr.name, attr.description && h("span", { class: "property-hint" }, attr.description)), h("input", { type: "number", id: `prop-${attr.name}`, value: value ?? '', placeholder: attr.default, onChange: e => this.handlePropertyChange(attr.name, e.target.value, type) })));
900
- }
901
- // Default: string/text input
902
- return (h("div", { class: "property-field" }, h("le-string-input", { name: `prop-${attr.name}`, label: attr.name, value: value ?? '', placeholder: attr.default?.replace(/'/g, ''), onChange: (e) => this.handlePropertyChange(attr.name, e.detail.value, type) }, h("span", { slot: "description" }, attr.description))));
903
- }
904
- render() {
905
- const name = this.displayName || this.formatDisplayName(this.component);
906
- // In default mode, just pass through content with host classes
907
- if (!this.adminMode) {
908
- return (h(Host, { class: classnames(this.component, this.hostClass), style: this.hostStyle }, h("slot", null)));
909
- }
910
- // In admin mode, show wrapper with header and settings
911
- return (h(Host, { class: classnames(this.component, this.hostClass, 'admin-mode'), style: this.hostStyle }, h("div", { class: "le-component-wrapper" }, h("div", { class: "le-component-header" }, h("span", { class: "le-component-name" }, name), h("le-popover", { popoverTitle: `${name} Settings`, position: "right", align: "start", "min-width": "300px", mode: "default" }, h("le-button", { type: "button", class: "le-component-button", slot: "trigger", variant: "clear", size: "small", "aria-label": "Edit component properties", "icon-only": true }, h("span", { class: "le-component-trigger", slot: "icon-only" }, "\u2699")), this.renderPropertyEditor())), h("div", { class: "le-component-content" }, h("slot", null)))));
912
- }
913
- static get assetsDirs() { return ["assets"]; }
914
- };
915
- LeComponent.style = leComponentCss();
916
-
917
- const leCurrentHeadingCss = () => `:host{display:inline-flex;min-width:0}.title{font:inherit;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--le-current-heading-color, var(--le-color-text-primary))}`;
918
-
919
- const LeCurrentHeading = class {
920
- constructor(hostRef) {
921
- registerInstance(this, hostRef);
922
- }
923
- get el() { return getElement(this); }
924
- /** CSS selector for page title/headings to watch (e.g. `.page-title`, `main h2`). */
925
- selector = '';
926
- activeText = null;
927
- componentWillLoad() {
928
- this.updateActiveTitle();
929
- }
930
- onSelectorChange() {
931
- this.updateActiveTitle();
932
- }
933
- onScroll() {
934
- this.updateActiveTitle();
935
- }
936
- onResize() {
937
- this.updateActiveTitle();
938
- }
939
- updateActiveTitle() {
940
- if (typeof window === 'undefined')
941
- return;
942
- const selector = (this.selector ?? '').trim();
943
- if (!selector) {
944
- this.activeText = null;
945
- return;
946
- }
947
- let elements = [];
948
- try {
949
- elements = Array.from(document.querySelectorAll(selector));
950
- }
951
- catch {
952
- this.activeText = null;
953
- return;
954
- }
955
- // Pick the last element that is fully above the viewport.
956
- let nextText = null;
957
- for (const element of elements) {
958
- const rect = element.getBoundingClientRect();
959
- if (rect.height > 0 && rect.bottom <= 0) {
960
- const t = (element.textContent ?? '').trim();
961
- if (t)
962
- nextText = t;
963
- }
964
- }
965
- // Do not create oscillations: update only when the computed title changes.
966
- if (nextText !== this.activeText) {
967
- this.activeText = nextText;
968
- }
969
- }
970
- render() {
971
- return (h(Host, { key: 'c8d94a695a402039000210914b6780264a034a89' }, this.activeText ? (h("span", { class: "title", part: "title" }, this.activeText)) : (h("slot", null))));
972
- }
973
- static get watchers() { return {
974
- "selector": ["onSelectorChange"]
975
- }; }
976
- };
977
- LeCurrentHeading.style = leCurrentHeadingCss();
978
-
979
- const leDropdownBaseCss = () => `:host{display:block;--le-dropdown-list-padding:var(--le-spacing-1);--le-dropdown-empty-padding:var(--le-spacing-4);--le-dropdown-option-radius:var(--le-radius-md);--le-dropdown-font-size:var(--le-font-size-sm);--le-dropdown-option-padding:var(--le-spacing-1) var(--le-spacing-2);--le-dropdown-group-padding:var(--le-spacing-2) var(--le-spacing-2) var(--le-spacing-1);--le-dropdown-group-font-size:var(--le-font-size-xs)}:host([disabled]){pointer-events:none;opacity:0.5}le-popover::part(content){overflow-y:auto;overflow-x:hidden;padding:var(--le-dropdown-list-padding, 0.25rem)}.dropdown-empty{padding:var(--le-dropdown-empty-padding);text-align:center;color:var(--le-color-text-secondary, #9ca3af);font-size:var(--le-dropdown-font-size)}.dropdown-group-header{padding:var(--le-dropdown-group-padding);font-size:var(--le-dropdown-group-font-size);font-weight:700;color:var(--le-color-text-secondary, #9ca3af);letter-spacing:0.05em}.dropdown-list{text-align:initial}.dropdown-separator{height:1px;margin:var(--le-dropdown-separator-margin, 0.25rem 0);background:var(--le-color-border, #e5e7eb)}.dropdown-option{display:flex;align-items:center;gap:var(--le-dropdown-option-gap, 0.5rem);padding:var(--le-dropdown-option-padding);font-size:var(--le-dropdown-font-size, 0.875rem);line-height:1.4;color:var(--le-color-text, #1f2937);border:1px solid transparent;border-radius:var(--le-dropdown-option-radius, 0.25rem);cursor:pointer;user-select:none;transition:background-color 0.1s ease}.dropdown-option:hover,.dropdown-option.is-focused{border-color:var(--le-color-border-hover, #d1d5db)}.dropdown-option.is-disabled{opacity:0.5;cursor:not-allowed}.dropdown-option.is-disabled:hover{background:transparent}.option-checkbox{display:flex;align-items:center;justify-content:center;width:1rem;height:1rem;border:2px solid var(--le-color-border, #d1d5db);border-radius:0.25rem;background:var(--le-color-surface, #fff);flex-shrink:0}.is-selected .option-checkbox{background:var(--le-color-primary, #3b82f6);border-color:var(--le-color-primary, #3b82f6);color:white}.option-checkbox svg{width:0.75rem;height:0.75rem}.option-icon-start,.option-icon-end{display:flex;align-items:center;justify-content:center;flex-shrink:0;width:1.25rem;height:1.25rem}.option-icon-start img,.option-icon-end img{width:100%;height:100%;object-fit:contain}.option-content{flex:1;min-width:0;display:flex;flex-direction:column}.option-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.option-description{font-size:0.75rem;color:var(--le-color-text-muted, #6b7280);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.option-check{display:flex;align-items:center;justify-content:center;width:1rem;height:1rem;color:var(--le-color-primary, #3b82f6);flex-shrink:0}.option-check svg{width:1rem;height:1rem}`;
980
-
981
- const LeDropdownBase = class {
982
- constructor(hostRef) {
983
- registerInstance(this, hostRef);
984
- this.leOptionSelect = createEvent(this, "leOptionSelect");
985
- this.leDropdownOpen = createEvent(this, "leDropdownOpen");
986
- this.leDropdownClose = createEvent(this, "leDropdownClose");
987
- }
988
- get el() { return getElement(this); }
989
- /**
990
- * The options to display in the dropdown.
991
- */
992
- options = [];
993
- /**
994
- * Current value(s) - single value or array for multiselect.
995
- */
996
- value;
997
- /**
998
- * Whether multiple selection is allowed.
999
- */
1000
- multiple = false;
1001
- /**
1002
- * Whether the dropdown is open.
1003
- */
1004
- open = false;
1005
- /**
1006
- * Whether the dropdown is disabled.
1007
- */
1008
- disabled = false;
1009
- /**
1010
- * Filter function for options.
1011
- * Return true to include the option.
1012
- */
1013
- filterFn;
1014
- /**
1015
- * Current filter query string.
1016
- */
1017
- filterQuery = '';
1018
- /**
1019
- * Placeholder text when no options match filter.
1020
- */
1021
- emptyText = 'No options';
1022
- /**
1023
- * Whether to show checkboxes for multiselect mode.
1024
- */
1025
- showCheckboxes = true;
1026
- /**
1027
- * Maximum height of the dropdown list.
1028
- */
1029
- maxHeight = '300px';
1030
- /**
1031
- * Width of the dropdown. If not set, matches trigger width.
1032
- */
1033
- width;
1034
- /**
1035
- * Sets the dropdown to full width of the trigger.
1036
- */
1037
- fullWidth = false;
1038
- /**
1039
- * Whether to close the dropdown when clicking outside.
1040
- * (used to support combobox with input focus)
1041
- */
1042
- closeOnClickOutside = true;
1043
- /**
1044
- * Emitted when an option is selected.
1045
- */
1046
- leOptionSelect;
1047
- /**
1048
- * Emitted when the dropdown opens.
1049
- */
1050
- leDropdownOpen;
1051
- /**
1052
- * Emitted when the dropdown closes.
1053
- */
1054
- leDropdownClose;
1055
- focusedIndex = -1;
1056
- filteredOptions = [];
1057
- popoverEl;
1058
- listEl;
1059
- triggerWidth = 0;
1060
- handleOptionsChange() {
1061
- this.updateFilteredOptions();
1062
- }
1063
- componentWillLoad() {
1064
- this.updateFilteredOptions();
1065
- }
1066
- updateFilteredOptions() {
1067
- // Remember previously focused option
1068
- const focusedOption = this.filteredOptions[this.focusedIndex];
1069
- if (!this.filterQuery || !this.filterFn) {
1070
- this.filteredOptions = this.options;
1071
- }
1072
- else {
1073
- this.filteredOptions = this.options.filter(opt => this.filterFn(opt, this.filterQuery));
1074
- }
1075
- // try to maintain focus on same option if still present
1076
- if (focusedOption) {
1077
- const newIndex = this.filteredOptions.indexOf(focusedOption);
1078
- this.focusedIndex = newIndex >= 0 ? newIndex : this.getInitialFocusIndex();
1079
- }
1080
- else {
1081
- this.focusedIndex = -1;
1082
- }
1083
- }
1084
- getSelectableOptions() {
1085
- return this.filteredOptions.filter(opt => !opt.disabled);
1086
- }
1087
- isSelected(option) {
1088
- const optValue = option.value ?? option.label;
1089
- if (this.multiple && Array.isArray(this.value)) {
1090
- setTimeout(() => {
1091
- this.popoverEl?.updatePosition();
1092
- }, 50);
1093
- return this.value.includes(optValue);
1094
- }
1095
- return this.value === optValue;
1096
- }
1097
- handleOptionClick(option, e) {
1098
- e.preventDefault();
1099
- e.stopPropagation();
1100
- if (option.disabled)
1101
- return;
1102
- this.leOptionSelect.emit({
1103
- value: option.value ?? option.label,
1104
- option,
1105
- });
1106
- // Close dropdown for single select
1107
- if (!this.multiple) {
1108
- this.hide();
1109
- }
1110
- }
1111
- handleKeyDown = (e) => {
1112
- if (!this.open)
1113
- return;
1114
- const optionCount = this.filteredOptions.length;
1115
- switch (e.key) {
1116
- case 'ArrowDown':
1117
- e.preventDefault();
1118
- // check for the next non-disabled option and focus
1119
- let nextIndex = this.focusedIndex < optionCount - 1 ? this.focusedIndex + 1 : 0;
1120
- while (this.filteredOptions[nextIndex].disabled) {
1121
- nextIndex = ++nextIndex < optionCount ? nextIndex : 0;
1122
- }
1123
- this.focusedIndex = nextIndex;
1124
- this.scrollToFocused();
1125
- break;
1126
- case 'ArrowUp':
1127
- e.preventDefault();
1128
- // check for the previous non-disabled option and focus
1129
- let prevIndex = this.focusedIndex > 0 ? this.focusedIndex - 1 : optionCount - 1;
1130
- while (this.filteredOptions[prevIndex].disabled) {
1131
- prevIndex = --prevIndex >= 0 ? prevIndex : optionCount - 1;
1132
- }
1133
- this.focusedIndex = prevIndex;
1134
- this.scrollToFocused();
1135
- break;
1136
- case 'Home':
1137
- e.preventDefault();
1138
- // check for the first non-disabled option and focus
1139
- let firstIndex = 0;
1140
- while (this.filteredOptions[firstIndex].disabled) {
1141
- firstIndex++;
1142
- if (firstIndex >= optionCount) {
1143
- firstIndex = -1;
1144
- break;
1145
- }
1146
- }
1147
- this.focusedIndex = firstIndex;
1148
- this.scrollToFocused();
1149
- break;
1150
- case 'End':
1151
- e.preventDefault();
1152
- // check for the last non-disabled option and focus
1153
- let lastIndex = optionCount - 1;
1154
- while (this.filteredOptions[lastIndex].disabled) {
1155
- lastIndex--;
1156
- if (lastIndex < 0) {
1157
- lastIndex = -1;
1158
- break;
1159
- }
1160
- }
1161
- this.focusedIndex = lastIndex;
1162
- this.scrollToFocused();
1163
- break;
1164
- case 'Enter':
1165
- case ' ':
1166
- e.preventDefault();
1167
- if (this.focusedIndex >= 0 && this.focusedIndex < optionCount) {
1168
- const option = this.filteredOptions[this.focusedIndex];
1169
- if (!option || option.disabled)
1170
- return;
1171
- this.leOptionSelect.emit({
1172
- value: option.value ?? option.label,
1173
- option,
1174
- });
1175
- if (!this.multiple) {
1176
- this.hide();
1177
- }
1178
- }
1179
- break;
1180
- case 'Escape':
1181
- e.preventDefault();
1182
- this.hide();
1183
- break;
1184
- case 'Tab':
1185
- this.hide();
1186
- break;
1187
- }
1188
- };
1189
- scrollToFocused() {
1190
- if (!this.listEl || this.focusedIndex < 0)
1191
- return;
1192
- const focusedEl = this.listEl.querySelector(`[data-index="${this.focusedIndex}"]`);
1193
- if (focusedEl) {
1194
- focusedEl.scrollIntoView({ block: 'nearest' });
1195
- }
1196
- }
1197
- handlePopoverOpen = () => {
1198
- this.open = true;
1199
- this.focusedIndex = this.getInitialFocusIndex();
1200
- this.leDropdownOpen.emit();
1201
- // Add keyboard listener
1202
- document.addEventListener('keydown', this.handleKeyDown);
1203
- };
1204
- handlePopoverClose = () => {
1205
- this.open = false;
1206
- this.focusedIndex = -1;
1207
- this.leDropdownClose.emit();
1208
- // Remove keyboard listener
1209
- document.removeEventListener('keydown', this.handleKeyDown);
1210
- };
1211
- getInitialFocusIndex() {
1212
- // Focus on first selected option, or first option
1213
- const selectableOptions = this.getSelectableOptions();
1214
- const selectedIndex = selectableOptions.findIndex(opt => this.isSelected(opt));
1215
- return selectedIndex >= 0 ? selectedIndex : 0;
1216
- }
1217
- /**
1218
- * Opens the dropdown.
1219
- */
1220
- async show() {
1221
- if (this.disabled)
1222
- return;
1223
- // Capture trigger width for matching dropdown width
1224
- const trigger = this.el.querySelector('[slot="trigger"]');
1225
- if (trigger) {
1226
- this.triggerWidth = trigger.offsetWidth;
1227
- }
1228
- await this.popoverEl?.show();
1229
- }
1230
- /**
1231
- * Closes the dropdown.
1232
- */
1233
- async hide() {
1234
- await this.popoverEl?.hide();
1235
- }
1236
- /**
1237
- * Toggles the dropdown.
1238
- */
1239
- async toggle() {
1240
- if (this.open) {
1241
- await this.hide();
1242
- }
1243
- else {
1244
- await this.show();
1245
- }
1246
- }
1247
- renderIcon(icon, className) {
1248
- if (!icon)
1249
- return null;
1250
- if (icon.startsWith('http') || icon.startsWith('/')) {
1251
- return h("img", { class: className, src: icon, alt: "" });
1252
- }
1253
- return h("span", { class: className }, icon);
1254
- }
1255
- renderOption(option, index) {
1256
- const isSelected = this.isSelected(option);
1257
- const isFocused = index === this.focusedIndex;
1258
- const optionId = option.id || generateId();
1259
- return (h("div", { class: {
1260
- 'dropdown-option': true,
1261
- 'is-selected': isSelected,
1262
- 'is-focused': isFocused,
1263
- 'is-disabled': !!option.disabled,
1264
- }, role: "option", id: optionId, "aria-selected": isSelected ? 'true' : 'false', "aria-disabled": option.disabled ? 'true' : undefined, "data-index": index, onClick: e => this.handleOptionClick(option, e), onMouseEnter: () => {
1265
- if (!option.disabled) {
1266
- this.focusedIndex = index;
1267
- }
1268
- } }, this.renderIcon(option.iconStart, 'option-icon-start'), h("div", { class: "option-content" }, h("span", { class: "option-label" }, option.label), option.description && h("span", { class: "option-description" }, option.description)), this.renderIcon(option.iconEnd, 'option-icon-end'), (!this.multiple || this.showCheckboxes) && isSelected && (h("span", { class: "option-check" }, h("svg", { viewBox: "0 0 16 16", fill: "currentColor" }, h("path", { d: "M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z" }))))));
1269
- }
1270
- renderOptions() {
1271
- if (this.filteredOptions.length === 0) {
1272
- return h("div", { class: "dropdown-empty" }, this.emptyText);
1273
- }
1274
- // Group options if they have group property
1275
- const grouped = new Map();
1276
- const ungrouped = [];
1277
- this.filteredOptions.forEach(opt => {
1278
- if (opt.group) {
1279
- const group = grouped.get(opt.group) || [];
1280
- group.push(opt);
1281
- grouped.set(opt.group, group);
1282
- }
1283
- else {
1284
- ungrouped.push(opt);
1285
- }
1286
- });
1287
- // Build flat list with group headers for index tracking
1288
- let globalIndex = 0;
1289
- const elements = [];
1290
- // Render ungrouped options first
1291
- ungrouped.forEach(opt => {
1292
- if (opt.separator === 'before') {
1293
- elements.push(h("div", { class: "dropdown-separator", role: "separator" }));
1294
- }
1295
- elements.push(this.renderOption(opt, globalIndex++));
1296
- if (opt.separator === 'after') {
1297
- elements.push(h("div", { class: "dropdown-separator", role: "separator" }));
1298
- }
1299
- });
1300
- // Render grouped options
1301
- grouped.forEach((options, groupLabel) => {
1302
- elements.push(h("div", { class: "dropdown-group-header", role: "presentation" }, groupLabel));
1303
- options.forEach(opt => {
1304
- elements.push(this.renderOption(opt, globalIndex++));
1305
- });
1306
- });
1307
- return elements;
1308
- }
1309
- render() {
1310
- const dropdownWidth = this.width || (this.triggerWidth ? `${this.triggerWidth}px` : undefined);
1311
- return (h(Host, { key: '90bca5763b9110f8e5cad70870110cab1efeeec6' }, h("le-popover", { key: 'ebded64a4f2b23c8b1a954dd995c4d6171ef9c88', ref: el => (this.popoverEl = el), position: "bottom", align: "start", showClose: false, closeOnClickOutside: this.closeOnClickOutside, closeOnEscape: true, offset: 4, width: dropdownWidth, minWidth: "150px", "trigger-full-width": this.fullWidth, onLePopoverOpen: this.handlePopoverOpen, onLePopoverClose: this.handlePopoverClose }, h("slot", { key: '57e540660ee269de594209186d6fbe066b9c8fc1', name: "trigger", slot: "trigger" }), h("slot", { key: 'e58a76a0097f938873f5462c844ee9f1a5eece72', name: "header" }), h("div", { key: 'c4fa35069438df82894e45e87f46aef67a189c43', class: "dropdown-list", role: "listbox", "aria-multiselectable": this.multiple ? 'true' : undefined, ref: el => (this.listEl = el), style: { maxHeight: this.maxHeight } }, this.renderOptions()))));
1312
- }
1313
- static get watchers() { return {
1314
- "options": ["handleOptionsChange"],
1315
- "filterQuery": ["handleOptionsChange"]
1316
- }; }
1317
- };
1318
- LeDropdownBase.style = leDropdownBaseCss();
1319
-
1320
- const leHeaderCss = () => `:host{display:block;width:100%;--le-header-top-offset:0;--le-header-bg:var(--le-color-surface);--le-header-max-width:var(--le-header-max-width, auto);--le-header-margin:0 auto;--le-header-border:1px solid var(--le-color-border);--le-header-border-radius:0px;--le-header-shadow:var(--le-header-shadow, none);--le-header-color:var(--le-color-text);--le-header-content-max-width:800px;--le-header-padding-x:var(--le-space-md);--le-header-padding-y:var(--le-space-sm);--le-header-gap:var(--le-space-sm);--le-header-transition:var(--le-transition-normal);--le-header-z:1000}.header{width:100%;max-width:var(--le-header-max-width);margin:var(--le-header-margin);background:var(--le-header-bg);color:var(--le-header-color);border-bottom:var(--le-header-border);border-radius:var(--le-header-border-radius);box-shadow:var(--le-header-shadow)}:host(.is-fixed){position:fixed;top:var(--le-header-top-offset);left:0;right:0;z-index:var(--le-header-z)}:host(.is-sticky){position:sticky;top:var(--le-header-top-offset);z-index:var(--le-header-z)}:host(.is-static){position:relative}.inner{max-width:var(--le-header-content-max-width);margin:0 auto;padding:var(--le-header-padding-y) var(--le-header-padding-x)}.row{display:grid;grid-template-columns:minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr);align-items:center;gap:var(--le-header-gap);transition:height var(--le-header-transition),
1321
- padding var(--le-header-transition),
1322
- transform var(--le-header-transition)}:host(.is-shrunk) .row{height:var(--le-header-height-condensed)}:host(.is-sticky.is-hidden){transform:translateY(-150%);transition:transform var(--le-header-transition)}:host(.is-sticky.is-revealed){transform:translateY(0);transition:transform var(--le-header-transition)}.start,.title,.end{min-width:0;display:flex;align-items:center}.start{justify-content:flex-start}.end{justify-content:flex-end}.title{justify-content:center;text-align:center}.title-slot ::slotted(*){white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.compact-title{font:inherit;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}`;
1323
-
1324
- const LeHeader = class {
1325
- constructor(hostRef) {
1326
- registerInstance(this, hostRef);
1327
- this.leHeaderState = createEvent(this, "leHeaderState");
1328
- this.leHeaderShrinkChange = createEvent(this, "leHeaderShrinkChange");
1329
- this.leHeaderVisibilityChange = createEvent(this, "leHeaderVisibilityChange");
1330
- }
1331
- get el() { return getElement(this); }
1332
- /** Force static positioning (default). Ignored if `sticky` or `fixed` are true. */
1333
- isStatic = false;
1334
- /** Sticky positioning (in-flow). Ignored if `fixed` is true. */
1335
- sticky = false;
1336
- /** Fixed positioning (out-of-flow). Takes precedence over `sticky`/`static`. */
1337
- fixed = false;
1338
- /**
1339
- * Sticky-only reveal behavior (hide on scroll down, show on scroll up).
1340
- * - missing/false: disabled
1341
- * - true/empty attribute: enabled with default threshold (16)
1342
- * - number (as string): enabled and used as threshold
1343
- */
1344
- revealOnScroll;
1345
- /**
1346
- * Shrink trigger.
1347
- * - missing/0: disabled
1348
- * - number (px): shrink when scrollY >= that value (but never before header height)
1349
- * - css var name (e.g. --foo): shrink when scrollY >= resolved var value
1350
- * - selector (e.g. .page-title): shrink when that element scrolls out of view above the viewport
1351
- */
1352
- shrinkOffset;
1353
- /**
1354
- * If true, expand the header when hovered
1355
- */
1356
- expandOnHover = false;
1357
- /** Emits whenever scroll-driven state changes. */
1358
- leHeaderState;
1359
- /** Emits when the header shrinks/expands (only on change). */
1360
- leHeaderShrinkChange;
1361
- /** Emits when the header hides/shows (only on change). */
1362
- leHeaderVisibilityChange;
1363
- revealed = true;
1364
- shrunk = false;
1365
- placeholderHeight = null;
1366
- hoverActive = false;
1367
- disconnectModeObserver;
1368
- rafId = null;
1369
- measureRafId = null;
1370
- lastY = 0;
1371
- lastEmittedDirection = 'down';
1372
- headerEl;
1373
- shrinkSelectorEl;
1374
- setShrunk(next, y) {
1375
- if (next === this.shrunk)
1376
- return;
1377
- this.shrunk = next;
1378
- this.leHeaderShrinkChange.emit({ shrunk: this.shrunk, y });
1379
- }
1380
- componentDidLoad() {
1381
- if (typeof window === 'undefined')
1382
- return;
1383
- this.lastY = window.scrollY || 0;
1384
- this.scheduleMeasure(true);
1385
- this.scheduleUpdate(true);
1386
- }
1387
- disconnectedCallback() {
1388
- this.disconnectModeObserver?.();
1389
- if (this.rafId != null) {
1390
- cancelAnimationFrame(this.rafId);
1391
- this.rafId = null;
1392
- }
1393
- if (this.measureRafId != null) {
1394
- cancelAnimationFrame(this.measureRafId);
1395
- this.measureRafId = null;
1396
- }
1397
- }
1398
- onBehaviorPropsChange() {
1399
- this.scheduleUpdate(true);
1400
- this.scheduleMeasure(true);
1401
- }
1402
- onWindowScroll() {
1403
- this.scheduleUpdate();
1404
- }
1405
- onWindowResize() {
1406
- this.scheduleMeasure(true);
1407
- this.scheduleUpdate(true);
1408
- }
1409
- getPosition() {
1410
- if (this.fixed)
1411
- return 'fixed';
1412
- if (this.sticky)
1413
- return 'sticky';
1414
- return 'static';
1415
- }
1416
- parseRevealThreshold() {
1417
- // Only applies in sticky mode.
1418
- if (!this.sticky || this.fixed)
1419
- return null;
1420
- if (this.revealOnScroll == null)
1421
- return null;
1422
- const raw = String(this.revealOnScroll).trim();
1423
- if (raw === '' || raw === 'true')
1424
- return 16;
1425
- if (raw === 'false')
1426
- return null;
1427
- const n = Number(raw);
1428
- return Number.isFinite(n) ? Math.max(0, n) : 16;
1429
- }
1430
- resolveShrinkStartPx() {
1431
- const raw = (this.shrinkOffset ?? '').trim();
1432
- if (!raw || raw === '0')
1433
- return null;
1434
- // Numeric
1435
- const numeric = Number(raw);
1436
- if (Number.isFinite(numeric))
1437
- return Math.max(0, numeric);
1438
- // CSS variable name
1439
- if (raw.startsWith('--')) {
1440
- const value = getComputedStyle(document.documentElement).getPropertyValue(raw).trim();
1441
- const v = Number(value.replace('px', '').trim());
1442
- return Number.isFinite(v) ? Math.max(0, v) : null;
1443
- }
1444
- // Selector
1445
- try {
1446
- const el = document.querySelector(raw);
1447
- this.shrinkSelectorEl = el;
1448
- return null;
1449
- }
1450
- catch {
1451
- this.shrinkSelectorEl = null;
1452
- return null;
1453
- }
1454
- }
1455
- scheduleUpdate(force = false) {
1456
- if (this.rafId != null) {
1457
- if (!force)
1458
- return;
1459
- cancelAnimationFrame(this.rafId);
1460
- this.rafId = null;
1461
- }
1462
- this.rafId = requestAnimationFrame(() => {
1463
- this.rafId = null;
1464
- this.updateFromScroll();
1465
- });
1466
- }
1467
- scheduleMeasure(force = false) {
1468
- if (this.measureRafId != null && !force)
1469
- return;
1470
- this.measureRafId = requestAnimationFrame(() => {
1471
- this.measureRafId = null;
1472
- this.measurePlaceholderHeight();
1473
- });
1474
- }
1475
- measurePlaceholderHeight() {
1476
- // Measure the rendered header height once (and on resize/mode change).
1477
- // This intentionally ignores scroll/shrink behavior; it should reserve the full header height.
1478
- if (!this.headerEl)
1479
- return;
1480
- const next = Math.ceil(this.headerEl.getBoundingClientRect().height);
1481
- if (!Number.isFinite(next) || next <= 0)
1482
- return;
1483
- if (next !== this.placeholderHeight) {
1484
- this.placeholderHeight = next;
1485
- // Publish to global root so placeholders anywhere can read it.
1486
- if (typeof document !== 'undefined') {
1487
- document.documentElement.style.setProperty('--le-header-height', `${next}px`);
1488
- }
1489
- }
1490
- }
1491
- updateFromScroll() {
1492
- const y = typeof window !== 'undefined' ? window.scrollY || 0 : 0;
1493
- const delta = y - this.lastY;
1494
- const direction = delta < 0 ? 'up' : 'down';
1495
- // Shrink behavior
1496
- let computedShrunk = false;
1497
- const headerHeight = Math.max(0, this.placeholderHeight ?? 0);
1498
- const shrinkStartPx = typeof window !== 'undefined' ? this.resolveShrinkStartPx() : null;
1499
- if (this.shrinkSelectorEl) {
1500
- const rect = this.shrinkSelectorEl.getBoundingClientRect();
1501
- computedShrunk = rect.bottom <= 0;
1502
- }
1503
- else if (shrinkStartPx != null) {
1504
- const effectiveStart = Math.max(shrinkStartPx, headerHeight);
1505
- computedShrunk = y >= effectiveStart;
1506
- }
1507
- // Hover override: when enabled and hovered, force expanded.
1508
- const nextShrunk = this.expandOnHover && this.hoverActive ? false : computedShrunk;
1509
- this.setShrunk(nextShrunk, y);
1510
- // Reveal-on-scroll (sticky-only)
1511
- const revealThreshold = this.parseRevealThreshold();
1512
- if (revealThreshold != null) {
1513
- // Always show the header near the top of the page.
1514
- const topLock = Math.max(0, this.placeholderHeight ?? 0);
1515
- if (y <= topLock) {
1516
- if (!this.revealed) {
1517
- this.revealed = true;
1518
- this.leHeaderVisibilityChange.emit({ visible: true, y });
1519
- }
1520
- }
1521
- else if (Math.abs(delta) >= revealThreshold) {
1522
- const nextRevealed = direction === 'up' || y <= 0;
1523
- if (nextRevealed !== this.revealed) {
1524
- this.revealed = nextRevealed;
1525
- this.leHeaderVisibilityChange.emit({ visible: this.revealed, y });
1526
- }
1527
- this.lastEmittedDirection = direction;
1528
- }
1529
- }
1530
- else {
1531
- if (!this.revealed) {
1532
- this.revealed = true;
1533
- this.leHeaderVisibilityChange.emit({ visible: true, y });
1534
- }
1535
- }
1536
- this.lastY = y;
1537
- this.leHeaderState.emit({
1538
- y,
1539
- direction: this.lastEmittedDirection,
1540
- revealed: this.revealed,
1541
- shrunk: this.shrunk,
1542
- });
1543
- }
1544
- render() {
1545
- const position = this.getPosition();
1546
- const hostClass = classnames('le-header', {
1547
- 'header-is-shrunk': this.shrunk,
1548
- 'is-fixed': position === 'fixed',
1549
- 'is-sticky': position === 'sticky',
1550
- 'is-static': position === 'static',
1551
- 'is-revealed': this.revealed,
1552
- 'is-hidden': !this.revealed,
1553
- 'is-shrunk': this.shrunk,
1554
- });
1555
- return (h(Host, { key: 'd1a4ae64dff81139b1c35681698539fdf072ae66', class: hostClass, onMouseEnter: () => {
1556
- if (!this.expandOnHover)
1557
- return;
1558
- this.hoverActive = true;
1559
- this.scheduleUpdate(true);
1560
- }, onMouseLeave: () => {
1561
- if (!this.expandOnHover)
1562
- return;
1563
- this.hoverActive = false;
1564
- this.scheduleUpdate(true);
1565
- } }, h("le-component", { key: '305bc8b4aefaf2ef1dd7287422167cfd68d3e8c2', component: "le-header" }, h("header", { key: '1cf3b2ab01140e14870c1282e49e6eb3dbae5bf8', class: "header", part: "header", role: "banner", ref: el => (this.headerEl = el) }, h("div", { key: 'b238e3762dd31228f3ab3627fbca2ff1a9c630fd', class: "inner", part: "inner" }, h("div", { key: 'f186fbecc9c9b6f6f08f45c272c292af9333450e', class: "row", part: "row" }, h("div", { key: 'e496055801a36f4cf7a045513df2bc917a573786', class: "start", part: "start" }, h("le-slot", { key: '697b90a8291836452c17d2c9d3759c23b7238e93', name: "start", label: "Start", description: "Logo / back button / nav", "allowed-components": "le-button,le-text,le-tag,le-box,le-stack" }, h("slot", { key: 'e7e2b7ad283ce089def47d1f11f78a8a1603face', name: "start" }))), h("div", { key: '145aaadb93972b9018f9303baee2d5b3c42db319', class: "title", part: "title" }, h("le-slot", { key: 'c488ef0d01da476a6351ae4b7dfb397950f9c3ce', name: "title", label: "Title", description: "Header title", type: "text", tag: "span" }, h("span", { key: '78c21f46cbc81dc720e2f803cb3edc81ba5f76cf', class: "title-slot", part: "title" }, h("slot", { key: 'a47d5c8d4d0ae42b1cb4d7fab98022cbb380a27e', name: "title" })))), h("div", { key: '5fb7c5febcfb9b837f313caa65ea9b5e08b6f9cb', class: "end", part: "end" }, h("le-slot", { key: 'cc2ed75ea779a29e5c616daafec3ef90bbec3cfc', name: "end", label: "End", description: "Actions", "allowed-components": "le-button,le-text,le-tag,le-box,le-stack" }, h("slot", { key: '135e8c2c0d7a7d9bef174f380d1f31d377cb043f', name: "end" })))), h("div", { key: 'b0d9e5fba045b7cfd5640e7ba700cb44d673f982', class: "secondary", part: "secondary" }, h("le-slot", { key: '75ed60e3ddef918db1534f8818cd0f337c71e8db', name: "", label: "Secondary", description: "Secondary row content", "allowed-components": "le-tabs,le-tab-bar,le-select,le-combobox,le-text,le-stack,le-box" }, h("slot", { key: '1266dc5bb54bf22055acbfc23befb398c1ee5a31' }))))))));
1566
- }
1567
- static get watchers() { return {
1568
- "revealOnScroll": ["onBehaviorPropsChange"],
1569
- "shrinkOffset": ["onBehaviorPropsChange"],
1570
- "fixed": ["onBehaviorPropsChange"],
1571
- "sticky": ["onBehaviorPropsChange"],
1572
- "isStatic": ["onBehaviorPropsChange"]
1573
- }; }
1574
- };
1575
- LeHeader.style = leHeaderCss();
1576
-
1577
- const leIconCss = () => `:host{display:inline-block;width:var(--le-icon-size, var(--le-size-4));height:var(--le-icon-size, var(--le-size-4));color:var(--le-icon-color, var(--le-color-text-primary))}:host svg{display:block;fill:currentColor}`;
1578
-
1579
- const iconCache = {};
1580
- const requestCache = {};
1581
- /**
1582
- * Get the URL for loading an icon.
1583
- * Uses configurable assetBasePath if set, otherwise falls back to Stencil's getAssetPath.
1584
- */
1585
- function getIconUrl(name) {
1586
- const basePath = getAssetBasePath();
1587
- if (basePath) {
1588
- // Use configured base path - normalize by removing trailing slash
1589
- const normalizedBase = basePath.endsWith('/') ? basePath.slice(0, -1) : basePath;
1590
- return `${normalizedBase}/icons/${name}.json`;
1591
- }
1592
- // Fall back to Stencil's getAssetPath for local development
1593
- return getAssetPath(`./assets/icons/${name}.json`);
1594
- }
1595
- async function fetchIcon({ name }) {
1596
- if (iconCache[name]) {
1597
- return iconCache[name];
1598
- }
1599
- if (!requestCache[name]) {
1600
- const iconUrl = getIconUrl(name);
1601
- requestCache[name] = fetch(iconUrl)
1602
- .then(resp => resp.json())
1603
- .catch(() => {
1604
- console.error(`Icon "${name}" could not be loaded from: ${iconUrl}`);
1605
- return '';
1606
- });
1607
- }
1608
- const path = await requestCache[name];
1609
- iconCache[name] = path;
1610
- return path;
1611
- }
1612
- const LeIcon = class {
1613
- constructor(hostRef) {
1614
- registerInstance(this, hostRef);
1615
- }
1616
- get el() { return getElement(this); }
1617
- /**
1618
- * Name of the icon to display. Corresponds to a JSON file in the assets folder.
1619
- * For example, "search" will load the "search.json" file.
1620
- */
1621
- name = null;
1622
- /**
1623
- * Size of the icon in pixels. Default is 16.
1624
- */
1625
- size = 16;
1626
- iconData = null;
1627
- visible = false;
1628
- async loadIconData() {
1629
- const { name, visible } = this;
1630
- if (!name || !visible) {
1631
- return;
1632
- }
1633
- this.iconData = await fetchIcon({ name });
1634
- }
1635
- intersectionObserver;
1636
- connectedCallback() {
1637
- this.waitUntilVisible(() => {
1638
- this.visible = true;
1639
- this.loadIconData();
1640
- });
1641
- }
1642
- disconnectedCallback() {
1643
- if (this.intersectionObserver) {
1644
- this.intersectionObserver.disconnect();
1645
- this.intersectionObserver = null;
1646
- }
1647
- }
1648
- async componentWillLoad() {
1649
- this.loadIconData();
1650
- }
1651
- waitUntilVisible(callback) {
1652
- if (typeof window === 'undefined' ||
1653
- !window.IntersectionObserver) {
1654
- callback();
1655
- return;
1656
- }
1657
- this.intersectionObserver = new IntersectionObserver(entries => {
1658
- entries.forEach(entry => {
1659
- if (entry.isIntersecting) {
1660
- this.intersectionObserver.disconnect();
1661
- this.intersectionObserver = null;
1662
- callback();
1663
- }
1664
- });
1665
- }, { rootMargin: '50px' });
1666
- this.intersectionObserver.observe(this.el);
1667
- }
1668
- /**
1669
- * Renders the SVG content out of a JSON data in a format:
1670
- * { "viewBox": "...", children: [{ "tag": "g", ""children": [ ... ], ...attrs }, ...] }
1671
- *
1672
- * @returns JSX.Element | null
1673
- */
1674
- renderSVGContent(children) {
1675
- if (!children || children.length === 0) {
1676
- return null;
1677
- }
1678
- const createElement = node => {
1679
- const { tag, children, ...attrs } = node;
1680
- return h(tag, attrs, children ? children.map(createElement) : null);
1681
- };
1682
- const svgElements = children.map(createElement);
1683
- return svgElements;
1684
- }
1685
- render() {
1686
- return (h("svg", { key: '679c2641c722c5321ffc90a372d3f5fa5d748946', xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", height: this.size || 16, width: this.size || 16, viewBox: this.iconData?.viewBox || `0 0 ${this.size || 16} ${this.size || 16}` }, this.renderSVGContent(this.iconData?.children)));
1687
- }
1688
- static get assetsDirs() { return ["assets/icons"]; }
1689
- static get watchers() { return {
1690
- "name": ["loadIconData"]
1691
- }; }
1692
- };
1693
- LeIcon.style = leIconCss();
1694
-
1695
- const leNavigationCss = () => `:host{display:block;--le-nav-radius:var(--le-radius-md);--le-nav-gap:var(--le-spacing-2);--le-nav-item-padding-x:var(--le-spacing-1);--le-nav-item-padding-y:var(--le-spacing-2);--le-nav-item-gap:var(--le-spacing-2);--le-nav-link-padding-x:var(--le-spacing-2);--le-nav-link-padding-y:var(--le-spacing-1);--le-nav-link-gap:var(--le-spacing-1);--le-nav-color:var(--le-color-text-primary);--le-nav-muted:var(--le-color-text-secondary);--le-nav-hover-bg:var(--le-color-gray-100);--le-nav-selected-bg:var(--le-color-primary);--le-nav-selected-color:var(--le-color-primary-contrast)}:host([orientation='horizontal']:not([wrap])){flex:1 1 0%;min-width:0}.nav-vertical{display:flex;flex-direction:column;gap:var(--le-nav-gap)}.nav-search{width:100%}.nav-search-input{--le-input-radius:var(--le-radius-md)}.nav-empty{padding:var(--le-spacing-2);color:var(--le-nav-muted);font-size:var(--le-font-size-sm)}.nav-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:var(--le-spacing-1)}.nav-row{display:flex;align-items:stretch;gap:var(--le-spacing-1);border-radius:var(--le-nav-radius)}.nav-row:hover{background:var(--le-nav-hover-bg)}.nav-toggle,.nav-toggle-spacer{box-sizing:border-box;width:var(--le-spacing-4);min-width:var(--le-spacing-4);display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;border-radius:var(--le-nav-radius);color:inherit}.nav-toggle{background:transparent;cursor:pointer;opacity:0.4}.nav-toggle:hover:not(:disabled){opacity:1}.nav-toggle:focus-visible{outline:2px solid var(--le-color-focus);outline-offset:2px;opacity:1}.nav-chevron{display:inline-block;transition:transform var(--le-transition-fast)}.nav-chevron svg{display:block;width:var(--le-spacing-4);height:var(--le-spacing-4)}.nav-node>div>button>.nav-chevron{transform:rotate(-90deg)}.nav-node.open>div>button>.nav-chevron{transform:rotate(0deg)}.nav-item{flex:1;display:inline-flex;align-items:center;gap:var(--le-nav-item-gap);padding:var(--le-nav-item-padding-y) var(--le-nav-item-padding-x) var(--le-nav-item-padding-y) 0;border-radius:var(--le-nav-radius);border:1px solid transparent;background:transparent;text-decoration:none;color:var(--le-nav-color);font-family:var(--le-font-family-base);font-size:var(--le-font-size-md);line-height:var(--le-line-height-tight);cursor:pointer}.nav-item:focus-visible{outline:2px solid var(--le-color-focus);outline-offset:2px}.nav-node.selected>.nav-row{background:var(--le-nav-selected-bg);color:var(--le-nav-selected-color)}.nav-node.selected>.nav-row>.nav-item{color:inherit}.nav-node.disabled>.nav-row>.nav-item{opacity:0.5;cursor:not-allowed}.nav-text{display:flex;flex-direction:column;min-width:0}.nav-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.nav-description{color:color-mix(in srgb, var(--le-nav-muted) 90%, transparent);font-size:var(--le-font-size-sm);line-height:var(--le-line-height-tight)}.nav-icon{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}.nav-icon-end{margin-left:auto}.nav-children{margin-top:var(--le-spacing-1)}.nav-horizontal-wrapper{display:flex;align-items:center;gap:var(--le-nav-gap)}.nav-bar{flex:1 1 0%;min-width:0;--le-bar-gap:var(--le-nav-gap)}.nav-bar.align-end{--le-bar-justify:flex-end}.nav-bar.align-center{--le-bar-justify:center}.nav-bar.align-space-between{--le-bar-justify:space-between}.nav-bar.overflow-more.has-overflow,.nav-bar.overflow-hamburger.has-overflow{margin-inline-end:calc((var(--le-nav-gap) + (var(--le-nav-link-padding-x) * 2)) * -1)}.h-item{display:flex;align-items:center}.h-link{display:inline-flex;align-items:center;gap:var(--le-nav-link-gap);padding:var(--le-nav-link-padding-y) var(--le-nav-link-padding-x);border-radius:var(--le-nav-radius);border:1px solid transparent;background:transparent;text-decoration:none;color:var(--le-nav-color);font-family:var(--le-font-family-base);font-size:var(--le-font-size-md);cursor:pointer}.h-link:hover{background:var(--le-nav-hover-bg)}.h-link:focus-visible{outline:2px solid var(--le-color-focus);outline-offset:2px}.h-link.disabled,.h-trigger.disabled{opacity:0.5;pointer-events:none}.h-link.selected,.h-trigger.selected{background:var(--le-nav-selected-bg);color:var(--le-nav-selected-color)}.h-label{white-space:nowrap}.h-trigger{display:inline-flex;align-items:center;gap:var(--le-spacing-1);border-radius:var(--le-nav-radius)}.h-submenu-toggle{width:var(--le-spacing-3);height:var(--le-spacing-3);display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;border-radius:var(--le-nav-radius);background:transparent;color:currentColor;cursor:pointer}.h-submenu-toggle:hover{background:var(--le-nav-hover-bg)}.overflow-trigger{display:inline-flex;align-items:center;justify-content:center;gap:var(--le-nav-link-gap);padding:var(--le-nav-link-padding-y) var(--le-nav-link-padding-x);border-radius:var(--le-nav-radius);border:1px solid transparent;background:transparent;color:var(--le-nav-color);cursor:pointer;font-family:var(--le-font-family-base);font-size:var(--le-font-size-md)}.overflow-trigger:hover{background:var(--le-nav-hover-bg)}.overflow-trigger:focus-visible{outline:2px solid var(--le-color-focus);outline-offset:2px}.nav-overflow-trigger{display:flex;align-items:center}le-popover::part(content){padding:var(--le-spacing-1)}`;
1696
-
1697
- const LeNavigation = class {
1698
- constructor(hostRef) {
1699
- registerInstance(this, hostRef);
1700
- this.leNavItemSelect = createEvent(this, "leNavItemSelect");
1701
- this.leNavItemToggle = createEvent(this, "leNavItemToggle");
1702
- }
1703
- get el() { return getElement(this); }
1704
- /**
1705
- * Navigation items.
1706
- * Can be passed as an array or JSON string (same pattern as le-select).
1707
- */
1708
- items = [];
1709
- /**
1710
- * Layout orientation.
1711
- */
1712
- orientation = 'horizontal';
1713
- /**
1714
- * Horizontal wrapping behavior.
1715
- * If false, overflow behavior depends on `overflowMode`.
1716
- */
1717
- wrap = false;
1718
- /**
1719
- * Overflow behavior for horizontal, non-wrapping menus.
1720
- * - more: moves overflow items into a "More" popover
1721
- * - hamburger: turns the whole nav into a hamburger popover
1722
- */
1723
- overflowMode = 'more';
1724
- /**
1725
- * Minimum number of visible top-level items required to use the "More" overflow.
1726
- * If fewer would be visible, the navigation falls back to hamburger.
1727
- */
1728
- minVisibleItemsForMore = 2;
1729
- /**
1730
- * Alignment of the menu items within the navigation bar.
1731
- */
1732
- align = 'start';
1733
- /**
1734
- * Active url for automatic selection.
1735
- */
1736
- activeUrl = '';
1737
- /**
1738
- * Enables a search input for the vertical navigation.
1739
- */
1740
- searchable = false;
1741
- /**
1742
- * Placeholder text for the search input.
1743
- */
1744
- searchPlaceholder = 'Search...';
1745
- /**
1746
- * Text shown when no items match the filter.
1747
- */
1748
- emptyText = 'No results found';
1749
- /**
1750
- * Whether submenu popovers should include a filter input.
1751
- */
1752
- submenuSearchable = false;
1753
- /**
1754
- * Fired when a navigation item is activated.
1755
- *
1756
- * This event is cancelable. Call `event.preventDefault()` to prevent
1757
- * default browser navigation and implement custom routing.
1758
- */
1759
- leNavItemSelect;
1760
- /**
1761
- * Fired when a tree branch is toggled.
1762
- */
1763
- leNavItemToggle;
1764
- searchQuery = '';
1765
- openState = {};
1766
- /** IDs of items currently in overflow (from le-bar) */
1767
- overflowIds = [];
1768
- /** Whether hamburger mode is active (from le-bar) */
1769
- hamburgerActive = false;
1770
- submenuQueries = {};
1771
- /** Whether the overflow popover is open */
1772
- overflowPopoverOpen = false;
1773
- popoverRefs = new Map();
1774
- instanceId = generateId('le-nav');
1775
- partFromOptionPart(base, part) {
1776
- const raw = (part ?? '').trim();
1777
- if (!raw)
1778
- return base;
1779
- const tokens = raw
1780
- .split(/\s+/)
1781
- .map(t => t.replace(/[^a-zA-Z0-9_-]/g, ''))
1782
- .filter(Boolean);
1783
- if (tokens.length === 0)
1784
- return base;
1785
- return [base, ...tokens.map(t => `${base}-${t}`)].join(' ');
1786
- }
1787
- handleLayoutInputsChange() {
1788
- // Reset overflow state when layout inputs change
1789
- this.overflowIds = [];
1790
- this.hamburgerActive = false;
1791
- }
1792
- disconnectedCallback() {
1793
- // Cleanup if needed
1794
- }
1795
- get parsedItems() {
1796
- if (typeof this.items === 'string') {
1797
- try {
1798
- return JSON.parse(this.items);
1799
- }
1800
- catch {
1801
- return [];
1802
- }
1803
- }
1804
- return this.items;
1805
- }
1806
- getItemId(item, path) {
1807
- return item.id ?? `${this.instanceId}:${path}`;
1808
- }
1809
- getChildItems(item) {
1810
- return Array.isArray(item.children) ? item.children : [];
1811
- }
1812
- isOpen(item, id) {
1813
- const fromState = this.openState[id];
1814
- if (typeof fromState === 'boolean')
1815
- return fromState;
1816
- return !!item.open;
1817
- }
1818
- setOpen(id, open) {
1819
- if (this.openState[id] === open)
1820
- return;
1821
- this.openState = {
1822
- ...this.openState,
1823
- [id]: open,
1824
- };
1825
- }
1826
- matchesQuery(option, query) {
1827
- if (!query)
1828
- return true;
1829
- const q = query.toLowerCase();
1830
- return (option.label.toLowerCase().includes(q) ||
1831
- (option.description?.toLowerCase().includes(q) ?? false));
1832
- }
1833
- filterTree(items, query, pathPrefix, autoOpen) {
1834
- if (!query)
1835
- return items;
1836
- const result = [];
1837
- items.forEach((item, index) => {
1838
- const path = pathPrefix ? `${pathPrefix}.${index}` : String(index);
1839
- const id = this.getItemId(item, path);
1840
- const children = this.getChildItems(item);
1841
- const filteredChildren = this.filterTree(children, query, path, autoOpen);
1842
- const selfMatch = this.matchesQuery(item, query);
1843
- const childMatch = filteredChildren.length > 0;
1844
- if (selfMatch || childMatch) {
1845
- if (childMatch) {
1846
- autoOpen.add(id);
1847
- }
1848
- if (childMatch && filteredChildren !== children) {
1849
- result.push({
1850
- ...item,
1851
- children: filteredChildren,
1852
- });
1853
- }
1854
- else {
1855
- result.push(item);
1856
- }
1857
- }
1858
- });
1859
- return result;
1860
- }
1861
- handleItemSelect = (e, item, id) => {
1862
- if (item.disabled) {
1863
- e.preventDefault();
1864
- e.stopPropagation();
1865
- return;
1866
- }
1867
- const emitted = this.leNavItemSelect.emit({
1868
- item,
1869
- id,
1870
- href: item.href,
1871
- originalEvent: e,
1872
- });
1873
- if (emitted.defaultPrevented) {
1874
- e.preventDefault();
1875
- }
1876
- };
1877
- handleToggle = (e, item, id) => {
1878
- e.preventDefault();
1879
- e.stopPropagation();
1880
- if (item.disabled)
1881
- return;
1882
- const next = !this.isOpen(item, id);
1883
- this.setOpen(id, next);
1884
- this.leNavItemToggle.emit({
1885
- item,
1886
- id,
1887
- open: next,
1888
- originalEvent: e,
1889
- });
1890
- };
1891
- handleSearchInput = (e) => {
1892
- const target = e.target;
1893
- this.searchQuery = target.value;
1894
- };
1895
- handleSubmenuSearchInput = (submenuId, e) => {
1896
- const target = e.target;
1897
- const value = target.value;
1898
- if (this.submenuQueries[submenuId] === value)
1899
- return;
1900
- this.submenuQueries = {
1901
- ...this.submenuQueries,
1902
- [submenuId]: value,
1903
- };
1904
- // Position may change as items filter.
1905
- requestAnimationFrame(() => this.popoverRefs.get(submenuId)?.updatePosition());
1906
- };
1907
- handleBarOverflowChange = (e) => {
1908
- this.overflowIds = e.detail.overflowingIds || [];
1909
- this.hamburgerActive = e.detail.hamburgerActive || false;
1910
- };
1911
- openOverflowPopover = () => {
1912
- this.overflowPopoverOpen = true;
1913
- };
1914
- closeOverflowPopover = () => {
1915
- this.overflowPopoverOpen = false;
1916
- };
1917
- renderVerticalList(items, { depth, pathPrefix, autoOpenIds, searchable, searchQuery, searchPlaceholder, emptyText, submenuId, closePopover, }) {
1918
- const query = searchQuery ?? '';
1919
- const openFromSearch = autoOpenIds ?? new Set();
1920
- const filtered = query ? this.filterTree(items, query, pathPrefix, openFromSearch) : items;
1921
- return (h("div", { class: classnames('nav-vertical', { 'is-submenu': !!submenuId }) }, searchable && (h("div", { class: "nav-search" }, h("le-string-input", { mode: "default", class: "nav-search-input", placeholder: searchPlaceholder ?? 'Search...', value: query, onInput: (e) => submenuId ? this.handleSubmenuSearchInput(submenuId, e) : this.handleSearchInput(e) }))), filtered.length === 0 ? (h("div", { class: "nav-empty" }, emptyText ?? this.emptyText)) : (h("ul", { class: "nav-list", role: "tree" }, filtered.map((item, index) => {
1922
- const path = pathPrefix ? `${pathPrefix}.${index}` : String(index);
1923
- const id = this.getItemId(item, path);
1924
- const children = this.getChildItems(item);
1925
- const hasChildren = children.length > 0;
1926
- const open = hasChildren && (this.isOpen(item, id) || openFromSearch.has(id));
1927
- const paddingLeft = `calc(var(--le-nav-item-padding-x) + ${depth} * var(--le-spacing-4))`;
1928
- const TagType = item.href && !item.disabled ? 'a' : 'button';
1929
- const attrs = TagType === 'a'
1930
- ? { href: item.href, role: 'treeitem' }
1931
- : { type: 'button', role: 'treeitem' };
1932
- const itemPart = this.partFromOptionPart('item', item.part);
1933
- return (h("li", { class: classnames('nav-node', {
1934
- 'disabled': item.disabled,
1935
- 'selected': item.selected || (this.activeUrl && item.href === this.activeUrl),
1936
- open,
1937
- 'has-children': hasChildren,
1938
- }), key: id, role: "none" }, h("div", { class: "nav-row", style: { paddingLeft } }, hasChildren ? (h("button", { type: "button", class: "nav-toggle", "aria-label": open ? 'Collapse' : 'Expand', "aria-expanded": open ? 'true' : 'false', onClick: (e) => this.handleToggle(e, item, id), disabled: item.disabled }, h("le-icon", { name: "chevron-down", class: "nav-chevron", "aria-hidden": "true" }))) : (h("span", { class: "nav-toggle-spacer", "aria-hidden": "true" })), h(TagType, { class: "nav-item", part: itemPart, ...attrs, "aria-disabled": item.disabled ? 'true' : undefined, onClick: (e) => {
1939
- // For buttons, also toggle if this is a purely structural node.
1940
- this.handleItemSelect(e, item, id);
1941
- if (!item.href && hasChildren && !item.disabled) {
1942
- this.handleToggle(e, item, id);
1943
- return;
1944
- }
1945
- if (!item.disabled && closePopover) {
1946
- closePopover();
1947
- }
1948
- } }, item.iconStart && (h("span", { class: "nav-icon", "aria-hidden": "true" }, item.iconStart)), h("span", { class: "nav-text" }, h("span", { class: "nav-label" }, item.label), item.description && (h("span", { class: "nav-description" }, item.description))), item.iconEnd && (h("span", { class: "nav-icon nav-icon-end", "aria-hidden": "true" }, item.iconEnd)))), hasChildren && (h("le-collapse", { class: "nav-children", closed: !open, noFading: true, role: "group" }, this.renderVerticalList(children, {
1949
- depth: depth + 1,
1950
- pathPrefix: path,
1951
- autoOpenIds: openFromSearch,
1952
- submenuId,
1953
- closePopover,
1954
- })))));
1955
- })))));
1956
- }
1957
- renderHorizontalItem(item, index) {
1958
- const id = this.getItemId(item, String(index));
1959
- const children = this.getChildItems(item);
1960
- const hasChildren = children.length > 0;
1961
- if (!hasChildren) {
1962
- const TagType = item.href && !item.disabled ? 'a' : 'button';
1963
- const attrs = TagType === 'a'
1964
- ? { href: item.href, role: 'menuitem' }
1965
- : { type: 'button', role: 'menuitem' };
1966
- const itemPart = this.partFromOptionPart('item', item.part);
1967
- return (h("div", { class: "h-item", "data-bar-id": id }, h(TagType, { class: classnames('h-link', {
1968
- disabled: item.disabled,
1969
- selected: item.selected || (this.activeUrl && item.href === this.activeUrl),
1970
- }), part: itemPart, ...attrs, "aria-disabled": item.disabled ? 'true' : undefined, onClick: (e) => this.handleItemSelect(e, item, id) }, item.iconStart && (h("span", { class: "nav-icon", "aria-hidden": "true" }, item.iconStart)), h("span", { class: "h-label" }, item.label), item.iconEnd && (h("span", { class: "nav-icon nav-icon-end", "aria-hidden": "true" }, item.iconEnd)))));
1971
- }
1972
- const submenuId = id;
1973
- const itemPart = this.partFromOptionPart('item', item.part);
1974
- return (h("div", { class: "h-item", "data-bar-id": id }, h("le-popover", { ref: el => {
1975
- if (el)
1976
- this.popoverRefs.set(submenuId, el);
1977
- }, mode: "default", offset: 8, showClose: false, closeOnClickOutside: true, closeOnEscape: true, position: "bottom", align: "start", minWidth: "240px" }, h("div", { slot: "trigger", class: classnames('h-trigger', {
1978
- disabled: item.disabled,
1979
- selected: item.selected || (this.activeUrl && item.href === this.activeUrl),
1980
- }), part: itemPart, role: "menuitem", "aria-disabled": item.disabled ? 'true' : undefined, onClick: (e) => {
1981
- // Don’t let le-popover auto-toggle from its internal wrapper.
1982
- e.stopPropagation();
1983
- if (item.disabled)
1984
- return;
1985
- if (item.href) {
1986
- this.handleItemSelect(e, item, id);
1987
- this.popoverRefs.get(submenuId)?.hide();
1988
- }
1989
- else {
1990
- this.popoverRefs.get(submenuId)?.toggle();
1991
- }
1992
- } }, item.href ? (h("a", { class: "h-link", href: item.href, onClick: (e) => {
1993
- e.stopPropagation();
1994
- this.handleItemSelect(e, item, id);
1995
- } }, item.iconStart && (h("span", { class: "nav-icon", "aria-hidden": "true" }, item.iconStart)), h("span", { class: "h-label" }, item.label), h("span", { class: "nav-chevron", "aria-hidden": "true" }, h("le-icon", { name: "chevron-down" })))) : (h("button", { type: "button", class: "h-link", onClick: (e) => {
1996
- e.stopPropagation();
1997
- if (item.disabled)
1998
- return;
1999
- this.popoverRefs.get(submenuId)?.toggle();
2000
- } }, item.iconStart && (h("span", { class: "nav-icon", "aria-hidden": "true" }, item.iconStart)), h("span", { class: "h-label" }, item.label), h("span", { class: "nav-chevron", "aria-hidden": "true" }, h("le-icon", { name: "chevron-down" }))))), h("div", { class: "popover-menu" }, this.renderVerticalList(children, {
2001
- depth: 0,
2002
- pathPrefix: String(index),
2003
- searchable: this.submenuSearchable,
2004
- searchQuery: this.submenuQueries[submenuId] ?? '',
2005
- searchPlaceholder: this.searchPlaceholder,
2006
- emptyText: this.emptyText,
2007
- submenuId,
2008
- closePopover: () => this.popoverRefs.get(submenuId)?.hide(),
2009
- })))));
2010
- }
2011
- getOverflowMode() {
2012
- if (this.wrap)
2013
- return 'wrap';
2014
- return this.overflowMode;
2015
- }
2016
- getBarAlignment() {
2017
- // Map le-navigation align to le-bar alignItems
2018
- // 'space-between' doesn't map directly, use 'stretch' as closest
2019
- if (this.align === 'space-between')
2020
- return 'stretch';
2021
- return this.align;
2022
- }
2023
- renderOverflowPopover() {
2024
- const items = this.parsedItems;
2025
- const overflowSet = new Set(this.overflowIds || []);
2026
- // Determine which items to show in the popover
2027
- let itemsToShow;
2028
- if (this.hamburgerActive) {
2029
- // In hamburger mode, show all items
2030
- itemsToShow = items;
2031
- }
2032
- else {
2033
- // In "more" mode, show only overflow items
2034
- itemsToShow = items.filter((item, index) => {
2035
- const id = this.getItemId(item, String(index));
2036
- return overflowSet.has(id);
2037
- });
2038
- }
2039
- if (itemsToShow.length === 0)
2040
- return null;
2041
- const isHamburger = this.hamburgerActive;
2042
- return (h("le-popover", { mode: "default", offset: 8, open: this.overflowPopoverOpen, showClose: false, closeOnClickOutside: true, closeOnEscape: true, position: "bottom", align: "end", minWidth: "260px", onLePopoverClose: this.closeOverflowPopover }, h("button", { slot: "trigger", type: "button", class: "overflow-trigger", part: isHamburger ? 'hamburger-trigger' : 'more-trigger', "aria-label": isHamburger ? 'Open menu' : 'More', onClick: this.openOverflowPopover }, h("slot", { name: isHamburger ? 'hamburger-trigger' : 'more-trigger' }, h("le-icon", { name: isHamburger ? 'hamburger' : 'ellipsis-horizontal' }))), h("div", { class: "popover-menu" }, this.renderVerticalList(itemsToShow, {
2043
- depth: 0,
2044
- pathPrefix: '',
2045
- closePopover: this.closeOverflowPopover,
2046
- }))));
2047
- }
2048
- renderHorizontal() {
2049
- const items = this.parsedItems;
2050
- const overflowMode = this.getOverflowMode();
2051
- const showOverflowButton = (this.overflowIds?.length ?? 0) > 0 || this.hamburgerActive;
2052
- return (h("div", { class: "nav-horizontal-wrapper" }, h("le-bar", { class: classnames('nav-bar', {
2053
- 'align-end': this.align === 'end',
2054
- 'align-center': this.align === 'center',
2055
- 'align-space-between': this.align === 'space-between',
2056
- }), overflow: overflowMode, alignItems: this.getBarAlignment(), disablePopover: true, minVisibleItems: this.minVisibleItemsForMore, onLeBarOverflowChange: this.handleBarOverflowChange }, items.map((item, index) => this.renderHorizontalItem(item, index))), showOverflowButton && this.renderOverflowPopover()));
2057
- }
2058
- render() {
2059
- const items = this.parsedItems;
2060
- if (this.orientation === 'horizontal') {
2061
- return (h(Host, null, h("le-component", { component: "le-navigation" }, this.renderHorizontal())));
2062
- }
2063
- return (h(Host, null, h("le-component", { component: "le-navigation" }, this.renderVerticalList(items, {
2064
- depth: 0,
2065
- pathPrefix: '',
2066
- searchable: this.searchable,
2067
- searchQuery: this.searchQuery,
2068
- searchPlaceholder: this.searchPlaceholder,
2069
- emptyText: this.emptyText,
2070
- }))));
2071
- }
2072
- static get watchers() { return {
2073
- "items": ["handleLayoutInputsChange"],
2074
- "orientation": ["handleLayoutInputsChange"],
2075
- "wrap": ["handleLayoutInputsChange"],
2076
- "overflowMode": ["handleLayoutInputsChange"]
2077
- }; }
2078
- };
2079
- LeNavigation.style = leNavigationCss();
2080
-
2081
- const lePopoverCss = () => `/* ============================================
2082
- le-popover.css
2083
- Popover using native HTML Popover API
2084
- ============================================ */
2085
-
2086
- :host {
2087
- display: inline-block;
2088
- position: relative;
2089
- }
2090
-
2091
- :host([trigger-full-width]) {
2092
- display: block;
2093
- width: 100%;
2094
- }
2095
-
2096
- /* ============================================
2097
- Trigger
2098
- ============================================ */
2099
-
2100
- .le-popover-trigger {
2101
- display: inline-flex;
2102
- cursor: pointer;
2103
- }
2104
-
2105
- .le-popover-trigger-full-width {
2106
- display: flex;
2107
- width: 100%;
2108
- }
2109
-
2110
- .le-popover-default-trigger {
2111
- display: flex;
2112
- align-items: center;
2113
- justify-content: center;
2114
- width: 28px;
2115
- height: 28px;
2116
- padding: 0;
2117
- border: 1px solid var(--le-color-border, #e0e0e0);
2118
- border-radius: var(--le-radius-md, 6px);
2119
- background: var(--le-color-surface, #fff);
2120
- color: var(--le-color-text-secondary, #666);
2121
- font-size: 16px;
2122
- cursor: pointer;
2123
- transition: all var(--le-transition-fast, 0.15s ease);
2124
- }
2125
-
2126
- .le-popover-default-trigger:hover {
2127
- border-color: var(--le-color-primary, #2196f3);
2128
- color: var(--le-color-primary, #2196f3);
2129
- background: var(--le-color-primary-light, rgba(33, 150, 243, 0.1));
2130
- }
2131
-
2132
- /* ============================================
2133
- Popover Content (native popover)
2134
- ============================================ */
2135
-
2136
- .le-popover-content {
2137
- /* Reset native popover defaults */
2138
- margin: 0;
2139
- padding: 0;
2140
- border: none;
2141
- background: transparent;
2142
-
2143
- /* Positioning - will be set via JS */
2144
- position: fixed;
2145
- inset: unset;
2146
-
2147
- /* Styling */
2148
- background: var(--le-color-surface, #ffffff);
2149
- border: 1px solid var(--le-color-border, #e0e0e0);
2150
- border-radius: var(--le-radius-lg, 8px);
2151
- box-shadow: var(--le-shadow-lg, 0 4px 12px rgba(0, 0, 0, 0.15));
2152
- overflow: hidden;
2153
- font-family: var(--le-font-family, system-ui, -apple-system, sans-serif);
2154
- font-size: var(--le-font-size-sm, 0.875rem);
2155
- color: var(--le-color-text, #333);
2156
-
2157
- /* Animation */
2158
- opacity: 0;
2159
- transform: scale(0.95);
2160
- transition: opacity 0.15s ease, transform 0.15s ease, display 0.15s ease allow-discrete;
2161
- }
2162
-
2163
- /* When popover is open */
2164
- .le-popover-content:popover-open {
2165
- opacity: 1;
2166
- transform: scale(1);
2167
- }
2168
-
2169
- /* Fallback for browsers without the Popover API */
2170
- .le-popover-content[data-fallback-open="false"] {
2171
- display: none;
2172
- }
2173
-
2174
- .le-popover-content[data-fallback-open="true"] {
2175
- opacity: 1;
2176
- transform: scale(1);
2177
- }
2178
-
2179
- /* Starting style for animation (CSS Anchor Positioning spec) */
2180
- @starting-style {
2181
- .le-popover-content:popover-open {
2182
- opacity: 0;
2183
- transform: scale(0.95);
2184
- }
2185
- }
2186
-
2187
- /* ============================================
2188
- Header
2189
- ============================================ */
2190
-
2191
- .le-popover-header {
2192
- display: flex;
2193
- align-items: center;
2194
- justify-content: space-between;
2195
- padding: var(--le-space-xs, 4px) var(--le-space-xs, 4px) var(--le-space-xs, 4px) var(--le-space-sm, 8px);
2196
- border-bottom: 1px solid var(--le-color-border, #e0e0e0);
2197
- background: var(--le-color-surface-alt, #f9f9f9);
2198
- min-height: 32px;
2199
- }
2200
-
2201
- .le-popover-title {
2202
- font-weight: var(--le-font-weight-semibold, 600);
2203
- font-size: var(--le-font-size-sm, 0.875rem);
2204
- color: var(--le-color-text, #333);
2205
- }
2206
-
2207
- .le-popover-close {
2208
- display: flex;
2209
- align-items: center;
2210
- justify-content: center;
2211
- width: 24px;
2212
- height: 24px;
2213
- padding: 0;
2214
- border: none;
2215
- background: transparent;
2216
- color: var(--le-color-text-secondary, #666);
2217
- font-size: 18px;
2218
- line-height: 1;
2219
- cursor: pointer;
2220
- border-radius: var(--le-radius-sm, 4px);
2221
- transition: background-color 0.15s, color 0.15s;
2222
- }
2223
-
2224
- .le-popover-close:hover {
2225
- background: var(--le-color-surface-hover, rgba(0, 0, 0, 0.05));
2226
- color: var(--le-color-text, #333);
2227
- }
2228
-
2229
- /* ============================================
2230
- Body
2231
- ============================================ */
2232
-
2233
- .le-popover-body {
2234
- padding: var(--le-space-md, 12px);
2235
- }
2236
-
2237
- /* ============================================
2238
- Scrollable content
2239
- ============================================ */
2240
-
2241
- .le-popover-content[style*="overflow-y: auto"] .le-popover-body {
2242
- overflow-y: auto;
2243
- }
2244
- `;
2245
-
2246
- // Keep a simple stack so Escape closes the most recently opened popover first.
2247
- // This also helps nested popovers behave naturally.
2248
- const openPopoverStack = [];
2249
- const LePopover = class {
2250
- constructor(hostRef) {
2251
- registerInstance(this, hostRef);
2252
- this.lePopoverOpen = createEvent(this, "lePopoverOpen");
2253
- this.lePopoverClose = createEvent(this, "lePopoverClose");
2254
- }
2255
- get el() { return getElement(this); }
2256
- /**
2257
- * Mode of the popover should be 'default' for internal use
2258
- */
2259
- mode;
2260
- /**
2261
- * Whether the popover is currently open
2262
- */
2263
- open = false;
2264
- /**
2265
- * Position of the popover relative to its trigger
2266
- */
2267
- position = 'bottom';
2268
- /**
2269
- * Alignment of the popover
2270
- */
2271
- align = 'start';
2272
- /**
2273
- * Optional title for the popover header
2274
- */
2275
- popoverTitle;
2276
- /**
2277
- * Whether to show a close button in the header
2278
- */
2279
- showClose = true;
2280
- /**
2281
- * Whether clicking outside closes the popover
2282
- */
2283
- closeOnClickOutside = true;
2284
- /**
2285
- * Whether pressing Escape closes the popover
2286
- */
2287
- closeOnEscape = true;
2288
- /**
2289
- * Offset from the trigger element (in pixels)
2290
- */
2291
- offset = 8;
2292
- /**
2293
- * Fixed width for the popover (e.g., '300px', '20rem')
2294
- */
2295
- width;
2296
- /**
2297
- * Minimum width for the popover (e.g., '200px', '15rem')
2298
- */
2299
- minWidth = '200px';
2300
- /**
2301
- * Maximum width for the popover (e.g., '400px', '25rem')
2302
- */
2303
- maxWidth;
2304
- /**
2305
- * Should the popover's trigger take full width of its container
2306
- */
2307
- triggerFullWidth = false;
2308
- /**
2309
- * Emitted when the popover opens
2310
- */
2311
- lePopoverOpen;
2312
- /**
2313
- * Emitted when the popover closes
2314
- */
2315
- lePopoverClose;
2316
- /**
2317
- * Method to update the popover position from a parent component
2318
- */
2319
- async updatePosition() {
2320
- this._updatePosition();
2321
- }
2322
- isPositioned = false;
2323
- triggerEl;
2324
- popoverEl;
2325
- uniqueId = `le-popover-${Math.random().toString(36).substr(2, 9)}`;
2326
- scrollParents = [];
2327
- isListeningForDismiss = false;
2328
- get supportsPopoverApi() {
2329
- return typeof HTMLElement.prototype.showPopover === 'function';
2330
- }
2331
- shadowContains(container, node) {
2332
- let current = node;
2333
- while (current) {
2334
- if (current === container)
2335
- return true;
2336
- if (current instanceof ShadowRoot) {
2337
- current = current.host;
2338
- continue;
2339
- }
2340
- if (current.parentNode) {
2341
- current = current.parentNode;
2342
- continue;
2343
- }
2344
- const root = current.getRootNode?.();
2345
- if (root instanceof ShadowRoot) {
2346
- current = root.host;
2347
- continue;
2348
- }
2349
- break;
2350
- }
2351
- return false;
2352
- }
2353
- componentDidLoad() {
2354
- // Listen for toggle events from the native popover API
2355
- this.popoverEl?.addEventListener('toggle', this.handlePopoverToggle);
2356
- // Listen for other popovers opening to close this one
2357
- document.addEventListener('le-popover-will-open', this.handleOtherPopoverOpen);
2358
- // If the popover is initially open (unlikely, but possible), wire listeners.
2359
- if (this.open) {
2360
- this.addDismissListeners();
2361
- }
2362
- }
2363
- disconnectedCallback() {
2364
- this.popoverEl?.removeEventListener('toggle', this.handlePopoverToggle);
2365
- document.removeEventListener('le-popover-will-open', this.handleOtherPopoverOpen);
2366
- this.removeScrollListeners();
2367
- this.removeDismissListeners();
2368
- }
2369
- addDismissListeners() {
2370
- if (this.isListeningForDismiss)
2371
- return;
2372
- // Use capture so clicks inside the trigger (which stops propagation) are still observed.
2373
- document.addEventListener('pointerdown', this.handleDocumentPointerDown, true);
2374
- document.addEventListener('keydown', this.handleDocumentKeyDown, true);
2375
- this.isListeningForDismiss = true;
2376
- }
2377
- removeDismissListeners() {
2378
- if (!this.isListeningForDismiss)
2379
- return;
2380
- document.removeEventListener('pointerdown', this.handleDocumentPointerDown, true);
2381
- document.removeEventListener('keydown', this.handleDocumentKeyDown, true);
2382
- this.isListeningForDismiss = false;
2383
- }
2384
- handleDocumentPointerDown = (event) => {
2385
- if (!this.open || !this.closeOnClickOutside)
2386
- return;
2387
- // If the click happens inside this popover component (trigger OR content), don't close.
2388
- const path = (event.composedPath?.() ?? []);
2389
- if (path.includes(this.el))
2390
- return;
2391
- this.hide();
2392
- };
2393
- handleDocumentKeyDown = (event) => {
2394
- if (!this.open || !this.closeOnEscape)
2395
- return;
2396
- if (event.key !== 'Escape')
2397
- return;
2398
- // Only the top-most opened popover handles Escape.
2399
- const top = openPopoverStack[openPopoverStack.length - 1];
2400
- if (top !== this.el)
2401
- return;
2402
- event.preventDefault();
2403
- event.stopPropagation();
2404
- this.hide();
2405
- };
2406
- /**
2407
- * Find all scrollable parent elements
2408
- */
2409
- getScrollParents(element) {
2410
- const scrollParents = [];
2411
- let parent = element.parentElement;
2412
- while (parent) {
2413
- const style = getComputedStyle(parent);
2414
- const overflow = style.overflow + style.overflowY + style.overflowX;
2415
- if (/(auto|scroll)/.test(overflow)) {
2416
- scrollParents.push(parent);
2417
- }
2418
- parent = parent.parentElement;
2419
- }
2420
- // Always include window for page scroll
2421
- return scrollParents;
2422
- }
2423
- /**
2424
- * Add scroll listeners to all scrollable parents
2425
- */
2426
- addScrollListeners() {
2427
- if (!this.triggerEl)
2428
- return;
2429
- this.scrollParents = this.getScrollParents(this.triggerEl);
2430
- // Listen to each scroll parent
2431
- this.scrollParents.forEach(parent => {
2432
- parent.addEventListener('scroll', this.handleScroll, { passive: true });
2433
- });
2434
- // Also listen to window scroll and resize
2435
- window.addEventListener('scroll', this.handleScroll, { passive: true });
2436
- window.addEventListener('resize', this.handleScroll, { passive: true });
2437
- }
2438
- /**
2439
- * Remove scroll listeners
2440
- */
2441
- removeScrollListeners() {
2442
- this.scrollParents.forEach(parent => {
2443
- parent.removeEventListener('scroll', this.handleScroll);
2444
- });
2445
- window.removeEventListener('scroll', this.handleScroll);
2446
- window.removeEventListener('resize', this.handleScroll);
2447
- this.scrollParents = [];
2448
- }
2449
- handleScroll = () => {
2450
- if (this.open) {
2451
- this._updatePosition();
2452
- }
2453
- };
2454
- handleOpened() {
2455
- this.open = true;
2456
- // Track stack order for Escape handling.
2457
- const existingIndex = openPopoverStack.indexOf(this.el);
2458
- if (existingIndex >= 0)
2459
- openPopoverStack.splice(existingIndex, 1);
2460
- openPopoverStack.push(this.el);
2461
- this.addDismissListeners();
2462
- this.addScrollListeners();
2463
- this._updatePosition();
2464
- this.lePopoverOpen.emit();
2465
- }
2466
- handleClosed() {
2467
- this.open = false;
2468
- this.isPositioned = false;
2469
- this.removeScrollListeners();
2470
- this.removeDismissListeners();
2471
- const index = openPopoverStack.indexOf(this.el);
2472
- if (index >= 0)
2473
- openPopoverStack.splice(index, 1);
2474
- this.lePopoverClose.emit();
2475
- }
2476
- handlePopoverToggle = (event) => {
2477
- if (event.newState === 'open') {
2478
- this.handleOpened();
2479
- }
2480
- else {
2481
- this.handleClosed();
2482
- }
2483
- };
2484
- handleOtherPopoverOpen = (event) => {
2485
- const customEvent = event;
2486
- const openingPopover = customEvent.detail?.popover;
2487
- if (!openingPopover)
2488
- return;
2489
- if (openingPopover === this.el)
2490
- return;
2491
- // Allow nested popovers (e.g., le-select inside another popover).
2492
- // Use a shadow-DOM-aware containment check.
2493
- if (this.shadowContains(this.el, openingPopover) ||
2494
- this.shadowContains(openingPopover, this.el)) {
2495
- return;
2496
- }
2497
- if (this.open) {
2498
- this.hide();
2499
- }
2500
- };
2501
- /**
2502
- * Opens the popover
2503
- */
2504
- async show() {
2505
- document.dispatchEvent(new CustomEvent('le-popover-will-open', {
2506
- detail: { popover: this.el },
2507
- }));
2508
- if (this.supportsPopoverApi) {
2509
- this.popoverEl?.showPopover();
2510
- }
2511
- else {
2512
- this.handleOpened();
2513
- }
2514
- }
2515
- /**
2516
- * Closes the popover
2517
- */
2518
- async hide() {
2519
- if (this.supportsPopoverApi) {
2520
- this.popoverEl?.hidePopover();
2521
- }
2522
- else {
2523
- this.handleClosed();
2524
- }
2525
- }
2526
- /**
2527
- * Toggles the popover
2528
- */
2529
- async toggle() {
2530
- if (this.open) {
2531
- await this.hide();
2532
- }
2533
- else {
2534
- await this.show();
2535
- }
2536
- }
2537
- handleTriggerClick = (event) => {
2538
- event.stopPropagation();
2539
- this.toggle();
2540
- };
2541
- _updatePosition() {
2542
- if (!this.triggerEl || !this.popoverEl)
2543
- return;
2544
- const triggerRect = this.triggerEl.getBoundingClientRect();
2545
- const popoverRect = this.popoverEl.getBoundingClientRect();
2546
- const viewportWidth = window.innerWidth;
2547
- const viewportHeight = window.innerHeight;
2548
- const viewportPadding = 8;
2549
- let position = this.position;
2550
- let align = this.align;
2551
- // Auto-position logic
2552
- const spaceBelow = viewportHeight - triggerRect.bottom - viewportPadding;
2553
- const spaceAbove = triggerRect.top - viewportPadding;
2554
- const spaceRight = viewportWidth - triggerRect.right - viewportPadding;
2555
- const spaceLeft = triggerRect.left - viewportPadding;
2556
- if (position === 'auto') {
2557
- if (spaceBelow >= popoverRect.height + this.offset) {
2558
- position = 'bottom';
2559
- }
2560
- else if (spaceAbove >= popoverRect.height + this.offset) {
2561
- position = 'top';
2562
- }
2563
- else if (spaceRight >= popoverRect.width + this.offset) {
2564
- position = 'right';
2565
- }
2566
- else if (spaceLeft >= popoverRect.width + this.offset) {
2567
- position = 'left';
2568
- }
2569
- else {
2570
- const maxSpace = Math.max(spaceBelow, spaceAbove, spaceRight, spaceLeft);
2571
- if (maxSpace === spaceBelow)
2572
- position = 'bottom';
2573
- else if (maxSpace === spaceAbove)
2574
- position = 'top';
2575
- else if (maxSpace === spaceRight)
2576
- position = 'right';
2577
- else
2578
- position = 'left';
2579
- }
2580
- }
2581
- // Adjust alignment for horizontal overflow
2582
- if (position === 'top' || position === 'bottom') {
2583
- if (align === 'start' &&
2584
- triggerRect.left + popoverRect.width > viewportWidth - viewportPadding) {
2585
- align = 'end';
2586
- }
2587
- else if (align === 'end' && triggerRect.right - popoverRect.width < viewportPadding) {
2588
- align = 'start';
2589
- }
2590
- else if (align === 'center') {
2591
- const triggerCenter = triggerRect.left + triggerRect.width / 2;
2592
- if (triggerCenter - popoverRect.width / 2 < viewportPadding) {
2593
- align = 'start';
2594
- }
2595
- else if (triggerCenter + popoverRect.width / 2 > viewportWidth - viewportPadding) {
2596
- align = 'end';
2597
- }
2598
- }
2599
- }
2600
- // Calculate position
2601
- let top = 0;
2602
- let left = 0;
2603
- let maxHeight = null;
2604
- switch (position) {
2605
- case 'top':
2606
- top = triggerRect.top - popoverRect.height - this.offset;
2607
- if (top < viewportPadding) {
2608
- maxHeight = triggerRect.top - this.offset - viewportPadding * 2;
2609
- top = viewportPadding;
2610
- }
2611
- break;
2612
- case 'bottom':
2613
- top = triggerRect.bottom + this.offset;
2614
- if (top + popoverRect.height > viewportHeight - viewportPadding) {
2615
- maxHeight = viewportHeight - top - viewportPadding;
2616
- }
2617
- break;
2618
- case 'left':
2619
- left = triggerRect.left - popoverRect.width - this.offset;
2620
- top = triggerRect.top;
2621
- if (left < viewportPadding)
2622
- left = viewportPadding;
2623
- break;
2624
- case 'right':
2625
- left = triggerRect.right + this.offset;
2626
- top = triggerRect.top;
2627
- if (left + popoverRect.width > viewportWidth - viewportPadding) {
2628
- left = viewportWidth - popoverRect.width - viewportPadding;
2629
- }
2630
- break;
2631
- }
2632
- // Calculate horizontal alignment for top/bottom
2633
- if (position === 'top' || position === 'bottom') {
2634
- switch (align) {
2635
- case 'start':
2636
- left = triggerRect.left;
2637
- break;
2638
- case 'center':
2639
- left = triggerRect.left + triggerRect.width / 2 - popoverRect.width / 2;
2640
- break;
2641
- case 'end':
2642
- left = triggerRect.right - popoverRect.width;
2643
- break;
2644
- }
2645
- // Constrain to viewport
2646
- if (left < viewportPadding) {
2647
- left = viewportPadding;
2648
- }
2649
- else if (left + popoverRect.width > viewportWidth - viewportPadding) {
2650
- left = viewportWidth - popoverRect.width - viewportPadding;
2651
- }
2652
- }
2653
- // Calculate vertical alignment for left/right
2654
- if (position === 'left' || position === 'right') {
2655
- switch (align) {
2656
- case 'start':
2657
- top = triggerRect.top;
2658
- break;
2659
- case 'center':
2660
- top = triggerRect.top + triggerRect.height / 2 - popoverRect.height / 2;
2661
- break;
2662
- case 'end':
2663
- top = triggerRect.bottom - popoverRect.height;
2664
- break;
2665
- }
2666
- if (top < viewportPadding)
2667
- top = viewportPadding;
2668
- if (top + popoverRect.height > viewportHeight - viewportPadding) {
2669
- maxHeight = viewportHeight - top - viewportPadding;
2670
- }
2671
- }
2672
- // Apply styles
2673
- this.popoverEl.style.top = `${top}px`;
2674
- this.popoverEl.style.left = `${left}px`;
2675
- if (maxHeight !== null && maxHeight > 100) {
2676
- this.popoverEl.style.maxHeight = `${maxHeight}px`;
2677
- this.popoverEl.style.overflowY = 'auto';
2678
- }
2679
- else {
2680
- this.popoverEl.style.maxHeight = '';
2681
- this.popoverEl.style.overflowY = '';
2682
- }
2683
- this.isPositioned = true;
2684
- }
2685
- render() {
2686
- const popoverStyles = {
2687
- visibility: this.isPositioned ? 'visible' : 'hidden',
2688
- };
2689
- if (this.width)
2690
- popoverStyles.width = this.width;
2691
- if (this.minWidth)
2692
- popoverStyles.minWidth = this.minWidth;
2693
- if (this.maxWidth)
2694
- popoverStyles.maxWidth = this.maxWidth;
2695
- return (h(Host, { key: '542d4ab391a9b176d110fe00c0dd61f2c46d73ef', "trigger-full-width": this.triggerFullWidth }, h("div", { key: '2248ab763d65e8a9150e62644452085f01c6a238', class: classnames('le-popover-trigger', {
2696
- 'le-popover-trigger-full-width': this.triggerFullWidth,
2697
- }), ref: el => (this.triggerEl = el), onClick: this.handleTriggerClick, part: "trigger" }, h("slot", { key: '9d9a5f05f4b9f1b11f1fcbb09d29f0c1e36a2cd6', name: "trigger" }, h("button", { key: 'ed573daefaffb7b1effb3c7891722aa40e4b606e', type: "button", class: "le-popover-default-trigger" }, h("span", { key: '61f00ea9761935224e1529adc3b102b85efd4f33' }, "\u2295")))), h("div", { key: 'bf447493c9c7dedb7f2ae7083c80a7a2d06aebe0', id: this.uniqueId, class: "le-popover-content",
2698
- // Always use manual mode so nested popovers can be open together.
2699
- // We implement click-outside and Escape handling ourselves.
2700
- popover: "manual", ref: el => (this.popoverEl = el), style: popoverStyles, "data-fallback-open": this.supportsPopoverApi ? undefined : String(this.open) }, (this.popoverTitle || this.showClose) && (h("div", { key: '50fe79bb415b5de315aea7f766d57ae911a90343', class: "le-popover-header" }, this.popoverTitle && h("span", { key: 'd809f12c512197bd34ca215a05820b533f4d8734', class: "le-popover-title" }, this.popoverTitle), this.showClose && (h("button", { key: '2baee3e910ad65243a66eee2bba1c46d9fa628b4', type: "button", class: "le-popover-close", onClick: () => this.hide(), "aria-label": "Close" }, "\u00D7")))), h("div", { key: 'eacad60a20becde7f4f8b9fa01d195dd3f4c08f1', class: "le-popover-body", part: "content" }, h("slot", { key: 'f8aa2edd170ee039d5277a1b9ebc8ee077a1a9dc' })))));
2701
- }
2702
- };
2703
- LePopover.style = lePopoverCss();
2704
-
2705
- const lePopupCss = () => `:host{display:contents}.le-popup-dialog{position:fixed;z-index:100;top:0;right:0;bottom:0;left:0;padding:0;border:none;background:transparent;max-width:none;max-height:none;overflow:visible;--_popup-min-width:var(--le-popup-min-width, 320px);--_popup-max-width:var(--le-popup-max-width, min(500px, 90vw));--_popup-min-height:var(--le-popup-min-height, auto)}.le-popup-dialog::backdrop{background:var(--le-popup-backdrop-color, rgba(0, 0, 0, 0.5));animation:le-popup-backdrop-fade 0.2s ease-out}@keyframes le-popup-backdrop-fade{from{opacity:0}to{opacity:1}}.le-popup-position-center{margin:auto}.le-popup-position-top{margin:var(--le-space-2xl, 48px) auto auto auto}.le-popup-position-top-left{margin:var(--le-space-lg, 24px) auto auto var(--le-space-lg, 24px)}.le-popup-position-top-right{margin:var(--le-space-lg, 24px) var(--le-space-lg, 24px) auto auto}.le-popup-position-bottom{margin:auto auto var(--le-space-2xl, 48px) auto}.le-popup-position-bottom-left{margin:auto auto var(--le-space-lg, 24px) var(--le-space-lg, 24px)}.le-popup-position-bottom-right{margin:auto var(--le-space-lg, 24px) var(--le-space-lg, 24px) auto}.le-popup-container{display:flex;flex-direction:column;min-width:var(--_popup-min-width);max-width:var(--_popup-max-width);min-height:var(--_popup-min-height);max-height:calc(100vh - var(--le-space-2xl, 48px) * 2);background:var(--le-color-surface, #ffffff);border:1px solid var(--le-color-border, #e0e0e0);border-radius:var(--le-radius-lg, 12px);box-shadow:var(--le-shadow-xl, 0 8px 32px rgba(0, 0, 0, 0.15));overflow:hidden;font-family:var(--le-font-family, system-ui, -apple-system, sans-serif);color:var(--le-color-text, #333);animation:le-popup-appear 0.2s ease-out}@keyframes le-popup-appear{from{opacity:0;transform:scale(0.95) translateY(-10px)}to{opacity:1;transform:scale(1) translateY(0)}}.le-popup-header{flex-shrink:0;padding:var(--le-space-md, 16px) var(--le-space-lg, 24px);border-bottom:1px solid var(--le-color-border, #e0e0e0);background:var(--le-color-surface-alt, #f9f9f9);font-size:var(--le-font-size-lg, 1.125rem);font-weight:var(--le-font-weight-semibold, 600);color:var(--le-color-text, #333)}.le-popup-body{flex:1;padding:var(--le-space-lg, 24px);overflow-y:auto}.le-popup-message{margin:0;font-size:var(--le-font-size-md, 1rem);line-height:var(--le-line-height-relaxed, 1.6);color:var(--le-color-text, #333)}.le-popup-message+::slotted(*){margin-top:var(--le-space-md, 16px)}.le-popup-input{display:block;width:100%;margin-top:var(--le-space-md, 16px);padding:var(--le-space-sm, 8px) var(--le-space-md, 16px);font-family:inherit;font-size:var(--le-font-size-md, 1rem);color:var(--le-color-text, #333);background:var(--le-color-background, #fff);border:1px solid var(--le-color-border, #e0e0e0);border-radius:var(--le-radius-md, 8px);outline:none;transition:border-color var(--le-transition-fast, 0.15s ease),
2706
- box-shadow var(--le-transition-fast, 0.15s ease);box-sizing:border-box}.le-popup-input:focus{border-color:var(--le-color-primary, #2196f3);box-shadow:0 0 0 3px var(--le-color-primary-light, rgba(33, 150, 243, 0.2))}.le-popup-input::placeholder{color:var(--le-color-text-muted, #999)}.le-popup-footer{flex-shrink:0;display:flex;justify-content:flex-end;gap:var(--le-space-sm, 8px);padding:var(--le-space-md, 16px) var(--le-space-lg, 24px);border-top:1px solid var(--le-color-border, #e0e0e0);background:var(--le-color-surface-alt, #f9f9f9)}.le-popup-btn{min-width:80px}@media (max-width: 480px){.le-popup-container{min-width:calc(100vw - var(--le-space-md, 16px) * 2);max-width:calc(100vw - var(--le-space-md, 16px) * 2)}.le-popup-footer{flex-direction:column-reverse}.le-popup-btn{width:100%}}`;
2707
-
2708
- const LePopup = class {
2709
- constructor(hostRef) {
2710
- registerInstance(this, hostRef);
2711
- this.leConfirm = createEvent(this, "leConfirm");
2712
- this.leCancel = createEvent(this, "leCancel");
2713
- this.leOpen = createEvent(this, "leOpen");
2714
- this.leClose = createEvent(this, "leClose");
2715
- }
2716
- get el() { return getElement(this); }
2717
- /**
2718
- * The mode of the Le Kit (e.g., 'default' or 'admin')
2719
- */
2720
- mode = 'default';
2721
- /**
2722
- * Whether the popup is currently visible
2723
- */
2724
- open = false;
2725
- /**
2726
- * Type of popup: alert (OK only), confirm (OK/Cancel), prompt (input + OK/Cancel), custom
2727
- */
2728
- type = 'alert';
2729
- /**
2730
- * Optional title for the popup header
2731
- */
2732
- popupTitle;
2733
- /**
2734
- * Message text to display (for alert/confirm/prompt types)
2735
- */
2736
- message;
2737
- /**
2738
- * Whether the popup is modal (blocks interaction with page behind)
2739
- */
2740
- modal = true;
2741
- /**
2742
- * Position of the popup on screen
2743
- */
2744
- position = 'center';
2745
- /**
2746
- * Text for the confirm/OK button
2747
- */
2748
- confirmText = 'OK';
2749
- /**
2750
- * Text for the cancel button
2751
- */
2752
- cancelText = 'Cancel';
2753
- /**
2754
- * Placeholder text for prompt input
2755
- */
2756
- placeholder = '';
2757
- /**
2758
- * Default value for prompt input
2759
- */
2760
- defaultValue = '';
2761
- /**
2762
- * Whether clicking the backdrop closes the popup (modal only)
2763
- */
2764
- closeOnBackdrop = true;
2765
- /**
2766
- * Internal state for prompt input value
2767
- */
2768
- inputValue = '';
2769
- /**
2770
- * Emitted when the popup is confirmed (OK clicked)
2771
- */
2772
- leConfirm;
2773
- /**
2774
- * Emitted when the popup is cancelled (Cancel clicked or dismissed)
2775
- */
2776
- leCancel;
2777
- /**
2778
- * Emitted when the popup opens
2779
- */
2780
- leOpen;
2781
- /**
2782
- * Emitted when the popup closes
2783
- */
2784
- leClose;
2785
- dialogEl;
2786
- inputEl;
2787
- resolvePromise;
2788
- componentWillLoad() {
2789
- this.inputValue = this.defaultValue;
2790
- }
2791
- componentDidLoad() {
2792
- // Native dialog handles Escape key automatically when modal
2793
- // We just need to listen for the cancel event
2794
- this.dialogEl?.addEventListener('cancel', this.handleDialogCancel);
2795
- }
2796
- disconnectedCallback() {
2797
- this.dialogEl?.removeEventListener('cancel', this.handleDialogCancel);
2798
- }
2799
- handleDialogCancel = (e) => {
2800
- e.preventDefault(); // Prevent default close to handle it ourselves
2801
- this.handleCancel();
2802
- };
2803
- /**
2804
- * Opens the popup and returns a promise that resolves when closed
2805
- */
2806
- async show() {
2807
- return new Promise(resolve => {
2808
- this.resolvePromise = resolve;
2809
- this.inputValue = this.defaultValue;
2810
- this.open = true;
2811
- // Use requestAnimationFrame to ensure the dialog element is rendered
2812
- requestAnimationFrame(() => {
2813
- if (this.dialogEl) {
2814
- if (this.modal) {
2815
- this.dialogEl.showModal();
2816
- }
2817
- else {
2818
- this.dialogEl.show();
2819
- }
2820
- this.leOpen.emit();
2821
- // Focus input for prompt type
2822
- if (this.type === 'prompt' && this.inputEl) {
2823
- this.inputEl.focus();
2824
- this.inputEl.select();
2825
- }
2826
- }
2827
- });
2828
- });
2829
- }
2830
- /**
2831
- * Closes the popup with a result
2832
- */
2833
- async hide(confirmed = false) {
2834
- const result = {
2835
- confirmed,
2836
- value: this.type === 'prompt' ? this.inputValue : undefined,
2837
- };
2838
- this.dialogEl?.close();
2839
- this.open = false;
2840
- this.leClose.emit(result);
2841
- if (this.resolvePromise) {
2842
- this.resolvePromise(result);
2843
- this.resolvePromise = undefined;
2844
- }
2845
- }
2846
- handleConfirm = () => {
2847
- const result = {
2848
- confirmed: true,
2849
- value: this.type === 'prompt' ? this.inputValue : undefined,
2850
- };
2851
- this.leConfirm.emit(result);
2852
- this.hide(true);
2853
- };
2854
- handleCancel = () => {
2855
- const result = {
2856
- confirmed: false,
2857
- value: undefined,
2858
- };
2859
- this.leCancel.emit(result);
2860
- this.hide(false);
2861
- };
2862
- handleBackdropClick = (e) => {
2863
- // Check if click was on the dialog backdrop (outside the dialog box)
2864
- if (this.closeOnBackdrop && e.target === this.dialogEl) {
2865
- const rect = this.dialogEl.getBoundingClientRect();
2866
- const clickedInDialog = e.clientX >= rect.left &&
2867
- e.clientX <= rect.right &&
2868
- e.clientY >= rect.top &&
2869
- e.clientY <= rect.bottom;
2870
- if (!clickedInDialog) {
2871
- this.handleCancel();
2872
- }
2873
- }
2874
- };
2875
- handleInputChange = (e) => {
2876
- this.inputValue = e.target.value;
2877
- };
2878
- handleKeyDown = (e) => {
2879
- if (e.key === 'Enter' && this.type !== 'custom') {
2880
- e.preventDefault();
2881
- this.handleConfirm();
2882
- }
2883
- };
2884
- hasSlot(name) {
2885
- return !!this.el.querySelector(`[slot="${name}"]`);
2886
- }
2887
- renderHeader() {
2888
- if (this.hasSlot('header')) {
2889
- return (h("div", { class: "le-popup-header", part: "header" }, h("slot", { name: "header" })));
2890
- }
2891
- if (this.popupTitle) {
2892
- return (h("div", { class: "le-popup-header", part: "header" }, this.popupTitle));
2893
- }
2894
- return null;
2895
- }
2896
- renderBody() {
2897
- return (h("div", { class: "le-popup-body", part: "body" }, this.message && h("p", { class: "le-popup-message" }, this.message), this.type === 'prompt' && (h("input", { type: "text", class: "le-popup-input", part: "input", placeholder: this.placeholder, value: this.inputValue, onInput: this.handleInputChange, onKeyDown: this.handleKeyDown, ref: el => (this.inputEl = el) })), h("le-slot", { name: "", tag: "div", description: "Custom popup content", type: "slot" }, h("slot", null))));
2898
- }
2899
- renderFooter() {
2900
- if (this.hasSlot('footer')) {
2901
- return (h("div", { class: "le-popup-footer", part: "footer" }, h("slot", { name: "footer" })));
2902
- }
2903
- // For custom type without footer slot, don't render default buttons
2904
- if (this.type === 'custom') {
2905
- return null;
2906
- }
2907
- return (h("div", { class: "le-popup-footer", part: "footer" }, (this.type === 'confirm' || this.type === 'prompt') && (h("le-button", { variant: "outlined", part: "button-cancel", class: "le-popup-btn", onClick: this.handleCancel }, this.cancelText)), h("le-button", { variant: "solid", part: "button-confirm", class: "le-popup-btn", onClick: this.handleConfirm }, this.confirmText)));
2908
- }
2909
- render() {
2910
- const positionClass = `le-popup-position-${this.position}`;
2911
- return (h("dialog", { key: '75ff06ac2532818f2951283fb455d165d1b13e89', class: `le-popup-dialog ${positionClass}`, part: "dialog", ref: el => (this.dialogEl = el), onClick: this.handleBackdropClick }, h("le-component", { key: '0fea1c4ea66d8457c66bf5e14b08b7ac3251a9cc', component: "le-popup" }, h("div", { key: 'eb95845004b27cdba2e817b2f296a59ae1d62552', class: "le-popup-container", part: "container" }, this.renderHeader(), this.renderBody(), this.renderFooter()))));
2912
- }
2913
- };
2914
- LePopup.style = lePopupCss();
2915
-
2916
- const leScrollProgressCss = () => `:host{display:block}:host([sticky]){position:sticky;top:var(--le-scroll-progress-sticky-top, 0);z-index:var(--le-scroll-progress-z, calc(var(--le-header-z, 1000) + 1))}:host([fixed]){position:fixed;top:var(--le-scroll-progress-fixed-top, 0);left:var(--le-scroll-progress-fixed-left, 0);right:var(--le-scroll-progress-fixed-right, 0);z-index:var(--le-scroll-progress-z, calc(var(--le-header-z, 1000) + 1))}.track{width:100%;height:var(--le-scroll-progress-height, 4px);background:var(--le-scroll-progress-bg, transparent)}.fill{height:100%;width:0;background:var(--le-scroll-progress-fill, var(--le-color-primary, currentColor));border-radius:var(--le-scroll-progress-border-radius, 2px);transition:width var(--le-transition-fast, 120ms linear)}`;
2917
-
2918
- const LeScrollProgress = class {
2919
- constructor(hostRef) {
2920
- registerInstance(this, hostRef);
2921
- }
2922
- get el() { return getElement(this); }
2923
- /** Boolean or selector string. */
2924
- trackScrollProgress;
2925
- progress = 0;
2926
- rafId = null;
2927
- targetEl = null;
2928
- componentWillLoad() {
2929
- this.updateProgress();
2930
- }
2931
- componentDidLoad() {
2932
- this.resolveTarget();
2933
- this.updateProgress();
2934
- }
2935
- disconnectedCallback() {
2936
- if (this.rafId != null) {
2937
- cancelAnimationFrame(this.rafId);
2938
- this.rafId = null;
2939
- }
2940
- }
2941
- onTrackChange() {
2942
- this.resolveTarget();
2943
- this.updateProgress();
2944
- }
2945
- onScroll() {
2946
- this.scheduleUpdate();
2947
- }
2948
- onResize() {
2949
- this.resolveTarget();
2950
- this.scheduleUpdate(true);
2951
- }
2952
- scheduleUpdate(force = false) {
2953
- if (this.rafId != null && !force)
2954
- return;
2955
- this.rafId = requestAnimationFrame(() => {
2956
- this.rafId = null;
2957
- this.updateProgress();
2958
- });
2959
- }
2960
- resolveTarget() {
2961
- if (typeof document === 'undefined')
2962
- return;
2963
- const raw = this.trackScrollProgress;
2964
- // If attribute missing, default to enabled (full document).
2965
- // If user explicitly sets 'false', treat as disabled.
2966
- if (raw == null) {
2967
- this.targetEl = null;
2968
- return;
2969
- }
2970
- const val = String(raw).trim();
2971
- if (val === '' || val === 'true') {
2972
- this.targetEl = null;
2973
- return;
2974
- }
2975
- if (val === 'false') {
2976
- this.targetEl = null;
2977
- return;
2978
- }
2979
- try {
2980
- this.targetEl = document.querySelector(val);
2981
- }
2982
- catch {
2983
- this.targetEl = null;
2984
- }
2985
- }
2986
- clamp01(n) {
2987
- return Math.max(0, Math.min(1, n));
2988
- }
2989
- updateProgress() {
2990
- if (typeof window === 'undefined' || typeof document === 'undefined')
2991
- return;
2992
- // If explicitly disabled.
2993
- if (this.trackScrollProgress === 'false') {
2994
- if (this.progress !== 0)
2995
- this.progress = 0;
2996
- return;
2997
- }
2998
- const scrollY = window.scrollY || 0;
2999
- let p = 0;
3000
- if (this.targetEl) {
3001
- const rect = this.targetEl.getBoundingClientRect();
3002
- const top = scrollY + rect.top;
3003
- const height = rect.height;
3004
- const viewport = window.innerHeight || 1;
3005
- const denom = Math.max(1, height - viewport);
3006
- p = this.clamp01((scrollY - top) / denom);
3007
- }
3008
- else {
3009
- const doc = document.documentElement;
3010
- const denom = Math.max(1, doc.scrollHeight - doc.clientHeight);
3011
- p = this.clamp01(scrollY / denom);
3012
- }
3013
- const next = Math.round(p * 1000) / 1000;
3014
- if (next !== this.progress)
3015
- this.progress = next;
3016
- }
3017
- render() {
3018
- const width = `${this.progress * 100}%`;
3019
- return (h(Host, { key: '7a93dbfd8b14e5e581ff1480ad0e657f8f33bcf4' }, h("div", { key: 'fe4ff14af541e2a610d0b32605aaadb87ccea957', class: "track", part: "track", "aria-hidden": "true" }, h("div", { key: 'f46a09358bf77a7cff64deafa63702360a686c6a', class: "fill", part: "fill", style: { width } }))));
3020
- }
3021
- static get watchers() { return {
3022
- "trackScrollProgress": ["onTrackChange"]
3023
- }; }
3024
- };
3025
- LeScrollProgress.style = leScrollProgressCss();
3026
-
3027
- const leSelectCss = () => `:host{display:inline-block;min-width:150px;--le-select-color:var(--le-color-text, #1f2937);--le-select-border-radius:var(--le-radius-md);--le-select-content-padding:var(--le-spacing-2)}:host([disabled]){opacity:0.5;pointer-events:none}:host([full-width]){width:100%}.select-trigger{display:flex;align-items:center;gap:0.5rem;width:100%;padding:0;--le-button-padding:var(--le-spacing-1) var(--le-spacing-1) var(--le-spacing-1) var(--le-spacing-2);font-size:var(--le-select-font-size, 0.875rem);font-family:inherit;line-height:1.4;color:var(--le-select-color);background:var(--le-select-bg, var(--le-color-surface, #fff));border-radius:var(--le-select-border-radius);cursor:pointer;text-align:left;transition:border-color 0.15s ease, box-shadow 0.15s ease}.select-trigger:focus{outline:2px solid var(--le-color-focus);outline-offset:2px}.select-trigger:not(.has-value) .trigger-label{color:color-mix(in srgb, var(--le-color-text-secondary) 66%, transparent)}.trigger-icon{display:flex;align-items:center;justify-content:center;flex-shrink:0;width:1.25rem;height:1.25rem}.trigger-icon-end{width:16px;height:16px}.trigger-icon img{width:100%;height:100%;object-fit:contain}.trigger-label{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--le-color-text)}.trigger-label::not(.has-value){color:var(--le-color-text-disabled, #9ca3af)}le-button::part(icon-end){display:flex;align-items:center;justify-content:center;flex-shrink:0;width:1.25rem;height:1.25rem;margin-left:auto;transition:transform 0.2s ease}le-button::part(icon-end) svg{width:1rem;height:1rem}le-button.is-open::part(icon-end){transform:rotate(180deg)}.search-input::part(container):focus-within{outline:none !important}.search-input{--le-input-radius:var(--le-radius-md)}`;
3028
-
3029
- const LeSelect = class {
3030
- constructor(hostRef) {
3031
- registerInstance(this, hostRef);
3032
- this.leChange = createEvent(this, "change");
3033
- this.leOpen = createEvent(this, "leOpen");
3034
- this.leClose = createEvent(this, "leClose");
3035
- }
3036
- get el() { return getElement(this); }
3037
- /**
3038
- * The options to display in the dropdown.
3039
- */
3040
- options = [];
3041
- /**
3042
- * The currently selected value.
3043
- */
3044
- value;
3045
- /**
3046
- * Placeholder text when no option is selected.
3047
- */
3048
- placeholder = 'Select an option';
3049
- /**
3050
- * Whether the select is disabled.
3051
- */
3052
- disabled = false;
3053
- /**
3054
- * Whether selection is required.
3055
- */
3056
- required = false;
3057
- /**
3058
- * Name attribute for form submission.
3059
- */
3060
- name;
3061
- /**
3062
- * Whether the select should take full width of its container.
3063
- */
3064
- fullWidth = false;
3065
- /**
3066
- * Size variant of the select.
3067
- */
3068
- size = 'medium';
3069
- /**
3070
- * Visual variant of the select.
3071
- */
3072
- variant = 'default';
3073
- /**
3074
- * Whether the input is searchable.
3075
- */
3076
- searchable = false;
3077
- /**
3078
- * Text to show when no options match the search.
3079
- */
3080
- emptyText = 'No results found';
3081
- /**
3082
- * Whether the dropdown is currently open.
3083
- */
3084
- open = false;
3085
- /**
3086
- * Emitted when the selected value changes.
3087
- */
3088
- leChange;
3089
- /**
3090
- * Emitted when the dropdown opens.
3091
- */
3092
- leOpen;
3093
- /**
3094
- * Emitted when the dropdown closes.
3095
- */
3096
- leClose;
3097
- selectedOption;
3098
- searchQuery = '';
3099
- dropdownEl;
3100
- inputEl;
3101
- handleValueChange() {
3102
- this.updateSelectedOption();
3103
- }
3104
- handleOptionsChange() {
3105
- this.updateSelectedOption();
3106
- }
3107
- componentWillLoad() {
3108
- this.updateSelectedOption();
3109
- }
3110
- get parsedOptions() {
3111
- if (typeof this.options === 'string') {
3112
- try {
3113
- return JSON.parse(this.options);
3114
- }
3115
- catch {
3116
- return [];
3117
- }
3118
- }
3119
- return this.options;
3120
- }
3121
- updateSelectedOption() {
3122
- if (this.value !== undefined) {
3123
- this.selectedOption = this.parsedOptions.find(opt => (opt.value ?? opt.label) === this.value);
3124
- }
3125
- else {
3126
- this.selectedOption = undefined;
3127
- }
3128
- }
3129
- filterOption = (option, query) => {
3130
- if (!query)
3131
- return true;
3132
- const searchLower = query.toLowerCase();
3133
- return (option.label.toLowerCase().includes(searchLower) ||
3134
- (option.description?.toLowerCase().includes(searchLower) ?? false));
3135
- };
3136
- handleOptionSelect = (e) => {
3137
- this.value = e.detail.value;
3138
- this.selectedOption = e.detail.option;
3139
- this.leChange.emit(e.detail);
3140
- };
3141
- handleDropdownOpen = () => {
3142
- this.open = true;
3143
- this.leOpen.emit();
3144
- // Focus search input if searchable
3145
- if (this.searchable) {
3146
- setTimeout(() => {
3147
- this.inputEl?.focus();
3148
- }, 50);
3149
- }
3150
- };
3151
- handleDropdownClose = () => {
3152
- this.open = false;
3153
- this.leClose.emit();
3154
- };
3155
- handleTriggerClick = () => {
3156
- if (!this.disabled) {
3157
- this.dropdownEl?.toggle();
3158
- }
3159
- };
3160
- handleTriggerKeyDown = (e) => {
3161
- if (this.disabled)
3162
- return;
3163
- if (e.key === 'Enter' || e.key === ' ' || e.key === 'ArrowDown') {
3164
- e.preventDefault();
3165
- this.dropdownEl?.show();
3166
- }
3167
- };
3168
- handleSearchInput = (e) => {
3169
- const target = e.target;
3170
- this.searchQuery = target.value;
3171
- };
3172
- /**
3173
- * Opens the dropdown.
3174
- */
3175
- async showDropdown() {
3176
- await this.dropdownEl?.show();
3177
- }
3178
- /**
3179
- * Closes the dropdown.
3180
- */
3181
- async hideDropdown() {
3182
- await this.dropdownEl?.hide();
3183
- }
3184
- renderIcon(icon) {
3185
- if (!icon)
3186
- return null;
3187
- if (icon.startsWith('http') || icon.startsWith('/')) {
3188
- return h("img", { class: "trigger-icon", src: icon, alt: "" });
3189
- }
3190
- return h("span", { class: "trigger-icon" }, icon);
3191
- }
3192
- render() {
3193
- const hasValue = this.selectedOption !== undefined;
3194
- return (h("le-component", { key: '670430a0ca8f310b7454c7dd93098b6b57f3bb82', component: "le-select" }, h("le-dropdown-base", { key: '58716c031b14513b67a1106b90b6174fa363c8b4', ref: el => (this.dropdownEl = el), options: this.parsedOptions, value: this.value, disabled: this.disabled, filterFn: this.searchable ? this.filterOption : undefined, filterQuery: this.searchQuery, onLeOptionSelect: this.handleOptionSelect, onLeDropdownOpen: this.handleDropdownOpen, onLeDropdownClose: this.handleDropdownClose, fullWidth: this.fullWidth }, h("le-button", { key: 'b9cb202179c8fbc6dea9bc7af5ccf11deeb7c0f1', variant: this.variant && this.variant !== 'default' ? this.variant : 'outlined', slot: "trigger", align: "space-between", class: {
3195
- 'select-trigger': true,
3196
- 'has-value': hasValue,
3197
- 'is-open': this.open,
3198
- }, mode: "default", size: this.size, disabled: this.disabled, "aria-haspopup": "listbox", "aria-expanded": this.open ? 'true' : 'false', onClick: this.handleTriggerClick, onKeyDown: this.handleTriggerKeyDown, fullWidth: this.fullWidth, iconStart: hasValue && this.selectedOption?.iconStart
3199
- ? this.renderIcon(this.selectedOption.iconStart)
3200
- : null, iconEnd: h("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", "stroke-width": "2" }, h("path", { d: "M4 6l4 4 4-4" })) }, h("span", { key: '592267788f6a02d6b501941863e91bcd68742233', class: "trigger-label" }, hasValue ? this.selectedOption.label : this.placeholder)), this.searchable && this.open && (h("div", { key: 'd4d2611e8b1f7fb243675cc11fa4982331b3c330', class: "multiselect-search", slot: "header" }, h("le-string-input", { key: 'f2a7e477eaf730173cfbca35b33d263eda860dc2', mode: "default", inputRef: el => (this.inputEl = el), class: "search-input", placeholder: "Search...", value: this.searchQuery, onInput: this.handleSearchInput })))), this.name && h("input", { key: 'bf9dc8141d02c272b0b81557dbc7c24a419ce558', type: "hidden", name: this.name, value: this.value?.toString() ?? '' })));
3201
- }
3202
- static get watchers() { return {
3203
- "value": ["handleValueChange"],
3204
- "options": ["handleOptionsChange"]
3205
- }; }
3206
- };
3207
- LeSelect.style = leSelectCss();
3208
-
3209
- const leSlotDefaultCss = () => `:host{display:contents;--le-slot-border-color:#0088ff;--le-slot-bg-color:rgba(0, 136, 255, 0.05);--le-slot-header-bg:rgb(218, 238, 255);--le-slot-label-color:#0066cc;--le-slot-description-color:#666;--le-slot-required-color:#e53935;--le-slot-dropzone-min-height:20px;--le-slot-dropzone-border-color:#ccc}.le-slot-container,.le-slot-header,.le-slot-description,.le-slot-dropzone,.le-slot-input{display:none}.hidden-slot{display:none}:host(.admin-mode){display:block;flex:1}:host(.admin-mode) .le-slot-container{position:relative;display:flex;flex-direction:column;border:2px dashed var(--le-slot-border-color);border-radius:4px;background:var(--le-slot-bg-color);margin:4px 0}:host(.admin-mode) .le-slot-header{display:flex;align-items:center;gap:4px;padding:0 0 0 var(--le-spacing-1, 4px);background:var(--le-slot-header-bg);border-bottom:1px solid var(--le-slot-border-color);font-size:var(--le-font-size-xs, 11px);font-weight:400;text-transform:capitalize}:host(.admin-mode) .le-slot-header-no-label{justify-content:flex-end;height:16px;border:none;background-color:transparent}.le-slot-label{color:var(--le-slot-label-color);text-align:start;overflow:hidden;width:0;flex:1 1 0%}.le-slot-required{color:var(--le-slot-required-color);font-weight:bold}:host(.admin-mode) .le-slot-description{display:block;padding:4px 8px;font-size:12px;color:var(--le-slot-description-color);font-style:italic}:host(.admin-mode) .le-slot-description-icon{display:inline-block;font-size:9px;line-height:1;cursor:pointer;color:var(--le-slot-description-color)}:host(.admin-mode) .le-slot-dropzone{display:block;min-height:var(--le-slot-dropzone-min-height);padding:var(--le-spacing-1, 4px);position:relative}:host(.admin-mode) .le-slot-dropzone:empty::before{content:'Drop content here';display:flex;align-items:center;justify-content:center;position:absolute;inset:8px;border:2px dashed var(--le-slot-dropzone-border-color);border-radius:4px;color:#999;font-size:12px;pointer-events:none}:host(.admin-mode.drag-over) .le-slot-container{border-color:#00cc66;background:rgba(0, 204, 102, 0.1)}:host(.admin-mode.drag-over) .le-slot-dropzone:empty::before{border-color:#00cc66;color:#00cc66;content:'Release to drop'}:host(.admin-mode) .le-slot-input{display:block;padding:var(--le-spacing-1, 4px)}:host(.admin-mode) .le-slot-input input,:host(.admin-mode) .le-slot-input textarea{display:block;width:100%;padding:8px 10px;border:1px solid var(--le-slot-dropzone-border-color);border-radius:4px;font-family:inherit;font-size:14px;line-height:1.4;background:#fff;color:#333;box-sizing:border-box;transition:border-color 0.2s, box-shadow 0.2s}:host(.admin-mode) .le-slot-input input:focus,:host(.admin-mode) .le-slot-input textarea:focus{outline:none;border-color:var(--le-slot-border-color);box-shadow:0 0 0 3px rgba(0, 136, 255, 0.15)}:host(.admin-mode) .le-slot-input input::placeholder,:host(.admin-mode) .le-slot-input textarea::placeholder{color:#999}:host(.admin-mode) .le-slot-input textarea{resize:vertical;min-height:60px}:host(.admin-mode) .le-slot-input slot{display:none}.le-slot-invalid{color:var(--le-slot-required-color);font-size:10px;margin-left:auto;font-weight:normal;text-transform:none}:host(.admin-mode) .le-slot-input.has-error input,:host(.admin-mode) .le-slot-input.has-error textarea{border-color:var(--le-slot-required-color);background:rgba(229, 57, 53, 0.05)}:host(.admin-mode) .le-slot-input.has-error input:focus,:host(.admin-mode) .le-slot-input.has-error textarea:focus{border-color:var(--le-slot-required-color);box-shadow:0 0 0 3px rgba(229, 57, 53, 0.15)}.le-slot-add-btn{font-size:24px;line-height:0px;width:12px;height:12px}.le-slot-header-no-label .le-slot-add-btn{font-size:16px}.le-slot-button{width:20px;height:20px}:host(.admin-mode) .le-slot-header-no-label.le-slot-header-text{height:0}`;
3210
-
3211
- const LeSlot = class {
3212
- constructor(hostRef) {
3213
- registerInstance(this, hostRef);
3214
- this.leSlotChange = createEvent(this, "leSlotChange");
3215
- }
3216
- get el() { return getElement(this); }
3217
- /**
3218
- * The type of slot content.
3219
- * - `slot`: Default, shows a dropzone for components (default)
3220
- * - `text`: Shows a single-line text input
3221
- * - `textarea`: Shows a multi-line text area
3222
- */
3223
- type = 'slot';
3224
- /**
3225
- * The name of the slot this placeholder represents.
3226
- * Should match the slot name in the parent component.
3227
- */
3228
- name = '';
3229
- /**
3230
- * Label to display in admin mode.
3231
- * If not provided, the slot name will be used.
3232
- */
3233
- label;
3234
- /**
3235
- * Description of what content this slot accepts.
3236
- * Shown in admin mode to guide content editors.
3237
- */
3238
- description;
3239
- /**
3240
- * Comma-separated list of allowed component tags for this slot.
3241
- * Used by CMS to filter available components.
3242
- *
3243
- * @example "le-card,le-button,le-text"
3244
- */
3245
- allowedComponents;
3246
- /**
3247
- * Whether multiple components can be dropped in this slot.
3248
- */
3249
- multiple = true;
3250
- /**
3251
- * Whether this slot is required to have content.
3252
- */
3253
- required = false;
3254
- /**
3255
- * Placeholder text for text/textarea inputs in admin mode.
3256
- */
3257
- placeholder;
3258
- /**
3259
- * The HTML tag to create when there's no slotted element.
3260
- * Used with type="text" or type="textarea" to auto-create elements.
3261
- *
3262
- * @example "h3" - creates <h3 slot="header">content</h3>
3263
- * @example "p" - creates <p slot="content">content</p>
3264
- */
3265
- tag;
3266
- /**
3267
- * CSS styles for the slot dropzone container.
3268
- * Useful for layouts - e.g., "flex-direction: row" for horizontal stacks.
3269
- * Only applies in admin mode for type="slot".
3270
- */
3271
- slotStyle;
3272
- /**
3273
- * Internal state to track admin mode
3274
- */
3275
- adminMode = false;
3276
- /**
3277
- * Internal state for text input value (synced from slot content)
3278
- */
3279
- textValue = '';
3280
- /**
3281
- * Whether the current textValue contains valid HTML
3282
- */
3283
- isValidHtml = true;
3284
- /**
3285
- * Available components loaded from Custom Elements Manifest
3286
- */
3287
- availableComponents = [];
3288
- /**
3289
- * Whether the component picker popover is open
3290
- */
3291
- pickerOpen = false;
3292
- /**
3293
- * Reference to the slot element to access assignedNodes
3294
- */
3295
- slotRef;
3296
- /**
3297
- * The original slotted element (e.g., <h3 slot="header">)
3298
- */
3299
- slottedElement;
3300
- /**
3301
- * Emitted when text content changes in admin mode.
3302
- * The event detail contains the new text value and validity.
3303
- */
3304
- leSlotChange;
3305
- disconnectModeObserver;
3306
- connectedCallback() {
3307
- this.disconnectModeObserver = observeModeChanges(this.el, mode => {
3308
- const wasAdmin = this.adminMode;
3309
- this.adminMode = mode === 'admin';
3310
- // When entering admin mode, read content from slotted elements
3311
- if (this.adminMode && !wasAdmin) {
3312
- // Need to wait for render to access slot ref
3313
- requestAnimationFrame(() => this.readSlottedContent());
3314
- // Load available components for the component picker
3315
- if (this.type === 'slot') {
3316
- this.loadAvailableComponents();
3317
- }
3318
- }
3319
- });
3320
- }
3321
- disconnectedCallback() {
3322
- this.disconnectModeObserver?.();
3323
- }
3324
- /**
3325
- * Flag to prevent re-reading content right after we updated it
3326
- */
3327
- isUpdating = false;
3328
- /**
3329
- * Read content from slotted elements via assignedNodes()
3330
- */
3331
- readSlottedContent() {
3332
- if (!this.slotRef)
3333
- return;
3334
- // Skip if we just updated the content ourselves
3335
- if (this.isUpdating) {
3336
- this.isUpdating = false;
3337
- return;
3338
- }
3339
- const assignedNodes = this.slotRef.assignedNodes({ flatten: true });
3340
- // For text/textarea types, we want to edit the innerHTML of slotted elements
3341
- if (this.type === 'text' || this.type === 'textarea') {
3342
- // Find the first element node (skip text nodes that are just whitespace)
3343
- const elementNode = assignedNodes.find(node => node.nodeType === Node.ELEMENT_NODE);
3344
- if (elementNode) {
3345
- // Only update textValue if slotted element changed or we don't have one yet
3346
- if (this.slottedElement !== elementNode) {
3347
- this.slottedElement = elementNode;
3348
- this.textValue = elementNode.innerHTML?.trim() || '';
3349
- // console.log(`[le-slot "${this.name}"] Read slotted content:`, this.textValue);
3350
- }
3351
- }
3352
- else {
3353
- // No element, check for direct text content
3354
- const textContent = assignedNodes
3355
- .filter(node => node.nodeType === Node.TEXT_NODE)
3356
- .map(node => node.textContent)
3357
- .join('')
3358
- .trim();
3359
- if (textContent && !this.textValue) {
3360
- this.textValue = textContent;
3361
- // console.log(`[le-slot "${this.name}"] Read text content:`, this.textValue);
3362
- }
3363
- }
3364
- }
3365
- }
3366
- /**
3367
- * Validates if a string contains valid HTML
3368
- */
3369
- validateHtml(html) {
3370
- // Empty string is valid
3371
- if (!html.trim())
3372
- return true;
3373
- // Create a template element to parse the HTML
3374
- const template = document.createElement('template');
3375
- template.innerHTML = html;
3376
- // Check that we don't have obviously broken HTML
3377
- // Count opening and closing tags for common elements
3378
- const openTags = (html.match(/<[a-z][^>]*(?<!\/)>/gi) || []).length;
3379
- const closeTags = (html.match(/<\/[a-z][^>]*>/gi) || []).length;
3380
- const selfClosing = (html.match(/<[a-z][^>]*\/>/gi) || []).length;
3381
- // Simple validation: opening tags (minus self-closing) should roughly match closing tags
3382
- // Allow some tolerance for void elements like <br>, <img>, etc.
3383
- const voidElements = (html.match(/<(br|hr|img|input|meta|link|area|base|col|embed|param|source|track|wbr)[^>]*>/gi) || []).length;
3384
- const effectiveOpenTags = openTags - selfClosing - voidElements;
3385
- // If difference is too large, HTML is likely broken
3386
- if (Math.abs(effectiveOpenTags - closeTags) > 1) {
3387
- return false;
3388
- }
3389
- return true;
3390
- }
3391
- handleTextInput = (event) => {
3392
- const target = event.target;
3393
- this.textValue = target.value;
3394
- this.isValidHtml = this.validateHtml(this.textValue);
3395
- if (this.isValidHtml) {
3396
- // Set flag to prevent slotchange from re-reading what we just wrote
3397
- this.isUpdating = true;
3398
- console.log('Updating text value:', this.textValue, 'slottedElement:', this.slottedElement);
3399
- if (this.slottedElement) {
3400
- // Update existing slotted element's innerHTML
3401
- this.slottedElement.innerHTML = this.textValue;
3402
- }
3403
- else if (this.tag && this.textValue) {
3404
- // No slotted element exists
3405
- // If the slot doesn't have a name, then it's the default slot
3406
- // remove the existing non-slotted content (text nodes and elements without slot attribute)
3407
- const rootNode = this.el.getRootNode();
3408
- if (!this.name && rootNode instanceof ShadowRoot) {
3409
- const hostComponent = rootNode.host;
3410
- Array.from(hostComponent.childNodes).forEach(node => {
3411
- if (node.nodeType === Node.TEXT_NODE || (node.nodeType === Node.ELEMENT_NODE && !node.hasAttribute('slot'))) {
3412
- node.remove();
3413
- }
3414
- });
3415
- }
3416
- // create one using the specified tag
3417
- this.createSlottedElement();
3418
- }
3419
- else if (this.textValue) {
3420
- // no tag specified - just replace everything in the host component
3421
- const rootNode = this.el.getRootNode();
3422
- if (rootNode instanceof ShadowRoot) {
3423
- const hostComponent = rootNode.host;
3424
- hostComponent.innerHTML = this.textValue;
3425
- }
3426
- }
3427
- }
3428
- this.leSlotChange.emit({
3429
- name: this.name,
3430
- value: this.textValue,
3431
- isValid: this.isValidHtml,
3432
- });
3433
- };
3434
- /**
3435
- * Create a new slotted element when none exists.
3436
- * The element is appended to the host component's light DOM.
3437
- */
3438
- createSlottedElement() {
3439
- if (!this.tag)
3440
- return;
3441
- // Find the host component (le-card, etc.) by traversing up through shadow DOM
3442
- // le-slot is inside le-card's shadow DOM, so we need to find le-card's host
3443
- const rootNode = this.el.getRootNode();
3444
- if (!(rootNode instanceof ShadowRoot))
3445
- return;
3446
- const hostComponent = rootNode.host;
3447
- if (!hostComponent)
3448
- return;
3449
- // Create the new element
3450
- const newElement = document.createElement(this.tag);
3451
- newElement.innerHTML = this.textValue;
3452
- // Set the slot attribute if this is a named slot
3453
- if (this.name) {
3454
- newElement.setAttribute('slot', this.name);
3455
- }
3456
- // Append to the host component's light DOM
3457
- hostComponent.appendChild(newElement);
3458
- // Store reference to the new element
3459
- this.slottedElement = newElement;
3460
- // console.log(`[le-slot "${this.name}"] Created new <${this.tag}> element`);
3461
- }
3462
- /**
3463
- * Load available components from Custom Elements Manifest
3464
- */
3465
- async loadAvailableComponents() {
3466
- try {
3467
- const { manifestFile } = getLeKitConfig();
3468
- const manifestFileResolved = getAssetPath(`./assets/${manifestFile}`);
3469
- const response = await fetch(manifestFileResolved);
3470
- const manifest = await response.json();
3471
- const components = [];
3472
- const allowedList = this.allowedComponents?.split(',').map(s => s.trim()) || [];
3473
- for (const module of manifest.modules) {
3474
- for (const declaration of module.declarations || []) {
3475
- if (declaration.tagName && declaration.customElement) {
3476
- // Skip internal components (le-slot, le-component, le-popover)
3477
- const isInternal = ['le-slot', 'le-component', 'le-popover'].includes(declaration.tagName);
3478
- if (isInternal)
3479
- continue;
3480
- // If allowedComponents is specified, filter by it
3481
- if (allowedList.length > 0 && !allowedList.includes(declaration.tagName)) {
3482
- continue;
3483
- }
3484
- components.push({
3485
- tagName: declaration.tagName,
3486
- name: this.formatComponentName(declaration.tagName),
3487
- description: declaration.description || '',
3488
- });
3489
- }
3490
- }
3491
- }
3492
- this.availableComponents = components || [];
3493
- }
3494
- catch (error) {
3495
- console.warn('[le-slot] Failed to load component manifest:', error);
3496
- }
3497
- }
3498
- /**
3499
- * Format a tag name into a display name
3500
- * e.g., 'le-card' -> 'Card'
3501
- */
3502
- formatComponentName(tagName) {
3503
- return tagName
3504
- .replace(/^le-/, '')
3505
- .split('-')
3506
- .map(word => word.charAt(0).toUpperCase() + word.slice(1))
3507
- .join(' ');
3508
- }
3509
- /**
3510
- * Add a new component to the slot
3511
- */
3512
- addComponent(tagName) {
3513
- // Find the host component by traversing up through shadow DOM
3514
- const rootNode = this.el.getRootNode();
3515
- if (!(rootNode instanceof ShadowRoot))
3516
- return;
3517
- const hostComponent = rootNode.host;
3518
- if (!hostComponent)
3519
- return;
3520
- // Create the new component element
3521
- const newElement = document.createElement(tagName);
3522
- // Set the slot attribute if this is a named slot
3523
- if (this.name) {
3524
- newElement.setAttribute('slot', this.name);
3525
- }
3526
- // Append to the host component's light DOM
3527
- hostComponent.appendChild(newElement);
3528
- // Emit change event so the page can save
3529
- this.leSlotChange.emit({
3530
- name: this.name,
3531
- value: hostComponent.innerHTML,
3532
- isValid: true,
3533
- });
3534
- }
3535
- /**
3536
- * Handle slot change event to re-read content when nodes are assigned
3537
- */
3538
- handleSlotChange = () => {
3539
- this.readSlottedContent();
3540
- };
3541
- render() {
3542
- const displayLabel = this.label || this.name;
3543
- // Always render the same structure, CSS handles visibility via .admin-mode class
3544
- return (h(Host, { key: '8a48f7865340d9a2e201a2f878b2f1c66c55d86c', class: {
3545
- 'admin-mode': this.adminMode,
3546
- 'invalid-html': !this.isValidHtml,
3547
- }, role: this.adminMode ? 'region' : undefined, "aria-label": this.adminMode ? `Slot: ${displayLabel}` : undefined, "data-slot-name": this.name, "data-slot-type": this.type, "data-allowed": this.allowedComponents, "data-multiple": this.multiple, "data-required": this.required }, this.adminMode ? (h("div", { class: "le-slot-container" }, h("div", { class: classnames('le-slot-header', {
3548
- 'le-slot-header-no-label': !displayLabel,
3549
- 'le-slot-header-text': this.type === 'text',
3550
- 'le-slot-header-error': !this.isValidHtml,
3551
- }) }, displayLabel && (h("span", { class: "le-slot-label" }, displayLabel, this.required && h("span", { class: "le-slot-required" }, "*"))), !this.isValidHtml && h("span", { class: "le-slot-invalid" }, "\u26A0 Invalid HTML"), this.type === 'slot' && this.adminMode && (h("le-popover", { mode: "default", showClose: true, align: "start", position: "right", popoverTitle: "Add Component", open: this.pickerOpen, onLePopoverOpen: () => (this.pickerOpen = true), onLePopoverClose: () => (this.pickerOpen = false) }, h("le-button", { type: "button", class: "le-slot-button", slot: "trigger", variant: "clear", size: "small", "aria-label": "Add component", "icon-only": true }, h("span", { class: "le-slot-add-btn", slot: "icon-only" }, "+")), h("div", { class: "le-slot-picker" }, this.availableComponents.length > 0 ? (h("ul", { class: "le-slot-picker-list" }, this.availableComponents.map(component => (h("li", { key: component.tagName }, h("button", { class: "le-slot-picker-item", onClick: () => {
3552
- this.addComponent(component.tagName);
3553
- this.pickerOpen = false;
3554
- } }, h("span", { class: "le-slot-picker-name" }, component.name), component.description && h("span", { class: "le-slot-picker-desc" }, component.description))))))) : (h("div", { class: "le-slot-picker-empty" }, "No components available")))))), this.renderContent())) : (
3555
- // In default mode, just pass through the slot - slotted content renders naturally
3556
- // Note: We use unnamed slot here because named slots from parent component
3557
- // are passed as le-slot's light DOM children
3558
- h("slot", null))));
3559
- }
3560
- renderContent() {
3561
- // Create the slot element with ref for reading assignedNodes
3562
- // Wrap in a hidden div since slot elements can't have style prop in Stencil
3563
- // Note: We use unnamed slot here because named slots from parent component
3564
- // are passed as le-slot's light DOM children
3565
- const slotElement = (h("div", { class: "hidden-slot" }, h("slot", { ref: el => (this.slotRef = el), onSlotchange: this.handleSlotChange })));
3566
- switch (this.type) {
3567
- case 'text':
3568
- return (h("div", { class: { 'le-slot-input': true, 'has-error': !this.isValidHtml } }, h("le-string-input", { mode: "default", value: this.textValue, placeholder: this.placeholder || `Enter ${this.label || this.name || 'text'}...`, onChange: this.handleTextInput }), slotElement));
3569
- case 'textarea':
3570
- return (h("div", { class: { 'le-slot-input': true, 'has-error': !this.isValidHtml } }, h("textarea", { value: this.textValue, placeholder: this.placeholder || `Enter ${this.label || this.name || 'text'}...`, onInput: this.handleTextInput, required: this.required, rows: 3 }), slotElement));
3571
- case 'slot':
3572
- default:
3573
- // Parse slotStyle string into style object if provided
3574
- const dropzoneStyle = {};
3575
- if (this.slotStyle) {
3576
- this.slotStyle.split(';').forEach(rule => {
3577
- const [prop, value] = rule.split(':').map(s => s.trim());
3578
- if (prop && value) {
3579
- // Convert kebab-case to camelCase for style object
3580
- const camelProp = prop.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
3581
- dropzoneStyle[camelProp] = value;
3582
- }
3583
- });
3584
- }
3585
- return (h("div", { class: "le-slot-dropzone", style: dropzoneStyle }, h("slot", { ref: el => (this.slotRef = el), onSlotchange: this.handleSlotChange })));
3586
- }
3587
- }
3588
- };
3589
- LeSlot.style = leSlotDefaultCss();
3590
-
3591
- const leStringInputCss = () => `:host{display:block;--le-input-bg:var(--le-color-surface, #ffffff);--le-input-color:var(--le-color-text-primary, #333333);--le-input-border:var(--le-border-width, 2px) solid var(--le-color-border-input, #007bff);--le-input-radius:var(--le-radius-sm, 4px);--le-input-padding:2px 6px;--le-input-height:1.5rem;--le-input-label-color:var(--le-color-text-primary, #333333);--le-input-desc-color:var(--le-color-text-secondary, #666666);--le-input-placeholder-color:#999999}.le-input-wrapper{display:flex;flex-direction:column;gap:2px}.le-input-label{display:block;font-size:0.9em;font-weight:500;color:var(--le-input-label-color);margin-bottom:2px}.le-input-container{position:relative;display:flex;align-items:center;background:var(--le-input-bg);border:var(--le-input-border);border-radius:var(--le-input-radius);transition:border-color 0.2s}.le-input-container:focus-within{outline:2px solid var(--le-color-focus);outline-offset:2px}:host([disabled]) .le-input-container{opacity:0.6;background-color:rgba(0,0,0,0.05);cursor:not-allowed}input{flex:1;min-height:var(--le-input-height);padding:var(--le-input-padding);border:none;background:transparent;color:var(--le-input-color);font-family:inherit;font-size:inherit;outline:none;width:100%}input::placeholder{color:var(--le-input-placeholder-color)}.icon-start,.icon-end{display:flex;align-items:center;justify-content:center;padding:0 8px;color:var(--le-input-desc-color)}.le-input-description{font-size:0.85em;color:var(--le-input-desc-color);margin-top:2px}.le-input-description::has(le-slot>slot[name=description]:empty){display:none}`;
3592
-
3593
- const LeStringInput = class {
3594
- constructor(hostRef) {
3595
- registerInstance(this, hostRef);
3596
- this.leChange = createEvent(this, "change");
3597
- this.leInput = createEvent(this, "input");
3598
- }
3599
- get el() { return getElement(this); }
3600
- /**
3601
- * Pass the ref of the input element to the parent component
3602
- */
3603
- inputRef;
3604
- /**
3605
- * Mode of the popover should be 'default' for internal use
3606
- */
3607
- mode;
3608
- /**
3609
- * The value of the input
3610
- */
3611
- value;
3612
- /**
3613
- * The name of the input
3614
- */
3615
- name;
3616
- /**
3617
- * The type of the input (text, email, password, etc.)
3618
- */
3619
- type = 'text';
3620
- /**
3621
- * Label for the input
3622
- */
3623
- label;
3624
- /**
3625
- * Icon for the start icon
3626
- */
3627
- iconStart;
3628
- /**
3629
- * Icon for the end icon
3630
- */
3631
- iconEnd;
3632
- /**
3633
- * Placeholder text
3634
- */
3635
- placeholder;
3636
- /**
3637
- * Hide description slot
3638
- */
3639
- hideDescription = false;
3640
- /**
3641
- * Whether the input is disabled
3642
- */
3643
- disabled = false;
3644
- /**
3645
- * Whether the input is read-only
3646
- */
3647
- readonly = false;
3648
- /**
3649
- * External ID for linking with external systems
3650
- */
3651
- externalId;
3652
- /**
3653
- * Emitted when the value changes (on blur or Enter)
3654
- */
3655
- leChange;
3656
- /**
3657
- * Emitted when the input value changes (on keystroke)
3658
- */
3659
- leInput;
3660
- handleInput = (ev) => {
3661
- const input = ev.target;
3662
- this.value = input.value;
3663
- this.leInput.emit({
3664
- value: this.value,
3665
- name: this.name,
3666
- externalId: this.externalId,
3667
- });
3668
- };
3669
- handleChange = (ev) => {
3670
- const input = ev.target;
3671
- this.value = input.value;
3672
- this.leChange.emit({
3673
- value: this.value,
3674
- name: this.name,
3675
- externalId: this.externalId,
3676
- });
3677
- };
3678
- handleClick = (ev) => {
3679
- ev.stopPropagation();
3680
- };
3681
- render() {
3682
- return (h("le-component", { key: '385fe7607d573ab4cfe81315f74e650f8e57faa1', component: "le-string-input", hostClass: classnames({ disabled: this.disabled }) }, h("div", { key: 'a36c5a32238eb6c9c574aeb3955343e042d89225', class: "le-input-wrapper" }, this.label && (h("label", { key: 'c1ff01932ada19ecea0cd2e2b477615d0c873ff0', class: "le-input-label", htmlFor: this.name }, this.label)), h("div", { key: '7c8909ed5e4e3404a2900a3f9beef8b0f331d62c', class: "le-input-container", part: "container" }, this.iconStart && h("span", { key: 'cf7e7355e22de3100bade2399ba63702731350e0', class: "icon-start" }, this.iconStart), h("input", { key: '6d71245d395f6cd2c55110ca902fc0374c74026b', ref: el => {
3683
- if (this.inputRef) {
3684
- this.inputRef(el);
3685
- }
3686
- }, id: this.name, type: this.type, name: this.name, value: this.value, placeholder: this.placeholder, disabled: this.disabled, readOnly: this.readonly, onInput: this.handleInput, onChange: this.handleChange, onClick: this.handleClick }), this.iconEnd && h("span", { key: 'e086f9559b086212be3cd231b7c870cdb229a733', class: "icon-end" }, this.iconEnd)), !this.hideDescription && (h("div", { key: '531ac78b43382166023a79475152345956188bcc', class: "le-input-description" }, h("le-slot", { key: '38700e86adc0c3bf049b0ad828d14993ddef7844', name: "description", type: "text", tag: "p", label: "Description" }, h("slot", { key: 'c2982e93304a872ec79446fe525eb5448e764401', name: "description" })))))));
3687
- }
3688
- };
3689
- LeStringInput.style = leStringInputCss();
3690
-
3691
- export { LeBar as le_bar, LeButton as le_button, LeCheckbox as le_checkbox, LeCollapse as le_collapse, LeComponent as le_component, LeCurrentHeading as le_current_heading, LeDropdownBase as le_dropdown_base, LeHeader as le_header, LeIcon as le_icon, LeNavigation as le_navigation, LePopover as le_popover, LePopup as le_popup, LeScrollProgress as le_scroll_progress, LeSelect as le_select, LeSlot as le_slot, LeStringInput as le_string_input };
3692
- //# sourceMappingURL=le-bar.le-button.le-checkbox.le-collapse.le-component.le-current-heading.le-dropdown-base.le-header.le-icon.le-navigation.le-popover.le-popup.le-scroll-progress.le-select.le-slot.le-string-input.entry.js.map