@aceshooting/lyra-ui 32.0.0 → 32.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (419) hide show
  1. package/CHANGELOG.md +203 -0
  2. package/README.md +24 -6
  3. package/design-tokens.json +1 -1
  4. package/dist/all.d.ts +1 -1
  5. package/dist/all.js +1 -1
  6. package/dist/autoloader.d.ts +10 -0
  7. package/dist/autoloader.js +1 -1
  8. package/dist/cli/migrate-wa.mjs +45 -37
  9. package/dist/cli/migration-contract.json.gz +0 -0
  10. package/dist/components/agent-tools/budget-meter/budget-meter.class.d.ts +1 -0
  11. package/dist/components/agent-tools/budget-meter/budget-meter.styles.js +1 -1
  12. package/dist/components/charts/chart/box-plot.class.d.ts +3 -0
  13. package/dist/components/charts/chart/chart-band.js +1 -1
  14. package/dist/components/charts/chart/chart-input-projection.js +1 -1
  15. package/dist/components/charts/chart/chart-surface.styles.js +1 -1
  16. package/dist/components/charts/chart/chart-types.d.ts +16 -2
  17. package/dist/components/charts/chart/chart.class.d.ts +4 -1
  18. package/dist/components/charts/chart/chart.class.js +3 -3
  19. package/dist/components/charts/chart/lite-chart.class.d.ts +3 -0
  20. package/dist/components/charts/chart/lite-chart.styles.js +1 -1
  21. package/dist/components/conversation/code-block/code-block-base.class.d.ts +29 -3
  22. package/dist/components/conversation/code-block/code-block-base.class.js +1 -1
  23. package/dist/components/conversation/code-block/code-block-core.class.d.ts +46 -2
  24. package/dist/components/conversation/code-block/code-block-core.class.js +1 -1
  25. package/dist/components/conversation/code-block/code-block-shared.d.ts +6 -2
  26. package/dist/components/conversation/code-block/code-block-shared.js +5 -4
  27. package/dist/components/conversation/code-block/code-block.class.d.ts +45 -1
  28. package/dist/components/conversation/code-block/code-block.class.js +1 -1
  29. package/dist/components/conversation/code-block/code-block.styles.js +1 -1
  30. package/dist/components/conversation/markdown/markdown-core.class.d.ts +12 -0
  31. package/dist/components/conversation/markdown/markdown.class.d.ts +12 -0
  32. package/dist/components/conversation/markdown/markdown.styles.js +1 -1
  33. package/dist/components/conversation/model-select/model-select.class.d.ts +6 -0
  34. package/dist/components/conversation/suggestion-chips/suggestion-chips.class.d.ts +1 -0
  35. package/dist/components/conversation/suggestion-chips/suggestion-chips.styles.js +1 -1
  36. package/dist/components/conversation/thread-list/thread-list.class.d.ts +3 -0
  37. package/dist/components/conversation/thread-list/thread-list.styles.js +1 -1
  38. package/dist/components/conversation/voice-picker/voice-picker.class.d.ts +6 -0
  39. package/dist/components/data/graph-query-builder/graph-query-builder.class.d.ts +4 -0
  40. package/dist/components/data/heatmap/heatmap.class.d.ts +21 -2
  41. package/dist/components/data/heatmap/heatmap.class.js +2 -2
  42. package/dist/components/data/heatmap/heatmap.styles.js +1 -1
  43. package/dist/components/data/stat/stat.class.d.ts +24 -1
  44. package/dist/components/data/stat/stat.class.js +2 -2
  45. package/dist/components/data/stat/stat.styles.js +1 -1
  46. package/dist/components/data/table/table-row-attributes.js +1 -0
  47. package/dist/components/data/table/table-support.d.ts +65 -5
  48. package/dist/components/data/table/table-support.js +1 -1
  49. package/dist/components/data/table/table.class.d.ts +77 -7
  50. package/dist/components/data/table/table.class.js +10 -10
  51. package/dist/components/data/table/table.styles.js +1 -1
  52. package/dist/components/data/timeline/timeline-item.class.d.ts +27 -5
  53. package/dist/components/data/timeline/timeline-item.class.js +11 -7
  54. package/dist/components/data/timeline/timeline-item.styles.js +1 -1
  55. package/dist/components/data/timeline/timeline.class.d.ts +40 -5
  56. package/dist/components/data/timeline/timeline.class.js +11 -7
  57. package/dist/components/data/timeline/timeline.styles.js +1 -1
  58. package/dist/components/data/tree/tree-item.class.d.ts +2 -0
  59. package/dist/components/data/tree/tree-item.class.js +2 -2
  60. package/dist/components/data/tree/tree-item.styles.js +1 -1
  61. package/dist/components/forms/button/button.class.d.ts +13 -0
  62. package/dist/components/forms/button/button.styles.js +1 -1
  63. package/dist/components/forms/checkbox-group/checkbox-group.class.d.ts +29 -2
  64. package/dist/components/forms/checkbox-group/checkbox-group.class.js +3 -3
  65. package/dist/components/forms/checkbox-group/checkbox-group.styles.js +1 -1
  66. package/dist/components/forms/code-editor/code-editor.class.d.ts +6 -0
  67. package/dist/components/forms/color-picker/color-picker.class.d.ts +9 -0
  68. package/dist/components/forms/color-picker/color-picker.class.js +3 -3
  69. package/dist/components/forms/color-picker/color-picker.styles.js +1 -1
  70. package/dist/components/forms/combobox/combobox.class.d.ts +114 -7
  71. package/dist/components/forms/combobox/combobox.class.js +9 -7
  72. package/dist/components/forms/combobox/combobox.styles.js +1 -1
  73. package/dist/components/forms/country-picker/country-picker.class.d.ts +2 -0
  74. package/dist/components/forms/currency-picker/currency-picker.class.d.ts +2 -0
  75. package/dist/components/forms/date-picker/date-input.class.d.ts +41 -0
  76. package/dist/components/forms/date-picker/date-input.class.js +2 -2
  77. package/dist/components/forms/date-picker/date-input.styles.js +1 -1
  78. package/dist/components/forms/emoji-picker/emoji-picker.class.d.ts +4 -0
  79. package/dist/components/forms/icon-button/icon-button.styles.js +1 -1
  80. package/dist/components/forms/input/input-shared.d.ts +12 -0
  81. package/dist/components/forms/input/input.styles.js +1 -1
  82. package/dist/components/forms/input/time-input.class.d.ts +6 -0
  83. package/dist/components/forms/input/time-input.styles.js +1 -1
  84. package/dist/components/forms/locale-picker/locale-picker.class.d.ts +11 -0
  85. package/dist/components/forms/locale-picker/locale-picker.styles.js +1 -1
  86. package/dist/components/forms/otp-input/otp-input.class.d.ts +6 -0
  87. package/dist/components/forms/phone-input/phone-input.class.d.ts +6 -0
  88. package/dist/components/forms/phone-input/phone-input.styles.js +1 -1
  89. package/dist/components/forms/radio/radio-group.class.d.ts +24 -2
  90. package/dist/components/forms/radio/radio-group.class.js +2 -2
  91. package/dist/components/forms/radio/radio-group.styles.js +1 -1
  92. package/dist/components/forms/rubric-form/rubric-form.class.d.ts +4 -0
  93. package/dist/components/forms/select/select.class.d.ts +13 -0
  94. package/dist/components/forms/select/select.class.js +1 -1
  95. package/dist/components/forms/select/select.styles.js +1 -1
  96. package/dist/components/forms/signature-pad/signature-pad.class.d.ts +6 -0
  97. package/dist/components/forms/signature-pad/signature-pad.styles.js +1 -1
  98. package/dist/components/forms/slider/slider.class.d.ts +28 -2
  99. package/dist/components/forms/slider/slider.class.js +3 -3
  100. package/dist/components/forms/slider/slider.styles.js +1 -1
  101. package/dist/components/forms/switch/switch.class.d.ts +2 -0
  102. package/dist/components/forms/switch/switch.styles.js +1 -1
  103. package/dist/components/forms/textarea/textarea.class.d.ts +8 -0
  104. package/dist/components/forms/textarea/textarea.styles.js +1 -1
  105. package/dist/components/forms/time-zone-picker/time-zone-picker.class.d.ts +2 -0
  106. package/dist/components/forms/token-input/token-input.class.d.ts +96 -18
  107. package/dist/components/forms/token-input/token-input.class.js +11 -8
  108. package/dist/components/forms/token-input/token-input.styles.js +1 -1
  109. package/dist/components/forms/unit-picker/unit-picker.class.d.ts +2 -0
  110. package/dist/components/layout/app-rail/app-rail.class.d.ts +3 -0
  111. package/dist/components/layout/app-rail/app-rail.styles.js +1 -1
  112. package/dist/components/layout/button-group/button-group.class.d.ts +4 -0
  113. package/dist/components/layout/button-group/button-group.class.js +1 -1
  114. package/dist/components/layout/card/card.class.d.ts +15 -1
  115. package/dist/components/layout/card/card.styles.js +1 -1
  116. package/dist/components/layout/details/details.class.d.ts +6 -0
  117. package/dist/components/layout/details/details.styles.js +1 -1
  118. package/dist/components/layout/filter-bar/filter-bar.class.d.ts +6 -0
  119. package/dist/components/layout/filter-bar/filter-bar.styles.js +1 -1
  120. package/dist/components/layout/index.d.ts +1 -1
  121. package/dist/components/layout/index.js +1 -1
  122. package/dist/components/layout/menu/dropdown-item.class.d.ts +8 -2
  123. package/dist/components/layout/menu/dropdown-item.class.js +1 -1
  124. package/dist/components/layout/menu/menu-item.class.d.ts +7 -0
  125. package/dist/components/layout/menu/menu-item.styles.js +1 -1
  126. package/dist/components/layout/menu/menu-label.class.d.ts +5 -0
  127. package/dist/components/layout/menu/menu-label.class.js +1 -1
  128. package/dist/components/layout/menu/menu.class.d.ts +3 -0
  129. package/dist/components/layout/menu/menu.styles.js +1 -1
  130. package/dist/components/layout/page/page.class.d.ts +9 -1
  131. package/dist/components/layout/page/page.class.js +2 -2
  132. package/dist/components/layout/segmented/segmented.class.d.ts +22 -3
  133. package/dist/components/layout/segmented/segmented.class.js +3 -4
  134. package/dist/components/layout/segmented/segmented.styles.js +1 -1
  135. package/dist/components/layout/stepper/step.class.d.ts +89 -0
  136. package/dist/components/layout/stepper/step.class.js +18 -0
  137. package/dist/components/layout/stepper/step.styles.js +1 -0
  138. package/dist/components/layout/stepper/stepper.class.d.ts +106 -13
  139. package/dist/components/layout/stepper/stepper.class.js +6 -2
  140. package/dist/components/layout/stepper/stepper.styles.js +1 -1
  141. package/dist/components/layout/tab-group/tab-group.class.d.ts +10 -1
  142. package/dist/components/layout/tab-group/tab-group.class.js +1 -1
  143. package/dist/components/layout/tab-group/tab-group.styles.js +1 -1
  144. package/dist/components/layout/tab-group/tab-panel.class.d.ts +1 -0
  145. package/dist/components/layout/tab-group/tab-panel.class.js +1 -1
  146. package/dist/components/layout/tab-group/tab.class.d.ts +4 -0
  147. package/dist/components/layout/widget/widget.class.d.ts +1 -0
  148. package/dist/components/layout/widget/widget.styles.js +1 -1
  149. package/dist/components/lr-code-block-core.d.ts +1 -1
  150. package/dist/components/lr-code-block.d.ts +1 -1
  151. package/dist/components/lr-counter.d.ts +1 -0
  152. package/dist/components/lr-counter.js +1 -0
  153. package/dist/components/lr-lightbox-item.d.ts +1 -0
  154. package/dist/components/lr-lightbox-item.js +1 -0
  155. package/dist/components/lr-lightbox.d.ts +1 -1
  156. package/dist/components/lr-lightbox.js +1 -1
  157. package/dist/components/lr-number-ticker.d.ts +1 -0
  158. package/dist/components/lr-number-ticker.js +1 -0
  159. package/dist/components/lr-step.d.ts +1 -0
  160. package/dist/components/lr-step.js +1 -0
  161. package/dist/components/media/file-input/file-input.class.d.ts +7 -1
  162. package/dist/components/media/file-input/file-input.class.js +2 -2
  163. package/dist/components/media/file-input/file-input.styles.js +1 -1
  164. package/dist/components/media/index.d.ts +1 -1
  165. package/dist/components/media/index.js +1 -1
  166. package/dist/components/media/lightbox/lightbox-item.class.d.ts +57 -0
  167. package/dist/components/media/lightbox/lightbox-item.class.js +9 -0
  168. package/dist/components/media/lightbox/lightbox-item.styles.js +1 -0
  169. package/dist/components/media/lightbox/lightbox.class.d.ts +90 -20
  170. package/dist/components/media/lightbox/lightbox.class.js +17 -12
  171. package/dist/components/media/lightbox/lightbox.styles.js +1 -1
  172. package/dist/components/media/map/map-anchor-avoid.js +1 -1
  173. package/dist/components/media/map/map-drawing-controller.js +1 -1
  174. package/dist/components/media/map/map.class.d.ts +137 -7
  175. package/dist/components/media/map/map.class.js +6 -6
  176. package/dist/components/media/map/map.styles.js +1 -1
  177. package/dist/components/media/sequence-playback/sequence-playback.class.d.ts +9 -0
  178. package/dist/components/media/sequence-playback/sequence-playback.class.js +2 -2
  179. package/dist/components/media/sequence-playback/sequence-playback.styles.js +1 -1
  180. package/dist/components/media/video/video.class.d.ts +4 -0
  181. package/dist/components/media/video/video.class.js +2 -2
  182. package/dist/components/media/video/video.styles.js +1 -1
  183. package/dist/components/media/zoomable-frame/zoomable-frame.class.d.ts +15 -0
  184. package/dist/components/media/zoomable-frame/zoomable-frame.class.js +2 -2
  185. package/dist/components/overlays/badge/badge.class.d.ts +2 -0
  186. package/dist/components/overlays/badge/badge.styles.js +1 -1
  187. package/dist/components/overlays/badge/tag.class.d.ts +2 -0
  188. package/dist/components/overlays/badge/tag.class.js +1 -1
  189. package/dist/components/overlays/chip/chip-group.class.d.ts +31 -4
  190. package/dist/components/overlays/chip/chip-group.class.js +3 -3
  191. package/dist/components/overlays/context-menu/context-menu.class.d.ts +5 -0
  192. package/dist/components/overlays/context-menu/context-menu.class.js +1 -1
  193. package/dist/components/overlays/dialog/dialog.class.d.ts +36 -4
  194. package/dist/components/overlays/dialog/dialog.class.js +3 -3
  195. package/dist/components/overlays/dialog/dialog.styles.js +1 -1
  196. package/dist/components/overlays/dialog/prompt.d.ts +60 -0
  197. package/dist/components/overlays/dialog/prompt.js +1 -0
  198. package/dist/components/overlays/drawer/drawer.class.d.ts +16 -1
  199. package/dist/components/overlays/drawer/drawer.class.js +1 -1
  200. package/dist/components/overlays/empty/empty.class.d.ts +1 -0
  201. package/dist/components/overlays/empty/empty.class.js +1 -1
  202. package/dist/components/overlays/overlay/dropdown.class.d.ts +4 -0
  203. package/dist/components/overlays/overlay/dropdown.class.js +1 -1
  204. package/dist/components/overlays/overlay/overlay.styles.js +1 -1
  205. package/dist/components/overlays/overlay/popover.class.d.ts +29 -3
  206. package/dist/components/overlays/overlay/popover.class.js +2 -2
  207. package/dist/components/overlays/overlay/tooltip.class.d.ts +2 -0
  208. package/dist/components/overlays/overlay/tooltip.class.js +2 -2
  209. package/dist/components/overlays/toast/toast-item.class.d.ts +1 -0
  210. package/dist/components/overlays/toast/toast-item.class.js +1 -1
  211. package/dist/components/overlays/toast/toast-item.styles.js +1 -1
  212. package/dist/components/overlays/toast/toast.class.d.ts +6 -0
  213. package/dist/components/overlays/toast/toast.class.js +1 -1
  214. package/dist/components/utility/copy-button/copy-button.class.d.ts +2 -0
  215. package/dist/components/utility/copy-button/copy-button.class.js +2 -2
  216. package/dist/components/utility/counter/counter-time.d.ts +15 -0
  217. package/dist/components/utility/counter/counter-time.js +1 -0
  218. package/dist/components/utility/counter/counter.class.d.ts +67 -0
  219. package/dist/components/utility/counter/counter.class.js +1 -0
  220. package/dist/components/utility/counter/counter.styles.js +1 -0
  221. package/dist/components/utility/divider/divider.class.d.ts +21 -3
  222. package/dist/components/utility/divider/divider.class.js +5 -1
  223. package/dist/components/utility/export-button/export-button.class.d.ts +5 -0
  224. package/dist/components/utility/export-button/export-button.styles.js +1 -1
  225. package/dist/components/utility/icon/icon-library.d.ts +14 -1
  226. package/dist/components/utility/icon/icon-library.js +1 -1
  227. package/dist/components/utility/icon/icon-sprite.js +1 -0
  228. package/dist/components/utility/icon/icon.class.d.ts +4 -2
  229. package/dist/components/utility/icon/icon.class.js +2 -2
  230. package/dist/components/utility/index.d.ts +1 -1
  231. package/dist/components/utility/index.js +1 -1
  232. package/dist/components/utility/known-date/known-date.class.d.ts +4 -0
  233. package/dist/components/utility/number-ticker/number-ticker.class.d.ts +58 -0
  234. package/dist/components/utility/number-ticker/number-ticker.class.js +1 -0
  235. package/dist/components/utility/number-ticker/number-ticker.styles.js +1 -0
  236. package/dist/components/viewers/include/include.class.d.ts +4 -1
  237. package/dist/components/viewers/include/include.class.js +1 -1
  238. package/dist/components/viewers/pdf-viewer/pdf-viewer.class.d.ts +10 -1
  239. package/dist/components/viewers/pdf-viewer/pdf-viewer.class.js +2 -2
  240. package/dist/components/viewers/pdf-viewer/pdf-viewer.styles.js +1 -1
  241. package/dist/custom-elements-jsx.d.ts +1 -1
  242. package/dist/event-classes.d.ts +2342 -0
  243. package/dist/event-classes.js +1 -0
  244. package/dist/events.d.ts +48 -22
  245. package/dist/framework-types.d.ts +2 -2
  246. package/dist/internal/all-defined-arguments.d.ts +19 -0
  247. package/dist/internal/all-defined-arguments.js +1 -0
  248. package/dist/internal/autoloader-tags.d.ts +1 -1
  249. package/dist/internal/autoloader-tags.js +1 -1
  250. package/dist/internal/checked-control-label.js +1 -1
  251. package/dist/internal/component-loaders.generated.js +1 -1
  252. package/dist/internal/dedent.js +7 -0
  253. package/dist/internal/default-strings/forms.generated.js +1 -1
  254. package/dist/internal/default-strings/layout.generated.js +1 -1
  255. package/dist/internal/dev-mode-attribute-warning.development.js +1 -1
  256. package/dist/internal/document-tokens.generated.js +3 -3
  257. package/dist/internal/form-control/chrome.styles.js +1 -1
  258. package/dist/internal/form-control.styles.js +1 -1
  259. package/dist/internal/interactive-control.styles.js +2 -2
  260. package/dist/internal/labeled-group.js +1 -1
  261. package/dist/internal/localization-runtime.d.ts +5 -0
  262. package/dist/internal/localization-runtime.js +1 -1
  263. package/dist/internal/localization-types.d.ts +1 -1
  264. package/dist/internal/localization.js +2 -2
  265. package/dist/internal/lyra-element.js +2 -2
  266. package/dist/internal/lyra-event.d.ts +22 -0
  267. package/dist/internal/lyra-event.js +1 -0
  268. package/dist/internal/overlay-shared.d.ts +5 -2
  269. package/dist/internal/overlay-shared.js +1 -1
  270. package/dist/internal/package-metadata.js +1 -1
  271. package/dist/internal/root-registration-allowlist.js +1 -1
  272. package/dist/internal/scoped-definitions.generated.js +1 -1
  273. package/dist/internal/shiki/core.d.ts +4 -1
  274. package/dist/internal/shiki/tokenize.js +1 -1
  275. package/dist/internal/srcset.js +1 -0
  276. package/dist/lyra.d.ts +1 -1
  277. package/dist/lyra.js +1 -1
  278. package/dist/ssr/all.d.ts +1 -1
  279. package/dist/ssr/all.js +1 -1
  280. package/dist/ssr.d.ts +5 -5
  281. package/dist/ssr.js +1 -1
  282. package/dist/styles/native.css +1 -1
  283. package/dist/styles/palette.css +1 -0
  284. package/dist/styles/tokens-root.css +1 -1
  285. package/dist/styles/utilities.css +1 -1
  286. package/dist/svelte.d.ts +1 -1
  287. package/dist/testing/happy-dom-shims.d.ts +11 -2
  288. package/dist/testing/happy-dom-shims.js +1 -1
  289. package/dist/testing/index.d.ts +1 -1
  290. package/dist/testing/index.js +1 -1
  291. package/dist/testing/lyra-tag-event-map.d.ts +2 -2
  292. package/dist/testing/lyra-tag-event-map.js +1 -1
  293. package/dist/theme-core.css +1 -1
  294. package/dist/theme.css +1 -1
  295. package/dist/utilities/defined.d.ts +10 -1
  296. package/dist/utilities/defined.js +1 -1
  297. package/dist/utilities/form.d.ts +9 -0
  298. package/dist/utilities/form.js +1 -0
  299. package/dist/utilities/index.d.ts +1 -1
  300. package/dist/utilities/index.js +1 -1
  301. package/dist/vue.d.ts +1 -1
  302. package/llms/components/lr-app-rail.md +4 -2
  303. package/llms/components/lr-badge.md +4 -4
  304. package/llms/components/lr-bar-chart.md +1 -1
  305. package/llms/components/lr-box-plot.md +6 -1
  306. package/llms/components/lr-bubble-chart.md +1 -1
  307. package/llms/components/lr-budget-meter.md +2 -2
  308. package/llms/components/lr-button-group.md +7 -3
  309. package/llms/components/lr-button.md +11 -1
  310. package/llms/components/lr-card.md +11 -1
  311. package/llms/components/lr-chart.md +21 -7
  312. package/llms/components/lr-checkbox-group.md +11 -1
  313. package/llms/components/lr-chip.md +11 -1
  314. package/llms/components/lr-code-block-core.md +36 -8
  315. package/llms/components/lr-code-block.md +45 -6
  316. package/llms/components/lr-code-editor.md +11 -1
  317. package/llms/components/lr-color-picker.md +17 -4
  318. package/llms/components/lr-combobox.md +62 -6
  319. package/llms/components/lr-context-menu.md +5 -3
  320. package/llms/components/lr-copy-button.md +2 -1
  321. package/llms/components/lr-counter.md +60 -0
  322. package/llms/components/lr-country-picker.md +5 -1
  323. package/llms/components/lr-currency-picker.md +5 -1
  324. package/llms/components/lr-date-input.md +1 -1
  325. package/llms/components/lr-date-picker.md +25 -1
  326. package/llms/components/lr-details.md +6 -2
  327. package/llms/components/lr-dialog.md +72 -8
  328. package/llms/components/lr-divider.md +14 -5
  329. package/llms/components/lr-doughnut-chart.md +1 -1
  330. package/llms/components/lr-drawer.md +26 -7
  331. package/llms/components/lr-dropdown-item.md +1 -1
  332. package/llms/components/lr-dropdown.md +8 -4
  333. package/llms/components/lr-emoji-picker.md +10 -1
  334. package/llms/components/lr-empty.md +3 -2
  335. package/llms/components/lr-export-button.md +5 -2
  336. package/llms/components/lr-file-input.md +13 -1
  337. package/llms/components/lr-filter-bar.md +6 -2
  338. package/llms/components/lr-graph-query-builder.md +10 -1
  339. package/llms/components/lr-heatmap.md +20 -3
  340. package/llms/components/lr-histogram.md +7 -2
  341. package/llms/components/lr-icon-button.md +3 -1
  342. package/llms/components/lr-icon.md +8 -0
  343. package/llms/components/lr-include.md +3 -0
  344. package/llms/components/lr-input.md +9 -1
  345. package/llms/components/lr-known-date.md +10 -1
  346. package/llms/components/lr-lightbox-item.md +14 -0
  347. package/llms/components/lr-lightbox.md +84 -5
  348. package/llms/components/lr-line-chart.md +7 -2
  349. package/llms/components/lr-lite-chart.md +3 -2
  350. package/llms/components/lr-locale-picker.md +17 -1
  351. package/llms/components/lr-map.md +122 -11
  352. package/llms/components/lr-markdown-core.md +15 -4
  353. package/llms/components/lr-markdown.md +13 -4
  354. package/llms/components/lr-menu-item.md +1 -1
  355. package/llms/components/lr-menu-label.md +5 -2
  356. package/llms/components/lr-menu.md +21 -6
  357. package/llms/components/lr-model-select.md +11 -1
  358. package/llms/components/lr-native-time-input.md +11 -1
  359. package/llms/components/lr-number-input.md +11 -1
  360. package/llms/components/lr-number-ticker.md +55 -0
  361. package/llms/components/lr-otp-input.md +11 -1
  362. package/llms/components/lr-page.md +7 -1
  363. package/llms/components/lr-pagination.md +18 -0
  364. package/llms/components/lr-pdf-viewer.md +6 -1
  365. package/llms/components/lr-phone-input.md +11 -1
  366. package/llms/components/lr-pie-chart.md +1 -1
  367. package/llms/components/lr-polar-area-chart.md +1 -1
  368. package/llms/components/lr-popover.md +25 -5
  369. package/llms/components/lr-radar-chart.md +1 -1
  370. package/llms/components/lr-radio-group.md +11 -1
  371. package/llms/components/lr-rubric-form.md +7 -1
  372. package/llms/components/lr-scatter-chart.md +1 -1
  373. package/llms/components/lr-segmented.md +20 -2
  374. package/llms/components/lr-select.md +10 -2
  375. package/llms/components/lr-sequence-playback.md +8 -2
  376. package/llms/components/lr-signature-pad.md +8 -1
  377. package/llms/components/lr-slider.md +17 -4
  378. package/llms/components/lr-stat.md +20 -5
  379. package/llms/components/lr-step.md +61 -0
  380. package/llms/components/lr-stepper.md +64 -8
  381. package/llms/components/lr-suggestion-chips.md +3 -2
  382. package/llms/components/lr-switch.md +4 -3
  383. package/llms/components/lr-tab-group.md +10 -3
  384. package/llms/components/lr-tab-panel.md +2 -2
  385. package/llms/components/lr-table.md +87 -8
  386. package/llms/components/lr-tag.md +1 -1
  387. package/llms/components/lr-textarea.md +17 -1
  388. package/llms/components/lr-thread-list.md +4 -2
  389. package/llms/components/lr-time-input.md +8 -1
  390. package/llms/components/lr-time-zone-picker.md +5 -1
  391. package/llms/components/lr-timeline-item.md +1 -1
  392. package/llms/components/lr-timeline.md +38 -1
  393. package/llms/components/lr-toast-item.md +1 -1
  394. package/llms/components/lr-toast.md +7 -2
  395. package/llms/components/lr-token-input.md +64 -8
  396. package/llms/components/lr-tooltip.md +3 -3
  397. package/llms/components/lr-tree-item.md +1 -1
  398. package/llms/components/lr-tree.md +2 -1
  399. package/llms/components/lr-unit-picker.md +5 -1
  400. package/llms/components/lr-video.md +5 -4
  401. package/llms/components/lr-voice-picker.md +8 -1
  402. package/llms/components/lr-widget.md +2 -2
  403. package/llms/components/lr-zoomable-frame.md +8 -0
  404. package/llms/index.md +145 -141
  405. package/llms/migration.md +20 -12
  406. package/llms/peers.md +2 -2
  407. package/llms/shared/events-and-types.md +36 -0
  408. package/llms/shared/imports-and-registration.md +60 -1
  409. package/llms/shared/native-styles-and-utilities.md +109 -3
  410. package/llms/shared/styles-and-tokens.md +2 -2
  411. package/llms/shared/testing-and-utilities.md +21 -0
  412. package/llms/shared.md +227 -6
  413. package/llms/tokens.md +6 -1
  414. package/llms.txt +3 -3
  415. package/locales.json +1 -1
  416. package/package.json +38 -9
  417. package/registrations.json +1 -1
  418. package/skills/compose-lyra-interfaces/SKILL.md +1 -1
  419. package/skills/lyra-ui/SKILL.md +1 -1
@@ -52,6 +52,16 @@ import type{PropertyValues}from'lit';import{LyraDialog}from'../dialog/dialog.cla
52
52
  * @cssprop --hide-duration - Closing slide duration.
53
53
  * @cssprop --lr-drawer-width - Inline size for start/end drawers.
54
54
  * @cssprop --lr-drawer-height - Block size for top/bottom drawers.
55
+ * @cssprop [--lr-drawer-panel-bg=var(--lr-dialog-panel-bg)] - Fill of this drawer's panel only.
56
+ * Wins over the inherited `--lr-dialog-panel-bg`; neither reaches popups opened inside the
57
+ * drawer, unlike `--lr-overlay-surface`.
58
+ * @cssprop [--lr-drawer-radius=0] - Corner radius of the panel. Square by default; `floating`
59
+ * changes the default to `--lr-overlay-radius`, and an explicit value here wins either way.
60
+ * @cssprop [--lr-drawer-inset=var(--lr-space-s)] - Gap between a `floating` panel and the viewport
61
+ * (or, with `contained`, its containing block) on every side. The device safe-area insets still
62
+ * win wherever they are larger. Ignored unless `floating` is set.
63
+ * @cssprop [--lr-overlay-radius=var(--lr-radius)] - Shared floating-surface corner
64
+ * radius, read by the panel only when `floating` is set.
55
65
  * @cssprop [--lr-drawer-enter-x=calc(-1 * var(--lr-size-1rem))] - Horizontal offset the panel
56
66
  * slides in from, and back out to, for start/end drawers. Its private default changes per
57
67
  * placement (and flips under RTL); an inherited or direct public value remains authoritative.
@@ -67,6 +77,11 @@ export declare class LyraDrawer extends LyraDialog{static styles:(import("lit").
67
77
  placement:LyraDrawerPlacement;
68
78
  /** Positions inside the nearest containing block without modal inerting, focus trapping,
69
79
  * scroll locking, top-layer promotion, backdrop, or Escape dismissal. */
70
- contained:boolean;protected get modalSurface():boolean;
80
+ contained:boolean;
81
+ /** Detaches the panel from the viewport edges as an inset, floating sheet: a
82
+ * `--lr-drawer-inset` gap on every side (default `var(--lr-space-s)`) and corners rounded with
83
+ * `--lr-overlay-radius`. Off by default, so the drawer stays square and edge-flush. Combines
84
+ * with `contained`, where the gap is measured from the containing block. */
85
+ floating:boolean;protected get modalSurface():boolean;
71
86
  /** A mapped drawer's hide request is cancelable on every path, including external removal.*/
72
87
  protected get disconnectHideCancelable():boolean;protected panelAnimationName(showing:boolean):string;protected overlayAnimationName(showing:boolean):string;protected panelAnimationSpec(showing:boolean):RegisteredAnimationSpec;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;}declare global{interface HTMLElementTagNameMap{'lr-drawer':LyraDrawer;}}
@@ -1 +1 @@
1
- import{__decorate}from"tslib";import{declaredDefaultConverter}from"../../../internal/converters.js";import{property}from"lit/decorators.js";import{LyraDialog}from"../dialog/dialog.class.js";import{css as lyraStaticStyleCss}from"lit";const styles=lyraStaticStyleCss`:host{justify-content:flex-start;align-items:stretch;padding:0}:host([contained]){pointer-events:none;position:absolute}:host([contained]:not([data-closing])) [part~=panel]{pointer-events:auto}:host([contained]) [part~=backdrop]{display:none}:host(:is([placement=end],:not([placement]))){justify-content:flex-end}:host([placement=top]){justify-content:stretch;align-items:flex-start}:host([placement=bottom]){justify-content:stretch;align-items:flex-end}[part~=panel]{inline-size:min(var(--size,var(--lr-drawer-width,var(--width,var(--lr-dialog-width,var(--lr-size-24rem))))),100%);block-size:100%;max-inline-size:min(var(--lr-dialog-max-width,var(--_lr-dialog-max-width)),100%);max-block-size:100%;box-shadow:var(--lr-overlay-shadow-modal,var(--lr-shadow-l));border-radius:0}:host([placement=top]) [part~=panel],:host([placement=bottom]) [part~=panel]{inline-size:100%;block-size:min(var(--size,var(--lr-drawer-height,var(--lr-size-24rem))),100%);max-block-size:100%;max-inline-size:100%}:host(:not([contained])) [part~=panel]{box-sizing:border-box;padding-block:var(--lr-safe-area-top) var(--lr-safe-area-bottom)}:host(:not([contained]):is([placement=end],:not([placement]))) [part~=panel]{padding-inline-end:var(--lr-safe-area-inline-end)}:host(:not([contained])[placement=start]) [part~=panel]{padding-inline-start:var(--lr-safe-area-inline-start)}:host(:not([contained]):is([placement=top],[placement=bottom])) [part~=panel]{padding-inline:var(--lr-safe-area-inline-start) var(--lr-safe-area-inline-end)}:host(:not([contained])[placement=top]) [part~=panel]{padding-block-end:0}:host(:not([contained])[placement=bottom]) [part~=panel]{padding-block-start:0}:host(:is([placement=end],:not([placement]))) [part~=panel],:host(:dir(rtl)) [part~=panel]{--_lr-drawer-enter-x:var(--lr-size-1rem)}:host(:dir(rtl):is([placement=end],:not([placement]))) [part~=panel]{--_lr-drawer-enter-x:calc(-1 * var(--lr-size-1rem))}:host([placement=bottom]) [part~=panel]{--_lr-drawer-enter-y:var(--lr-size-1rem)}[part=body]{flex:0 auto}`;class LyraDrawer extends LyraDialog{constructor(){super(...arguments),this.placement="end",this.contained=!1}static{this.styles=[LyraDialog.styles,styles]}get modalSurface(){return!this.contained}get disconnectHideCancelable(){return!0}panelAnimationName(showing){const placement=`${this.placement.charAt(0).toUpperCase()}${this.placement.slice(1)}`;return`drawer.${showing?"show":"hide"}${placement}`}overlayAnimationName(showing){return showing?"drawer.overlay.show":"drawer.overlay.hide"}panelAnimationSpec(showing){const block=this.placement==="top"||this.placement==="bottom",offset=block?"translateY(var(--lr-drawer-enter-y, var(--_lr-drawer-enter-y, calc(-1 * var(--lr-size-1rem)))))":"translateX(var(--lr-drawer-enter-x, var(--_lr-drawer-enter-x, calc(-1 * var(--lr-size-1rem)))))",resting=block?"translateY(0)":"translateX(0)",keyframes=showing?[{opacity:0,transform:offset},{opacity:1,transform:resting}]:[{opacity:1,transform:resting},{opacity:0,transform:offset}];return{keyframes,rtlKeyframes:keyframes,durationProperties:[showing?"--show-duration":"--hide-duration","--lr-dialog-panel-duration","--lr-duration-base"],easingProperties:["--lr-easing-standard"]}}willUpdate(changed){super.willUpdate(changed),!(!changed.has("contained")||!this.open)&&(this.modalSurface&&this.isConnected?this.activateOverlay():(this.deactivateOverlay({restoreFocus:!1}),this.leaveTopLayer()))}updated(changed){super.updated(changed),changed.has("contained")&&this.open&&this.isConnected&&this.modalSurface&&(this.enterTopLayer(),this.focusInitial())}}__decorate([property({reflect:!0,converter:declaredDefaultConverter("end")})],LyraDrawer.prototype,"placement",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraDrawer.prototype,"contained",void 0);export{LyraDrawer};
1
+ import{__decorate}from"tslib";import{declaredDefaultConverter}from"../../../internal/converters.js";import{property}from"lit/decorators.js";import{LyraDialog}from"../dialog/dialog.class.js";import{css as lyraStaticStyleCss}from"lit";const styles=lyraStaticStyleCss`:host{justify-content:flex-start;align-items:stretch;padding:0}:host([contained]){pointer-events:none;position:absolute}:host([contained]:not([data-closing])) [part~=panel]{pointer-events:auto}:host([contained]) [part~=backdrop]{display:none}:host(:is([placement=end],:not([placement]))){justify-content:flex-end}:host([placement=top]){justify-content:stretch;align-items:flex-start}:host([placement=bottom]){justify-content:stretch;align-items:flex-end}[part~=panel]{inline-size:min(var(--size,var(--lr-drawer-width,var(--width,var(--lr-dialog-width,var(--lr-size-24rem))))),100%);block-size:100%;max-inline-size:min(var(--lr-dialog-max-width,var(--_lr-dialog-max-width)),100%);border-radius:var(--lr-drawer-radius,var(--_lr-drawer-radius,0));--_lr-dialog-panel-fill:var(--lr-drawer-panel-bg,var(--lr-dialog-panel-bg,var(--lr-overlay-surface,var(--_lr-overlay-surface,var(--lr-color-surface-container-highest)))));max-block-size:100%;box-shadow:var(--lr-overlay-shadow-modal,var(--lr-shadow-l))}:host([placement=top]) [part~=panel],:host([placement=bottom]) [part~=panel]{inline-size:100%;block-size:min(var(--size,var(--lr-drawer-height,var(--lr-size-24rem))),100%);max-block-size:100%;max-inline-size:100%}:host(:not([contained])) [part~=panel]{box-sizing:border-box;padding-block:var(--lr-safe-area-top) var(--lr-safe-area-bottom)}:host(:not([contained]):is([placement=end],:not([placement]))) [part~=panel]{padding-inline-end:var(--lr-safe-area-inline-end)}:host(:not([contained])[placement=start]) [part~=panel]{padding-inline-start:var(--lr-safe-area-inline-start)}:host(:not([contained]):is([placement=top],[placement=bottom])) [part~=panel]{padding-inline:var(--lr-safe-area-inline-start) var(--lr-safe-area-inline-end)}:host(:not([contained])[placement=top]) [part~=panel]{padding-block-end:0}:host(:not([contained])[placement=bottom]) [part~=panel]{padding-block-start:0}:host(:is([placement=end],:not([placement]))) [part~=panel],:host(:dir(rtl)) [part~=panel]{--_lr-drawer-enter-x:var(--lr-size-1rem)}:host(:dir(rtl):is([placement=end],:not([placement]))) [part~=panel]{--_lr-drawer-enter-x:calc(-1 * var(--lr-size-1rem))}:host([placement=bottom]) [part~=panel]{--_lr-drawer-enter-y:var(--lr-size-1rem)}:host([floating]){--_lr-drawer-radius:var(--lr-overlay-radius,var(--lr-radius))}:host([floating]:not([contained])){padding-block-start:max(var(--lr-drawer-inset,var(--lr-space-s)),var(--lr-safe-area-top));padding-block-end:max(var(--lr-drawer-inset,var(--lr-space-s)),var(--lr-safe-area-bottom));padding-inline-start:max(var(--lr-drawer-inset,var(--lr-space-s)),var(--lr-safe-area-inline-start));padding-inline-end:max(var(--lr-drawer-inset,var(--lr-space-s)),var(--lr-safe-area-inline-end))}:host([floating][contained]){padding:var(--lr-drawer-inset,var(--lr-space-s))}:host([floating]:not([contained])) [part~=panel]{padding:0}[part=body]{flex:0 auto}`;class LyraDrawer extends LyraDialog{constructor(){super(...arguments),this.placement="end",this.contained=!1,this.floating=!1}static{this.styles=[LyraDialog.styles,styles]}get modalSurface(){return!this.contained}get disconnectHideCancelable(){return!0}panelAnimationName(showing){const placement=`${this.placement.charAt(0).toUpperCase()}${this.placement.slice(1)}`;return`drawer.${showing?"show":"hide"}${placement}`}overlayAnimationName(showing){return showing?"drawer.overlay.show":"drawer.overlay.hide"}panelAnimationSpec(showing){const block=this.placement==="top"||this.placement==="bottom",offset=block?"translateY(var(--lr-drawer-enter-y, var(--_lr-drawer-enter-y, calc(-1 * var(--lr-size-1rem)))))":"translateX(var(--lr-drawer-enter-x, var(--_lr-drawer-enter-x, calc(-1 * var(--lr-size-1rem)))))",resting=block?"translateY(0)":"translateX(0)",keyframes=showing?[{opacity:0,transform:offset},{opacity:1,transform:resting}]:[{opacity:1,transform:resting},{opacity:0,transform:offset}];return{keyframes,rtlKeyframes:keyframes,durationProperties:[showing?"--show-duration":"--hide-duration","--lr-dialog-panel-duration","--lr-duration-base"],easingProperties:["--lr-easing-standard"]}}willUpdate(changed){super.willUpdate(changed),!(!changed.has("contained")||!this.open)&&(this.modalSurface&&this.isConnected?this.activateOverlay():(this.deactivateOverlay({restoreFocus:!1}),this.leaveTopLayer()))}updated(changed){super.updated(changed),changed.has("contained")&&this.open&&this.isConnected&&this.modalSurface&&(this.enterTopLayer(),this.focusInitial())}}__decorate([property({reflect:!0,converter:declaredDefaultConverter("end")})],LyraDrawer.prototype,"placement",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraDrawer.prototype,"contained",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraDrawer.prototype,"floating",void 0);export{LyraDrawer};
@@ -36,6 +36,7 @@ import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from
36
36
  * default density.
37
37
  * @cssprop [--lr-empty-icon-size=var(--lr-font-size-3xl)] - Font size of the icon/illustration
38
38
  * wrapper at the default density.
39
+ * @cssprop [--lr-empty-icon-color=var(--lr-color-text-quiet)] - Color of the icon/illustration glyph.
39
40
  * @cssprop [--lr-empty-compact-icon-size=var(--lr-font-size-m)] - Font size of the
40
41
  * icon/illustration wrapper at the compact density (`size="s"` and below).
41
42
  * @cssprop --lr-empty-compact-align - Cross-axis and text alignment used at the compact density
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{renderInertPresentation}from"../../../internal/inert-presentation.js";import{composedAccessibilityText,isAccessibilityVisible}from"../../../internal/accessibility-visibility.js";import{AccessibleTextController}from"../../../internal/accessible-text-controller.js";import{LyraElement}from"../../../internal/lyra-element.js";import{resolveHeadingLevel}from"../../../internal/heading-level.js";import{SlotPresenceController}from"../../../internal/slot-presence-controller.js";import{writeOptionalSize,optionalSizeConverter}from"../../../internal/variants.js";import{css as lyraStaticStyleCss}from"lit";const styles=lyraStaticStyleCss`:host{display:flex}[part=base]{box-sizing:border-box;text-align:center;align-items:center;gap:var(--lr-empty-gap,var(--lr-space-s));min-inline-size:0;max-inline-size:100%;padding:var(--lr-empty-padding,var(--lr-space-l));color:var(--lr-color-text-quiet);flex-direction:column;inline-size:100%;display:flex}:host([size="2xs"]) [part=base],:host([size=xs]) [part=base],:host([size=s]) [part=base],:host([size=small]) [part=base]{align-items:var(--lr-empty-compact-align,flex-start);text-align:var(--lr-empty-compact-align,start);padding:var(--lr-empty-compact-padding,var(--lr-space-xs));gap:var(--lr-empty-compact-gap,var(--lr-space-2xs))}[part=icon]{font-size:var(--lr-empty-icon-size,var(--lr-font-size-3xl));line-height:var(--lr-line-height-none);color:var(--lr-color-text-quiet)}:host([size="2xs"]) [part=icon],:host([size=xs]) [part=icon],:host([size=s]) [part=icon],:host([size=small]) [part=icon]{font-size:var(--lr-empty-compact-icon-size,var(--lr-font-size-m))}[part=icon][hidden]{display:none}[part=heading]{overflow-wrap:anywhere;max-inline-size:100%;font-weight:var(--lr-empty-heading-font-weight,var(--lr-font-weight-semibold));font-size:var(--lr-empty-heading-font-size);color:var(--lr-empty-heading-color,var(--lr-color-text));margin:0}[part=heading][hidden]{display:none}:host([size="2xs"]) [part=heading],:host([size=xs]) [part=heading],:host([size=s]) [part=heading],:host([size=small]) [part=heading]{font-weight:var(--lr-empty-heading-font-weight,var(--lr-font-weight-normal));font-size:var(--lr-empty-compact-font-size,var(--lr-empty-heading-font-size))}[part=description]{overflow-wrap:anywhere;max-inline-size:100%;font-size:var(--lr-font-size-md-sm);color:var(--lr-empty-description-color,var(--lr-color-text-quiet));margin:0}[part=description][hidden],[part=actions][hidden]{display:none}[part=actions]{overflow-wrap:anywhere;min-inline-size:0;max-inline-size:100%}`;class LyraEmpty extends LyraElement{constructor(){super(...arguments),this.heading="",this.headingLevel="3",this.description="",this.announce=!1,this.slotPresence=new SlotPresenceController(this),this.contentText=new AccessibleTextController(this,["heading","description"],()=>this.announceCurrentContent(),[],!0,!1,!1),this.announcements=new AnnouncementSinkController(this,{eager:["polite"]}),this.announcementsArmed=!1,this.initialContentAnnounced=!1,this.announcementGeneration=0,this.lastAnnouncementText=""}static{this.styles=[LyraElement.styles,styles]}get size(){return this._size}set size(next){writeOptionalSize(this,this._size,next,value=>{this._size=value})}connectedCallback(){super.connectedCallback(),this.announcementsArmed=!1,this.lastAnnouncementText="";const generation=++this.announcementGeneration;this.updateComplete.then(()=>{!this.isConnected||generation!==this.announcementGeneration||(this.lastAnnouncementText=this.announcementText(),this.contentText.bind(),this.announcementsArmed=!0,this.announce&&!this.initialContentAnnounced&&(this.initialContentAnnounced=!0,this.announceCurrentContent(!0)))})}disconnectedCallback(){this.announcementGeneration+=1,this.announcementsArmed=!1,this.lastAnnouncementText="",super.disconnectedCallback()}updated(changed){super.updated(changed),this.announceCurrentContent()}slotContent(name){const selector=`slot[name="${name}"]`,slot=this.shadowRoot?.querySelector(selector);return{assigned:(slot?.assignedNodes()??[]).length>0,text:(slot?.assignedNodes({flatten:!0})??[]).map(node=>composedAccessibilityText(node,{skipRootAncestorValidation:!0,requireRendered:!1})).join(" ")}}announcementText(){if(!isAccessibilityVisible(this))return"";const headingSlot=this.slotContent("heading"),descriptionSlot=this.slotContent("description");return[headingSlot.assigned?headingSlot.text:this.heading,descriptionSlot.assigned?descriptionSlot.text:this.description].join(" ").replace(/\s+/g," ").trim()}announceCurrentContent(force=!1){if(!this.announcementsArmed||!this.isConnected)return;const text=this.announcementText();!force&&text===this.lastAnnouncementText||(this.lastAnnouncementText=text,text&&this.announcements.announcePolite(text))}render(){const hasHeading=this.slotPresence.has("heading")||(this.heading??"").length>0,hasDescription=this.slotPresence.has("description")||(this.description??"").length>0,headingLevel=resolveHeadingLevel(this.headingLevel);return html`
1
+ import{__decorate}from"tslib";import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{renderInertPresentation}from"../../../internal/inert-presentation.js";import{composedAccessibilityText,isAccessibilityVisible}from"../../../internal/accessibility-visibility.js";import{AccessibleTextController}from"../../../internal/accessible-text-controller.js";import{LyraElement}from"../../../internal/lyra-element.js";import{resolveHeadingLevel}from"../../../internal/heading-level.js";import{SlotPresenceController}from"../../../internal/slot-presence-controller.js";import{writeOptionalSize,optionalSizeConverter}from"../../../internal/variants.js";import{css as lyraStaticStyleCss}from"lit";const styles=lyraStaticStyleCss`:host{display:flex}[part=base]{box-sizing:border-box;text-align:center;align-items:center;gap:var(--lr-empty-gap,var(--lr-space-s));min-inline-size:0;max-inline-size:100%;padding:var(--lr-empty-padding,var(--lr-space-l));color:var(--lr-color-text-quiet);flex-direction:column;inline-size:100%;display:flex}:host([size="2xs"]) [part=base],:host([size=xs]) [part=base],:host([size=s]) [part=base],:host([size=small]) [part=base]{align-items:var(--lr-empty-compact-align,flex-start);text-align:var(--lr-empty-compact-align,start);padding:var(--lr-empty-compact-padding,var(--lr-space-xs));gap:var(--lr-empty-compact-gap,var(--lr-space-2xs))}[part=icon]{font-size:var(--lr-empty-icon-size,var(--lr-font-size-3xl));line-height:var(--lr-line-height-none);color:var(--lr-empty-icon-color,var(--lr-color-text-quiet))}:host([size="2xs"]) [part=icon],:host([size=xs]) [part=icon],:host([size=s]) [part=icon],:host([size=small]) [part=icon]{font-size:var(--lr-empty-compact-icon-size,var(--lr-font-size-m))}[part=icon][hidden]{display:none}[part=heading]{overflow-wrap:anywhere;max-inline-size:100%;font-weight:var(--lr-empty-heading-font-weight,var(--lr-font-weight-semibold));font-size:var(--lr-empty-heading-font-size);color:var(--lr-empty-heading-color,var(--lr-color-text));margin:0}[part=heading][hidden]{display:none}:host([size="2xs"]) [part=heading],:host([size=xs]) [part=heading],:host([size=s]) [part=heading],:host([size=small]) [part=heading]{font-weight:var(--lr-empty-heading-font-weight,var(--lr-font-weight-normal));font-size:var(--lr-empty-compact-font-size,var(--lr-empty-heading-font-size))}[part=description]{overflow-wrap:anywhere;max-inline-size:100%;font-size:var(--lr-font-size-md-sm);color:var(--lr-empty-description-color,var(--lr-color-text-quiet));margin:0}[part=description][hidden],[part=actions][hidden]{display:none}[part=actions]{overflow-wrap:anywhere;min-inline-size:0;max-inline-size:100%}`;class LyraEmpty extends LyraElement{constructor(){super(...arguments),this.heading="",this.headingLevel="3",this.description="",this.announce=!1,this.slotPresence=new SlotPresenceController(this),this.contentText=new AccessibleTextController(this,["heading","description"],()=>this.announceCurrentContent(),[],!0,!1,!1),this.announcements=new AnnouncementSinkController(this,{eager:["polite"]}),this.announcementsArmed=!1,this.initialContentAnnounced=!1,this.announcementGeneration=0,this.lastAnnouncementText=""}static{this.styles=[LyraElement.styles,styles]}get size(){return this._size}set size(next){writeOptionalSize(this,this._size,next,value=>{this._size=value})}connectedCallback(){super.connectedCallback(),this.announcementsArmed=!1,this.lastAnnouncementText="";const generation=++this.announcementGeneration;this.updateComplete.then(()=>{!this.isConnected||generation!==this.announcementGeneration||(this.lastAnnouncementText=this.announcementText(),this.contentText.bind(),this.announcementsArmed=!0,this.announce&&!this.initialContentAnnounced&&(this.initialContentAnnounced=!0,this.announceCurrentContent(!0)))})}disconnectedCallback(){this.announcementGeneration+=1,this.announcementsArmed=!1,this.lastAnnouncementText="",super.disconnectedCallback()}updated(changed){super.updated(changed),this.announceCurrentContent()}slotContent(name){const selector=`slot[name="${name}"]`,slot=this.shadowRoot?.querySelector(selector);return{assigned:(slot?.assignedNodes()??[]).length>0,text:(slot?.assignedNodes({flatten:!0})??[]).map(node=>composedAccessibilityText(node,{skipRootAncestorValidation:!0,requireRendered:!1})).join(" ")}}announcementText(){if(!isAccessibilityVisible(this))return"";const headingSlot=this.slotContent("heading"),descriptionSlot=this.slotContent("description");return[headingSlot.assigned?headingSlot.text:this.heading,descriptionSlot.assigned?descriptionSlot.text:this.description].join(" ").replace(/\s+/g," ").trim()}announceCurrentContent(force=!1){if(!this.announcementsArmed||!this.isConnected)return;const text=this.announcementText();!force&&text===this.lastAnnouncementText||(this.lastAnnouncementText=text,text&&this.announcements.announcePolite(text))}render(){const hasHeading=this.slotPresence.has("heading")||(this.heading??"").length>0,hasDescription=this.slotPresence.has("description")||(this.description??"").length>0,headingLevel=resolveHeadingLevel(this.headingLevel);return html`
2
2
  <div part="base">
3
3
  ${renderInertPresentation(html`<slot></slot>`,{part:"icon",hidden:!this.slotPresence.has()})}
4
4
  <p part="heading" role=${headingLevel?"heading":nothing} aria-level=${headingLevel??nothing} ?hidden=${!hasHeading} >
@@ -44,6 +44,10 @@ import{type PropertyValues,type TemplateResult}from'lit';import type{Placement}f
44
44
  * @cssprop [--arrow-size=var(--lr-overlay-arrow-size,var(--lr-size-0-375rem))] - Arrow half-width
45
45
  * inherited from the popover surface.
46
46
  * @cssprop --lr-overlay-max-inline-size - Maximum inline size of the popup.
47
+ * @cssprop [--lr-overlay-inline-size=auto] - Assertive inline size of the popup, inherited from the
48
+ * popover surface; also honoured by a `top-layer` popup.
49
+ * @cssprop [--lr-overlay-min-inline-size=0px] - Minimum inline size of the popup, inherited from the
50
+ * popover surface and capped by the available viewport space.
47
51
  * @cssprop --lr-overlay-arrow-size - Retained Lyra arrow-size fallback.
48
52
  * @cssprop [--lr-overlay-surface=var(--lr-color-surface-container-high)] - Shared floating-surface fill,
49
53
  * inherited from the popover surface.
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{shouldIgnoreNavigationKey}from"../../../internal/list-navigation.js";import{declaredDefaultConverter}from"../../../internal/converters.js";import{html}from"lit";import{property,query,state}from"lit/decorators.js";import{html as staticHtml,unsafeStatic}from"lit/static-html.js";import{collectInitialSlotAssignment}from"../../../internal/initial-slot-collection.js";import{tag}from"../../../internal/prefix.js";import{LyraPopover}from"./popover.class.js";import{css as lyraStaticStyleCss}from"lit";const styles=lyraStaticStyleCss`[part~=popup]{flex-direction:column;display:flex;overflow:visible}[part~=popup][popover]{block-size:auto;inline-size:auto;margin:0;padding:0;bottom:auto;right:auto}[part~=popup] [part~=content]{min-block-size:0;padding:var(--lr-space-xs);flex-direction:column;display:flex;overflow:visible}[part~=menu]{display:contents}`;const menuTag=unsafeStatic(tag("menu"));class LyraDropdown extends LyraPopover{static{this.styles=[LyraPopover.styles,styles]}get hoist(){return this.positioningStrategy==="fixed"}set hoist(next){this.positioningStrategy=next?"fixed":"absolute"}constructor(){super(),this.distance=0,this.placement="bottom-start",this.size="m",this.stayOpenOnSelect=!1,this.onContentSlotChange=event=>{this.collectConsumerMenuFromSlot(event.target)},this.popupRole="menu"}get popupRole(){return"menu"}set popupRole(_next){super.popupRole!=="menu"&&(super.popupRole="menu")}attributeChangedCallback(name,oldValue,newValue){if(name==="popup-role"&&newValue!==null&&newValue!=="menu"){this.setAttribute("popup-role","menu");return}super.attributeChangedCallback(name,oldValue,newValue)}get defaultDistance(){return 0}get isHoverCard(){return!1}opensOn(keyword){return super.isHoverCard?keyword==="hover"||keyword==="focus":super.opensOn(keyword)}get defaultPositioningStrategy(){return"absolute"}get positioningSync(){return this.sync}get animationNamespace(){return"dropdown"}get popupSurfaceRole(){}animationDurationProperties(showing){return[showing?"--show-duration":"--hide-duration","--lr-transition-fast"]}get popupPartNames(){return["popup","dialog","popup-popup","base","base__popup","panel"].join(" ")}get arrowPartNames(){return"arrow popup-arrow"}isInsideLightDismissBoundary(path){return super.isInsideLightDismissBoundary(path)||!!(this.containingElement&&path.includes(this.containingElement))}onPopupPositioned(){if(super.onPopupPositioned(),this.openedByInteraction)return;const menu=this.menuEngine;if(!menu?.dropdownOpen)return;menu.shadowRoot?.querySelector("slot:not([name])")?.assignedElements({flatten:!0}).find(element=>element.tabIndex===0)?.focus()}get menuEngine(){return this.consumerMenu??this.renderRoot?.querySelector('[part~="menu"]')??void 0}configureMenu(menu){!this.isConnected||!menu||(menu===this.consumerMenu&&!this.consumerMenuSnapshot&&(this.consumerMenuSnapshot={dropdownOwner:menu.dropdownOwner,dropdownContained:menu.dropdownContained,dropdownRendersMenuRole:menu.dropdownRendersMenuRole,dropdownStayOpenOnSelect:menu.dropdownStayOpenOnSelect,dropdownSize:menu.dropdownSize,dropdownLabel:menu.dropdownLabel,dropdownOpen:menu.dropdownOpen}),menu.dropdownOwner=this,menu.dropdownContained=!0,menu.dropdownRendersMenuRole=!0,menu.dropdownStayOpenOnSelect=this.stayOpenOnSelect,menu.dropdownSize=this.size,menu.dropdownLabel=this.effectivePopupLabel,menu.dropdownOpen=this.open)}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.contentSlot&&this.collectConsumerMenuFromSlot(this.contentSlot)})}releaseConsumerMenu(menu){if(!menu)return;const snapshot=menu===this.consumerMenu?this.consumerMenuSnapshot:void 0;menu.dropdownOpen=!1,menu.dropdownOwner=snapshot?.dropdownOwner??null,menu.dropdownContained=snapshot?.dropdownContained??!1,menu.dropdownRendersMenuRole=snapshot?.dropdownRendersMenuRole??!1,menu.dropdownStayOpenOnSelect=snapshot?.dropdownStayOpenOnSelect??!1,menu.dropdownSize=snapshot?.dropdownSize,menu.dropdownLabel=snapshot?.dropdownLabel,snapshot&&(menu.dropdownOpen=snapshot.dropdownOpen),menu===this.consumerMenu&&(this.consumerMenuSnapshot=void 0)}collectConsumerMenuFromSlot(slot){if(!this.isConnected||slot!==this.contentSlot)return;const next=slot.assignedElements({flatten:!0}).find(element=>element.localName===tag("menu"));next!==this.consumerMenu&&(this.releaseConsumerMenu(this.consumerMenu),this.consumerMenu=next),this.configureMenu(next??this.menuEngine)}onTriggerKeyDown(event){if(this.disabled||this.open||event.defaultPrevented||shouldIgnoreNavigationKey(event)||event.shiftKey)return;let focus;if(event.key==="ArrowDown"?focus="first":event.key==="ArrowUp"&&(focus="last"),!focus)return;event.preventDefault();const menu=this.menuEngine;this.configureMenu(menu),menu?menu.focusContained(focus):this.show()}reposition(){this.positionPopup()}focusOnTrigger(options){this.renderRoot?.querySelector('slot[name="trigger"]')?.assignedElements({flatten:!0})[0]?.focus(options)}getMenu(){return this.menuEngine??null}updated(changed){super.updated(changed),this.configureMenu(this.menuEngine),this.open&&changed.has("sync")&&this.reposition()}firstUpdated(changed){super.firstUpdated(changed);const slot=this.contentSlot;queueMicrotask(()=>{collectInitialSlotAssignment(slot,s=>this.collectConsumerMenuFromSlot(s))})}disconnectedCallback(){this.releaseConsumerMenu(this.consumerMenu),super.disconnectedCallback()}renderPopupContent(){return this.consumerMenu?html`<slot @slotchange=${this.onContentSlotChange}></slot>`:staticHtml`
1
+ import{__decorate}from"tslib";import{shouldIgnoreNavigationKey}from"../../../internal/list-navigation.js";import{declaredDefaultConverter}from"../../../internal/converters.js";import{html}from"lit";import{property,query,state}from"lit/decorators.js";import{html as staticHtml,unsafeStatic}from"lit/static-html.js";import{collectInitialSlotAssignment}from"../../../internal/initial-slot-collection.js";import{tag}from"../../../internal/prefix.js";import{LyraPopover}from"./popover.class.js";import{css as lyraStaticStyleCss}from"lit";const styles=lyraStaticStyleCss`[part~=popup]{flex-direction:column;display:flex;overflow:visible}[part~=popup][popover]{inline-size:var(--lr-overlay-inline-size,auto);block-size:auto;margin:0;padding:0;bottom:auto;right:auto}[part~=popup] [part~=content]{min-block-size:0;padding:var(--lr-space-xs);flex-direction:column;display:flex;overflow:visible}[part~=menu]{display:contents}`;const menuTag=unsafeStatic(tag("menu"));class LyraDropdown extends LyraPopover{static{this.styles=[LyraPopover.styles,styles]}get hoist(){return this.positioningStrategy==="fixed"}set hoist(next){this.positioningStrategy=next?"fixed":"absolute"}constructor(){super(),this.distance=0,this.placement="bottom-start",this.size="m",this.stayOpenOnSelect=!1,this.onContentSlotChange=event=>{this.collectConsumerMenuFromSlot(event.target)},this.popupRole="menu"}get popupRole(){return"menu"}set popupRole(_next){super.popupRole!=="menu"&&(super.popupRole="menu")}attributeChangedCallback(name,oldValue,newValue){if(name==="popup-role"&&newValue!==null&&newValue!=="menu"){this.setAttribute("popup-role","menu");return}super.attributeChangedCallback(name,oldValue,newValue)}get defaultDistance(){return 0}get isHoverCard(){return!1}opensOn(keyword){return super.isHoverCard?keyword==="hover"||keyword==="focus":super.opensOn(keyword)}get defaultPositioningStrategy(){return"absolute"}get positioningSync(){return this.sync}get animationNamespace(){return"dropdown"}get popupSurfaceRole(){}animationDurationProperties(showing){return[showing?"--show-duration":"--hide-duration","--lr-transition-fast"]}get popupPartNames(){return["popup","dialog","popup-popup","base","base__popup","panel"].join(" ")}get arrowPartNames(){return"arrow popup-arrow"}isInsideLightDismissBoundary(path){return super.isInsideLightDismissBoundary(path)||!!(this.containingElement&&path.includes(this.containingElement))}onPopupPositioned(){if(super.onPopupPositioned(),this.openedByInteraction)return;const menu=this.menuEngine;if(!menu?.dropdownOpen)return;menu.shadowRoot?.querySelector("slot:not([name])")?.assignedElements({flatten:!0}).find(element=>element.tabIndex===0)?.focus()}get menuEngine(){return this.consumerMenu??this.renderRoot?.querySelector('[part~="menu"]')??void 0}configureMenu(menu){!this.isConnected||!menu||(menu===this.consumerMenu&&!this.consumerMenuSnapshot&&(this.consumerMenuSnapshot={dropdownOwner:menu.dropdownOwner,dropdownContained:menu.dropdownContained,dropdownRendersMenuRole:menu.dropdownRendersMenuRole,dropdownStayOpenOnSelect:menu.dropdownStayOpenOnSelect,dropdownSize:menu.dropdownSize,dropdownLabel:menu.dropdownLabel,dropdownOpen:menu.dropdownOpen}),menu.dropdownOwner=this,menu.dropdownContained=!0,menu.dropdownRendersMenuRole=!0,menu.dropdownStayOpenOnSelect=this.stayOpenOnSelect,menu.dropdownSize=this.size,menu.dropdownLabel=this.effectivePopupLabel,menu.dropdownOpen=this.open)}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.contentSlot&&this.collectConsumerMenuFromSlot(this.contentSlot)})}releaseConsumerMenu(menu){if(!menu)return;const snapshot=menu===this.consumerMenu?this.consumerMenuSnapshot:void 0;menu.dropdownOpen=!1,menu.dropdownOwner=snapshot?.dropdownOwner??null,menu.dropdownContained=snapshot?.dropdownContained??!1,menu.dropdownRendersMenuRole=snapshot?.dropdownRendersMenuRole??!1,menu.dropdownStayOpenOnSelect=snapshot?.dropdownStayOpenOnSelect??!1,menu.dropdownSize=snapshot?.dropdownSize,menu.dropdownLabel=snapshot?.dropdownLabel,snapshot&&(menu.dropdownOpen=snapshot.dropdownOpen),menu===this.consumerMenu&&(this.consumerMenuSnapshot=void 0)}collectConsumerMenuFromSlot(slot){if(!this.isConnected||slot!==this.contentSlot)return;const next=slot.assignedElements({flatten:!0}).find(element=>element.localName===tag("menu"));next!==this.consumerMenu&&(this.releaseConsumerMenu(this.consumerMenu),this.consumerMenu=next),this.configureMenu(next??this.menuEngine)}onTriggerKeyDown(event){if(this.disabled||this.open||event.defaultPrevented||shouldIgnoreNavigationKey(event)||event.shiftKey)return;let focus;if(event.key==="ArrowDown"?focus="first":event.key==="ArrowUp"&&(focus="last"),!focus)return;event.preventDefault();const menu=this.menuEngine;this.configureMenu(menu),menu?menu.focusContained(focus):this.show()}reposition(){this.positionPopup()}focusOnTrigger(options){this.renderRoot?.querySelector('slot[name="trigger"]')?.assignedElements({flatten:!0})[0]?.focus(options)}getMenu(){return this.menuEngine??null}updated(changed){super.updated(changed),this.configureMenu(this.menuEngine),this.open&&changed.has("sync")&&this.reposition()}firstUpdated(changed){super.firstUpdated(changed);const slot=this.contentSlot;queueMicrotask(()=>{collectInitialSlotAssignment(slot,s=>this.collectConsumerMenuFromSlot(s))})}disconnectedCallback(){this.releaseConsumerMenu(this.consumerMenu),super.disconnectedCallback()}renderPopupContent(){return this.consumerMenu?html`<slot @slotchange=${this.onContentSlotChange}></slot>`:staticHtml`
2
2
  <${menuTag}
3
3
  part="menu"
4
4
  .dropdownOwner=${this}
@@ -1 +1 @@
1
- import{css}from"lit";import{anchoredPopupSettle,overlaySurface,overlaySurfaceFill}from"../../../internal/overlay-surface.styles.js";const styles=css` :host{display:inline-block}[part=trigger]{display:inline-block}[part~=popup]{position:fixed;top:0;left:0;z-index:var(--lr-overlay-stack-index,var(--lr-layer-popover));max-inline-size:min(var(--max-width,var(--lr-overlay-max-inline-size,var(--lr-size-20rem))),var(--lr-positioner-available-inline-size,var(--lr-size-20rem)));max-block-size:var(--lr-positioner-available-block-size,var(--lr-size-20rem));overflow:auto;${overlaySurface} box-shadow:var(--lr-overlay-shadow-anchored,var(--lr-shadow-m))}[part~=hover-bridge]{position:fixed;inset:0;z-index:var(--lr-overlay-stack-index,var(--lr-layer-popover));clip-path:polygon(var(--lr-positioner-hover-bridge-top-left-x,0) var(--lr-positioner-hover-bridge-top-left-y,0),var(--lr-positioner-hover-bridge-top-right-x,0) var(--lr-positioner-hover-bridge-top-right-y,0),var(--lr-positioner-hover-bridge-bottom-right-x,0) var(--lr-positioner-hover-bridge-bottom-right-y,0),var(--lr-positioner-hover-bridge-bottom-left-x,0) var(--lr-positioner-hover-bridge-bottom-left-y,0))}[part~=popup]{--_lr-popup-exit-transform:translateY(var(--lr-size-neg-0-25rem))}${anchoredPopupSettle} [part~=content]{padding:var(--lr-space-m)}[part~=popup]:where([data-has-arrow]){overflow:visible}[part~=popup]:where([data-has-arrow]) [part~=content]{overflow:auto;max-block-size:var(--lr-positioner-available-block-size,var(--lr-size-20rem))}[part~=arrow]{position:absolute;inline-size:calc(2 * var(--arrow-size,var(--lr-overlay-arrow-size,var(--lr-size-0-375rem))));block-size:calc(2 * var(--arrow-size,var(--lr-overlay-arrow-size,var(--lr-size-0-375rem))));rotate:45deg;${overlaySurfaceFill} clip-path:polygon(100% 0,100% 100%,0 100%)}`,tooltipStyles=/* @__PURE__ */(()=>css` :host{display:inline-block}[part=trigger]{display:inline-block}[part~=popup]{position:absolute;top:0;left:0;z-index:var(--lr-overlay-stack-index,var(--lr-layer-popover));min-inline-size:0;inline-size:max-content;max-inline-size:min(var(--max-width,var(--lr-tooltip-max-inline-size,var(--lr-size-20rem))),var(--lr-positioner-available-inline-size,100vi));max-block-size:var(--lr-positioner-available-block-size,100vb);overflow-x:clip;overflow-y:auto;overflow-wrap:anywhere;padding:var(--lr-space-xs) var(--lr-space-s);border-radius:var(--lr-overlay-radius,var(--lr-radius-xs));background:var(--lr-tooltip-bg,var(--lr-color-neutral));color:var(--lr-tooltip-color,var(--lr-color-on-neutral));font-size:var(--lr-font-size-sm);line-height:var(--lr-line-height-compact);box-shadow:var(--lr-overlay-shadow-anchored,var(--lr-shadow-m))}[part~=popup]{--_lr-popup-exit-transform:none}${anchoredPopupSettle} [part~=popup]:where([data-has-arrow]){overflow:visible}[part~=arrow]{position:absolute;inline-size:calc(2 * var(--arrow-size,var(--lr-tooltip-arrow-size,var(--lr-size-0-375rem))));block-size:calc(2 * var(--arrow-size,var(--lr-tooltip-arrow-size,var(--lr-size-0-375rem))));rotate:45deg;background:var(--lr-tooltip-bg,var(--lr-color-neutral))}`)();export{styles,tooltipStyles};
1
+ import{css}from"lit";import{anchoredPopupSettle,overlaySurface,overlaySurfaceFill}from"../../../internal/overlay-surface.styles.js";const styles=css` :host{display:inline-block}[part=trigger]{display:inline-block}:host([full-width-trigger]){display:block}:host([full-width-trigger]) [part=trigger]{display:block}:host([full-width-trigger]) slot[name=trigger]::slotted(*){box-sizing:border-box;inline-size:100%}[part~=popup]{position:fixed;top:0;left:0;z-index:var(--lr-overlay-stack-index,var(--lr-layer-popover));inline-size:var(--lr-overlay-inline-size,auto);max-inline-size:min(var(--max-width,var(--lr-overlay-max-inline-size,var(--lr-overlay-inline-size,var(--lr-size-20rem)))),var(--lr-positioner-available-inline-size,var(--lr-size-20rem)));min-inline-size:min(var(--_lr-popup-min-inline-size,var(--lr-overlay-min-inline-size,0px)),var(--lr-positioner-available-inline-size,100vw));max-block-size:var(--lr-positioner-available-block-size,var(--lr-size-20rem));overflow:auto;${overlaySurface} box-shadow:var(--lr-overlay-shadow-anchored,var(--lr-shadow-m))}[part~=hover-bridge]{position:fixed;inset:0;z-index:var(--lr-overlay-stack-index,var(--lr-layer-popover));clip-path:polygon(var(--lr-positioner-hover-bridge-top-left-x,0) var(--lr-positioner-hover-bridge-top-left-y,0),var(--lr-positioner-hover-bridge-top-right-x,0) var(--lr-positioner-hover-bridge-top-right-y,0),var(--lr-positioner-hover-bridge-bottom-right-x,0) var(--lr-positioner-hover-bridge-bottom-right-y,0),var(--lr-positioner-hover-bridge-bottom-left-x,0) var(--lr-positioner-hover-bridge-bottom-left-y,0))}[part~=popup]{--_lr-popup-exit-transform:translateY(var(--lr-size-neg-0-25rem))}${anchoredPopupSettle} [part~=content]{padding:var(--lr-overlay-content-padding,var(--lr-space-m))}[part~=popup]:where([data-has-arrow]){overflow:visible}[part~=popup]:where([data-has-arrow]) [part~=content]{overflow:auto;max-block-size:var(--lr-positioner-available-block-size,var(--lr-size-20rem))}[part~=arrow]{position:absolute;inline-size:calc(2 * var(--arrow-size,var(--lr-overlay-arrow-size,var(--lr-size-0-375rem))));block-size:calc(2 * var(--arrow-size,var(--lr-overlay-arrow-size,var(--lr-size-0-375rem))));rotate:45deg;${overlaySurfaceFill} clip-path:polygon(100% 0,100% 100%,0 100%)}`,tooltipStyles=/* @__PURE__ */(()=>css` :host{display:inline-block}[part=trigger]{display:inline-block}[part~=popup]{position:absolute;top:0;left:0;z-index:var(--lr-overlay-stack-index,var(--lr-layer-popover));min-inline-size:0;inline-size:max-content;max-inline-size:min(var(--max-width,var(--lr-tooltip-max-inline-size,var(--lr-size-20rem))),var(--lr-positioner-available-inline-size,100vi));max-block-size:var(--lr-positioner-available-block-size,100vb);overflow-x:clip;overflow-y:auto;overflow-wrap:anywhere;padding:var(--lr-space-xs) var(--lr-space-s);border-radius:var(--lr-overlay-radius,var(--lr-radius-xs));background:var(--lr-tooltip-bg,var(--lr-color-neutral));color:var(--lr-tooltip-color,var(--lr-color-on-neutral));font-size:var(--lr-font-size-sm);line-height:var(--lr-line-height-compact);box-shadow:var(--lr-overlay-shadow-anchored,var(--lr-shadow-m))}[part~=popup]{--_lr-popup-exit-transform:none}${anchoredPopupSettle} [part~=popup]:where([data-has-arrow]){overflow:visible}[part~=arrow]{position:absolute;inline-size:calc(2 * var(--arrow-size,var(--lr-tooltip-arrow-size,var(--lr-size-0-375rem))));block-size:calc(2 * var(--arrow-size,var(--lr-tooltip-arrow-size,var(--lr-size-0-375rem))));rotate:45deg;background:var(--lr-tooltip-bg,var(--lr-color-neutral))}`)();export{styles,tooltipStyles};
@@ -1,4 +1,4 @@
1
- import{type PropertyValues,type TemplateResult}from'lit';import type{Placement}from'@floating-ui/dom';import{LyraElement}from'../../../internal/lyra-element.js';import type{PlaceStrategy,PlaceSync}from'../../../internal/positioner.js';import{type LyraArrowPlacement}from'./overlay-arrow.js';import{type OverlayVirtualRect}from'../../../internal/overlay-shared.js';
1
+ import{type PropertyValues,type TemplateResult}from'lit';import type{Placement}from'@floating-ui/dom';import{LyraElement}from'../../../internal/lyra-element.js';import type{PlaceStrategy,PlaceSync,VirtualAnchor}from'../../../internal/positioner.js';import{type LyraArrowPlacement}from'./overlay-arrow.js';import{type OverlayVirtualRect}from'../../../internal/overlay-shared.js';
2
2
  /** Semantic role vocabulary for a popover surface or mapped trigger contract.*/
3
3
  /**
4
4
  * Semantic role a popover's positioned surface takes on.
@@ -37,6 +37,10 @@ export type LyraPopupRole='dialog'|'menu'|'none';
37
37
  * `'manual'`. `<lr-dropdown>` treats it as `hover focus` and keeps its menu ARIA.
38
38
  */
39
39
  export type LyraPopoverTrigger='click'|'hover'|'focus'|'manual'|'hover-card';export type{LyraArrowPlacement,OverlayVirtualRect,PlaceStrategy};
40
+ /** What `virtualElement` positions against: any object whose `getBoundingClientRect()` returns
41
+ * the rectangle to anchor to, with an optional `contextElement` supplying scroll, scale and
42
+ * direction context. */
43
+ export type LyraPopoverVirtualElement=VirtualAnchor;
40
44
  /** The `showAt()` rectangle, shared verbatim with `<lr-tooltip>` (see `src/internal/overlay-shared.ts`).*/
41
45
  export interface LyraPopoverEventMap{'lr-show':CustomEvent<null>;'lr-after-show':CustomEvent<null>;'lr-hide':CustomEvent<null>;'lr-after-hide':CustomEvent<null>;}
42
46
  /**
@@ -87,9 +91,12 @@ export interface LyraPopoverEventMap{'lr-show':CustomEvent<null>;'lr-after-show'
87
91
  * never disagree. Markup that renders open from the start emits nothing.
88
92
  * Motion resolves through `popover.show`/`popover.hide` in the public animation registry.
89
93
  *
90
- * Positioning resolves `showAt()` virtual anchor, direct `.anchor`, `for`, then the interaction
94
+ * Positioning resolves `showAt()` virtual anchor, `.virtualElement`, direct `.anchor`, `for`, then the interaction
91
95
  * owner, in that order. Thus `anchor` can position against an element that never receives click or
92
96
  * ARIA state, while `for` owns both positioning and interaction only when no trigger is slotted.
97
+ * `virtualElement` positions against a virtual element -- an object with `getBoundingClientRect()`
98
+ * and an optional `contextElement` -- ahead of `anchor`, and persists until replaced, unlike a
99
+ * one-shot `showAt()`.
93
100
  * Activating an enabled, non-inert light-DOM descendant with `data-popover="close"` requests this
94
101
  * closest owning popover to close. Nested popovers consume their own close actions.
95
102
  *
@@ -126,6 +133,12 @@ export interface LyraPopoverEventMap{'lr-show':CustomEvent<null>;'lr-after-show'
126
133
  * @cssprop [--max-width=var(--lr-overlay-max-inline-size,var(--lr-size-20rem))] - Maximum inline
127
134
  * size of the popup.
128
135
  * @cssprop --lr-overlay-max-inline-size - Retained Lyra fallback for `--max-width`.
136
+ * @cssprop [--lr-overlay-inline-size=auto] - Assertive inline size of the popup. Left at `auto` the
137
+ * popup shrink-wraps to its content. With it set and no maximum given, the maximum falls back to
138
+ * this width instead of `20rem`; the available viewport space is always a hard limit.
139
+ * @cssprop [--lr-overlay-min-inline-size=0px] - Minimum inline size of the popup, capped by the
140
+ * available viewport space.
141
+ * @cssprop [--lr-overlay-content-padding=var(--lr-space-m)] - Padding of the `content` part.
129
142
  * @cssprop [--arrow-size=var(--lr-overlay-arrow-size,var(--lr-size-0-375rem))] - Half-width of the
130
143
  * arrow square.
131
144
  * @cssprop --lr-overlay-arrow-size - Retained Lyra fallback for `--arrow-size`.
@@ -212,6 +225,13 @@ forElement:HTMLElement|null;
212
225
  /** Positioning-only element anchor. Takes precedence over `for` and the interaction owner, but
213
226
  * never receives click listeners or generated ARIA. */
214
227
  anchor:Element|null;
228
+ /** Positioning-only virtual element: any object with a `getBoundingClientRect()` method and an
229
+ * optional `contextElement`, such as a text selection or a cursor position. Takes precedence
230
+ * over `anchor`, `for` and the interaction owner, but never receives click listeners or
231
+ * generated ARIA. It is re-measured on every reposition, stays in effect until replaced or
232
+ * cleared, and needs no DOM connection; `showAt()` still wins while active. A value without a
233
+ * callable `getBoundingClientRect()` is ignored, as if unset. */
234
+ virtualElement:LyraPopoverVirtualElement|null;
215
235
  /**
216
236
  * Additional light-dismiss containment while using a DOM anchor. Pointer presses within this
217
237
  * connected element and its composed descendants do not dismiss the popup. The boundary must
@@ -227,7 +247,13 @@ withoutArrow:boolean;
227
247
  /** Where the arrow sits along the popup's edge. `anchor` tracks the anchor's centre.*/
228
248
  arrowPlacement:LyraArrowPlacement;
229
249
  /** Keeps the arrow this far from the popup's corners, in pixels.*/
230
- arrowPadding:number;private _trigger;
250
+ arrowPadding:number;
251
+ /** Lays the trigger out at full width: the host becomes a block box and the `trigger` part and
252
+ * the slotted trigger element stretch to the host's inline size, for a trigger that sits in a
253
+ * form column or a sidebar like a block-level field. Off by default, which keeps the
254
+ * `inline-block` trigger. Positioning is unaffected; set `--lr-overlay-inline-size` or the
255
+ * dropdown's `sync` to size the popup as well. */
256
+ fullWidthTrigger:boolean;private _trigger;
231
257
  /**
232
258
  * Space-separated list of the interactions that open the popover -- see
233
259
  * {@link LyraPopoverTrigger} for the keywords, which are `<lr-tooltip>`'s plus the popover-only
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{AnchoredDisclosureController}from"../../../internal/anchored-disclosure-controller.js";import{DocumentPointerListener}from"../../../internal/document-pointer.js";import{GlassScrollLayer}from"../../../internal/glass-scroll-layer.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{hostAriaLabel,nextId}from"../../../internal/a11y.js";import{normalizeLabel}from"../../../internal/accessible-name.js";import{collectInitialSlotAssignment}from"../../../internal/initial-slot-collection.js";import{CustomElementUpgradeObserver}from"../../../internal/custom-element-upgrade-observer.js";import{acquireAriaOwnership}from"../../../internal/aria-ownership.js";import{tag}from"../../../internal/prefix.js";import{PositioningStrategyState,positioningStrategyConverter,resolveEffectivePositioningStrategy}from"../../../internal/positioning-strategy.js";import{deferredPlaceReady,syncTopLayerRelease,waitForDeferredPlacement}from"../../../internal/anchored-overlay-runtime.js";import{OwnerAnimationFrameWaiter}from"../../../internal/owner-animation-frame.js";import{rtlAwarePlacement}from"../../../internal/rtl.js";import{finiteDuration,finiteNumber}from"../../../internal/numbers.js";import{deepActiveElementIn}from"../../../internal/active-element.js";import{isKeyboardFocusEvent}from"../../../internal/focus-modality.js";import{declaredDefaultConverter,literalSetConverter,omittedEmptyStringConverter,blankNumberConverter}from"../../../internal/converters.js";import{activateNonmodalOverlay,composedContains}from"../../../internal/nonmodal-overlay-manager.js";import{setCustomState}from"../../../internal/custom-states.js";import{attachInternalsSafely}from"../../../internal/element-internals.js";import{animateRegistered}from"../../../internal/registered-animation.js";import{applyOverlayArrow}from"./overlay-arrow.js";import{normalizeVirtualRect,OverlayAnchorIdentity,OverlayDelayTimer,resolveOverlayAnchor,resolveOverlayAccessibleTrigger,resolveOverlayInteractionTrigger}from"../../../internal/overlay-shared.js";import{styles}from"./overlay.styles.js";import{glassPopoverStyles}from"./popover-glass.styles.js";import{LYRA_DEFAULT_popover}from"../../../internal/default-strings/overlays.generated.js";import{LYRA_DEFAULT_menuLabel}from"../../../internal/default-strings/shared.generated.js";const DEFAULT_DISTANCE=8,EXPANDABLE_TRIGGER_ROLES=new Set(["application","button","checkbox","combobox","gridcell","link","listbox","menuitem","row","rowheader","tab","treeitem","columnheader","menuitemcheckbox","menuitemradio","switch"]);function supportsTriggerExpansion(element){const role=element.getAttribute("role")?.trim().split(/\s+/)[0];return role?EXPANDABLE_TRIGGER_ROLES.has(role):element.matches("button, a[href], select, summary")?!0:element.localName==="input"&&["button","submit","reset","image","checkbox"].includes(element.type)}let popoverConnectionSequence=0;const POPUP_ROLE=literalSetConverter(["dialog","menu","none"],"dialog"),POPOVER_TRIGGER_KEYWORDS=["click","hover","focus","manual","hover-card"];function normalizeTriggerList(next){const keywords=[];for(const token of String(next??"").toLowerCase().split(/\s+/)){const keyword=token;POPOVER_TRIGGER_KEYWORDS.includes(keyword)&&!keywords.includes(keyword)&&keywords.push(keyword)}return keywords.length>0?keywords.join(" "):"click"}const DEFAULT_TRIGGER_DELAY=0;class LyraPopover extends LyraElement{static{this.defaultStrings={...super.defaultStrings,menuLabel:LYRA_DEFAULT_menuLabel,popover:LYRA_DEFAULT_popover}}constructor(){super(),this._open=!1,this.placement="top",this.strategy=new PositioningStrategyState(this,this.defaultPositioningStrategy),this.topLayer=!1,this.distance=8,this.skidding=0,this._for="",this.forElement=null,this.anchor=null,this.interactionBoundary=null,this.withoutArrow=!1,this.arrowPlacement="anchor",this.arrowPadding=0,this._trigger="click",this.showDelay=0,this.hideDelay=0,this.hoverBridge=!1,this.accessibleLabel="",this._popupRole="dialog",this._disabled=!1,this.openedByInteraction=!1,this.pinned=!1,this.suppressTriggerFocusOpen=!1,this.delayTimer=new OverlayDelayTimer,this.resolvedSide="bottom",this.anchorPositioned=!1,this.popupHidden=!0,this.disconnecting=!1,this.reconnectedWhileDisconnecting=!1,this.directionChanged=!1,this.anchorIdentity=new OverlayAnchorIdentity,this.triggerUpgrades=new CustomElementUpgradeObserver(()=>{this.isConnected&&this.syncTriggerA11y()}),this.transientRevealFrame=new OwnerAnimationFrameWaiter(this),this.positioningGeneration=0,this.generatedHostId=nextId("popover"),this.popupId=nextId("popover-popup"),this.outsidePress=new DocumentPointerListener(this,event=>this.onDocumentPointer(event)),this.hostIdObserverGeneration=0,this.connectionSequence=0,this.popoverInternals=attachInternalsSafely(this),this.onExternalTriggerKeyDown=event=>{this.onTriggerKeyDown(event)},this.onTriggerSlotChange=event=>{this.collectTriggerFromSlot(event.target)},this.onTriggerClick=()=>{if(!this.virtualAnchor&&(this.syncTriggerA11y(),!this.isManualTrigger)){if(this.cancelPendingTransition(),this.isHoverCard){this.open&&this.hide({focusTrigger:!1});return}if(this.opensOn("click")&&!this.opensOn("hover")&&!this.opensOn("focus")){this.open?this.hide():this.show();return}if(this.open&&this.pinned){this.hide();return}this.open||(this.openedByInteraction=!1,this.show()),this.pinned=this.open}},this.onTriggerPointerEnter=()=>{this.opensOn("hover")&&this.requestDelayedTransition(!0)},this.onTriggerPointerLeave=event=>{this.opensOn("hover")&&this.requestInteractionClose(event.relatedTarget)},this.onPopupPointerEnter=()=>{!this.opensOn("hover")||!this.open||this.cancelPendingTransition()},this.onPopupPointerLeave=event=>{this.opensOn("hover")&&this.requestInteractionClose(event.relatedTarget)},this.onSurfaceFocusIn=event=>{!this.opensOn("focus")||this.suppressTriggerFocusOpen||(!this.open||this.triggerElement!=null&&event.composedPath().includes(this.triggerElement))&&!isKeyboardFocusEvent(event)||this.requestDelayedTransition(!0)},this.onSurfaceFocusOut=event=>{this.opensOn("focus")&&this.requestInteractionClose(event.relatedTarget)},this.onPopupClick=event=>{if(event.defaultPrevented)return;const path=event.composedPath(),hostIndex=path.indexOf(this);if(hostIndex<0)return;const closeAction=path.slice(0,hostIndex).find(target=>target.nodeType===1&&target.getAttribute("data-popover")==="close");if(!closeAction)return;event.stopPropagation();const state2=closeAction;state2.effectiveDisabled===!0||state2.disabled===!0||closeAction.hasAttribute("disabled")||closeAction.getAttribute("aria-disabled")?.trim().toLowerCase()==="true"||closeAction.hasAttribute("inert")||closeAction.closest("[inert]")||this.hide()},this.onDocumentPointer=event=>{this.overlayHandle?.isTopmost()&&(this.isInsideLightDismissBoundary(event.composedPath())||this.hide())},this.disclosure=new AnchoredDisclosureController({host:this,isOpen:()=>this._open,setOpen:value=>this.setOpen(value),emit:name=>name==="lr-show"||name==="lr-hide"?this.emitCancelableLifecycle(name).defaultPrevented:this.emitSettledLifecycle(name).defaultPrevented,popup:()=>this.renderRoot.querySelector('[part~="popup"]'),readyToShow:async isCurrent=>{const positioned=await waitForDeferredPlacement(()=>this.cleanup);return isCurrent()&&this.open&&positioned&&this.anchorPositioned},animate:(showing,popup)=>{const offset="translateY(var(--lr-size-neg-0-25rem))";return animateRegistered(this,popup,`${this.animationNamespace}.${showing?"show":"hide"}`,this.effectiveDirection,{keyframes:showing?[{opacity:0,transform:offset},{opacity:1,transform:"translateY(0)"}]:[{opacity:1,transform:"translateY(0)"},{opacity:0,transform:offset}],durationProperties:this.animationDurationProperties(showing),easingProperties:["--lr-easing-standard"]})},afterHide:()=>{this.popupHidden=!0}}),new GlassScrollLayer(this,'[part~="popup"]')}static{this.styles=[LyraElement.styles,styles,glassPopoverStyles]}get open(){return this._open}set open(next){const normalized=!!next&&this.canOpen;if(normalized!==this._open){if(!this.hasUpdated){this.setOpen(normalized),this.isConnected&&this.connectionSequence>0&&this.updateBrowserDerivedState(()=>this.reconcileInitialPopoverPeers());return}normalized?this.show():this.hide()}}get positioningStrategy(){return this.strategy.value}set positioningStrategy(next){const previous=this.strategy.value;this.strategy.set(next),previous!==this.strategy.value&&this.onPositioningStrategyChanged(previous,this.strategy.value)}onPositioningStrategyChanged(_previous,_next){}get for(){return this._for}set for(next){this._for=next??""}get trigger(){return this._trigger}set trigger(next){const normalized=normalizeTriggerList(next);if(normalized===this._trigger)return;const old=this._trigger;this._trigger=normalized,this.requestUpdate("trigger",old)}get triggerKeywords(){return this._trigger.split(" ")}get isManualTrigger(){return this.triggerKeywords.includes("manual")}get isHoverCard(){return!this.isManualTrigger&&this.triggerKeywords.includes("hover-card")}opensOn(keyword){return this.isHoverCard?keyword==="hover"||keyword==="focus":!this.isManualTrigger&&this.triggerKeywords.includes(keyword)}get popupRole(){return this._popupRole}set popupRole(next){const normalized=POPUP_ROLE.normalize(next);if(normalized===this._popupRole)return;const old=this._popupRole;this._popupRole=normalized,this.requestUpdate("popupRole",old)}get disabled(){return this._disabled}set disabled(next){const normalized=!!next;if(normalized===this._disabled)return;const old=this._disabled;this._disabled=normalized,this.requestUpdate("disabled",old),normalized&&this.open&&(this.hasUpdated?this.hide():this.open=!1)}get defaultDistance(){return DEFAULT_DISTANCE}get defaultPositioningStrategy(){return"fixed"}get resolvedPositioningStrategy(){return resolveEffectivePositioningStrategy(this,this.strategy.authored,this.defaultPositioningStrategy)}get positioningSync(){}get animationNamespace(){return"popover"}animationDurationProperties(showing){return[showing?"--show-duration":"--hide-duration","--lr-duration-fast"]}get popupPartNames(){return["popup","dialog","popup__popup"].join(" ")}get contentPartNames(){return["content","body"].join(" ")}get triggerPopupRole(){return this.popupRole}get popupSurfaceRole(){return this.popupRole==="none"?void 0:this.popupRole}get effectivePopupLabel(){return hostAriaLabel(this)??normalizeLabel(this.accessibleLabel)??this.localize(this.triggerPopupRole==="menu"?"menuLabel":"popover")}get rendersArrow(){return!this.withoutArrow}get arrowPartNames(){return"arrow popup__arrow"}get rendersHoverBridge(){return this.hoverBridge&&this.opensOn("hover")&&this.open}get canOpen(){return!this.disabled}renderPopupContent(){return html`<slot></slot>`}onTriggerKeyDown(_event){}isInsideLightDismissBoundary(path){const boundary=this.virtualAnchor?this.virtualInteractionBoundary:this.interactionBoundary;return path.includes(this)||this.triggerElement!=null&&path.includes(this.triggerElement)||boundary!=null&&boundary.isConnected&&boundary.ownerDocument===this.ownerDocument&&path.includes(boundary)}onPopupPositioned(){this.openedByInteraction||this.overlayHandle?.focusAutofocus()}willUpdate(changed){super.willUpdate(changed);const direction=this.effectiveDirection;this.directionChanged=direction!==this.positioningDirection,this.positioningDirection=direction,this.anchorIdentity.lostAnchorProperty(changed,this.anchor)&&this.open&&!this.resolveAnchor()&&this.forceClose({focusTrigger:!1}),changed.has("open")&&!this.open&&(this.anchorPositioned=!1),changed.has("open")&&this.open&&(this.popupHidden=!1),(changed.has("anchor")||changed.has("for"))&&(this.anchorPositioned=!1)}updated(changed){if(super.updated(changed),changed.has("trigger")&&(this.cancelPendingTransition(),!this.opensOn("hover")&&!this.opensOn("focus")&&(this.pinned=!1)),changed.has("showDelay")&&this.delayTimer.pendingDirection==="show"&&this.requestDelayedTransition(!0,!0),changed.has("hideDelay")&&this.delayTimer.pendingDirection==="hide"&&this.requestDelayedTransition(!1,!0),(changed.has("for")||changed.has("forElement")||changed.has("anchor")||changed.has("open"))&&this.syncAnchorIdentityObservation(),changed.has("for")||changed.has("forElement")?this.syncInteractionTrigger():changed.has("trigger")&&this.syncTriggerA11y(),this.directionChanged||changed.has("open")||changed.has("placement")||changed.has("positioningStrategy")||changed.has("topLayer")||changed.has("hoverBridge")||changed.has("trigger")||changed.has("distance")||changed.has("skidding")||changed.has("for")||changed.has("forElement")||changed.has("anchor")||changed.has("arrow")||changed.has("withoutArrow")||changed.has("arrowPlacement")||changed.has("arrowPadding")||changed.has("popupRole")){if(this.open&&this.isConnected?this.positionPopup():changed.has("open")&&this.invalidatePositioning(),changed.has("open"))if(this.open)this.isConnected&&(this.startLightDismiss(),this.activatePopoverOverlay());else{this.pinned=!1,this.openedByInteraction=!1,this.cancelPendingTransition(),this.positionedAnchor=void 0,this.stopLightDismiss(),this.suppressTriggerFocusOpen=!0;try{this.overlayHandle?.deactivate()}finally{this.suppressTriggerFocusOpen=!1}this.overlayHandle=void 0,this.virtualAnchor=void 0,this.returnFocusTo=void 0,this.virtualInteractionBoundary=void 0,this.syncInteractionTrigger()}this.isConnected&&this.syncTriggerA11y()}}firstUpdated(changed){super.firstUpdated(changed);const slot=this.triggerSlotElement;queueMicrotask(()=>{collectInitialSlotAssignment(slot,s=>this.collectTriggerFromSlot(s))})}connectedCallback(){if(this.disconnecting){this.reconnectedWhileDisconnecting=!0;return}if(super.connectedCallback(),this.connectionSequence=++popoverConnectionSequence,this.addEventListener("focusin",this.onSurfaceFocusIn),this.addEventListener("focusout",this.onSurfaceFocusOut),this.updateBrowserDerivedState(()=>this.reconcileInitialPopoverPeers()),this.syncAnchorIdentityObservation(),this.id||(this.id=this.generatedHostId),this.observeHostId(),this.syncInteractionTrigger(),this.hasUpdated&&this.open){const wasPreviouslyActivated=this.overlayHandle?.isActive()===!0;this.startLightDismiss(),wasPreviouslyActivated?this.overlayHandle.resume():this.activatePopoverOverlay(),this.popupHidden=!1,this.positionPopup()}}disconnectedCallback(){this.disconnecting=!0;try{this.teardownOnDisconnect(),super.disconnectedCallback()}finally{this.disconnecting=!1}this.reconnectedWhileDisconnecting&&(this.reconnectedWhileDisconnecting=!1,this.isConnected&&this.connectedCallback())}teardownOnDisconnect(){this.connectionSequence=0,this.anchorIdentity.stop(),this.invalidatePositioning(),this.stopLightDismiss(),this.resetHostIdObserver(),this.overlayHandle?.suspend(),this.triggerElement?.removeEventListener("click",this.onTriggerClick),this.triggerElement?.removeEventListener("keydown",this.onExternalTriggerKeyDown),this.triggerElement&&this.unbindTriggerInteractions(this.triggerElement),this.releaseTriggerA11y(),this.triggerElement=void 0,this.removeEventListener("focusin",this.onSurfaceFocusIn),this.removeEventListener("focusout",this.onSurfaceFocusOut),this.cancelPendingTransition(),this.virtualInteractionBoundary=void 0,this.pinned=!1,this.openedByInteraction=!1,this.disclosure.reset(),this.popupHidden=!0}adoptedCallback(){super.adoptedCallback(),this.anchorIdentity.stop(),this.resetHostIdObserver(),this.releaseTriggerA11y()}syncAnchorIdentityObservation(){this.anchorIdentity.stop();const directAnchor=this.open?this.anchor??this.forElement??void 0:void 0;this.anchorIdentity.observe(this,directAnchor,this.for,()=>this.anchor,directAnchorRemoved=>{if(this.resolveInteractionTrigger()!==this.triggerElement&&this.syncInteractionTrigger(),!this.open)return;const nextAnchor=this.resolveAnchor();if(directAnchorRemoved&&!nextAnchor){this.forceClose({focusTrigger:!1});return}nextAnchor!==this.positionedAnchor&&this.positionPopup()})}get connectedForElement(){const element=this.forElement;return element?.isConnected&&element.ownerDocument===this.ownerDocument?element:void 0}resolveInteractionTrigger(){return resolveOverlayInteractionTrigger(this,this.virtualAnchor,this.slottedTrigger??this.connectedForElement,this.for)}syncInteractionTrigger(slotChanged=!1){if(!this.isConnected)return;const next=this.resolveInteractionTrigger();if(next===this.triggerElement&&!slotChanged){this.syncTriggerA11y();return}this.cancelPendingTransition();const previous=this.triggerElement;if(previous?.removeEventListener("click",this.onTriggerClick),previous?.removeEventListener("keydown",this.onExternalTriggerKeyDown),previous&&this.unbindTriggerInteractions(previous),this.triggerElement=next,this.triggerUpgrades.disconnect(),this.triggerElement&&this.triggerElement!==this.slottedTrigger&&(this.triggerElement.addEventListener("click",this.onTriggerClick),this.triggerElement.addEventListener("keydown",this.onExternalTriggerKeyDown)),this.triggerElement&&this.bindTriggerInteractions(this.triggerElement),this.syncTriggerA11y(),this.open){if(previous&&next&&this.openedByInteraction&&!this.pinned&&![next,this].some(element=>element.matches(":hover"))&&!this.isWithinPopoverSurface(deepActiveElementIn(this.ownerDocument))||!this.resolveAnchor()){this.forceClose({focusTrigger:!1});return}this.updatePopoverRestoreFocusTarget(),this.positionPopup()}else this.isHoverCard&&next&&next!==previous&&next.matches(":hover")&&this.requestDelayedTransition(!0,!0)}activatePopoverOverlay(){!this.isConnected||this.overlayHandle?.isActive()||(this.overlayHandle=activateNonmodalOverlay({host:this,panel:()=>this.renderRoot.querySelector('[part~="popup"]'),onEscape:()=>{this.hide()},restoreFocusTo:this.virtualAnchor?this.returnFocusTo??null:this.accessibleTrigger}))}updatePopoverRestoreFocusTarget(){const target=this.virtualAnchor?this.returnFocusTo??null:this.accessibleTrigger;if(this.overlayHandle?.isActive()){this.overlayHandle.updateRestoreFocusTo(target);return}this.activatePopoverOverlay()}showAt(rect,options){const normalizedRect=normalizeVirtualRect(rect);if(!normalizedRect)return;const previousAnchor=this.virtualAnchor,previousReturnFocusTo=this.returnFocusTo,previousInteractionBoundary=this.virtualInteractionBoundary,bounds=new DOMRect(normalizedRect.x,normalizedRect.y,normalizedRect.width,normalizedRect.height);if(this.virtualAnchor={getBoundingClientRect:()=>bounds,contextElement:normalizedRect.contextElement},this.returnFocusTo=options?.returnFocusTo,this.virtualInteractionBoundary=options?.interactionBoundary,this.syncInteractionTrigger(),this.open){this.updatePopoverRestoreFocusTarget(),this.positionPopup();return}this.show(),!this.open&&(this.virtualAnchor=previousAnchor,this.returnFocusTo=previousReturnFocusTo,this.virtualInteractionBoundary=previousInteractionBoundary,this.syncInteractionTrigger())}resolveAnchor(){return resolveOverlayAnchor(this,{virtualAnchor:this.virtualAnchor,anchor:this.anchor,for:this.connectedForElement?"":this.for,trigger:this.triggerElement})}positionPopup(){if(!this.renderRoot)return;this.invalidatePositioning();const popup=this.renderRoot.querySelector('[part~="popup"]'),arrowElement=this.renderRoot.querySelector('[part~="arrow"]'),bridgeElement=this.renderRoot.querySelector('[part~="hover-bridge"]'),anchor=this.resolveAnchor();if(!this.open||!anchor||!popup){this.positionedAnchor=void 0,this.anchorPositioned=!1;return}anchor!==this.positionedAnchor&&(this.anchorPositioned=!1);const generation=this.positioningGeneration;if(this.openedByInteraction&&!this.anchorPositioned){this.cleanup=Object.assign(()=>this.transientRevealFrame.cancel(),{ready:this.transientRevealFrame.wait().then(current=>!current||generation!==this.positioningGeneration||!this.open||this.resolveAnchor()!==anchor?!1:(this.startPositioning(generation,anchor,popup,arrowElement,bridgeElement),this.cleanup?.ready??!1))});return}this.startPositioning(generation,anchor,popup,arrowElement,bridgeElement)}invalidatePositioning(){this.positioningGeneration++,this.cleanup?.(),this.cleanup=void 0}startPositioning(generation,anchor,popup,arrowElement,bridgeElement){this.placedTopLayer=syncTopLayerRelease(popup,this.placedTopLayer,this.topLayer);const operation=deferredPlaceReady(anchor,popup,{placement:rtlAwarePlacement(this.placement,this),strategy:this.topLayer?"fixed":this.resolvedPositioningStrategy,topLayer:this.topLayer,offset:finiteNumber(this.distance,this.defaultDistance),skidding:finiteNumber(this.skidding,0),sync:this.positioningSync,arrow:this.rendersArrow&&arrowElement?arrowElement:void 0,arrowPadding:Math.max(0,finiteNumber(this.arrowPadding,0)),hoverBridge:this.rendersHoverBridge&&bridgeElement?bridgeElement:void 0,onPlaced:({placement,arrow})=>{if(generation!==this.positioningGeneration)return;const becamePositioned=!this.anchorPositioned||this.positionedAnchor!==anchor;this.positionedAnchor=anchor,this.anchorPositioned=!0;const side=applyOverlayArrow(arrowElement,{placement,coords:arrow,enabled:this.rendersArrow,arrowPlacement:this.arrowPlacement,arrowPadding:Math.max(0,finiteNumber(this.arrowPadding,0)),rtl:this.effectiveDirection==="rtl",sizeProperty:"--arrow-size",fallbackSizeProperty:"--lr-overlay-arrow-size"});side!==this.resolvedSide&&(this.resolvedSide=side),this.updateComplete.then(()=>{generation!==this.positioningGeneration||!this.open||this.resolveAnchor()!==anchor||becamePositioned&&this.onPopupPositioned()})}});this.cleanup=operation,operation.ready.then(positioned=>{!positioned&&generation===this.positioningGeneration&&this.open&&this.forceClose({focusTrigger:!1})})}syncTriggerA11y(){const popup=this.renderRoot?.querySelector('[part~="popup"]')??null,contribution={attributes:{"aria-haspopup":this.triggerPopupRole==="none"?null:this.triggerPopupRole,"aria-expanded":this.open?"true":"false"},controls:popup?[popup]:[]},accessibleTrigger=this.accessibleTrigger;this.observeAccessibleTrigger(accessibleTrigger);const semanticTrigger=accessibleTrigger&&!this.isHoverCard&&supportsTriggerExpansion(accessibleTrigger)?accessibleTrigger:null;this.accessibleTriggerAria?this.accessibleTriggerAria.update(semanticTrigger,contribution):this.accessibleTriggerAria=acquireAriaOwnership(semanticTrigger,contribution),this.overlayHandle?.isActive()&&!this.virtualAnchor&&this.overlayHandle.updateRestoreFocusTo(accessibleTrigger)}get accessibleTrigger(){const trigger=this.triggerElement;return trigger?resolveOverlayAccessibleTrigger(trigger):null}observeAccessibleTrigger(target){this.accessibleTriggerObserver?.disconnect();const trigger=this.triggerElement;if(!trigger||!this.isConnected)return;const view=this.ownerDocument.defaultView;if(view?.MutationObserver){this.accessibleTriggerObserver??=new view.MutationObserver(()=>{this.isConnected&&this.syncTriggerA11y()});const roots=new Set([trigger]);trigger.shadowRoot&&roots.add(trigger.shadowRoot);let current=target;for(;current&&current!==trigger;){const root=current.getRootNode();if(root.nodeType!==11||!("host"in root))break;roots.add(root),current=root.host}for(const root of roots)this.accessibleTriggerObserver.observe(root,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["role","tabindex","disabled","href","type"]})}this.triggerUpgrades.observeElement(trigger)}releaseTriggerA11y(){this.accessibleTriggerObserver?.disconnect(),this.accessibleTriggerObserver=void 0,this.triggerUpgrades.disconnect(),this.accessibleTriggerAria?.release(),this.accessibleTriggerAria=void 0}collectTriggerFromSlot(slot){const next=slot.assignedElements({flatten:!0})[0];next!==this.slottedTrigger&&(this.slottedTrigger=next,this.syncInteractionTrigger(!0))}requestInteractionClose(next){this.pinned||this.isWithinPopoverSurface(next)||this.hasFocusWithinSurface()||this.requestDelayedTransition(!1)}isWithinPopoverSurface(target){if(target===null||target.nodeType!==1)return!1;const element=target;if(composedContains(this,element))return!0;const popup=this.renderRoot?.querySelector('[part~="popup"]')??null;return popup&&composedContains(popup,element)?!0:this.triggerElement!=null&&composedContains(this.triggerElement,element)}hasFocusWithinSurface(){const active=deepActiveElementIn(this.ownerDocument);return active===null||this.triggerElement&&composedContains(this.triggerElement,active)?!1:this.isWithinPopoverSurface(active)}requestDelayedTransition(next,deferImmediate=!1){if(this.cancelPendingTransition(),next&&!this.canOpen)return;const commit=()=>{next?(this.openedByInteraction=!0,this.show()):this.hide()},delay=Math.max(0,finiteDuration(next?this.showDelay:this.hideDelay,DEFAULT_TRIGGER_DELAY)),view=this.ownerDocument.defaultView;if(!view||delay<=0&&!deferImmediate){commit();return}this.delayTimer.schedule(view,delay,next?"show":"hide",commit)}cancelPendingTransition(){this.delayTimer.cancel()}triggerNeedsOwnFocusListeners(trigger){return!composedContains(this,trigger)}bindTriggerInteractions(trigger){trigger.addEventListener("mouseenter",this.onTriggerPointerEnter),trigger.addEventListener("mouseleave",this.onTriggerPointerLeave),this.triggerNeedsOwnFocusListeners(trigger)&&(trigger.addEventListener("focusin",this.onSurfaceFocusIn),trigger.addEventListener("focusout",this.onSurfaceFocusOut))}unbindTriggerInteractions(trigger){trigger.removeEventListener("mouseenter",this.onTriggerPointerEnter),trigger.removeEventListener("mouseleave",this.onTriggerPointerLeave),trigger.removeEventListener("focusin",this.onSurfaceFocusIn),trigger.removeEventListener("focusout",this.onSurfaceFocusOut)}startLightDismiss(){this.outsidePress.bind()}stopLightDismiss(){this.outsidePress.unbind()}observeHostId(){const ownerDocument=this.ownerDocument;if(this.hostIdObserver&&this.hostIdObserverDocument===ownerDocument)return;this.resetHostIdObserver();const MutationObserverCtor=ownerDocument.defaultView?.MutationObserver;if(!MutationObserverCtor||!this.isConnected)return;const generation=this.hostIdObserverGeneration,observer=new MutationObserverCtor(()=>{this.hostIdObserver!==observer||this.hostIdObserverDocument!==ownerDocument||this.hostIdObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||(this.id||(this.id=this.generatedHostId),this.syncTriggerA11y())});this.hostIdObserver=observer,this.hostIdObserverDocument=ownerDocument,observer.observe(this,{attributes:!0,attributeFilter:["id"]})}resetHostIdObserver(){this.hostIdObserverGeneration+=1,this.hostIdObserver?.disconnect(),this.hostIdObserver=void 0,this.hostIdObserverDocument=void 0}setOpen(next){if(this._open===next)return;const old=this._open;this._open=next,setCustomState(this.popoverInternals,"open",next),this.requestUpdate("open",old)}syncOpenAttribute(){this.toggleAttribute("open",this._open)}show(){return this.canOpen?this.disclosure.show(()=>!this.closePopoverPeers()):Promise.resolve()}hide(options){return this.disclosure.hide(()=>this.prepareClose(options))}hasPopoverAncestor(peer){const trigger=this.triggerElement??this.resolveInteractionTrigger();return composedContains(peer,this)||trigger!==void 0&&composedContains(peer,trigger)}closePopoverPeers(){if(this.virtualAnchor||this.localName!==tag("popover"))return!0;const root=this.getRootNode();for(const peer of root.querySelectorAll(tag("popover")))if(!(peer===this||!peer.open||peer.virtualAnchor)&&!this.hasPopoverAncestor(peer)&&(peer.hide({focusTrigger:!1}),peer.open))return!1;return!0}reconcileInitialPopoverPeers(){if(!this.isConnected||!this._open||this.virtualAnchor||this.localName!==tag("popover"))return;const root=this.getRootNode(),peers=[];let winner;for(const peer of root.querySelectorAll(tag("popover")))!peer.isConnected||!peer._open||peer.virtualAnchor||!(peer.connectionSequence>0)||(peers.push(peer),(!winner||peer.connectionSequence>winner.connectionSequence)&&(winner=peer));if(winner!==this){winner?.hasPopoverAncestor(this)||this.closeForInitialPeerReconciliation();return}for(const peer of peers)peer!==this&&!this.hasPopoverAncestor(peer)&&peer.closeForInitialPeerReconciliation()}closeForInitialPeerReconciliation(){this._open&&(this.disclosure.reset(),this.invalidatePositioning(),this.stopLightDismiss(),this.overlayHandle?.deactivate({restoreFocus:!1}),this.overlayHandle=void 0,this.positionedAnchor=void 0,this.anchorPositioned=!1,this.popupHidden=!0,this.returnFocusTo=void 0,this.setOpen(!1),this.syncOpenAttribute())}forceClose(options){return this.disclosure.forceClose(()=>this.prepareClose(options))}prepareClose(options){options?.focusTrigger===!1&&(this.overlayHandle?.deactivate({restoreFocus:!1}),this.overlayHandle=void 0),this.anchorPositioned||(this.popupHidden=!0)}emitCancelableLifecycle(name){return this.emit(name,null,{cancelable:!0})}emitSettledLifecycle(name){return this.emit(name)}render(){const popupRole=this.popupSurfaceRole;return html`
1
+ import{__decorate}from"tslib";import{AnchoredDisclosureController}from"../../../internal/anchored-disclosure-controller.js";import{DocumentPointerListener}from"../../../internal/document-pointer.js";import{GlassScrollLayer}from"../../../internal/glass-scroll-layer.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{hostAriaLabel,nextId}from"../../../internal/a11y.js";import{normalizeLabel}from"../../../internal/accessible-name.js";import{collectInitialSlotAssignment}from"../../../internal/initial-slot-collection.js";import{CustomElementUpgradeObserver}from"../../../internal/custom-element-upgrade-observer.js";import{acquireAriaOwnership}from"../../../internal/aria-ownership.js";import{tag}from"../../../internal/prefix.js";import{PositioningStrategyState,positioningStrategyConverter,resolveEffectivePositioningStrategy}from"../../../internal/positioning-strategy.js";import{deferredPlaceReady,syncTopLayerRelease,waitForDeferredPlacement}from"../../../internal/anchored-overlay-runtime.js";import{OwnerAnimationFrameWaiter}from"../../../internal/owner-animation-frame.js";import{rtlAwarePlacement}from"../../../internal/rtl.js";import{finiteDuration,finiteNumber}from"../../../internal/numbers.js";import{deepActiveElementIn}from"../../../internal/active-element.js";import{isKeyboardFocusEvent}from"../../../internal/focus-modality.js";import{declaredDefaultConverter,literalSetConverter,omittedEmptyStringConverter,blankNumberConverter}from"../../../internal/converters.js";import{activateNonmodalOverlay,composedContains}from"../../../internal/nonmodal-overlay-manager.js";import{setCustomState}from"../../../internal/custom-states.js";import{attachInternalsSafely}from"../../../internal/element-internals.js";import{animateRegistered}from"../../../internal/registered-animation.js";import{applyOverlayArrow}from"./overlay-arrow.js";import{liveVirtualElement,normalizeVirtualRect,OverlayAnchorIdentity,OverlayDelayTimer,resolveOverlayAnchor,resolveOverlayAccessibleTrigger,resolveOverlayInteractionTrigger}from"../../../internal/overlay-shared.js";import{styles}from"./overlay.styles.js";import{glassPopoverStyles}from"./popover-glass.styles.js";import{LYRA_DEFAULT_popover}from"../../../internal/default-strings/overlays.generated.js";import{LYRA_DEFAULT_menuLabel}from"../../../internal/default-strings/shared.generated.js";const DEFAULT_DISTANCE=8,EXPANDABLE_TRIGGER_ROLES=new Set(["application","button","checkbox","combobox","gridcell","link","listbox","menuitem","row","rowheader","tab","treeitem","columnheader","menuitemcheckbox","menuitemradio","switch"]);function supportsTriggerExpansion(element){const role=element.getAttribute("role")?.trim().split(/\s+/)[0];return role?EXPANDABLE_TRIGGER_ROLES.has(role):element.matches("button, a[href], select, summary")?!0:element.localName==="input"&&["button","submit","reset","image","checkbox"].includes(element.type)}let popoverConnectionSequence=0;const POPUP_ROLE=literalSetConverter(["dialog","menu","none"],"dialog"),POPOVER_TRIGGER_KEYWORDS=["click","hover","focus","manual","hover-card"];function normalizeTriggerList(next){const keywords=[];for(const token of String(next??"").toLowerCase().split(/\s+/)){const keyword=token;POPOVER_TRIGGER_KEYWORDS.includes(keyword)&&!keywords.includes(keyword)&&keywords.push(keyword)}return keywords.length>0?keywords.join(" "):"click"}const DEFAULT_TRIGGER_DELAY=0;class LyraPopover extends LyraElement{static{this.defaultStrings={...super.defaultStrings,menuLabel:LYRA_DEFAULT_menuLabel,popover:LYRA_DEFAULT_popover}}constructor(){super(),this._open=!1,this.placement="top",this.strategy=new PositioningStrategyState(this,this.defaultPositioningStrategy),this.topLayer=!1,this.distance=8,this.skidding=0,this._for="",this.forElement=null,this.anchor=null,this.virtualElement=null,this.interactionBoundary=null,this.withoutArrow=!1,this.arrowPlacement="anchor",this.arrowPadding=0,this.fullWidthTrigger=!1,this._trigger="click",this.showDelay=0,this.hideDelay=0,this.hoverBridge=!1,this.accessibleLabel="",this._popupRole="dialog",this._disabled=!1,this.openedByInteraction=!1,this.pinned=!1,this.suppressTriggerFocusOpen=!1,this.delayTimer=new OverlayDelayTimer,this.resolvedSide="bottom",this.anchorPositioned=!1,this.popupHidden=!0,this.disconnecting=!1,this.reconnectedWhileDisconnecting=!1,this.directionChanged=!1,this.anchorIdentity=new OverlayAnchorIdentity,this.triggerUpgrades=new CustomElementUpgradeObserver(()=>{this.isConnected&&this.syncTriggerA11y()}),this.transientRevealFrame=new OwnerAnimationFrameWaiter(this),this.positioningGeneration=0,this.generatedHostId=nextId("popover"),this.popupId=nextId("popover-popup"),this.outsidePress=new DocumentPointerListener(this,event=>this.onDocumentPointer(event)),this.hostIdObserverGeneration=0,this.connectionSequence=0,this.popoverInternals=attachInternalsSafely(this),this.onExternalTriggerKeyDown=event=>{this.onTriggerKeyDown(event)},this.onTriggerSlotChange=event=>{this.collectTriggerFromSlot(event.target)},this.onTriggerClick=()=>{if(!this.virtualAnchor&&(this.syncTriggerA11y(),!this.isManualTrigger)){if(this.cancelPendingTransition(),this.isHoverCard){this.open&&this.hide({focusTrigger:!1});return}if(this.opensOn("click")&&!this.opensOn("hover")&&!this.opensOn("focus")){this.open?this.hide():this.show();return}if(this.open&&this.pinned){this.hide();return}this.open||(this.openedByInteraction=!1,this.show()),this.pinned=this.open}},this.onTriggerPointerEnter=()=>{this.opensOn("hover")&&this.requestDelayedTransition(!0)},this.onTriggerPointerLeave=event=>{this.opensOn("hover")&&this.requestInteractionClose(event.relatedTarget)},this.onPopupPointerEnter=()=>{!this.opensOn("hover")||!this.open||this.cancelPendingTransition()},this.onPopupPointerLeave=event=>{this.opensOn("hover")&&this.requestInteractionClose(event.relatedTarget)},this.onSurfaceFocusIn=event=>{!this.opensOn("focus")||this.suppressTriggerFocusOpen||(!this.open||this.triggerElement!=null&&event.composedPath().includes(this.triggerElement))&&!isKeyboardFocusEvent(event)||this.requestDelayedTransition(!0)},this.onSurfaceFocusOut=event=>{this.opensOn("focus")&&this.requestInteractionClose(event.relatedTarget)},this.onPopupClick=event=>{if(event.defaultPrevented)return;const path=event.composedPath(),hostIndex=path.indexOf(this);if(hostIndex<0)return;const closeAction=path.slice(0,hostIndex).find(target=>target.nodeType===1&&target.getAttribute("data-popover")==="close");if(!closeAction)return;event.stopPropagation();const state2=closeAction;state2.effectiveDisabled===!0||state2.disabled===!0||closeAction.hasAttribute("disabled")||closeAction.getAttribute("aria-disabled")?.trim().toLowerCase()==="true"||closeAction.hasAttribute("inert")||closeAction.closest("[inert]")||this.hide()},this.onDocumentPointer=event=>{this.overlayHandle?.isTopmost()&&(this.isInsideLightDismissBoundary(event.composedPath())||this.hide())},this.disclosure=new AnchoredDisclosureController({host:this,isOpen:()=>this._open,setOpen:value=>this.setOpen(value),emit:name=>name==="lr-show"||name==="lr-hide"?this.emitCancelableLifecycle(name).defaultPrevented:this.emitSettledLifecycle(name).defaultPrevented,popup:()=>this.renderRoot.querySelector('[part~="popup"]'),readyToShow:async isCurrent=>{const positioned=await waitForDeferredPlacement(()=>this.cleanup);return isCurrent()&&this.open&&positioned&&this.anchorPositioned},animate:(showing,popup)=>{const offset="translateY(var(--lr-size-neg-0-25rem))";return animateRegistered(this,popup,`${this.animationNamespace}.${showing?"show":"hide"}`,this.effectiveDirection,{keyframes:showing?[{opacity:0,transform:offset},{opacity:1,transform:"translateY(0)"}]:[{opacity:1,transform:"translateY(0)"},{opacity:0,transform:offset}],durationProperties:this.animationDurationProperties(showing),easingProperties:["--lr-easing-standard"]})},afterHide:()=>{this.popupHidden=!0}}),new GlassScrollLayer(this,'[part~="popup"]')}static{this.styles=[LyraElement.styles,styles,glassPopoverStyles]}get open(){return this._open}set open(next){const normalized=!!next&&this.canOpen;if(normalized!==this._open){if(!this.hasUpdated){this.setOpen(normalized),this.isConnected&&this.connectionSequence>0&&this.updateBrowserDerivedState(()=>this.reconcileInitialPopoverPeers());return}normalized?this.show():this.hide()}}get positioningStrategy(){return this.strategy.value}set positioningStrategy(next){const previous=this.strategy.value;this.strategy.set(next),previous!==this.strategy.value&&this.onPositioningStrategyChanged(previous,this.strategy.value)}onPositioningStrategyChanged(_previous,_next){}get for(){return this._for}set for(next){this._for=next??""}get trigger(){return this._trigger}set trigger(next){const normalized=normalizeTriggerList(next);if(normalized===this._trigger)return;const old=this._trigger;this._trigger=normalized,this.requestUpdate("trigger",old)}get triggerKeywords(){return this._trigger.split(" ")}get isManualTrigger(){return this.triggerKeywords.includes("manual")}get isHoverCard(){return!this.isManualTrigger&&this.triggerKeywords.includes("hover-card")}opensOn(keyword){return this.isHoverCard?keyword==="hover"||keyword==="focus":!this.isManualTrigger&&this.triggerKeywords.includes(keyword)}get popupRole(){return this._popupRole}set popupRole(next){const normalized=POPUP_ROLE.normalize(next);if(normalized===this._popupRole)return;const old=this._popupRole;this._popupRole=normalized,this.requestUpdate("popupRole",old)}get disabled(){return this._disabled}set disabled(next){const normalized=!!next;if(normalized===this._disabled)return;const old=this._disabled;this._disabled=normalized,this.requestUpdate("disabled",old),normalized&&this.open&&(this.hasUpdated?this.hide():this.open=!1)}get defaultDistance(){return DEFAULT_DISTANCE}get defaultPositioningStrategy(){return"fixed"}get resolvedPositioningStrategy(){return resolveEffectivePositioningStrategy(this,this.strategy.authored,this.defaultPositioningStrategy)}get positioningSync(){}get animationNamespace(){return"popover"}animationDurationProperties(showing){return[showing?"--show-duration":"--hide-duration","--lr-duration-fast"]}get popupPartNames(){return["popup","dialog","popup__popup"].join(" ")}get contentPartNames(){return["content","body"].join(" ")}get triggerPopupRole(){return this.popupRole}get popupSurfaceRole(){return this.popupRole==="none"?void 0:this.popupRole}get effectivePopupLabel(){return hostAriaLabel(this)??normalizeLabel(this.accessibleLabel)??this.localize(this.triggerPopupRole==="menu"?"menuLabel":"popover")}get rendersArrow(){return!this.withoutArrow}get arrowPartNames(){return"arrow popup__arrow"}get rendersHoverBridge(){return this.hoverBridge&&this.opensOn("hover")&&this.open}get canOpen(){return!this.disabled}renderPopupContent(){return html`<slot></slot>`}onTriggerKeyDown(_event){}isInsideLightDismissBoundary(path){const boundary=this.virtualAnchor?this.virtualInteractionBoundary:this.interactionBoundary;return path.includes(this)||this.triggerElement!=null&&path.includes(this.triggerElement)||boundary!=null&&boundary.isConnected&&boundary.ownerDocument===this.ownerDocument&&path.includes(boundary)}onPopupPositioned(){this.openedByInteraction||this.overlayHandle?.focusAutofocus()}willUpdate(changed){super.willUpdate(changed);const direction=this.effectiveDirection;this.directionChanged=direction!==this.positioningDirection,this.positioningDirection=direction;const lostVirtualElement=changed.has("virtualElement")&&liveVirtualElement(changed.get("virtualElement"))&&!liveVirtualElement(this.virtualElement);(this.anchorIdentity.lostAnchorProperty(changed,this.anchor)||lostVirtualElement)&&this.open&&!this.resolveAnchor()&&this.forceClose({focusTrigger:!1}),changed.has("open")&&!this.open&&(this.anchorPositioned=!1),changed.has("open")&&this.open&&(this.popupHidden=!1),(changed.has("anchor")||changed.has("virtualElement")||changed.has("for"))&&(this.anchorPositioned=!1)}updated(changed){if(super.updated(changed),changed.has("trigger")&&(this.cancelPendingTransition(),!this.opensOn("hover")&&!this.opensOn("focus")&&(this.pinned=!1)),changed.has("showDelay")&&this.delayTimer.pendingDirection==="show"&&this.requestDelayedTransition(!0,!0),changed.has("hideDelay")&&this.delayTimer.pendingDirection==="hide"&&this.requestDelayedTransition(!1,!0),(changed.has("for")||changed.has("forElement")||changed.has("anchor")||changed.has("open"))&&this.syncAnchorIdentityObservation(),changed.has("for")||changed.has("forElement")?this.syncInteractionTrigger():changed.has("trigger")&&this.syncTriggerA11y(),this.directionChanged||changed.has("open")||changed.has("placement")||changed.has("positioningStrategy")||changed.has("topLayer")||changed.has("hoverBridge")||changed.has("trigger")||changed.has("distance")||changed.has("skidding")||changed.has("for")||changed.has("forElement")||changed.has("anchor")||changed.has("virtualElement")||changed.has("arrow")||changed.has("withoutArrow")||changed.has("arrowPlacement")||changed.has("arrowPadding")||changed.has("popupRole")){if(this.open&&this.isConnected?this.positionPopup():changed.has("open")&&this.invalidatePositioning(),changed.has("open"))if(this.open)this.isConnected&&(this.startLightDismiss(),this.activatePopoverOverlay());else{this.pinned=!1,this.openedByInteraction=!1,this.cancelPendingTransition(),this.positionedAnchor=void 0,this.stopLightDismiss(),this.suppressTriggerFocusOpen=!0;try{this.overlayHandle?.deactivate()}finally{this.suppressTriggerFocusOpen=!1}this.overlayHandle=void 0,this.virtualAnchor=void 0,this.returnFocusTo=void 0,this.virtualInteractionBoundary=void 0,this.syncInteractionTrigger()}this.isConnected&&this.syncTriggerA11y()}}firstUpdated(changed){super.firstUpdated(changed);const slot=this.triggerSlotElement;queueMicrotask(()=>{collectInitialSlotAssignment(slot,s=>this.collectTriggerFromSlot(s))})}connectedCallback(){if(this.disconnecting){this.reconnectedWhileDisconnecting=!0;return}if(super.connectedCallback(),this.connectionSequence=++popoverConnectionSequence,this.addEventListener("focusin",this.onSurfaceFocusIn),this.addEventListener("focusout",this.onSurfaceFocusOut),this.updateBrowserDerivedState(()=>this.reconcileInitialPopoverPeers()),this.syncAnchorIdentityObservation(),this.id||(this.id=this.generatedHostId),this.observeHostId(),this.syncInteractionTrigger(),this.hasUpdated&&this.open){const wasPreviouslyActivated=this.overlayHandle?.isActive()===!0;this.startLightDismiss(),wasPreviouslyActivated?this.overlayHandle.resume():this.activatePopoverOverlay(),this.popupHidden=!1,this.positionPopup()}}disconnectedCallback(){this.disconnecting=!0;try{this.teardownOnDisconnect(),super.disconnectedCallback()}finally{this.disconnecting=!1}this.reconnectedWhileDisconnecting&&(this.reconnectedWhileDisconnecting=!1,this.isConnected&&this.connectedCallback())}teardownOnDisconnect(){this.connectionSequence=0,this.anchorIdentity.stop(),this.invalidatePositioning(),this.stopLightDismiss(),this.resetHostIdObserver(),this.overlayHandle?.suspend(),this.triggerElement?.removeEventListener("click",this.onTriggerClick),this.triggerElement?.removeEventListener("keydown",this.onExternalTriggerKeyDown),this.triggerElement&&this.unbindTriggerInteractions(this.triggerElement),this.releaseTriggerA11y(),this.triggerElement=void 0,this.removeEventListener("focusin",this.onSurfaceFocusIn),this.removeEventListener("focusout",this.onSurfaceFocusOut),this.cancelPendingTransition(),this.virtualInteractionBoundary=void 0,this.pinned=!1,this.openedByInteraction=!1,this.disclosure.reset(),this.popupHidden=!0}adoptedCallback(){super.adoptedCallback(),this.anchorIdentity.stop(),this.resetHostIdObserver(),this.releaseTriggerA11y()}syncAnchorIdentityObservation(){this.anchorIdentity.stop();const directAnchor=this.open?this.anchor??this.forElement??void 0:void 0;this.anchorIdentity.observe(this,directAnchor,this.for,()=>this.anchor,directAnchorRemoved=>{if(this.resolveInteractionTrigger()!==this.triggerElement&&this.syncInteractionTrigger(),!this.open)return;const nextAnchor=this.resolveAnchor();if(directAnchorRemoved&&!nextAnchor){this.forceClose({focusTrigger:!1});return}nextAnchor!==this.positionedAnchor&&this.positionPopup()})}get connectedForElement(){const element=this.forElement;return element?.isConnected&&element.ownerDocument===this.ownerDocument?element:void 0}resolveInteractionTrigger(){return resolveOverlayInteractionTrigger(this,this.virtualAnchor,this.slottedTrigger??this.connectedForElement,this.for)}syncInteractionTrigger(slotChanged=!1){if(!this.isConnected)return;const next=this.resolveInteractionTrigger();if(next===this.triggerElement&&!slotChanged){this.syncTriggerA11y();return}this.cancelPendingTransition();const previous=this.triggerElement;if(previous?.removeEventListener("click",this.onTriggerClick),previous?.removeEventListener("keydown",this.onExternalTriggerKeyDown),previous&&this.unbindTriggerInteractions(previous),this.triggerElement=next,this.triggerUpgrades.disconnect(),this.triggerElement&&this.triggerElement!==this.slottedTrigger&&(this.triggerElement.addEventListener("click",this.onTriggerClick),this.triggerElement.addEventListener("keydown",this.onExternalTriggerKeyDown)),this.triggerElement&&this.bindTriggerInteractions(this.triggerElement),this.syncTriggerA11y(),this.open){if(previous&&next&&this.openedByInteraction&&!this.pinned&&![next,this].some(element=>element.matches(":hover"))&&!this.isWithinPopoverSurface(deepActiveElementIn(this.ownerDocument))||!this.resolveAnchor()){this.forceClose({focusTrigger:!1});return}this.updatePopoverRestoreFocusTarget(),this.positionPopup()}else this.isHoverCard&&next&&next!==previous&&next.matches(":hover")&&this.requestDelayedTransition(!0,!0)}activatePopoverOverlay(){!this.isConnected||this.overlayHandle?.isActive()||(this.overlayHandle=activateNonmodalOverlay({host:this,panel:()=>this.renderRoot.querySelector('[part~="popup"]'),onEscape:()=>{this.hide()},restoreFocusTo:this.virtualAnchor?this.returnFocusTo??null:this.accessibleTrigger}))}updatePopoverRestoreFocusTarget(){const target=this.virtualAnchor?this.returnFocusTo??null:this.accessibleTrigger;if(this.overlayHandle?.isActive()){this.overlayHandle.updateRestoreFocusTo(target);return}this.activatePopoverOverlay()}showAt(rect,options){const normalizedRect=normalizeVirtualRect(rect);if(!normalizedRect)return;const previousAnchor=this.virtualAnchor,previousReturnFocusTo=this.returnFocusTo,previousInteractionBoundary=this.virtualInteractionBoundary,bounds=new DOMRect(normalizedRect.x,normalizedRect.y,normalizedRect.width,normalizedRect.height);if(this.virtualAnchor={getBoundingClientRect:()=>bounds,contextElement:normalizedRect.contextElement},this.returnFocusTo=options?.returnFocusTo,this.virtualInteractionBoundary=options?.interactionBoundary,this.syncInteractionTrigger(),this.open){this.updatePopoverRestoreFocusTarget(),this.positionPopup();return}this.show(),!this.open&&(this.virtualAnchor=previousAnchor,this.returnFocusTo=previousReturnFocusTo,this.virtualInteractionBoundary=previousInteractionBoundary,this.syncInteractionTrigger())}resolveAnchor(){return resolveOverlayAnchor(this,{virtualAnchor:this.virtualAnchor,anchor:liveVirtualElement(this.virtualElement)?this.virtualElement:this.anchor,for:this.connectedForElement?"":this.for,trigger:this.triggerElement})}positionPopup(){if(!this.renderRoot)return;this.invalidatePositioning();const popup=this.renderRoot.querySelector('[part~="popup"]'),arrowElement=this.renderRoot.querySelector('[part~="arrow"]'),bridgeElement=this.renderRoot.querySelector('[part~="hover-bridge"]'),anchor=this.resolveAnchor();if(!this.open||!anchor||!popup){this.positionedAnchor=void 0,this.anchorPositioned=!1;return}anchor!==this.positionedAnchor&&(this.anchorPositioned=!1);const generation=this.positioningGeneration;if(this.openedByInteraction&&!this.anchorPositioned){this.cleanup=Object.assign(()=>this.transientRevealFrame.cancel(),{ready:this.transientRevealFrame.wait().then(current=>!current||generation!==this.positioningGeneration||!this.open||this.resolveAnchor()!==anchor?!1:(this.startPositioning(generation,anchor,popup,arrowElement,bridgeElement),this.cleanup?.ready??!1))});return}this.startPositioning(generation,anchor,popup,arrowElement,bridgeElement)}invalidatePositioning(){this.positioningGeneration++,this.cleanup?.(),this.cleanup=void 0}startPositioning(generation,anchor,popup,arrowElement,bridgeElement){this.placedTopLayer=syncTopLayerRelease(popup,this.placedTopLayer,this.topLayer);const operation=deferredPlaceReady(anchor,popup,{placement:rtlAwarePlacement(this.placement,this),strategy:this.topLayer?"fixed":this.resolvedPositioningStrategy,topLayer:this.topLayer,offset:finiteNumber(this.distance,this.defaultDistance),skidding:finiteNumber(this.skidding,0),sync:this.positioningSync,arrow:this.rendersArrow&&arrowElement?arrowElement:void 0,arrowPadding:Math.max(0,finiteNumber(this.arrowPadding,0)),hoverBridge:this.rendersHoverBridge&&bridgeElement?bridgeElement:void 0,onPlaced:({placement,arrow})=>{if(generation!==this.positioningGeneration)return;const becamePositioned=!this.anchorPositioned||this.positionedAnchor!==anchor;this.positionedAnchor=anchor,this.anchorPositioned=!0;const side=applyOverlayArrow(arrowElement,{placement,coords:arrow,enabled:this.rendersArrow,arrowPlacement:this.arrowPlacement,arrowPadding:Math.max(0,finiteNumber(this.arrowPadding,0)),rtl:this.effectiveDirection==="rtl",sizeProperty:"--arrow-size",fallbackSizeProperty:"--lr-overlay-arrow-size"});side!==this.resolvedSide&&(this.resolvedSide=side),this.updateComplete.then(()=>{generation!==this.positioningGeneration||!this.open||this.resolveAnchor()!==anchor||becamePositioned&&this.onPopupPositioned()})}});this.cleanup=operation,operation.ready.then(positioned=>{!positioned&&generation===this.positioningGeneration&&this.open&&this.forceClose({focusTrigger:!1})})}syncTriggerA11y(){const popup=this.renderRoot?.querySelector('[part~="popup"]')??null,contribution={attributes:{"aria-haspopup":this.triggerPopupRole==="none"?null:this.triggerPopupRole,"aria-expanded":this.open?"true":"false"},controls:popup?[popup]:[]},accessibleTrigger=this.accessibleTrigger;this.observeAccessibleTrigger(accessibleTrigger);const semanticTrigger=accessibleTrigger&&!this.isHoverCard&&supportsTriggerExpansion(accessibleTrigger)?accessibleTrigger:null;this.accessibleTriggerAria?this.accessibleTriggerAria.update(semanticTrigger,contribution):this.accessibleTriggerAria=acquireAriaOwnership(semanticTrigger,contribution),this.overlayHandle?.isActive()&&!this.virtualAnchor&&this.overlayHandle.updateRestoreFocusTo(accessibleTrigger)}get accessibleTrigger(){const trigger=this.triggerElement;return trigger?resolveOverlayAccessibleTrigger(trigger):null}observeAccessibleTrigger(target){this.accessibleTriggerObserver?.disconnect();const trigger=this.triggerElement;if(!trigger||!this.isConnected)return;const view=this.ownerDocument.defaultView;if(view?.MutationObserver){this.accessibleTriggerObserver??=new view.MutationObserver(()=>{this.isConnected&&this.syncTriggerA11y()});const roots=new Set([trigger]);trigger.shadowRoot&&roots.add(trigger.shadowRoot);let current=target;for(;current&&current!==trigger;){const root=current.getRootNode();if(root.nodeType!==11||!("host"in root))break;roots.add(root),current=root.host}for(const root of roots)this.accessibleTriggerObserver.observe(root,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["role","tabindex","disabled","href","type"]})}this.triggerUpgrades.observeElement(trigger)}releaseTriggerA11y(){this.accessibleTriggerObserver?.disconnect(),this.accessibleTriggerObserver=void 0,this.triggerUpgrades.disconnect(),this.accessibleTriggerAria?.release(),this.accessibleTriggerAria=void 0}collectTriggerFromSlot(slot){const next=slot.assignedElements({flatten:!0})[0];next!==this.slottedTrigger&&(this.slottedTrigger=next,this.syncInteractionTrigger(!0))}requestInteractionClose(next){this.pinned||this.isWithinPopoverSurface(next)||this.hasFocusWithinSurface()||this.requestDelayedTransition(!1)}isWithinPopoverSurface(target){if(target===null||target.nodeType!==1)return!1;const element=target;if(composedContains(this,element))return!0;const popup=this.renderRoot?.querySelector('[part~="popup"]')??null;return popup&&composedContains(popup,element)?!0:this.triggerElement!=null&&composedContains(this.triggerElement,element)}hasFocusWithinSurface(){const active=deepActiveElementIn(this.ownerDocument);return active===null||this.triggerElement&&composedContains(this.triggerElement,active)?!1:this.isWithinPopoverSurface(active)}requestDelayedTransition(next,deferImmediate=!1){if(this.cancelPendingTransition(),next&&!this.canOpen)return;const commit=()=>{next?(this.openedByInteraction=!0,this.show()):this.hide()},delay=Math.max(0,finiteDuration(next?this.showDelay:this.hideDelay,DEFAULT_TRIGGER_DELAY)),view=this.ownerDocument.defaultView;if(!view||delay<=0&&!deferImmediate){commit();return}this.delayTimer.schedule(view,delay,next?"show":"hide",commit)}cancelPendingTransition(){this.delayTimer.cancel()}triggerNeedsOwnFocusListeners(trigger){return!composedContains(this,trigger)}bindTriggerInteractions(trigger){trigger.addEventListener("mouseenter",this.onTriggerPointerEnter),trigger.addEventListener("mouseleave",this.onTriggerPointerLeave),this.triggerNeedsOwnFocusListeners(trigger)&&(trigger.addEventListener("focusin",this.onSurfaceFocusIn),trigger.addEventListener("focusout",this.onSurfaceFocusOut))}unbindTriggerInteractions(trigger){trigger.removeEventListener("mouseenter",this.onTriggerPointerEnter),trigger.removeEventListener("mouseleave",this.onTriggerPointerLeave),trigger.removeEventListener("focusin",this.onSurfaceFocusIn),trigger.removeEventListener("focusout",this.onSurfaceFocusOut)}startLightDismiss(){this.outsidePress.bind()}stopLightDismiss(){this.outsidePress.unbind()}observeHostId(){const ownerDocument=this.ownerDocument;if(this.hostIdObserver&&this.hostIdObserverDocument===ownerDocument)return;this.resetHostIdObserver();const MutationObserverCtor=ownerDocument.defaultView?.MutationObserver;if(!MutationObserverCtor||!this.isConnected)return;const generation=this.hostIdObserverGeneration,observer=new MutationObserverCtor(()=>{this.hostIdObserver!==observer||this.hostIdObserverDocument!==ownerDocument||this.hostIdObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||(this.id||(this.id=this.generatedHostId),this.syncTriggerA11y())});this.hostIdObserver=observer,this.hostIdObserverDocument=ownerDocument,observer.observe(this,{attributes:!0,attributeFilter:["id"]})}resetHostIdObserver(){this.hostIdObserverGeneration+=1,this.hostIdObserver?.disconnect(),this.hostIdObserver=void 0,this.hostIdObserverDocument=void 0}setOpen(next){if(this._open===next)return;const old=this._open;this._open=next,setCustomState(this.popoverInternals,"open",next),this.requestUpdate("open",old)}syncOpenAttribute(){this.toggleAttribute("open",this._open)}show(){return this.canOpen?this.disclosure.show(()=>!this.closePopoverPeers()):Promise.resolve()}hide(options){return this.disclosure.hide(()=>this.prepareClose(options))}hasPopoverAncestor(peer){const trigger=this.triggerElement??this.resolveInteractionTrigger();return composedContains(peer,this)||trigger!==void 0&&composedContains(peer,trigger)}closePopoverPeers(){if(this.virtualAnchor||this.localName!==tag("popover"))return!0;const root=this.getRootNode();for(const peer of root.querySelectorAll(tag("popover")))if(!(peer===this||!peer.open||peer.virtualAnchor)&&!this.hasPopoverAncestor(peer)&&(peer.hide({focusTrigger:!1}),peer.open))return!1;return!0}reconcileInitialPopoverPeers(){if(!this.isConnected||!this._open||this.virtualAnchor||this.localName!==tag("popover"))return;const root=this.getRootNode(),peers=[];let winner;for(const peer of root.querySelectorAll(tag("popover")))!peer.isConnected||!peer._open||peer.virtualAnchor||!(peer.connectionSequence>0)||(peers.push(peer),(!winner||peer.connectionSequence>winner.connectionSequence)&&(winner=peer));if(winner!==this){winner?.hasPopoverAncestor(this)||this.closeForInitialPeerReconciliation();return}for(const peer of peers)peer!==this&&!this.hasPopoverAncestor(peer)&&peer.closeForInitialPeerReconciliation()}closeForInitialPeerReconciliation(){this._open&&(this.disclosure.reset(),this.invalidatePositioning(),this.stopLightDismiss(),this.overlayHandle?.deactivate({restoreFocus:!1}),this.overlayHandle=void 0,this.positionedAnchor=void 0,this.anchorPositioned=!1,this.popupHidden=!0,this.returnFocusTo=void 0,this.setOpen(!1),this.syncOpenAttribute())}forceClose(options){return this.disclosure.forceClose(()=>this.prepareClose(options))}prepareClose(options){options?.focusTrigger===!1&&(this.overlayHandle?.deactivate({restoreFocus:!1}),this.overlayHandle=void 0),this.anchorPositioned||(this.popupHidden=!0)}emitCancelableLifecycle(name){return this.emit(name,null,{cancelable:!0})}emitSettledLifecycle(name){return this.emit(name)}render(){const popupRole=this.popupSurfaceRole;return html`
2
2
  <span part="trigger" @click=${this.onTriggerClick} @keydown=${this.onTriggerKeyDown}>
3
3
  <slot name="trigger" @slotchange=${this.onTriggerSlotChange}></slot>
4
4
  </span>
@@ -8,4 +8,4 @@ import{__decorate}from"tslib";import{AnchoredDisclosureController}from"../../../
8
8
  <div part=${this.contentPartNames}>${this.renderPopupContent()}</div>
9
9
  ${this.rendersArrow?html`<span part=${this.arrowPartNames+" arrow-"+this.resolvedSide}></span>`:nothing}
10
10
  </div>
11
- `}}__decorate([property({type:Boolean,reflect:!0})],LyraPopover.prototype,"open",null),__decorate([property({reflect:!0,converter:declaredDefaultConverter("top")})],LyraPopover.prototype,"placement",void 0),__decorate([property({attribute:"positioning-strategy",reflect:!0,converter:positioningStrategyConverter})],LyraPopover.prototype,"positioningStrategy",null),__decorate([property({type:Boolean,attribute:"top-layer",reflect:!0})],LyraPopover.prototype,"topLayer",void 0),__decorate([property({converter:blankNumberConverter(8)})],LyraPopover.prototype,"distance",void 0),__decorate([property({converter:blankNumberConverter(0)})],LyraPopover.prototype,"skidding",void 0),__decorate([property({reflect:!0,converter:omittedEmptyStringConverter})],LyraPopover.prototype,"for",null),__decorate([property({attribute:!1})],LyraPopover.prototype,"forElement",void 0),__decorate([property({attribute:!1})],LyraPopover.prototype,"anchor",void 0),__decorate([property({attribute:!1})],LyraPopover.prototype,"interactionBoundary",void 0),__decorate([property({type:Boolean,attribute:"without-arrow",reflect:!0})],LyraPopover.prototype,"withoutArrow",void 0),__decorate([property({attribute:"arrow-placement"})],LyraPopover.prototype,"arrowPlacement",void 0),__decorate([property({converter:blankNumberConverter(0),attribute:"arrow-padding"})],LyraPopover.prototype,"arrowPadding",void 0),__decorate([property()],LyraPopover.prototype,"trigger",null),__decorate([property({converter:blankNumberConverter(0),attribute:"show-delay"})],LyraPopover.prototype,"showDelay",void 0),__decorate([property({converter:blankNumberConverter(0),attribute:"hide-delay"})],LyraPopover.prototype,"hideDelay",void 0),__decorate([property({type:Boolean,attribute:"hover-bridge",reflect:!0})],LyraPopover.prototype,"hoverBridge",void 0),__decorate([property({attribute:"aria-label"})],LyraPopover.prototype,"accessibleLabel",void 0),__decorate([property({attribute:"popup-role",converter:POPUP_ROLE})],LyraPopover.prototype,"popupRole",null),__decorate([property({type:Boolean,reflect:!0})],LyraPopover.prototype,"disabled",null),__decorate([query('slot[name="trigger"]')],LyraPopover.prototype,"triggerSlotElement",void 0),__decorate([state()],LyraPopover.prototype,"resolvedSide",void 0),__decorate([state()],LyraPopover.prototype,"anchorPositioned",void 0),__decorate([state()],LyraPopover.prototype,"popupHidden",void 0);export{LyraPopover};
11
+ `}}__decorate([property({type:Boolean,reflect:!0})],LyraPopover.prototype,"open",null),__decorate([property({reflect:!0,converter:declaredDefaultConverter("top")})],LyraPopover.prototype,"placement",void 0),__decorate([property({attribute:"positioning-strategy",reflect:!0,converter:positioningStrategyConverter})],LyraPopover.prototype,"positioningStrategy",null),__decorate([property({type:Boolean,attribute:"top-layer",reflect:!0})],LyraPopover.prototype,"topLayer",void 0),__decorate([property({converter:blankNumberConverter(8)})],LyraPopover.prototype,"distance",void 0),__decorate([property({converter:blankNumberConverter(0)})],LyraPopover.prototype,"skidding",void 0),__decorate([property({reflect:!0,converter:omittedEmptyStringConverter})],LyraPopover.prototype,"for",null),__decorate([property({attribute:!1})],LyraPopover.prototype,"forElement",void 0),__decorate([property({attribute:!1})],LyraPopover.prototype,"anchor",void 0),__decorate([property({attribute:!1})],LyraPopover.prototype,"virtualElement",void 0),__decorate([property({attribute:!1})],LyraPopover.prototype,"interactionBoundary",void 0),__decorate([property({type:Boolean,attribute:"without-arrow",reflect:!0})],LyraPopover.prototype,"withoutArrow",void 0),__decorate([property({attribute:"arrow-placement"})],LyraPopover.prototype,"arrowPlacement",void 0),__decorate([property({converter:blankNumberConverter(0),attribute:"arrow-padding"})],LyraPopover.prototype,"arrowPadding",void 0),__decorate([property({type:Boolean,attribute:"full-width-trigger",reflect:!0})],LyraPopover.prototype,"fullWidthTrigger",void 0),__decorate([property()],LyraPopover.prototype,"trigger",null),__decorate([property({converter:blankNumberConverter(0),attribute:"show-delay"})],LyraPopover.prototype,"showDelay",void 0),__decorate([property({converter:blankNumberConverter(0),attribute:"hide-delay"})],LyraPopover.prototype,"hideDelay",void 0),__decorate([property({type:Boolean,attribute:"hover-bridge",reflect:!0})],LyraPopover.prototype,"hoverBridge",void 0),__decorate([property({attribute:"aria-label"})],LyraPopover.prototype,"accessibleLabel",void 0),__decorate([property({attribute:"popup-role",converter:POPUP_ROLE})],LyraPopover.prototype,"popupRole",null),__decorate([property({type:Boolean,reflect:!0})],LyraPopover.prototype,"disabled",null),__decorate([query('slot[name="trigger"]')],LyraPopover.prototype,"triggerSlotElement",void 0),__decorate([state()],LyraPopover.prototype,"resolvedSide",void 0),__decorate([state()],LyraPopover.prototype,"anchorPositioned",void 0),__decorate([state()],LyraPopover.prototype,"popupHidden",void 0);export{LyraPopover};
@@ -87,10 +87,12 @@ export type LyraTooltipLabelMode='description'|'label'|'none';export type{LyraAr
87
87
  * @csspart tooltip - The tooltip popup wrapper. It is the same node as `base`.
88
88
  * @csspart popup - The tooltip popup. It is the same node as `base` and `tooltip`.
89
89
  * @csspart base__popup - Shoelace exported popup alias on the same node.
90
+ * @csspart tooltip__popup - Web Awesome-named alias on the same popup node.
90
91
  * @csspart body - Tooltip content wrapper.
91
92
  * @csspart arrow - The arrow element, rendered unless `without-arrow` is set. Its part name also
92
93
  * carries the resolved side (`arrow-top`, `arrow-bottom`, `arrow-left`, `arrow-right`).
93
94
  * @csspart base__arrow - Shoelace exported alias on the arrow.
95
+ * @csspart tooltip__arrow - Web Awesome-named alias on the arrow.
94
96
  * @cssprop [--max-width=var(--lr-tooltip-max-inline-size,var(--lr-size-20rem))] - Maximum inline
95
97
  * size of the tooltip.
96
98
  * @cssprop --lr-tooltip-max-inline-size - Retained Lyra fallback for `--max-width`.
@@ -3,10 +3,10 @@ import{__decorate}from"tslib";import{AnchoredDisclosureController}from"../../../
3
3
  ${this.namedTriggerMode?html`<slot name="trigger" @slotchange=${this.onTriggerSlotChange}></slot>`:html`<slot @slotchange=${this.onTriggerSlotChange}></slot>`}
4
4
  </span>
5
5
  <slot name="__lr-tooltip-description" hidden></slot>
6
- <div id=${this.tooltipId} part="popup base tooltip base__popup" role=${this.interactiveContent?"dialog":"tooltip"} aria-label=${popupLabel} ?hidden=${this.popupHidden} ?data-hidden=${!this.open||!this.anchorPositioned} ?data-has-arrow=${this.rendersArrow} @mouseenter=${this.onPopupEnter} @mouseleave=${this.onPopupLeave} @focusin=${this.onPopupEnter} @focusout=${this.onPopupLeave}>
6
+ <div id=${this.tooltipId} part="popup base tooltip base__popup tooltip__popup" role=${this.interactiveContent?"dialog":"tooltip"} aria-label=${popupLabel} ?hidden=${this.popupHidden} ?data-hidden=${!this.open||!this.anchorPositioned} ?data-has-arrow=${this.rendersArrow} @mouseenter=${this.onPopupEnter} @mouseleave=${this.onPopupLeave} @focusin=${this.onPopupEnter} @focusout=${this.onPopupLeave}>
7
7
  <span part="body">
8
8
  ${this.namedTriggerMode?html`<slot @slotchange=${this.onContentSlotChange}>${this.content}</slot>`:html`<slot name="content" @slotchange=${this.onContentSlotChange}>${this.content}</slot>`}${this.blankContentAssignment?this.content:nothing}
9
9
  </span>
10
- ${this.rendersArrow?html`<span part="arrow base__arrow arrow-${this.resolvedSide}"></span>`:nothing}
10
+ ${this.rendersArrow?html`<span part="arrow base__arrow tooltip__arrow arrow-${this.resolvedSide}"></span>`:nothing}
11
11
  </div>
12
12
  `}}__decorate([property({type:Boolean,reflect:!0})],LyraTooltip.prototype,"open",null),__decorate([property({converter:declaredDefaultConverter("hover focus")})],LyraTooltip.prototype,"trigger",void 0),__decorate([property({attribute:"label-mode",converter:TOOLTIP_LABEL_MODE})],LyraTooltip.prototype,"labelMode",null),__decorate([property({type:Boolean})],LyraTooltip.prototype,"manual",void 0),__decorate([property({converter:blankNumberConverter(150),attribute:"show-delay"})],LyraTooltip.prototype,"showDelay",void 0),__decorate([property({converter:blankNumberConverter(0),attribute:"hide-delay"})],LyraTooltip.prototype,"hideDelay",void 0),__decorate([property({reflect:!0,converter:declaredDefaultConverter("top")})],LyraTooltip.prototype,"placement",void 0),__decorate([property({converter:blankNumberConverter(8)})],LyraTooltip.prototype,"distance",void 0),__decorate([property({converter:blankNumberConverter(0)})],LyraTooltip.prototype,"skidding",void 0),__decorate([property({reflect:!0,converter:omittedEmptyStringConverter})],LyraTooltip.prototype,"for",null),__decorate([property({attribute:!1})],LyraTooltip.prototype,"anchor",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraTooltip.prototype,"disabled",void 0),__decorate([property({attribute:"positioning-strategy",reflect:!0,converter:positioningStrategyConverter})],LyraTooltip.prototype,"positioningStrategy",null),__decorate([property({type:Boolean,reflect:!0})],LyraTooltip.prototype,"hoist",null),__decorate([property({type:Boolean,attribute:"top-layer",reflect:!0})],LyraTooltip.prototype,"topLayer",void 0),__decorate([property({type:Boolean,attribute:"without-arrow",reflect:!0})],LyraTooltip.prototype,"withoutArrow",void 0),__decorate([property({attribute:"arrow-placement"})],LyraTooltip.prototype,"arrowPlacement",void 0),__decorate([property({converter:blankNumberConverter(0),attribute:"arrow-padding"})],LyraTooltip.prototype,"arrowPadding",void 0),__decorate([property()],LyraTooltip.prototype,"content",void 0),__decorate([property({attribute:"aria-label"})],LyraTooltip.prototype,"accessibleLabel",void 0),__decorate([state()],LyraTooltip.prototype,"interactiveContent",void 0),__decorate([state()],LyraTooltip.prototype,"blankContentAssignment",void 0),__decorate([state()],LyraTooltip.prototype,"resolvedSide",void 0),__decorate([state()],LyraTooltip.prototype,"anchorPositioned",void 0),__decorate([state()],LyraTooltip.prototype,"popupHidden",void 0);export{LyraTooltip};
@@ -39,6 +39,7 @@ export type LyraToastSize=LyraSize;export interface LyraToastItemEventMap{'lr-sh
39
39
  * @csspart close-icon__svg - The close glyph's SVG element.
40
40
  * @csspart progress-ring - The auto-dismiss progress ring around the close glyph.
41
41
  * @csspart progress-ring__base - The progress ring's SVG element.
42
+ * @csspart progress-ring__progress-ring - Upstream name on the same SVG as `progress-ring__base`.
42
43
  * @csspart progress-ring__indicator - The elapsed-time indicator circle.
43
44
  * @csspart progress-ring__label - The ring's centered close-glyph container.
44
45
  * @csspart progress-ring__track - The progress ring's background circle.
@@ -1,7 +1,7 @@
1
1
  import{__decorate}from"tslib";import{OwnedFrame}from"../../../internal/owned-timer.js";import{waitForTransitionSettle}from"../../../internal/css-motion-time.js";import{html}from"lit";import{property,state}from"lit/decorators.js";import{keyed}from"lit/directives/keyed.js";import{composedParentElement}from"../../../internal/a11y.js";import{CustomElementUpgradeObserver}from"../../../internal/custom-element-upgrade-observer.js";import{composedAccessibilityTextResult}from"../../../internal/accessibility-visibility.js";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{LyraElement}from"../../../internal/lyra-element.js";import{closeIcon}from"../../../internal/icons.js";import{getSegmenter}from"../../../internal/intl-cache.js";import{prefersReducedMotion}from"../../../internal/motion.js";import{finiteDuration}from"../../../internal/numbers.js";import{composedContains,deepActiveElement}from"../../../internal/overlay-manager.js";import{applyComposedFocusRepair,captureComposedFocusRepair,isActionableElement}from"../../../internal/focus-navigation.js";import{tag}from"../../../internal/prefix.js";import{normalizeSize}from"../../../internal/variants.js";import{variants}from"../../../internal/variants.styles.js";import{styles}from"./toast-item.styles.js";import{TOAST_REGION_ENQUEUE,TOAST_REGION_EVICT,TOAST_REGION_REJECT,TOAST_REGION_SET_ACTIVE,toastRegionControllerFor}from"./toast-region-protocol.js";import{blankNumberConverter}from"../../../internal/converters.js";import{LYRA_DEFAULT_closeWithContext,LYRA_DEFAULT_closeWithTruncatedContext,LYRA_DEFAULT_toastContentIncomplete}from"../../../internal/default-strings/overlays.generated.js";import{LYRA_DEFAULT_close}from"../../../internal/default-strings/shared.generated.js";const CLOSE_LABEL_GRAPHEME_LIMIT=40;function isAssertiveVariant(variant){return variant==="danger"||variant==="warning"}function truncateGraphemes(value,limit,locale){if(typeof Intl.Segmenter!="function")return{snippet:value,truncated:!1};let graphemes;try{graphemes=[...getSegmenter(locale,{granularity:"grapheme"}).segment(value)].map(({segment})=>segment)}catch(error){if(!(error instanceof RangeError))throw error;graphemes=[...getSegmenter(void 0,{granularity:"grapheme"}).segment(value)].map(({segment})=>segment)}return graphemes.length>limit?{snippet:graphemes.slice(0,limit).join(""),truncated:!0}:{snippet:value,truncated:!1}}class LyraToastItem extends LyraElement{constructor(){super(...arguments),this.duration=5e3,this.size="m",this.variant="neutral",this.withIcon=!1,this.elapsedMs=0,this.startedAt=0,this.timerStarted=!1,this.showFrame=new OwnedFrame(this),this.showGeneration=0,this.showCompletionGeneration=0,this.showCompletionRunning=!1,this.showAccepted=!1,this.afterShowEmitted=!1,this.admitted=!1,this.requestingRegionAdmission=!1,this.hovering=!1,this.focused=!1,this.messageUpgrades=new CustomElementUpgradeObserver(()=>{this.isConnected&&(this.bindMessageObserverTargets(),this.recomputeMessageText())}),this.announcements=new AnnouncementSinkController(this,{eager:["polite","assertive"]}),this.lastAnnouncedMessage="",this.onMessageSlotChange=event=>{const target=event.target;target?.nodeType!==1||target.localName!=="slot"||(this.bindMessageObserverTargets(),this.recomputeMessageText())},this.hideCompletionRunning=!1,this.hideGeneration=0,this.afterHideEmitted=!1,this.messageText="",this.messageTextTruncated=!1,this.hiding=!1,this.progressRun=0,this.surfaceMounted=!1,this.interactionReady=!1,this.resumeTimer=()=>{if(this.timer!==void 0&&(this.timerOwner?.clearTimeout(this.timer),this.timer=void 0,this.timerOwner=void 0),!this.isConnected||!this.admitted||this.hiding||!this.hasAttribute("data-visible")||this.hovering||this.focused||this.ownerDocument.hidden)return;const duration=this.safeDuration;if(!isFinite(duration)||duration<=0)return;const remaining=duration-this.elapsedMs;if(remaining<=0){this.requestHide("timeout");return}const view=this.ownerDocument.defaultView;if(!view)return;this.startedAt=view.performance.now(),this.timerOwner=view;const timer=view.setTimeout(()=>{this.timer!==timer||this.timerOwner!==view||(this.timer=void 0,this.timerOwner=void 0,this.requestHide("timeout"))},remaining);this.timer=timer},this.onVisibilityChange=()=>{this.pauseTimer(),this.resumeTimer()},this.pauseTimer=()=>{if(this.timer!==void 0){const owner=this.timerOwner;owner?.clearTimeout(this.timer),this.timer=void 0,this.timerOwner=void 0,owner&&(this.elapsedMs+=owner.performance.now()-this.startedAt)}},this.onPointerEnter=()=>{this.hovering=!0,this.pauseTimer()},this.onPointerLeave=()=>{this.hovering=!1,!this.focused&&!this.hiding&&this.resumeTimer()},this.onFocusIn=event=>{const previous=event.relatedTarget;previous?.nodeType===1&&!composedContains(this,previous)&&previous.isConnected&&(this.focusReturnTarget=previous);const activeElement=deepActiveElement(this.ownerDocument);this.pendingFocusRepair=activeElement&&typeof activeElement.focus=="function"?captureComposedFocusRepair(this,activeElement)??void 0:void 0,this.focused=!0,this.pauseTimer()},this.onFocusOut=event=>{if(event.relatedTarget===null&&this.hasAttribute("data-visible")){const parent=this.parentElement,clearIfStillOwned=()=>{this.isConnected&&this.parentElement===parent&&(this.pendingFocusRepair=void 0)},view=this.ownerDocument.defaultView;view?view.queueMicrotask(clearIfStillOwned):queueMicrotask(clearIfStillOwned)}else event.relatedTarget?.nodeType===1&&!composedContains(this,event.relatedTarget)&&(this.pendingFocusRepair=void 0);this.focused=!1,!this.hovering&&!this.hiding&&this.resumeTimer()}}static{this.defaultStrings={...super.defaultStrings,close:LYRA_DEFAULT_close,closeWithContext:LYRA_DEFAULT_closeWithContext,closeWithTruncatedContext:LYRA_DEFAULT_closeWithTruncatedContext,toastContentIncomplete:LYRA_DEFAULT_toastContentIncomplete}}static{this.styles=[LyraElement.styles,variants,styles]}get toastItemElement(){return this.renderRoot?.querySelector('[part="toast-item"]')??null}get effectiveSize(){const value=this.size;return["2xs","xs","s","m","l","xl","small","medium","large"].includes(value)?normalizeSize(value):"m"}get safeDuration(){return this.duration===1/0?1/0:finiteDuration(this.duration,5e3,0)}willUpdate(changed){super.willUpdate(changed),this.setAttribute("data-effective-size",this.effectiveSize),changed.has("duration")&&this.timerStarted&&this.admitted&&this.hasAttribute("data-visible")&&!this.hovering&&!this.focused&&(this.pauseTimer(),this.resumeTimer())}updated(changed){if(super.updated(changed),this.hasAttribute("data-visible")){const previousVariant=changed.get("variant");changed.has("variant")&&isAssertiveVariant(this.variant)!==isAssertiveVariant(previousVariant??"neutral")?this.announceMessage(!0):(changed.has("messageText")||changed.has("messageTextTruncated"))&&this.announceMessage()}this.shadowRoot?.querySelector('[part~="close-icon"] svg')?.setAttribute("part","close-icon__svg")}firstUpdated(changed){super.firstUpdated(changed),this.requestRegionAdmission(),this.admitted&&this.scheduleShow()}connectedCallback(){super.connectedCallback();const MutationObserverCtor=this.ownerDocument.defaultView?.MutationObserver;if(this.messageObserver=MutationObserverCtor?new MutationObserverCtor(()=>{this.bindMessageObserverTargets(),this.recomputeMessageText()}):void 0,this.addEventListener("slotchange",this.onMessageSlotChange),this.ownerDocument.addEventListener("visibilitychange",this.onVisibilityChange),this.bindMessageObserverTargets(),this.hasUpdated?this.recomputeMessageText():this.seedFirstRenderState(()=>this.recomputeMessageText()),this.requestRegionAdmission(),!!this.hasUpdated){if(this.hiding){this.completeHide();return}!this.hasAttribute("data-visible")&&this.admitted?this.scheduleShow():this.admitted&&this.timerStarted&&!this.hovering&&!this.focused&&(this.completeShow(),this.resumeTimer())}}requestRegionAdmission(){const controller=toastRegionControllerFor(this);if(controller){this.requestingRegionAdmission=!0;try{controller[TOAST_REGION_ENQUEUE](this)}finally{this.requestingRegionAdmission=!1}return}const parent=this.parentElement;if(parent?.localName===tag("toast")){this.regionOwner=void 0,this.admitted=!1,this.setAttribute("data-toast-queued",""),this.cancelPendingShow(),this.pauseTimer(),this.setSurfaceAvailability(!1);const releaseUnavailableOwner=()=>{this.parentElement===parent&&!toastRegionControllerFor(this)&&this.remove()},view=this.ownerDocument.defaultView,registry=view?.customElements;registry?.get(this.localName)&&!registry.get(parent.localName)?registry.whenDefined(parent.localName).then(releaseUnavailableOwner):view?view.queueMicrotask(releaseUnavailableOwner):queueMicrotask(releaseUnavailableOwner);return}this.regionOwner=void 0,this.admitted=!0,this.removeAttribute("data-toast-queued"),this.hasAttribute("data-visible")&&(this.setSurfaceAvailability(!0),this.pendingFocusRepair&&(applyComposedFocusRepair(this.pendingFocusRepair),this.pendingFocusRepair=void 0))}[TOAST_REGION_SET_ACTIVE](owner,active){if(this.parentElement===owner){if(this.regionOwner=owner,this.admitted=active,this.toggleAttribute("data-toast-queued",!active),!active){const focusTarget=this.adjacentToastOrReturnTarget(),activeElement=deepActiveElement(this.ownerDocument),repair=this.pendingFocusRepair??(activeElement&&typeof activeElement.focus=="function"?captureComposedFocusRepair(this,focusTarget):null);this.cancelPendingShow(),this.pauseTimer(),this.setSurfaceAvailability(!1),repair&&applyComposedFocusRepair(repair,focusTarget),this.pendingFocusRepair=void 0;return}if(this.hasAttribute("data-visible")&&!this.hiding){this.setSurfaceAvailability(!0),this.pendingFocusRepair&&(applyComposedFocusRepair(this.pendingFocusRepair),this.pendingFocusRepair=void 0),!this.requestingRegionAdmission&&this.timerStarted&&!this.hovering&&!this.focused&&this.resumeTimer(),this.completeShow();return}this.isConnected&&this.hasUpdated&&!this.hiding&&!this.hasAttribute("data-visible")&&this.scheduleShow()}}[TOAST_REGION_EVICT](owner,_reason){this.regionOwner===owner&&(this.regionOwner=void 0,this.admitted=!1,this.cancelPendingShow(),this.showAccepted=!1,this.pauseTimer(),this.setSurfaceAvailability(!1),this.parentElement===owner&&this.remove())}setSurfaceAvailability(available){this.surfaceMounted=available,this.interactionReady=available;const surface=this.shadowRoot?.querySelector('[part="toast-item"]');surface&&(surface.hidden=!available,surface.inert=!available)}cancelPendingShow(){this.showGeneration+=1,this.showAccepted&&!this.afterShowEmitted&&(this.showCompletionGeneration+=1),this.showFrame.cancel(),this.cancelShowAnimation?.(),this.cancelShowAnimation=void 0}scheduleShow(){if(this.showFrame.pending||this.hiding||!this.admitted)return;const generation=++this.showGeneration;this.showFrame.schedule(()=>{this.prepareShow(generation)})}async prepareShow(generation){if(await this.updateComplete,generation!==this.showGeneration||!this.isConnected||!this.admitted||this.hiding)return;if(this.emit("lr-show",null,{cancelable:!0}).defaultPrevented){if(generation!==this.showGeneration)return;const owner=this.regionOwner;owner?owner[TOAST_REGION_REJECT](this):this.remove();return}if(generation!==this.showGeneration||!this.isConnected||!this.admitted||this.hiding)return;this.surfaceMounted=!0;const surface=this.shadowRoot?.querySelector('[part="toast-item"]');surface&&(surface.hidden=!1,surface.offsetWidth),this.setAttribute("data-visible",""),this.bindMessageObserverTargets(),this.recomputeMessageText(),this.interactionReady=!0,surface&&(surface.inert=!1),this.announceMessage(!0),this.showAccepted=!0,this.afterShowEmitted=!1,this.showCompletionGeneration+=1,this.completeShow(),this.startTimer()}async completeShow(){if(this.showCompletionRunning||!this.showAccepted||this.afterShowEmitted||this.hiding||!this.admitted||!this.hasAttribute("data-visible"))return;this.showCompletionRunning=!0;const generation=this.showCompletionGeneration;if(await this.waitForVisualCompletion("show"),this.showCompletionRunning=!1,generation!==this.showCompletionGeneration||!this.isConnected||!this.admitted||this.hiding||!this.hasAttribute("data-visible")){this.isConnected&&this.admitted&&!this.hiding&&this.completeShow();return}this.afterShowEmitted||!this.showAccepted||(this.afterShowEmitted=!0,this.showAccepted=!1,this.emit("lr-after-show"))}disconnectedCallback(){const activeElement=deepActiveElement(this.ownerDocument);!this.pendingFocusRepair&&!this.hiding&&this.hasAttribute("data-visible")&&activeElement&&typeof activeElement.focus=="function"&&(this.pendingFocusRepair=captureComposedFocusRepair(this,activeElement)??void 0),super.disconnectedCallback(),this.removeEventListener("slotchange",this.onMessageSlotChange),this.ownerDocument.removeEventListener("visibilitychange",this.onVisibilityChange),this.messageObserver?.disconnect(),this.messageObserver=void 0,this.messageUpgrades.disconnect(),this.hiding&&!this.afterHideEmitted&&this.hideGeneration++,this.cancelPendingShow(),this.cancelHideAnimation?.(),this.cancelHideAnimation=void 0,this.pauseTimer(),this.hovering=!1,this.focused=!1,!this.hasAttribute("data-visible")&&!this.hiding&&(this.surfaceMounted=!1,this.interactionReady=!1)}startTimer(){this.timerStarted=!0,this.elapsedMs=0,this.resumeTimer()}clearTimer(){this.timer!==void 0&&this.timerOwner?.clearTimeout(this.timer),this.timer=void 0,this.timerOwner=void 0}waitForVisualCompletion(kind){(kind==="show"?this.cancelShowAnimation:this.cancelHideAnimation)?.();const surface=this.shadowRoot?.querySelector('[part="toast-item"]'),watch=waitForTransitionSettle(surface??null,this,{reducedMotion:prefersReducedMotion(this),includeAnimation:!0});if(!watch.pending)return watch.finished;const cancelKey=kind==="show"?"cancelShowAnimation":"cancelHideAnimation",cancel=()=>watch.cancel();return this[cancelKey]=cancel,watch.finished.then(()=>{this[cancelKey]===cancel&&(this[cancelKey]=void 0)})}observeMessageNode(node){if(this.messageObserver){if(node.nodeType===3){this.messageObserver.observe(node,{characterData:!0});return}node.nodeType!==1&&node.nodeType!==11||this.messageObserver.observe(node,{attributes:!0,attributeFilter:["alt","aria-hidden","aria-label","aria-labelledby","class","contenteditable","hidden","href","inert","id","role","slot","style","tabindex"],childList:!0,characterData:!0,subtree:!0})}}bindMessageObserverTargets(){if(this.messageObserver){if(this.messageObserver.disconnect(),this.observeMessageNode(this),this.hasAttribute("data-visible")){let ancestor=composedParentElement(this);for(;ancestor;)this.messageObserver.observe(ancestor,{attributes:!0,attributeFilter:["aria-hidden","class","hidden","inert","style"]}),ancestor=composedParentElement(ancestor)}for(const slot of this.querySelectorAll("slot"))for(const assigned of slot.assignedNodes({flatten:!0}))this.observeMessageNode(assigned)}}observeLabelReferenceRoot(root){this.messageObserver?.observe(root,{attributes:!0,attributeFilter:["id"],childList:!0,subtree:!0})}recomputeMessageText(){const slot=this.renderRoot?.querySelector("slot:not([name])"),lightDomNodes=this.childNodes,messageNodes=slot?slot.assignedNodes({flatten:!0}):Array.from(lightDomNodes??[]).filter(node=>node.nodeType!==1||!node.getAttribute("slot")),result=composedAccessibilityTextResult(messageNodes,{requireRendered:!1,shouldPrune:element=>{const slotName=element.getAttribute("slot");return slotName!==null&&slotName!==""||isActionableElement(element)?!0:(this.messageUpgrades.observeElement(element),element.hasAttribute("tabindex")&&element.getAttribute("tabindex")!=="-1")},skipRootAncestorValidation:!0});this.messageText=result.text.trim().replace(/\s+/g," "),this.messageTextTruncated=result.truncated;for(const root of result.labelReferenceRoots)this.observeLabelReferenceRoot(root);for(const reference of result.referencedElements)this.observeMessageNode(reference);for(const root of result.traversedShadowRoots)this.observeMessageNode(root)}announceMessage(force=!1){const message=this.messageText,announcement=this.messageTextTruncated?message?`${message}…`:this.localize("toastContentIncomplete"):message;!force&&announcement===this.lastAnnouncedMessage||(this.lastAnnouncedMessage=announcement,this.announcements.announce(announcement,isAssertiveVariant(this.variant)?"assertive":"polite"))}get closeLabel(){const text=this.messageText;if(!text&&this.messageTextTruncated)return this.localize("closeWithContext",void 0,{snippet:this.localize("toastContentIncomplete")});if(!text)return this.localize("close");const{snippet,truncated}=truncateGraphemes(text,CLOSE_LABEL_GRAPHEME_LIMIT,this.effectiveLocale);return this.messageTextTruncated||truncated?this.localize("closeWithTruncatedContext",void 0,{snippet}):this.localize("closeWithContext",void 0,{snippet})}async hide(){await this.requestHide("programmatic")}requestHide(reason){if(this.hideRequest)return this.hideRequest;if(this.hiding)return Promise.resolve();let resolve,reject;const completion=new Promise((resolveCompletion,rejectCompletion)=>{resolve=resolveCompletion,reject=rejectCompletion});return this.hideRequest=completion,this.emit("lr-hide",null,{cancelable:!0}).defaultPrevented||this.emit("lr-close-request",{reason},{cancelable:!0}).defaultPrevented?(reason==="timeout"&&(this.elapsedMs=0,this.startedAt=0,this.progressRun+=1,this.isConnected&&!this.hovering&&!this.focused&&this.resumeTimer()),this.hideRequest===completion&&(this.hideRequest=void 0),resolve(),completion):(this.hiding=!0,this.showAccepted=!1,this.showCompletionGeneration+=1,this.shadowRoot?.querySelector('[part="close-button"]')?.setAttribute("aria-disabled","true"),this.cancelShowAnimation?.(),this.cancelShowAnimation=void 0,this.clearTimer(),this.removeAttribute("data-visible"),this.bindMessageObserverTargets(),this.setAttribute("data-hiding",""),this.emit("lr-close",{reason}),this.completeHide().then(()=>{this.hideRequest===completion&&(this.hideRequest=void 0),resolve()},reason2=>{this.hideRequest===completion&&(this.hideRequest=void 0),reject(reason2)}),completion)}async completeHide(){if(this.hideCompletionRunning||this.afterHideEmitted)return;this.hideCompletionRunning=!0;const generation=this.hideGeneration;if(await this.waitForVisualCompletion("hide"),this.hideCompletionRunning=!1,generation!==this.hideGeneration||!this.isConnected){this.isConnected&&await this.completeHide();return}this.afterHideEmitted||(this.repairFocusBeforeRemoval(),this.afterHideEmitted=!0,this.emit("lr-after-hide"),this.remove())}repairFocusBeforeRemoval(){const active=deepActiveElement(this.ownerDocument);composedContains(this,active)&&this.focusAdjacentToastOrReturn()}adjacentToastOrReturnTarget(){const findAdjacent=direction=>{let element=this[direction];for(;element;){if(element.localName===tag("toast-item")){const item=element,surface=item.shadowRoot?.querySelector('[part="toast-item"]');if(!item.hasAttribute("data-hiding")&&!item.hasAttribute("data-toast-queued")&&item.hasAttribute("data-visible")&&item.isConnected&&surface&&!surface.hidden&&!surface.inert)return item.shadowRoot?.querySelector('[part="close-button"]')??null}element=element[direction]}return null};return findAdjacent("nextElementSibling")??findAdjacent("previousElementSibling")??(this.focusReturnTarget?.isConnected&&!composedContains(this,this.focusReturnTarget)?this.focusReturnTarget:null)}focusAdjacentToastOrReturn(){this.adjacentToastOrReturnTarget()?.focus()}renderCloseControl(){const close=html`<span part="close-icon">${closeIcon()}</span>`,duration=this.safeDuration;return!Number.isFinite(duration)||duration<=0?close:html`
2
2
  <span part="progress-ring" aria-hidden="true">
3
3
  ${keyed(this.progressRun,html`
4
- <svg part="progress-ring__base" viewBox="0 0 20 20" focusable="false" >
4
+ <svg part="progress-ring__base progress-ring__progress-ring" viewBox="0 0 20 20" focusable="false" >
5
5
  <circle part="progress-ring__track" cx="10" cy="10" r="8" pathLength="1" ></circle>
6
6
  <circle part="progress-ring__indicator" cx="10" cy="10" r="8" pathLength="1" style=${`animation-duration: ${duration}ms; animation-delay: -${Math.min(this.elapsedMs,duration)}ms`} ></circle>
7
7
  </svg>
@@ -1 +1 @@
1
- import{iconAction,iconActionHover,iconActionActive}from"../../../internal/icon-action.styles.js";import{activeFill,disabledControl,focusRing,iconHitTarget}from"../../../internal/interactive-control.styles.js";import{css}from"lit";import{glassSurface}from"../../../internal/glass-surface.styles.js";import{overlaySurfaceFill}from"../../../internal/overlay-surface.styles.js";const styles=css` :host{display:block;--_lr-toast-accent-width:var(--accent-width, var(--lr-size-4px));--_lr-toast-show-duration:var( --show-duration, var(--lr-transition-base, 180ms ease-out) );--_lr-toast-hide-duration:var( --hide-duration, var(--lr-transition-base, 180ms ease-out) );--_lr-toast-padding:var(--padding, var(--lr-space-m));--_lr-toast-font-size:var(--lr-font-size-m);--_lr-toast-accent-color:var(--lr-color-border)}:host([variant]:not([variant=neutral])){--_lr-toast-accent-color:var(--lr-color-fill-loud)}:host([data-effective-size="2xs"]){--_lr-toast-padding:var(--padding, var(--lr-space-2xs));--_lr-toast-font-size:var(--lr-font-size-2xs)}:host([data-effective-size=xs]){--_lr-toast-padding:var(--padding, var(--lr-space-xs));--_lr-toast-font-size:var(--lr-font-size-xs)}:host([data-effective-size=s]){--_lr-toast-padding:var(--padding, var(--lr-space-s));--_lr-toast-font-size:var(--lr-font-size-md-sm)}:host([data-effective-size=m]){--_lr-toast-padding:var(--padding, var(--lr-space-m));--_lr-toast-font-size:var(--lr-font-size-m)}:host([data-effective-size=l]){--_lr-toast-padding:var(--padding, var(--lr-space-l));--_lr-toast-font-size:var(--lr-font-size-lg)}:host([data-effective-size=xl]){--_lr-toast-padding:var(--padding, calc(var(--lr-space-l) * 1.5));--_lr-toast-font-size:var(--lr-font-size-xl)}[part=toast-item]{position:relative;display:flex;align-items:start;gap:var(--lr-toast-item-gap,var(--lr-space-s));inline-size:100%;padding:var(--lr-toast-padding,var(--_lr-toast-padding));padding-inline-start:calc(var(--lr-toast-padding,var(--_lr-toast-padding)) + var(--lr-toast-accent-width,var(--_lr-toast-accent-width)));font-size:var(--lr-toast-font-size,var(--_lr-toast-font-size));${overlaySurfaceFill} color:var(--lr-color-text);border-radius:var(--lr-toast-item-radius,var(--lr-overlay-radius,var(--lr-radius)));box-shadow:var(--lr-overlay-shadow-modal,var(--lr-shadow-l));opacity:0;transform:translateY(var(--lr-size-neg-8px));transition:opacity var(--lr-toast-show-duration,var(--_lr-toast-show-duration)),transform var(--lr-toast-show-duration,var(--_lr-toast-show-duration))}[part=toast-item][hidden]{display:none}:host([data-hiding]) [part=toast-item]{transition:opacity var(--lr-toast-hide-duration,var(--_lr-toast-hide-duration)),transform var(--lr-toast-hide-duration,var(--_lr-toast-hide-duration))}:host([data-visible]) [part=toast-item]{opacity:1;transform:none}@media (prefers-reduced-motion:reduce){[part=toast-item]{transition-duration:0.01ms!important}}[part=accent]{position:absolute;inset-block:0;inset-inline-start:0;inline-size:var(--lr-toast-accent-width,var(--_lr-toast-accent-width));background:var(--lr-toast-accent-color,var(--_lr-toast-accent-color));border-start-start-radius:var(--lr-toast-item-radius,var(--lr-overlay-radius,var(--lr-radius)));border-end-start-radius:var(--lr-toast-item-radius,var(--lr-overlay-radius,var(--lr-radius)))}[part=icon]{display:inline-flex;flex:0 1 auto;min-inline-size:0;max-inline-size:var(--lr-icon-button-size);overflow:hidden;color:var(--lr-toast-accent-color,var(--_lr-toast-accent-color))}[part=icon] ::slotted(*){max-inline-size:100%}[part=content]{flex:1 1 auto;min-inline-size:0;overflow-wrap:anywhere;unicode-bidi:plaintext}::slotted(button){display:inline-block;margin-inline:var(--lr-space-s)!important;padding:0;border:none;background:none;font:inherit;font-weight:var(--lr-font-weight-bold);color:var(--lr-color-on-quiet);text-decoration:underline;cursor:pointer}::slotted(button:hover){color:var(--lr-color-text)}::slotted(button:focus-visible){${focusRing}}::slotted([hidden]:not([hidden="until-found" i])){display:none}[part=close-button]{${iconAction} --_lr-icon-button-color-default:var(--lr-color-text-quiet);--_lr-icon-button-color-hover-default:var(--lr-toast-close-button-hover-color, var(--lr-color-text));--_lr-icon-button-color-active-default:var(--lr-toast-close-button-active-color, var(--lr-color-text));--_lr-icon-button-background-hover-default:var(--lr-toast-close-button-hover-bg, transparent);--_lr-icon-button-background-active-default:var(--lr-toast-close-button-active-bg, ${activeFill("transparent")});position:relative;display:inline-grid;place-items:center;flex:0 0 auto;margin-inline-start:auto;font-size:var(--lr-size-1em);line-height:var(--lr-line-height-none);padding:var(--lr-space-xs);${iconHitTarget}}[part=progress-ring]{position:relative;display:inline-grid;place-items:center;inline-size:var(--lr-size-24px);block-size:var(--lr-size-24px);pointer-events:none}[part=progress-ring__base]{position:absolute;inset:0;inline-size:100%;block-size:100%;overflow:visible;fill:none;transform:rotate(-90deg)}[part=progress-ring__track],[part=progress-ring__indicator]{fill:none;stroke-width:var(--lr-border-width-medium)}[part=progress-ring__track]{stroke:var(--lr-color-border)}[part=progress-ring__indicator]{stroke:var(--lr-toast-accent-color,var(--_lr-toast-accent-color));stroke-linecap:round;stroke-dasharray:1;stroke-dashoffset:0;animation-timing-function:linear;animation-fill-mode:forwards}:host([data-visible]) [part=progress-ring__indicator]{animation-name:var(--_lr-motion-animation,lr-toast-progress)}:host(:hover) [part=progress-ring__indicator],:host(:focus-within) [part=progress-ring__indicator]{animation-play-state:paused}[part=progress-ring__label],[part=close-icon]{display:inline-flex;align-items:center;justify-content:center}[part=close-icon__svg]{display:block}[part=close-button]:where(:hover):where(:not([aria-disabled=true])){${iconActionHover}}[part=close-button]:where(:active):where(:not([aria-disabled=true])){${iconActionActive}}[part=close-button][aria-disabled=true]{${disabledControl}}[part=close-button]:focus-visible{${focusRing}}@keyframes lr-toast-progress{to{stroke-dashoffset:1}}@media (prefers-reduced-motion:reduce){[part=progress-ring__indicator]{animation:none!important;stroke-dashoffset:1}}${glassSurface('[part="toast-item"]',css`var(--lr-overlay-surface, var(--lr-color-surface-container-high))`)} `;export{styles};
1
+ import{iconAction,iconActionHover,iconActionActive}from"../../../internal/icon-action.styles.js";import{activeFill,disabledControl,focusRing,iconHitTarget}from"../../../internal/interactive-control.styles.js";import{css}from"lit";import{glassSurface}from"../../../internal/glass-surface.styles.js";import{overlaySurfaceFill}from"../../../internal/overlay-surface.styles.js";const styles=css` :host{display:block;--_lr-toast-accent-width:var(--accent-width, var(--lr-size-4px));--_lr-toast-show-duration:var( --show-duration, var(--lr-transition-base, 180ms ease-out) );--_lr-toast-hide-duration:var( --hide-duration, var(--lr-transition-base, 180ms ease-out) );--_lr-toast-padding:var(--padding, var(--lr-space-m));--_lr-toast-font-size:var(--lr-font-size-m);--_lr-toast-accent-color:var(--lr-color-border)}:host([variant]:not([variant=neutral])){--_lr-toast-accent-color:var(--lr-color-fill-loud)}:host([data-effective-size="2xs"]){--_lr-toast-padding:var(--padding, var(--lr-space-2xs));--_lr-toast-font-size:var(--lr-font-size-2xs)}:host([data-effective-size=xs]){--_lr-toast-padding:var(--padding, var(--lr-space-xs));--_lr-toast-font-size:var(--lr-font-size-xs)}:host([data-effective-size=s]){--_lr-toast-padding:var(--padding, var(--lr-space-s));--_lr-toast-font-size:var(--lr-font-size-md-sm)}:host([data-effective-size=m]){--_lr-toast-padding:var(--padding, var(--lr-space-m));--_lr-toast-font-size:var(--lr-font-size-m)}:host([data-effective-size=l]){--_lr-toast-padding:var(--padding, var(--lr-space-l));--_lr-toast-font-size:var(--lr-font-size-lg)}:host([data-effective-size=xl]){--_lr-toast-padding:var(--padding, calc(var(--lr-space-l) * 1.5));--_lr-toast-font-size:var(--lr-font-size-xl)}[part=toast-item]{position:relative;display:flex;align-items:start;gap:var(--lr-toast-item-gap,var(--lr-space-s));inline-size:100%;padding:var(--lr-toast-padding,var(--_lr-toast-padding));padding-inline-start:calc(var(--lr-toast-padding,var(--_lr-toast-padding)) + var(--lr-toast-accent-width,var(--_lr-toast-accent-width)));font-size:var(--lr-toast-font-size,var(--_lr-toast-font-size));${overlaySurfaceFill} color:var(--lr-color-text);border-radius:var(--lr-toast-item-radius,var(--lr-overlay-radius,var(--lr-radius)));box-shadow:var(--lr-overlay-shadow-modal,var(--lr-shadow-l));opacity:0;transform:translateY(var(--lr-size-neg-8px));transition:opacity var(--lr-toast-show-duration,var(--_lr-toast-show-duration)),transform var(--lr-toast-show-duration,var(--_lr-toast-show-duration))}[part=toast-item][hidden]{display:none}:host([data-hiding]) [part=toast-item]{transition:opacity var(--lr-toast-hide-duration,var(--_lr-toast-hide-duration)),transform var(--lr-toast-hide-duration,var(--_lr-toast-hide-duration))}:host([data-visible]) [part=toast-item]{opacity:1;transform:none}@media (prefers-reduced-motion:reduce){[part=toast-item]{transition-duration:0.01ms!important}}[part=accent]{position:absolute;inset-block:0;inset-inline-start:0;inline-size:var(--lr-toast-accent-width,var(--_lr-toast-accent-width));background:var(--lr-toast-accent-color,var(--_lr-toast-accent-color));border-start-start-radius:var(--lr-toast-item-radius,var(--lr-overlay-radius,var(--lr-radius)));border-end-start-radius:var(--lr-toast-item-radius,var(--lr-overlay-radius,var(--lr-radius)))}[part=icon]{display:inline-flex;flex:0 1 auto;min-inline-size:0;max-inline-size:var(--lr-icon-button-size);overflow:hidden;color:var(--lr-toast-accent-color,var(--_lr-toast-accent-color))}[part=icon] ::slotted(*){max-inline-size:100%}[part=content]{flex:1 1 auto;min-inline-size:0;overflow-wrap:anywhere;unicode-bidi:plaintext}::slotted(button){display:inline-block;margin-inline:var(--lr-space-s)!important;padding:0;border:none;background:none;font:inherit;font-weight:var(--lr-font-weight-bold);color:var(--lr-color-on-quiet);text-decoration:underline;cursor:pointer}::slotted(button:hover){color:var(--lr-color-text)}::slotted(button:focus-visible){${focusRing}}::slotted([hidden]:not([hidden="until-found" i])){display:none}[part=close-button]{${iconAction} --_lr-icon-button-color-default:var(--lr-color-text-quiet);--_lr-icon-button-color-hover-default:var(--lr-toast-close-button-hover-color, var(--lr-color-text));--_lr-icon-button-color-active-default:var(--lr-toast-close-button-active-color, var(--lr-color-text));--_lr-icon-button-background-hover-default:var(--lr-toast-close-button-hover-bg, transparent);--_lr-icon-button-background-active-default:var(--lr-toast-close-button-active-bg, ${activeFill("transparent")});position:relative;display:inline-grid;place-items:center;flex:0 0 auto;margin-inline-start:auto;font-size:var(--lr-size-1em);line-height:var(--lr-line-height-none);padding:var(--lr-space-xs);${iconHitTarget}}[part=progress-ring]{position:relative;display:inline-grid;place-items:center;inline-size:var(--lr-size-24px);block-size:var(--lr-size-24px);pointer-events:none}[part~=progress-ring__base]{position:absolute;inset:0;inline-size:100%;block-size:100%;overflow:visible;fill:none;transform:rotate(-90deg)}[part=progress-ring__track],[part=progress-ring__indicator]{fill:none;stroke-width:var(--lr-border-width-medium)}[part=progress-ring__track]{stroke:var(--lr-color-border)}[part=progress-ring__indicator]{stroke:var(--lr-toast-accent-color,var(--_lr-toast-accent-color));stroke-linecap:round;stroke-dasharray:1;stroke-dashoffset:0;animation-timing-function:linear;animation-fill-mode:forwards}:host([data-visible]) [part=progress-ring__indicator]{animation-name:var(--_lr-motion-animation,lr-toast-progress)}:host(:hover) [part=progress-ring__indicator],:host(:focus-within) [part=progress-ring__indicator]{animation-play-state:paused}[part=progress-ring__label],[part=close-icon]{display:inline-flex;align-items:center;justify-content:center}[part=close-icon__svg]{display:block}[part=close-button]:where(:hover):where(:not([aria-disabled=true])){${iconActionHover}}[part=close-button]:where(:active):where(:not([aria-disabled=true])){${iconActionActive}}[part=close-button][aria-disabled=true]{${disabledControl}}[part=close-button]:focus-visible{${focusRing}}@keyframes lr-toast-progress{to{stroke-dashoffset:1}}@media (prefers-reduced-motion:reduce){[part=progress-ring__indicator]{animation:none!important;stroke-dashoffset:1}}${glassSurface('[part="toast-item"]',css`var(--lr-overlay-surface, var(--lr-color-surface-container-high))`)} `;export{styles};
@@ -28,6 +28,12 @@ count:number;}export interface LyraToastEventMap{'lr-toast-overflow':CustomEvent
28
28
  * @csspart stack - The fl-column container holding the items.
29
29
  * @cssprop --gap - Mapped alias for `--lr-toast-gap`.
30
30
  * @cssprop --width - Mapped alias for `--lr-toast-width`.
31
+ * @cssprop [--lr-toast-inset-block=var(--lr-space-l)] - Distance between the region and the
32
+ * viewport's top and bottom edges. Each placement is its own region element, so
33
+ * `lr-toast[placement^='bottom']` scopes it to one region. The device safe-area insets still win
34
+ * wherever they are larger.
35
+ * @cssprop [--lr-toast-inset-inline=var(--lr-space-l)] - Distance between the region and the
36
+ * viewport's inline-start and inline-end edges, scoped per region the same way.
31
37
  * @cssprop [--lr-toast-gap=var(--lr-space-s)] - Gap between stacked items.
32
38
  * @cssprop [--lr-toast-width=var(--lr-size-28rem)] - Inline size of the stack, capped by the
33
39
  * usable logical safe-area rectangle.