@aceshooting/lyra-ui 13.0.1 → 14.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 (723) hide show
  1. package/CHANGELOG.md +329 -0
  2. package/custom-elements.json +1 -1
  3. package/dist/cli/migration-contract.json +1 -1
  4. package/dist/components/agent-tools/activity-feed/activity-feed.class.d.ts +23 -15
  5. package/dist/components/agent-tools/activity-feed/activity-feed.class.js +9 -6
  6. package/dist/components/agent-tools/agent-trace/agent-trace.class.d.ts +12 -3
  7. package/dist/components/agent-tools/agent-trace/agent-trace.class.js +2 -1
  8. package/dist/components/agent-tools/approval-queue/approval-queue.class.d.ts +4 -2
  9. package/dist/components/agent-tools/approval-queue/approval-queue.class.js +1 -1
  10. package/dist/components/agent-tools/artifact-panel/artifact-panel.styles.js +1 -1
  11. package/dist/components/agent-tools/commit-card/commit-card.class.d.ts +3 -1
  12. package/dist/components/agent-tools/commit-card/commit-card.class.js +2 -2
  13. package/dist/components/agent-tools/compare-panel/compare-panel.class.d.ts +2 -1
  14. package/dist/components/agent-tools/compare-panel/compare-panel.styles.js +1 -1
  15. package/dist/components/agent-tools/prompt-studio/prompt-studio.class.d.ts +6 -2
  16. package/dist/components/agent-tools/prompt-studio/prompt-studio.class.js +8 -8
  17. package/dist/components/agent-tools/result-card/result-card.class.d.ts +1 -1
  18. package/dist/components/agent-tools/result-card/result-card.class.js +1 -1
  19. package/dist/components/agent-tools/result-card/result-field.class.d.ts +1 -1
  20. package/dist/components/agent-tools/result-card/result-field.class.js +1 -1
  21. package/dist/components/agent-tools/schema-viewer/schema-viewer.class.d.ts +5 -5
  22. package/dist/components/agent-tools/schema-viewer/schema-viewer.class.js +23 -10
  23. package/dist/components/agent-tools/span-waterfall/span-waterfall.class.d.ts +13 -6
  24. package/dist/components/agent-tools/span-waterfall/span-waterfall.class.js +3 -3
  25. package/dist/components/agent-tools/span-waterfall/span-waterfall.styles.js +1 -1
  26. package/dist/components/agent-tools/stack-trace/stack-trace-parse.js +3 -3
  27. package/dist/components/agent-tools/stack-trace/stack-trace.class.d.ts +1 -1
  28. package/dist/components/agent-tools/stack-trace/stack-trace.class.js +1 -1
  29. package/dist/components/agent-tools/subagent-panel/subagent-panel.class.js +1 -1
  30. package/dist/components/agent-tools/subagent-panel/subagent-panel.styles.js +1 -1
  31. package/dist/components/agent-tools/task-list/task-list.class.d.ts +1 -2
  32. package/dist/components/agent-tools/task-list/task-list.class.js +2 -2
  33. package/dist/components/agent-tools/terminal/terminal.class.d.ts +11 -2
  34. package/dist/components/agent-tools/terminal/terminal.class.js +5 -5
  35. package/dist/components/agent-tools/terminal/terminal.styles.js +1 -1
  36. package/dist/components/agent-tools/test-results/test-results.class.d.ts +4 -2
  37. package/dist/components/agent-tools/test-results/test-results.class.js +2 -2
  38. package/dist/components/agent-tools/thinking-panel/thinking-panel.class.d.ts +2 -0
  39. package/dist/components/agent-tools/thinking-panel/thinking-panel.styles.js +1 -1
  40. package/dist/components/agent-tools/tool-approval-dialog/tool-approval-dialog.class.js +1 -1
  41. package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.d.ts +2 -2
  42. package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.js +1 -1
  43. package/dist/components/agent-tools/tool-param-form/tool-param-form.class.js +3 -2
  44. package/dist/components/agent-tools/tool-param-form/tool-param-form.d.ts +1 -1
  45. package/dist/components/agent-tools/tool-param-form/tool-param-form.js +1 -1
  46. package/dist/components/agent-tools/tool-result-dialog/tool-result-dialog.class.js +2 -2
  47. package/dist/components/agent-tools/tool-result-dialog/tool-result-dialog.styles.js +1 -1
  48. package/dist/components/agent-tools/tool-result-view/registry.d.ts +2 -1
  49. package/dist/components/agent-tools/tool-result-view/tool-result-view.class.d.ts +1 -1
  50. package/dist/components/agent-tools/tool-result-view/tool-result-view.class.js +1 -1
  51. package/dist/components/agent-tools/tool-select-dialog/tool-select-dialog.class.d.ts +18 -12
  52. package/dist/components/agent-tools/tool-select-dialog/tool-select-dialog.class.js +7 -7
  53. package/dist/components/agent-tools/tool-timeline/tool-timeline.class.d.ts +9 -3
  54. package/dist/components/agent-tools/tool-timeline/tool-timeline.class.js +1 -1
  55. package/dist/components/agent-tools/trace-tree/span.d.ts +3 -1
  56. package/dist/components/agent-tools/trace-tree/span.js +1 -1
  57. package/dist/components/agent-tools/trace-tree/trace-tree.styles.js +1 -1
  58. package/dist/components/charts/chart/box-plot.class.d.ts +12 -3
  59. package/dist/components/charts/chart/box-plot.class.js +9 -9
  60. package/dist/components/charts/chart/box-plot.styles.js +1 -1
  61. package/dist/components/charts/chart/chart-core-loader.js +1 -1
  62. package/dist/components/charts/chart/chart-feature-loader.js +1 -1
  63. package/dist/components/charts/chart/chart-preload.d.ts +1 -1
  64. package/dist/components/charts/chart/chart-preload.js +1 -1
  65. package/dist/components/charts/chart/chart.class.d.ts +33 -10
  66. package/dist/components/charts/chart/chart.class.js +23 -14
  67. package/dist/components/charts/chart/chart.styles.js +1 -1
  68. package/dist/components/charts/chart/histogram-bin.js +1 -1
  69. package/dist/components/charts/chart/lite-chart.class.d.ts +20 -11
  70. package/dist/components/charts/chart/lite-chart.class.js +17 -11
  71. package/dist/components/charts/chart/lite-chart.styles.js +1 -1
  72. package/dist/components/conversation/agent-workspace/agent-workspace.class.d.ts +1 -1
  73. package/dist/components/conversation/agent-workspace/agent-workspace.class.js +2 -2
  74. package/dist/components/conversation/audio-visualizer/audio-visualizer.class.d.ts +10 -5
  75. package/dist/components/conversation/audio-visualizer/audio-visualizer.class.js +1 -1
  76. package/dist/components/conversation/branch-picker/branch-picker.class.d.ts +4 -2
  77. package/dist/components/conversation/branch-picker/branch-picker.class.js +1 -1
  78. package/dist/components/conversation/branch-picker/branch-picker.styles.js +1 -1
  79. package/dist/components/conversation/chat-composer/chat-composer.class.d.ts +6 -2
  80. package/dist/components/conversation/chat-composer/chat-composer.class.js +3 -3
  81. package/dist/components/conversation/chat-composer/chat-composer.styles.js +1 -1
  82. package/dist/components/conversation/chat-message/chat-message.class.d.ts +4 -3
  83. package/dist/components/conversation/chat-message/chat-message.class.js +2 -2
  84. package/dist/components/conversation/chat-message/chat-message.styles.js +1 -1
  85. package/dist/components/conversation/chat-viewport/chat-viewport.styles.js +1 -1
  86. package/dist/components/conversation/code-block/code-block-core.class.d.ts +4 -3
  87. package/dist/components/conversation/code-block/code-block-core.class.js +1 -1
  88. package/dist/components/conversation/code-block/code-block-shared.d.ts +3 -3
  89. package/dist/components/conversation/code-block/code-block-shared.js +2 -2
  90. package/dist/components/conversation/code-block/code-block.class.d.ts +4 -3
  91. package/dist/components/conversation/code-block/code-block.class.js +1 -1
  92. package/dist/components/conversation/code-block/code-block.styles.js +1 -1
  93. package/dist/components/conversation/code-block/code-loader.d.ts +1 -1
  94. package/dist/components/conversation/code-block/code-loader.js +1 -1
  95. package/dist/components/conversation/code-block/shiki-types.d.ts +2 -0
  96. package/dist/components/conversation/code-block/shiki-types.js +1 -1
  97. package/dist/components/conversation/conversation-item/conversation-item.class.js +1 -1
  98. package/dist/components/conversation/conversation-item/conversation-item.styles.js +1 -1
  99. package/dist/components/conversation/generation-metrics/generation-metrics.styles.js +1 -1
  100. package/dist/components/conversation/markdown/katex-loader.d.ts +4 -4
  101. package/dist/components/conversation/markdown/katex-loader.js +1 -1
  102. package/dist/components/conversation/markdown/markdown-base.class.js +1 -1
  103. package/dist/components/conversation/markdown/markdown-core.class.d.ts +1 -1
  104. package/dist/components/conversation/markdown/markdown-loader.d.ts +1 -1
  105. package/dist/components/conversation/markdown/markdown-loader.js +1 -1
  106. package/dist/components/conversation/markdown/markdown-shared.d.ts +6 -1
  107. package/dist/components/conversation/markdown/markdown-shared.js +5 -4
  108. package/dist/components/conversation/markdown/markdown.class.d.ts +1 -1
  109. package/dist/components/conversation/message-actions/message-actions.class.d.ts +18 -3
  110. package/dist/components/conversation/message-actions/message-actions.class.js +2 -2
  111. package/dist/components/conversation/message-actions/message-actions.styles.js +1 -1
  112. package/dist/components/conversation/message-actions/toolbar-actions.d.ts +3 -1
  113. package/dist/components/conversation/message-actions/toolbar-actions.js +1 -1
  114. package/dist/components/conversation/message-feedback/message-feedback.class.d.ts +40 -15
  115. package/dist/components/conversation/message-feedback/message-feedback.class.js +7 -3
  116. package/dist/components/conversation/message-feedback/message-feedback.styles.js +1 -1
  117. package/dist/components/conversation/message-parts/message-parts.class.d.ts +10 -4
  118. package/dist/components/conversation/message-parts/message-parts.class.js +2 -2
  119. package/dist/components/conversation/message-parts/message-parts.styles.js +1 -1
  120. package/dist/components/conversation/model-select/model-select.class.d.ts +5 -2
  121. package/dist/components/conversation/model-select/model-select.class.js +8 -5
  122. package/dist/components/conversation/model-settings-panel/model-settings-panel.class.d.ts +3 -5
  123. package/dist/components/conversation/model-settings-panel/model-settings-panel.class.js +2 -1
  124. package/dist/components/conversation/prompt-input/prompt-input.class.d.ts +9 -2
  125. package/dist/components/conversation/prompt-input/prompt-input.class.js +3 -3
  126. package/dist/components/conversation/prompt-input/prompt-input.styles.js +1 -1
  127. package/dist/components/conversation/prompt-queue/prompt-queue.class.d.ts +20 -4
  128. package/dist/components/conversation/prompt-queue/prompt-queue.class.js +1 -1
  129. package/dist/components/conversation/prompt-queue/prompt-queue.styles.js +1 -1
  130. package/dist/components/conversation/push-to-talk/push-to-talk.class.d.ts +17 -8
  131. package/dist/components/conversation/push-to-talk/push-to-talk.class.js +1 -1
  132. package/dist/components/conversation/push-to-talk/push-to-talk.styles.js +1 -1
  133. package/dist/components/conversation/selection-toolbar/selection-toolbar.class.d.ts +6 -3
  134. package/dist/components/conversation/selection-toolbar/selection-toolbar.class.js +1 -1
  135. package/dist/components/conversation/selection-toolbar/selection-toolbar.styles.js +1 -1
  136. package/dist/components/conversation/thread-list/thread-list.class.d.ts +14 -4
  137. package/dist/components/conversation/thread-list/thread-list.class.js +11 -11
  138. package/dist/components/conversation/thread-list/thread-list.styles.js +1 -1
  139. package/dist/components/conversation/transcript-feed/transcript-feed.class.d.ts +2 -0
  140. package/dist/components/conversation/transcript-feed/transcript-feed.class.js +1 -1
  141. package/dist/components/conversation/transcript-feed/transcript-feed.styles.js +1 -1
  142. package/dist/components/conversation/typing-indicator/typing-indicator.class.d.ts +2 -1
  143. package/dist/components/conversation/typing-indicator/typing-indicator.class.js +1 -1
  144. package/dist/components/conversation/usage-badge/usage-badge-overlay-runtime.d.ts +3 -0
  145. package/dist/components/conversation/usage-badge/usage-badge-overlay-runtime.js +1 -0
  146. package/dist/components/conversation/usage-badge/usage-badge.class.d.ts +4 -2
  147. package/dist/components/conversation/usage-badge/usage-badge.class.js +1 -1
  148. package/dist/components/conversation/voice-picker/voice-picker.class.d.ts +12 -4
  149. package/dist/components/conversation/voice-picker/voice-picker.class.js +8 -5
  150. package/dist/components/conversation/voice-picker/voice-picker.styles.js +1 -1
  151. package/dist/components/conversation/widget-renderer/resolve.d.ts +4 -6
  152. package/dist/components/conversation/widget-renderer/resolve.js +1 -1
  153. package/dist/components/data/calendar/calendar.class.d.ts +16 -5
  154. package/dist/components/data/calendar/calendar.class.js +2 -2
  155. package/dist/components/data/calendar/calendar.styles.js +1 -1
  156. package/dist/components/data/condition-builder/condition-builder.class.d.ts +3 -1
  157. package/dist/components/data/condition-builder/condition-builder.class.js +15 -1
  158. package/dist/components/data/context-meter/context-meter.class.d.ts +3 -1
  159. package/dist/components/data/context-meter/context-meter.class.js +4 -4
  160. package/dist/components/data/data-grid/data-grid.class.d.ts +51 -6
  161. package/dist/components/data/data-grid/data-grid.class.js +25 -11
  162. package/dist/components/data/data-grid/data-grid.styles.js +1 -1
  163. package/dist/components/data/document-library/document-library.class.d.ts +5 -2
  164. package/dist/components/data/document-library/document-library.class.js +1 -1
  165. package/dist/components/data/env-list/env-list.class.js +1 -1
  166. package/dist/components/data/file-tree/file-tree.class.d.ts +2 -1
  167. package/dist/components/data/file-tree/file-tree.class.js +1 -1
  168. package/dist/components/data/flow-canvas/flow-canvas.class.d.ts +24 -14
  169. package/dist/components/data/flow-canvas/flow-canvas.class.js +1 -2
  170. package/dist/components/data/flow-canvas/flow-canvas.styles.js +1 -1
  171. package/dist/components/data/flow-canvas/flow-model.js +1 -1
  172. package/dist/components/data/flow-canvas/flow-types.d.ts +2 -1
  173. package/dist/components/data/flow-controls/flow-controls.styles.js +1 -1
  174. package/dist/components/data/flow-run-status/flow-run-status.class.js +1 -1
  175. package/dist/components/data/funnel/funnel.class.d.ts +1 -0
  176. package/dist/components/data/funnel/funnel.class.js +1 -1
  177. package/dist/components/data/gauge/gauge.class.d.ts +4 -1
  178. package/dist/components/data/gauge/gauge.class.js +6 -6
  179. package/dist/components/data/graph-query-builder/graph-query-builder.class.d.ts +5 -2
  180. package/dist/components/data/graph-query-builder/graph-query-builder.class.js +15 -1
  181. package/dist/components/data/graph-query-builder/graph-query-builder.styles.js +1 -1
  182. package/dist/components/data/heatmap/heatmap.class.d.ts +7 -4
  183. package/dist/components/data/heatmap/heatmap.class.js +1 -1
  184. package/dist/components/data/sequence-strip/sequence-strip.class.js +1 -1
  185. package/dist/components/data/sparkline/sparkline.class.d.ts +2 -1
  186. package/dist/components/data/sparkline/sparkline.class.js +1 -1
  187. package/dist/components/data/stat/stat.class.d.ts +6 -2
  188. package/dist/components/data/stat/stat.class.js +1 -1
  189. package/dist/components/data/table/table.class.d.ts +15 -16
  190. package/dist/components/data/table/table.class.js +5 -4
  191. package/dist/components/data/table/table.styles.js +1 -1
  192. package/dist/components/data/timeline/timeline.class.d.ts +7 -2
  193. package/dist/components/data/timeline/timeline.class.js +1 -1
  194. package/dist/components/data/timeline/timeline.styles.js +1 -1
  195. package/dist/components/data/tree/tree-item.class.d.ts +3 -1
  196. package/dist/components/data/tree/tree-item.class.js +1 -1
  197. package/dist/components/data/tree/tree-item.styles.js +1 -1
  198. package/dist/components/data/tree/tree.class.d.ts +4 -1
  199. package/dist/components/data/tree/tree.class.js +1 -1
  200. package/dist/components/data/word-cloud/word-cloud-layout.d.ts +2 -1
  201. package/dist/components/data/word-cloud/word-cloud-layout.js +1 -1
  202. package/dist/components/data/word-cloud/word-cloud.class.d.ts +2 -1
  203. package/dist/components/data/word-cloud/word-cloud.class.js +1 -1
  204. package/dist/components/forms/button/button.class.d.ts +5 -3
  205. package/dist/components/forms/button/button.class.js +1 -1
  206. package/dist/components/forms/checkbox/checkbox.class.d.ts +3 -0
  207. package/dist/components/forms/checkbox/checkbox.class.js +1 -1
  208. package/dist/components/forms/checkbox-group/checkbox-group.class.d.ts +7 -2
  209. package/dist/components/forms/checkbox-group/checkbox-group.class.js +1 -1
  210. package/dist/components/forms/code-editor/code-editor.class.d.ts +16 -4
  211. package/dist/components/forms/code-editor/code-editor.class.js +19 -9
  212. package/dist/components/forms/code-editor/code-editor.styles.js +1 -1
  213. package/dist/components/forms/color-picker/color-picker.class.d.ts +6 -2
  214. package/dist/components/forms/color-picker/color-picker.class.js +4 -4
  215. package/dist/components/forms/combobox/combobox.class.d.ts +19 -8
  216. package/dist/components/forms/combobox/combobox.class.js +3 -3
  217. package/dist/components/forms/combobox/combobox.styles.js +1 -1
  218. package/dist/components/forms/combobox/option.class.d.ts +4 -0
  219. package/dist/components/forms/combobox/option.class.js +2 -2
  220. package/dist/components/forms/date-picker/calendar-core.d.ts +1 -1
  221. package/dist/components/forms/date-picker/calendar-core.js +1 -1
  222. package/dist/components/forms/date-picker/date-input.class.d.ts +20 -10
  223. package/dist/components/forms/date-picker/date-input.class.js +4 -4
  224. package/dist/components/forms/date-picker/date-picker.class.d.ts +33 -15
  225. package/dist/components/forms/date-picker/date-picker.class.js +8 -8
  226. package/dist/components/forms/date-picker/date-picker.styles.js +1 -1
  227. package/dist/components/forms/emoji-picker/emoji-data-loader.js +1 -1
  228. package/dist/components/forms/emoji-picker/emoji-picker.class.d.ts +11 -3
  229. package/dist/components/forms/emoji-picker/emoji-picker.class.js +3 -3
  230. package/dist/components/forms/emoji-picker/emoji-types.d.ts +2 -2
  231. package/dist/components/forms/icon-button/icon-button.class.d.ts +4 -2
  232. package/dist/components/forms/icon-button/icon-button.class.js +1 -1
  233. package/dist/components/forms/input/input.class.d.ts +16 -5
  234. package/dist/components/forms/input/input.class.js +7 -1
  235. package/dist/components/forms/input/native-time-input.class.d.ts +3 -0
  236. package/dist/components/forms/input/number-input.class.d.ts +3 -0
  237. package/dist/components/forms/input/time-input.class.d.ts +11 -2
  238. package/dist/components/forms/input/time-input.class.js +2 -2
  239. package/dist/components/forms/locale-picker/locale-picker.class.d.ts +22 -4
  240. package/dist/components/forms/locale-picker/locale-picker.class.js +2 -2
  241. package/dist/components/forms/locale-picker/locale-picker.styles.js +1 -1
  242. package/dist/components/forms/otp-input/otp-input.class.d.ts +5 -1
  243. package/dist/components/forms/otp-input/otp-input.class.js +1 -1
  244. package/dist/components/forms/phone-input/phone-input.class.d.ts +21 -8
  245. package/dist/components/forms/phone-input/phone-input.class.js +1 -1
  246. package/dist/components/forms/radio/radio-button.class.d.ts +4 -0
  247. package/dist/components/forms/radio/radio-group.class.d.ts +4 -1
  248. package/dist/components/forms/radio/radio-group.class.js +1 -1
  249. package/dist/components/forms/radio/radio.class.d.ts +6 -2
  250. package/dist/components/forms/radio/radio.class.js +1 -1
  251. package/dist/components/forms/rubric-form/rubric-form.class.d.ts +7 -1
  252. package/dist/components/forms/rubric-form/rubric-form.class.js +3 -3
  253. package/dist/components/forms/select/select.class.d.ts +8 -2
  254. package/dist/components/forms/select/select.class.js +2 -2
  255. package/dist/components/forms/select/select.styles.js +1 -1
  256. package/dist/components/forms/slider/slider.class.d.ts +12 -6
  257. package/dist/components/forms/slider/slider.class.js +2 -2
  258. package/dist/components/forms/swatch-picker/swatch-picker.class.d.ts +4 -0
  259. package/dist/components/forms/swatch-picker/swatch-picker.class.js +1 -1
  260. package/dist/components/forms/switch/switch.class.d.ts +5 -1
  261. package/dist/components/forms/switch/switch.class.js +1 -1
  262. package/dist/components/forms/textarea/textarea.class.d.ts +3 -0
  263. package/dist/components/forms/textarea/textarea.class.js +1 -1
  264. package/dist/components/forms/time-range/time-range.class.d.ts +3 -0
  265. package/dist/components/forms/time-range/time-range.class.js +1 -1
  266. package/dist/components/forms/token-input/token-input.class.d.ts +8 -2
  267. package/dist/components/forms/token-input/token-input.class.js +2 -2
  268. package/dist/components/forms/token-input/token-input.styles.js +1 -1
  269. package/dist/components/layout/app-rail/app-rail.class.d.ts +9 -5
  270. package/dist/components/layout/app-rail/app-rail.class.js +4 -3
  271. package/dist/components/layout/app-rail/app-rail.styles.js +1 -1
  272. package/dist/components/layout/carousel/carousel.class.d.ts +3 -2
  273. package/dist/components/layout/carousel/carousel.class.js +1 -1
  274. package/dist/components/layout/command-palette/command-palette.class.d.ts +2 -2
  275. package/dist/components/layout/command-palette/command-palette.class.js +1 -1
  276. package/dist/components/layout/command-palette/command-palette.styles.js +1 -1
  277. package/dist/components/layout/dashboard-grid/dashboard-grid.class.d.ts +2 -0
  278. package/dist/components/layout/dashboard-grid/dashboard-grid.class.js +1 -1
  279. package/dist/components/layout/details/details.class.d.ts +16 -15
  280. package/dist/components/layout/details/details.class.js +43 -34
  281. package/dist/components/layout/details/details.styles.js +1 -1
  282. package/dist/components/layout/dock-panel/dock-panel.class.d.ts +4 -3
  283. package/dist/components/layout/dock-panel/dock-panel.class.js +2 -1
  284. package/dist/components/layout/filter-bar/filter-bar.class.d.ts +3 -1
  285. package/dist/components/layout/filter-bar/filter-bar.class.js +2 -2
  286. package/dist/components/layout/menu/menu-item.class.js +2 -2
  287. package/dist/components/layout/menu/menu-label.class.d.ts +3 -3
  288. package/dist/components/layout/menu/menu.class.d.ts +4 -1
  289. package/dist/components/layout/menu/menu.class.js +1 -1
  290. package/dist/components/layout/multi-split/multi-split.class.d.ts +19 -8
  291. package/dist/components/layout/multi-split/multi-split.class.js +2 -1
  292. package/dist/components/layout/multi-split/multi-split.styles.js +1 -1
  293. package/dist/components/layout/reorder-list/reorder-item.class.d.ts +2 -1
  294. package/dist/components/layout/reorder-list/reorder-item.class.js +1 -1
  295. package/dist/components/layout/reorder-list/reorder-list.class.js +1 -1
  296. package/dist/components/layout/reorder-list/reorder-owner.js +1 -1
  297. package/dist/components/layout/scroller/scroller.class.d.ts +4 -4
  298. package/dist/components/layout/scroller/scroller.styles.js +1 -1
  299. package/dist/components/layout/split-panel/split-panel.class.d.ts +5 -3
  300. package/dist/components/layout/split-panel/split-panel.class.js +3 -2
  301. package/dist/components/layout/tab-group/tab-group.class.d.ts +3 -1
  302. package/dist/components/layout/tab-group/tab-group.class.js +1 -1
  303. package/dist/components/layout/tab-group/tab-group.styles.js +1 -1
  304. package/dist/components/layout/virtual-list/virtual-list.class.js +2 -2
  305. package/dist/components/layout/widget/widget.class.d.ts +6 -2
  306. package/dist/components/layout/widget/widget.class.js +1 -1
  307. package/dist/components/layout/widget/widget.styles.js +1 -1
  308. package/dist/components/media/animation/animation.class.d.ts +3 -2
  309. package/dist/components/media/animation/animation.class.js +1 -1
  310. package/dist/components/media/attachment-chip/attachment-chip.class.d.ts +4 -3
  311. package/dist/components/media/attachment-chip/attachment-chip.class.js +1 -1
  312. package/dist/components/media/av-player/av-metadata.d.ts +3 -2
  313. package/dist/components/media/av-player/av-player.class.d.ts +4 -3
  314. package/dist/components/media/av-player/av-player.class.js +3 -3
  315. package/dist/components/media/av-player/av-player.styles.js +1 -1
  316. package/dist/components/media/avatar/avatar.class.d.ts +2 -1
  317. package/dist/components/media/avatar/avatar.class.js +1 -1
  318. package/dist/components/media/file-input/file-input.class.d.ts +4 -2
  319. package/dist/components/media/file-input/file-input.class.js +1 -1
  320. package/dist/components/media/file-input/file-input.styles.js +1 -1
  321. package/dist/components/media/flag/flag.class.js +1 -1
  322. package/dist/components/media/image-viewer/image-viewer.class.d.ts +2 -1
  323. package/dist/components/media/image-viewer/image-viewer.class.js +1 -1
  324. package/dist/components/media/image-viewer/image-viewer.styles.js +1 -1
  325. package/dist/components/media/lightbox/lightbox.styles.js +1 -1
  326. package/dist/components/media/map/map-loader.js +1 -1
  327. package/dist/components/media/map/map.class.d.ts +22 -34
  328. package/dist/components/media/map/map.class.js +1 -1
  329. package/dist/components/media/map/map.styles.js +1 -1
  330. package/dist/components/media/media-card/media-card.class.d.ts +1 -1
  331. package/dist/components/media/media-card/media-card.class.js +1 -1
  332. package/dist/components/media/pan-zoom/pan-zoom.class.js +1 -1
  333. package/dist/components/media/qr-code/qr-code-loader.js +1 -1
  334. package/dist/components/media/qr-code/qr-code.class.d.ts +5 -2
  335. package/dist/components/media/qr-code/qr-code.class.js +2 -2
  336. package/dist/components/media/sequence-playback/sequence-playback.class.d.ts +3 -3
  337. package/dist/components/media/sequence-playback/sequence-playback.class.js +1 -1
  338. package/dist/components/media/sequence-playback/sequence-playback.styles.js +1 -1
  339. package/dist/components/media/video/video.class.d.ts +2 -1
  340. package/dist/components/media/video/video.styles.js +1 -1
  341. package/dist/components/media/zoomable-frame/zoomable-frame.class.d.ts +3 -2
  342. package/dist/components/media/zoomable-frame/zoomable-frame.class.js +2 -2
  343. package/dist/components/overlays/alert/alert.styles.js +1 -1
  344. package/dist/components/overlays/callout/callout.styles.js +1 -1
  345. package/dist/components/overlays/chip/chip-group.class.d.ts +2 -0
  346. package/dist/components/overlays/chip/chip-group.class.js +1 -1
  347. package/dist/components/overlays/dialog/dialog.class.d.ts +2 -0
  348. package/dist/components/overlays/dialog/dialog.class.js +1 -1
  349. package/dist/components/overlays/dialog/dialog.styles.js +1 -1
  350. package/dist/components/overlays/empty/empty.class.d.ts +2 -0
  351. package/dist/components/overlays/empty/empty.class.js +1 -1
  352. package/dist/components/overlays/kbd/kbd.class.d.ts +2 -0
  353. package/dist/components/overlays/kbd/kbd.class.js +1 -1
  354. package/dist/components/overlays/overlay/popover.class.d.ts +3 -1
  355. package/dist/components/overlays/overlay/popover.class.js +1 -1
  356. package/dist/components/overlays/overlay/tooltip.class.d.ts +3 -1
  357. package/dist/components/overlays/overlay/tooltip.class.js +1 -1
  358. package/dist/components/overlays/rating/rating.class.d.ts +2 -0
  359. package/dist/components/overlays/rating/rating.class.js +1 -1
  360. package/dist/components/overlays/toast/toast-item.class.js +1 -1
  361. package/dist/components/retrieval/claim-evidence/claim-evidence.class.d.ts +11 -5
  362. package/dist/components/retrieval/claim-evidence/claim-evidence.class.js +3 -3
  363. package/dist/components/retrieval/embedding-explorer/embedding-explorer.class.js +2 -2
  364. package/dist/components/retrieval/entity-card/entity-card.class.d.ts +5 -2
  365. package/dist/components/retrieval/entity-card/entity-card.class.js +1 -1
  366. package/dist/components/retrieval/entity-chip/entity-chip.class.d.ts +4 -2
  367. package/dist/components/retrieval/entity-chip/entity-chip.class.js +1 -1
  368. package/dist/components/retrieval/graph/graph-canvas.js +1 -1
  369. package/dist/components/retrieval/graph/graph-loader.js +1 -1
  370. package/dist/components/retrieval/graph/graph.class.d.ts +10 -8
  371. package/dist/components/retrieval/graph/graph.class.js +10 -10
  372. package/dist/components/retrieval/graph-legend/graph-legend.class.d.ts +4 -2
  373. package/dist/components/retrieval/graph-legend/graph-legend.class.js +1 -1
  374. package/dist/components/retrieval/grounding-summary/grounding-summary.class.d.ts +15 -9
  375. package/dist/components/retrieval/grounding-summary/grounding-summary.class.js +7 -5
  376. package/dist/components/retrieval/ingestion-queue/ingestion-queue.class.d.ts +2 -0
  377. package/dist/components/retrieval/ingestion-queue/ingestion-queue.class.js +1 -1
  378. package/dist/components/retrieval/knowledge-base/knowledge-base.class.d.ts +3 -2
  379. package/dist/components/retrieval/knowledge-base/knowledge-base.class.js +4 -3
  380. package/dist/components/retrieval/knowledge-base/knowledge-base.styles.js +1 -1
  381. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.d.ts +7 -3
  382. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.js +8 -3
  383. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.styles.js +1 -1
  384. package/dist/components/retrieval/memory-panel/memory-panel.class.d.ts +15 -6
  385. package/dist/components/retrieval/memory-panel/memory-panel.class.js +1 -1
  386. package/dist/components/retrieval/neighbor-list/neighbor-list.class.js +1 -1
  387. package/dist/components/retrieval/neighbor-list/neighbor-list.styles.js +1 -1
  388. package/dist/components/retrieval/node-palette/node-palette.class.d.ts +17 -12
  389. package/dist/components/retrieval/node-palette/node-palette.class.js +2 -2
  390. package/dist/components/retrieval/node-palette/node-palette.styles.js +1 -1
  391. package/dist/components/retrieval/path-strip/path-strip.class.js +1 -1
  392. package/dist/components/retrieval/provenance-panel/provenance-panel.class.d.ts +2 -1
  393. package/dist/components/retrieval/provenance-panel/provenance-panel.class.js +1 -1
  394. package/dist/components/retrieval/retrieval-results/retrieval-results.class.d.ts +1 -1
  395. package/dist/components/retrieval/retrieval-results/retrieval-results.class.js +5 -5
  396. package/dist/components/retrieval/retrieval-trace/retrieval-trace.class.js +1 -1
  397. package/dist/components/retrieval/source-picker/source-picker.class.d.ts +2 -1
  398. package/dist/components/retrieval/source-picker/source-picker.class.js +2 -2
  399. package/dist/components/utility/copy-button/copy-button.class.d.ts +2 -1
  400. package/dist/components/utility/copy-button/copy-button.class.js +1 -1
  401. package/dist/components/utility/diff-view/diff-view.class.d.ts +4 -1
  402. package/dist/components/utility/diff-view/diff-view.class.js +1 -1
  403. package/dist/components/utility/export-button/export-button.class.d.ts +2 -2
  404. package/dist/components/utility/export-button/export-button.class.js +1 -1
  405. package/dist/components/utility/export-button/export-button.styles.js +1 -1
  406. package/dist/components/utility/format/format-date.class.js +1 -1
  407. package/dist/components/utility/format/format-number.class.d.ts +3 -1
  408. package/dist/components/utility/format/format-options.js +1 -1
  409. package/dist/components/utility/format/relative-time.class.js +1 -1
  410. package/dist/components/utility/icon/dompurify-loader.js +1 -1
  411. package/dist/components/utility/icon/icon-library.js +1 -1
  412. package/dist/components/utility/intersection-observer/intersection-observer.class.js +1 -1
  413. package/dist/components/utility/json-viewer/json-viewer.class.d.ts +6 -3
  414. package/dist/components/utility/json-viewer/json-viewer.class.js +5 -5
  415. package/dist/components/utility/known-date/known-date.class.d.ts +9 -5
  416. package/dist/components/utility/known-date/known-date.class.js +2 -2
  417. package/dist/components/utility/known-date/known-date.styles.js +1 -1
  418. package/dist/components/utility/mention-popover/mention-popover.class.d.ts +32 -45
  419. package/dist/components/utility/mention-popover/mention-popover.class.js +1 -1
  420. package/dist/components/utility/mutation-observer/mutation-observer.class.js +1 -1
  421. package/dist/components/utility/poll-status/poll-status.class.d.ts +3 -0
  422. package/dist/components/utility/poll-status/poll-status.styles.js +1 -1
  423. package/dist/components/viewers/calendar-viewer/calendar-loader.js +1 -1
  424. package/dist/components/viewers/calendar-viewer/calendar-viewer.class.d.ts +1 -0
  425. package/dist/components/viewers/calendar-viewer/calendar-viewer.class.js +1 -1
  426. package/dist/components/viewers/dataset-viewer/dataset-viewer.class.d.ts +2 -1
  427. package/dist/components/viewers/dataset-viewer/dataset-viewer.styles.js +1 -1
  428. package/dist/components/viewers/document-compare/document-compare.class.d.ts +11 -8
  429. package/dist/components/viewers/document-compare/document-compare.class.js +2 -2
  430. package/dist/components/viewers/document-preview/document-preview.class.d.ts +8 -4
  431. package/dist/components/viewers/document-preview/document-preview.class.js +4 -4
  432. package/dist/components/viewers/document-preview/document-preview.styles.js +1 -1
  433. package/dist/components/viewers/document-viewer/document-viewer.class.d.ts +5 -2
  434. package/dist/components/viewers/document-viewer/document-viewer.class.js +2 -2
  435. package/dist/components/viewers/document-viewer/document-viewer.styles.js +1 -1
  436. package/dist/components/viewers/document-viewer/registry-ownership.d.ts +1 -0
  437. package/dist/components/viewers/document-viewer/registry-ownership.js +1 -0
  438. package/dist/components/viewers/document-viewer/registry.js +1 -1
  439. package/dist/components/viewers/docx-viewer/docx-loader.js +1 -1
  440. package/dist/components/viewers/docx-viewer/docx-viewer.class.js +1 -1
  441. package/dist/components/viewers/ebook-viewer/ebook-loader.d.ts +1 -1
  442. package/dist/components/viewers/ebook-viewer/ebook-viewer.class.d.ts +8 -2
  443. package/dist/components/viewers/ebook-viewer/ebook-viewer.class.js +1 -1
  444. package/dist/components/viewers/email-viewer/email-loader.js +1 -1
  445. package/dist/components/viewers/email-viewer/email-viewer.class.d.ts +3 -2
  446. package/dist/components/viewers/email-viewer/email-viewer.class.js +2 -2
  447. package/dist/components/viewers/html-viewer/dompurify-loader.js +1 -1
  448. package/dist/components/viewers/include/include-resource.js +1 -1
  449. package/dist/components/viewers/include/include.class.d.ts +3 -1
  450. package/dist/components/viewers/notebook-viewer/dompurify-loader.js +1 -1
  451. package/dist/components/viewers/notebook-viewer/notebook-viewer.class.d.ts +4 -2
  452. package/dist/components/viewers/notebook-viewer/notebook-viewer.class.js +4 -4
  453. package/dist/components/viewers/notebook-viewer/notebook-viewer.styles.js +1 -1
  454. package/dist/components/viewers/passive-markup.js +1 -1
  455. package/dist/components/viewers/pdf-viewer/pdf-loader.js +1 -1
  456. package/dist/components/viewers/pptx-viewer/pptx-loader.js +1 -1
  457. package/dist/components/viewers/spreadsheet-viewer/spreadsheet-loader.js +1 -1
  458. package/dist/components/viewers/svg-viewer/dompurify-loader.js +1 -1
  459. package/dist/components/viewers/svg-viewer/svg-viewer.class.d.ts +2 -1
  460. package/dist/components/viewers/svg-viewer/svg-viewer.styles.js +1 -1
  461. package/dist/components/viewers/viewer-loading.js +1 -1
  462. package/dist/components/viewers/viewer-search-limits.d.ts +2 -0
  463. package/dist/components/viewers/viewer-search-limits.js +1 -1
  464. package/dist/components/viewers/xml-viewer/xml-viewer.class.d.ts +2 -1
  465. package/dist/components/viewers/xml-viewer/xml-viewer.class.js +1 -1
  466. package/dist/components/viewers/xml-viewer/xml-viewer.js +1 -1
  467. package/dist/custom-elements-jsx.d.ts +1 -1
  468. package/dist/events.d.ts +13 -6
  469. package/dist/internal/aria-controls.d.ts +16 -13
  470. package/dist/internal/aria-controls.js +1 -1
  471. package/dist/internal/aria-reflection.js +1 -1
  472. package/dist/internal/catalog-picker.d.ts +2 -2
  473. package/dist/internal/catalog-picker.js +1 -1
  474. package/dist/internal/chart-annotation-registration.d.ts +1 -0
  475. package/dist/internal/chart-annotation-registration.js +1 -0
  476. package/dist/internal/data-descriptors.d.ts +13 -0
  477. package/dist/internal/data-descriptors.js +1 -0
  478. package/dist/internal/default-strings.generated.d.ts +1 -1
  479. package/dist/internal/default-strings.generated.js +2 -2
  480. package/dist/internal/dev-mode-attribute-warning.d.ts +3 -0
  481. package/dist/internal/dev-mode-attribute-warning.js +1 -1
  482. package/dist/internal/element-internals.d.ts +4 -3
  483. package/dist/internal/element-internals.js +1 -1
  484. package/dist/internal/form-associated.js +1 -1
  485. package/dist/internal/highlight-collection.d.ts +2 -0
  486. package/dist/internal/highlight-collection.js +1 -1
  487. package/dist/internal/localization-types.d.ts +1 -1
  488. package/dist/internal/localization.js +2 -2
  489. package/dist/internal/lyra-element.d.ts +10 -1
  490. package/dist/internal/lyra-element.js +2 -1
  491. package/dist/internal/native-control-description.d.ts +7 -0
  492. package/dist/internal/native-control-description.js +1 -0
  493. package/dist/internal/option-selection.js +1 -1
  494. package/dist/internal/overlay-order.d.ts +6 -0
  495. package/dist/internal/overlay-order.js +1 -0
  496. package/dist/internal/overlay-stack.d.ts +1 -1
  497. package/dist/internal/overlay-stack.js +1 -1
  498. package/dist/internal/package-metadata.d.ts +1 -1
  499. package/dist/internal/package-metadata.js +1 -1
  500. package/dist/internal/papaparse-loader.js +1 -1
  501. package/dist/internal/positioner.d.ts +5 -4
  502. package/dist/internal/pseudo-localization.js +1 -1
  503. package/dist/internal/reactive-property-writes.d.ts +1 -0
  504. package/dist/internal/reactive-property-writes.js +1 -0
  505. package/dist/internal/safe-css.js +1 -1
  506. package/dist/internal/step-value.d.ts +6 -0
  507. package/dist/internal/step-value.js +1 -0
  508. package/dist/internal/svg-title.d.ts +3 -0
  509. package/dist/internal/svg-title.js +1 -0
  510. package/dist/internal/text-quote.js +1 -1
  511. package/dist/lyra.d.ts +1 -1
  512. package/dist/svelte.d.ts +1 -1
  513. package/dist/translations/ar.js +2 -2
  514. package/dist/translations/de.js +2 -2
  515. package/dist/translations/es.js +2 -2
  516. package/dist/translations/fa.js +2 -2
  517. package/dist/translations/fr.js +2 -2
  518. package/dist/translations/he.js +2 -2
  519. package/dist/translations/ja.js +2 -2
  520. package/dist/translations/pseudo/ar-XB.js +1 -1
  521. package/dist/translations/pt-BR.js +2 -2
  522. package/dist/translations/ru.js +2 -2
  523. package/dist/translations/zh-CN.js +2 -2
  524. package/dist/vue.d.ts +1 -1
  525. package/llms/components/lr-accordion-item.md +10 -5
  526. package/llms/components/lr-accordion.md +10 -5
  527. package/llms/components/lr-activity-feed.md +6 -5
  528. package/llms/components/lr-agent-run.md +1 -1
  529. package/llms/components/lr-agent-trace.md +3 -0
  530. package/llms/components/lr-agent-workspace.md +3 -2
  531. package/llms/components/lr-animation.md +4 -0
  532. package/llms/components/lr-app-rail-item.md +4 -2
  533. package/llms/components/lr-app-rail.md +4 -2
  534. package/llms/components/lr-attachment-chip.md +8 -3
  535. package/llms/components/lr-audio-visualizer.md +9 -6
  536. package/llms/components/lr-av-player.md +14 -0
  537. package/llms/components/lr-avatar.md +4 -0
  538. package/llms/components/lr-bar-chart.md +2 -2
  539. package/llms/components/lr-box-plot.md +15 -6
  540. package/llms/components/lr-bubble-chart.md +2 -2
  541. package/llms/components/lr-button.md +11 -3
  542. package/llms/components/lr-calendar-viewer.md +4 -0
  543. package/llms/components/lr-calendar.md +15 -4
  544. package/llms/components/lr-carousel.md +5 -0
  545. package/llms/components/lr-chart.md +24 -9
  546. package/llms/components/lr-chat-composer.md +2 -1
  547. package/llms/components/lr-chat-message.md +4 -0
  548. package/llms/components/lr-checkbox.md +3 -0
  549. package/llms/components/lr-chip-group.md +3 -0
  550. package/llms/components/lr-chip.md +3 -0
  551. package/llms/components/lr-chunk-inspector.md +2 -2
  552. package/llms/components/lr-code-block-core.md +20 -8
  553. package/llms/components/lr-code-block.md +17 -14
  554. package/llms/components/lr-code-editor.md +20 -5
  555. package/llms/components/lr-color-picker.md +9 -0
  556. package/llms/components/lr-combobox.md +35 -4
  557. package/llms/components/lr-command-palette.md +4 -0
  558. package/llms/components/lr-commit-card.md +3 -0
  559. package/llms/components/lr-compare-panel.md +7 -0
  560. package/llms/components/lr-condition-builder.md +5 -0
  561. package/llms/components/lr-conversation-item.md +3 -0
  562. package/llms/components/lr-copy-button.md +10 -1
  563. package/llms/components/lr-dashboard-grid.md +5 -0
  564. package/llms/components/lr-data-grid.md +22 -3
  565. package/llms/components/lr-dataset-viewer.md +3 -2
  566. package/llms/components/lr-date-input.md +50 -6
  567. package/llms/components/lr-date-picker.md +51 -7
  568. package/llms/components/lr-details.md +10 -5
  569. package/llms/components/lr-dialog.md +4 -0
  570. package/llms/components/lr-diff-view.md +6 -0
  571. package/llms/components/lr-document-compare.md +6 -2
  572. package/llms/components/lr-document-library.md +4 -0
  573. package/llms/components/lr-document-preview.md +18 -4
  574. package/llms/components/lr-document-viewer.md +14 -4
  575. package/llms/components/lr-docx-viewer.md +6 -0
  576. package/llms/components/lr-doughnut-chart.md +2 -2
  577. package/llms/components/lr-dropdown-item.md +4 -0
  578. package/llms/components/lr-dropdown.md +3 -0
  579. package/llms/components/lr-ebook-viewer.md +12 -3
  580. package/llms/components/lr-email-viewer.md +10 -0
  581. package/llms/components/lr-emoji-picker.md +17 -3
  582. package/llms/components/lr-empty.md +3 -0
  583. package/llms/components/lr-entity-card.md +3 -0
  584. package/llms/components/lr-entity-chip.md +4 -0
  585. package/llms/components/lr-eval-dataset.md +2 -2
  586. package/llms/components/lr-export-button.md +9 -0
  587. package/llms/components/lr-file-input.md +12 -8
  588. package/llms/components/lr-file-tree.md +5 -1
  589. package/llms/components/lr-filter-bar.md +5 -0
  590. package/llms/components/lr-flow-canvas.md +8 -1
  591. package/llms/components/lr-flow-node.md +2 -1
  592. package/llms/components/lr-flow-run-status.md +1 -1
  593. package/llms/components/lr-format-date.md +3 -1
  594. package/llms/components/lr-format-number.md +4 -0
  595. package/llms/components/lr-funnel.md +4 -0
  596. package/llms/components/lr-gauge.md +4 -0
  597. package/llms/components/lr-generation-metrics.md +5 -0
  598. package/llms/components/lr-graph-legend.md +4 -2
  599. package/llms/components/lr-graph-query-builder.md +6 -0
  600. package/llms/components/lr-graph.md +8 -2
  601. package/llms/components/lr-grounding-summary.md +8 -8
  602. package/llms/components/lr-heatmap.md +13 -0
  603. package/llms/components/lr-histogram.md +2 -2
  604. package/llms/components/lr-icon-button.md +7 -0
  605. package/llms/components/lr-image-viewer.md +9 -0
  606. package/llms/components/lr-include.md +5 -0
  607. package/llms/components/lr-ingestion-queue.md +5 -1
  608. package/llms/components/lr-input.md +22 -8
  609. package/llms/components/lr-intersection-observer.md +9 -0
  610. package/llms/components/lr-json-viewer.md +10 -1
  611. package/llms/components/lr-kbd.md +3 -0
  612. package/llms/components/lr-knowledge-base.md +10 -1
  613. package/llms/components/lr-knowledge-graph-explorer.md +7 -0
  614. package/llms/components/lr-known-date.md +7 -0
  615. package/llms/components/lr-line-chart.md +2 -2
  616. package/llms/components/lr-lite-chart.md +29 -9
  617. package/llms/components/lr-live-region.md +3 -0
  618. package/llms/components/lr-locale-picker.md +12 -0
  619. package/llms/components/lr-map.md +23 -5
  620. package/llms/components/lr-markdown-core.md +4 -0
  621. package/llms/components/lr-markdown.md +15 -8
  622. package/llms/components/lr-media-card.md +5 -8
  623. package/llms/components/lr-mention-popover.md +17 -10
  624. package/llms/components/lr-menu-item.md +4 -0
  625. package/llms/components/lr-menu-label.md +4 -3
  626. package/llms/components/lr-menu.md +4 -0
  627. package/llms/components/lr-message-actions.md +13 -3
  628. package/llms/components/lr-message-feedback.md +24 -7
  629. package/llms/components/lr-message-parts.md +6 -3
  630. package/llms/components/lr-model-select.md +13 -2
  631. package/llms/components/lr-multi-split.md +20 -7
  632. package/llms/components/lr-mutation-observer.md +8 -0
  633. package/llms/components/lr-native-time-input.md +10 -0
  634. package/llms/components/lr-node-palette.md +8 -2
  635. package/llms/components/lr-notebook-viewer.md +4 -1
  636. package/llms/components/lr-number-input.md +12 -1
  637. package/llms/components/lr-option.md +35 -4
  638. package/llms/components/lr-otp-input.md +10 -0
  639. package/llms/components/lr-pan-zoom.md +1 -2
  640. package/llms/components/lr-phone-input.md +20 -5
  641. package/llms/components/lr-pie-chart.md +2 -2
  642. package/llms/components/lr-polar-area-chart.md +2 -2
  643. package/llms/components/lr-poll-status.md +4 -0
  644. package/llms/components/lr-popover.md +3 -0
  645. package/llms/components/lr-popup.md +3 -2
  646. package/llms/components/lr-prompt-input.md +7 -3
  647. package/llms/components/lr-prompt-queue.md +6 -0
  648. package/llms/components/lr-prompt-studio.md +7 -0
  649. package/llms/components/lr-provenance-panel.md +3 -0
  650. package/llms/components/lr-push-to-talk.md +8 -0
  651. package/llms/components/lr-qr-code.md +6 -0
  652. package/llms/components/lr-radar-chart.md +2 -2
  653. package/llms/components/lr-radio-button.md +13 -4
  654. package/llms/components/lr-radio-group.md +5 -0
  655. package/llms/components/lr-radio.md +9 -0
  656. package/llms/components/lr-rating.md +8 -0
  657. package/llms/components/lr-relative-time.md +2 -0
  658. package/llms/components/lr-reorder-item.md +6 -0
  659. package/llms/components/lr-reorder-list.md +6 -0
  660. package/llms/components/lr-result-card.md +6 -3
  661. package/llms/components/lr-result-field.md +6 -3
  662. package/llms/components/lr-retrieval-results.md +1 -1
  663. package/llms/components/lr-rubric-form.md +12 -0
  664. package/llms/components/lr-scatter-chart.md +2 -2
  665. package/llms/components/lr-scroller.md +5 -5
  666. package/llms/components/lr-select.md +9 -0
  667. package/llms/components/lr-sequence-playback.md +5 -2
  668. package/llms/components/lr-slider.md +19 -5
  669. package/llms/components/lr-source-picker.md +4 -0
  670. package/llms/components/lr-span-waterfall.md +3 -0
  671. package/llms/components/lr-sparkline.md +4 -0
  672. package/llms/components/lr-split-panel.md +4 -0
  673. package/llms/components/lr-stack-trace.md +3 -0
  674. package/llms/components/lr-stat.md +10 -0
  675. package/llms/components/lr-streaming-text.md +2 -3
  676. package/llms/components/lr-subagent-panel.md +3 -2
  677. package/llms/components/lr-svg-viewer.md +3 -0
  678. package/llms/components/lr-swatch-picker.md +4 -0
  679. package/llms/components/lr-switch.md +6 -0
  680. package/llms/components/lr-tab-group.md +4 -0
  681. package/llms/components/lr-table.md +10 -2
  682. package/llms/components/lr-terminal.md +17 -5
  683. package/llms/components/lr-textarea.md +9 -0
  684. package/llms/components/lr-thinking-panel.md +3 -1
  685. package/llms/components/lr-thread-list.md +26 -4
  686. package/llms/components/lr-time-input.md +3 -0
  687. package/llms/components/lr-time-range.md +5 -0
  688. package/llms/components/lr-timeline-item.md +6 -0
  689. package/llms/components/lr-timeline.md +6 -0
  690. package/llms/components/lr-token-input.md +14 -0
  691. package/llms/components/lr-tool-call-chip.md +7 -5
  692. package/llms/components/lr-tool-param-form.md +6 -2
  693. package/llms/components/lr-tool-result-dialog.md +4 -0
  694. package/llms/components/lr-tool-result-view.md +2 -3
  695. package/llms/components/lr-tool-select-dialog.md +6 -2
  696. package/llms/components/lr-tooltip.md +6 -0
  697. package/llms/components/lr-trace-tree.md +3 -0
  698. package/llms/components/lr-transcript-feed.md +3 -0
  699. package/llms/components/lr-tree-item.md +12 -5
  700. package/llms/components/lr-tree.md +12 -5
  701. package/llms/components/lr-typing-indicator.md +3 -0
  702. package/llms/components/lr-usage-badge.md +4 -0
  703. package/llms/components/lr-video.md +8 -2
  704. package/llms/components/lr-virtual-list.md +5 -3
  705. package/llms/components/lr-voice-picker.md +15 -2
  706. package/llms/components/lr-widget-renderer.md +21 -13
  707. package/llms/components/lr-widget.md +4 -2
  708. package/llms/components/lr-word-cloud.md +4 -0
  709. package/llms/components/lr-xml-viewer.md +9 -2
  710. package/llms/components/lr-zoomable-frame.md +6 -3
  711. package/llms/peers.md +5 -5
  712. package/llms/shared.md +74 -63
  713. package/llms-full.txt +4705 -2954
  714. package/package.json +19 -14
  715. package/vscode-css-data.json +1 -1
  716. package/vscode-html-data.json +1 -1
  717. package/web-types.json +1 -1
  718. package/dist/components/viewers/docx-viewer/fixtures/minimal-docx-fixture.d.ts +0 -1
  719. package/dist/components/viewers/docx-viewer/fixtures/minimal-docx-fixture.js +0 -1
  720. package/dist/components/viewers/ebook-viewer/fixtures/minimal-epub-fixture.d.ts +0 -1
  721. package/dist/components/viewers/ebook-viewer/fixtures/minimal-epub-fixture.js +0 -1
  722. package/dist/components/viewers/spreadsheet-viewer/fixtures/minimal-xlsx-fixture.d.ts +0 -1
  723. package/dist/components/viewers/spreadsheet-viewer/fixtures/minimal-xlsx-fixture.js +0 -1
@@ -1,4 +1,4 @@
1
- var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{installFormControlLabelSupport}from"../../../internal/form-control-labels.js";installFormControlLabelSupport();import{nextId}from"../../../internal/a11y.js";import{tag}from"../../../internal/prefix.js";import{sizes}from"../../../internal/sizes.styles.js";import{groupStyles}from"./radio-group.styles.js";import{dispatchNativeEvent,dispatchNativeInputEvent}from"../../../internal/native-event-relay.js";import{AnchoredValidityController,VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{syncValidityStates}from"../../../internal/custom-states.js";import{attachInternalsSafely,getFormOwner,isBarredFromValidation,setFormOwner}from"../../../internal/form-associated.js";import{declaredDefaultConverter,omittedEmptyStringConverter}from"../../../internal/converters.js";import{isAccessibilitySubtreeExcluded,isAriaTrue}from"../../../internal/accessibility-visibility.js";import{composedParentElement}from"../../../internal/active-element.js";import{currentValidityValidator}from"../form-validator.js";import{LYRA_DEFAULT_radioRequired}from"../../../internal/default-strings.generated.js";const RADIO_TAGS=()=>[tag("radio"),tag("radio-button")];class LyraRadioGroup extends LyraElement{static{this.defaultStrings={...super.defaultStrings,radioRequired:LYRA_DEFAULT_radioRequired}}static{this.immutableEventDetails=Object.freeze(["lr-input","lr-change"])}static{this.identityEventDetailProperties=Object.freeze({"lr-input":Object.freeze(["radio"]),"lr-change":Object.freeze(["radio"])})}static get validators(){return[currentValidityValidator("required","disabled","value")]}static{this.formAssociated=!0}static{this.styles=[LyraElement.styles,sizes,groupStyles]}static{this.properties={name:{reflect:!0,noAccessor:!0,converter:omittedEmptyStringConverter},value:{attribute:!1,noAccessor:!0},defaultValue:{attribute:"value",reflect:!0,useDefault:!0,noAccessor:!0},customError:{attribute:"custom-error",reflect:!0,noAccessor:!0},required:{type:Boolean,reflect:!0,noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0},orientation:{reflect:!0,converter:declaredDefaultConverter("vertical")},form:{noAccessor:!0}}}get name(){return this._name}set name(next){const old=this._name;this._name=next??"",this._name?this.setAttribute("name",this._name):this.removeAttribute("name"),this.syncFormState(),this.requestUpdate("name",old)}get value(){return this._value}set value(next){this._valueDirty=!0,this.selectValue(next??"")}get defaultValue(){return this._defaultValue}set defaultValue(next){if(this.reflectingDefaultValue)return;const old=this._defaultValue;this._defaultValue=next??"",this.reflectingDefaultValue=!0;try{this._defaultValue?this.setAttribute("value",this._defaultValue):this.removeAttribute("value")}finally{this.reflectingDefaultValue=!1}this._valueDirty||(this.selectValue(this._defaultValue),this._valueDirty=!1),this.requestUpdate("defaultValue",old)}get customError(){return this.validityController?.customValidityMessage||null}set customError(next){this.reflectingCustomError||this.commitCustomValidity(next)}get required(){return this._required}set required(next){const old=this._required;this._required=!!next,this.toggleAttribute("required",this._required),this.syncRadios(),this.updateValidity(),this.requestUpdate("required",old)}get disabled(){return this._disabled}set disabled(next){const old=this._disabled;this._disabled=!!next,this.toggleAttribute("disabled",this._disabled),this.syncRadios(),this.updateValidity(),this.requestUpdate("disabled",old)}get effectiveDisabled(){return this.disabled||this._fieldsetDisabled}get form(){return getFormOwner(this.internals)}set form(owner){setFormOwner(this,owner)}getForm(){return getFormOwner(this.internals)}get labels(){return this.internals.labels}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}get willValidate(){return this.internals.willValidate}constructor(){super(),this.size="m",this.orientation="vertical",this.label="",this.hint="",this.helpText="",this.shoelaceDefaultValue="",this.withLabel=!1,this.withHint=!1,this.errorText="",this.accessibleLabel="",this.hasLabelSlot=!1,this.hasHintSlot=!1,this.hasHelpTextSlot=!1,this.hasErrorSlot=!1,this.labelId=nextId("radio-group-label"),this.hintId=nextId("radio-group-hint"),this.errorId=nextId("radio-group-error"),this.managedRadios=new Set,this.syncingRadios=!1,this.membershipObserverGeneration=0,this._name="",this._value="",this._defaultValue="",this._valueDirty=!1,this.reflectingDefaultValue=!1,this.reflectingCustomError=!1,this._required=!1,this._disabled=!1,this._fieldsetDisabled=!1,this.hasInteracted=!1,this.hadShoelaceDefaultValue=!1,this.onInvalid=event=>{const target=event.target;if(target!==this&&!(target?.nodeType===1&&this.ownsRadio(target)))return;this.hasInteracted=!0,this.reflectValidityStates(),this.requestUpdate(),this.emit("lr-invalid",null,{cancelable:!0}).defaultPrevented&&event.preventDefault()},this.onKeyDown=event=>{if(![...this.orientation==="horizontal"?["ArrowRight","ArrowLeft"]:["ArrowDown","ArrowUp"],"Home","End"].includes(event.key)||this.effectiveDisabled)return;const radios=this.radios().filter(radio=>this.isRadioAvailable(radio)),current=event.target;if(!this.isRadioAvailable(current))return;const index=radios.indexOf(current);if(index<0||radios.length===0)return;event.preventDefault();const rtl=this.effectiveDirection==="rtl",forward=this.orientation==="vertical"?event.key==="ArrowDown":rtl?event.key==="ArrowLeft":event.key==="ArrowRight",backward=this.orientation==="vertical"?event.key==="ArrowUp":rtl?event.key==="ArrowRight":event.key==="ArrowLeft",nextIndex=event.key==="Home"?0:event.key==="End"?radios.length-1:forward?(index+1)%radios.length:backward?(index-1+radios.length)%radios.length:index,next=radios[nextIndex];next.focus(),next.activateFromGroup()},this.onSlotChange=event=>{const slot=event.target,elements=slot.assignedElements({flatten:!0});slot.name==="label"&&(this.hasLabelSlot=elements.length>0),slot.name==="hint"&&(this.hasHintSlot=elements.length>0),slot.name==="help-text"&&(this.hasHelpTextSlot=elements.length>0),slot.name==="error"&&(this.hasErrorSlot=elements.length>0)},this.onRadioSlotChange=()=>{this.syncRadios();const ownerDocument=this.ownerDocument,generation=this.membershipObserverGeneration,ownerWindow=ownerDocument?.defaultView;ownerWindow&&ownerWindow.queueMicrotask(()=>{this.membershipObserverGeneration===generation&&this.isConnected&&this.ownerDocument===ownerDocument&&this.syncRadios()})},this.internals=attachInternalsSafely(this),this.validityController=new AnchoredValidityController(this,this.internals,()=>this[VALIDITY_ANCHOR]()),this.addEventListener("invalid",this.onInvalid,!0),this.syncFormState(),this.updateValidity()}connectedCallback(){super.connectedCallback(),this.syncSupportSlots(),this.syncRadios(),this.armMembershipObserver(),this.armRunResizeObserver(),this.scheduleRunProjection()}armRunResizeObserver(){this.runResizeObserver?.disconnect();const ResizeObserverCtor=this.ownerDocument?.defaultView?.ResizeObserver;if(!(!ResizeObserverCtor||!this.isConnected)){this.runResizeObserver=new ResizeObserverCtor(()=>this.scheduleRunProjection()),this.runResizeObserver.observe(this);for(const radio of this.radios())this.runResizeObserver.observe(radio)}}scheduleRunProjection(){const ownerWindow=this.ownerDocument?.defaultView;!ownerWindow||!this.isConnected||this.runProjectionFrame!==void 0||(this.runProjectionFrame=ownerWindow.requestAnimationFrame(()=>{this.runProjectionFrame=void 0,this.isConnected&&this.projectButtonRuns()}))}isButtonRadio(radio){return radio.localName===tag("radio-button")||radio.appearance==="button"}areActuallyAdjacent(first,second){const firstRect=first.getBoundingClientRect(),secondRect=second.getBoundingClientRect();if(firstRect.width<=0||firstRect.height<=0||secondRect.width<=0||secondRect.height<=0||!(Math.abs(firstRect.top-secondRect.top)<=1&&Math.abs(firstRect.bottom-secondRect.bottom)<=1))return!1;const gap=getComputedStyle(this).direction==="rtl"?firstRect.left-secondRect.right:secondRect.left-firstRect.right;return gap>=-2&&gap<=1}projectButtonRuns(){const radios=this.radios(),joinsPrevious=radios.map(()=>!1);if(this.orientation==="horizontal")for(let index=1;index<radios.length;index+=1){const previous=radios[index-1],current=radios[index];joinsPrevious[index]=this.isButtonRadio(previous)&&this.isButtonRadio(current)&&this.areActuallyAdjacent(previous,current)}for(let index=0;index<radios.length;index+=1){const joinsBefore=joinsPrevious[index]??!1,joinsAfter=joinsPrevious[index+1]??!1,position=joinsBefore?joinsAfter?"middle":"end":joinsAfter?"start":"standalone";radios[index].setButtonRunPosition(position)}}armMembershipObserver(){const ownerDocument=this.ownerDocument;if(!this.isConnected||this.membershipObserver&&this.membershipObserverDocument===ownerDocument)return;this.resetMembershipObserver();const ownerWindow=ownerDocument?.defaultView,MutationObserverCtor=ownerWindow?.MutationObserver;if(!ownerWindow||!MutationObserverCtor)return;const generation=this.membershipObserverGeneration,observer=new MutationObserverCtor(()=>{this.membershipObserver!==observer||this.membershipObserverDocument!==ownerDocument||this.membershipObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||ownerWindow.queueMicrotask(()=>{this.membershipObserver!==observer||this.membershipObserverDocument!==ownerDocument||this.membershipObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||this.syncRadios()})});this.membershipObserver=observer,this.membershipObserverDocument=ownerDocument,observer.observe(this,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["slot","checked","disabled","value","size","appearance","hidden","inert","aria-hidden","aria-disabled","class","style"]})}disconnectedCallback(){this.resetMembershipObserver(),this.runResizeObserver?.disconnect(),this.runResizeObserver=void 0;const ownerWindow=this.ownerDocument?.defaultView;ownerWindow&&this.runProjectionFrame!==void 0&&ownerWindow.cancelAnimationFrame(this.runProjectionFrame),this.runProjectionFrame=void 0,this.releaseRadios(this.managedRadios),this.managedRadios.clear(),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.resetMembershipObserver()}resetMembershipObserver(){this.membershipObserverGeneration+=1,this.membershipObserver?.disconnect(),this.membershipObserver=void 0,this.membershipObserverDocument=void 0}willUpdate(changed){super.willUpdate(changed),changed.has("shoelaceDefaultValue")&&(this.hasAttribute("default-value")||this.hadShoelaceDefaultValue)&&(this.defaultValue=this.shoelaceDefaultValue,this.hadShoelaceDefaultValue=this.hasAttribute("default-value"))}updated(changed){super.updated(changed),this.syncRadios()}syncSupportSlots(){this.hasLabelSlot=Array.from(this.children??[]).some(element=>element.getAttribute("slot")==="label"),this.hasHintSlot=Array.from(this.children??[]).some(element=>element.getAttribute("slot")==="hint"),this.hasHelpTextSlot=Array.from(this.children??[]).some(element=>element.getAttribute("slot")==="help-text"),this.hasErrorSlot=Array.from(this.children??[]).some(element=>element.getAttribute("slot")==="error")}radioGroupOwner(element){const group=element.closest(tag("radio-group"));if(!group)return null;let topLevelChild=element;for(;topLevelChild.parentElement&&topLevelChild.parentElement!==group;)topLevelChild=topLevelChild.parentElement;if(topLevelChild.parentElement!==group)return null;const slot=topLevelChild.getAttribute("slot");return slot==="label"||slot==="hint"||slot==="help-text"||slot==="error"?null:group}ownsRadio(element){return RADIO_TAGS().includes(element.localName)&&this.radioGroupOwner(element)===this}radios(){const querySelectorAll=this.querySelectorAll;return typeof querySelectorAll!="function"?[]:[...querySelectorAll.call(this,RADIO_TAGS().join(","))].filter(radio=>this.ownsRadio(radio)&&typeof radio.setGroupOwner=="function")}isRadioAvailable(radio){if(radio.effectiveDisabled||radio.matches(":disabled"))return!1;for(let current=radio;current;current=composedParentElement(current)){if(isAccessibilitySubtreeExcluded(current)||isAriaTrue(current.getAttribute("aria-disabled")))return!1;if(current===this)break}return!0}selectValue(next){const desired=next??"",radios=this.radios();if(radios.length===0){const old=this._value;this._value=desired,this.pendingSelection=desired,this.syncFormState(),this.updateValidity(),this.requestUpdate("value",old);return}const match=radios.find(radio=>radio.value===desired);this.syncingRadios=!0;try{for(const radio of radios)radio.checked=radio===match}finally{this.syncingRadios=!1}this.pendingSelection=void 0,this.syncRadios(match)}syncRadios(preferred){if(!this.syncingRadios){this.syncingRadios=!0;try{const radios=this.radios(),current=new Set(radios);this.releaseRadios([...this.managedRadios].filter(radio=>!current.has(radio)));for(const radio of radios)radio.setGroupOwner(this);this.managedRadios=current,this.armRunResizeObserver();for(const radio of radios)radio.setGroupDisabled(this.effectiveDisabled);const enabled=radios.filter(radio=>this.isRadioAvailable(radio));let checked=radios.filter(radio=>radio.checked),checkedRadio;if(this.pendingSelection!==void 0&&radios.length>0){checkedRadio=radios.find(radio=>radio.value===this.pendingSelection);for(const radio of radios)radio.checked=radio===checkedRadio;checked=checkedRadio?[checkedRadio]:[],this.pendingSelection=void 0}else checkedRadio=preferred?.checked&&current.has(preferred)?preferred:checked[checked.length-1];for(const radio of checked)radio!==checkedRadio&&(radio.checked=!1);const tabbableRadio=checkedRadio&&this.isRadioAvailable(checkedRadio)?checkedRadio:enabled[0];for(const radio of radios)radio.setGroupSize(this.size),radio.setGroupRequired(this.required&&!this.effectiveDisabled),radio.setGroupTabbable(radio===tabbableRadio);const oldValue=this._value;this._value=checkedRadio?.value??"",this.syncFormState(),this.updateValidity(),oldValue!==this._value&&this.requestUpdate("value",oldValue),this.scheduleRunProjection()}finally{this.syncingRadios=!1}}}releaseRadios(radios){for(const radio of radios)radio.releaseGroupOwner(this),radio.setButtonRunPosition("standalone")}reconcileRadio(radio){return this.ownsRadio(radio)?(this.syncRadios(radio.checked?radio:void 0),!0):!1}releaseRadio(radio){this.managedRadios.has(radio)&&(this.releaseRadios([radio]),this.managedRadios.delete(radio),this.syncRadios())}radioCheckedChanged(radio){this.syncingRadios||!this.ownsRadio(radio)||(this._valueDirty=!0,this.syncRadios(radio.checked?radio:void 0))}selectRadio(radio){if(this.effectiveDisabled||!this.ownsRadio(radio)||!this.isRadioAvailable(radio))return!1;this._valueDirty=!0,this.hasInteracted=!0,this.syncingRadios=!0;try{for(const candidate of this.radios())candidate.checked=candidate===radio}finally{this.syncingRadios=!1}return this.syncRadios(),dispatchNativeInputEvent(this),this.emit("lr-input",{value:radio.value,radio}),dispatchNativeEvent(this,"change"),this.emit("lr-change",{value:radio.value,radio}),!0}focus(options){if(this.effectiveDisabled||this.matches(":disabled"))return;const enabled=this.radios().filter(radio=>this.isRadioAvailable(radio));(enabled.find(radio=>radio.checked)??enabled[0])?.focus(options)}blur(){this.radios().find(radio=>radio.matches(":focus-within"))?.blur()}click(){if(this.effectiveDisabled||this.matches(":disabled"))return;const enabled=this.radios().filter(radio=>this.isRadioAvailable(radio));(enabled.find(radio=>radio.checked)??enabled[0])?.click()}[VALIDITY_ANCHOR](){return this.renderRoot?.querySelector('[part~="base"]')??null}syncFormState(){this.internals&&this.internals.setFormValue(this.name&&this.value?this.value:null,this.value)}get barredFromValidation(){return isBarredFromValidation(this,this.internals)}updateValidity(){if(!this.validityController)return;const missing=!this.barredFromValidation&&this.required&&!this.value;this.validityController.setValidity(missing?{valueMissing:!0}:{},missing?this.localize("radioRequired"):""),this.reflectValidityStates()}reflectValidityStates(){syncValidityStates(this.internals,{required:this.required,hasInteracted:this.hasInteracted,barred:this.barredFromValidation})}checkValidity(){return this.internals.checkValidity()}reportValidity(){return this.hasInteracted=!0,this.updateValidity(),this.requestUpdate(),this.internals.reportValidity()}commitCustomValidity(message){const old=this.customError,normalized=message??"";this.validityController.setCustomValidity(normalized),this.reflectValidityStates(),this.reflectingCustomError=!0;try{normalized?this.setAttribute("custom-error",normalized):this.removeAttribute("custom-error")}finally{this.reflectingCustomError=!1}this.requestUpdate("customError",old)}setCustomValidity(message=""){this.commitCustomValidity(message)}resetValidity(){this.commitCustomValidity(""),this.updateValidity()}formResetCallback(){this._valueDirty=!1,this.pendingSelection=void 0,this.syncingRadios=!0;try{for(const radio of this.radios())radio.resetFromGroup()}finally{this.syncingRadios=!1}this.defaultValue&&(this.pendingSelection=this.defaultValue),this.hasInteracted=!1,this.syncRadios()}formStateRestoreCallback(state2,reason){this._valueDirty=!0,this.hasInteracted=!1,this.pendingSelection=typeof state2=="string"?state2:"",this.selectValue(this.pendingSelection)}formDisabledCallback(disabled){this._fieldsetDisabled=disabled,this.syncRadios(),this.updateValidity(),this.requestUpdate()}render(){const hasLabel=this.hasLabelSlot||!!this.label||this.withLabel,hasAccessibleLabel=this.hasAttribute("aria-label")||!!this.accessibleLabel,hasHint=this.hasHintSlot||this.hasHelpTextSlot||!!(this.hint||this.helpText)||this.withHint,hasError=this.hasErrorSlot||!!this.errorText,described=[hasHint?this.hintId:"",hasError?this.errorId:""].filter(Boolean).join(" ")||nothing;return html`
1
+ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{acquireResolvedAriaRelationship}from"../../../internal/aria-controls.js";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{installFormControlLabelSupport}from"../../../internal/form-control-labels.js";installFormControlLabelSupport();import{nextId}from"../../../internal/a11y.js";import{tag}from"../../../internal/prefix.js";import{sizes}from"../../../internal/sizes.styles.js";import{groupStyles}from"./radio-group.styles.js";import{dispatchNativeEvent,dispatchNativeInputEvent}from"../../../internal/native-event-relay.js";import{AnchoredValidityController,VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{syncValidityStates}from"../../../internal/custom-states.js";import{attachInternalsSafely,getFormOwner,isBarredFromValidation,setFormOwner}from"../../../internal/form-associated.js";import{declaredDefaultConverter,omittedEmptyStringConverter}from"../../../internal/converters.js";import{isAccessibilitySubtreeExcluded,isAriaTrue}from"../../../internal/accessibility-visibility.js";import{composedParentElement}from"../../../internal/active-element.js";import{currentValidityValidator}from"../form-validator.js";import{LYRA_DEFAULT_radioRequired}from"../../../internal/default-strings.generated.js";const RADIO_TAGS=()=>[tag("radio"),tag("radio-button")];class LyraRadioGroup extends LyraElement{static{this.defaultStrings={...super.defaultStrings,radioRequired:LYRA_DEFAULT_radioRequired}}static{this.immutableEventDetails=Object.freeze(["lr-input","lr-change"])}static{this.identityEventDetailProperties=Object.freeze({"lr-input":Object.freeze(["radio"]),"lr-change":Object.freeze(["radio"])})}static get validators(){return[currentValidityValidator("required","disabled","value")]}static{this.formAssociated=!0}static{this.styles=[LyraElement.styles,sizes,groupStyles]}static{this.properties={name:{reflect:!0,noAccessor:!0,converter:omittedEmptyStringConverter},value:{attribute:!1,noAccessor:!0},defaultValue:{attribute:"value",reflect:!0,useDefault:!0,noAccessor:!0},customError:{attribute:"custom-error",reflect:!0,noAccessor:!0},required:{type:Boolean,reflect:!0,noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0},orientation:{reflect:!0,converter:declaredDefaultConverter("vertical")},form:{noAccessor:!0}}}get name(){return this._name}set name(next){const old=this._name;this._name=next??"",this._name?this.setAttribute("name",this._name):this.removeAttribute("name"),this.syncFormState(),this.requestUpdate("name",old)}get value(){return this._value}set value(next){this._valueDirty=!0,this.selectValue(next??"")}get defaultValue(){return this._defaultValue}set defaultValue(next){if(this.reflectingDefaultValue)return;const old=this._defaultValue;this._defaultValue=next??"",this.reflectingDefaultValue=!0;try{this._defaultValue?this.setAttribute("value",this._defaultValue):this.removeAttribute("value")}finally{this.reflectingDefaultValue=!1}this._valueDirty||(this.selectValue(this._defaultValue),this._valueDirty=!1),this.requestUpdate("defaultValue",old)}get customError(){return this.validityController?.customValidityMessage||null}set customError(next){this.reflectingCustomError||this.commitCustomValidity(next)}get required(){return this._required}set required(next){const old=this._required;this._required=!!next,this.toggleAttribute("required",this._required),this.syncRadios(),this.updateValidity(),this.requestUpdate("required",old)}get disabled(){return this._disabled}set disabled(next){const old=this._disabled;this._disabled=!!next,this.toggleAttribute("disabled",this._disabled),this.syncRadios(),this.updateValidity(),this.requestUpdate("disabled",old)}get effectiveDisabled(){return this.disabled||this._fieldsetDisabled}get form(){return getFormOwner(this.internals)}set form(owner){setFormOwner(this,owner)}getForm(){return getFormOwner(this.internals)}get labels(){return this.internals.labels}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}get willValidate(){return this.internals.willValidate}constructor(){super(),this.size="m",this.orientation="vertical",this.label="",this.hint="",this.helpText="",this.shoelaceDefaultValue="",this.withLabel=!1,this.withHint=!1,this.errorText="",this.accessibleLabel="",this.hasLabelSlot=!1,this.hasHintSlot=!1,this.hasHelpTextSlot=!1,this.hasErrorSlot=!1,this.labelId=nextId("radio-group-label"),this.hintId=nextId("radio-group-hint"),this.errorId=nextId("radio-group-error"),this.managedRadios=new Set,this.syncingRadios=!1,this.membershipObserverGeneration=0,this._name="",this._value="",this._defaultValue="",this._valueDirty=!1,this.reflectingDefaultValue=!1,this.reflectingCustomError=!1,this._required=!1,this._disabled=!1,this._fieldsetDisabled=!1,this.hasInteracted=!1,this.hadShoelaceDefaultValue=!1,this.onInvalid=event=>{const target=event.target;if(target!==this&&!(target?.nodeType===1&&this.ownsRadio(target)))return;this.hasInteracted=!0,this.reflectValidityStates(),this.requestUpdate(),this.emit("lr-invalid",null,{cancelable:!0}).defaultPrevented&&event.preventDefault()},this.onKeyDown=event=>{if(![...this.orientation==="horizontal"?["ArrowRight","ArrowLeft"]:["ArrowDown","ArrowUp"],"Home","End"].includes(event.key)||this.effectiveDisabled)return;const radios=this.radios().filter(radio=>this.isRadioAvailable(radio)),current=event.target;if(!this.isRadioAvailable(current))return;const index=radios.indexOf(current);if(index<0||radios.length===0)return;event.preventDefault();const rtl=this.effectiveDirection==="rtl",forward=this.orientation==="vertical"?event.key==="ArrowDown":rtl?event.key==="ArrowLeft":event.key==="ArrowRight",backward=this.orientation==="vertical"?event.key==="ArrowUp":rtl?event.key==="ArrowRight":event.key==="ArrowLeft",nextIndex=event.key==="Home"?0:event.key==="End"?radios.length-1:forward?(index+1)%radios.length:backward?(index-1+radios.length)%radios.length:index,next=radios[nextIndex];next.focus(),next.activateFromGroup()},this.onSlotChange=event=>{const slot=event.target,elements=slot.assignedElements({flatten:!0});slot.name==="label"&&(this.hasLabelSlot=elements.length>0),slot.name==="hint"&&(this.hasHintSlot=elements.length>0),slot.name==="help-text"&&(this.hasHelpTextSlot=elements.length>0),slot.name==="error"&&(this.hasErrorSlot=elements.length>0)},this.onRadioSlotChange=()=>{this.syncRadios();const ownerDocument=this.ownerDocument,generation=this.membershipObserverGeneration,ownerWindow=ownerDocument?.defaultView;ownerWindow&&ownerWindow.queueMicrotask(()=>{this.membershipObserverGeneration===generation&&this.isConnected&&this.ownerDocument===ownerDocument&&this.syncRadios()})},this.internals=attachInternalsSafely(this),this.validityController=new AnchoredValidityController(this,this.internals,()=>this[VALIDITY_ANCHOR]()),this.addEventListener("invalid",this.onInvalid,!0),this.syncFormState(),this.updateValidity()}syncExternalDescription(){if(!this.isConnected)return;const target=this.renderRoot?.querySelector('[role="radiogroup"]')??null;target&&(this.externalDescriptionLease?this.externalDescriptionLease.update(target):this.externalDescriptionLease=acquireResolvedAriaRelationship(this,target,"aria-describedby"))}releaseExternalDescription(){this.externalDescriptionLease?.release(),this.externalDescriptionLease=void 0}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.syncExternalDescription(),this.syncSupportSlots(),this.syncRadios(),this.armMembershipObserver(),this.armRunResizeObserver(),this.scheduleRunProjection()}armRunResizeObserver(){this.runResizeObserver?.disconnect();const ResizeObserverCtor=this.ownerDocument?.defaultView?.ResizeObserver;if(!(!ResizeObserverCtor||!this.isConnected)){this.runResizeObserver=new ResizeObserverCtor(()=>this.scheduleRunProjection()),this.runResizeObserver.observe(this);for(const radio of this.radios())this.runResizeObserver.observe(radio)}}scheduleRunProjection(){const ownerWindow=this.ownerDocument?.defaultView;!ownerWindow||!this.isConnected||this.runProjectionFrame!==void 0||(this.runProjectionFrame=ownerWindow.requestAnimationFrame(()=>{this.runProjectionFrame=void 0,this.isConnected&&this.projectButtonRuns()}))}isButtonRadio(radio){return radio.localName===tag("radio-button")||radio.appearance==="button"}areActuallyAdjacent(first,second){const firstRect=first.getBoundingClientRect(),secondRect=second.getBoundingClientRect();if(firstRect.width<=0||firstRect.height<=0||secondRect.width<=0||secondRect.height<=0||!(Math.abs(firstRect.top-secondRect.top)<=1&&Math.abs(firstRect.bottom-secondRect.bottom)<=1))return!1;const gap=getComputedStyle(this).direction==="rtl"?firstRect.left-secondRect.right:secondRect.left-firstRect.right;return gap>=-2&&gap<=1}projectButtonRuns(){const radios=this.radios(),joinsPrevious=radios.map(()=>!1);if(this.orientation==="horizontal")for(let index=1;index<radios.length;index+=1){const previous=radios[index-1],current=radios[index];joinsPrevious[index]=this.isButtonRadio(previous)&&this.isButtonRadio(current)&&this.areActuallyAdjacent(previous,current)}for(let index=0;index<radios.length;index+=1){const joinsBefore=joinsPrevious[index]??!1,joinsAfter=joinsPrevious[index+1]??!1,position=joinsBefore?joinsAfter?"middle":"end":joinsAfter?"start":"standalone";radios[index].setButtonRunPosition(position)}}armMembershipObserver(){const ownerDocument=this.ownerDocument;if(!this.isConnected||this.membershipObserver&&this.membershipObserverDocument===ownerDocument)return;this.resetMembershipObserver();const ownerWindow=ownerDocument?.defaultView,MutationObserverCtor=ownerWindow?.MutationObserver;if(!ownerWindow||!MutationObserverCtor)return;const generation=this.membershipObserverGeneration,observer=new MutationObserverCtor(()=>{this.membershipObserver!==observer||this.membershipObserverDocument!==ownerDocument||this.membershipObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||ownerWindow.queueMicrotask(()=>{this.membershipObserver!==observer||this.membershipObserverDocument!==ownerDocument||this.membershipObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||this.syncRadios()})});this.membershipObserver=observer,this.membershipObserverDocument=ownerDocument,observer.observe(this,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["slot","checked","disabled","value","size","appearance","hidden","inert","aria-hidden","aria-disabled","class","style"]})}disconnectedCallback(){this.releaseExternalDescription(),this.resetMembershipObserver(),this.runResizeObserver?.disconnect(),this.runResizeObserver=void 0;const ownerWindow=this.ownerDocument?.defaultView;ownerWindow&&this.runProjectionFrame!==void 0&&ownerWindow.cancelAnimationFrame(this.runProjectionFrame),this.runProjectionFrame=void 0,this.releaseRadios(this.managedRadios),this.managedRadios.clear(),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.releaseExternalDescription(),this.hasUpdated&&this.syncExternalDescription(),this.resetMembershipObserver()}resetMembershipObserver(){this.membershipObserverGeneration+=1,this.membershipObserver?.disconnect(),this.membershipObserver=void 0,this.membershipObserverDocument=void 0}willUpdate(changed){super.willUpdate(changed),changed.has("shoelaceDefaultValue")&&(this.hasAttribute("default-value")||this.hadShoelaceDefaultValue)&&(this.defaultValue=this.shoelaceDefaultValue,this.hadShoelaceDefaultValue=this.hasAttribute("default-value"))}updated(changed){super.updated(changed),this.syncExternalDescription(),this.syncRadios()}syncSupportSlots(){this.hasLabelSlot=Array.from(this.children??[]).some(element=>element.getAttribute("slot")==="label"),this.hasHintSlot=Array.from(this.children??[]).some(element=>element.getAttribute("slot")==="hint"),this.hasHelpTextSlot=Array.from(this.children??[]).some(element=>element.getAttribute("slot")==="help-text"),this.hasErrorSlot=Array.from(this.children??[]).some(element=>element.getAttribute("slot")==="error")}radioGroupOwner(element){const group=element.closest(tag("radio-group"));if(!group)return null;let topLevelChild=element;for(;topLevelChild.parentElement&&topLevelChild.parentElement!==group;)topLevelChild=topLevelChild.parentElement;if(topLevelChild.parentElement!==group)return null;const slot=topLevelChild.getAttribute("slot");return slot==="label"||slot==="hint"||slot==="help-text"||slot==="error"?null:group}ownsRadio(element){return RADIO_TAGS().includes(element.localName)&&this.radioGroupOwner(element)===this}radios(){const querySelectorAll=this.querySelectorAll;return typeof querySelectorAll!="function"?[]:[...querySelectorAll.call(this,RADIO_TAGS().join(","))].filter(radio=>this.ownsRadio(radio)&&typeof radio.setGroupOwner=="function")}isRadioAvailable(radio){if(radio.effectiveDisabled||radio.matches(":disabled"))return!1;for(let current=radio;current;current=composedParentElement(current)){if(isAccessibilitySubtreeExcluded(current)||isAriaTrue(current.getAttribute("aria-disabled")))return!1;if(current===this)break}return!0}selectValue(next){const desired=next??"",radios=this.radios();if(radios.length===0){const old=this._value;this._value=desired,this.pendingSelection=desired,this.syncFormState(),this.updateValidity(),this.requestUpdate("value",old);return}const match=radios.find(radio=>radio.value===desired);this.syncingRadios=!0;try{for(const radio of radios)radio.checked!==(radio===match)&&(radio.checked=radio===match)}finally{this.syncingRadios=!1}this.pendingSelection=void 0,this.syncRadios(match)}syncRadios(preferred){if(!this.syncingRadios){this.syncingRadios=!0;try{const radios=this.radios(),current=new Set(radios);this.releaseRadios([...this.managedRadios].filter(radio=>!current.has(radio)));for(const radio of radios)radio.setGroupOwner(this);this.managedRadios=current,this.armRunResizeObserver();for(const radio of radios)radio.setGroupDisabled(this.effectiveDisabled);const enabled=radios.filter(radio=>this.isRadioAvailable(radio));let checked=radios.filter(radio=>radio.checked),checkedRadio;if(this.pendingSelection!==void 0&&radios.length>0){checkedRadio=radios.find(radio=>radio.value===this.pendingSelection);for(const radio of radios)radio.checked!==(radio===checkedRadio)&&(radio.checked=radio===checkedRadio);checked=checkedRadio?[checkedRadio]:[],this.pendingSelection=void 0}else checkedRadio=preferred?.checked&&current.has(preferred)?preferred:checked[checked.length-1];for(const radio of checked)radio!==checkedRadio&&(radio.checked=!1);const tabbableRadio=checkedRadio&&this.isRadioAvailable(checkedRadio)?checkedRadio:enabled[0];for(const radio of radios)radio.setGroupSize(this.size),radio.setGroupRequired(this.required&&!this.effectiveDisabled),radio.setGroupTabbable(radio===tabbableRadio);const oldValue=this._value;this._value=checkedRadio?.value??"",this.syncFormState(),this.updateValidity(),oldValue!==this._value&&this.requestUpdate("value",oldValue),this.scheduleRunProjection()}finally{this.syncingRadios=!1}}}releaseRadios(radios){for(const radio of radios)radio.releaseGroupOwner(this),radio.setButtonRunPosition("standalone")}reconcileRadio(radio){return this.ownsRadio(radio)?(this.syncRadios(radio.checked?radio:void 0),!0):!1}releaseRadio(radio){this.managedRadios.has(radio)&&(this.releaseRadios([radio]),this.managedRadios.delete(radio),this.syncRadios())}radioCheckedChanged(radio){this.syncingRadios||!this.ownsRadio(radio)||(this._valueDirty=!0,this.syncRadios(radio.checked?radio:void 0))}selectRadio(radio){if(this.effectiveDisabled||!this.ownsRadio(radio)||!this.isRadioAvailable(radio))return!1;this._valueDirty=!0,this.hasInteracted=!0,this.syncingRadios=!0;try{for(const candidate of this.radios())candidate.checked!==(candidate===radio)&&(candidate.checked=candidate===radio)}finally{this.syncingRadios=!1}return this.syncRadios(),dispatchNativeInputEvent(this),this.emit("lr-input",{value:radio.value,radio}),dispatchNativeEvent(this,"change"),this.emit("lr-change",{value:radio.value,radio}),!0}focus(options){if(this.effectiveDisabled||this.matches(":disabled"))return;const enabled=this.radios().filter(radio=>this.isRadioAvailable(radio));(enabled.find(radio=>radio.checked)??enabled[0])?.focus(options)}blur(){this.radios().find(radio=>radio.matches(":focus-within"))?.blur()}click(){if(this.effectiveDisabled||this.matches(":disabled"))return;const enabled=this.radios().filter(radio=>this.isRadioAvailable(radio));(enabled.find(radio=>radio.checked)??enabled[0])?.click()}[VALIDITY_ANCHOR](){return this.renderRoot?.querySelector('[part~="base"]')??null}syncFormState(){this.internals&&this.internals.setFormValue(this.name&&this.value?this.value:null,this.value)}get barredFromValidation(){return isBarredFromValidation(this,this.internals)}updateValidity(){if(!this.validityController)return;const missing=!this.barredFromValidation&&this.required&&!this.value;this.validityController.setValidity(missing?{valueMissing:!0}:{},missing?this.localize("radioRequired"):""),this.reflectValidityStates()}reflectValidityStates(){syncValidityStates(this.internals,{required:this.required,hasInteracted:this.hasInteracted,barred:this.barredFromValidation})}checkValidity(){return this.internals.checkValidity()}reportValidity(){return this.hasInteracted=!0,this.updateValidity(),this.requestUpdate(),this.internals.reportValidity()}commitCustomValidity(message){const old=this.customError,normalized=message??"";this.validityController.setCustomValidity(normalized),this.reflectValidityStates(),this.reflectingCustomError=!0;try{normalized?this.setAttribute("custom-error",normalized):this.removeAttribute("custom-error")}finally{this.reflectingCustomError=!1}this.requestUpdate("customError",old)}setCustomValidity(message=""){this.commitCustomValidity(message)}resetValidity(){this.commitCustomValidity(""),this.updateValidity()}formResetCallback(){this._valueDirty=!1,this.pendingSelection=void 0,this.syncingRadios=!0;try{for(const radio of this.radios())radio.resetFromGroup()}finally{this.syncingRadios=!1}this.defaultValue&&(this.pendingSelection=this.defaultValue),this.hasInteracted=!1,this.syncRadios()}formStateRestoreCallback(state2,reason){this._valueDirty=!0,this.hasInteracted=!1,this.pendingSelection=typeof state2=="string"?state2:"",this.selectValue(this.pendingSelection)}formDisabledCallback(disabled){this._fieldsetDisabled=disabled,this.syncRadios(),this.updateValidity(),this.requestUpdate()}render(){const hasLabel=this.hasLabelSlot||!!this.label||this.withLabel,hasAccessibleLabel=this.hasAttribute("aria-label")||!!this.accessibleLabel,hasHint=this.hasHintSlot||this.hasHelpTextSlot||!!(this.hint||this.helpText)||this.withHint,hasError=this.hasErrorSlot||!!this.errorText,described=[hasHint?this.hintId:"",hasError?this.errorId:""].filter(Boolean).join(" ")||nothing;return html`
2
2
  <div part="base" role="radiogroup"
3
3
  aria-label=${hasAccessibleLabel?this.accessibleLabel:nothing}
4
4
  aria-labelledby=${!hasAccessibleLabel&&hasLabel?this.labelId:nothing}
@@ -1,4 +1,4 @@
1
- import{type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{LyraSize}from'../../../internal/variants.js';import{type FormOwnerValue}from'../../../internal/form-associated.js';import{type LyraFormValidator}from'../form-validator.js';export interface LyraRadioEventMap{'lr-invalid':CustomEvent<null>;input:Event;change:Event;'lr-input':CustomEvent<{checked:boolean;value:string;}>;'lr-change':CustomEvent<{checked:boolean;value:string;}>;focus:FocusEvent;blur:FocusEvent;}export type RadioAppearance='default'|'button';type RadioButtonRunPosition='standalone'|'start'|'middle'|'end';
1
+ import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{LyraSize}from'../../../internal/variants.js';import{type FormOwnerValue}from'../../../internal/form-associated.js';import{type LyraFormValidator}from'../form-validator.js';export interface LyraRadioEventMap{'lr-invalid':CustomEvent<null>;input:Event;change:Event;'lr-input':CustomEvent<{checked:boolean;value:string;}>;'lr-change':CustomEvent<{checked:boolean;value:string;}>;focus:FocusEvent;blur:FocusEvent;}export type RadioAppearance='default'|'button';type RadioButtonRunPosition='standalone'|'start'|'middle'|'end';
2
2
  /**
3
3
  * `<lr-radio>` — a form-associated single-choice control. Radios can be used
4
4
  * alone or inside `<lr-radio-group>`.
@@ -18,6 +18,10 @@ import{type TemplateResult}from'lit';import{LyraElement}from'../../../internal/l
18
18
  * `<lr-radio-button>` render around the label. Empty leading, label, and trailing wrappers stay
19
19
  * hidden so only present content contributes the button's flex gaps.
20
20
  *
21
+ * Host `aria-describedby` references resolve onto the internal radio, including button appearance,
22
+ * and track live target changes, reconnect and document adoption. Explicit `checked` assignments
23
+ * mark live state dirty even when unchanged; later default changes affect live state only after reset.
24
+ *
21
25
  * @customElement lr-radio
22
26
  * @slot - Label content, including forwarded or element-only visuals.
23
27
  * @slot start - Leading content in `appearance="button"`, typically an icon.
@@ -143,7 +147,7 @@ get effectiveSize():LyraSize;get form():HTMLFormElement|null;set form(owner:Form
143
147
  * form participation and validity reporting are unavailable in that environment (there is no
144
148
  * polyfillable substitute), but rendering and every non-form-associated feature keep working.
145
149
  * Mirrors lr-graph-query-builder's identical guard. */
146
- private safeAttachInternals;private inertInternals;connectedCallback():void;disconnectedCallback():void;formResetCallback():void;private restoreCheckedFromDefault;formStateRestoreCallback(state:string|File|FormData|null,reason:'autocomplete'|'restore'):void;formDisabledCallback(disabled:boolean):void;
150
+ private safeAttachInternals;private inertInternals;private externalDescriptionLease?;private syncExternalDescription;protected updated(changed:PropertyValues):void;private releaseExternalDescription;connectedCallback():void;adoptedCallback():void;disconnectedCallback():void;formResetCallback():void;private restoreCheckedFromDefault;formStateRestoreCallback(state:string|File|FormData|null,reason:'autocomplete'|'restore'):void;formDisabledCallback(disabled:boolean):void;
147
151
  /** Shared with every other form control: disabled (own, fieldset, or group) bars validation. */
148
152
  private get barredFromValidation();private updateValidity;
149
153
  /** Republishes the six validity custom states (`required`/`optional`, `valid`/`invalid`,
@@ -1,4 +1,4 @@
1
- var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{installFormControlLabelSupport}from"../../../internal/form-control-labels.js";installFormControlLabelSupport();import{AnchoredValidityController,VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{setCustomState,syncValidityStates}from"../../../internal/custom-states.js";import{tag}from"../../../internal/prefix.js";import{sizes}from"../../../internal/sizes.styles.js";import{styles}from"./radio.styles.js";import{appearanceStyles}from"./radio-button.styles.js";import{dispatchNativeEvent,relayNativeEvent}from"../../../internal/native-event-relay.js";import{getFormOwner,installCustomErrorProperty,isBarredFromValidation,setFormOwner}from"../../../internal/form-associated.js";import{installInvalidEventAlias}from"../../../internal/invalid-event-alias.js";import{declaredDefaultConverter,omittedEmptyStringConverter}from"../../../internal/converters.js";import{hasRealContent}from"../../../internal/a11y.js";import{isActionableElement}from"../../../internal/focus-navigation.js";import{currentValidityValidator}from"../form-validator.js";import{LYRA_DEFAULT_radioRequired}from"../../../internal/default-strings.generated.js";class LyraRadio extends LyraElement{static{this.defaultStrings={...super.defaultStrings,radioRequired:LYRA_DEFAULT_radioRequired}}static get validators(){return[currentValidityValidator("required","disabled","checked","value")]}static{this.styles=[LyraElement.styles,sizes,styles,appearanceStyles]}static{this.formAssociated=!0}static{this.properties={customError:{attribute:"custom-error",reflect:!0,noAccessor:!0},checked:{attribute:!1,noAccessor:!0},defaultChecked:{attribute:"checked",type:Boolean,reflect:!0,useDefault:!0,noAccessor:!0},appearance:{reflect:!0,converter:declaredDefaultConverter("default")},disabled:{type:Boolean,reflect:!0,noAccessor:!0},name:{reflect:!0,noAccessor:!0,converter:omittedEmptyStringConverter},pill:{type:Boolean,reflect:!0},required:{type:Boolean,reflect:!0,noAccessor:!0},size:{reflect:!0,converter:declaredDefaultConverter("m")},value:{reflect:!0,noAccessor:!0}}}get checked(){return this._checked}set checked(value){const old=this._checked,next=!!value;old!==next&&(this.settingDefaultChecked||(this._checkedDirty=!0),this._checked=next,this.syncFormState(),this.requestUpdate("checked",old),this.isConnected&&this.group()?.radioCheckedChanged?.(this))}get defaultChecked(){return this._defaultChecked}set defaultChecked(value){if(this.reflectingDefaultChecked)return;const old=this._defaultChecked;this._defaultChecked=!!value,this.reflectingDefaultChecked=!0;try{this.toggleAttribute("checked",this._defaultChecked)}finally{this.reflectingDefaultChecked=!1}this._checkedDirty||this.restoreCheckedFromDefault(),this.requestUpdate("defaultChecked",old)}get disabled(){return this._disabled}set disabled(value){const old=this._disabled;this._disabled=!!value,this.toggleAttribute("disabled",this._disabled),this.updateValidity(),this.requestUpdate("disabled",old)}get required(){return this._required}set required(value){const old=this._required;this._required=!!value,this.toggleAttribute("required",this._required),this.updateValidity(),this.requestUpdate("required",old)}get name(){return this._name}set name(value){const old=this._name,next=value??"";if(old===next){!next&&this.hasAttribute("name")&&this.removeAttribute("name");return}this._name=next,next?this.getAttribute("name")!==next&&this.setAttribute("name",next):this.hasAttribute("name")&&this.removeAttribute("name"),this.requestUpdate("name",old)}get value(){return this._value}set value(value){const old=this._value,next=value??"on";old!==next&&(this._value=next,value==null?this.hasAttribute("value")&&this.removeAttribute("value"):this.getAttribute("value")!==next&&this.setAttribute("value",next),this.syncFormState(),this.requestUpdate("value",old))}get effectiveDisabled(){return this.disabled||this._fieldsetDisabled||!!this.currentGroup()&&this._groupDisabled}get effectiveRequired(){return this.required||(this.currentGroup()?this._groupRequired:!1)}get effectiveName(){return this.currentGroup()?.name||this.name}get effectiveSize(){return this.currentGroup()?.size??this._groupSize??this.size}get form(){return getFormOwner(this.internals)}set form(owner){setFormOwner(this,owner)}getForm(){return getFormOwner(this.internals)}get labels(){return this.internals.labels}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}get willValidate(){return this.internals.willValidate}constructor(){super(),this.size="m",this.appearance="default",this.pill=!1,this.hasLabel=!1,this.hasStart=!1,this.hasEnd=!1,this.hasInteracted=!1,this._checked=!1,this._disabled=!1,this._required=!1,this._name="",this._value="on",this._fieldsetDisabled=!1,this._groupDisabled=!1,this._groupRequired=!1,this._groupSize=null,this._tabbable=!0,this._buttonRunPosition="standalone",this.groupOwner=null,this._defaultChecked=!1,this._checkedDirty=!1,this.settingDefaultChecked=!1,this.reflectingDefaultChecked=!1,this.onClick=event=>{if(event&&this.isNestedInteractiveEvent(event)){event.stopPropagation();return}this.select()},this.onKeyDown=event=>{if(this.isNestedInteractiveEvent(event)){event.stopPropagation();return}this.effectiveDisabled||(event.key===" "||event.key==="Spacebar")&&(event.preventDefault(),this.select())},this.onFocus=event=>{relayNativeEvent(this,event)},this.onBlur=event=>{this.effectiveDisabled||(this.hasInteracted=!0,this.reflectValidityStates()),relayNativeEvent(this,event)},this.onLabelSlotChange=event=>this.handleLabelSlotChange(event),this.onSlotChange=event=>this.handleLabelSlotChange(event),this.onAdornmentSlotChange=()=>{this.bindLabelObserverTargets(),this.recomputeButtonAdornments()},this.internals=this.safeAttachInternals(),this.validityController=new AnchoredValidityController(this,this.internals,()=>this[VALIDITY_ANCHOR]()),installCustomErrorProperty(this,()=>this.currentGroup()?.customError??this.validityController.customValidityMessage),installInvalidEventAlias(this,init=>this.emit("lr-invalid",null,init)),this.syncFormState()}safeAttachInternals(){if(typeof globalThis.ElementInternals>"u")return this.inertInternals();try{return this.attachInternals()}catch{return this.inertInternals()}}inertInternals(){return{form:null,labels:[],validity:{},validationMessage:"",willValidate:!1,setFormValue:()=>{},setValidity:()=>{},checkValidity:()=>!0,reportValidity:()=>!0,states:new Set}}[VALIDITY_ANCHOR](){return this.renderRoot?.querySelector('[part~="base"]')??null}connectedCallback(){super.connectedCallback();const MutationObserverCtor=this.ownerDocument.defaultView?.MutationObserver;this.labelObserver=MutationObserverCtor?new MutationObserverCtor(()=>{this.bindLabelObserverTargets(),this.recomputeHasLabel(),this.recomputeButtonAdornments()}):void 0,this.addEventListener("slotchange",this.onLabelSlotChange),this.addEventListener("slotchange",this.onAdornmentSlotChange),this.bindLabelObserverTargets(),this.recomputeHasLabel(),this.recomputeButtonAdornments(),this.updateValidity(),this.group()}disconnectedCallback(){this.removeEventListener("slotchange",this.onLabelSlotChange),this.removeEventListener("slotchange",this.onAdornmentSlotChange),this.labelObserver?.disconnect(),this.labelObserver=void 0,super.disconnectedCallback()}formResetCallback(){this.currentGroup()||(this.hasInteracted=!1,this.restoreCheckedFromDefault(),this.reflectValidityStates())}resetFromGroup(){this.hasInteracted=!1,this.restoreCheckedFromDefault()}restoreCheckedFromDefault(){this.settingDefaultChecked=!0;try{this.checked=this._defaultChecked}finally{this.settingDefaultChecked=!1}this._checkedDirty=!1}formStateRestoreCallback(state2,reason){if(this.currentGroup())return;const old=this._checked;this._checked=state2==="checked",this._checkedDirty=!0,this.syncFormState(),this.requestUpdate("checked",old),this.isConnected&&this.group()?.radioCheckedChanged?.(this)}formDisabledCallback(disabled){this._fieldsetDisabled=disabled,this.updateValidity(),this.requestUpdate()}get barredFromValidation(){return isBarredFromValidation(this,this.internals)}updateValidity(){const owned=!!this.currentGroup(),violates=!this.barredFromValidation&&!owned&&this.effectiveRequired&&!this.checked;this.validityController.setValidity(violates?{valueMissing:!0}:{},this.localize("radioRequired")),this.reflectValidityStates()}reflectValidityStates(){syncValidityStates(this.internals,{required:this.effectiveRequired,hasInteracted:this.hasInteracted,barred:this.barredFromValidation}),setCustomState(this.internals,"checked",this.checked),setCustomState(this.internals,"disabled",this.effectiveDisabled)}setGroupDisabled(value){this._groupDisabled!==value&&(this._groupDisabled=value,this.updateValidity(),this.requestUpdate())}setGroupRequired(value){this._groupRequired!==value&&(this._groupRequired=value,this.updateValidity(),this.requestUpdate())}setGroupSize(value){this._groupSize!==value&&(this._groupSize=value,this.toggleAttribute("data-lr-group-size",value!==null),this.requestUpdate())}setGroupTabbable(value){this._tabbable!==value&&(this._tabbable=value,this.requestUpdate())}setButtonRunPosition(value){this._buttonRunPosition!==value&&(this._buttonRunPosition=value,this.requestUpdate())}setGroupOwner(owner){if(this.groupOwner===owner)return;this.groupOwner?.releaseRadio?.(this);const standaloneCustomError=this.validityController.customValidityMessage;this.groupOwner=owner,standaloneCustomError&&owner.setCustomValidity&&(owner.setCustomValidity(standaloneCustomError),this.validityController.setCustomValidity("")),this.syncFormState()}releaseGroupOwner(owner){if(this.groupOwner!==owner)return;this.groupOwner=null,this.setGroupRequired(!1),this.setGroupDisabled(!1),this.setGroupSize(null),this.setGroupTabbable(!0),this.setButtonRunPosition("standalone");const reflectedCustomError=this.getAttribute("custom-error")??"";reflectedCustomError&&this.validityController.setCustomValidity(reflectedCustomError),this.syncFormState()}checkValidity(){return this.internals.checkValidity()}reportValidity(){return this.hasInteracted=!0,this.reflectValidityStates(),this.internals.reportValidity()}setCustomValidity(message){const group=this.currentGroup();if(group?.setCustomValidity){group.setCustomValidity(message??"");return}this.validityController.setCustomValidity(message??""),this.reflectValidityStates(),this.requestUpdate()}resetValidity(){this.setCustomValidity("")}click(){this.effectiveDisabled||this[VALIDITY_ANCHOR]()?.click()}focus(options){this.effectiveDisabled||this[VALIDITY_ANCHOR]()?.focus(options)}blur(){this[VALIDITY_ANCHOR]()?.blur()}syncFormState(){!!this.currentGroup()?this.internals.setFormValue(null):this.internals.setFormValue(this.checked?this.value:null,this.checked?"checked":"unchecked"),this.updateValidity()}currentGroup(){if(!this.isConnected)return null;const closest=this.closest;if(typeof closest!="function")return null;const group=closest.call(this,tag("radio-group"));return group?.isConnected&&group.ownsRadio?.(this)?group:null}group(){const group=this.currentGroup();return group?(this.setGroupOwner(group),group.reconcileRadio?.(this),group):(this.groupOwner?.releaseRadio?.(this),null)}activateFromGroup(){this.select()}select(){const group=this.group();if(!(this.effectiveDisabled||this.checked)){if(this.hasInteracted=!0,group)return group.selectRadio?.(this),void 0;this.checked=!0,dispatchNativeEvent(this,"input"),this.emit("lr-input",{checked:!0,value:this.value}),dispatchNativeEvent(this,"change"),this.emit("lr-change",{checked:!0,value:this.value})}}get groupTabbable(){return this._tabbable}get buttonRunPosition(){return this._buttonRunPosition}isNestedInteractiveEvent(event){const currentTarget=event.currentTarget;for(const entry of event.composedPath()){if(entry===currentTarget)break;if(entry&&typeof entry=="object"&&entry.nodeType===1&&isActionableElement(entry))return!0}return!1}isDefaultLabelNode(node){if(node.nodeType!==1)return!0;const slotName=node.getAttribute("slot");return slotName===null||slotName===""}labelForwardingSlots(){return Array.from(this.querySelectorAll("slot")).filter(slot=>{let top=slot;for(;top.parentNode&&top.parentNode!==this;)top=top.parentNode;return top.parentNode===this&&this.isDefaultLabelNode(top)})}adornmentForwardingSlots(){const names=["start","prefix","end","suffix"];return Array.from(this.querySelectorAll("slot")).filter(slot=>{let top=slot;for(;top.parentNode&&top.parentNode!==this;)top=top.parentNode;return top===slot&&top.parentNode===this&&names.includes(slot.getAttribute("slot")??"")})}observeLabelNode(node){if(this.labelObserver){if(node.nodeType===3){this.labelObserver.observe(node,{characterData:!0});return}node.nodeType===1&&this.labelObserver.observe(node,{attributes:!0,attributeFilter:["aria-hidden","aria-label","class","hidden","inert","slot","style"],childList:!0,characterData:!0,subtree:!0})}}bindLabelObserverTargets(){if(this.labelObserver){this.labelObserver.disconnect(),this.observeLabelNode(this);for(const slot of this.labelForwardingSlots())if(slot.assignedNodes().length!==0)for(const assigned of slot.assignedNodes({flatten:!0}))this.observeLabelNode(assigned);for(const slot of this.adornmentForwardingSlots())if(slot.assignedNodes().length!==0)for(const assigned of slot.assignedNodes({flatten:!0}))this.observeLabelNode(assigned)}}recomputeHasLabel(){const slot=this.renderRoot.querySelector("slot:not([name])"),nodes=slot?slot.assignedNodes({flatten:!0}):Array.from(this.childNodes??[]).filter(node=>this.isDefaultLabelNode(node)).flatMap(node=>{if(node.nodeType!==1||node.localName!=="slot")return[node];const forwardingSlot=node;return forwardingSlot.assignedNodes().length>0?forwardingSlot.assignedNodes({flatten:!0}):Array.from(forwardingSlot.childNodes)});this.hasLabel=hasRealContent(nodes)}assignedAdornmentNodes(names){const slots=names.map(name=>this.renderRoot.querySelector(`slot[name="${name}"]`)).filter(slot=>!!slot);if(slots.length>0)return slots.flatMap(slot=>slot.assignedNodes({flatten:!0}));const children=this.children;return(children?Array.from(children):[]).filter(element=>names.includes(element.getAttribute("slot")??"")).flatMap(element=>{if(element.localName!=="slot")return[element];const forwardingSlot=element;return forwardingSlot.assignedNodes().length>0?forwardingSlot.assignedNodes({flatten:!0}):Array.from(forwardingSlot.childNodes)})}recomputeButtonAdornments(){this.hasStart=hasRealContent(this.assignedAdornmentNodes(["start","prefix"])),this.hasEnd=hasRealContent(this.assignedAdornmentNodes(["end","suffix"]))}handleLabelSlotChange(event){const target=event.target;target?.nodeType!==1||target.localName!=="slot"||target.getRootNode()!==this.renderRoot&&!this.labelForwardingSlots().includes(target)||(this.bindLabelObserverTargets(),this.recomputeHasLabel())}renderButtonContent(){return html`
1
+ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{acquireResolvedAriaRelationship}from"../../../internal/aria-controls.js";import{html,nothing}from"lit";import{state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{installFormControlLabelSupport}from"../../../internal/form-control-labels.js";installFormControlLabelSupport();import{AnchoredValidityController,VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{setCustomState,syncValidityStates}from"../../../internal/custom-states.js";import{tag}from"../../../internal/prefix.js";import{sizes}from"../../../internal/sizes.styles.js";import{styles}from"./radio.styles.js";import{appearanceStyles}from"./radio-button.styles.js";import{dispatchNativeEvent,relayNativeEvent}from"../../../internal/native-event-relay.js";import{getFormOwner,installCustomErrorProperty,isBarredFromValidation,setFormOwner}from"../../../internal/form-associated.js";import{installInvalidEventAlias}from"../../../internal/invalid-event-alias.js";import{declaredDefaultConverter,omittedEmptyStringConverter}from"../../../internal/converters.js";import{hasRealContent}from"../../../internal/a11y.js";import{isActionableElement}from"../../../internal/focus-navigation.js";import{currentValidityValidator}from"../form-validator.js";import{LYRA_DEFAULT_radioRequired}from"../../../internal/default-strings.generated.js";class LyraRadio extends LyraElement{static{this.defaultStrings={...super.defaultStrings,radioRequired:LYRA_DEFAULT_radioRequired}}static get validators(){return[currentValidityValidator("required","disabled","checked","value")]}static{this.styles=[LyraElement.styles,sizes,styles,appearanceStyles]}static{this.formAssociated=!0}static{this.properties={customError:{attribute:"custom-error",reflect:!0,noAccessor:!0},checked:{attribute:!1,noAccessor:!0},defaultChecked:{attribute:"checked",type:Boolean,reflect:!0,useDefault:!0,noAccessor:!0},appearance:{reflect:!0,converter:declaredDefaultConverter("default")},disabled:{type:Boolean,reflect:!0,noAccessor:!0},name:{reflect:!0,noAccessor:!0,converter:omittedEmptyStringConverter},pill:{type:Boolean,reflect:!0},required:{type:Boolean,reflect:!0,noAccessor:!0},size:{reflect:!0,converter:declaredDefaultConverter("m")},value:{reflect:!0,noAccessor:!0}}}get checked(){return this._checked}set checked(value){const old=this._checked,next=!!value;this.settingDefaultChecked||(this._checkedDirty=!0),old!==next&&(this._checked=next,this.syncFormState(),this.requestUpdate("checked",old),this.isConnected&&this.group()?.radioCheckedChanged?.(this))}get defaultChecked(){return this._defaultChecked}set defaultChecked(value){if(this.reflectingDefaultChecked)return;const old=this._defaultChecked;this._defaultChecked=!!value,this.reflectingDefaultChecked=!0;try{this.toggleAttribute("checked",this._defaultChecked)}finally{this.reflectingDefaultChecked=!1}this._checkedDirty||this.restoreCheckedFromDefault(),this.requestUpdate("defaultChecked",old)}get disabled(){return this._disabled}set disabled(value){const old=this._disabled;this._disabled=!!value,this.toggleAttribute("disabled",this._disabled),this.updateValidity(),this.requestUpdate("disabled",old)}get required(){return this._required}set required(value){const old=this._required;this._required=!!value,this.toggleAttribute("required",this._required),this.updateValidity(),this.requestUpdate("required",old)}get name(){return this._name}set name(value){const old=this._name,next=value??"";if(old===next){!next&&this.hasAttribute("name")&&this.removeAttribute("name");return}this._name=next,next?this.getAttribute("name")!==next&&this.setAttribute("name",next):this.hasAttribute("name")&&this.removeAttribute("name"),this.requestUpdate("name",old)}get value(){return this._value}set value(value){const old=this._value,next=value??"on";old!==next&&(this._value=next,value==null?this.hasAttribute("value")&&this.removeAttribute("value"):this.getAttribute("value")!==next&&this.setAttribute("value",next),this.syncFormState(),this.requestUpdate("value",old))}get effectiveDisabled(){return this.disabled||this._fieldsetDisabled||!!this.currentGroup()&&this._groupDisabled}get effectiveRequired(){return this.required||(this.currentGroup()?this._groupRequired:!1)}get effectiveName(){return this.currentGroup()?.name||this.name}get effectiveSize(){return this.currentGroup()?.size??this._groupSize??this.size}get form(){return getFormOwner(this.internals)}set form(owner){setFormOwner(this,owner)}getForm(){return getFormOwner(this.internals)}get labels(){return this.internals.labels}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}get willValidate(){return this.internals.willValidate}constructor(){super(),this.size="m",this.appearance="default",this.pill=!1,this.hasLabel=!1,this.hasStart=!1,this.hasEnd=!1,this.hasInteracted=!1,this._checked=!1,this._disabled=!1,this._required=!1,this._name="",this._value="on",this._fieldsetDisabled=!1,this._groupDisabled=!1,this._groupRequired=!1,this._groupSize=null,this._tabbable=!0,this._buttonRunPosition="standalone",this.groupOwner=null,this._defaultChecked=!1,this._checkedDirty=!1,this.settingDefaultChecked=!1,this.reflectingDefaultChecked=!1,this.onClick=event=>{if(event&&this.isNestedInteractiveEvent(event)){event.stopPropagation();return}this.select()},this.onKeyDown=event=>{if(this.isNestedInteractiveEvent(event)){event.stopPropagation();return}this.effectiveDisabled||(event.key===" "||event.key==="Spacebar")&&(event.preventDefault(),this.select())},this.onFocus=event=>{relayNativeEvent(this,event)},this.onBlur=event=>{this.effectiveDisabled||(this.hasInteracted=!0,this.reflectValidityStates()),relayNativeEvent(this,event)},this.onLabelSlotChange=event=>this.handleLabelSlotChange(event),this.onSlotChange=event=>this.handleLabelSlotChange(event),this.onAdornmentSlotChange=()=>{this.bindLabelObserverTargets(),this.recomputeButtonAdornments()},this.internals=this.safeAttachInternals(),this.validityController=new AnchoredValidityController(this,this.internals,()=>this[VALIDITY_ANCHOR]()),installCustomErrorProperty(this,()=>this.currentGroup()?.customError??this.validityController.customValidityMessage),installInvalidEventAlias(this,init=>this.emit("lr-invalid",null,init)),this.syncFormState()}safeAttachInternals(){if(typeof globalThis.ElementInternals>"u")return this.inertInternals();try{return this.attachInternals()}catch{return this.inertInternals()}}inertInternals(){return{form:null,labels:[],validity:{},validationMessage:"",willValidate:!1,setFormValue:()=>{},setValidity:()=>{},checkValidity:()=>!0,reportValidity:()=>!0,states:new Set}}[VALIDITY_ANCHOR](){return this.renderRoot?.querySelector('[part~="base"]')??null}syncExternalDescription(){if(!this.isConnected)return;const target=this[VALIDITY_ANCHOR]();target&&(this.externalDescriptionLease?this.externalDescriptionLease.update(target):this.externalDescriptionLease=acquireResolvedAriaRelationship(this,target,"aria-describedby"))}updated(changed){super.updated(changed),this.syncExternalDescription()}releaseExternalDescription(){this.externalDescriptionLease?.release(),this.externalDescriptionLease=void 0}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.syncExternalDescription();const MutationObserverCtor=this.ownerDocument.defaultView?.MutationObserver;this.labelObserver=MutationObserverCtor?new MutationObserverCtor(()=>{this.bindLabelObserverTargets(),this.recomputeHasLabel(),this.recomputeButtonAdornments()}):void 0,this.addEventListener("slotchange",this.onLabelSlotChange),this.addEventListener("slotchange",this.onAdornmentSlotChange),this.bindLabelObserverTargets(),this.recomputeHasLabel(),this.recomputeButtonAdornments(),this.updateValidity(),this.group()}adoptedCallback(){super.adoptedCallback(),this.releaseExternalDescription(),this.hasUpdated&&this.syncExternalDescription()}disconnectedCallback(){this.releaseExternalDescription(),this.removeEventListener("slotchange",this.onLabelSlotChange),this.removeEventListener("slotchange",this.onAdornmentSlotChange),this.labelObserver?.disconnect(),this.labelObserver=void 0,super.disconnectedCallback()}formResetCallback(){this.currentGroup()||(this.hasInteracted=!1,this.restoreCheckedFromDefault(),this.reflectValidityStates())}resetFromGroup(){this.hasInteracted=!1,this.restoreCheckedFromDefault()}restoreCheckedFromDefault(){this.settingDefaultChecked=!0;try{this.checked=this._defaultChecked}finally{this.settingDefaultChecked=!1}this._checkedDirty=!1}formStateRestoreCallback(state2,reason){if(this.currentGroup())return;const old=this._checked;this._checked=state2==="checked",this._checkedDirty=!0,this.syncFormState(),this.requestUpdate("checked",old),this.isConnected&&this.group()?.radioCheckedChanged?.(this)}formDisabledCallback(disabled){this._fieldsetDisabled=disabled,this.updateValidity(),this.requestUpdate()}get barredFromValidation(){return isBarredFromValidation(this,this.internals)}updateValidity(){const owned=!!this.currentGroup(),violates=!this.barredFromValidation&&!owned&&this.effectiveRequired&&!this.checked;this.validityController.setValidity(violates?{valueMissing:!0}:{},this.localize("radioRequired")),this.reflectValidityStates()}reflectValidityStates(){syncValidityStates(this.internals,{required:this.effectiveRequired,hasInteracted:this.hasInteracted,barred:this.barredFromValidation}),setCustomState(this.internals,"checked",this.checked),setCustomState(this.internals,"disabled",this.effectiveDisabled)}setGroupDisabled(value){this._groupDisabled!==value&&(this._groupDisabled=value,this.updateValidity(),this.requestUpdate())}setGroupRequired(value){this._groupRequired!==value&&(this._groupRequired=value,this.updateValidity(),this.requestUpdate())}setGroupSize(value){this._groupSize!==value&&(this._groupSize=value,this.toggleAttribute("data-lr-group-size",value!==null),this.requestUpdate())}setGroupTabbable(value){this._tabbable!==value&&(this._tabbable=value,this.requestUpdate())}setButtonRunPosition(value){this._buttonRunPosition!==value&&(this._buttonRunPosition=value,this.requestUpdate())}setGroupOwner(owner){if(this.groupOwner===owner)return;this.groupOwner?.releaseRadio?.(this);const standaloneCustomError=this.validityController.customValidityMessage;this.groupOwner=owner,standaloneCustomError&&owner.setCustomValidity&&(owner.setCustomValidity(standaloneCustomError),this.validityController.setCustomValidity("")),this.syncFormState()}releaseGroupOwner(owner){if(this.groupOwner!==owner)return;this.groupOwner=null,this.setGroupRequired(!1),this.setGroupDisabled(!1),this.setGroupSize(null),this.setGroupTabbable(!0),this.setButtonRunPosition("standalone");const reflectedCustomError=this.getAttribute("custom-error")??"";reflectedCustomError&&this.validityController.setCustomValidity(reflectedCustomError),this.syncFormState()}checkValidity(){return this.internals.checkValidity()}reportValidity(){return this.hasInteracted=!0,this.reflectValidityStates(),this.internals.reportValidity()}setCustomValidity(message){const group=this.currentGroup();if(group?.setCustomValidity){group.setCustomValidity(message??"");return}this.validityController.setCustomValidity(message??""),this.reflectValidityStates(),this.requestUpdate()}resetValidity(){this.setCustomValidity("")}click(){this.effectiveDisabled||this[VALIDITY_ANCHOR]()?.click()}focus(options){this.effectiveDisabled||this[VALIDITY_ANCHOR]()?.focus(options)}blur(){this[VALIDITY_ANCHOR]()?.blur()}syncFormState(){!!this.currentGroup()?this.internals.setFormValue(null):this.internals.setFormValue(this.checked?this.value:null,this.checked?"checked":"unchecked"),this.updateValidity()}currentGroup(){if(!this.isConnected)return null;const closest=this.closest;if(typeof closest!="function")return null;const group=closest.call(this,tag("radio-group"));return group?.isConnected&&group.ownsRadio?.(this)?group:null}group(){const group=this.currentGroup();return group?(this.setGroupOwner(group),group.reconcileRadio?.(this),group):(this.groupOwner?.releaseRadio?.(this),null)}activateFromGroup(){this.select()}select(){const group=this.group();if(!(this.effectiveDisabled||this.checked)){if(this.hasInteracted=!0,group)return group.selectRadio?.(this),void 0;this.checked=!0,dispatchNativeEvent(this,"input"),this.emit("lr-input",{checked:!0,value:this.value}),dispatchNativeEvent(this,"change"),this.emit("lr-change",{checked:!0,value:this.value})}}get groupTabbable(){return this._tabbable}get buttonRunPosition(){return this._buttonRunPosition}isNestedInteractiveEvent(event){const currentTarget=event.currentTarget;for(const entry of event.composedPath()){if(entry===currentTarget)break;if(entry&&typeof entry=="object"&&entry.nodeType===1&&isActionableElement(entry))return!0}return!1}isDefaultLabelNode(node){if(node.nodeType!==1)return!0;const slotName=node.getAttribute("slot");return slotName===null||slotName===""}labelForwardingSlots(){return Array.from(this.querySelectorAll("slot")).filter(slot=>{let top=slot;for(;top.parentNode&&top.parentNode!==this;)top=top.parentNode;return top.parentNode===this&&this.isDefaultLabelNode(top)})}adornmentForwardingSlots(){const names=["start","prefix","end","suffix"];return Array.from(this.querySelectorAll("slot")).filter(slot=>{let top=slot;for(;top.parentNode&&top.parentNode!==this;)top=top.parentNode;return top===slot&&top.parentNode===this&&names.includes(slot.getAttribute("slot")??"")})}observeLabelNode(node){if(this.labelObserver){if(node.nodeType===3){this.labelObserver.observe(node,{characterData:!0});return}node.nodeType===1&&this.labelObserver.observe(node,{attributes:!0,attributeFilter:["aria-hidden","aria-label","class","hidden","inert","slot","style"],childList:!0,characterData:!0,subtree:!0})}}bindLabelObserverTargets(){if(this.labelObserver){this.labelObserver.disconnect(),this.observeLabelNode(this);for(const slot of this.labelForwardingSlots())if(slot.assignedNodes().length!==0)for(const assigned of slot.assignedNodes({flatten:!0}))this.observeLabelNode(assigned);for(const slot of this.adornmentForwardingSlots())if(slot.assignedNodes().length!==0)for(const assigned of slot.assignedNodes({flatten:!0}))this.observeLabelNode(assigned)}}recomputeHasLabel(){const slot=this.renderRoot.querySelector("slot:not([name])"),nodes=slot?slot.assignedNodes({flatten:!0}):Array.from(this.childNodes??[]).filter(node=>this.isDefaultLabelNode(node)).flatMap(node=>{if(node.nodeType!==1||node.localName!=="slot")return[node];const forwardingSlot=node;return forwardingSlot.assignedNodes().length>0?forwardingSlot.assignedNodes({flatten:!0}):Array.from(forwardingSlot.childNodes)});this.hasLabel=hasRealContent(nodes)}assignedAdornmentNodes(names){const slots=names.map(name=>this.renderRoot.querySelector(`slot[name="${name}"]`)).filter(slot=>!!slot);if(slots.length>0)return slots.flatMap(slot=>slot.assignedNodes({flatten:!0}));const children=this.children;return(children?Array.from(children):[]).filter(element=>names.includes(element.getAttribute("slot")??"")).flatMap(element=>{if(element.localName!=="slot")return[element];const forwardingSlot=element;return forwardingSlot.assignedNodes().length>0?forwardingSlot.assignedNodes({flatten:!0}):Array.from(forwardingSlot.childNodes)})}recomputeButtonAdornments(){this.hasStart=hasRealContent(this.assignedAdornmentNodes(["start","prefix"])),this.hasEnd=hasRealContent(this.assignedAdornmentNodes(["end","suffix"]))}handleLabelSlotChange(event){const target=event.target;target?.nodeType!==1||target.localName!=="slot"||target.getRootNode()!==this.renderRoot&&!this.labelForwardingSlots().includes(target)||(this.bindLabelObserverTargets(),this.recomputeHasLabel())}renderButtonContent(){return html`
2
2
  <span part="start prefix" ?hidden=${!this.hasStart}>
3
3
  <slot name="start" @slotchange=${this.onAdornmentSlotChange}></slot>
4
4
  <slot name="prefix" @slotchange=${this.onAdornmentSlotChange}></slot>
@@ -23,6 +23,8 @@ export type RubricKey=ScoreRubricKey|CategoryRubricKey|CommentRubricKey;export t
23
23
  * supplied default records its rendered, snapped midpoint in both the default and live value;
24
24
  * segmented scores remain unselected. `defaultValue` is the explicit reset baseline; reads return
25
25
  * defensive snapshots.
26
+ * Replacing the parent value reconciles live multiple-category checkbox state, even immediately
27
+ * after a user edit, without changing child reset defaults or emitting user-edit events.
26
28
  *
27
29
  * Optional native `<form>` participation is implemented via `ElementInternals`
28
30
  * attached directly (this component's value is a whole object, not a plain
@@ -37,6 +39,10 @@ export type RubricKey=ScoreRubricKey|CategoryRubricKey|CommentRubricKey;export t
37
39
  * presence (including an explicitly empty value), while each rubric field keeps its own
38
40
  * field-level name. When `errorText` is empty, a consumer `setCustomValidity()` message is rendered
39
41
  * in the aggregate error region so a blocking whole-form error is never silent.
42
+ * Host-root external descriptions precede the aggregate hint/error guidance and follow live source
43
+ * identity changes, reconnection and adoption. They stay on the aggregate group; child fields keep
44
+ * their own guidance. Removing label or hint safely removes that copy while retaining native
45
+ * attribute-removal property readback.
40
46
  *
41
47
  * @customElement lr-rubric-form
42
48
  * @slot label - Aggregate rubric label rendered before all fields.
@@ -184,4 +190,4 @@ reportValidity():boolean;
184
190
  setCustomValidity(message:string):void;formResetCallback():void;formStateRestoreCallback(state:string|File|FormData|null,_mode?:'restore'|'autocomplete'):void;formDisabledCallback(disabled:boolean):void;private onFormKeyDown;private setFieldValue;private stopChildEvent;private onAggregateSlotChange;private markTouched;private submit;private skip;private focusFirstControl;
185
191
  /** Forwards host clicks to the first rendered field, so programmatic and `<label>`-driven
186
192
  * interactions target the active rubric field. */
187
- click():void;protected updated(changed:PropertyValues):void;private renderScoreControl;private renderCategoryControl;private renderCommentControl;private renderField;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-rubric-form':LyraRubricForm;}}export{};
193
+ click():void;private externalDescriptionLease?;private syncExternalDescription;private releaseExternalDescription;connectedCallback():void;disconnectedCallback():void;adoptedCallback():void;protected updated(changed:PropertyValues):void;private renderScoreControl;private renderCategoryControl;private renderCommentControl;private renderField;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-rubric-form':LyraRubricForm;}}export{};
@@ -1,4 +1,4 @@
1
- var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{repeat}from"lit/directives/repeat.js";import{LyraElement}from"../../../internal/lyra-element.js";import{installFormControlLabelSupport}from"../../../internal/form-control-labels.js";installFormControlLabelSupport();import{nextId}from"../../../internal/a11y.js";import{AnchoredValidityController,VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{syncValidityStates}from"../../../internal/custom-states.js";import{styles}from"./rubric-form.styles.js";import"../../layout/segmented/segmented.class.js";import"../slider/slider.class.js";import"../select/select.class.js";import"../combobox/option.class.js";import"../checkbox/checkbox.class.js";import"../checkbox-group/checkbox-group.class.js";import"../textarea/textarea.class.js";import{getFormOwner,installCustomErrorProperty,isBarredFromValidation,setFormOwner}from"../../../internal/form-associated.js";import{installInvalidEventAlias}from"../../../internal/invalid-event-alias.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_noData,LYRA_DEFAULT_rubricSkip,LYRA_DEFAULT_rubricSubmit,LYRA_DEFAULT_rubricSubmitAndNext,LYRA_DEFAULT_unsupportedFieldType}from"../../../internal/default-strings.generated.js";const EMPTY_KEYS=[],EMPTY_VALUE={};function cloneRubricValue(value){return Object.freeze(Object.fromEntries(Object.entries(value).map(([key,entry])=>[key,Array.isArray(entry)?Object.freeze([...entry]):entry])))}function normalizeRubricKeys(next){if(!Array.isArray(next))return[];const seen=new Set,normalized=[];for(const candidate of next){if(candidate===null||typeof candidate!="object"||Array.isArray(candidate))continue;const raw=candidate,key=typeof raw.key=="string"?raw.key:"";if(key.trim().length===0||seen.has(key))continue;seen.add(key);const common={key,...typeof raw.label=="string"?{label:raw.label}:{},...typeof raw.description=="string"?{description:raw.description}:{},...typeof raw.required=="boolean"?{required:raw.required}:{}};if(raw.type==="score")normalized.push({...common,type:"score",...typeof raw.min=="number"?{min:raw.min}:{},...typeof raw.max=="number"?{max:raw.max}:{},...typeof raw.step=="number"?{step:raw.step}:{}});else if(raw.type==="category"){const options=Array.isArray(raw.options)?raw.options.flatMap(option=>{if(option===null||typeof option!="object"||Array.isArray(option))return[];const entry=option;return typeof entry.value!="string"?[]:[{value:entry.value,...typeof entry.label=="string"?{label:entry.label}:{},...typeof entry.description=="string"?{description:entry.description}:{}}]}):[];normalized.push({...common,type:"category",options,...typeof raw.multiple=="boolean"?{multiple:raw.multiple}:{}})}else raw.type==="comment"?normalized.push({...common,type:"comment",...typeof raw.placeholder=="string"?{placeholder:raw.placeholder}:{}}):normalized.push({...common,type:String(raw.type??"")})}return normalized}function scoreDomain(key){const min=Number.isFinite(key.min)?key.min:0,rawMax=Number.isFinite(key.max)?key.max:5,max=Math.max(min,rawMax),step=Number.isFinite(key.step)&&key.step>0?key.step:1;return{min,max,step}}function isSegmentedScoreKey(key){if(key.step!==void 0&&(!Number.isFinite(key.step)||key.step<=0)||Number.isFinite(key.min)&&Number.isFinite(key.max)&&key.max<key.min)return!1;const{min,max,step}=scoreDomain(key);if(!Number.isInteger(min)||!Number.isInteger(max)||!Number.isInteger(step))return!1;const count=(max-min)/step;return Number.isInteger(count)&&count>=0&&count<=10}function canonicalScore(value,key){if(typeof value!="number"||!Number.isFinite(value))return;const{min,max,step}=scoreDomain(key),clamped=Math.min(max,Math.max(min,value)),snapped=Math.min(max,Math.max(min,min+Math.round((clamped-min)/step)*step));return Number(snapped.toPrecision(15))}function normalizeRubricValue(value,keys){const source=value!==null&&typeof value=="object"&&!Array.isArray(value)?value:EMPTY_VALUE,normalized={};for(const key of keys){let entry,hasEntry=!1;try{hasEntry=Object.prototype.hasOwnProperty.call(source,key.key),hasEntry&&(entry=source[key.key])}catch{continue}if(key.type==="score"){const{min,max}=scoreDomain(key),score=canonicalScore(hasEntry?entry:isSegmentedScoreKey(key)?void 0:min+(max-min)/2,key);score!==void 0&&(normalized[key.key]=score)}else if(key.type==="category"){if(!hasEntry)continue;const allowed=(key.options??[]).map(option=>option.value);if(key.multiple){if(!Array.isArray(entry))continue;const remaining=new Map;for(const option of allowed)remaining.set(option,(remaining.get(option)??0)+1);const selected=[];for(const candidate of entry){if(typeof candidate!="string")continue;const count=remaining.get(candidate)??0;count<=0||(selected.push(candidate),remaining.set(candidate,count-1))}normalized[key.key]=selected}else typeof entry=="string"&&entry!==""&&allowed.includes(entry)&&(normalized[key.key]=entry)}else key.type==="comment"&&hasEntry&&typeof entry=="string"&&(normalized[key.key]=entry)}return normalized}class LyraRubricForm extends LyraElement{static{this.defaultStrings={...super.defaultStrings,fieldRequired:LYRA_DEFAULT_fieldRequired,noData:LYRA_DEFAULT_noData,rubricSkip:LYRA_DEFAULT_rubricSkip,rubricSubmit:LYRA_DEFAULT_rubricSubmit,rubricSubmitAndNext:LYRA_DEFAULT_rubricSubmitAndNext,unsupportedFieldType:LYRA_DEFAULT_unsupportedFieldType}}static{this.formAssociated=!0}static{this.styles=[LyraElement.styles,styles]}static{this.properties={customError:{attribute:"custom-error",reflect:!0,noAccessor:!0},name:{reflect:!0,noAccessor:!0},keys:{attribute:!1,noAccessor:!0},value:{attribute:!1,noAccessor:!0},defaultValue:{attribute:!1,noAccessor:!0},itemId:{attribute:"item-id",reflect:!0,noAccessor:!0},hasNext:{type:Boolean,attribute:"has-next",noAccessor:!0},skippable:{type:Boolean,noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0}}}constructor(){super(),this.label="",this.hint="",this.errorText="",this.withLabel=!1,this.withHint=!1,this._errors={},this.touchedFields=new Set,this.hasLabelSlot=!1,this.hasHintSlot=!1,this.hasErrorSlot=!1,this.baseId=nextId("rubric-form"),this.aggregateLabelId=`${this.baseId}-label`,this.aggregateHintId=`${this.baseId}-hint`,this.aggregateErrorId=`${this.baseId}-error`,this._fieldsetDisabled=!1,this._name="",this._keys=EMPTY_KEYS,this._value=EMPTY_VALUE,this._defaultValue=EMPTY_VALUE,this._valueDirty=!1,this._itemId="",this._hasNext=!1,this._skippable=!1,this._disabled=!1,this.pendingFocusFirst=!1,this.onFormKeyDown=e=>{e.key==="Enter"&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.submit())},this.stopChildEvent=event=>{event.stopPropagation()},this.onAggregateSlotChange=event=>{const slot=event.target,populated=slot.assignedNodes({flatten:!0}).some(node=>node.nodeType===Node.ELEMENT_NODE||!!node.textContent?.trim());slot.name==="label"?this.hasLabelSlot=populated:slot.name==="hint"?this.hasHintSlot=populated:slot.name==="error"&&(this.hasErrorSlot=populated)},this.internals=this.safeAttachInternals(),this.validityController=new AnchoredValidityController(this,this.internals,()=>this[VALIDITY_ANCHOR]()),installCustomErrorProperty(this,()=>this.validityController.customValidityMessage),installInvalidEventAlias(this,init=>this.emit("lr-invalid",null,init)),this.addEventListener("keydown",this.onFormKeyDown),this.syncFormState()}safeAttachInternals(){if(typeof globalThis.ElementInternals>"u")return this.inertInternals();try{return this.attachInternals()}catch{return this.inertInternals()}}inertInternals(){return{form:null,labels:[],validity:{},validationMessage:"",willValidate:!1,setFormValue:()=>{},setValidity:()=>{},checkValidity:()=>!0,reportValidity:()=>!0,states:new Set}}get form(){return getFormOwner(this.internals)}set form(owner){setFormOwner(this,owner)}getForm(){return getFormOwner(this.internals)}get labels(){return this.internals.labels}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}get willValidate(){return this.internals.willValidate}get keys(){return this._keys}set keys(next){const old=this._keys;this._keys=normalizeRubricKeys(next??EMPTY_KEYS);const oldDefault=this._defaultValue,oldValue=this._value;this._defaultValue=normalizeRubricValue(this._defaultValue,this._keys),this._value=this._valueDirty?normalizeRubricValue(this._value,this._keys):cloneRubricValue(this._defaultValue),this.syncFormState(),this.requestUpdate("keys",old),this.requestUpdate("defaultValue",oldDefault),this.requestUpdate("value",oldValue)}get value(){return cloneRubricValue(this._value)}set value(next){this.setLiveValue(next,!0)}get defaultValue(){return cloneRubricValue(this._defaultValue)}set defaultValue(next){const old=this._defaultValue;this._defaultValue=normalizeRubricValue(next??EMPTY_VALUE,this._keys),this._valueDirty||this.setLiveValue(this._defaultValue,!1),this.requestUpdate("defaultValue",old)}setLiveValue(next,dirty){const old=this._value;this._value=normalizeRubricValue(next??EMPTY_VALUE,this._keys),this._valueDirty=dirty,this.syncFormState(),this.requestUpdate("value",old)}get itemId(){return this._itemId}set itemId(next){const old=this._itemId;this._itemId=next??"",old!==this._itemId&&(this.touchedFields=new Set,this.syncCustomStates(),this.hasUpdated&&(this.pendingFocusFirst=!0)),this._itemId?this.setAttribute("item-id",this._itemId):this.removeAttribute("item-id"),this.requestUpdate("itemId",old)}get hasNext(){return this._hasNext}set hasNext(next){const old=this._hasNext;this._hasNext=!!next,this.toggleAttribute("has-next",this._hasNext),this.requestUpdate("hasNext",old)}get skippable(){return this._skippable}set skippable(next){const old=this._skippable;this._skippable=!!next,this.requestUpdate("skippable",old)}get name(){return this._name}set name(next){const old=this._name;this._name=next??"",this._name?this.setAttribute("name",this._name):this.removeAttribute("name"),this.requestUpdate("name",old)}get disabled(){return this._disabled}set disabled(next){const old=this._disabled;this._disabled=!!next,this.toggleAttribute("disabled",this._disabled),this.validityController&&this.syncFormState(),this.requestUpdate("disabled",old)}get effectiveDisabled(){return this.disabled||this._fieldsetDisabled}get errors(){return this.publicValidityErrors()}publicValidityErrors(){const errors={...this._errors};return this.willValidate&&this.validityController.customValidityMessage&&(errors.base=this.validationMessage),Object.freeze(errors)}publishValiditySnapshot(){if(!this.isConnected)return;const valid=!this.willValidate||this.validity.valid,errors=valid?Object.freeze({}):this.publicValidityErrors(),key=JSON.stringify({valid,errors});key!==this.lastValidityKey&&(this.lastValidityKey=key,this.emit("lr-validity-change",Object.freeze({valid,errors})))}fieldElement(key){const root=this.renderRoot,ownerCss=this.ownerDocument.defaultView?.CSS;if(typeof ownerCss?.escape=="function")try{const candidate=root.querySelector(`[part="field"][data-key="${ownerCss.escape(key)}"]`);if(candidate?.getAttribute("data-key")===key)return candidate}catch{}return Array.from(root.querySelectorAll('[part="field"][data-key]')).find(candidate=>candidate.getAttribute("data-key")===key)??null}[VALIDITY_ANCHOR](){const firstInvalidKey=Object.keys(this._errors)[0];return!firstInvalidKey||!this.renderRoot?void 0:this.fieldElement(firstInvalidKey)?.querySelector(".control")??void 0}isSegmentedScore(k){return isSegmentedScoreKey(k)}scoreValues(k){if(!this.isSegmentedScore(k))return[];const{min,max,step}=scoreDomain(k),count=Math.round((max-min)/step);return Array.from({length:count+1},(_,index)=>index===count?max:min+index*step)}computeValidation(){const errors={},flags={};for(const k of this._keys){if(k.type!=="score"&&k.type!=="category"&&k.type!=="comment"){const unsupported=k;errors[unsupported.key]=this.localize("unsupportedFieldType",void 0,{type:unsupported.type}),flags.customError=!0;continue}if(!k.required)continue;const v=this._value[k.key];(k.type==="category"&&k.multiple?Array.isArray(v)&&v.length>0:v!==void 0&&v!=="")||(errors[k.key]=this.localize("fieldRequired"),flags.valueMissing=!0)}return{errors,flags}}syncFormState(){const{errors,flags}=this.computeValidation();this._errors=errors;let formValue=null;try{formValue=JSON.stringify(this._value)}catch{formValue=null}if(this.internals.setFormValue(formValue,formValue),this.barredFromValidation||Object.keys(flags).length===0)this.validityController.setValidity({});else{const message=Object.values(errors)[0]??"";this.validityController.setValidity(flags,message)}this.syncCustomStates(),this.publishValiditySnapshot()}get barredFromValidation(){return isBarredFromValidation(this,this.internals)}syncCustomStates(){syncValidityStates(this.internals,{required:this._keys.some(key=>!!key.required),hasInteracted:this.touchedFields.size>0,barred:this.barredFromValidation})}checkValidity(){return this.syncFormState(),this.internals.checkValidity()}reportValidity(){return this.syncFormState(),Object.keys(this._errors).length>0&&(this.touchedFields=new Set([...this.touchedFields,...Object.keys(this._errors)]),this.syncCustomStates()),this.internals.reportValidity()}setCustomValidity(message){this.validityController.setCustomValidity(message??""),this.syncCustomStates(),this.publishValiditySnapshot(),this.requestUpdate()}formResetCallback(){this.setLiveValue(this._defaultValue,!1),this.touchedFields=new Set,this.syncCustomStates()}formStateRestoreCallback(state2,_mode){let restored={};if(typeof state2=="string")try{const parsed=JSON.parse(state2);parsed!==null&&typeof parsed=="object"&&!Array.isArray(parsed)&&(restored=parsed)}catch{}this.setLiveValue(restored,!0)}formDisabledCallback(disabled){this._fieldsetDisabled=disabled,this.syncFormState(),this.requestUpdate()}setFieldValue(key,val){this.effectiveDisabled||(this.value={...this._value,[key]:val},this.emit("lr-input",Object.freeze({value:cloneRubricValue(this._value)})))}markTouched(key){this.effectiveDisabled||this.touchedFields.has(key)||(this.touchedFields=new Set(this.touchedFields).add(key),this.syncCustomStates())}submit(){this.effectiveDisabled||this.reportValidity()&&this.emit("lr-submit",Object.freeze({value:cloneRubricValue(this._value),itemId:this.itemId}))}skip(){this.effectiveDisabled||this.emit("lr-skip",{itemId:this.itemId})}focusFirstControl(){const firstKey=this._keys[0];if(!firstKey)return;const control=this.fieldElement(firstKey.key)?.querySelector(".control");control&&(firstKey.type==="score"&&this.isSegmentedScore(firstKey)?control.shadowRoot?.querySelector('[part="segment"][tabindex="0"]')?.focus():firstKey.type==="score"?control.shadowRoot?.querySelector('[part="thumb"]')?.focus():firstKey.type==="category"&&firstKey.multiple?control.querySelector("lr-checkbox")?.focus():control.focus())}click(){this.effectiveDisabled||this.focusFirstControl()}updated(changed){super.updated(changed),this.publishValiditySnapshot(),this.pendingFocusFirst&&(this.pendingFocusFirst=!1,this.focusFirstControl())}renderScoreControl(k,fieldId,current,hasError){const{min,max,step}=scoreDomain(k),disabled=this.effectiveDisabled,accessibleLabel=[k.label??k.key,k.description,hasError?this._errors[k.key]:void 0].filter(value=>!!value).join(". ");if(this.isSegmentedScore(k)){const numberFormat=getNumberFormat(this.effectiveLocale,{maximumFractionDigits:20}),items=this.scoreValues(k).map(score=>({value:String(score),label:numberFormat.format(score),disabled})),value=typeof current=="number"?String(current):"";return html`<lr-segmented
1
+ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{repeat}from"lit/directives/repeat.js";import{live}from"lit/directives/live.js";import{LyraElement}from"../../../internal/lyra-element.js";import{installFormControlLabelSupport}from"../../../internal/form-control-labels.js";installFormControlLabelSupport();import{nextId}from"../../../internal/a11y.js";import{acquireResolvedAriaRelationship}from"../../../internal/aria-controls.js";import{AnchoredValidityController,VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{syncValidityStates}from"../../../internal/custom-states.js";import{styles}from"./rubric-form.styles.js";import"../../layout/segmented/segmented.class.js";import"../slider/slider.class.js";import"../select/select.class.js";import"../combobox/option.class.js";import"../checkbox/checkbox.class.js";import"../checkbox-group/checkbox-group.class.js";import"../textarea/textarea.class.js";import{getFormOwner,installCustomErrorProperty,isBarredFromValidation,setFormOwner}from"../../../internal/form-associated.js";import{installInvalidEventAlias}from"../../../internal/invalid-event-alias.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{getOwnDataDescriptor,MISSING_OWN_DATA_DESCRIPTOR,UNSAFE_OWN_DATA_DESCRIPTOR}from"../../../internal/data-descriptors.js";import{LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_noData,LYRA_DEFAULT_rubricSkip,LYRA_DEFAULT_rubricSubmit,LYRA_DEFAULT_rubricSubmitAndNext,LYRA_DEFAULT_unsupportedFieldType}from"../../../internal/default-strings.generated.js";const EMPTY_KEYS=[],EMPTY_VALUE={},MAX_RUBRIC_COLLECTION_ENTRIES=1e4;function cloneRubricValue(value){return Object.freeze(Object.fromEntries(Object.entries(value).map(([key,entry])=>[key,Array.isArray(entry)?Object.freeze([...entry]):entry])))}function projectRubricStringArray(value){try{if(!Array.isArray(value))return;const length=getOwnDataDescriptor(value,"length");if(length===MISSING_OWN_DATA_DESCRIPTOR||length===UNSAFE_OWN_DATA_DESCRIPTOR||typeof length.value!="number"||!Number.isSafeInteger(length.value)||length.value<0)return;const values=[];for(let index=0;index<Math.min(length.value,MAX_RUBRIC_COLLECTION_ENTRIES);index+=1){const entry=getOwnDataDescriptor(value,String(index));entry===MISSING_OWN_DATA_DESCRIPTOR||entry===UNSAFE_OWN_DATA_DESCRIPTOR||typeof entry.value=="string"&&values.push(entry.value)}return Object.freeze(values)}catch{return}}function projectRubricOptions(value){try{if(!Array.isArray(value))return Object.freeze([]);const length=getOwnDataDescriptor(value,"length");if(length===MISSING_OWN_DATA_DESCRIPTOR||length===UNSAFE_OWN_DATA_DESCRIPTOR||typeof length.value!="number"||!Number.isSafeInteger(length.value)||length.value<0)return Object.freeze([]);const options=[];for(let index=0;index<Math.min(length.value,MAX_RUBRIC_COLLECTION_ENTRIES);index+=1){const candidate=getOwnDataDescriptor(value,String(index));if(candidate===MISSING_OWN_DATA_DESCRIPTOR||candidate===UNSAFE_OWN_DATA_DESCRIPTOR||candidate.value===null||typeof candidate.value!="object"||Array.isArray(candidate.value))continue;const optionValue=getOwnDataDescriptor(candidate.value,"value"),label=getOwnDataDescriptor(candidate.value,"label"),description=getOwnDataDescriptor(candidate.value,"description");if(optionValue===MISSING_OWN_DATA_DESCRIPTOR||optionValue===UNSAFE_OWN_DATA_DESCRIPTOR||typeof optionValue.value!="string")continue;const labelValue=label===MISSING_OWN_DATA_DESCRIPTOR||label===UNSAFE_OWN_DATA_DESCRIPTOR?void 0:typeof label.value=="string"?label.value:void 0,descriptionValue=description===MISSING_OWN_DATA_DESCRIPTOR||description===UNSAFE_OWN_DATA_DESCRIPTOR?void 0:typeof description.value=="string"?description.value:void 0;options.push(Object.freeze({value:optionValue.value,...labelValue===void 0?{}:{label:labelValue},...descriptionValue===void 0?{}:{description:descriptionValue}}))}return Object.freeze(options)}catch{return Object.freeze([])}}function projectRubricKey(candidate){try{if(candidate===null||typeof candidate!="object"||Array.isArray(candidate))return;const key=getOwnDataDescriptor(candidate,"key"),type=getOwnDataDescriptor(candidate,"type"),label=getOwnDataDescriptor(candidate,"label"),description=getOwnDataDescriptor(candidate,"description"),required=getOwnDataDescriptor(candidate,"required");if(key===MISSING_OWN_DATA_DESCRIPTOR||key===UNSAFE_OWN_DATA_DESCRIPTOR||type===UNSAFE_OWN_DATA_DESCRIPTOR||label===UNSAFE_OWN_DATA_DESCRIPTOR||description===UNSAFE_OWN_DATA_DESCRIPTOR||required===UNSAFE_OWN_DATA_DESCRIPTOR||typeof key.value!="string"||key.value.trim().length===0)return;const typeValue=type===MISSING_OWN_DATA_DESCRIPTOR?"":type.value;if(typeof typeValue!="string")return;const labelValue=label===MISSING_OWN_DATA_DESCRIPTOR?void 0:label.value,descriptionValue=description===MISSING_OWN_DATA_DESCRIPTOR?void 0:description.value,requiredValue=required===MISSING_OWN_DATA_DESCRIPTOR?void 0:required.value,common={key:key.value,...typeof labelValue=="string"?{label:labelValue}:{},...typeof descriptionValue=="string"?{description:descriptionValue}:{},...typeof requiredValue=="boolean"?{required:requiredValue}:{}};if(typeValue==="score"){const min=getOwnDataDescriptor(candidate,"min"),max=getOwnDataDescriptor(candidate,"max"),step=getOwnDataDescriptor(candidate,"step");return min===UNSAFE_OWN_DATA_DESCRIPTOR||max===UNSAFE_OWN_DATA_DESCRIPTOR||step===UNSAFE_OWN_DATA_DESCRIPTOR?void 0:Object.freeze({...common,type:"score",...min!==MISSING_OWN_DATA_DESCRIPTOR&&typeof min.value=="number"?{min:min.value}:{},...max!==MISSING_OWN_DATA_DESCRIPTOR&&typeof max.value=="number"?{max:max.value}:{},...step!==MISSING_OWN_DATA_DESCRIPTOR&&typeof step.value=="number"?{step:step.value}:{}})}if(typeValue==="category"){const options=getOwnDataDescriptor(candidate,"options"),multiple=getOwnDataDescriptor(candidate,"multiple");return options===UNSAFE_OWN_DATA_DESCRIPTOR||multiple===UNSAFE_OWN_DATA_DESCRIPTOR?void 0:Object.freeze({...common,type:"category",options:options===MISSING_OWN_DATA_DESCRIPTOR?Object.freeze([]):projectRubricOptions(options.value),...multiple!==MISSING_OWN_DATA_DESCRIPTOR&&typeof multiple.value=="boolean"?{multiple:multiple.value}:{}})}if(typeValue==="comment"){const placeholder=getOwnDataDescriptor(candidate,"placeholder");return placeholder===UNSAFE_OWN_DATA_DESCRIPTOR?void 0:Object.freeze({...common,type:"comment",...placeholder!==MISSING_OWN_DATA_DESCRIPTOR&&typeof placeholder.value=="string"?{placeholder:placeholder.value}:{}})}return Object.freeze({...common,type:typeValue})}catch{return}}function normalizeRubricKeys(next){try{if(!Array.isArray(next))return EMPTY_KEYS;const length=getOwnDataDescriptor(next,"length");if(length===MISSING_OWN_DATA_DESCRIPTOR||length===UNSAFE_OWN_DATA_DESCRIPTOR||typeof length.value!="number"||!Number.isSafeInteger(length.value)||length.value<0)return EMPTY_KEYS;const seen=new Set,normalized=[];for(let index=0;index<Math.min(length.value,MAX_RUBRIC_COLLECTION_ENTRIES);index+=1){const candidate=getOwnDataDescriptor(next,String(index));if(candidate===MISSING_OWN_DATA_DESCRIPTOR||candidate===UNSAFE_OWN_DATA_DESCRIPTOR)continue;const key=projectRubricKey(candidate.value);!key||seen.has(key.key)||(seen.add(key.key),normalized.push(key))}return Object.freeze(normalized)}catch{return EMPTY_KEYS}}function scoreDomain(key){const min=Number.isFinite(key.min)?key.min:0,rawMax=Number.isFinite(key.max)?key.max:5,max=Math.max(min,rawMax),step=Number.isFinite(key.step)&&key.step>0?key.step:1;return{min,max,step}}function isSegmentedScoreKey(key){if(key.step!==void 0&&(!Number.isFinite(key.step)||key.step<=0)||Number.isFinite(key.min)&&Number.isFinite(key.max)&&key.max<key.min)return!1;const{min,max,step}=scoreDomain(key);if(!Number.isInteger(min)||!Number.isInteger(max)||!Number.isInteger(step))return!1;const count=(max-min)/step;return Number.isInteger(count)&&count>=0&&count<=10}function canonicalScore(value,key){if(typeof value!="number"||!Number.isFinite(value))return;const{min,max,step}=scoreDomain(key),clamped=Math.min(max,Math.max(min,value)),snapped=Math.min(max,Math.max(min,min+Math.round((clamped-min)/step)*step));return Number(snapped.toPrecision(15))}function normalizeRubricValue(value,keys){const source=value!==null&&typeof value=="object"&&!Array.isArray(value)?value:EMPTY_VALUE,normalized={};for(const key of keys){const descriptor=getOwnDataDescriptor(source,key.key);if(descriptor===UNSAFE_OWN_DATA_DESCRIPTOR)continue;const hasEntry=descriptor!==MISSING_OWN_DATA_DESCRIPTOR,entry=descriptor===MISSING_OWN_DATA_DESCRIPTOR?void 0:descriptor.value;if(key.type==="score"){const{min,max}=scoreDomain(key),score=canonicalScore(hasEntry?entry:isSegmentedScoreKey(key)?void 0:min+(max-min)/2,key);score!==void 0&&(normalized[key.key]=score)}else if(key.type==="category"){if(!hasEntry)continue;const allowed=(key.options??[]).map(option=>option.value);if(key.multiple){const entries=projectRubricStringArray(entry);if(!entries)continue;const remaining=new Map;for(const option of allowed)remaining.set(option,(remaining.get(option)??0)+1);const selected=[];for(const candidate of entries){const count=remaining.get(candidate)??0;count<=0||(selected.push(candidate),remaining.set(candidate,count-1))}normalized[key.key]=selected}else typeof entry=="string"&&entry!==""&&allowed.includes(entry)&&(normalized[key.key]=entry)}else key.type==="comment"&&hasEntry&&typeof entry=="string"&&(normalized[key.key]=entry)}return normalized}class LyraRubricForm extends LyraElement{static{this.defaultStrings={...super.defaultStrings,fieldRequired:LYRA_DEFAULT_fieldRequired,noData:LYRA_DEFAULT_noData,rubricSkip:LYRA_DEFAULT_rubricSkip,rubricSubmit:LYRA_DEFAULT_rubricSubmit,rubricSubmitAndNext:LYRA_DEFAULT_rubricSubmitAndNext,unsupportedFieldType:LYRA_DEFAULT_unsupportedFieldType}}static{this.formAssociated=!0}static{this.styles=[LyraElement.styles,styles]}static{this.properties={customError:{attribute:"custom-error",reflect:!0,noAccessor:!0},name:{reflect:!0,noAccessor:!0},keys:{attribute:!1,noAccessor:!0},value:{attribute:!1,noAccessor:!0},defaultValue:{attribute:!1,noAccessor:!0},itemId:{attribute:"item-id",reflect:!0,noAccessor:!0},hasNext:{type:Boolean,attribute:"has-next",noAccessor:!0},skippable:{type:Boolean,noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0}}}constructor(){super(),this.label="",this.hint="",this.errorText="",this.withLabel=!1,this.withHint=!1,this._errors={},this.touchedFields=new Set,this.hasLabelSlot=!1,this.hasHintSlot=!1,this.hasErrorSlot=!1,this.baseId=nextId("rubric-form"),this.aggregateLabelId=`${this.baseId}-label`,this.aggregateHintId=`${this.baseId}-hint`,this.aggregateErrorId=`${this.baseId}-error`,this._fieldsetDisabled=!1,this._name="",this._keys=EMPTY_KEYS,this._value=EMPTY_VALUE,this._defaultValue=EMPTY_VALUE,this._valueDirty=!1,this._itemId="",this._hasNext=!1,this._skippable=!1,this._disabled=!1,this.pendingFocusFirst=!1,this.onFormKeyDown=e=>{e.key==="Enter"&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.submit())},this.stopChildEvent=event=>{event.stopPropagation()},this.onAggregateSlotChange=event=>{const slot=event.target,populated=slot.assignedNodes({flatten:!0}).some(node=>node.nodeType===Node.ELEMENT_NODE||!!node.textContent?.trim());slot.name==="label"?this.hasLabelSlot=populated:slot.name==="hint"?this.hasHintSlot=populated:slot.name==="error"&&(this.hasErrorSlot=populated)},this.internals=this.safeAttachInternals(),this.validityController=new AnchoredValidityController(this,this.internals,()=>this[VALIDITY_ANCHOR]()),installCustomErrorProperty(this,()=>this.validityController.customValidityMessage),installInvalidEventAlias(this,init=>this.emit("lr-invalid",null,init)),this.addEventListener("keydown",this.onFormKeyDown),this.syncFormState()}safeAttachInternals(){if(typeof globalThis.ElementInternals>"u")return this.inertInternals();try{return this.attachInternals()}catch{return this.inertInternals()}}inertInternals(){return{form:null,labels:[],validity:{},validationMessage:"",willValidate:!1,setFormValue:()=>{},setValidity:()=>{},checkValidity:()=>!0,reportValidity:()=>!0,states:new Set}}get form(){return getFormOwner(this.internals)}set form(owner){setFormOwner(this,owner)}getForm(){return getFormOwner(this.internals)}get labels(){return this.internals.labels}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}get willValidate(){return this.internals.willValidate}get keys(){return this._keys}set keys(next){const old=this._keys;this._keys=normalizeRubricKeys(next??EMPTY_KEYS);const oldDefault=this._defaultValue,oldValue=this._value;this._defaultValue=normalizeRubricValue(this._defaultValue,this._keys),this._value=this._valueDirty?normalizeRubricValue(this._value,this._keys):cloneRubricValue(this._defaultValue),this.syncFormState(),this.requestUpdate("keys",old),this.requestUpdate("defaultValue",oldDefault),this.requestUpdate("value",oldValue)}get value(){return cloneRubricValue(this._value)}set value(next){this.setLiveValue(next,!0)}get defaultValue(){return cloneRubricValue(this._defaultValue)}set defaultValue(next){const old=this._defaultValue;this._defaultValue=normalizeRubricValue(next??EMPTY_VALUE,this._keys),this._valueDirty||this.setLiveValue(this._defaultValue,!1),this.requestUpdate("defaultValue",old)}setLiveValue(next,dirty){const old=this._value;this._value=normalizeRubricValue(next??EMPTY_VALUE,this._keys),this._valueDirty=dirty,this.syncFormState(),this.requestUpdate("value",old)}get itemId(){return this._itemId}set itemId(next){const old=this._itemId;this._itemId=next??"",old!==this._itemId&&(this.touchedFields=new Set,this.syncCustomStates(),this.hasUpdated&&(this.pendingFocusFirst=!0)),this._itemId?this.setAttribute("item-id",this._itemId):this.removeAttribute("item-id"),this.requestUpdate("itemId",old)}get hasNext(){return this._hasNext}set hasNext(next){const old=this._hasNext;this._hasNext=!!next,this.toggleAttribute("has-next",this._hasNext),this.requestUpdate("hasNext",old)}get skippable(){return this._skippable}set skippable(next){const old=this._skippable;this._skippable=!!next,this.requestUpdate("skippable",old)}get name(){return this._name}set name(next){const old=this._name;this._name=next??"",this._name?this.setAttribute("name",this._name):this.removeAttribute("name"),this.requestUpdate("name",old)}get disabled(){return this._disabled}set disabled(next){const old=this._disabled;this._disabled=!!next,this.toggleAttribute("disabled",this._disabled),this.validityController&&this.syncFormState(),this.requestUpdate("disabled",old)}get effectiveDisabled(){return this.disabled||this._fieldsetDisabled}get errors(){return this.publicValidityErrors()}publicValidityErrors(){const errors={...this._errors};return this.willValidate&&this.validityController.customValidityMessage&&(errors.base=this.validationMessage),Object.freeze(errors)}publishValiditySnapshot(){if(!this.isConnected)return;const valid=!this.willValidate||this.validity.valid,errors=valid?Object.freeze({}):this.publicValidityErrors(),key=JSON.stringify({valid,errors});key!==this.lastValidityKey&&(this.lastValidityKey=key,this.emit("lr-validity-change",Object.freeze({valid,errors})))}fieldElement(key){const root=this.renderRoot,ownerCss=this.ownerDocument.defaultView?.CSS;if(typeof ownerCss?.escape=="function")try{const candidate=root.querySelector(`[part="field"][data-key="${ownerCss.escape(key)}"]`);if(candidate?.getAttribute("data-key")===key)return candidate}catch{}return Array.from(root.querySelectorAll('[part="field"][data-key]')).find(candidate=>candidate.getAttribute("data-key")===key)??null}[VALIDITY_ANCHOR](){const firstInvalidKey=Object.keys(this._errors)[0];return!firstInvalidKey||!this.renderRoot?void 0:this.fieldElement(firstInvalidKey)?.querySelector(".control")??void 0}isSegmentedScore(k){return isSegmentedScoreKey(k)}scoreValues(k){if(!this.isSegmentedScore(k))return[];const{min,max,step}=scoreDomain(k),count=Math.round((max-min)/step);return Array.from({length:count+1},(_,index)=>index===count?max:min+index*step)}computeValidation(){const errors={},flags={};for(const k of this._keys){if(k.type!=="score"&&k.type!=="category"&&k.type!=="comment"){const unsupported=k;errors[unsupported.key]=this.localize("unsupportedFieldType",void 0,{type:unsupported.type}),flags.customError=!0;continue}if(!k.required)continue;const v=this._value[k.key];(k.type==="category"&&k.multiple?Array.isArray(v)&&v.length>0:v!==void 0&&v!=="")||(errors[k.key]=this.localize("fieldRequired"),flags.valueMissing=!0)}return{errors,flags}}syncFormState(){const{errors,flags}=this.computeValidation();this._errors=errors;let formValue=null;try{formValue=JSON.stringify(this._value)}catch{formValue=null}if(this.internals.setFormValue(formValue,formValue),this.barredFromValidation||Object.keys(flags).length===0)this.validityController.setValidity({});else{const message=Object.values(errors)[0]??"";this.validityController.setValidity(flags,message)}this.syncCustomStates(),this.publishValiditySnapshot()}get barredFromValidation(){return isBarredFromValidation(this,this.internals)}syncCustomStates(){syncValidityStates(this.internals,{required:this._keys.some(key=>!!key.required),hasInteracted:this.touchedFields.size>0,barred:this.barredFromValidation})}checkValidity(){return this.syncFormState(),this.internals.checkValidity()}reportValidity(){return this.syncFormState(),Object.keys(this._errors).length>0&&(this.touchedFields=new Set([...this.touchedFields,...Object.keys(this._errors)]),this.syncCustomStates()),this.internals.reportValidity()}setCustomValidity(message){this.validityController.setCustomValidity(message??""),this.syncCustomStates(),this.publishValiditySnapshot(),this.requestUpdate()}formResetCallback(){this.setLiveValue(this._defaultValue,!1),this.touchedFields=new Set,this.syncCustomStates()}formStateRestoreCallback(state2,_mode){let restored={};if(typeof state2=="string")try{const parsed=JSON.parse(state2);parsed!==null&&typeof parsed=="object"&&!Array.isArray(parsed)&&(restored=parsed)}catch{}this.setLiveValue(restored,!0)}formDisabledCallback(disabled){this._fieldsetDisabled=disabled,this.syncFormState(),this.requestUpdate()}setFieldValue(key,val){this.effectiveDisabled||(this.value={...this._value,[key]:val},this.emit("lr-input",Object.freeze({value:cloneRubricValue(this._value)})))}markTouched(key){this.effectiveDisabled||this.touchedFields.has(key)||(this.touchedFields=new Set(this.touchedFields).add(key),this.syncCustomStates())}submit(){this.effectiveDisabled||this.reportValidity()&&this.emit("lr-submit",Object.freeze({value:cloneRubricValue(this._value),itemId:this.itemId}))}skip(){this.effectiveDisabled||this.emit("lr-skip",{itemId:this.itemId})}focusFirstControl(){const firstKey=this._keys[0];if(!firstKey)return;const control=this.fieldElement(firstKey.key)?.querySelector(".control");control&&(firstKey.type==="score"&&this.isSegmentedScore(firstKey)?control.shadowRoot?.querySelector('[part="segment"][tabindex="0"]')?.focus():firstKey.type==="score"?control.shadowRoot?.querySelector('[part="thumb"]')?.focus():firstKey.type==="category"&&firstKey.multiple?control.querySelector("lr-checkbox")?.focus():control.focus())}click(){this.effectiveDisabled||this.focusFirstControl()}syncExternalDescription(){const target=this.isConnected?this.renderRoot.querySelector('[part="base"][role="group"]'):null;if(!target){this.releaseExternalDescription();return}this.externalDescriptionLease?this.externalDescriptionLease.update(target):this.externalDescriptionLease=acquireResolvedAriaRelationship(this,target,"aria-describedby")}releaseExternalDescription(){this.externalDescriptionLease?.release(),this.externalDescriptionLease=void 0}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.syncExternalDescription()}disconnectedCallback(){this.releaseExternalDescription(),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.releaseExternalDescription(),this.isConnected&&this.hasUpdated&&this.syncExternalDescription()}updated(changed){super.updated(changed),this.syncExternalDescription(),this.publishValiditySnapshot(),this.pendingFocusFirst&&(this.pendingFocusFirst=!1,this.focusFirstControl())}renderScoreControl(k,fieldId,current,hasError){const{min,max,step}=scoreDomain(k),disabled=this.effectiveDisabled,accessibleLabel=[k.label??k.key,k.description,hasError?this._errors[k.key]:void 0].filter(value=>!!value).join(". ");if(this.isSegmentedScore(k)){const numberFormat=getNumberFormat(this.effectiveLocale,{maximumFractionDigits:20}),items=this.scoreValues(k).map(score=>({value:String(score),label:numberFormat.format(score),disabled})),value=typeof current=="number"?String(current):"";return html`<lr-segmented
2
2
  id=${fieldId}
3
3
  class="control"
4
4
  part="scale"
@@ -36,7 +36,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
36
36
  >
37
37
  <span slot="label" part="label">${label}</span>
38
38
  ${description} ${error}
39
- ${options.map(opt=>html`<lr-checkbox value=${opt.value} ?checked=${selected.includes(opt.value)} ?disabled=${disabled}
39
+ ${options.map(opt=>html`<lr-checkbox value=${opt.value} .checked=${live(selected.includes(opt.value))} ?disabled=${disabled}
40
40
  ><span
41
41
  >${opt.label??opt.value}${opt.description?html`<small class="option-description">${opt.description}</small>`:nothing}</span
42
42
  ></lr-checkbox
@@ -83,7 +83,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
83
83
  ${control} ${k.type==="score"&&k.description?html`<p part="description">${k.description}</p>`:nothing}
84
84
  ${k.type==="score"&&hasError?html`<p part="error" id=${errId}>${this._errors[k.key]}</p>`:nothing}
85
85
  </div>
86
- `}render(){const hasLabel=this.withLabel||this.hasLabelSlot||this.label.length>0,hasHint=this.withHint||this.hasHintSlot||this.hint.length>0,aggregateError=this.errorText||this.customError||"",hasError=this.hasErrorSlot||aggregateError.length>0,hostLabel=this.getAttribute("aria-label"),describedBy=[hasHint?this.aggregateHintId:"",hasError?this.aggregateErrorId:""].filter(Boolean).join(" ");return html`
86
+ `}render(){const hasLabel=this.withLabel||this.hasLabelSlot||(this.label??"").length>0,hasHint=this.withHint||this.hasHintSlot||(this.hint??"").length>0,aggregateError=this.errorText||this.customError||"",hasError=this.hasErrorSlot||aggregateError.length>0,hostLabel=this.getAttribute("aria-label"),describedBy=[hasHint?this.aggregateHintId:"",hasError?this.aggregateErrorId:""].filter(Boolean).join(" ");return html`
87
87
  <div
88
88
  part="base"
89
89
  role="group"
@@ -65,6 +65,12 @@ export type LyraSelectTagRenderer=(option:LyraOption,index:number)=>unknown;expo
65
65
  * nearest available survivor takes over (preferring the following row on a tie); an empty
66
66
  * available collection clears `aria-activedescendant` instead of retaining an invalid index.
67
67
  *
68
+ * Host `aria-describedby` targets supplement internal hint/error guidance on the semantic
69
+ * control, including live target replacement and document adoption. Removing label, hint, or
70
+ * error attributes safely omits their content while retaining native null property readback.
71
+ * Mounted option `selected` writes immediately update the live value and submission silently;
72
+ * reset defaults stay independent, and later default changes preserve a dirty selection.
73
+ *
68
74
  * @customElement lr-select
69
75
  * @slot - `<lr-option>` elements.
70
76
  * @slot label - Custom label content.
@@ -271,7 +277,7 @@ private activeOption?;private options;private touched;
271
277
  private hasInteracted;private readonly slotPresence;private triggerElement?;private internals;private validityController;
272
278
  /** Consumer-supplied validation message reflected through `custom-error`.
273
279
  * @default null */
274
- customError:string|null;private _fieldsetDisabled;private listId;private triggerId;private valueTextId;private cleanup?;private positioningReady;private overlayHandle?;private restoreFocusOnClose;private positionedDirection?;private pointerListenerDocument?;private pointerListener?;private _isFirstUpdate;private openVetoed;private openStateGeneration;private pendingOpenTransitionStart?;private suppressedOpenLifecycleGeneration?;private transitionToken;private transitionWaiters;private _selected;private _selectedOptions;private _multiple;private _disabled;private _required;private _defaultSelected;private _defaultSelectedOptions;private _defaultCaptured;private _valueDirty;private _restoredStateActive;private typeAheadBuffer;private typeAheadTimer?;private typeAheadTimerWindow?;private typeAheadTimerGeneration;
280
+ customError:string|null;private _fieldsetDisabled;private listId;private triggerId;private valueTextId;private cleanup?;private positioningReady;private overlayHandle?;private restoreFocusOnClose;private positionedDirection?;private pointerListenerDocument?;private pointerListener?;private _isFirstUpdate;private openVetoed;private openStateGeneration;private pendingOpenTransitionStart?;private suppressedOpenLifecycleGeneration?;private transitionToken;private transitionWaiters;private _selected;private _selectedOptions;private _selectedValuesByOption;private _multiple;private _disabled;private _required;private _defaultSelected;private _defaultSelectedOptions;private _defaultCaptured;private _valueDirty;private _restoredStateActive;private typeAheadBuffer;private typeAheadTimer?;private typeAheadTimerWindow?;private typeAheadTimerGeneration;
275
281
  /** Focus the internal select trigger. */
276
282
  focus(options?:FocusOptions):void;
277
283
  /** Blur the internal select trigger. */
@@ -287,7 +293,7 @@ click():void;private _name;private _maxOptionsVisible;constructor();
287
293
  * @default null */
288
294
  get form():HTMLFormElement|null;set form(owner:FormOwnerValue);
289
295
  /** Returns the browser-resolved form owner, including an external owner selected by `form`. */
290
- getForm():HTMLFormElement|null;get labels():NodeList;get validity():ValidityState;get validationMessage():string;get willValidate():boolean;connectedCallback():void;protected willUpdate(changed:PropertyValues):void;private applyOpenState;
296
+ getForm():HTMLFormElement|null;get labels():NodeList;get validity():ValidityState;get validationMessage():string;get willValidate():boolean;private localDescriptionIds;private externalDescriptionLease?;private syncExternalDescription;private releaseExternalDescription;connectedCallback():void;protected willUpdate(changed:PropertyValues):void;private applyOpenState;
291
297
  /** Enforces a platform policy close without exposing an author veto point. A disabled form
292
298
  * control cannot keep an interactive popup open even when an ordinary `lr-hide` listener would
293
299
  * cancel a user-requested close. */
@@ -1,4 +1,4 @@
1
- var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{LyraElement}from"../../../internal/lyra-element.js";import{installFormControlLabelSupport}from"../../../internal/form-control-labels.js";installFormControlLabelSupport();import{deferredPlaceReady as place}from"../../../internal/anchored-overlay-runtime.js";import{rtlAwarePlacement}from"../../../internal/rtl.js";import{nextId,srOnly}from"../../../internal/a11y.js";import{activateNonmodalOverlay}from"../../../internal/nonmodal-overlay-manager.js";import{chevronIcon,closeIcon}from"../../../internal/icons.js";import{AnchoredValidityController,VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{syncValidityStates}from"../../../internal/custom-states.js";import{finiteCount}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{styles}from"./select.styles.js";import{sizes}from"../../../internal/sizes.styles.js";import"../combobox/option.class.js";import{sanitizeCssColor}from"../../../internal/safe-css.js";import{dispatchNativeEvent,dispatchNativeInputEvent,relayNativeEvent}from"../../../internal/native-event-relay.js";import{installInvalidEventAlias}from"../../../internal/invalid-event-alias.js";import{omittedEmptyStringConverter}from"../../../internal/converters.js";import{attachInternalsSafely,getFormOwner,installCustomErrorProperty,isBarredFromValidation,setFormOwner}from"../../../internal/form-associated.js";import{SlotPresenceController}from"../../../internal/slot-presence-controller.js";import{isOptionSelectedDirty,wasOptionInitiallySelected,RESET_OPTION_SELECTED_FROM_OWNER,SET_OPTION_SELECTED_FROM_OWNER}from"../../../internal/option-selection.js";import{isHtmlElement}from"../../../internal/dom-guards.js";import{tag}from"../../../internal/prefix.js";import{currentValidityValidator}from"../form-validator.js";import{LYRA_DEFAULT_clear,LYRA_DEFAULT_removeWithContext,LYRA_DEFAULT_select,LYRA_DEFAULT_selectSelectedOverflow,LYRA_DEFAULT_selectValueMissing}from"../../../internal/default-strings.generated.js";function isLyraOptionElement(value){return isHtmlElement(value)&&value.localName===tag("option")}class LyraSelect extends LyraElement{static{this.defaultStrings={...super.defaultStrings,clear:LYRA_DEFAULT_clear,removeWithContext:LYRA_DEFAULT_removeWithContext,select:LYRA_DEFAULT_select,selectSelectedOverflow:LYRA_DEFAULT_selectSelectedOverflow,selectValueMissing:LYRA_DEFAULT_selectValueMissing}}static{this.immutableEventDetails=Object.freeze(["lr-input","lr-change"])}static get validators(){return[currentValidityValidator("required","disabled","value","multiple")]}static{this.formAssociated=!0}static{this.styles=[LyraElement.styles,sizes,styles,srOnly]}static{this.properties={customError:{attribute:"custom-error",reflect:!0,noAccessor:!0},multiple:{type:Boolean,reflect:!0,noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0},required:{type:Boolean,reflect:!0,noAccessor:!0},value:{noAccessor:!0},name:{reflect:!0,noAccessor:!0,converter:omittedEmptyStringConverter},maxOptionsVisible:{type:Number,attribute:"max-options-visible",noAccessor:!0},defaultValue:{attribute:"default-value",noAccessor:!0}}}get open(){return this._open}set open(next){const requested=!!next,normalized=requested&&!this.effectiveDisabled;if(normalized===this._open){requested!==normalized&&this.hasAttribute("open")&&this.removeAttribute("open");return}this.applyOpenState(normalized)}focus(options){this.effectiveDisabled||this.triggerElement?.focus(options)}blur(){this.triggerElement?.blur()}click(){this.effectiveDisabled||this.triggerElement?.click()}constructor(){super(),this.placeholder="",this.label="",this.hint="",this.helpText="",this.withLabel=!1,this.withHint=!1,this.errorText="",this.autofocus=!1,this.title="",this._open=!1,this.size="m",this.appearance="outlined",this.pill=!1,this.placement="bottom",this.hoist=!1,this.filled=!1,this.withClear=!1,this.clearable=!1,this.autoCommitSingleOption=!1,this.activeIndex=-1,this.options=[],this.touched=!1,this.hasInteracted=!1,this.slotPresence=new SlotPresenceController(this),this._fieldsetDisabled=!1,this.listId=nextId("select-list"),this.triggerId=nextId("select-trigger"),this.valueTextId=nextId("select-value"),this.positioningReady=Promise.resolve(!1),this.restoreFocusOnClose=!0,this._isFirstUpdate=!0,this.openVetoed=!1,this.openStateGeneration=0,this.transitionToken=0,this.transitionWaiters=new Map,this._selected=[],this._selectedOptions=[],this._multiple=!1,this._disabled=!1,this._required=!1,this._defaultSelected=[],this._defaultSelectedOptions=[],this._defaultCaptured=!1,this._valueDirty=!1,this._restoredStateActive=!1,this.typeAheadBuffer="",this.typeAheadTimerGeneration=0,this._name="",this._maxOptionsVisible=3,this.collectOptions=e=>{const slot=e.target,previous=new Set(this.options),previousActive=this.activeOption,previousActiveRawIndex=previousActive?this.options.indexOf(previousActive):this.activeIndex;if(this.options=slot.assignedElements({flatten:!0}).filter(isLyraOptionElement),this.reconcileActiveOption(previousActive,previousActiveRawIndex),this._defaultCaptured){const newDefaults=this.options.filter(option=>!previous.has(option)&&option.defaultSelected),newLive=this.options.filter(option=>!previous.has(option)&&option.selected&&!option.defaultSelected);this.refreshOptionDefaults();const eligible=[...!this._restoredStateActive&&!this._valueDirty?newDefaults:[],...this._restoredStateActive?[]:newLive];if(eligible.length>0){const added=this.multiple?eligible:eligible.slice(-1),occurrences=this.multiple?[...new Set([...this._selectedOptions,...added])]:added;newLive.length>0&&(this._valueDirty=!0),this.setSelection(occurrences.map(option=>option.value),occurrences);return}}else{this._defaultCaptured=!0;const hasDefaultValue=this.hasAttribute("default-value"),allDefaults=this.options.filter(option=>option.defaultSelected),defaults=this.multiple?allDefaults:allDefaults.slice(0,1),allLive=this.options.filter(option=>option.selected),live=this.multiple?allLive:allLive.slice(0,1),initialLive=this.options.filter(option=>wasOptionInitiallySelected(option)),optionDirty=this.options.some(option=>isOptionSelectedDirty(option)),dirtySelected=this.options.filter(option=>isOptionSelectedDirty(option)&&option.selected);if(hasDefaultValue)this._defaultSelectedOptions=this.resolveOccurrences(this._defaultSelected);else{const resetOptions=defaults.length>0?defaults:initialLive.length>0?initialLive:live;this._defaultSelected=resetOptions.map(option=>option.value),this._defaultSelectedOptions=[...resetOptions]}const fromDefaults=hasDefaultValue||defaults.length>0,initial=optionDirty?this.multiple?allLive:dirtySelected.slice(-1)[0]?dirtySelected.slice(-1):live:hasDefaultValue?this._defaultSelectedOptions:fromDefaults?defaults:live;if(initial.length>0&&!this._restoredStateActive&&!this._valueDirty){(!fromDefaults||optionDirty)&&(this._valueDirty=!0),this.setSelection(initial.map(option=>option.value),[...initial]);return}if(optionDirty&&(this._valueDirty=!0),hasDefaultValue&&!this._valueDirty&&!this._restoredStateActive){this.setSelection([...this._defaultSelected],[...this._defaultSelectedOptions]);return}}this.reflectSelected()},this.onOptionChange=e=>{e.stopPropagation();const previousActive=this.activeOption,previousActiveRawIndex=previousActive?this.options.indexOf(previousActive):this.activeIndex;queueMicrotask(()=>{this.refreshOptionDefaults(),this.reflectSelected(),this.options=[...this.options],this.reconcileActiveOption(previousActive,previousActiveRawIndex)})},this.onDocPointer=e=>{if(!e.composedPath().includes(this)){if(this.overlayHandle?.isActive()){this.overlayHandle.dismissBackdrop();return}this.restoreFocusOnClose=!1,this.hide()}},this.onTriggerClick=()=>{if(!this.effectiveDisabled){if(this.onlyOption)return this.selectOption(this.onlyOption);this.open?this.hide():this.show()}},this.onTriggerBlur=event=>{this.effectiveDisabled||(this.touched=!0,this.hasInteracted=!0,this.reflectValidityStates()),this.open&&(this.restoreFocusOnClose=!1),this.hide(),relayNativeEvent(this,event)},this.onTriggerFocus=event=>{relayNativeEvent(this,event)},this.onKeyDown=e=>{const navigable=this.navigableOptions();switch(e.key){case"ArrowDown":if(e.preventDefault(),this.onlyOption)return this.selectOption(this.onlyOption);if(!this.open){this.show();return}this.setActiveIndex(Math.min(navigable.length-1,this.activeIndex+1),navigable);break;case"ArrowUp":if(e.preventDefault(),this.onlyOption)return this.selectOption(this.onlyOption);if(!this.open){this.show();return}this.setActiveIndex(Math.max(0,this.activeIndex-1),navigable);break;case"Enter":case" ":if(this.open){e.preventDefault();const active=navigable[this.activeIndex];this.activeIndex>=0&&active?this.selectOption(active):this.hide()}break;case"Escape":this.open&&(!this.overlayHandle?.isActive()||this.overlayHandle.isTopmost())&&(e.preventDefault(),this.hide());break;case"Home":this.open&&(e.preventDefault(),this.setActiveIndex(0,navigable));break;case"End":this.open&&(e.preventDefault(),this.setActiveIndex(navigable.length-1,navigable));break;case"Backspace":case"Delete":this.multiple&&this._selected.length>0&&(e.preventDefault(),this.removeValueAt(this._selected.length-1));break;default:e.key.length===1&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&this.typeAhead(e.key);break}},this.onListboxMouseDown=e=>{e.preventDefault()},this.onListboxClick=e=>{const optionEl=e.target.closest('[part="option"]'),index=Number(optionEl?.dataset.index);if(!Number.isInteger(index))return;const option=this.options[index];option&&this.selectOption(option)},installInvalidEventAlias(this,init=>this.emit("lr-invalid",null,init)),this.internals=attachInternalsSafely(this),this.validityController=new AnchoredValidityController(this,this.internals,()=>this[VALIDITY_ANCHOR]()),installCustomErrorProperty(this,()=>this.validityController.customValidityMessage),this.syncFormValue()}get form(){return getFormOwner(this.internals)}set form(owner){setFormOwner(this,owner)}getForm(){return getFormOwner(this.internals)}get labels(){return this.internals.labels}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}get willValidate(){return this.internals.willValidate}[VALIDITY_ANCHOR](){return this.renderRoot?.querySelector('[part="trigger"]')??null}connectedCallback(){super.connectedCallback(),this.updateValidity(),this.hasUpdated&&this.open&&queueMicrotask(()=>this.reconnectOpenPopup())}willUpdate(changed){super.willUpdate(changed),this._isFirstUpdate=!this.hasUpdated,this.announceOpenTransition(changed),changed.has("open")&&!this.open&&!this.openVetoed&&this.setActiveIndex(-1)}applyOpenState(next){const old=this._open;this.pendingOpenTransitionStart===void 0&&(this.pendingOpenTransitionStart=old),this.openStateGeneration++,this._open=next,this.requestUpdate("open",old)}forceCloseOpenState(){const isClosing=this._open||this.pendingOpenTransitionStart===!0;if(this.transitionToken++,this.resolveTransitionWaiters("lr-after-show"),this.resolveTransitionWaiters("lr-after-hide"),!this._open){isClosing&&(this.suppressedOpenLifecycleGeneration=this.openStateGeneration),this.hasAttribute("open")&&this.removeAttribute("open");return}this.applyOpenState(!1),this.suppressedOpenLifecycleGeneration=this.openStateGeneration}announceOpenTransition(changed){if(this.openVetoed=!1,!changed.has("open")||this._isFirstUpdate||this.suppressedOpenLifecycleGeneration===this.openStateGeneration)return;const name=this.open?"lr-show":"lr-hide";if(!this.isConnected){this.emit("lr-hide");return}this.emit(name,null,{cancelable:!0}).defaultPrevented&&(this.openVetoed=!0,this.open=!this.open,this.resolveTransitionWaiters(this.open?"lr-after-hide":"lr-after-show"))}get name(){return this._name}set name(next){const old=this._name;this._name=next??"",this._name?this.setAttribute("name",this._name):this.removeAttribute("name"),this.syncFormValue(),this.requestUpdate("name",old)}get multiple(){return this._multiple}set multiple(next){const old=this._multiple;this._multiple=!!next,this.toggleAttribute("multiple",this._multiple),!this._multiple&&this._selected.length>1?this.setSelection(this._selected.slice(0,1),this._selectedOptions.slice(0,1)):this.syncFormValue(),this.requestUpdate("multiple",old)}get maxOptionsVisible(){return this._maxOptionsVisible}set maxOptionsVisible(next){const old=this._maxOptionsVisible;this._maxOptionsVisible=finiteCount(next,3),this.requestUpdate("maxOptionsVisible",old)}get disabled(){return this._disabled}set disabled(next){const old=this._disabled;this._disabled=!!next,this.toggleAttribute("disabled",this._disabled),this._disabled&&this.forceCloseOpenState(),this.updateValidity(),this.requestUpdate("disabled",old)}get required(){return this._required}set required(next){const old=this._required;this._required=!!next,this.toggleAttribute("required",this._required),this.updateValidity(),this.requestUpdate("required",old)}get value(){return this.multiple?[...this._selected]:this._selected[0]??""}set value(next){this._restoredStateActive=!1,this._valueDirty=!0;const values=(Array.isArray(next)?next:next?[next]:[]).filter(value=>typeof value=="string");this.setSelection(values,values.map(value=>this.options.find(option=>option.value===value)))}get defaultValue(){return this.multiple?[...this._defaultSelected]:this._defaultSelected[0]??""}set defaultValue(next){const old=this.multiple?[...this._defaultSelected]:this._defaultSelected[0]??"",values=(Array.isArray(next)?next:next?[next]:[]).filter(value=>typeof value=="string");this._defaultSelected=this.multiple?[...values]:values.slice(0,1),this._defaultSelectedOptions=this.resolveOccurrences(this._defaultSelected),!this._valueDirty&&!this._restoredStateActive&&this.setSelection([...this._defaultSelected],[...this._defaultSelectedOptions]),this.requestUpdate("defaultValue",old)}get selectedOptions(){return[...this._selectedOptions]}set selectedOptions(next){this._restoredStateActive=!1,this._valueDirty=!0;const candidates=Array.isArray(next)?next:[],live=candidates.filter((option,index)=>isLyraOptionElement(option)&&this.contains(option)&&this.options.includes(option)&&candidates.indexOf(option)===index),selected=this.multiple?live:live.slice(0,1);this.setSelection(selected.map(option=>option.value),selected)}setSelection(next,preferred=[]){const values=this.multiple?[...next]:next.slice(0,1),previousValues=this._selected,previousOptions=this._selectedOptions,old=this.multiple?[...previousValues]:previousValues[0]??"";this._selected=values,this._selectedOptions=this.resolveOccurrences(values,preferred),this.syncFormValue(),this.reflectSelected(),this.updateValidity(),this.requestUpdate("value",old);const sameValues=previousValues.length===values.length&&previousValues.every((value,i)=>value===values[i]),sameOptions=previousOptions.length===this._selectedOptions.length&&previousOptions.every((option,i)=>option===this._selectedOptions[i]);sameValues&&!sameOptions&&this.requestUpdate()}resolveOccurrences(values,preferred=[]){const claimed=new Set,resolved=[];return values.forEach((value,index)=>{const hint=preferred[index],match=hint&&hint.value===value&&this.options.includes(hint)&&!claimed.has(hint)?hint:this.options.find(option=>option.value===value&&!claimed.has(option));match&&(claimed.add(match),resolved.push(match))}),resolved}get barredFromValidation(){return isBarredFromValidation(this,this.internals)}updateValidity(){this.barredFromValidation?this.validityController.setValidity({}):this.required&&this._selected.length===0?this.validityController.setValidity({valueMissing:!0},this.localize("selectValueMissing")):this.validityController.setValidity({}),this.reflectValidityStates()}reflectValidityStates(){syncValidityStates(this.internals,{required:this.required,hasInteracted:this.hasInteracted,barred:this.barredFromValidation}),this._selected.length===0?this.internals.states?.add("blank"):this.internals.states?.delete("blank")}syncFormValue(){if(!this.multiple){this.internals.setFormValue(this._selected[0]??"");return}const state2=JSON.stringify(this._selected);if(!this.name){this.internals.setFormValue(null,state2);return}const data=new FormData;for(const value of this._selected)data.append(this.name,value);this.internals.setFormValue(data,state2)}get effectiveDisabled(){return this.disabled||this._fieldsetDisabled}formResetCallback(){this.touched=!1,this.hasInteracted=!1,this._restoredStateActive=!1,this._valueDirty=!1;const resetOptions=this._defaultSelectedOptions.length>0?this._defaultSelectedOptions:this.options.filter(option=>wasOptionInitiallySelected(option));this._defaultSelectedOptions.length===0&&resetOptions.length>0&&(this._defaultSelectedOptions=[...resetOptions],this._defaultSelected=resetOptions.map(option=>option.value));const defaults=new Set(resetOptions);for(const option of this.options)option[RESET_OPTION_SELECTED_FROM_OWNER](defaults.has(option));this.setSelection([...this._defaultSelected],[...this._defaultSelectedOptions])}formStateRestoreCallback(state2,reason){if(!this.multiple)this.value=typeof state2=="string"?state2:"";else{let restored=[];if(typeof state2=="string")try{const parsed=JSON.parse(state2);Array.isArray(parsed)&&parsed.every(entry=>typeof entry=="string")&&(restored=parsed)}catch{}this.value=restored}this._restoredStateActive=!0,this._valueDirty=!0}formDisabledCallback(disabled){this._fieldsetDisabled=disabled,disabled&&this.forceCloseOpenState(),this.updateValidity(),this.requestUpdate()}checkValidity(){return this.updateValidity(),this.internals.checkValidity()}reportValidity(){return this.updateValidity(),this.hasInteracted=!0,this.reflectValidityStates(),this.internals.reportValidity()}setCustomValidity(message){this.validityController.setCustomValidity(message??""),this.reflectValidityStates()}resetValidity(){this.setCustomValidity("")}disconnectedCallback(){this.transitionToken++,super.disconnectedCallback(),this.cleanup?.(),this.cleanup=void 0,this.positionedDirection=void 0,this.clearTypeAheadTimer(),this.typeAheadBuffer="",this.overlayHandle?.deactivate({restoreFocus:!1}),this.overlayHandle=void 0,this.unbindDocumentPointer(),this.resolveTransitionWaiters("lr-after-show"),this.resolveTransitionWaiters("lr-after-hide"),this.open=!1}adoptedCallback(){super.adoptedCallback(),this.cleanup?.(),this.cleanup=void 0,this.positionedDirection=void 0,this.overlayHandle?.deactivate({restoreFocus:!1}),this.overlayHandle=void 0,this.unbindDocumentPointer(),this.clearTypeAheadTimer(),queueMicrotask(()=>this.reconnectOpenPopup())}refreshOptionDefaults(){if(this.hasAttribute("default-value"))return;const declared=this.options.filter(option=>option.defaultSelected),defaults=this.multiple?declared:declared.slice(0,1);this._defaultSelected=defaults.map(option=>option.value),this._defaultSelectedOptions=[...defaults],!this._valueDirty&&!this._restoredStateActive&&this.setSelection([...this._defaultSelected],[...this._defaultSelectedOptions])}reflectSelected(){this._selectedOptions=this.resolveOccurrences(this._selected,this._selectedOptions);const chosen=new Set(this._selectedOptions);for(const option of this.options)option[SET_OPTION_SELECTED_FROM_OWNER](chosen.has(option))}labelFor(value,occurrenceIndex=0){return(this._selectedOptions[occurrenceIndex]?.value===value?this._selectedOptions[occurrenceIndex]?.label:void 0)??this._selectedOptions.find(option=>option.value===value)?.label??this.options.find(option=>option.value===value)?.label??value}get onlyOption(){if(!this.autoCommitSingleOption)return;const navigable=this.navigableOptions();return navigable.length===1?navigable[0]:void 0}isOptionAvailable(option){return!option.disabled&&!option.inert&&!option.closest("[inert]")}navigableOptions(options=this.options){return options.filter(option=>this.isOptionAvailable(option))}setActiveIndex(next,navigable=this.navigableOptions()){if(next<0||navigable.length===0){this.activeIndex=-1,this.activeOption=void 0;return}const index=Math.min(next,navigable.length-1);this.activeIndex=index,this.activeOption=navigable[index]}reconcileActiveOption(previousActive,previousRawIndex){if(!previousActive&&this.activeIndex<0)return;const navigable=this.navigableOptions();if(previousActive){const preservedIndex=navigable.indexOf(previousActive);if(preservedIndex>=0){this.setActiveIndex(preservedIndex,navigable);return}}if(navigable.length===0){this.setActiveIndex(-1,navigable);return}const pivot=Math.max(0,previousRawIndex);let nearestIndex=0,nearestDistance=Number.POSITIVE_INFINITY,nearestRawIndex=-1;navigable.forEach((option,index)=>{const rawIndex=this.options.indexOf(option),distance=Math.abs(rawIndex-pivot);(distance<nearestDistance||distance===nearestDistance&&rawIndex>=pivot&&nearestRawIndex<pivot)&&(nearestIndex=index,nearestDistance=distance,nearestRawIndex=rawIndex)}),this.setActiveIndex(nearestIndex,navigable)}show(){if(this.open||this.effectiveDisabled)return Promise.resolve();this.resolveTransitionWaiters("lr-after-hide");const settled=this.waitForTransition("lr-after-show");return this.open=!0,settled}hide(){if(!this.open)return Promise.resolve();this.resolveTransitionWaiters("lr-after-show");const settled=this.waitForTransition("lr-after-hide");return this.open=!1,settled}positionListbox(){this.cleanup?.(),this.cleanup=void 0,this.positionedDirection=this.effectiveDirection;const anchor=this.renderRoot.querySelector('[part="trigger"]'),listbox=this.renderRoot.querySelector('[part="listbox"]');!anchor||!listbox||(this.cleanup=place(anchor,listbox,{placement:rtlAwarePlacement(this.placement,this),strategy:this.hoist?"fixed":"absolute"}),this.positioningReady=this.cleanup.ready)}activateListboxOverlay(){this.cleanup?.(),this.cleanup=void 0,this.overlayHandle?.deactivate({restoreFocus:!1}),this.restoreFocusOnClose=!0,this.overlayHandle=activateNonmodalOverlay({host:this,panel:()=>this.renderRoot.querySelector('[part="listbox"]'),onEscape:()=>{this.hide()},onBackdrop:()=>{this.restoreFocusOnClose=!1,this.hide()},restoreFocusTo:this.triggerElement??null}),this.bindDocumentPointer(),this.positionListbox()}teardownListboxOverlay(restoreFocus=this.restoreFocusOnClose){this.cleanup?.(),this.cleanup=void 0,this.positionedDirection=void 0,this.overlayHandle?.deactivate({restoreFocus}),this.overlayHandle=void 0,this.unbindDocumentPointer(),this.restoreFocusOnClose=!0}bindDocumentPointer(){if(!this.isConnected)return;const ownerDocument=this.ownerDocument;if(this.pointerListenerDocument===ownerDocument&&this.pointerListener)return;this.unbindDocumentPointer();const listener=event=>{this.pointerListener!==listener||this.pointerListenerDocument!==ownerDocument||!this.isConnected||this.ownerDocument!==ownerDocument||this.onDocPointer(event)};this.pointerListenerDocument=ownerDocument,this.pointerListener=listener,ownerDocument.addEventListener("pointerdown",listener,!0)}unbindDocumentPointer(){this.pointerListenerDocument&&this.pointerListener&&this.pointerListenerDocument.removeEventListener("pointerdown",this.pointerListener,!0),this.pointerListenerDocument=void 0,this.pointerListener=void 0}reconnectOpenPopup(){!this.isConnected||!this.open||this.activateListboxOverlay()}updated(changed){super.updated(changed);const suppressOpenLifecycle=changed.has("open")&&this.suppressedOpenLifecycleGeneration===this.openStateGeneration,shouldRefreshPosition=this.open&&this.isConnected&&(changed.has("placement")||changed.has("hoist")||this.positionedDirection!==this.effectiveDirection);changed.has("open")&&!this.openVetoed?this.open&&this.isConnected?(this.activateListboxOverlay(),!this._isFirstUpdate&&!suppressOpenLifecycle&&this.settleTransition("lr-after-show")):this.open?this.teardownListboxOverlay(!1):(this.teardownListboxOverlay(),!this._isFirstUpdate&&!suppressOpenLifecycle&&this.settleTransition("lr-after-hide")):changed.has("open")&&this.openVetoed?(this.restoreFocusOnClose=!0,shouldRefreshPosition&&this.positionListbox()):shouldRefreshPosition&&this.positionListbox(),(changed.has("touched")||changed.has("required")||changed.has("value"))&&this.toggleAttribute("data-invalid",this.touched&&!this.internals.validity.valid),changed.has("open")&&(this.pendingOpenTransitionStart=void 0,this.suppressedOpenLifecycleGeneration=void 0)}async settleTransition(event){const token=++this.transitionToken;if(await this.updateComplete,this.transitionToken===token){if(event==="lr-after-show"){for(;this.open;){const readiness=this.positioningReady,positioned=await readiness;if(this.transitionToken!==token)return;if(positioned)break;if(readiness===this.positioningReady){this.forceCloseOpenState();return}}if(await this.updateComplete,this.transitionToken!==token)return}if(this.isConnected){const view=this.ownerDocument.defaultView;if(view&&await new Promise(resolve=>view.requestAnimationFrame(()=>resolve())),this.transitionToken!==token)return;const animations=this.renderRoot.querySelector('[part="listbox"]')?.getAnimations({subtree:!0})??[];if(await Promise.all(animations.map(animation=>animation.finished.catch(()=>{}))),this.transitionToken!==token)return}this.emit(event),this.resolveTransitionWaiters(event)}}waitForTransition(event){return new Promise(resolve=>{const waiters=this.transitionWaiters.get(event)??new Set;waiters.add(resolve),this.transitionWaiters.set(event,waiters)})}resolveTransitionWaiters(event){const waiters=this.transitionWaiters.get(event);if(waiters){this.transitionWaiters.delete(event);for(const resolve of waiters)resolve()}}emitValueEvents(){dispatchNativeInputEvent(this),this.emit("lr-input",{value:this.value}),dispatchNativeEvent(this,"change"),this.emit("lr-change",{value:this.value})}selectOption(option){if(this.effectiveDisabled||!this.isOptionAvailable(option))return;if(this.hasInteracted=!0,this._restoredStateActive=!1,this._valueDirty=!0,this.multiple){const selectedIndex=this._selectedOptions.indexOf(option),selected=selectedIndex>=0,occurrences=selected?this._selectedOptions.filter((_,index)=>index!==selectedIndex):[...this._selectedOptions,option],values=selected?this._selected.filter((_,index)=>index!==selectedIndex):[...this._selected,option.value];this.setSelection(values,occurrences),this.emitValueEvents();return}const changed=option!==this._selectedOptions[0]||option.value!==this._selected[0];this.setSelection([option.value],[option]),this.hide(),changed&&this.emitValueEvents()}removeValueAt(index){this.effectiveDisabled||index<0||index>=this._selected.length||(this._restoredStateActive=!1,this._valueDirty=!0,this.setSelection(this._selected.filter((_,candidateIndex)=>candidateIndex!==index),this._selectedOptions.filter((_,candidateIndex)=>candidateIndex!==index)),this.emitValueEvents())}clear(){this.effectiveDisabled||this._selected.length===0||(this._restoredStateActive=!1,this._valueDirty=!0,this.setSelection([],[]),this.emitValueEvents(),this.emit("lr-clear"))}removeTag(value,index,event){event.stopPropagation(),this._selected[index]===value&&(this.removeValueAt(index),this.updateComplete.then(()=>{const buttons=[...this.renderRoot.querySelectorAll('[part~="tag__remove-button"]')];(buttons[Math.min(index,buttons.length-1)]??this.triggerElement)?.focus()}))}typeAhead(char){this.clearTypeAheadTimer(),this.typeAheadBuffer+=char.toLocaleLowerCase(this.effectiveLocale);const ownerWindow=this.ownerDocument.defaultView;if(this.isConnected&&ownerWindow){const generation=this.typeAheadTimerGeneration;this.typeAheadTimerWindow=ownerWindow,this.typeAheadTimer=ownerWindow.setTimeout(()=>{this.typeAheadTimerGeneration!==generation||!this.isConnected||this.ownerDocument.defaultView!==ownerWindow||(this.typeAheadTimer=void 0,this.typeAheadTimerWindow=void 0,this.typeAheadBuffer="")},500)}const navigable=this.navigableOptions();if(!navigable.length)return;const currentOption=this.open?navigable[this.activeIndex]:this._selectedOptions[this._selectedOptions.length-1],currentIndex=navigable.indexOf(currentOption),n=navigable.length;for(let step=1;step<=n;step++){const idx=(currentIndex+step+n)%n,candidate=navigable[idx];if(candidate!==void 0&&candidate.label.toLocaleLowerCase(this.effectiveLocale).startsWith(this.typeAheadBuffer)){if(this.open){this.setActiveIndex(idx,navigable);return}if(this.multiple&&this._selectedOptions.includes(candidate))continue;this.selectOption(candidate);return}}}clearTypeAheadTimer(){this.typeAheadTimerGeneration+=1,this.typeAheadTimer!==void 0&&this.typeAheadTimerWindow?.clearTimeout(this.typeAheadTimer),this.typeAheadTimer=void 0,this.typeAheadTimerWindow=void 0}renderRows(options,activeId){const out=[],chosen=new Set(this._selectedOptions);let currentGroup,groupRows=[],groupIndex=0;const flushGroup=()=>{if(groupRows.length!==0){if(currentGroup){const labelId=`${this.listId}-group-${groupIndex++}`;out.push(html`<div role="group" aria-labelledby=${labelId}>
1
+ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{acquireNativeControlDescription}from"../../../internal/native-control-description.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{LyraElement}from"../../../internal/lyra-element.js";import{installFormControlLabelSupport}from"../../../internal/form-control-labels.js";installFormControlLabelSupport();import{deferredPlaceReady as place}from"../../../internal/anchored-overlay-runtime.js";import{rtlAwarePlacement}from"../../../internal/rtl.js";import{nextId,srOnly}from"../../../internal/a11y.js";import{activateNonmodalOverlay}from"../../../internal/nonmodal-overlay-manager.js";import{chevronIcon,closeIcon}from"../../../internal/icons.js";import{AnchoredValidityController,VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{syncValidityStates}from"../../../internal/custom-states.js";import{finiteCount}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{styles}from"./select.styles.js";import{sizes}from"../../../internal/sizes.styles.js";import"../combobox/option.class.js";import{sanitizeCssColor}from"../../../internal/safe-css.js";import{dispatchNativeEvent,dispatchNativeInputEvent,relayNativeEvent}from"../../../internal/native-event-relay.js";import{installInvalidEventAlias}from"../../../internal/invalid-event-alias.js";import{omittedEmptyStringConverter}from"../../../internal/converters.js";import{attachInternalsSafely,getFormOwner,installCustomErrorProperty,isBarredFromValidation,setFormOwner}from"../../../internal/form-associated.js";import{SlotPresenceController}from"../../../internal/slot-presence-controller.js";import{isOptionSelectedDirty,isOptionSelectedWrite,wasOptionInitiallySelected,RESET_OPTION_SELECTED_FROM_OWNER,SET_OPTION_SELECTED_FROM_OWNER}from"../../../internal/option-selection.js";import{isHtmlElement}from"../../../internal/dom-guards.js";import{tag}from"../../../internal/prefix.js";import{currentValidityValidator}from"../form-validator.js";import{LYRA_DEFAULT_clear,LYRA_DEFAULT_removeWithContext,LYRA_DEFAULT_select,LYRA_DEFAULT_selectSelectedOverflow,LYRA_DEFAULT_selectValueMissing}from"../../../internal/default-strings.generated.js";function isLyraOptionElement(value){return isHtmlElement(value)&&value.localName===tag("option")}class LyraSelect extends LyraElement{static{this.defaultStrings={...super.defaultStrings,clear:LYRA_DEFAULT_clear,removeWithContext:LYRA_DEFAULT_removeWithContext,select:LYRA_DEFAULT_select,selectSelectedOverflow:LYRA_DEFAULT_selectSelectedOverflow,selectValueMissing:LYRA_DEFAULT_selectValueMissing}}static{this.immutableEventDetails=Object.freeze(["lr-input","lr-change"])}static get validators(){return[currentValidityValidator("required","disabled","value","multiple")]}static{this.formAssociated=!0}static{this.styles=[LyraElement.styles,sizes,styles,srOnly]}static{this.properties={customError:{attribute:"custom-error",reflect:!0,noAccessor:!0},multiple:{type:Boolean,reflect:!0,noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0},required:{type:Boolean,reflect:!0,noAccessor:!0},value:{noAccessor:!0},name:{reflect:!0,noAccessor:!0,converter:omittedEmptyStringConverter},maxOptionsVisible:{type:Number,attribute:"max-options-visible",noAccessor:!0},defaultValue:{attribute:"default-value",noAccessor:!0}}}get open(){return this._open}set open(next){const requested=!!next,normalized=requested&&!this.effectiveDisabled;if(normalized===this._open){requested!==normalized&&this.hasAttribute("open")&&this.removeAttribute("open");return}this.applyOpenState(normalized)}focus(options){this.effectiveDisabled||this.triggerElement?.focus(options)}blur(){this.triggerElement?.blur()}click(){this.effectiveDisabled||this.triggerElement?.click()}constructor(){super(),this.placeholder="",this.label="",this.hint="",this.helpText="",this.withLabel=!1,this.withHint=!1,this.errorText="",this.autofocus=!1,this.title="",this._open=!1,this.size="m",this.appearance="outlined",this.pill=!1,this.placement="bottom",this.hoist=!1,this.filled=!1,this.withClear=!1,this.clearable=!1,this.autoCommitSingleOption=!1,this.activeIndex=-1,this.options=[],this.touched=!1,this.hasInteracted=!1,this.slotPresence=new SlotPresenceController(this),this._fieldsetDisabled=!1,this.listId=nextId("select-list"),this.triggerId=nextId("select-trigger"),this.valueTextId=nextId("select-value"),this.positioningReady=Promise.resolve(!1),this.restoreFocusOnClose=!0,this._isFirstUpdate=!0,this.openVetoed=!1,this.openStateGeneration=0,this.transitionToken=0,this.transitionWaiters=new Map,this._selected=[],this._selectedOptions=[],this._selectedValuesByOption=new Map,this._multiple=!1,this._disabled=!1,this._required=!1,this._defaultSelected=[],this._defaultSelectedOptions=[],this._defaultCaptured=!1,this._valueDirty=!1,this._restoredStateActive=!1,this.typeAheadBuffer="",this.typeAheadTimerGeneration=0,this._name="",this._maxOptionsVisible=3,this.localDescriptionIds="",this.collectOptions=e=>{const slot=e.target,previous=new Set(this.options),previousActive=this.activeOption,previousActiveRawIndex=previousActive?this.options.indexOf(previousActive):this.activeIndex;if(this.options=slot.assignedElements({flatten:!0}).filter(isLyraOptionElement),this.reconcileActiveOption(previousActive,previousActiveRawIndex),this._defaultCaptured){const newDefaults=this.options.filter(option=>!previous.has(option)&&option.defaultSelected),newLive=this.options.filter(option=>!previous.has(option)&&option.selected&&!option.defaultSelected);this.refreshOptionDefaults();const eligible=[...!this._restoredStateActive&&!this._valueDirty?newDefaults:[],...this._restoredStateActive?[]:newLive];if(eligible.length>0){const added=this.multiple?eligible:eligible.slice(-1),occurrences=this.multiple?[...new Set([...this._selectedOptions,...added])]:added;newLive.length>0&&(this._valueDirty=!0),this.setSelection(occurrences.map(option=>option.value),occurrences);return}}else{this._defaultCaptured=!0;const hasDefaultValue=this.hasAttribute("default-value"),allDefaults=this.options.filter(option=>option.defaultSelected),defaults=this.multiple?allDefaults:allDefaults.slice(0,1),allLive=this.options.filter(option=>option.selected),live=this.multiple?allLive:allLive.slice(0,1),initialLive=this.options.filter(option=>wasOptionInitiallySelected(option)),optionDirty=this.options.some(option=>isOptionSelectedDirty(option)),dirtySelected=this.options.filter(option=>isOptionSelectedDirty(option)&&option.selected);if(hasDefaultValue)this._defaultSelectedOptions=this.resolveOccurrences(this._defaultSelected);else{const resetOptions=defaults.length>0?defaults:initialLive.length>0?initialLive:live;this._defaultSelected=resetOptions.map(option=>option.value),this._defaultSelectedOptions=[...resetOptions]}const fromDefaults=hasDefaultValue||defaults.length>0,initial=optionDirty?this.multiple?allLive:dirtySelected.slice(-1)[0]?dirtySelected.slice(-1):live:hasDefaultValue?this._defaultSelectedOptions:fromDefaults?defaults:live;if(initial.length>0&&!this._restoredStateActive&&!this._valueDirty){(!fromDefaults||optionDirty)&&(this._valueDirty=!0),this.setSelection(initial.map(option=>option.value),[...initial]);return}if(optionDirty&&(this._valueDirty=!0),hasDefaultValue&&!this._valueDirty&&!this._restoredStateActive){this.setSelection([...this._defaultSelected],[...this._defaultSelectedOptions]);return}}this.reflectSelected()},this.onOptionChange=e=>{e.stopPropagation();const option=e.composedPath().find(isLyraOptionElement);if(isLyraOptionElement(option)&&this.options.includes(option)&&isOptionSelectedWrite(e)){this._valueDirty=!0,this._restoredStateActive=!1;const selected=this._selectedOptions.includes(option);if(option.selected===selected&&(!selected||this._selectedValuesByOption.get(option)===option.value))return;if(option.selected&&!this.multiple){this.setSelection([option.value],[option]);return}const remaining=[...this._selectedOptions],preferred=this._selected.map(value=>{const index2=remaining.findIndex(candidate=>this._selectedValuesByOption.get(candidate)===value);return index2<0?void 0:remaining.splice(index2,1)[0]}),values=[...this._selected],index=preferred.indexOf(option);if(option.selected)index<0?(values.push(option.value),preferred.push(option)):values[index]=option.value;else{if(index<0)return;values.splice(index,1),preferred.splice(index,1)}this.setSelection(values,preferred);return}const previousActive=this.activeOption,previousActiveRawIndex=previousActive?this.options.indexOf(previousActive):this.activeIndex;queueMicrotask(()=>{this.refreshOptionDefaults(),this.reflectSelected(),this.options=[...this.options],this.reconcileActiveOption(previousActive,previousActiveRawIndex)})},this.onDocPointer=e=>{if(!e.composedPath().includes(this)){if(this.overlayHandle?.isActive()){this.overlayHandle.dismissBackdrop();return}this.restoreFocusOnClose=!1,this.hide()}},this.onTriggerClick=()=>{if(!this.effectiveDisabled){if(this.onlyOption)return this.selectOption(this.onlyOption);this.open?this.hide():this.show()}},this.onTriggerBlur=event=>{this.effectiveDisabled||(this.touched=!0,this.hasInteracted=!0,this.reflectValidityStates()),this.open&&(this.restoreFocusOnClose=!1),this.hide(),relayNativeEvent(this,event)},this.onTriggerFocus=event=>{relayNativeEvent(this,event)},this.onKeyDown=e=>{const navigable=this.navigableOptions();switch(e.key){case"ArrowDown":if(e.preventDefault(),this.onlyOption)return this.selectOption(this.onlyOption);if(!this.open){this.show();return}this.setActiveIndex(Math.min(navigable.length-1,this.activeIndex+1),navigable);break;case"ArrowUp":if(e.preventDefault(),this.onlyOption)return this.selectOption(this.onlyOption);if(!this.open){this.show();return}this.setActiveIndex(Math.max(0,this.activeIndex-1),navigable);break;case"Enter":case" ":if(this.open){e.preventDefault();const active=navigable[this.activeIndex];this.activeIndex>=0&&active?this.selectOption(active):this.hide()}break;case"Escape":this.open&&(!this.overlayHandle?.isActive()||this.overlayHandle.isTopmost())&&(e.preventDefault(),this.hide());break;case"Home":this.open&&(e.preventDefault(),this.setActiveIndex(0,navigable));break;case"End":this.open&&(e.preventDefault(),this.setActiveIndex(navigable.length-1,navigable));break;case"Backspace":case"Delete":this.multiple&&this._selected.length>0&&(e.preventDefault(),this.removeValueAt(this._selected.length-1));break;default:e.key.length===1&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&this.typeAhead(e.key);break}},this.onListboxMouseDown=e=>{e.preventDefault()},this.onListboxClick=e=>{const optionEl=e.target.closest('[part="option"]'),index=Number(optionEl?.dataset.index);if(!Number.isInteger(index))return;const option=this.options[index];option&&this.selectOption(option)},installInvalidEventAlias(this,init=>this.emit("lr-invalid",null,init)),this.internals=attachInternalsSafely(this),this.validityController=new AnchoredValidityController(this,this.internals,()=>this[VALIDITY_ANCHOR]()),installCustomErrorProperty(this,()=>this.validityController.customValidityMessage),this.syncFormValue()}get form(){return getFormOwner(this.internals)}set form(owner){setFormOwner(this,owner)}getForm(){return getFormOwner(this.internals)}get labels(){return this.internals.labels}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}get willValidate(){return this.internals.willValidate}[VALIDITY_ANCHOR](){return this.renderRoot?.querySelector('[part="trigger"]')??null}syncExternalDescription(){if(!this.isConnected)return;const target=this.renderRoot.querySelector('[part="trigger"]');target&&(this.externalDescriptionLease?this.externalDescriptionLease.update(target):this.externalDescriptionLease=acquireNativeControlDescription(this,target,()=>this.localDescriptionIds))}releaseExternalDescription(){this.externalDescriptionLease?.release(),this.externalDescriptionLease=void 0}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.syncExternalDescription(),this.updateValidity(),this.hasUpdated&&this.open&&queueMicrotask(()=>this.reconnectOpenPopup())}willUpdate(changed){super.willUpdate(changed),this._isFirstUpdate=!this.hasUpdated,this.announceOpenTransition(changed),changed.has("open")&&!this.open&&!this.openVetoed&&this.setActiveIndex(-1)}applyOpenState(next){const old=this._open;this.pendingOpenTransitionStart===void 0&&(this.pendingOpenTransitionStart=old),this.openStateGeneration++,this._open=next,this.requestUpdate("open",old)}forceCloseOpenState(){const isClosing=this._open||this.pendingOpenTransitionStart===!0;if(this.transitionToken++,this.resolveTransitionWaiters("lr-after-show"),this.resolveTransitionWaiters("lr-after-hide"),!this._open){isClosing&&(this.suppressedOpenLifecycleGeneration=this.openStateGeneration),this.hasAttribute("open")&&this.removeAttribute("open");return}this.applyOpenState(!1),this.suppressedOpenLifecycleGeneration=this.openStateGeneration}announceOpenTransition(changed){if(this.openVetoed=!1,!changed.has("open")||this._isFirstUpdate||this.suppressedOpenLifecycleGeneration===this.openStateGeneration)return;const name=this.open?"lr-show":"lr-hide";if(!this.isConnected){this.emit("lr-hide");return}this.emit(name,null,{cancelable:!0}).defaultPrevented&&(this.openVetoed=!0,this.open=!this.open,this.resolveTransitionWaiters(this.open?"lr-after-hide":"lr-after-show"))}get name(){return this._name}set name(next){const old=this._name;this._name=next??"",this._name?this.setAttribute("name",this._name):this.removeAttribute("name"),this.syncFormValue(),this.requestUpdate("name",old)}get multiple(){return this._multiple}set multiple(next){const old=this._multiple;this._multiple=!!next,this.toggleAttribute("multiple",this._multiple),!this._multiple&&this._selected.length>1?this.setSelection(this._selected.slice(0,1),this._selectedOptions.slice(0,1)):this.syncFormValue(),this.requestUpdate("multiple",old)}get maxOptionsVisible(){return this._maxOptionsVisible}set maxOptionsVisible(next){const old=this._maxOptionsVisible;this._maxOptionsVisible=finiteCount(next,3),this.requestUpdate("maxOptionsVisible",old)}get disabled(){return this._disabled}set disabled(next){const old=this._disabled;this._disabled=!!next,this.toggleAttribute("disabled",this._disabled),this._disabled&&this.forceCloseOpenState(),this.updateValidity(),this.requestUpdate("disabled",old)}get required(){return this._required}set required(next){const old=this._required;this._required=!!next,this.toggleAttribute("required",this._required),this.updateValidity(),this.requestUpdate("required",old)}get value(){return this.multiple?[...this._selected]:this._selected[0]??""}set value(next){this._restoredStateActive=!1,this._valueDirty=!0;const values=(Array.isArray(next)?next:next?[next]:[]).filter(value=>typeof value=="string");this.setSelection(values,values.map(value=>this.options.find(option=>option.value===value)))}get defaultValue(){return this.multiple?[...this._defaultSelected]:this._defaultSelected[0]??""}set defaultValue(next){const old=this.multiple?[...this._defaultSelected]:this._defaultSelected[0]??"",values=(Array.isArray(next)?next:next?[next]:[]).filter(value=>typeof value=="string");this._defaultSelected=this.multiple?[...values]:values.slice(0,1),this._defaultSelectedOptions=this.resolveOccurrences(this._defaultSelected),!this._valueDirty&&!this._restoredStateActive&&this.setSelection([...this._defaultSelected],[...this._defaultSelectedOptions]),this.requestUpdate("defaultValue",old)}get selectedOptions(){return[...this._selectedOptions]}set selectedOptions(next){this._restoredStateActive=!1,this._valueDirty=!0;const candidates=Array.isArray(next)?next:[],live=candidates.filter((option,index)=>isLyraOptionElement(option)&&this.contains(option)&&this.options.includes(option)&&candidates.indexOf(option)===index),selected=this.multiple?live:live.slice(0,1);this.setSelection(selected.map(option=>option.value),selected)}setSelection(next,preferred=[]){const values=this.multiple?[...next]:next.slice(0,1),previousValues=this._selected,previousOptions=this._selectedOptions,old=this.multiple?[...previousValues]:previousValues[0]??"";this._selected=values,this._selectedOptions=this.resolveOccurrences(values,preferred),this.syncFormValue(),this.reflectSelected(),this.updateValidity(),this.requestUpdate("value",old);const sameValues=previousValues.length===values.length&&previousValues.every((value,i)=>value===values[i]),sameOptions=previousOptions.length===this._selectedOptions.length&&previousOptions.every((option,i)=>option===this._selectedOptions[i]);sameValues&&!sameOptions&&this.requestUpdate()}resolveOccurrences(values,preferred=[]){const claimed=new Set,resolved=[];return values.forEach((value,index)=>{const hint=preferred.length===values.length?preferred[index]:preferred.find(option=>option?.value===value&&!claimed.has(option)),match=hint&&hint.value===value&&this.options.includes(hint)&&!claimed.has(hint)?hint:this.options.find(option=>option.value===value&&!claimed.has(option));match&&(claimed.add(match),resolved.push(match))}),resolved}get barredFromValidation(){return isBarredFromValidation(this,this.internals)}updateValidity(){this.barredFromValidation?this.validityController.setValidity({}):this.required&&this._selected.length===0?this.validityController.setValidity({valueMissing:!0},this.localize("selectValueMissing")):this.validityController.setValidity({}),this.reflectValidityStates()}reflectValidityStates(){syncValidityStates(this.internals,{required:this.required,hasInteracted:this.hasInteracted,barred:this.barredFromValidation}),this._selected.length===0?this.internals.states?.add("blank"):this.internals.states?.delete("blank")}syncFormValue(){if(!this.multiple){this.internals.setFormValue(this._selected[0]??"");return}const state2=JSON.stringify(this._selected);if(!this.name){this.internals.setFormValue(null,state2);return}const data=new FormData;for(const value of this._selected)data.append(this.name,value);this.internals.setFormValue(data,state2)}get effectiveDisabled(){return this.disabled||this._fieldsetDisabled}formResetCallback(){this.touched=!1,this.hasInteracted=!1,this._restoredStateActive=!1,this._valueDirty=!1;const resetOptions=this._defaultSelectedOptions.length>0?this._defaultSelectedOptions:this.options.filter(option=>wasOptionInitiallySelected(option));this._defaultSelectedOptions.length===0&&resetOptions.length>0&&(this._defaultSelectedOptions=[...resetOptions],this._defaultSelected=resetOptions.map(option=>option.value));const defaults=new Set(resetOptions);for(const option of this.options)option[RESET_OPTION_SELECTED_FROM_OWNER](defaults.has(option));this.setSelection([...this._defaultSelected],[...this._defaultSelectedOptions])}formStateRestoreCallback(state2,reason){if(!this.multiple)this.value=typeof state2=="string"?state2:"";else{let restored=[];if(typeof state2=="string")try{const parsed=JSON.parse(state2);Array.isArray(parsed)&&parsed.every(entry=>typeof entry=="string")&&(restored=parsed)}catch{}this.value=restored}this._restoredStateActive=!0,this._valueDirty=!0}formDisabledCallback(disabled){this._fieldsetDisabled=disabled,disabled&&this.forceCloseOpenState(),this.updateValidity(),this.requestUpdate()}checkValidity(){return this.updateValidity(),this.internals.checkValidity()}reportValidity(){return this.updateValidity(),this.hasInteracted=!0,this.reflectValidityStates(),this.internals.reportValidity()}setCustomValidity(message){this.validityController.setCustomValidity(message??""),this.reflectValidityStates()}resetValidity(){this.setCustomValidity("")}disconnectedCallback(){this.releaseExternalDescription(),this.transitionToken++,super.disconnectedCallback(),this.cleanup?.(),this.cleanup=void 0,this.positionedDirection=void 0,this.clearTypeAheadTimer(),this.typeAheadBuffer="",this.overlayHandle?.deactivate({restoreFocus:!1}),this.overlayHandle=void 0,this.unbindDocumentPointer(),this.resolveTransitionWaiters("lr-after-show"),this.resolveTransitionWaiters("lr-after-hide"),this.open=!1}adoptedCallback(){super.adoptedCallback(),this.releaseExternalDescription(),this.hasUpdated&&this.syncExternalDescription(),this.cleanup?.(),this.cleanup=void 0,this.positionedDirection=void 0,this.overlayHandle?.deactivate({restoreFocus:!1}),this.overlayHandle=void 0,this.unbindDocumentPointer(),this.clearTypeAheadTimer(),queueMicrotask(()=>this.reconnectOpenPopup())}refreshOptionDefaults(){if(this.hasAttribute("default-value"))return;const declared=this.options.filter(option=>option.defaultSelected),defaults=this.multiple?declared:declared.slice(0,1);this._defaultSelected=defaults.map(option=>option.value),this._defaultSelectedOptions=[...defaults],!this._valueDirty&&!this._restoredStateActive&&this.setSelection([...this._defaultSelected],[...this._defaultSelectedOptions])}reflectSelected(){this._selectedOptions=this.resolveOccurrences(this._selected,this._selectedOptions),this._selectedValuesByOption=new Map(this._selectedOptions.map(option=>[option,option.value]));const chosen=new Set(this._selectedOptions);for(const option of this.options)option[SET_OPTION_SELECTED_FROM_OWNER](chosen.has(option))}labelFor(value,occurrenceIndex=0){return(this._selectedOptions[occurrenceIndex]?.value===value?this._selectedOptions[occurrenceIndex]?.label:void 0)??this._selectedOptions.find(option=>option.value===value)?.label??this.options.find(option=>option.value===value)?.label??value}get onlyOption(){if(!this.autoCommitSingleOption)return;const navigable=this.navigableOptions();return navigable.length===1?navigable[0]:void 0}isOptionAvailable(option){return!option.disabled&&!option.inert&&!option.closest("[inert]")}navigableOptions(options=this.options){return options.filter(option=>this.isOptionAvailable(option))}setActiveIndex(next,navigable=this.navigableOptions()){if(next<0||navigable.length===0){this.activeIndex=-1,this.activeOption=void 0;return}const index=Math.min(next,navigable.length-1);this.activeIndex=index,this.activeOption=navigable[index]}reconcileActiveOption(previousActive,previousRawIndex){if(!previousActive&&this.activeIndex<0)return;const navigable=this.navigableOptions();if(previousActive){const preservedIndex=navigable.indexOf(previousActive);if(preservedIndex>=0){this.setActiveIndex(preservedIndex,navigable);return}}if(navigable.length===0){this.setActiveIndex(-1,navigable);return}const pivot=Math.max(0,previousRawIndex);let nearestIndex=0,nearestDistance=Number.POSITIVE_INFINITY,nearestRawIndex=-1;navigable.forEach((option,index)=>{const rawIndex=this.options.indexOf(option),distance=Math.abs(rawIndex-pivot);(distance<nearestDistance||distance===nearestDistance&&rawIndex>=pivot&&nearestRawIndex<pivot)&&(nearestIndex=index,nearestDistance=distance,nearestRawIndex=rawIndex)}),this.setActiveIndex(nearestIndex,navigable)}show(){if(this.open||this.effectiveDisabled)return Promise.resolve();this.resolveTransitionWaiters("lr-after-hide");const settled=this.waitForTransition("lr-after-show");return this.open=!0,settled}hide(){if(!this.open)return Promise.resolve();this.resolveTransitionWaiters("lr-after-show");const settled=this.waitForTransition("lr-after-hide");return this.open=!1,settled}positionListbox(){this.cleanup?.(),this.cleanup=void 0,this.positionedDirection=this.effectiveDirection;const anchor=this.renderRoot.querySelector('[part="trigger"]'),listbox=this.renderRoot.querySelector('[part="listbox"]');!anchor||!listbox||(this.cleanup=place(anchor,listbox,{placement:rtlAwarePlacement(this.placement,this),strategy:this.hoist?"fixed":"absolute"}),this.positioningReady=this.cleanup.ready)}activateListboxOverlay(){this.cleanup?.(),this.cleanup=void 0,this.overlayHandle?.deactivate({restoreFocus:!1}),this.restoreFocusOnClose=!0,this.overlayHandle=activateNonmodalOverlay({host:this,panel:()=>this.renderRoot.querySelector('[part="listbox"]'),onEscape:()=>{this.hide()},onBackdrop:()=>{this.restoreFocusOnClose=!1,this.hide()},restoreFocusTo:this.triggerElement??null}),this.bindDocumentPointer(),this.positionListbox()}teardownListboxOverlay(restoreFocus=this.restoreFocusOnClose){this.cleanup?.(),this.cleanup=void 0,this.positionedDirection=void 0,this.overlayHandle?.deactivate({restoreFocus}),this.overlayHandle=void 0,this.unbindDocumentPointer(),this.restoreFocusOnClose=!0}bindDocumentPointer(){if(!this.isConnected)return;const ownerDocument=this.ownerDocument;if(this.pointerListenerDocument===ownerDocument&&this.pointerListener)return;this.unbindDocumentPointer();const listener=event=>{this.pointerListener!==listener||this.pointerListenerDocument!==ownerDocument||!this.isConnected||this.ownerDocument!==ownerDocument||this.onDocPointer(event)};this.pointerListenerDocument=ownerDocument,this.pointerListener=listener,ownerDocument.addEventListener("pointerdown",listener,!0)}unbindDocumentPointer(){this.pointerListenerDocument&&this.pointerListener&&this.pointerListenerDocument.removeEventListener("pointerdown",this.pointerListener,!0),this.pointerListenerDocument=void 0,this.pointerListener=void 0}reconnectOpenPopup(){!this.isConnected||!this.open||this.activateListboxOverlay()}updated(changed){super.updated(changed),this.syncExternalDescription();const suppressOpenLifecycle=changed.has("open")&&this.suppressedOpenLifecycleGeneration===this.openStateGeneration,shouldRefreshPosition=this.open&&this.isConnected&&(changed.has("placement")||changed.has("hoist")||this.positionedDirection!==this.effectiveDirection);changed.has("open")&&!this.openVetoed?this.open&&this.isConnected?(this.activateListboxOverlay(),!this._isFirstUpdate&&!suppressOpenLifecycle&&this.settleTransition("lr-after-show")):this.open?this.teardownListboxOverlay(!1):(this.teardownListboxOverlay(),!this._isFirstUpdate&&!suppressOpenLifecycle&&this.settleTransition("lr-after-hide")):changed.has("open")&&this.openVetoed?(this.restoreFocusOnClose=!0,shouldRefreshPosition&&this.positionListbox()):shouldRefreshPosition&&this.positionListbox(),(changed.has("touched")||changed.has("required")||changed.has("value"))&&this.toggleAttribute("data-invalid",this.touched&&!this.internals.validity.valid),changed.has("open")&&(this.pendingOpenTransitionStart=void 0,this.suppressedOpenLifecycleGeneration=void 0)}async settleTransition(event){const token=++this.transitionToken;if(await this.updateComplete,this.transitionToken===token){if(event==="lr-after-show"){for(;this.open;){const readiness=this.positioningReady,positioned=await readiness;if(this.transitionToken!==token)return;if(positioned)break;if(readiness===this.positioningReady){this.forceCloseOpenState();return}}if(await this.updateComplete,this.transitionToken!==token)return}if(this.isConnected){const view=this.ownerDocument.defaultView;if(view&&await new Promise(resolve=>view.requestAnimationFrame(()=>resolve())),this.transitionToken!==token)return;const animations=this.renderRoot.querySelector('[part="listbox"]')?.getAnimations({subtree:!0})??[];if(await Promise.all(animations.map(animation=>animation.finished.catch(()=>{}))),this.transitionToken!==token)return}this.emit(event),this.resolveTransitionWaiters(event)}}waitForTransition(event){return new Promise(resolve=>{const waiters=this.transitionWaiters.get(event)??new Set;waiters.add(resolve),this.transitionWaiters.set(event,waiters)})}resolveTransitionWaiters(event){const waiters=this.transitionWaiters.get(event);if(waiters){this.transitionWaiters.delete(event);for(const resolve of waiters)resolve()}}emitValueEvents(){dispatchNativeInputEvent(this),this.emit("lr-input",{value:this.value}),dispatchNativeEvent(this,"change"),this.emit("lr-change",{value:this.value})}selectOption(option){if(this.effectiveDisabled||!this.isOptionAvailable(option))return;if(this.hasInteracted=!0,this._restoredStateActive=!1,this._valueDirty=!0,this.multiple){const selectedIndex=this._selectedOptions.indexOf(option),selected=selectedIndex>=0,occurrences=selected?this._selectedOptions.filter((_,index)=>index!==selectedIndex):[...this._selectedOptions,option],values=selected?this._selected.filter((_,index)=>index!==selectedIndex):[...this._selected,option.value];this.setSelection(values,occurrences),this.emitValueEvents();return}const changed=option!==this._selectedOptions[0]||option.value!==this._selected[0];this.setSelection([option.value],[option]),this.hide(),changed&&this.emitValueEvents()}removeValueAt(index){this.effectiveDisabled||index<0||index>=this._selected.length||(this._restoredStateActive=!1,this._valueDirty=!0,this.setSelection(this._selected.filter((_,candidateIndex)=>candidateIndex!==index),this._selectedOptions.filter((_,candidateIndex)=>candidateIndex!==index)),this.emitValueEvents())}clear(){this.effectiveDisabled||this._selected.length===0||(this._restoredStateActive=!1,this._valueDirty=!0,this.setSelection([],[]),this.emitValueEvents(),this.emit("lr-clear"))}removeTag(value,index,event){event.stopPropagation(),this._selected[index]===value&&(this.removeValueAt(index),this.updateComplete.then(()=>{const buttons=[...this.renderRoot.querySelectorAll('[part~="tag__remove-button"]')];(buttons[Math.min(index,buttons.length-1)]??this.triggerElement)?.focus()}))}typeAhead(char){this.clearTypeAheadTimer(),this.typeAheadBuffer+=char.toLocaleLowerCase(this.effectiveLocale);const ownerWindow=this.ownerDocument.defaultView;if(this.isConnected&&ownerWindow){const generation=this.typeAheadTimerGeneration;this.typeAheadTimerWindow=ownerWindow,this.typeAheadTimer=ownerWindow.setTimeout(()=>{this.typeAheadTimerGeneration!==generation||!this.isConnected||this.ownerDocument.defaultView!==ownerWindow||(this.typeAheadTimer=void 0,this.typeAheadTimerWindow=void 0,this.typeAheadBuffer="")},500)}const navigable=this.navigableOptions();if(!navigable.length)return;const currentOption=this.open?navigable[this.activeIndex]:this._selectedOptions[this._selectedOptions.length-1],currentIndex=navigable.indexOf(currentOption),n=navigable.length;for(let step=1;step<=n;step++){const idx=(currentIndex+step+n)%n,candidate=navigable[idx];if(candidate!==void 0&&candidate.label.toLocaleLowerCase(this.effectiveLocale).startsWith(this.typeAheadBuffer)){if(this.open){this.setActiveIndex(idx,navigable);return}if(this.multiple&&this._selectedOptions.includes(candidate))continue;this.selectOption(candidate);return}}}clearTypeAheadTimer(){this.typeAheadTimerGeneration+=1,this.typeAheadTimer!==void 0&&this.typeAheadTimerWindow?.clearTimeout(this.typeAheadTimer),this.typeAheadTimer=void 0,this.typeAheadTimerWindow=void 0}renderRows(options,activeId){const out=[],chosen=new Set(this._selectedOptions);let currentGroup,groupRows=[],groupIndex=0;const flushGroup=()=>{if(groupRows.length!==0){if(currentGroup){const labelId=`${this.listId}-group-${groupIndex++}`;out.push(html`<div role="group" aria-labelledby=${labelId}>
2
2
  <div id=${labelId} class="group-label" part="group-label">${currentGroup}</div>
3
3
  ${groupRows}
4
4
  </div>`)}else out.push(...groupRows);groupRows=[]}};return options.forEach((o,i)=>{o.group!==currentGroup&&(flushGroup(),currentGroup=o.group);const id=`${this.listId}-opt-${i}`,selected=chosen.has(o);groupRows.push(html`<div
@@ -32,7 +32,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
32
32
  >
33
33
  ${closeIcon()}
34
34
  </button>
35
- </span>`}render(){const options=this.options,navigable=this.navigableOptions(options),active=this.activeIndex>=0?navigable[this.activeIndex]:void 0,activeId=active?`${this.listId}-opt-${options.indexOf(active)}`:"",selectedLabel=this._selected.length>0?this.labelFor(this._selected[0]):"",selectedLabels=this._selected.map((value,index)=>this.labelFor(value,index)).join(", "),hasValue=this._selected.length>0,shownValues=this.maxOptionsVisible>0?this._selected.slice(0,this.maxOptionsVisible):this._selected,overflow=this._selected.length-shownValues.length,showClear=(this.withClear||this.clearable)&&hasValue,hasHint=this.slotPresence.has("hint")||this.slotPresence.has("help-text")||this.hint.length>0||this.helpText.length>0||this.withHint,hasError=this.slotPresence.has("error")||this.errorText.length>0,hasLabel=this.slotPresence.has("label")||this.label.length>0||this.withLabel,describedBy=[this.multiple&&hasValue?this.valueTextId:"",hasError?"select-error":"",hasHint?"select-hint":""].filter(Boolean).join(" "),isSingleOption=this.autoCommitSingleOption&&navigable.length===1;return html`
35
+ </span>`}render(){const options=this.options,navigable=this.navigableOptions(options),active=this.activeIndex>=0?navigable[this.activeIndex]:void 0,activeId=active?`${this.listId}-opt-${options.indexOf(active)}`:"",selectedLabel=this._selected.length>0?this.labelFor(this._selected[0]):"",selectedLabels=this._selected.map((value,index)=>this.labelFor(value,index)).join(", "),hasValue=this._selected.length>0,shownValues=this.maxOptionsVisible>0?this._selected.slice(0,this.maxOptionsVisible):this._selected,overflow=this._selected.length-shownValues.length,showClear=(this.withClear||this.clearable)&&hasValue,hasHint=this.slotPresence.has("hint")||this.slotPresence.has("help-text")||(this.hint??"").length>0||(this.helpText??"").length>0||this.withHint,hasError=this.slotPresence.has("error")||(this.errorText??"").length>0,hasLabel=this.slotPresence.has("label")||(this.label??"").length>0||this.withLabel,describedBy=this.localDescriptionIds=[this.multiple&&hasValue?this.valueTextId:"",hasError?"select-error":"",hasHint?"select-hint":""].filter(Boolean).join(" "),isSingleOption=this.autoCommitSingleOption&&navigable.length===1;return html`
36
36
  <div part="form-control">
37
37
  <label
38
38
  part="form-control-label"