@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
@@ -46,6 +46,10 @@ export interface LyraLocaleChangeDetail{value:string;previousValue:string;direct
46
46
  * until the host sets it or the user actually picks a row. This mirrors a native `<select>`
47
47
  * rendering its first option's text without that being a committed selection.
48
48
  *
49
+ * When a required picker is still empty, its library-owned validation message follows its current
50
+ * `.strings` and effective locale. A caller-provided `setCustomValidity()` message remains the
51
+ * higher-precedence validation layer until the caller clears it.
52
+ *
49
53
  * Built directly on the shared trigger-button/`aria-activedescendant` listbox technique
50
54
  * `<lr-select>` uses (not composed from it) — a plain closed list, no filter/free-text mode; a
51
55
  * locale catalog is realistically dozens of rows, not thousands, so `<lr-combobox>`'s filterable
@@ -66,6 +70,10 @@ export interface LyraLocaleChangeDetail{value:string;previousValue:string;direct
66
70
  * ancestor theme wrapper override the active size tier. A value set directly on the locale picker
67
71
  * still wins through normal custom-property inheritance.
68
72
  *
73
+ * Host aria-describedby targets supplement local error/hint guidance on the trigger. The
74
+ * relationships track target replacement, missing IDs, removal/reinsertion, reconnect, and adoption.
75
+ * Removed label/hint/error-text content is safely omitted without changing null property readback.
76
+ *
69
77
  * @customElement lr-locale-picker
70
78
  * @event lr-change - The selection changed. `detail: { value, previousValue, direction }`, where
71
79
  * `direction` is the picked locale's `'ltr'`/`'rtl'` writing direction. Cancelable —
@@ -150,7 +158,7 @@ get open():boolean;set open(next:boolean);
150
158
  * tag rename with no attribute rewrite. */
151
159
  size:LyraSize;private activeIndex;private touched;private hasHintSlot;private hasErrorSlot;private hasLabelSlot;private registryTick;private triggerElement?;private internals;private validityController;
152
160
  /** Consumer-supplied validation message reflected through `custom-error`. */
153
- customError:string|null;private listId;private controlId;private cleanup?;private pointerListenerDocument?;private pointerListener?;private stopRegistrySubscription?;private _value;private _open;private _fieldsetDisabled;private _name;private _disabled;private _required;private _defaultValue;private _valueDirty;private settingDefaultValue;private reflectingDefaultValue;private typeAheadBuffer;private typeAheadTimer?;private typeAheadTimerWindow?;private typeAheadTimerGeneration;private activeScrollGeneration;constructor();
161
+ customError:string|null;private listId;private controlId;private cleanup?;private overlayHandle?;private pointerListenerDocument?;private pointerListener?;private stopRegistrySubscription?;private _value;private _open;private _fieldsetDisabled;private _name;private _disabled;private _required;private _defaultValue;private _valueDirty;private settingDefaultValue;private reflectingDefaultValue;private typeAheadBuffer;private typeAheadTimer?;private typeAheadTimerWindow?;private typeAheadTimerGeneration;private activeScrollGeneration;private localizedValidityLocale;private localizedIntrinsicMessage;constructor();
154
162
  /** Reads both component state and the UA's synchronous fieldset cascade before public actions. */
155
163
  private get liveDisabled();
156
164
  /** Focus the internal trigger unless the form control is effectively disabled. */
@@ -160,7 +168,7 @@ blur():void;
160
168
  /** Activates the internal trigger -- `HTMLElement.prototype.click()` on a custom element with
161
169
  * no native click semantics is otherwise a silent no-op. Mirrors `<lr-select>`'s identical
162
170
  * `click()`. */
163
- click():void;get form():HTMLFormElement|null;set form(owner:FormOwnerValue);getForm():HTMLFormElement|null;get labels():NodeList;get validity():ValidityState;get validationMessage():string;get willValidate():boolean;connectedCallback():void;disconnectedCallback():void;adoptedCallback():void;protected willUpdate(changed:PropertyValues):void;
171
+ click():void;get form():HTMLFormElement|null;set form(owner:FormOwnerValue);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;disconnectedCallback():void;adoptedCallback():void;protected willUpdate(changed:PropertyValues):void;
164
172
  /** The current locale tag (empty string when nothing is committed). */
165
173
  get value():string;set value(next:string);
166
174
  /** Reflected current reset default; changing it never overwrites a dirty live `value`. */
@@ -175,9 +183,19 @@ get effectiveDisabled():boolean;
175
183
  * exactly like a native control — a real `<input required disabled>` matches neither `:valid` nor
176
184
  * `:invalid`. Without this guard a `<lr-locale-picker required disabled>` kept publishing
177
185
  * `valueMissing` and `:state(invalid)`, which is what painted every disabled picker with the
178
- * documented `lr-locale-picker:state(user-invalid)` error styling.
186
+ * documented `lr-locale-picker:state(user-invalid)` error styling. This only writes the
187
+ * library-owned intrinsic layer; `AnchoredValidityController` preserves a caller's custom error
188
+ * while the localized required message changes.
179
189
  */
180
190
  private updateValidity;
191
+ /** A localized catalog can change without a named Lit property change, so compare both the
192
+ * resolved locale and the current intrinsic message during each update. The comparison makes
193
+ * the controller write only when a library-owned validation input actually changed. */
194
+ private refreshLocalizedIntrinsicValidity;private hasMissingRequiredValue;
195
+ /** Lit reflects a changed property after rendering. This component's localizer resolves the
196
+ * host attribute, so synchronize an explicit locale before either render-time or intrinsic
197
+ * validation text asks it for the effective message locale. */
198
+ private syncLocaleAttributeForLocalization;
181
199
  /** Whether constraint validation is currently barred. Shares the library-wide predicate rather
182
200
  * than re-listing the conditions, so this control cannot implement three of them and miss the
183
201
  * fourth. This picker has no `readonly` of its own; the shared predicate simply never sees one. */
@@ -214,7 +232,7 @@ private get normalizedEntries();
214
232
  /** The tag actually shown in the trigger: the committed `value` once set, else a live preview
215
233
  * of `effectiveLocale` -- never a committed selection, see the class doc's value/preview
216
234
  * split. */
217
- private get previewTag();private entryFor;private labelFor;private show;private hide;private onDocPointer;private bindDocumentPointer;private unbindDocumentPointer;private syncPopup;protected updated(changed:PropertyValues):void;
235
+ private get previewTag();private entryFor;private labelFor;private show;private hide;private dismissFromEscape;private onDocPointer;private bindDocumentPointer;private unbindDocumentPointer;private activatePopupOverlay;private deactivatePopupOverlay;private syncPopup;protected updated(changed:PropertyValues):void;
218
236
  /** Commits `tag`: sets `value`, closes the popup, then emits a cancelable `lr-change` --
219
237
  * applying `setLyraLocale(tag)` itself only when the listener doesn't veto it. Unconditional
220
238
  * on every explicit pick (no reselect-guard), mirroring `<lr-model-select>`'s identical
@@ -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{LyraElement}from"../../../internal/lyra-element.js";import{installFormControlLabelSupport}from"../../../internal/form-control-labels.js";installFormControlLabelSupport();import{deferredPlace as place}from"../../../internal/anchored-overlay-runtime.js";import{hostAriaLabel,nextId}from"../../../internal/a11y.js";import{chevronIcon}from"../../../internal/icons.js";import{AnchoredValidityController,VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{syncValidityStates}from"../../../internal/custom-states.js";import{getLyraLocaleDirection,getRegisteredLyraLocales,subscribeLyraLocaleRegistry,setLyraLocale}from"../../../internal/localization-runtime.js";import{localeNativeName}from"../../media/flag/language-map.js";import{sizes}from"../../../internal/sizes.styles.js";import{styles}from"./locale-picker.styles.js";import{declaredDefaultConverter,trueDefaultBooleanFromAttributeConverter as trueDefaultBooleanConverter}from"../../../internal/converters.js";import{attachInternalsSafely,getFormOwner,installCustomErrorProperty,isBarredFromValidation,setFormOwner}from"../../../internal/form-associated.js";import{installInvalidEventAlias}from"../../../internal/invalid-event-alias.js";import{relayNativeEvent}from"../../../internal/native-event-relay.js";import{LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_localePickerLabel,LYRA_DEFAULT_localePickerRequired}from"../../../internal/default-strings.generated.js";const MAX_LOCALE_ENTRIES=512;function snapshotLocaleCatalog(source){if(!Array.isArray(source))return Object.freeze([]);const rows=[];for(let index=0;index<Math.min(source.length,MAX_LOCALE_ENTRIES);index+=1)try{const raw=source[index];if(typeof raw=="string"){raw.length>0&&rows.push(raw);continue}if(raw===null||typeof raw!="object")continue;const candidate=raw,tag=candidate.tag,label=candidate.label,country=candidate.country;if(typeof tag!="string"||tag.length===0||label!==void 0&&typeof label!="string"||country!==void 0&&typeof country!="string")continue;rows.push(Object.freeze({tag,...label===void 0?{}:{label},...country===void 0?{}:{country}}))}catch{}return Object.freeze(rows)}class LyraLocalePicker extends LyraElement{static{this.defaultStrings={...super.defaultStrings,fieldRequired:LYRA_DEFAULT_fieldRequired,localePickerLabel:LYRA_DEFAULT_localePickerLabel,localePickerRequired:LYRA_DEFAULT_localePickerRequired}}static{this.formAssociated=!0}static{this.styles=[LyraElement.styles,sizes,styles]}static{this.properties={customError:{attribute:"custom-error",reflect:!0,noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0},required:{type:Boolean,reflect:!0,noAccessor:!0},value:{attribute:!1,noAccessor:!0},defaultValue:{attribute:"value",reflect:!0,useDefault:!0,noAccessor:!0},name:{reflect:!0,noAccessor:!0}}}get locales(){return this._locales}set locales(next){const previous=this._locales;this._locales=next===void 0?void 0:snapshotLocaleCatalog(next),this.requestUpdate("locales",previous)}get open(){return this._open}set open(next){const old=this._open,liveDisabled=this.effectiveDisabled||typeof this.matches=="function"&&this.matches(":disabled");if(this._open=!!next&&!liveDisabled,this._open===old){next&&!this._open&&this.hasAttribute("open")&&this.removeAttribute("open");return}this._open||(this.activeIndex=-1),this.requestUpdate("open",old)}constructor(){super(),this.showFlags=!0,this.label="",this.hint="",this.errorText="",this.size="m",this.activeIndex=-1,this.touched=!1,this.hasHintSlot=!1,this.hasErrorSlot=!1,this.hasLabelSlot=!1,this.registryTick=0,this.listId=nextId("locale-picker-list"),this.controlId=nextId("locale-picker-control"),this._value="",this._open=!1,this._fieldsetDisabled=!1,this._name="",this._disabled=!1,this._required=!1,this._defaultValue="",this._valueDirty=!1,this.settingDefaultValue=!1,this.reflectingDefaultValue=!1,this.typeAheadBuffer="",this.typeAheadTimerGeneration=0,this.activeScrollGeneration=0,this.onDocPointer=e=>{e.composedPath().includes(this)||this.hide()},this.onTriggerClick=()=>{this.liveDisabled||(this.open?this.hide():this.show())},this.onTriggerBlur=event=>{this.liveDisabled||(this.touched=!0),this.syncCustomStates(),this.hide(),relayNativeEvent(this,event)},this.onTriggerFocus=event=>{if(this.liveDisabled){event.stopPropagation();return}relayNativeEvent(this,event)},this.onLabelSlotChange=e=>{this.hasLabelSlot=e.target.assignedElements({flatten:!0}).length>0},this.onHintSlotChange=e=>{this.hasHintSlot=e.target.assignedElements({flatten:!0}).length>0},this.onErrorSlotChange=e=>{this.hasErrorSlot=e.target.assignedElements({flatten:!0}).length>0},this.onKeyDown=e=>{if(this.liveDisabled)return;const rows=this.normalizedEntries;switch(e.key){case"ArrowDown":if(e.preventDefault(),!this.open)return this.show();this.setActiveIndex(Math.min(rows.length-1,this.activeIndex+1));break;case"ArrowUp":if(e.preventDefault(),!this.open)return this.show();this.setActiveIndex(Math.max(0,this.activeIndex-1));break;case"Enter":case" ":if(this.open){e.preventDefault();const activeRow=rows[this.activeIndex];this.activeIndex>=0&&activeRow?this.commit(activeRow.tag):this.hide()}break;case"Escape":this.open&&(e.preventDefault(),this.hide());break;case"Home":this.open&&(e.preventDefault(),this.setActiveIndex(0));break;case"End":this.open&&(e.preventDefault(),this.setActiveIndex(rows.length-1));break;default:e.key.length===1&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&this.typeAhead(e.key);break}},this.onListboxMouseDown=e=>{e.target.closest('[part="option"]')&&e.preventDefault()},this.onListboxClick=e=>{if(this.liveDisabled)return;const tag=e.target.closest('[part="option"]')?.dataset.value;tag!==void 0&&this.commit(tag)},this.internals=attachInternalsSafely(this),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.internals.setFormValue("")}get liveDisabled(){return this.effectiveDisabled||this.matches(":disabled")}focus(options){this.liveDisabled||this.triggerElement?.focus(options)}blur(){this.triggerElement?.blur()}click(){this.liveDisabled||this.triggerElement?.click()}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.stopRegistrySubscription=subscribeLyraLocaleRegistry(()=>{this.registryTick+=1}),this.hasUpdated&&this.open&&queueMicrotask(()=>this.syncPopup())}disconnectedCallback(){super.disconnectedCallback(),this.cleanup?.(),this.cleanup=void 0,this.unbindDocumentPointer(),this.stopRegistrySubscription?.(),this.stopRegistrySubscription=void 0,this.clearTypeAheadTimer(),this.activeScrollGeneration+=1,this.typeAheadBuffer="",this.open=!1}adoptedCallback(){super.adoptedCallback(),this.cleanup?.(),this.cleanup=void 0,this.unbindDocumentPointer(),this.clearTypeAheadTimer()}willUpdate(changed){super.willUpdate(changed),this.open&&(changed.has("locales")||changed.has("registryTick"))&&this.activeIndex>=0&&(this.activeIndex=Math.min(this.activeIndex,this.normalizedEntries.length-1),this.queueActiveScroll()),this.hasUpdated||(this.hasHintSlot=Array.from(this.children??[]).some(el=>el.getAttribute("slot")==="hint"),this.hasErrorSlot=Array.from(this.children??[]).some(el=>el.getAttribute("slot")==="error"),this.hasLabelSlot=Array.from(this.children??[]).some(el=>el.getAttribute("slot")==="label"))}get value(){return this._value}set value(next){const old=this._value;this.settingDefaultValue||(this._valueDirty=!0),this._value=next??"",this.internals.setFormValue(this._value),this.updateValidity(),this.requestUpdate("value",old)}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.restoreLiveValueFromDefault(),this.requestUpdate("defaultValue",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._disabled&&this.hide(),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 effectiveDisabled(){return this.disabled||this._fieldsetDisabled}updateValidity(){this.isBarred()?this.validityController.setValidity({}):this.required&&!this._value?this.validityController.setValidity({valueMissing:!0},this.localize("localePickerRequired")):this.validityController.setValidity({}),this.syncCustomStates()}isBarred(){return isBarredFromValidation(this,this.internals)}syncCustomStates(){syncValidityStates(this.internals,{required:this.required,hasInteracted:this.touched,barred:this.isBarred()})}formResetCallback(){this.touched=!1,this.restoreLiveValueFromDefault()}restoreLiveValueFromDefault(){this.settingDefaultValue=!0;try{this.value=this._defaultValue}finally{this.settingDefaultValue=!1}this._valueDirty=!1}formStateRestoreCallback(state2,_mode){this.value=typeof state2=="string"?state2:""}formDisabledCallback(disabled){this._fieldsetDisabled=disabled,disabled&&this.hide(),this.updateValidity(),this.requestUpdate()}checkValidity(){return this.internals.checkValidity()}reportValidity(){return this.touched=!0,this.syncCustomStates(),this.internals.reportValidity()}setCustomValidity(message){this.validityController.setCustomValidity(message??""),this.syncCustomStates(),this.toggleAttribute("data-invalid",this.touched&&!this.internals.validity.valid),this.requestUpdate()}get normalizedEntries(){const raw=this.locales;return raw!==void 0?raw.map(entry=>typeof entry=="string"?{tag:entry,label:localeNativeName(entry)}:{tag:entry.tag,label:entry.label??localeNativeName(entry.tag),country:entry.country}):getRegisteredLyraLocales().map(tag=>({tag,label:localeNativeName(tag)}))}get previewTag(){return this._value||this.effectiveLocale}entryFor(tag){return this.normalizedEntries.find(e=>e.tag===tag)}labelFor(tag){return this.entryFor(tag)?.label??localeNativeName(tag)}show(){this.open||this.liveDisabled||(this.open=!0)}hide(){this.open&&(this.open=!1,this.setActiveIndex(-1))}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)}unbindDocumentPointer(){this.pointerListenerDocument&&this.pointerListener&&this.pointerListenerDocument.removeEventListener("pointerdown",this.pointerListener),this.pointerListenerDocument=void 0,this.pointerListener=void 0}syncPopup(){if(this.cleanup?.(),this.cleanup=void 0,!this.open||!this.isConnected){this.unbindDocumentPointer();return}this.bindDocumentPointer();const anchor=this.renderRoot.querySelector('[part="trigger"]'),listbox=this.renderRoot.querySelector('[part="listbox"]');anchor&&listbox&&(this.cleanup=place(anchor,listbox))}updated(changed){super.updated(changed),(changed.has("open")||this.open&&(changed.has("locales")||changed.has("registryTick")))&&this.syncPopup(),(changed.has("touched")||changed.has("required")||changed.has("value"))&&this.toggleAttribute("data-invalid",this.touched&&!this.internals.validity.valid)}commit(tag){const previousValue=this._value;this.value=tag,this.hide(),this.emit("lr-change",{value:tag,previousValue,direction:getLyraLocaleDirection(tag)},{cancelable:!0}).defaultPrevented||setLyraLocale(tag)}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 rows=this.normalizedEntries;if(!rows.length)return;const currentTag=this.open?rows[this.activeIndex]?.tag:this.previewTag,currentIndex=rows.findIndex(r=>r.tag===currentTag),n=rows.length;for(let step=1;step<=n;step++){const idx=(currentIndex+step+n)%n,row=rows[idx];if(row&&row.label.toLocaleLowerCase(this.effectiveLocale).startsWith(this.typeAheadBuffer)){this.open?this.setActiveIndex(idx):this.commit(row.tag);return}}}clearTypeAheadTimer(){this.typeAheadTimerGeneration+=1,this.typeAheadTimer!==void 0&&this.typeAheadTimerWindow?.clearTimeout(this.typeAheadTimer),this.typeAheadTimer=void 0,this.typeAheadTimerWindow=void 0}setActiveIndex(index){const last=this.normalizedEntries.length-1,next=last<0||index<0?-1:Math.min(last,index);this.activeIndex=next,this.queueActiveScroll()}queueActiveScroll(){const generation=++this.activeScrollGeneration,index=this.activeIndex;index<0||!this.open||this.updateComplete.then(()=>{generation!==this.activeScrollGeneration||!this.isConnected||!this.open||this.activeIndex!==index||this.shadowRoot?.getElementById(`${this.listId}-opt-${index}`)?.scrollIntoView({block:"nearest"})})}renderRows(rows,activeId){return rows.map((entry,i)=>{const id=`${this.listId}-opt-${i}`,selected=entry.tag===this._value;return html`<div
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{LyraElement}from"../../../internal/lyra-element.js";import{installFormControlLabelSupport}from"../../../internal/form-control-labels.js";installFormControlLabelSupport();import{deferredPlace as place}from"../../../internal/anchored-overlay-runtime.js";import{hostAriaLabel,nextId}from"../../../internal/a11y.js";import{chevronIcon}from"../../../internal/icons.js";import{AnchoredValidityController,VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{syncValidityStates}from"../../../internal/custom-states.js";import{activateNonmodalOverlay}from"../../../internal/nonmodal-overlay-manager.js";import{getLyraLocaleDirection,getRegisteredLyraLocales,subscribeLyraLocaleRegistry,setLyraLocale}from"../../../internal/localization-runtime.js";import{localeNativeName}from"../../media/flag/language-map.js";import{sizes}from"../../../internal/sizes.styles.js";import{styles}from"./locale-picker.styles.js";import{declaredDefaultConverter,trueDefaultBooleanFromAttributeConverter as trueDefaultBooleanConverter}from"../../../internal/converters.js";import{attachInternalsSafely,getFormOwner,installCustomErrorProperty,isBarredFromValidation,setFormOwner}from"../../../internal/form-associated.js";import{installInvalidEventAlias}from"../../../internal/invalid-event-alias.js";import{relayNativeEvent}from"../../../internal/native-event-relay.js";import{LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_localePickerLabel,LYRA_DEFAULT_localePickerRequired}from"../../../internal/default-strings.generated.js";const MAX_LOCALE_ENTRIES=512;function snapshotLocaleCatalog(source){if(!Array.isArray(source))return Object.freeze([]);const rows=[];for(let index=0;index<Math.min(source.length,MAX_LOCALE_ENTRIES);index+=1)try{const raw=source[index];if(typeof raw=="string"){raw.length>0&&rows.push(raw);continue}if(raw===null||typeof raw!="object")continue;const candidate=raw,tag=candidate.tag,label=candidate.label,country=candidate.country;if(typeof tag!="string"||tag.length===0||label!==void 0&&typeof label!="string"||country!==void 0&&typeof country!="string")continue;rows.push(Object.freeze({tag,...label===void 0?{}:{label},...country===void 0?{}:{country}}))}catch{}return Object.freeze(rows)}class LyraLocalePicker extends LyraElement{static{this.defaultStrings={...super.defaultStrings,fieldRequired:LYRA_DEFAULT_fieldRequired,localePickerLabel:LYRA_DEFAULT_localePickerLabel,localePickerRequired:LYRA_DEFAULT_localePickerRequired}}static{this.formAssociated=!0}static{this.styles=[LyraElement.styles,sizes,styles]}static{this.properties={customError:{attribute:"custom-error",reflect:!0,noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0},required:{type:Boolean,reflect:!0,noAccessor:!0},value:{attribute:!1,noAccessor:!0},defaultValue:{attribute:"value",reflect:!0,useDefault:!0,noAccessor:!0},name:{reflect:!0,noAccessor:!0}}}get locales(){return this._locales}set locales(next){const previous=this._locales;this._locales=next===void 0?void 0:snapshotLocaleCatalog(next),this.requestUpdate("locales",previous)}get open(){return this._open}set open(next){const old=this._open,liveDisabled=this.effectiveDisabled||typeof this.matches=="function"&&this.matches(":disabled");if(this._open=!!next&&!liveDisabled,this._open===old){next&&!this._open&&this.hasAttribute("open")&&this.removeAttribute("open");return}this._open||(this.activeIndex=-1),this.requestUpdate("open",old)}constructor(){super(),this.showFlags=!0,this.label="",this.hint="",this.errorText="",this.size="m",this.activeIndex=-1,this.touched=!1,this.hasHintSlot=!1,this.hasErrorSlot=!1,this.hasLabelSlot=!1,this.registryTick=0,this.listId=nextId("locale-picker-list"),this.controlId=nextId("locale-picker-control"),this._value="",this._open=!1,this._fieldsetDisabled=!1,this._name="",this._disabled=!1,this._required=!1,this._defaultValue="",this._valueDirty=!1,this.settingDefaultValue=!1,this.reflectingDefaultValue=!1,this.typeAheadBuffer="",this.typeAheadTimerGeneration=0,this.activeScrollGeneration=0,this.localizedValidityLocale="",this.localizedIntrinsicMessage="",this.localDescriptionIds="",this.onDocPointer=e=>{if(!e.composedPath().includes(this)){if(this.overlayHandle?.isActive()){this.overlayHandle.dismissBackdrop();return}this.hide()}},this.onTriggerClick=()=>{this.liveDisabled||(this.open?this.hide():this.show())},this.onTriggerBlur=event=>{this.liveDisabled||(this.touched=!0),this.syncCustomStates(),this.hide(),relayNativeEvent(this,event)},this.onTriggerFocus=event=>{if(this.liveDisabled){event.stopPropagation();return}relayNativeEvent(this,event)},this.onLabelSlotChange=e=>{this.hasLabelSlot=e.target.assignedElements({flatten:!0}).length>0},this.onHintSlotChange=e=>{this.hasHintSlot=e.target.assignedElements({flatten:!0}).length>0},this.onErrorSlotChange=e=>{this.hasErrorSlot=e.target.assignedElements({flatten:!0}).length>0},this.onKeyDown=e=>{if(this.liveDisabled)return;const rows=this.normalizedEntries;switch(e.key){case"ArrowDown":if(e.preventDefault(),!this.open)return this.show();this.setActiveIndex(Math.min(rows.length-1,this.activeIndex+1));break;case"ArrowUp":if(e.preventDefault(),!this.open)return this.show();this.setActiveIndex(Math.max(0,this.activeIndex-1));break;case"Enter":case" ":if(this.open){e.preventDefault();const activeRow=rows[this.activeIndex];this.activeIndex>=0&&activeRow?this.commit(activeRow.tag):this.hide()}break;case"Escape":this.open&&(!this.overlayHandle?.isActive()||this.overlayHandle.isTopmost())&&(e.preventDefault(),this.dismissFromEscape());break;case"Home":this.open&&(e.preventDefault(),this.setActiveIndex(0));break;case"End":this.open&&(e.preventDefault(),this.setActiveIndex(rows.length-1));break;default:e.key.length===1&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&this.typeAhead(e.key);break}},this.onListboxMouseDown=e=>{e.target.closest('[part="option"]')&&e.preventDefault()},this.onListboxClick=e=>{if(this.liveDisabled)return;const tag=e.target.closest('[part="option"]')?.dataset.value;tag!==void 0&&this.commit(tag)},this.internals=attachInternalsSafely(this),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.internals.setFormValue("")}get liveDisabled(){return this.effectiveDisabled||this.matches(":disabled")}focus(options){this.liveDisabled||this.triggerElement?.focus(options)}blur(){this.triggerElement?.blur()}click(){this.liveDisabled||this.triggerElement?.click()}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.triggerElement??null;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.syncLocaleAttributeForLocalization(),this.updateValidity(),this.stopRegistrySubscription=subscribeLyraLocaleRegistry(()=>{this.registryTick+=1}),this.hasUpdated&&this.open&&queueMicrotask(()=>this.syncPopup())}disconnectedCallback(){this.releaseExternalDescription(),super.disconnectedCallback(),this.cleanup?.(),this.cleanup=void 0,this.deactivatePopupOverlay(!1),this.stopRegistrySubscription?.(),this.stopRegistrySubscription=void 0,this.clearTypeAheadTimer(),this.activeScrollGeneration+=1,this.typeAheadBuffer="",this.open=!1}adoptedCallback(){super.adoptedCallback(),this.releaseExternalDescription(),this.hasUpdated&&this.syncExternalDescription(),this.cleanup?.(),this.cleanup=void 0,this.unbindDocumentPointer(),this.overlayHandle?.suspend(),this.clearTypeAheadTimer(),this.open&&queueMicrotask(()=>this.syncPopup())}willUpdate(changed){super.willUpdate(changed),changed.has("locale")&&this.syncLocaleAttributeForLocalization(),this.hasUpdated&&this.refreshLocalizedIntrinsicValidity(changed),this.open&&(changed.has("locales")||changed.has("registryTick"))&&this.activeIndex>=0&&(this.activeIndex=Math.min(this.activeIndex,this.normalizedEntries.length-1),this.queueActiveScroll()),this.hasUpdated||(this.hasHintSlot=Array.from(this.children??[]).some(el=>el.getAttribute("slot")==="hint"),this.hasErrorSlot=Array.from(this.children??[]).some(el=>el.getAttribute("slot")==="error"),this.hasLabelSlot=Array.from(this.children??[]).some(el=>el.getAttribute("slot")==="label"))}get value(){return this._value}set value(next){const old=this._value;this.settingDefaultValue||(this._valueDirty=!0),this._value=next??"",this.internals.setFormValue(this._value),this.updateValidity(),this.requestUpdate("value",old)}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.restoreLiveValueFromDefault(),this.requestUpdate("defaultValue",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._disabled&&this.hide(),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 effectiveDisabled(){return this.disabled||this._fieldsetDisabled}updateValidity(){this.localizedValidityLocale=this.effectiveMessageLocale;const valueMissing=this.hasMissingRequiredValue(),message=valueMissing?this.localize("localePickerRequired"):"";this.localizedIntrinsicMessage=message,valueMissing?this.validityController.setValidity({valueMissing:!0},message):this.validityController.setValidity({}),this.syncCustomStates()}refreshLocalizedIntrinsicValidity(changed){const locale=this.effectiveMessageLocale,message=this.hasMissingRequiredValue()?this.localize("localePickerRequired"):"";(changed.has("strings")||locale!==this.localizedValidityLocale||message!==this.localizedIntrinsicMessage)&&this.updateValidity()}hasMissingRequiredValue(){return!this.isBarred()&&this.required&&!this._value}syncLocaleAttributeForLocalization(){this.locale?this.getAttribute("locale")!==this.locale&&this.setAttribute("locale",this.locale):this.hasAttribute("locale")&&this.removeAttribute("locale")}isBarred(){return isBarredFromValidation(this,this.internals)}syncCustomStates(){syncValidityStates(this.internals,{required:this.required,hasInteracted:this.touched,barred:this.isBarred()})}formResetCallback(){this.touched=!1,this.restoreLiveValueFromDefault()}restoreLiveValueFromDefault(){this.settingDefaultValue=!0;try{this.value=this._defaultValue}finally{this.settingDefaultValue=!1}this._valueDirty=!1}formStateRestoreCallback(state2,_mode){this.value=typeof state2=="string"?state2:""}formDisabledCallback(disabled){this._fieldsetDisabled=disabled,disabled&&this.hide(),this.updateValidity(),this.requestUpdate()}checkValidity(){return this.internals.checkValidity()}reportValidity(){return this.touched=!0,this.syncCustomStates(),this.internals.reportValidity()}setCustomValidity(message){this.validityController.setCustomValidity(message??""),this.syncCustomStates(),this.toggleAttribute("data-invalid",this.touched&&!this.internals.validity.valid),this.requestUpdate()}get normalizedEntries(){const raw=this.locales;return raw!==void 0?raw.map(entry=>typeof entry=="string"?{tag:entry,label:localeNativeName(entry)}:{tag:entry.tag,label:entry.label??localeNativeName(entry.tag),country:entry.country}):getRegisteredLyraLocales().map(tag=>({tag,label:localeNativeName(tag)}))}get previewTag(){return this._value||this.effectiveLocale}entryFor(tag){return this.normalizedEntries.find(e=>e.tag===tag)}labelFor(tag){return this.entryFor(tag)?.label??localeNativeName(tag)}show(){this.open||this.liveDisabled||(this.open=!0)}hide(){this.open&&(this.open=!1,this.setActiveIndex(-1))}dismissFromEscape(){this.open&&(this.deactivatePopupOverlay(!0),this.hide())}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)}unbindDocumentPointer(){this.pointerListenerDocument&&this.pointerListener&&this.pointerListenerDocument.removeEventListener("pointerdown",this.pointerListener),this.pointerListenerDocument=void 0,this.pointerListener=void 0}activatePopupOverlay(){if(this.overlayHandle?.isActive()){this.overlayHandle.resume();return}this.overlayHandle=activateNonmodalOverlay({host:this,panel:()=>this.renderRoot.querySelector('[part="listbox"]'),onEscape:()=>this.dismissFromEscape(),onBackdrop:()=>this.hide(),restoreFocusTo:()=>this.renderRoot.querySelector('[part="trigger"]')})}deactivatePopupOverlay(restoreFocus){const overlay=this.overlayHandle;this.overlayHandle=void 0,overlay?.deactivate({restoreFocus}),this.unbindDocumentPointer()}syncPopup(){if(this.cleanup?.(),this.cleanup=void 0,!this.open||!this.isConnected){this.deactivatePopupOverlay(!1);return}this.activatePopupOverlay(),this.bindDocumentPointer();const anchor=this.renderRoot.querySelector('[part="trigger"]'),listbox=this.renderRoot.querySelector('[part="listbox"]');anchor&&listbox&&(this.cleanup=place(anchor,listbox))}updated(changed){super.updated(changed),this.syncExternalDescription(),(changed.has("open")||this.open&&(changed.has("locales")||changed.has("registryTick")||changed.has("locale")))&&this.syncPopup(),(changed.has("touched")||changed.has("required")||changed.has("value"))&&this.toggleAttribute("data-invalid",this.touched&&!this.internals.validity.valid)}commit(tag){const previousValue=this._value;this.value=tag,this.hide(),this.emit("lr-change",{value:tag,previousValue,direction:getLyraLocaleDirection(tag)},{cancelable:!0}).defaultPrevented||setLyraLocale(tag)}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 rows=this.normalizedEntries;if(!rows.length)return;const currentTag=this.open?rows[this.activeIndex]?.tag:this.previewTag,currentIndex=rows.findIndex(r=>r.tag===currentTag),n=rows.length;for(let step=1;step<=n;step++){const idx=(currentIndex+step+n)%n,row=rows[idx];if(row&&row.label.toLocaleLowerCase(this.effectiveLocale).startsWith(this.typeAheadBuffer)){this.open?this.setActiveIndex(idx):this.commit(row.tag);return}}}clearTypeAheadTimer(){this.typeAheadTimerGeneration+=1,this.typeAheadTimer!==void 0&&this.typeAheadTimerWindow?.clearTimeout(this.typeAheadTimer),this.typeAheadTimer=void 0,this.typeAheadTimerWindow=void 0}setActiveIndex(index){const last=this.normalizedEntries.length-1,next=last<0||index<0?-1:Math.min(last,index);this.activeIndex=next,this.queueActiveScroll()}queueActiveScroll(){const generation=++this.activeScrollGeneration,index=this.activeIndex;index<0||!this.open||this.updateComplete.then(()=>{generation!==this.activeScrollGeneration||!this.isConnected||!this.open||this.activeIndex!==index||this.shadowRoot?.getElementById(`${this.listId}-opt-${index}`)?.scrollIntoView({block:"nearest"})})}renderRows(rows,activeId){return rows.map((entry,i)=>{const id=`${this.listId}-opt-${i}`,selected=entry.tag===this._value;return html`<div
2
2
  part="option"
3
3
  id=${id}
4
4
  role="option"
@@ -11,7 +11,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
11
11
  <span>${entry.label}</span>
12
12
  <span part="option-tag">${entry.tag}</span>
13
13
  </span>
14
- </div>`})}render(){const rows=this.normalizedEntries,activeId=this.activeIndex>=0&&rows[this.activeIndex]?`${this.listId}-opt-${this.activeIndex}`:"",previewTag=this.previewTag,previewEntry=this.entryFor(previewTag),hasLabel=this.hasLabelSlot||this.label.length>0,hasHint=this.hasHintSlot||this.hint.length>0,hasError=this.hasErrorSlot||this.errorText.length>0,describedBy=[hasError?"locale-picker-error":"",hasHint?"locale-picker-hint":""].filter(Boolean).join(" ");return html`
14
+ </div>`})}render(){const rows=this.normalizedEntries,activeId=this.activeIndex>=0&&rows[this.activeIndex]?`${this.listId}-opt-${this.activeIndex}`:"",previewTag=this.previewTag,previewEntry=this.entryFor(previewTag),hasLabel=this.hasLabelSlot||(this.label??"").length>0,hasHint=this.hasHintSlot||(this.hint??"").length>0,hasError=this.hasErrorSlot||(this.errorText??"").length>0,describedBy=this.localDescriptionIds=[hasError?"locale-picker-error":"",hasHint?"locale-picker-hint":""].filter(Boolean).join(" ");return html`
15
15
  <div part="form-control">
16
16
  <label part="form-control-label" for=${this.controlId} ?hidden=${!hasLabel}>
17
17
  ${this.label}<slot name="label" @slotchange=${this.onLabelSlotChange}></slot>
@@ -1 +1 @@
1
- import{css}from"lit";import{formControlRequiredMarker}from"../../../internal/form-control.styles.js";const styles=css` :host { display: block; --_lr-locale-picker-trigger-padding-default: var(--lr-space-xs) var(--lr-space-s); --_lr-locale-picker-trigger-min-height-default: var(--lr-form-control-height); --_lr-locale-picker-font-size-default: var(--lr-form-control-font-size); --_lr-locale-picker-expand-size-default: var(--lr-size-1-75rem); --_lr-locale-picker-gap-default: var(--lr-space-xs); --_lr-locale-picker-radius-default: var(--lr-form-control-radius); } :host([size='2xs']) { --_lr-locale-picker-trigger-padding-default: var(--lr-size-0-0625rem) var(--lr-space-2xs); --_lr-locale-picker-expand-size-default: var(--lr-size-1rem); } :host([size='xs']) { --_lr-locale-picker-trigger-padding-default: var(--lr-size-0-125rem) var(--lr-space-xs); --_lr-locale-picker-expand-size-default: var(--lr-size-1rem); } :host([size='s']), :host([size='small']) { --_lr-locale-picker-trigger-padding-default: var(--lr-space-xs) var(--lr-space-xs); --_lr-locale-picker-expand-size-default: var(--lr-size-1-25rem); } :host([size='l']), :host([size='large']) { --_lr-locale-picker-trigger-padding-default: var(--lr-space-s) var(--lr-space-m); } :host([size='xl']) { --_lr-locale-picker-trigger-padding-default: var(--lr-space-m) var(--lr-space-l); } [part='form-control-label'] { display: block; margin-block-end: var(--lr-space-xs); font-size: var(--lr-font-size-md-sm); font-weight: var(--lr-font-weight-semibold); } [part='form-control-label'][hidden] { display: none; } ${formControlRequiredMarker} [part='trigger'] { display: flex; align-items: center; justify-content: space-between; gap: var(--lr-locale-picker-gap, var(--_lr-locale-picker-gap-default)); inline-size: 100%; min-block-size: var(--lr-locale-picker-trigger-height, var(--lr-locale-picker-trigger-min-height, var(--_lr-locale-picker-trigger-min-height-default))); box-sizing: border-box; block-size: var(--lr-locale-picker-trigger-height, auto); padding: var(--lr-locale-picker-trigger-padding, var(--_lr-locale-picker-trigger-padding-default)); border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-locale-picker-radius, var(--_lr-locale-picker-radius-default)); background: var(--lr-color-surface); color: inherit; font: inherit; font-size: var(--lr-locale-picker-font-size, var(--_lr-locale-picker-font-size-default)); text-align: start; cursor: pointer; } [part='trigger']:focus-visible { outline: var(--lr-focus-ring-width) solid var(--lr-focus-ring-color); outline-offset: var(--lr-focus-ring-offset); } :where([part='trigger']):hover:where(:not(:disabled)) { background: var(--lr-locale-picker-trigger-hover-bg, var(--lr-color-brand-quiet)); } :where([part='trigger']):active:where(:not(:disabled)) { background: color-mix( in oklab, var(--lr-locale-picker-trigger-hover-bg, var(--lr-color-brand-quiet)), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } :host([open]) [part='trigger'] { border-color: var(--lr-locale-picker-open-border-color, var(--lr-color-brand)); } :host(:disabled) [part='trigger'] { opacity: var(--lr-opacity-disabled); cursor: not-allowed; } [part='trigger-flag'] { flex: 0 0 auto; } .trigger-label { flex: 1 1 auto; min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } [part='expand-icon'] { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; color: var(--lr-color-text-quiet); min-inline-size: min(var(--lr-icon-button-size), var(--lr-locale-picker-expand-size, var(--_lr-locale-picker-expand-size-default))); min-block-size: min(var(--lr-icon-button-size), var(--lr-locale-picker-expand-size, var(--_lr-locale-picker-expand-size-default))); line-height: var(--lr-line-height-none); } [part='expand-icon'] svg { transform: rotate(90deg); } [part='listbox'] { position: fixed; z-index: var(--lr-layer-dropdown); box-sizing: border-box; max-block-size: var(--lr-size-18rem); overflow-y: auto; overflow-x: hidden; inline-size: max-content; min-inline-size: var(--lr-size-12rem); max-inline-size: min(var(--lr-popover-viewport-clamp), var(--lr-size-28rem)); padding: var(--lr-space-xs); background: var(--lr-color-surface); border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-locale-picker-radius, var(--_lr-locale-picker-radius-default)); box-shadow: var(--lr-shadow-m); visibility: hidden; opacity: 0; transform: translateY(var(--lr-size-neg-0-25rem)); transition: opacity var(--lr-transition-fast), transform var(--lr-transition-fast), visibility var(--lr-transition-fast); } :host([open]) [part='listbox'] { visibility: visible; opacity: 1; transform: translateY(0); } @media (prefers-reduced-motion: reduce) { [part='listbox'] { transition: none !important; } } [part='option'] { display: flex; align-items: center; gap: var(--lr-locale-picker-gap, var(--_lr-locale-picker-gap-default)); inline-size: 100%; box-sizing: border-box; padding: var(--lr-space-xs) var(--lr-space-s); border: var(--lr-border-width-thin) solid transparent; border-radius: var(--lr-locale-picker-radius, var(--_lr-locale-picker-radius-default)); background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; } [part='option']:hover { background: var( --lr-locale-picker-option-active-bg, var(--lr-color-brand-quiet) ); } [part='option'][data-active] { background: var(--lr-locale-picker-option-active-bg, var(--lr-color-brand-quiet)); } [part='option']:active { background: color-mix( in oklab, var(--lr-locale-picker-option-active-bg, var(--lr-color-brand-quiet)), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part='option'][aria-selected='true'] { border-color: var(--lr-locale-picker-option-selected-border-color, var(--lr-color-brand)); color: var(--lr-locale-picker-option-selected-color, var(--lr-color-brand)); font-weight: var(--lr-locale-picker-option-selected-font-weight, var(--lr-font-weight-semibold)); } @media (forced-colors: active) { :where([part='trigger']):hover:where(:not(:disabled)) { outline: var(--lr-border-width-thin) dashed Highlight; outline-offset: calc(-1 * var(--lr-border-width-thin)); } :where([part="trigger"]):active:where(:not(:disabled)) { outline-style: double; outline-width: var(--lr-border-width-medium); } [part="option"][data-active] { outline: var(--lr-border-width-thin) dashed Highlight; outline-offset: calc(-1 * var(--lr-border-width-thin)); } [part="option"][aria-selected="true"] { border-color: Highlight; border-style: double; } } [part='option-flag'] { flex: 0 0 auto; } [part='option-label'] { display: flex; flex-direction: column; min-inline-size: 0; overflow: hidden; } [part='option-label'] span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } [part='option-tag'] { font-size: var(--lr-font-size-xs); color: var(--lr-color-text-quiet); } [part='hint'] { margin-block-start: var(--lr-space-xs); font-size: var(--lr-font-size-sm); color: var(--lr-color-text-quiet); } [part='hint'][hidden] { display: none; } [part='error'] { margin-block-start: var(--lr-space-xs); font-size: var(--lr-font-size-sm); color: var(--lr-color-danger); } [part='error'][hidden] { display: none; } [part='form-control'], [part='form-control-label'], [part='hint'], [part='error'] { min-inline-size: 0; max-inline-size: 100%; overflow-wrap: anywhere; } `;export{styles};
1
+ import{css}from"lit";import{formControlRequiredMarker}from"../../../internal/form-control.styles.js";const styles=css` :host { display: block; --_lr-locale-picker-trigger-padding-default: var(--lr-space-xs) var(--lr-space-s); --_lr-locale-picker-trigger-min-height-default: var(--lr-form-control-height); --_lr-locale-picker-font-size-default: var(--lr-form-control-font-size); --_lr-locale-picker-expand-size-default: var(--lr-size-1-75rem); --_lr-locale-picker-gap-default: var(--lr-space-xs); --_lr-locale-picker-radius-default: var(--lr-form-control-radius); } :host([size='2xs']) { --_lr-locale-picker-trigger-padding-default: var(--lr-size-0-0625rem) var(--lr-space-2xs); --_lr-locale-picker-expand-size-default: var(--lr-size-1rem); } :host([size='xs']) { --_lr-locale-picker-trigger-padding-default: var(--lr-size-0-125rem) var(--lr-space-xs); --_lr-locale-picker-expand-size-default: var(--lr-size-1rem); } :host([size='s']), :host([size='small']) { --_lr-locale-picker-trigger-padding-default: var(--lr-space-xs) var(--lr-space-xs); --_lr-locale-picker-expand-size-default: var(--lr-size-1-25rem); } :host([size='l']), :host([size='large']) { --_lr-locale-picker-trigger-padding-default: var(--lr-space-s) var(--lr-space-m); } :host([size='xl']) { --_lr-locale-picker-trigger-padding-default: var(--lr-space-m) var(--lr-space-l); } [part='form-control-label'] { display: block; margin-block-end: var(--lr-space-xs); font-size: var(--lr-font-size-md-sm); font-weight: var(--lr-font-weight-semibold); } [part='form-control-label'][hidden] { display: none; } ${formControlRequiredMarker} [part='trigger'] { display: flex; align-items: center; justify-content: space-between; gap: var(--lr-locale-picker-gap, var(--_lr-locale-picker-gap-default)); inline-size: 100%; min-block-size: var(--lr-locale-picker-trigger-height, var(--lr-locale-picker-trigger-min-height, var(--_lr-locale-picker-trigger-min-height-default))); box-sizing: border-box; block-size: var(--lr-locale-picker-trigger-height, auto); padding: var(--lr-locale-picker-trigger-padding, var(--_lr-locale-picker-trigger-padding-default)); border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-locale-picker-radius, var(--_lr-locale-picker-radius-default)); background: var(--lr-color-surface); color: inherit; font: inherit; font-size: var(--lr-locale-picker-font-size, var(--_lr-locale-picker-font-size-default)); text-align: start; cursor: pointer; } [part='trigger']:focus-visible { outline: var(--lr-focus-ring-width) solid var(--lr-focus-ring-color); outline-offset: var(--lr-focus-ring-offset); } :where([part='trigger']):hover:where(:not(:disabled)) { background: var(--lr-locale-picker-trigger-hover-bg, var(--lr-color-brand-quiet)); } :where([part='trigger']):active:where(:not(:disabled)) { background: color-mix( in oklab, var(--lr-locale-picker-trigger-hover-bg, var(--lr-color-brand-quiet)), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } :host([open]) [part='trigger'] { border-color: var(--lr-locale-picker-open-border-color, var(--lr-color-brand)); } :host(:disabled) [part='trigger'] { opacity: var(--lr-opacity-disabled); cursor: not-allowed; } [part='trigger-flag'] { flex: 0 0 auto; } .trigger-label { flex: 1 1 auto; min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } [part='expand-icon'] { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; color: var(--lr-color-text-quiet); min-inline-size: min(var(--lr-icon-button-size), var(--lr-locale-picker-expand-size, var(--_lr-locale-picker-expand-size-default))); min-block-size: min(var(--lr-icon-button-size), var(--lr-locale-picker-expand-size, var(--_lr-locale-picker-expand-size-default))); line-height: var(--lr-line-height-none); } [part='expand-icon'] svg { transform: rotate(90deg); } [part='listbox'] { position: fixed; z-index: var(--lr-overlay-stack-index, var(--lr-layer-dropdown)); box-sizing: border-box; max-block-size: var(--lr-size-18rem); overflow-y: auto; overflow-x: hidden; inline-size: max-content; min-inline-size: var(--lr-size-12rem); max-inline-size: min(var(--lr-popover-viewport-clamp), var(--lr-size-28rem)); padding: var(--lr-space-xs); background: var(--lr-color-surface); border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-locale-picker-radius, var(--_lr-locale-picker-radius-default)); box-shadow: var(--lr-shadow-m); visibility: hidden; opacity: 0; transform: translateY(var(--lr-size-neg-0-25rem)); transition: opacity var(--lr-transition-fast), transform var(--lr-transition-fast), visibility var(--lr-transition-fast); } :host([open]) [part='listbox'] { visibility: visible; opacity: 1; transform: translateY(0); } @media (prefers-reduced-motion: reduce) { [part='listbox'] { transition: none !important; } } [part='option'] { display: flex; align-items: center; gap: var(--lr-locale-picker-gap, var(--_lr-locale-picker-gap-default)); inline-size: 100%; box-sizing: border-box; padding: var(--lr-space-xs) var(--lr-space-s); border: var(--lr-border-width-thin) solid transparent; border-radius: var(--lr-locale-picker-radius, var(--_lr-locale-picker-radius-default)); background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; } [part='option']:hover { background: var( --lr-locale-picker-option-active-bg, var(--lr-color-brand-quiet) ); } [part='option'][data-active] { background: var(--lr-locale-picker-option-active-bg, var(--lr-color-brand-quiet)); } [part='option']:active { background: color-mix( in oklab, var(--lr-locale-picker-option-active-bg, var(--lr-color-brand-quiet)), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part='option'][aria-selected='true'] { border-color: var(--lr-locale-picker-option-selected-border-color, var(--lr-color-brand)); color: var(--lr-locale-picker-option-selected-color, var(--lr-color-brand)); font-weight: var(--lr-locale-picker-option-selected-font-weight, var(--lr-font-weight-semibold)); } @media (forced-colors: active) { :where([part='trigger']):hover:where(:not(:disabled)) { outline: var(--lr-border-width-thin) dashed Highlight; outline-offset: calc(-1 * var(--lr-border-width-thin)); } :where([part="trigger"]):active:where(:not(:disabled)) { outline-style: double; outline-width: var(--lr-border-width-medium); } [part="option"][data-active] { outline: var(--lr-border-width-thin) dashed Highlight; outline-offset: calc(-1 * var(--lr-border-width-thin)); } [part="option"][aria-selected="true"] { border-color: Highlight; border-style: double; } } [part='option-flag'] { flex: 0 0 auto; } [part='option-label'] { display: flex; flex-direction: column; min-inline-size: 0; overflow: hidden; } [part='option-label'] span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } [part='option-tag'] { font-size: var(--lr-font-size-xs); color: var(--lr-color-text-quiet); } [part='hint'] { margin-block-start: var(--lr-space-xs); font-size: var(--lr-font-size-sm); color: var(--lr-color-text-quiet); } [part='hint'][hidden] { display: none; } [part='error'] { margin-block-start: var(--lr-space-xs); font-size: var(--lr-font-size-sm); color: var(--lr-color-danger); } [part='error'][hidden] { display: none; } [part='form-control'], [part='form-control-label'], [part='hint'], [part='error'] { min-inline-size: 0; max-inline-size: 100%; overflow-wrap: anywhere; } `;export{styles};
@@ -39,6 +39,10 @@ export type OtpInputAppearance=Extract<LyraAppearance,'outlined'|'filled'|'fille
39
39
  * ancestor theme wrapper override appearance fallbacks. A value set directly on the OTP input
40
40
  * still wins through normal custom-property inheritance.
41
41
  *
42
+ * Host aria-describedby targets supplement local error/hint guidance on the native control
43
+ * input. Relationships track missing IDs, target replacement, removal/reinsertion, reconnect,
44
+ * and document adoption.
45
+ *
42
46
  * @customElement lr-otp-input
43
47
  * @slot label - Rich label content used while the `label` attribute is empty.
44
48
  * @slot hint - Rich supporting text used while the `hint` attribute is empty.
@@ -211,7 +215,7 @@ select():void;
211
215
  /** Sets the selection on the compact code and maps its start back to the visual fixed cells. */
212
216
  setSelectionRange(start:number|null,end:number|null,direction?:OtpInputSelectionDirection):void;setRangeText(replacement:string):void;setRangeText(replacement:string,start:number,end:number,selectMode?:SelectionMode):void;
213
217
  /** Clears the live code, returns focus to the field, and emits `lr-clear` when a value changed. */
214
- clear():void;formResetCallback():void;formStateRestoreCallback(state:string|File|FormData|null,reason:'autocomplete'|'restore'):void;disconnectedCallback():void;reportValidity():boolean;protected firstUpdated(changed:PropertyValues):void;willUpdate(changed:PropertyValues<this>):void;private syncOtpStates;
218
+ clear():void;formResetCallback():void;formStateRestoreCallback(state:string|File|FormData|null,reason:'autocomplete'|'restore'):void;disconnectedCallback():void;reportValidity():boolean;protected firstUpdated(changed:PropertyValues):void;adoptedCallback():void;protected updated(changed:PropertyValues):void;private externalDescriptionLease?;private syncExternalDescription;private releaseExternalDescription;connectedCallback():void;willUpdate(changed:PropertyValues<this>):void;private syncOtpStates;
215
219
  /**
216
220
  * Recomputes the OTP-specific constraints. Barred controls short-circuit first, through the same
217
221
  * `isBarredFromValidation()` predicate the base mixin uses — this override used to check
@@ -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{LyraElement}from"../../../internal/lyra-element.js";import{FormAssociated,isBarredFromValidation}from"../../../internal/form-associated.js";import{SET_ANCHORED_VALIDITY}from"../../../internal/anchored-validity.js";import{hostAriaLabel,nextId}from"../../../internal/a11y.js";import{finiteInteger}from"../../../internal/numbers.js";import{setCustomState}from"../../../internal/custom-states.js";import{contextualSizes}from"../../../internal/contextual-vocabulary.styles.js";import{findImplicitSubmitter,isNativeSubmitter,submitOnEnter}from"../../../internal/submit-on-enter.js";import{styles}from"./otp-input.styles.js";import{dispatchNativeEvent,dispatchNativeInputEvent,relayNativeEvent}from"../../../internal/native-event-relay.js";import{currentValidityValidator}from"../form-validator.js";import{declaredDefaultConverter}from"../../../internal/converters.js";import{LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_otpInputIncomplete,LYRA_DEFAULT_otpInputLabel}from"../../../internal/default-strings.generated.js";const ACCEPTED={numeric:/[0-9]/,alpha:/[a-zA-Z]/,alphanumeric:/[a-zA-Z0-9]/},DEFAULT_LENGTH=6,MAX_LENGTH=32,MAX_FORMAT_SOURCE_LENGTH=4096,MAX_VALUE_SOURCE_LENGTH=4096;class LyraOtpInputBase extends LyraElement{static{this.styles=[LyraElement.styles,contextualSizes,styles]}}class LyraOtpInput extends FormAssociated(LyraOtpInputBase){constructor(){super(...arguments),this.label="",this.hint="",this.errorText="",this.appearance="outlined",this.autofocus=!1,this.autosubmit=!1,this.size="m",this.length=DEFAULT_LENGTH,this.format="",this.type="numeric",this.case="preserve",this.mask=!1,this.withMask=!1,this.readonly=!1,this.autocomplete="one-time-code",this.focused=!1,this.hasLabelSlot=!1,this.hasHintSlot=!1,this.hasErrorSlot=!1,this.touched=!1,this.labelId=nextId("otp-input-label"),this.hintId=nextId("otp-input-hint"),this.errorId=nextId("otp-input-error"),this.activeSegmentIndex=0,this.segmentValues=[],this.segmentEditPendingChange=!1,this.autosubmitToken=0,this.onInput=event=>{if(event.isComposing===!0){event.stopPropagation();return}const raw=event.target.value,next=this.sanitize(raw),previous=this.value,previousFilled=this.filledSegmentCount,layoutChanged=Array.from({length:this.renderedSegmentCount},(_,index)=>next[index]??"").some((value,index)=>value!==this.segmentValues[index]);if(this.control&&this.control.value!==next&&(this.control.value=next),next===this.value&&!layoutChanged){event.stopImmediatePropagation();return}this.touched=!0,this.value=next,relayNativeEvent(this,event),previous&&!next&&this.emit("lr-clear"),this.completeIfTransition(previousFilled)},this.onKeyDown=event=>{if(this.effectiveDisabled)return;if(event.key==="ArrowLeft"||event.key==="ArrowRight"){event.preventDefault();const physical=event.key==="ArrowRight"?1:-1,delta=this.effectiveDirection==="rtl"?-physical:physical;this.setActiveSegment(this.activeSegmentIndex+delta);return}if(event.key==="Enter"){this.readonly||submitOnEnter(this,event,{beforeSubmit:()=>this.flushPendingChange()});return}if(this.readonly||event.isComposing)return;const selection=this.selectedSegmentRange;if(event.key==="Backspace"||event.key==="Delete"){event.preventDefault();const values2=this.normalizedSegmentValues();if(selection){for(const index of selection.indices)values2[index]="";this.commitSegmentEdit(values2,event.key==="Backspace"?"deleteContentBackward":"deleteContentForward"),this.setActiveSegment(selection.first);return}const changed=!!values2[this.activeSegmentIndex];values2[this.activeSegmentIndex]="",changed&&this.commitSegmentEdit(values2,event.key==="Backspace"?"deleteContentBackward":"deleteContentForward"),event.key==="Backspace"&&this.setActiveSegment(this.activeSegmentIndex-1);return}if(event.ctrlKey||event.metaKey||event.altKey||event.key.length!==1)return;event.preventDefault();const accepted=this.sanitize(event.key).slice(0,1);if(!accepted)return;const values=this.normalizedSegmentValues(),targetIndex=selection?.first??this.activeSegmentIndex;if(selection)for(const index of selection.indices)values[index]="";values[targetIndex]=accepted,this.commitSegmentEdit(values,"insertText",accepted),this.setActiveSegment(targetIndex+1)},this.onPaste=event=>{if(this.effectiveDisabled||this.readonly)return;const pasted=this.sanitize(event.clipboardData?.getData("text")??"");if(event.preventDefault(),!pasted)return;const values=Array.from({length:this.renderedSegmentCount},(_,index)=>pasted[index]??"");this.commitSegmentEdit(values,"insertFromPaste",pasted),this.setActiveSegment(Math.min(pasted.length,this.renderedSegmentCount-1))},this.onChange=event=>{this.segmentEditPendingChange=!1,relayNativeEvent(this,event)},this.onFocus=event=>{this.focused=!0,relayNativeEvent(this,event)},this.onBlur=event=>{this.focused=!1,this.effectiveDisabled||(this.touched=!0),this.flushPendingChange(),relayNativeEvent(this,event)},this.onLabelSlotChange=event=>{this.hasLabelSlot=event.target.assignedNodes({flatten:!0}).length>0},this.onHintSlotChange=event=>{this.hasHintSlot=event.target.assignedNodes({flatten:!0}).length>0},this.onErrorSlotChange=event=>{this.hasErrorSlot=event.target.assignedNodes({flatten:!0}).length>0}}static{this.defaultStrings={...super.defaultStrings,fieldRequired:LYRA_DEFAULT_fieldRequired,otpInputIncomplete:LYRA_DEFAULT_otpInputIncomplete,otpInputLabel:LYRA_DEFAULT_otpInputLabel}}static get validators(){return[currentValidityValidator("required","disabled","readonly","value","length","pattern")]}get input(){return this.control??null}get validationTarget(){return this.control??null}get value(){return super.value}set value(next){this.autosubmitToken+=1;const normalized=this.sanitize(next??"");this.packSegmentValues(normalized),super.value=normalized}get defaultValue(){return super.defaultValue}set defaultValue(next){this.autosubmitToken+=1,super.defaultValue=next}get formattedCells(){if(this.parsedFormatSource===this.format)return this.parsedFormatCells??null;if(this.parsedFormatSource=this.format,!this.format)return this.parsedFormatCells=null,null;const cells=[];let segments=0,literal="";const flushLiteral=()=>{literal&&(cells.push({kind:"separator",text:literal}),literal="")};for(const char of this.format.slice(0,MAX_FORMAT_SOURCE_LENGTH)){if(char!=="#"){literal+=char;continue}if(segments>=MAX_LENGTH)break;flushLiteral(),cells.push({kind:"segment"}),segments+=1}return flushLiteral(),this.parsedFormatCells=segments>0?cells:null,this.parsedFormatCells}get renderedSegmentCount(){const formatted=this.formattedCells;return formatted?formatted.filter(cell=>cell.kind==="segment").length:Math.min(MAX_LENGTH,Math.max(1,finiteInteger(this.length,DEFAULT_LENGTH)))}get effectiveLength(){return this.renderedSegmentCount}get cells(){return this.formattedCells??Array.from({length:this.renderedSegmentCount},()=>({kind:"segment"}))}sanitize(raw){const accepted=ACCEPTED[this.type]??ACCEPTED.numeric,limit=this.renderedSegmentCount;let out="";for(const char of(raw??"").slice(0,MAX_VALUE_SOURCE_LENGTH))if(accepted.test(char)&&(out+=char),out.length>=limit)break;return this.case==="upper"?out=out.toUpperCase():this.case==="lower"&&(out=out.toLowerCase()),out.slice(0,limit)}packSegmentValues(value){const count=this.renderedSegmentCount;this.segmentValues=Array.from({length:count},(_,index)=>value[index]??""),this.activeSegmentIndex=Math.min(value.length,count-1)}get filledSegmentCount(){return Array.isArray(this.segmentValues)?this.segmentValues.reduce((count,value)=>count+(value?1:0),0):this.value.length}normalizedSegmentValues(values=this.segmentValues){return Array.from({length:this.renderedSegmentCount},(_,index)=>values[index]??"")}setActiveSegment(index){const next=Math.min(this.renderedSegmentCount-1,Math.max(0,index));this.activeSegmentIndex=next;const caret=this.normalizedSegmentValues().slice(0,next).filter(Boolean).length;this.control?.setSelectionRange(caret,caret),this.updateComplete.then(()=>{this.renderRoot.querySelectorAll('[part~="segment"]')[next]?.scrollIntoView({block:"nearest",inline:"nearest"})})}submitOwningForm(){const form=this.getForm();if(!form)return;const submitter=findImplicitSubmitter(form);submitter?isNativeSubmitter(submitter)?form.requestSubmit(submitter):submitter.click():form.requestSubmit()}completeIfTransition(previousFilled){if(previousFilled>=this.renderedSegmentCount||this.filledSegmentCount!==this.renderedSegmentCount)return;const completionValue=this.value,token=this.autosubmitToken,completeEvent=this.emit("lr-complete",{value:completionValue},{cancelable:!0});this.autosubmit&&setTimeout(()=>{token!==this.autosubmitToken||completeEvent.defaultPrevented||!this.isConnected||!this.autosubmit||this.value!==completionValue||this.filledSegmentCount!==this.renderedSegmentCount||this.submitOwningForm()})}commitSegmentEdit(values,inputType,data=null){this.autosubmitToken+=1;const previousValue=this.value,previousFilled=this.filledSegmentCount;this.segmentValues=this.normalizedSegmentValues(values);const nextValue=this.segmentValues.join("");super.value=nextValue,this.control&&(this.control.value=nextValue),this.touched=!0,dispatchNativeInputEvent(this,{data,inputType}),this.segmentEditPendingChange=!0,previousValue&&!nextValue&&this.emit("lr-clear"),this.completeIfTransition(previousFilled),this.requestUpdate()}get selectedSegmentRange(){const start=this.control?.selectionStart,end=this.control?.selectionEnd;if(start==null||end===void 0||end===null||start===end)return null;const indices=this.normalizedSegmentValues().map((value,index)=>value?index:-1).filter(index=>index>=0).slice(start,end),first=indices[0];return first===void 0?null:{indices,first}}segmentIndexAtCompactOffset(offset){const values=this.normalizedSegmentValues();let occupied=0;for(let index=0;index<values.length;index+=1){if(occupied>=offset)return index;values[index]&&(occupied+=1)}return Math.max(0,values.length-1)}syncActiveSegmentFromSelection(){const control=this.control;if(!control||control.selectionStart===null)return;const selected=this.selectedSegmentRange;this.activeSegmentIndex=selected?.first??this.segmentIndexAtCompactOffset(control.selectionStart)}get selectionStart(){return this.control?.selectionStart??null}set selectionStart(value){this.control&&(this.control.selectionStart=value,this.syncActiveSegmentFromSelection())}get selectionEnd(){return this.control?.selectionEnd??null}set selectionEnd(value){this.control&&(this.control.selectionEnd=value,this.syncActiveSegmentFromSelection())}get selectionDirection(){return this.control?.selectionDirection??null}set selectionDirection(value){this.control&&(this.control.selectionDirection=value)}focus(options){this.effectiveDisabled||this.control?.focus(options)}blur(){this.control?.blur()}click(){this.effectiveDisabled||this.control?.click()}select(){this.control?.select()}setSelectionRange(start,end,direction){this.control&&(this.control.setSelectionRange(start,end,direction),this.syncActiveSegmentFromSelection())}setRangeText(replacement,start,end,selectMode){const control=this.control;if(!control)return;const selectionPrefixLength=(value,offset)=>{if(offset===null)return null;const boundedOffset=Math.min(MAX_VALUE_SOURCE_LENGTH,Math.max(0,offset));return this.sanitize(value.slice(0,boundedOffset)).length},currentRaw=control.value,currentSelectionStart=selectionPrefixLength(currentRaw,control.selectionStart),currentSelectionEnd=selectionPrefixLength(currentRaw,control.selectionEnd),currentSelectionDirection=control.selectionDirection,boundedCurrent=this.sanitize(currentRaw);currentRaw!==boundedCurrent&&(control.value=boundedCurrent,currentSelectionStart!==null&&currentSelectionEnd!==null&&control.setSelectionRange(currentSelectionStart,currentSelectionEnd,currentSelectionDirection??void 0));const boundedReplacement=this.sanitize(replacement);start===void 0||end===void 0?control.setRangeText(boundedReplacement):control.setRangeText(boundedReplacement,start,end,selectMode);const raw=control.value,selectionStart=selectionPrefixLength(raw,control.selectionStart),selectionEnd=selectionPrefixLength(raw,control.selectionEnd),selectionDirection=control.selectionDirection,normalized=this.sanitize(raw);this.value=normalized,control.value=normalized,selectionStart!==null&&selectionEnd!==null&&control.setSelectionRange(selectionStart,selectionEnd,selectionDirection??void 0),this.syncActiveSegmentFromSelection()}clear(){const hadValue=this.value.length>0;this.value="",this.control&&(this.control.value=""),this.focus(),hadValue&&this.emit("lr-clear")}formResetCallback(){this.autosubmitToken+=1,super.formResetCallback(),this.touched=!1,this.segmentEditPendingChange=!1}formStateRestoreCallback(state2,reason){this.autosubmitToken+=1,super.formStateRestoreCallback(state2,reason)}disconnectedCallback(){super.disconnectedCallback(),this.autosubmitToken+=1}reportValidity(){return this.touched=!0,super.reportValidity()}firstUpdated(changed){super.firstUpdated(changed),this.autofocus&&this.scheduleAfterUpdate(()=>this.focus(),"otp-autofocus")}willUpdate(changed){if(super.willUpdate(changed),changed.has("type")||changed.has("case")||changed.has("length")||changed.has("format")){const next=this.sanitize(this.value);next!==this.value?this.value=next:this.packSegmentValues(next)}(changed.has("value")||changed.has("required")||changed.has("readonly")||changed.has("length")||changed.has("format"))&&this.updateValidity(),this.syncOtpStates()}syncOtpStates(){setCustomState(this.internals,"--blank",this.value.length===0),setCustomState(this.internals,"--filled",this.filledSegmentCount===this.renderedSegmentCount),setCustomState(this.internals,"disabled",this.effectiveDisabled),setCustomState(this.internals,"readonly",this.readonly)}updateValidity(){if(isBarredFromValidation(this,this.internals)){this[SET_ANCHORED_VALIDITY]({});return}const total=this.renderedSegmentCount,filled=this.filledSegmentCount,complete=filled===total;if(this.required&&filled===0){this[SET_ANCHORED_VALIDITY]({valueMissing:!0},this.localize("fieldRequired"));return}if(filled>0&&!complete){this[SET_ANCHORED_VALIDITY]({tooShort:!0},this.localize("otpInputIncomplete",void 0,{total}));return}this[SET_ANCHORED_VALIDITY]({})}flushPendingChange(){this.segmentEditPendingChange&&(this.segmentEditPendingChange=!1,dispatchNativeEvent(this,"change"))}renderSegment(index,invalid){const char=this.segmentValues[index]??"",filled=char!=="",active=this.focused&&!this.effectiveDisabled&&index===this.activeSegmentIndex,masked=filled&&this.mask,placeholderMask=!filled&&this.withMask,parts=["segment"];return active&&parts.push("active"),masked&&parts.push("masked"),placeholderMask&&parts.push("placeholder-mask"),invalid&&parts.push("invalid"),html`<div part=${parts.join(" ")} aria-hidden="true">${masked?nothing:placeholderMask?nothing:char}</div>`}render(){const hasLabel=!!this.label||this.hasLabelSlot,hasHint=!!this.hint||this.hasHintSlot,hasError=!!this.errorText||this.hasErrorSlot,intrinsicInvalid=this.touched&&!this.validity.valid,ariaInvalid=hasError||intrinsicInvalid,describedBy=[hasError?this.errorId:"",hasHint?this.hintId:""].filter(Boolean).join(" "),labelledBy=hasLabel&&!this.getAttribute("aria-label")?this.labelId:nothing;let segmentIndex=-1;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,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{FormAssociated,isBarredFromValidation}from"../../../internal/form-associated.js";import{SET_ANCHORED_VALIDITY}from"../../../internal/anchored-validity.js";import{hostAriaLabel,nextId}from"../../../internal/a11y.js";import{finiteInteger}from"../../../internal/numbers.js";import{setCustomState}from"../../../internal/custom-states.js";import{contextualSizes}from"../../../internal/contextual-vocabulary.styles.js";import{findImplicitSubmitter,isNativeSubmitter,submitOnEnter}from"../../../internal/submit-on-enter.js";import{styles}from"./otp-input.styles.js";import{dispatchNativeEvent,dispatchNativeInputEvent,relayNativeEvent}from"../../../internal/native-event-relay.js";import{currentValidityValidator}from"../form-validator.js";import{declaredDefaultConverter}from"../../../internal/converters.js";import{LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_otpInputIncomplete,LYRA_DEFAULT_otpInputLabel}from"../../../internal/default-strings.generated.js";const ACCEPTED={numeric:/[0-9]/,alpha:/[a-zA-Z]/,alphanumeric:/[a-zA-Z0-9]/},DEFAULT_LENGTH=6,MAX_LENGTH=32,MAX_FORMAT_SOURCE_LENGTH=4096,MAX_VALUE_SOURCE_LENGTH=4096;class LyraOtpInputBase extends LyraElement{static{this.styles=[LyraElement.styles,contextualSizes,styles]}}class LyraOtpInput extends FormAssociated(LyraOtpInputBase){constructor(){super(...arguments),this.label="",this.hint="",this.errorText="",this.appearance="outlined",this.autofocus=!1,this.autosubmit=!1,this.size="m",this.length=DEFAULT_LENGTH,this.format="",this.type="numeric",this.case="preserve",this.mask=!1,this.withMask=!1,this.readonly=!1,this.autocomplete="one-time-code",this.focused=!1,this.hasLabelSlot=!1,this.hasHintSlot=!1,this.hasErrorSlot=!1,this.touched=!1,this.labelId=nextId("otp-input-label"),this.hintId=nextId("otp-input-hint"),this.errorId=nextId("otp-input-error"),this.activeSegmentIndex=0,this.segmentValues=[],this.segmentEditPendingChange=!1,this.autosubmitToken=0,this.onInput=event=>{if(event.isComposing===!0){event.stopPropagation();return}const raw=event.target.value,next=this.sanitize(raw),previous=this.value,previousFilled=this.filledSegmentCount,layoutChanged=Array.from({length:this.renderedSegmentCount},(_,index)=>next[index]??"").some((value,index)=>value!==this.segmentValues[index]);if(this.control&&this.control.value!==next&&(this.control.value=next),next===this.value&&!layoutChanged){event.stopImmediatePropagation();return}this.touched=!0,this.value=next,relayNativeEvent(this,event),previous&&!next&&this.emit("lr-clear"),this.completeIfTransition(previousFilled)},this.onKeyDown=event=>{if(this.effectiveDisabled)return;if(event.key==="ArrowLeft"||event.key==="ArrowRight"){event.preventDefault();const physical=event.key==="ArrowRight"?1:-1,delta=this.effectiveDirection==="rtl"?-physical:physical;this.setActiveSegment(this.activeSegmentIndex+delta);return}if(event.key==="Enter"){this.readonly||submitOnEnter(this,event,{beforeSubmit:()=>this.flushPendingChange()});return}if(this.readonly||event.isComposing)return;const selection=this.selectedSegmentRange;if(event.key==="Backspace"||event.key==="Delete"){event.preventDefault();const values2=this.normalizedSegmentValues();if(selection){for(const index of selection.indices)values2[index]="";this.commitSegmentEdit(values2,event.key==="Backspace"?"deleteContentBackward":"deleteContentForward"),this.setActiveSegment(selection.first);return}const changed=!!values2[this.activeSegmentIndex];values2[this.activeSegmentIndex]="",changed&&this.commitSegmentEdit(values2,event.key==="Backspace"?"deleteContentBackward":"deleteContentForward"),event.key==="Backspace"&&this.setActiveSegment(this.activeSegmentIndex-1);return}if(event.ctrlKey||event.metaKey||event.altKey||event.key.length!==1)return;event.preventDefault();const accepted=this.sanitize(event.key).slice(0,1);if(!accepted)return;const values=this.normalizedSegmentValues(),targetIndex=selection?.first??this.activeSegmentIndex;if(selection)for(const index of selection.indices)values[index]="";values[targetIndex]=accepted,this.commitSegmentEdit(values,"insertText",accepted),this.setActiveSegment(targetIndex+1)},this.onPaste=event=>{if(this.effectiveDisabled||this.readonly)return;const pasted=this.sanitize(event.clipboardData?.getData("text")??"");if(event.preventDefault(),!pasted)return;const values=Array.from({length:this.renderedSegmentCount},(_,index)=>pasted[index]??"");this.commitSegmentEdit(values,"insertFromPaste",pasted),this.setActiveSegment(Math.min(pasted.length,this.renderedSegmentCount-1))},this.onChange=event=>{this.segmentEditPendingChange=!1,relayNativeEvent(this,event)},this.onFocus=event=>{this.focused=!0,relayNativeEvent(this,event)},this.onBlur=event=>{this.focused=!1,this.effectiveDisabled||(this.touched=!0),this.flushPendingChange(),relayNativeEvent(this,event)},this.onLabelSlotChange=event=>{this.hasLabelSlot=event.target.assignedNodes({flatten:!0}).length>0},this.onHintSlotChange=event=>{this.hasHintSlot=event.target.assignedNodes({flatten:!0}).length>0},this.onErrorSlotChange=event=>{this.hasErrorSlot=event.target.assignedNodes({flatten:!0}).length>0}}static{this.defaultStrings={...super.defaultStrings,fieldRequired:LYRA_DEFAULT_fieldRequired,otpInputIncomplete:LYRA_DEFAULT_otpInputIncomplete,otpInputLabel:LYRA_DEFAULT_otpInputLabel}}static get validators(){return[currentValidityValidator("required","disabled","readonly","value","length","pattern")]}get input(){return this.control??null}get validationTarget(){return this.control??null}get value(){return super.value}set value(next){this.autosubmitToken+=1;const normalized=this.sanitize(next??"");this.packSegmentValues(normalized),super.value=normalized}get defaultValue(){return super.defaultValue}set defaultValue(next){this.autosubmitToken+=1,super.defaultValue=next}get formattedCells(){if(this.parsedFormatSource===this.format)return this.parsedFormatCells??null;if(this.parsedFormatSource=this.format,!this.format)return this.parsedFormatCells=null,null;const cells=[];let segments=0,literal="";const flushLiteral=()=>{literal&&(cells.push({kind:"separator",text:literal}),literal="")};for(const char of this.format.slice(0,MAX_FORMAT_SOURCE_LENGTH)){if(char!=="#"){literal+=char;continue}if(segments>=MAX_LENGTH)break;flushLiteral(),cells.push({kind:"segment"}),segments+=1}return flushLiteral(),this.parsedFormatCells=segments>0?cells:null,this.parsedFormatCells}get renderedSegmentCount(){const formatted=this.formattedCells;return formatted?formatted.filter(cell=>cell.kind==="segment").length:Math.min(MAX_LENGTH,Math.max(1,finiteInteger(this.length,DEFAULT_LENGTH)))}get effectiveLength(){return this.renderedSegmentCount}get cells(){return this.formattedCells??Array.from({length:this.renderedSegmentCount},()=>({kind:"segment"}))}sanitize(raw){const accepted=ACCEPTED[this.type]??ACCEPTED.numeric,limit=this.renderedSegmentCount;let out="";for(const char of(raw??"").slice(0,MAX_VALUE_SOURCE_LENGTH))if(accepted.test(char)&&(out+=char),out.length>=limit)break;return this.case==="upper"?out=out.toUpperCase():this.case==="lower"&&(out=out.toLowerCase()),out.slice(0,limit)}packSegmentValues(value){const count=this.renderedSegmentCount;this.segmentValues=Array.from({length:count},(_,index)=>value[index]??""),this.activeSegmentIndex=Math.min(value.length,count-1)}get filledSegmentCount(){return Array.isArray(this.segmentValues)?this.segmentValues.reduce((count,value)=>count+(value?1:0),0):this.value.length}normalizedSegmentValues(values=this.segmentValues){return Array.from({length:this.renderedSegmentCount},(_,index)=>values[index]??"")}setActiveSegment(index){const next=Math.min(this.renderedSegmentCount-1,Math.max(0,index));this.activeSegmentIndex=next;const caret=this.normalizedSegmentValues().slice(0,next).filter(Boolean).length;this.control?.setSelectionRange(caret,caret),this.updateComplete.then(()=>{this.renderRoot.querySelectorAll('[part~="segment"]')[next]?.scrollIntoView({block:"nearest",inline:"nearest"})})}submitOwningForm(){const form=this.getForm();if(!form)return;const submitter=findImplicitSubmitter(form);submitter?isNativeSubmitter(submitter)?form.requestSubmit(submitter):submitter.click():form.requestSubmit()}completeIfTransition(previousFilled){if(previousFilled>=this.renderedSegmentCount||this.filledSegmentCount!==this.renderedSegmentCount)return;const completionValue=this.value,token=this.autosubmitToken,completeEvent=this.emit("lr-complete",{value:completionValue},{cancelable:!0});this.autosubmit&&setTimeout(()=>{token!==this.autosubmitToken||completeEvent.defaultPrevented||!this.isConnected||!this.autosubmit||this.value!==completionValue||this.filledSegmentCount!==this.renderedSegmentCount||this.submitOwningForm()})}commitSegmentEdit(values,inputType,data=null){this.autosubmitToken+=1;const previousValue=this.value,previousFilled=this.filledSegmentCount;this.segmentValues=this.normalizedSegmentValues(values);const nextValue=this.segmentValues.join("");super.value=nextValue,this.control&&(this.control.value=nextValue),this.touched=!0,dispatchNativeInputEvent(this,{data,inputType}),this.segmentEditPendingChange=!0,previousValue&&!nextValue&&this.emit("lr-clear"),this.completeIfTransition(previousFilled),this.requestUpdate()}get selectedSegmentRange(){const start=this.control?.selectionStart,end=this.control?.selectionEnd;if(start==null||end===void 0||end===null||start===end)return null;const indices=this.normalizedSegmentValues().map((value,index)=>value?index:-1).filter(index=>index>=0).slice(start,end),first=indices[0];return first===void 0?null:{indices,first}}segmentIndexAtCompactOffset(offset){const values=this.normalizedSegmentValues();let occupied=0;for(let index=0;index<values.length;index+=1){if(occupied>=offset)return index;values[index]&&(occupied+=1)}return Math.max(0,values.length-1)}syncActiveSegmentFromSelection(){const control=this.control;if(!control||control.selectionStart===null)return;const selected=this.selectedSegmentRange;this.activeSegmentIndex=selected?.first??this.segmentIndexAtCompactOffset(control.selectionStart)}get selectionStart(){return this.control?.selectionStart??null}set selectionStart(value){this.control&&(this.control.selectionStart=value,this.syncActiveSegmentFromSelection())}get selectionEnd(){return this.control?.selectionEnd??null}set selectionEnd(value){this.control&&(this.control.selectionEnd=value,this.syncActiveSegmentFromSelection())}get selectionDirection(){return this.control?.selectionDirection??null}set selectionDirection(value){this.control&&(this.control.selectionDirection=value)}focus(options){this.effectiveDisabled||this.control?.focus(options)}blur(){this.control?.blur()}click(){this.effectiveDisabled||this.control?.click()}select(){this.control?.select()}setSelectionRange(start,end,direction){this.control&&(this.control.setSelectionRange(start,end,direction),this.syncActiveSegmentFromSelection())}setRangeText(replacement,start,end,selectMode){const control=this.control;if(!control)return;const selectionPrefixLength=(value,offset)=>{if(offset===null)return null;const boundedOffset=Math.min(MAX_VALUE_SOURCE_LENGTH,Math.max(0,offset));return this.sanitize(value.slice(0,boundedOffset)).length},currentRaw=control.value,currentSelectionStart=selectionPrefixLength(currentRaw,control.selectionStart),currentSelectionEnd=selectionPrefixLength(currentRaw,control.selectionEnd),currentSelectionDirection=control.selectionDirection,boundedCurrent=this.sanitize(currentRaw);currentRaw!==boundedCurrent&&(control.value=boundedCurrent,currentSelectionStart!==null&&currentSelectionEnd!==null&&control.setSelectionRange(currentSelectionStart,currentSelectionEnd,currentSelectionDirection??void 0));const boundedReplacement=this.sanitize(replacement);start===void 0||end===void 0?control.setRangeText(boundedReplacement):control.setRangeText(boundedReplacement,start,end,selectMode);const raw=control.value,selectionStart=selectionPrefixLength(raw,control.selectionStart),selectionEnd=selectionPrefixLength(raw,control.selectionEnd),selectionDirection=control.selectionDirection,normalized=this.sanitize(raw);this.value=normalized,control.value=normalized,selectionStart!==null&&selectionEnd!==null&&control.setSelectionRange(selectionStart,selectionEnd,selectionDirection??void 0),this.syncActiveSegmentFromSelection()}clear(){const hadValue=this.value.length>0;this.value="",this.control&&(this.control.value=""),this.focus(),hadValue&&this.emit("lr-clear")}formResetCallback(){this.autosubmitToken+=1,super.formResetCallback(),this.touched=!1,this.segmentEditPendingChange=!1}formStateRestoreCallback(state2,reason){this.autosubmitToken+=1,super.formStateRestoreCallback(state2,reason)}disconnectedCallback(){this.releaseExternalDescription(),super.disconnectedCallback(),this.autosubmitToken+=1}reportValidity(){return this.touched=!0,super.reportValidity()}firstUpdated(changed){super.firstUpdated(changed),this.autofocus&&this.scheduleAfterUpdate(()=>this.focus(),"otp-autofocus")}adoptedCallback(){super.adoptedCallback(),this.releaseExternalDescription(),this.hasUpdated&&this.syncExternalDescription()}updated(changed){super.updated(changed),this.syncExternalDescription()}syncExternalDescription(){if(!this.isConnected)return;const target=this.control??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()}willUpdate(changed){if(super.willUpdate(changed),changed.has("type")||changed.has("case")||changed.has("length")||changed.has("format")){const next=this.sanitize(this.value);next!==this.value?this.value=next:this.packSegmentValues(next)}(changed.has("value")||changed.has("required")||changed.has("readonly")||changed.has("length")||changed.has("format"))&&this.updateValidity(),this.syncOtpStates()}syncOtpStates(){setCustomState(this.internals,"--blank",this.value.length===0),setCustomState(this.internals,"--filled",this.filledSegmentCount===this.renderedSegmentCount),setCustomState(this.internals,"disabled",this.effectiveDisabled),setCustomState(this.internals,"readonly",this.readonly)}updateValidity(){if(isBarredFromValidation(this,this.internals)){this[SET_ANCHORED_VALIDITY]({});return}const total=this.renderedSegmentCount,filled=this.filledSegmentCount,complete=filled===total;if(this.required&&filled===0){this[SET_ANCHORED_VALIDITY]({valueMissing:!0},this.localize("fieldRequired"));return}if(filled>0&&!complete){this[SET_ANCHORED_VALIDITY]({tooShort:!0},this.localize("otpInputIncomplete",void 0,{total}));return}this[SET_ANCHORED_VALIDITY]({})}flushPendingChange(){this.segmentEditPendingChange&&(this.segmentEditPendingChange=!1,dispatchNativeEvent(this,"change"))}renderSegment(index,invalid){const char=this.segmentValues[index]??"",filled=char!=="",active=this.focused&&!this.effectiveDisabled&&index===this.activeSegmentIndex,masked=filled&&this.mask,placeholderMask=!filled&&this.withMask,parts=["segment"];return active&&parts.push("active"),masked&&parts.push("masked"),placeholderMask&&parts.push("placeholder-mask"),invalid&&parts.push("invalid"),html`<div part=${parts.join(" ")} aria-hidden="true">${masked?nothing:placeholderMask?nothing:char}</div>`}render(){const hasLabel=!!this.label||this.hasLabelSlot,hasHint=!!this.hint||this.hasHintSlot,hasError=!!this.errorText||this.hasErrorSlot,intrinsicInvalid=this.touched&&!this.validity.valid,ariaInvalid=hasError||intrinsicInvalid,describedBy=[hasError?this.errorId:"",hasHint?this.hintId:""].filter(Boolean).join(" "),labelledBy=hasLabel&&!this.getAttribute("aria-label")?this.labelId:nothing;let segmentIndex=-1;return html`
2
2
  <div part="base form-control">
3
3
  <label part="label form-control-label" id=${this.labelId} for="control" ?hidden=${!hasLabel}>
4
4
  ${this.label}<slot name="label" ?hidden=${!!this.label} @slotchange=${this.onLabelSlotChange}></slot>
@@ -81,6 +81,13 @@ inputValue:string;country:string;valid:boolean;status:LyraPhoneNumberStatus;}exp
81
81
  * `readonly` locks both telephone and country mutation while retaining focus, selection, copying,
82
82
  * form value, and submission. `autofocus` targets the real native telephone input.
83
83
  *
84
+ * Host aria-describedby targets supplement local hint/error guidance on the telephone input,
85
+ * including live target changes, reconnect, and adoption. Removing default-country safely uses
86
+ * the existing country fallback while retaining null property readback. Explicit countryLabel,
87
+ * incompleteText, and invalidText values win over locale strings; removing those copy attributes
88
+ * restores their English property defaults and localized presentation. Empty validation copy
89
+ * retains a nonempty localized native error reason.
90
+ *
84
91
  * @customElement lr-phone-input
85
92
  * @slot label - Custom label content.
86
93
  * @slot hint - Custom hint content.
@@ -172,14 +179,20 @@ size:LyraSize;
172
179
  pill:boolean;
173
180
  /** Accessible name for the telephone input. Takes precedence over `phoneLabel`, label, and placeholder. */
174
181
  accessibleLabel:string|null;
175
- /** Accessible name for the country selector. */
176
- countryLabel:string;
182
+ /** Accessible name for the country selector. Explicit copy wins over locale strings; omission localizes.
183
+ * @default 'Select'
184
+ */
185
+ countryLabel:string;private countryLabelAuthored;
177
186
  /** Accessible-name override for the telephone input. */
178
187
  phoneLabel:string;
179
- /** Validation message for a number that may still become valid with more digits. */
180
- incompleteText:string;
181
- /** Validation message for a completed but invalid number. */
182
- invalidText:string;autocomplete:string;inputmode:'tel'|'numeric'|'text';enterkeyhint:string;
188
+ /** Validation message for a number that may still become valid with more digits. Explicit copy wins over locale strings; omission localizes.
189
+ * @default 'This phone number is incomplete.'
190
+ */
191
+ incompleteText:string;private incompleteTextAuthored;
192
+ /** Validation message for a completed but invalid number. Explicit copy wins over locale strings; omission localizes.
193
+ * @default 'The value is invalid.'
194
+ */
195
+ invalidText:string;private invalidTextAuthored;autocomplete:string;inputmode:'tel'|'numeric'|'text';enterkeyhint:string;
183
196
  /** Native readonly mode: keeps the telephone value focusable/copyable/submittable while
184
197
  * preventing telephone and country edits and barring constraint validation. */
185
198
  readonly:boolean;
@@ -214,7 +227,7 @@ get phoneStatus():LyraPhoneNumberStatus;get selectionStart():number|null;set sel
214
227
  * once an adapter reformats the text differently from what was typed. A no-op (no reassignment,
215
228
  * no selection change) when the reformat didn't actually change the string, which keeps the
216
229
  * no-adapter path exactly as before. */
217
- private syncFormattedValue;private get eventDetail();private get effectiveCountryLabel();
230
+ private syncFormattedValue;private get eventDetail();static get observedAttributes():string[];attributeChangedCallback(name:string,oldValue:string|null,newValue:string|null):void;private get effectiveCountryLabel();
218
231
  /** The telephone input's accessible name. Every consumer-supplied source wins, in the precedence
219
232
  * order this component documents; a bare `<lr-phone-input>` with none of them set still lands on
220
233
  * a localized generic name rather than shipping an unnamed field to the accessibility tree, the
@@ -234,7 +247,7 @@ private effectivePhoneLabel;private get incompleteMessage();private get invalidM
234
247
  * raised and published `:state(invalid)`/`:state(user-invalid)`, painting every disabled field
235
248
  * with the documented `:state(user-invalid)` error styling.
236
249
  */
237
- protected updateValidity():void;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;private onInput;private onChange;private onCountryChange;
250
+ protected updateValidity():void;adoptedCallback():void;disconnectedCallback():void;private externalDescriptionLease?;private syncExternalDescription;private releaseExternalDescription;connectedCallback():void;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;private onInput;private onChange;private onCountryChange;
238
251
  /**
239
252
  * Implicit form submission, through the shared gate in `internal/submit-on-enter.ts` — the
240
253
  * internal telephone input lives in a shadow root and has no form owner, so the platform can
@@ -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{nextId}from"../../../internal/a11y.js";import{chevronIcon}from"../../../internal/icons.js";import{SET_ANCHORED_VALIDITY,VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{FormAssociated,isBarredFromValidation}from"../../../internal/form-associated.js";import{getDisplayNames}from"../../../internal/intl-cache.js";import{LyraElement}from"../../../internal/lyra-element.js";import{sizes}from"../../../internal/sizes.styles.js";import{styles}from"./phone-input.styles.js";import{submitOnEnter}from"../../../internal/submit-on-enter.js";import{dispatchNativeInputEvent,relayNativeEvent}from"../../../internal/native-event-relay.js";import{declaredDefaultConverter,trueDefaultSpellcheckConverter as spellcheckConverter}from"../../../internal/converters.js";import{resolveOptionalPeerCapability}from"../../../internal/optional-peer-capabilities.js";import{LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_phoneInputIncomplete,LYRA_DEFAULT_phoneInputLabel,LYRA_DEFAULT_select,LYRA_DEFAULT_valueInvalid}from"../../../internal/default-strings.generated.js";function isLibphonenumberModule(candidate){const api=candidate;return(typeof api=="object"||typeof api=="function")&&api!==null&&typeof api.getCountries=="function"&&typeof api.getCountryCallingCode=="function"&&typeof api.parsePhoneNumberFromString=="function"}async function loadLibphonenumberAdapter(loader){const raw=await loader(),resolved=resolveOptionalPeerCapability(raw,isLibphonenumberModule);if(!resolved)throw new TypeError("Invalid optional peer for <lr-phone-input>: the module passed to loadLibphonenumberAdapter() does not expose the getCountries/getCountryCallingCode/parsePhoneNumberFromString capability libphonenumber-js provides.");const module=resolved;return{countries:Object.freeze(module.getCountries().map(code=>Object.freeze({code:normalizeCountry(code),callingCode:module.getCountryCallingCode(code)}))),parse(input,country){const raw2=input.trim();if(!raw2)return{status:"empty"};const normalizedCountry=country?normalizeCountry(country):void 0,phone=module.parsePhoneNumberFromString(raw2,normalizedCountry);if(!phone)return{status:module.validatePhoneNumberLength?.(raw2,normalizedCountry)==="TOO_SHORT"||isDialLike(raw2)?"incomplete":"invalid",formatted:raw2};const formatted=raw2.startsWith("+")?phone.formatInternational():phone.formatNational();if(phone.isValid())return{status:"valid",e164:phone.number,formatted,country:phone.country?normalizeCountry(phone.country):normalizedCountry};const length=module.validatePhoneNumberLength?.(raw2,normalizedCountry);return{status:length==="TOO_SHORT"||!length&&!phone.isPossible()?"incomplete":"invalid",formatted,country:phone.country?normalizeCountry(phone.country):normalizedCountry}}}}class LyraPhoneInputBase extends LyraElement{}const E164_RE=/^\+[1-9]\d{1,14}$/,DIAL_LIKE_RE=/^[+\d\s().-]+$/;function normalizeCountry(country){return country.trim().toUpperCase()}function isDialLike(value){return DIAL_LIKE_RE.test(value.trim())}function digitsBefore(value,index){let count=0;for(let i=0;i<index&&i<value.length;i++)/\d/.test(value[i])&&count++;return count}function indexAfterDigits(value,digitCount){if(digitCount<=0)return 0;let count=0;for(let i=0;i<value.length;i++)if(/\d/.test(value[i])&&(count++,count===digitCount))return i+1;return value.length}function fallbackParse(input){const raw=input.trim();if(!raw)return{status:"empty"};const compact=raw.replace(/[\s().-]/g,"");return E164_RE.test(compact)?{status:"valid",e164:compact,formatted:raw}:isDialLike(raw)?{status:"incomplete",formatted:raw}:{status:"invalid",formatted:raw}}function normalizeParseResult(result,input){try{if(result===null||typeof result!="object")return{status:"invalid",formatted:input};const record=result,status=record.status;if(status!=="empty"&&status!=="incomplete"&&status!=="invalid"&&status!=="valid")return{status:"invalid",formatted:input};const formatted=record.formatted;if(formatted!==void 0&&typeof formatted!="string")return{status:"invalid",formatted:input};const rawCountry=record.country;if(rawCountry!==void 0&&typeof rawCountry!="string")return{status:"invalid",formatted:formatted??input};const country=typeof rawCountry=="string"&&/^[A-Za-z]{2}$/.test(rawCountry.trim())?normalizeCountry(rawCountry):void 0,metadata={...formatted===void 0?{}:{formatted},...country===void 0?{}:{country}};if(status==="valid"){const e164=record.e164;return typeof e164!="string"||!E164_RE.test(e164)?{status:"invalid",formatted:formatted??input,...country?{country}:{}}:{status,e164,...metadata}}return{status,...metadata}}catch{return{status:"invalid",formatted:input}}}const MAX_PHONE_COUNTRIES=512;function normalizeCountryCatalog(source){if(!Array.isArray(source))return Object.freeze([]);const rows=[],seen=new Set;let length=0;try{length=Math.min(source.length,MAX_PHONE_COUNTRIES)}catch{return Object.freeze(rows)}for(let index=0;index<length;index+=1)try{const item=source[index];if(item===null||typeof item!="object")continue;const candidate=item,rawCode=candidate.code,rawCallingCode=candidate.callingCode,rawLabel=candidate.label;if(typeof rawCode!="string"||typeof rawCallingCode!="string")continue;const code=normalizeCountry(rawCode),callingCode=rawCallingCode.replace(/^\+/,"");if(!/^[A-Z]{2}$/.test(code)||!/^[1-9]\d{0,2}$/.test(callingCode)||seen.has(code)||rawLabel!==void 0&&typeof rawLabel!="string")continue;seen.add(code),rows.push(Object.freeze({code,callingCode,...rawLabel===void 0?{}:{label:rawLabel}}))}catch{}return Object.freeze(rows)}class LyraPhoneInput extends FormAssociated(LyraPhoneInputBase){constructor(){super(...arguments),this.flags=!1,this.adapterCountries=Object.freeze([]),this.defaultCountry="",this.label="",this.hint="",this.errorText="",this.placeholder="",this.size="m",this.pill=!1,this.accessibleLabel=null,this.countryLabel="Select",this.phoneLabel="",this.incompleteText="This phone number is incomplete.",this.invalidText="The value is invalid.",this.autocomplete="tel",this.inputmode="tel",this.enterkeyhint="",this.readonly=!1,this.autofocus=!1,this.spellcheck=!0,this.autocapitalize="",this.autoCorrect="",this.editableValue="",this.status="empty",this.touched=!1,this.hasLabelSlot=!1,this.hasHintSlot=!1,this.hasErrorSlot=!1,this.hasCountryPrefixSlot=!1,this.inputId=nextId("phone-input"),this.hintId=nextId("phone-hint"),this.errorId=nextId("phone-error"),this.explicitCountry="",this.onInput=event=>{if(this.liveDisabled||this.readonly){event.stopPropagation();return}const input=event.currentTarget,caret=input.selectionStart,digitsBeforeCaret=caret==null?null:digitsBefore(input.value,caret);this.applyParsed(input.value,this.parse(input.value)),this.syncFormattedValue(input,digitsBeforeCaret),relayNativeEvent(this,event),this.emit("lr-input",this.eventDetail)},this.onChange=event=>{if(this.liveDisabled||this.readonly){event.stopPropagation();return}this.touched=!0,relayNativeEvent(this,event),this.emit("lr-change",this.eventDetail)},this.onCountryChange=event=>{if(this.liveDisabled||this.readonly){event.stopPropagation();return}this.country=normalizeCountry(event.currentTarget.value),this.applyParsed(this.editableValue,this.parse(this.editableValue)),dispatchNativeInputEvent(this),this.emit("lr-input",this.eventDetail),relayNativeEvent(this,event),this.emit("lr-change",this.eventDetail)},this.onKeyDown=event=>{this.liveDisabled||submitOnEnter(this,event)},this.onFocus=event=>{if(this.liveDisabled){event.stopPropagation();return}relayNativeEvent(this,event)},this.onBlur=event=>{this.liveDisabled||(this.touched=!0),relayNativeEvent(this,event)},this.onLabelSlotChange=event=>{this.hasLabelSlot=event.currentTarget.assignedElements({flatten:!0}).length>0},this.onHintSlotChange=event=>{this.hasHintSlot=event.currentTarget.assignedElements({flatten:!0}).length>0},this.onErrorSlotChange=event=>{this.hasErrorSlot=event.currentTarget.assignedElements({flatten:!0}).length>0},this.onCountryPrefixSlotChange=event=>{this.hasCountryPrefixSlot=event.currentTarget.assignedElements({flatten:!0}).length>0}}static{this.defaultStrings={...super.defaultStrings,fieldRequired:LYRA_DEFAULT_fieldRequired,phoneInputIncomplete:LYRA_DEFAULT_phoneInputIncomplete,phoneInputLabel:LYRA_DEFAULT_phoneInputLabel,select:LYRA_DEFAULT_select,valueInvalid:LYRA_DEFAULT_valueInvalid}}static{this.styles=[LyraElement.styles,sizes,styles]}static{this.properties={country:{noAccessor:!0}}}get adapter(){return this._adapter}set adapter(next){const previous=this._adapter;this._adapter=next,this.adapterCountries=normalizeCountryCatalog(next?.countries),this.requestUpdate("adapter",previous)}get countries(){return this._countries}set countries(next){const previous=this._countries;this._countries=next===void 0?void 0:normalizeCountryCatalog(next),this.requestUpdate("countries",previous)}get country(){return this.resolveCountry(this.availableCountries)}set country(next){const old=this.country;this.explicitCountry=normalizeCountry(next??""),this.requestUpdate("country",old)}get input(){return this.inputElement}get inputValue(){return this.editableValue}get phoneStatus(){return this.status}get selectionStart(){return this.inputElement?.selectionStart??null}set selectionStart(value){this.inputElement&&(this.inputElement.selectionStart=value??0)}get selectionEnd(){return this.inputElement?.selectionEnd??null}set selectionEnd(value){this.inputElement&&(this.inputElement.selectionEnd=value??0)}get selectionDirection(){return this.inputElement?.selectionDirection}set selectionDirection(value){this.inputElement&&(this.inputElement.selectionDirection=value??"none")}[VALIDITY_ANCHOR](){return this.inputElement??null}get value(){return super.value}set value(next){const raw=next??"",parsed=this.parse(raw);this.applyParsed(raw,parsed)}get availableCountries(){return this.countries??this.adapterCountries}resolveCountry(rows){const codes=rows.map(row=>row.code),explicit=normalizeCountry(this.explicitCountry),preferred=normalizeCountry(this.defaultCountry);return codes.includes(explicit)?explicit:codes.includes(preferred)?preferred:codes[0]??""}parse(input){if(!this.adapter)return fallbackParse(input);try{const parse=this.adapter.parse;return typeof parse!="function"?{status:"invalid",formatted:input}:normalizeParseResult(parse.call(this.adapter,input,this.country||void 0),input)}catch{return{status:"invalid",formatted:input}}}reconcileCountryCatalog(){this.explicitCountry=this.resolveCountry(this.availableCountries)}applyParsed(raw,parsed){this.editableValue=parsed.formatted??raw,this.status=parsed.status,parsed.country&&(this.country=normalizeCountry(parsed.country)),super.value=parsed.status==="valid"?parsed.e164:"",this.setAttribute("data-phone-status",parsed.status)}syncFormattedValue(input,digitsBeforeCaret){if(input.value!==this.editableValue&&(input.value=this.editableValue,digitsBeforeCaret!=null)){const position=indexAfterDigits(this.editableValue,digitsBeforeCaret);input.setSelectionRange(position,position)}}get eventDetail(){return{value:super.value,inputValue:this.editableValue,country:this.country,valid:this.internals.validity.valid,status:this.status}}get effectiveCountryLabel(){return this.localize("select",this.countryLabel==="Select"?void 0:this.countryLabel)}effectivePhoneLabel(hasLabel){return this.accessibleLabel!==null?this.accessibleLabel:this.phoneLabel?this.phoneLabel:hasLabel?nothing:this.placeholder||this.localize("phoneInputLabel")}get incompleteMessage(){return this.localize("phoneInputIncomplete",this.incompleteText==="This phone number is incomplete."?void 0:this.incompleteText)}get invalidMessage(){return this.localize("valueInvalid",this.invalidText==="The value is invalid."?void 0:this.invalidText)}countryName(row){if(row.label)return row.label;try{return getDisplayNames(this.effectiveLocale,{type:"region"}).of(row.code)??row.code}catch{return row.code}}updateValidity(){if(isBarredFromValidation(this,this.internals)){this[SET_ANCHORED_VALIDITY]({});return}const flags={};let message="";this.required&&this.status==="empty"?(flags.valueMissing=!0,message=this.localize("fieldRequired")):this.status==="incomplete"?(flags.badInput=!0,message=this.incompleteMessage):this.status==="invalid"&&(flags.typeMismatch=!0,message=this.invalidMessage),this[SET_ANCHORED_VALIDITY](flags,message)}willUpdate(changed){super.willUpdate(changed),this.flags&&!LyraPhoneInput.flagRegistration&&(LyraPhoneInput.flagRegistration=import("../../media/flag/flag.js").catch(error=>{console.warn("<lr-phone-input> failed to register <lr-flag> for its flags option:",error)})),this.hasUpdated||(this.hasLabelSlot=Array.from(this.children??[]).some(child=>child.getAttribute("slot")==="label"),this.hasHintSlot=Array.from(this.children??[]).some(child=>child.getAttribute("slot")==="hint"),this.hasErrorSlot=Array.from(this.children??[]).some(child=>child.getAttribute("slot")==="error"),this.hasCountryPrefixSlot=Array.from(this.children??[]).some(child=>child.getAttribute("slot")==="country-prefix")),(!this.hasUpdated||changed.has("countries")||changed.has("adapter")||changed.has("country")||changed.has("defaultCountry"))&&this.reconcileCountryCatalog(),(changed.has("adapter")||changed.has("countries")||changed.has("country")||changed.has("defaultCountry"))&&this.editableValue&&this.applyParsed(this.editableValue,this.parse(this.editableValue))}updated(changed){if(super.updated(changed),changed.has("touched")||changed.has("required")||changed.has("value")||changed.has("status")){const invalid=this.touched&&!this.internals.validity.valid;this.toggleAttribute("data-invalid",invalid),invalid?this.setAttribute("aria-invalid","true"):this.removeAttribute("aria-invalid")}}get liveDisabled(){return this.effectiveDisabled||this.matches(":disabled")}click(){this.liveDisabled||this.inputElement?.click()}focus(options){this.liveDisabled||this.inputElement?.focus(options)}blur(){this.inputElement?.blur()}select(){this.inputElement?.select()}setSelectionRange(start,end,direction){this.inputElement?.setSelectionRange(start,end,direction)}setRangeText(replacement,start,end,selectMode){const input=this.inputElement;if(!input)return;start===void 0||end===void 0?input.setRangeText(replacement):input.setRangeText(replacement,start,end,selectMode);const caret=input.selectionStart,digitsBeforeCaret=caret==null?null:digitsBefore(input.value,caret);this.applyParsed(input.value,this.parse(input.value)),this.syncFormattedValue(input,digitsBeforeCaret)}formResetCallback(){this.explicitCountry="",this.reconcileCountryCatalog(),super.formResetCallback(),this.touched=!1}render(){const hasLabel=!!(this.label||this.hasLabelSlot),validationError=this.touched?this.validationMessage:"",renderedError=this.errorText||validationError,hasHint=!!(this.hint||this.hasHintSlot),hasError=!!(renderedError||this.hasErrorSlot),describedBy=[hasHint?this.hintId:"",hasError?this.errorId:""].filter(Boolean).join(" "),rows=this.availableCountries,current=rows.find(row=>row.code===this.country);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{observeReactivePropertyWrites}from"../../../internal/reactive-property-writes.js";import{acquireResolvedAriaRelationship}from"../../../internal/aria-controls.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{nextId}from"../../../internal/a11y.js";import{chevronIcon}from"../../../internal/icons.js";import{SET_ANCHORED_VALIDITY,VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{FormAssociated,isBarredFromValidation}from"../../../internal/form-associated.js";import{getDisplayNames}from"../../../internal/intl-cache.js";import{LyraElement}from"../../../internal/lyra-element.js";import{sizes}from"../../../internal/sizes.styles.js";import{styles}from"./phone-input.styles.js";import{submitOnEnter}from"../../../internal/submit-on-enter.js";import{dispatchNativeInputEvent,relayNativeEvent}from"../../../internal/native-event-relay.js";import{declaredDefaultConverter,trueDefaultSpellcheckConverter as spellcheckConverter}from"../../../internal/converters.js";import{resolveOptionalPeerCapability}from"../../../internal/optional-peer-capabilities.js";import{LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_phoneInputIncomplete,LYRA_DEFAULT_phoneInputLabel,LYRA_DEFAULT_select,LYRA_DEFAULT_valueInvalid}from"../../../internal/default-strings.generated.js";function isLibphonenumberModule(candidate){const api=candidate;return(typeof api=="object"||typeof api=="function")&&api!==null&&typeof api.getCountries=="function"&&typeof api.getCountryCallingCode=="function"&&typeof api.parsePhoneNumberFromString=="function"}async function loadLibphonenumberAdapter(loader){const raw=await loader(),resolved=resolveOptionalPeerCapability(raw,isLibphonenumberModule);if(!resolved)throw new TypeError("Invalid optional peer for <lr-phone-input>: the module passed to loadLibphonenumberAdapter() does not expose the getCountries/getCountryCallingCode/parsePhoneNumberFromString capability libphonenumber-js provides.");const module=resolved;return{countries:Object.freeze(module.getCountries().map(code=>Object.freeze({code:normalizeCountry(code),callingCode:module.getCountryCallingCode(code)}))),parse(input,country){const raw2=input.trim();if(!raw2)return{status:"empty"};const normalizedCountry=country?normalizeCountry(country):void 0,phone=module.parsePhoneNumberFromString(raw2,normalizedCountry);if(!phone)return{status:module.validatePhoneNumberLength?.(raw2,normalizedCountry)==="TOO_SHORT"||isDialLike(raw2)?"incomplete":"invalid",formatted:raw2};const formatted=raw2.startsWith("+")?phone.formatInternational():phone.formatNational();if(phone.isValid())return{status:"valid",e164:phone.number,formatted,country:phone.country?normalizeCountry(phone.country):normalizedCountry};const length=module.validatePhoneNumberLength?.(raw2,normalizedCountry);return{status:length==="TOO_SHORT"||!length&&!phone.isPossible()?"incomplete":"invalid",formatted,country:phone.country?normalizeCountry(phone.country):normalizedCountry}}}}class LyraPhoneInputBase extends LyraElement{}const E164_RE=/^\+[1-9]\d{1,14}$/,DIAL_LIKE_RE=/^[+\d\s().-]+$/;function normalizeCountry(country){return country.trim().toUpperCase()}function isDialLike(value){return DIAL_LIKE_RE.test(value.trim())}function digitsBefore(value,index){let count=0;for(let i=0;i<index&&i<value.length;i++)/\d/.test(value[i])&&count++;return count}function indexAfterDigits(value,digitCount){if(digitCount<=0)return 0;let count=0;for(let i=0;i<value.length;i++)if(/\d/.test(value[i])&&(count++,count===digitCount))return i+1;return value.length}function fallbackParse(input){const raw=input.trim();if(!raw)return{status:"empty"};const compact=raw.replace(/[\s().-]/g,"");return E164_RE.test(compact)?{status:"valid",e164:compact,formatted:raw}:isDialLike(raw)?{status:"incomplete",formatted:raw}:{status:"invalid",formatted:raw}}function normalizeParseResult(result,input){try{if(result===null||typeof result!="object")return{status:"invalid",formatted:input};const record=result,status=record.status;if(status!=="empty"&&status!=="incomplete"&&status!=="invalid"&&status!=="valid")return{status:"invalid",formatted:input};const formatted=record.formatted;if(formatted!==void 0&&typeof formatted!="string")return{status:"invalid",formatted:input};const rawCountry=record.country;if(rawCountry!==void 0&&typeof rawCountry!="string")return{status:"invalid",formatted:formatted??input};const country=typeof rawCountry=="string"&&/^[A-Za-z]{2}$/.test(rawCountry.trim())?normalizeCountry(rawCountry):void 0,metadata={...formatted===void 0?{}:{formatted},...country===void 0?{}:{country}};if(status==="valid"){const e164=record.e164;return typeof e164!="string"||!E164_RE.test(e164)?{status:"invalid",formatted:formatted??input,...country?{country}:{}}:{status,e164,...metadata}}return{status,...metadata}}catch{return{status:"invalid",formatted:input}}}const MAX_PHONE_COUNTRIES=512;function normalizeCountryCatalog(source){if(!Array.isArray(source))return Object.freeze([]);const rows=[],seen=new Set;let length=0;try{length=Math.min(source.length,MAX_PHONE_COUNTRIES)}catch{return Object.freeze(rows)}for(let index=0;index<length;index+=1)try{const item=source[index];if(item===null||typeof item!="object")continue;const candidate=item,rawCode=candidate.code,rawCallingCode=candidate.callingCode,rawLabel=candidate.label;if(typeof rawCode!="string"||typeof rawCallingCode!="string")continue;const code=normalizeCountry(rawCode),callingCode=rawCallingCode.replace(/^\+/,"");if(!/^[A-Z]{2}$/.test(code)||!/^[1-9]\d{0,2}$/.test(callingCode)||seen.has(code)||rawLabel!==void 0&&typeof rawLabel!="string")continue;seen.add(code),rows.push(Object.freeze({code,callingCode,...rawLabel===void 0?{}:{label:rawLabel}}))}catch{}return Object.freeze(rows)}class LyraPhoneInput extends FormAssociated(LyraPhoneInputBase){constructor(){super(...arguments),this.flags=!1,this.adapterCountries=Object.freeze([]),this.defaultCountry="",this.label="",this.hint="",this.errorText="",this.placeholder="",this.size="m",this.pill=!1,this.accessibleLabel=null,this.countryLabel="Select",this.countryLabelAuthored=!1,this.phoneLabel="",this.incompleteText="This phone number is incomplete.",this.incompleteTextAuthored=!1,this.invalidText="The value is invalid.",this.invalidTextAuthored=!1,this.autocomplete="tel",this.inputmode="tel",this.enterkeyhint="",this.readonly=!1,this.autofocus=!1,this.spellcheck=!0,this.autocapitalize="",this.autoCorrect="",this.editableValue="",this.status="empty",this.touched=!1,this.hasLabelSlot=!1,this.hasHintSlot=!1,this.hasErrorSlot=!1,this.hasCountryPrefixSlot=!1,this.inputId=nextId("phone-input"),this.hintId=nextId("phone-hint"),this.errorId=nextId("phone-error"),this.explicitCountry="",this.onInput=event=>{if(this.liveDisabled||this.readonly){event.stopPropagation();return}const input=event.currentTarget,caret=input.selectionStart,digitsBeforeCaret=caret==null?null:digitsBefore(input.value,caret);this.applyParsed(input.value,this.parse(input.value)),this.syncFormattedValue(input,digitsBeforeCaret),relayNativeEvent(this,event),this.emit("lr-input",this.eventDetail)},this.onChange=event=>{if(this.liveDisabled||this.readonly){event.stopPropagation();return}this.touched=!0,relayNativeEvent(this,event),this.emit("lr-change",this.eventDetail)},this.onCountryChange=event=>{if(this.liveDisabled||this.readonly){event.stopPropagation();return}this.country=normalizeCountry(event.currentTarget.value),this.applyParsed(this.editableValue,this.parse(this.editableValue)),dispatchNativeInputEvent(this),this.emit("lr-input",this.eventDetail),relayNativeEvent(this,event),this.emit("lr-change",this.eventDetail)},this.onKeyDown=event=>{this.liveDisabled||submitOnEnter(this,event)},this.onFocus=event=>{if(this.liveDisabled){event.stopPropagation();return}relayNativeEvent(this,event)},this.onBlur=event=>{this.liveDisabled||(this.touched=!0),relayNativeEvent(this,event)},this.onLabelSlotChange=event=>{this.hasLabelSlot=event.currentTarget.assignedElements({flatten:!0}).length>0},this.onHintSlotChange=event=>{this.hasHintSlot=event.currentTarget.assignedElements({flatten:!0}).length>0},this.onErrorSlotChange=event=>{this.hasErrorSlot=event.currentTarget.assignedElements({flatten:!0}).length>0},this.onCountryPrefixSlotChange=event=>{this.hasCountryPrefixSlot=event.currentTarget.assignedElements({flatten:!0}).length>0}}static{this.defaultStrings={...super.defaultStrings,fieldRequired:LYRA_DEFAULT_fieldRequired,phoneInputIncomplete:LYRA_DEFAULT_phoneInputIncomplete,phoneInputLabel:LYRA_DEFAULT_phoneInputLabel,select:LYRA_DEFAULT_select,valueInvalid:LYRA_DEFAULT_valueInvalid}}static{this.styles=[LyraElement.styles,sizes,styles]}static{this.properties={country:{noAccessor:!0}}}get adapter(){return this._adapter}set adapter(next){const previous=this._adapter;this._adapter=next,this.adapterCountries=normalizeCountryCatalog(next?.countries),this.requestUpdate("adapter",previous)}get countries(){return this._countries}set countries(next){const previous=this._countries;this._countries=next===void 0?void 0:normalizeCountryCatalog(next),this.requestUpdate("countries",previous)}get country(){return this.resolveCountry(this.availableCountries)}set country(next){const old=this.country;this.explicitCountry=normalizeCountry(next??""),this.requestUpdate("country",old)}get input(){return this.inputElement}get inputValue(){return this.editableValue}get phoneStatus(){return this.status}get selectionStart(){return this.inputElement?.selectionStart??null}set selectionStart(value){this.inputElement&&(this.inputElement.selectionStart=value??0)}get selectionEnd(){return this.inputElement?.selectionEnd??null}set selectionEnd(value){this.inputElement&&(this.inputElement.selectionEnd=value??0)}get selectionDirection(){return this.inputElement?.selectionDirection}set selectionDirection(value){this.inputElement&&(this.inputElement.selectionDirection=value??"none")}[VALIDITY_ANCHOR](){return this.inputElement??null}get value(){return super.value}set value(next){const raw=next??"",parsed=this.parse(raw);this.applyParsed(raw,parsed)}get availableCountries(){return this.countries??this.adapterCountries}resolveCountry(rows){const codes=rows.map(row=>row.code),explicit=normalizeCountry(this.explicitCountry),preferred=normalizeCountry(this.defaultCountry??"");return codes.includes(explicit)?explicit:codes.includes(preferred)?preferred:codes[0]??""}parse(input){if(!this.adapter)return fallbackParse(input);try{const parse=this.adapter.parse;return typeof parse!="function"?{status:"invalid",formatted:input}:normalizeParseResult(parse.call(this.adapter,input,this.country||void 0),input)}catch{return{status:"invalid",formatted:input}}}reconcileCountryCatalog(){this.explicitCountry=this.resolveCountry(this.availableCountries)}applyParsed(raw,parsed){this.editableValue=parsed.formatted??raw,this.status=parsed.status,parsed.country&&(this.country=normalizeCountry(parsed.country)),super.value=parsed.status==="valid"?parsed.e164:"",this.setAttribute("data-phone-status",parsed.status)}syncFormattedValue(input,digitsBeforeCaret){if(input.value!==this.editableValue&&(input.value=this.editableValue,digitsBeforeCaret!=null)){const position=indexAfterDigits(this.editableValue,digitsBeforeCaret);input.setSelectionRange(position,position)}}get eventDetail(){return{value:super.value,inputValue:this.editableValue,country:this.country,valid:this.internals.validity.valid,status:this.status}}static get observedAttributes(){const attributes=super.observedAttributes;return observeReactivePropertyWrites(this.prototype,["countryLabel","incompleteText","invalidText"],(instance,name,value)=>{const authored=value!=null;let ownershipChanged=!1;switch(name){case"countryLabel":if(instance.countryLabelAuthored===void 0)return;ownershipChanged=authored!==instance.countryLabelAuthored,instance.countryLabelAuthored=authored;break;case"incompleteText":if(instance.incompleteTextAuthored===void 0)return;ownershipChanged=authored!==instance.incompleteTextAuthored,instance.incompleteTextAuthored=authored;break;case"invalidText":if(instance.invalidTextAuthored===void 0)return;ownershipChanged=authored!==instance.invalidTextAuthored,instance.invalidTextAuthored=authored;break}ownershipChanged&&instance.requestUpdate(),name!=="countryLabel"&&instance.hasUpdated&&instance.updateValidity()}),attributes}attributeChangedCallback(name,oldValue,newValue){if(super.attributeChangedCallback(name,oldValue,newValue),newValue===null){if(name==="country-label")this.countryLabelAuthored=!1;else if(name==="incomplete-text")this.incompleteTextAuthored=!1;else if(name==="invalid-text")this.invalidTextAuthored=!1;else return;this.requestUpdate(),this.hasUpdated&&this.updateValidity()}}get effectiveCountryLabel(){return this.countryLabelAuthored?this.countryLabel:this.localize("select")}effectivePhoneLabel(hasLabel){return this.accessibleLabel!==null?this.accessibleLabel:this.phoneLabel?this.phoneLabel:hasLabel?nothing:this.placeholder||this.localize("phoneInputLabel")}get incompleteMessage(){return(this.incompleteTextAuthored?this.incompleteText:"")||this.localize("phoneInputIncomplete")}get invalidMessage(){return(this.invalidTextAuthored?this.invalidText:"")||this.localize("valueInvalid")}countryName(row){if(row.label)return row.label;try{return getDisplayNames(this.effectiveLocale,{type:"region"}).of(row.code)??row.code}catch{return row.code}}updateValidity(){if(isBarredFromValidation(this,this.internals)){this[SET_ANCHORED_VALIDITY]({});return}const flags={};let message="";this.required&&this.status==="empty"?(flags.valueMissing=!0,message=this.localize("fieldRequired")):this.status==="incomplete"?(flags.badInput=!0,message=this.incompleteMessage):this.status==="invalid"&&(flags.typeMismatch=!0,message=this.invalidMessage),this[SET_ANCHORED_VALIDITY](flags,message)}adoptedCallback(){super.adoptedCallback(),this.releaseExternalDescription(),this.hasUpdated&&this.syncExternalDescription()}disconnectedCallback(){this.releaseExternalDescription(),super.disconnectedCallback()}syncExternalDescription(){if(!this.isConnected)return;const target=this.inputElement??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()}willUpdate(changed){super.willUpdate(changed),this.flags&&!LyraPhoneInput.flagRegistration&&(LyraPhoneInput.flagRegistration=import("../../media/flag/flag.js").catch(error=>{console.warn("<lr-phone-input> failed to register <lr-flag> for its flags option:",error)})),this.hasUpdated||(this.hasLabelSlot=Array.from(this.children??[]).some(child=>child.getAttribute("slot")==="label"),this.hasHintSlot=Array.from(this.children??[]).some(child=>child.getAttribute("slot")==="hint"),this.hasErrorSlot=Array.from(this.children??[]).some(child=>child.getAttribute("slot")==="error"),this.hasCountryPrefixSlot=Array.from(this.children??[]).some(child=>child.getAttribute("slot")==="country-prefix")),(!this.hasUpdated||changed.has("countries")||changed.has("adapter")||changed.has("country")||changed.has("defaultCountry"))&&this.reconcileCountryCatalog(),(changed.has("adapter")||changed.has("countries")||changed.has("country")||changed.has("defaultCountry"))&&this.editableValue&&this.applyParsed(this.editableValue,this.parse(this.editableValue))}updated(changed){if(super.updated(changed),this.syncExternalDescription(),changed.has("strings")&&this.updateValidity(),changed.has("touched")||changed.has("required")||changed.has("value")||changed.has("status")){const invalid=this.touched&&!this.internals.validity.valid;this.toggleAttribute("data-invalid",invalid),invalid?this.setAttribute("aria-invalid","true"):this.removeAttribute("aria-invalid")}}get liveDisabled(){return this.effectiveDisabled||this.matches(":disabled")}click(){this.liveDisabled||this.inputElement?.click()}focus(options){this.liveDisabled||this.inputElement?.focus(options)}blur(){this.inputElement?.blur()}select(){this.inputElement?.select()}setSelectionRange(start,end,direction){this.inputElement?.setSelectionRange(start,end,direction)}setRangeText(replacement,start,end,selectMode){const input=this.inputElement;if(!input)return;start===void 0||end===void 0?input.setRangeText(replacement):input.setRangeText(replacement,start,end,selectMode);const caret=input.selectionStart,digitsBeforeCaret=caret==null?null:digitsBefore(input.value,caret);this.applyParsed(input.value,this.parse(input.value)),this.syncFormattedValue(input,digitsBeforeCaret)}formResetCallback(){this.explicitCountry="",this.reconcileCountryCatalog(),super.formResetCallback(),this.touched=!1}render(){const hasLabel=!!(this.label||this.hasLabelSlot),validationError=this.touched?this.validationMessage:"",renderedError=this.errorText||validationError,hasHint=!!(this.hint||this.hasHintSlot),hasError=!!(renderedError||this.hasErrorSlot),describedBy=[hasHint?this.hintId:"",hasError?this.errorId:""].filter(Boolean).join(" "),rows=this.availableCountries,current=rows.find(row=>row.code===this.country);return html`
2
2
  <div part="form-control">
3
3
  <label part="form-control-label" for=${this.inputId} ?hidden=${!hasLabel}>
4
4
  <slot name="label" @slotchange=${this.onLabelSlotChange}>${this.label}</slot>
@@ -18,6 +18,10 @@ import{type TemplateResult}from'lit';import{LyraRadio}from'./radio.class.js';
18
18
  * the page. The leading, label, and trailing wrappers are hidden independently while empty, so a
19
19
  * missing region never contributes a dead `--lr-radio-button-gap`.
20
20
  *
21
+ * Host `aria-describedby` references resolve onto the internal radio and track target changes,
22
+ * reconnect and document adoption. Equal-value `checked` assignments retain the inherited dirty
23
+ * state contract: later defaults cannot replace the live selection until reset.
24
+ *
21
25
  * @customElement lr-radio-button
22
26
  * @slot - Label text.
23
27
  * @slot start - Content placed before the label, typically an icon.
@@ -5,6 +5,9 @@ import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from
5
5
  * to the radiogroup only after user interaction or a native validity check (`checkValidity()`,
6
6
  * `reportValidity()`, or form-level validation), while explicit error chrome remains immediate.
7
7
  *
8
+ * Host `aria-describedby` references resolve onto the internal radiogroup before local hint/error
9
+ * guidance. References track target replacement/removal, reconnect and document adoption.
10
+ *
8
11
  * @customElement lr-radio-group
9
12
  * @slot - Radio controls.
10
13
  * @slot label - Visible group label.
@@ -77,7 +80,7 @@ get name():string;set name(next:string|null);get value():string;set value(next:s
77
80
  /** Reflected current reset default; changing it never overwrites a dirty live selection. */
78
81
  get defaultValue():string;set defaultValue(next:string);
79
82
  /** Consumer-supplied validation message reflected through `custom-error`. */
80
- get customError():string|null;set customError(next:string|null);get required():boolean;set required(next:boolean);get disabled():boolean;set disabled(next:boolean);get effectiveDisabled():boolean;get form():HTMLFormElement|null;set form(owner:FormOwnerValue);getForm():HTMLFormElement|null;get labels():NodeList;get validity():ValidityState;get validationMessage():string;get willValidate():boolean;constructor();private onInvalid;connectedCallback():void;private armRunResizeObserver;private scheduleRunProjection;private isButtonRadio;private areActuallyAdjacent;private projectButtonRuns;private armMembershipObserver;disconnectedCallback():void;adoptedCallback():void;private resetMembershipObserver;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;private syncSupportSlots;private radioGroupOwner;private radios;private isRadioAvailable;private selectValue;private syncRadios;private releaseRadios;private onKeyDown;private onSlotChange;private onRadioSlotChange;
83
+ get customError():string|null;set customError(next:string|null);get required():boolean;set required(next:boolean);get disabled():boolean;set disabled(next:boolean);get effectiveDisabled():boolean;get form():HTMLFormElement|null;set form(owner:FormOwnerValue);getForm():HTMLFormElement|null;get labels():NodeList;get validity():ValidityState;get validationMessage():string;get willValidate():boolean;constructor();private onInvalid;private externalDescriptionLease?;private syncExternalDescription;private releaseExternalDescription;connectedCallback():void;private armRunResizeObserver;private scheduleRunProjection;private isButtonRadio;private areActuallyAdjacent;private projectButtonRuns;private armMembershipObserver;disconnectedCallback():void;adoptedCallback():void;private resetMembershipObserver;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;private syncSupportSlots;private radioGroupOwner;private radios;private isRadioAvailable;private selectValue;private syncRadios;private releaseRadios;private onKeyDown;private onSlotChange;private onRadioSlotChange;
81
84
  /** Moves focus to the selected enabled option, or the first enabled option when empty. */
82
85
  focus(options?:FocusOptions):void;
83
86
  /** Removes focus from whichever owned option currently contains the deep active element. */