@aceshooting/lyra-ui 9.1.1 → 10.0.1

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 (578) hide show
  1. package/CHANGELOG.md +597 -0
  2. package/custom-elements.json +1 -1
  3. package/dist/cli/migrate-wa.mjs +52 -0
  4. package/dist/cli/migration-contract.json +1 -1
  5. package/dist/components/agent-tools/activity-feed/activity-feed.class.js +1 -1
  6. package/dist/components/agent-tools/activity-feed/activity-feed.styles.js +0 -16
  7. package/dist/components/agent-tools/agent-eval-dashboard/agent-eval-dashboard.class.js +1 -1
  8. package/dist/components/agent-tools/agent-eval-dashboard/agent-eval-dashboard.styles.js +7 -5
  9. package/dist/components/agent-tools/agent-run/agent-run.class.js +2 -2
  10. package/dist/components/agent-tools/agent-run/agent-run.styles.js +0 -13
  11. package/dist/components/agent-tools/agent-trace/agent-trace.styles.js +7 -4
  12. package/dist/components/agent-tools/approval-queue/approval-queue.styles.js +7 -5
  13. package/dist/components/agent-tools/artifact-panel/artifact-panel.styles.js +0 -3
  14. package/dist/components/agent-tools/browser-frame/browser-frame.styles.js +3 -5
  15. package/dist/components/agent-tools/commit-card/commit-card.styles.js +0 -10
  16. package/dist/components/agent-tools/compare-panel/compare-panel.styles.js +11 -6
  17. package/dist/components/agent-tools/confirm-bar/confirm-bar.styles.js +0 -46
  18. package/dist/components/agent-tools/eval-dataset/eval-dataset.styles.js +0 -7
  19. package/dist/components/agent-tools/evaluation-run/evaluation-run.class.js +2 -2
  20. package/dist/components/agent-tools/prompt-studio/prompt-studio.styles.js +0 -15
  21. package/dist/components/agent-tools/result-card/result-card.styles.js +0 -7
  22. package/dist/components/agent-tools/result-card/result-field.styles.js +0 -5
  23. package/dist/components/agent-tools/schema-viewer/schema-viewer.styles.js +0 -3
  24. package/dist/components/agent-tools/span-waterfall/span-waterfall.styles.js +0 -15
  25. package/dist/components/agent-tools/stack-trace/stack-trace.styles.js +0 -20
  26. package/dist/components/agent-tools/subagent-panel/subagent-panel.class.js +2 -2
  27. package/dist/components/agent-tools/subagent-panel/subagent-panel.styles.js +0 -3
  28. package/dist/components/agent-tools/task-list/task-list.styles.js +0 -15
  29. package/dist/components/agent-tools/terminal/terminal.class.d.ts +11 -6
  30. package/dist/components/agent-tools/terminal/terminal.class.js +4 -4
  31. package/dist/components/agent-tools/terminal/terminal.styles.js +0 -46
  32. package/dist/components/agent-tools/test-results/test-results.class.js +2 -2
  33. package/dist/components/agent-tools/test-results/test-results.styles.js +0 -5
  34. package/dist/components/agent-tools/thinking-panel/thinking-panel.styles.js +0 -41
  35. package/dist/components/agent-tools/tool-approval-dialog/tool-approval-dialog.styles.js +0 -41
  36. package/dist/components/agent-tools/tool-call-chip/tool-call-chip.styles.js +0 -30
  37. package/dist/components/agent-tools/tool-param-form/tool-param-form.class.js +6 -6
  38. package/dist/components/agent-tools/tool-param-form/tool-param-form.styles.js +0 -5
  39. package/dist/components/agent-tools/tool-result-dialog/tool-result-dialog.styles.js +0 -20
  40. package/dist/components/agent-tools/tool-result-view/tool-result-view.styles.js +0 -4
  41. package/dist/components/agent-tools/tool-select-dialog/tool-select-dialog.styles.js +0 -21
  42. package/dist/components/agent-tools/trace-tree/trace-tree.styles.js +7 -31
  43. package/dist/components/charts/chart/box-plot.styles.js +0 -20
  44. package/dist/components/charts/chart/chart-colors.d.ts +1 -1
  45. package/dist/components/charts/chart/chart-colors.js +1 -1
  46. package/dist/components/charts/chart/chart-core-loader.d.ts +1 -0
  47. package/dist/components/charts/chart/chart-core-loader.js +1 -1
  48. package/dist/components/charts/chart/chart-feature-loader.d.ts +35 -0
  49. package/dist/components/charts/chart/chart-feature-loader.js +1 -1
  50. package/dist/components/charts/chart/chart.class.d.ts +93 -0
  51. package/dist/components/charts/chart/chart.class.js +3 -3
  52. package/dist/components/charts/chart/chart.styles.js +0 -27
  53. package/dist/components/charts/chart/lite-chart.class.d.ts +20 -1
  54. package/dist/components/charts/chart/lite-chart.class.js +4 -4
  55. package/dist/components/charts/chart/lite-chart.styles.js +0 -27
  56. package/dist/components/conversation/agent-workspace/agent-workspace.class.d.ts +20 -0
  57. package/dist/components/conversation/agent-workspace/agent-workspace.class.js +3 -1
  58. package/dist/components/conversation/agent-workspace/agent-workspace.styles.js +3 -0
  59. package/dist/components/conversation/audio-visualizer/audio-visualizer.styles.js +0 -7
  60. package/dist/components/conversation/branch-picker/branch-picker.styles.js +0 -3
  61. package/dist/components/conversation/chat-composer/chat-composer.styles.js +0 -51
  62. package/dist/components/conversation/chat-message/chat-message.styles.js +7 -35
  63. package/dist/components/conversation/chat-viewport/chat-viewport.class.js +1 -1
  64. package/dist/components/conversation/chat-viewport/chat-viewport.styles.js +0 -33
  65. package/dist/components/conversation/checkpoint/checkpoint.class.js +1 -1
  66. package/dist/components/conversation/checkpoint/checkpoint.styles.js +0 -3
  67. package/dist/components/conversation/code-block/code-block-shared.d.ts +5 -2
  68. package/dist/components/conversation/code-block/code-block.class.js +1 -1
  69. package/dist/components/conversation/code-block/code-block.styles.js +4 -95
  70. package/dist/components/conversation/code-block/code-loader.d.ts +11 -0
  71. package/dist/components/conversation/code-block/code-loader.js +1 -1
  72. package/dist/components/conversation/code-block/shiki-types.d.ts +12 -0
  73. package/dist/components/conversation/code-block/shiki-types.js +1 -1
  74. package/dist/components/conversation/conversation-item/conversation-item.styles.js +8 -54
  75. package/dist/components/conversation/generation-metrics/generation-metrics.class.js +2 -2
  76. package/dist/components/conversation/generation-metrics/generation-metrics.styles.js +0 -17
  77. package/dist/components/conversation/markdown/markdown-base.class.js +1 -1
  78. package/dist/components/conversation/markdown/markdown.styles.js +0 -41
  79. package/dist/components/conversation/message-actions/message-actions.styles.js +0 -3
  80. package/dist/components/conversation/message-feedback/message-feedback.styles.js +0 -35
  81. package/dist/components/conversation/message-parts/message-parts.class.d.ts +1 -1
  82. package/dist/components/conversation/message-parts/message-parts.styles.js +0 -5
  83. package/dist/components/conversation/model-select/model-select.class.js +3 -3
  84. package/dist/components/conversation/model-select/model-select.styles.js +12 -47
  85. package/dist/components/conversation/model-settings-panel/model-settings-panel.styles.js +0 -6
  86. package/dist/components/conversation/prompt-input/prompt-input.class.d.ts +3 -0
  87. package/dist/components/conversation/prompt-input/prompt-input.styles.js +0 -10
  88. package/dist/components/conversation/push-to-talk/push-to-talk.styles.js +0 -8
  89. package/dist/components/conversation/selection-toolbar/selection-toolbar.styles.js +1 -11
  90. package/dist/components/conversation/stream-status/stream-status.styles.js +0 -16
  91. package/dist/components/conversation/streaming-text/streaming-text.styles.js +0 -15
  92. package/dist/components/conversation/suggestion-chips/suggestion-chips.styles.js +0 -5
  93. package/dist/components/conversation/thread-list/thread-list.styles.js +0 -23
  94. package/dist/components/conversation/transcript-feed/transcript-feed.class.d.ts +16 -4
  95. package/dist/components/conversation/transcript-feed/transcript-feed.class.js +1 -1
  96. package/dist/components/conversation/transcript-feed/transcript-feed.styles.js +0 -1
  97. package/dist/components/conversation/typing-indicator/typing-indicator.styles.js +0 -23
  98. package/dist/components/conversation/usage-badge/usage-badge.styles.js +0 -3
  99. package/dist/components/conversation/voice-picker/voice-picker.class.js +3 -3
  100. package/dist/components/conversation/voice-picker/voice-picker.styles.js +9 -29
  101. package/dist/components/conversation/widget-renderer/resolve.d.ts +2 -0
  102. package/dist/components/conversation/widget-renderer/resolve.js +1 -1
  103. package/dist/components/data/calendar/calendar.class.d.ts +15 -2
  104. package/dist/components/data/calendar/calendar.class.js +2 -2
  105. package/dist/components/data/calendar/calendar.styles.js +2 -28
  106. package/dist/components/data/condition-builder/condition-builder.class.d.ts +10 -6
  107. package/dist/components/data/condition-builder/condition-builder.class.js +2 -2
  108. package/dist/components/data/condition-builder/condition-builder.styles.js +0 -6
  109. package/dist/components/data/context-meter/context-meter.styles.js +0 -24
  110. package/dist/components/data/data-grid/data-grid.class.js +3 -3
  111. package/dist/components/data/data-grid/data-grid.styles.js +0 -22
  112. package/dist/components/data/document-library/document-library.class.js +2 -2
  113. package/dist/components/data/document-library/document-library.styles.js +0 -4
  114. package/dist/components/data/env-list/env-list.class.js +1 -1
  115. package/dist/components/data/env-list/env-list.styles.js +7 -4
  116. package/dist/components/data/file-tree/file-tree.class.d.ts +12 -0
  117. package/dist/components/data/flow-canvas/flow-canvas.styles.js +12 -19
  118. package/dist/components/data/flow-controls/flow-controls.class.js +2 -2
  119. package/dist/components/data/flow-controls/flow-controls.styles.js +3 -36
  120. package/dist/components/data/flow-minimap/flow-minimap.class.js +1 -1
  121. package/dist/components/data/flow-minimap/flow-minimap.styles.js +0 -9
  122. package/dist/components/data/flow-node/flow-node.styles.js +0 -23
  123. package/dist/components/data/flow-run-status/flow-run-status.class.js +1 -1
  124. package/dist/components/data/flow-run-status/flow-run-status.styles.js +0 -7
  125. package/dist/components/data/graph-query-builder/graph-query-builder.class.d.ts +0 -7
  126. package/dist/components/data/graph-query-builder/graph-query-builder.class.js +1 -1
  127. package/dist/components/data/graph-query-builder/graph-query-builder.styles.js +0 -10
  128. package/dist/components/data/heatmap/heatmap-scale.d.ts +20 -0
  129. package/dist/components/data/heatmap/heatmap-scale.js +1 -1
  130. package/dist/components/data/heatmap/heatmap.class.d.ts +84 -1
  131. package/dist/components/data/heatmap/heatmap.class.js +2 -2
  132. package/dist/components/data/heatmap/heatmap.styles.js +0 -54
  133. package/dist/components/data/pagination/pagination.styles.js +23 -46
  134. package/dist/components/data/sequence-strip/sequence-strip.class.d.ts +34 -1
  135. package/dist/components/data/sequence-strip/sequence-strip.class.js +5 -2
  136. package/dist/components/data/sequence-strip/sequence-strip.styles.js +14 -20
  137. package/dist/components/data/sparkline/sparkline.class.js +1 -1
  138. package/dist/components/data/stat/stat.styles.js +0 -67
  139. package/dist/components/data/table/table.class.d.ts +42 -3
  140. package/dist/components/data/table/table.class.js +4 -4
  141. package/dist/components/data/table/table.styles.js +20 -91
  142. package/dist/components/data/timeline/timeline-item.styles.js +0 -30
  143. package/dist/components/data/timeline/timeline.class.d.ts +89 -1
  144. package/dist/components/data/timeline/timeline.class.js +2 -2
  145. package/dist/components/data/timeline/timeline.styles.js +111 -31
  146. package/dist/components/data/tree/tree-item.styles.js +1 -28
  147. package/dist/components/data/tree/tree.class.js +2 -2
  148. package/dist/components/data/tree/tree.styles.js +0 -6
  149. package/dist/components/data/word-cloud/word-cloud.styles.js +0 -5
  150. package/dist/components/forms/button/button.class.js +1 -1
  151. package/dist/components/forms/button/button.styles.js +0 -105
  152. package/dist/components/forms/checkbox/checkbox.class.d.ts +3 -0
  153. package/dist/components/forms/checkbox/checkbox.class.js +1 -1
  154. package/dist/components/forms/checkbox/checkbox.styles.js +0 -39
  155. package/dist/components/forms/checkbox-group/checkbox-group.class.d.ts +21 -2
  156. package/dist/components/forms/checkbox-group/checkbox-group.class.js +1 -1
  157. package/dist/components/forms/checkbox-group/checkbox-group.styles.js +0 -18
  158. package/dist/components/forms/code-editor/code-editor.styles.js +0 -30
  159. package/dist/components/forms/color-picker/color-picker.class.js +2 -2
  160. package/dist/components/forms/color-picker/color-picker.styles.js +0 -69
  161. package/dist/components/forms/combobox/combobox.class.js +2 -2
  162. package/dist/components/forms/combobox/combobox.styles.js +22 -111
  163. package/dist/components/forms/combobox/option.styles.js +7 -1
  164. package/dist/components/forms/date-picker/date-input.class.js +1 -1
  165. package/dist/components/forms/date-picker/date-input.styles.js +12 -67
  166. package/dist/components/forms/date-picker/date-picker.class.d.ts +1 -0
  167. package/dist/components/forms/date-picker/date-picker.class.js +22 -20
  168. package/dist/components/forms/date-picker/date-picker.styles.js +36 -29
  169. package/dist/components/forms/emoji-picker/emoji-data-loader.d.ts +6 -3
  170. package/dist/components/forms/emoji-picker/emoji-data-loader.js +1 -1
  171. package/dist/components/forms/emoji-picker/emoji-picker.class.d.ts +8 -1
  172. package/dist/components/forms/emoji-picker/emoji-picker.class.js +1 -1
  173. package/dist/components/forms/emoji-picker/emoji-picker.styles.js +3 -41
  174. package/dist/components/forms/icon-button/icon-button.class.js +1 -1
  175. package/dist/components/forms/icon-button/icon-button.styles.js +0 -16
  176. package/dist/components/forms/input/input.styles.js +0 -54
  177. package/dist/components/forms/input/number-input.styles.d.ts +4 -5
  178. package/dist/components/forms/input/number-input.styles.js +0 -11
  179. package/dist/components/forms/input/time-input-shared.d.ts +11 -0
  180. package/dist/components/forms/input/time-input-shared.js +1 -1
  181. package/dist/components/forms/input/time-input.class.d.ts +11 -2
  182. package/dist/components/forms/input/time-input.class.js +1 -1
  183. package/dist/components/forms/input/time-input.styles.js +0 -6
  184. package/dist/components/forms/locale-picker/locale-picker.class.js +2 -2
  185. package/dist/components/forms/locale-picker/locale-picker.styles.js +1 -26
  186. package/dist/components/forms/otp-input/otp-input.class.js +3 -3
  187. package/dist/components/forms/otp-input/otp-input.styles.js +0 -16
  188. package/dist/components/forms/phone-input/phone-input.class.d.ts +9 -1
  189. package/dist/components/forms/phone-input/phone-input.class.js +2 -2
  190. package/dist/components/forms/phone-input/phone-input.styles.js +0 -37
  191. package/dist/components/forms/radio/radio-button.styles.js +1 -30
  192. package/dist/components/forms/radio/radio-group.styles.js +0 -4
  193. package/dist/components/forms/radio/radio.styles.js +0 -44
  194. package/dist/components/forms/rubric-form/rubric-form.styles.js +0 -5
  195. package/dist/components/forms/select/select.class.js +1 -1
  196. package/dist/components/forms/select/select.styles.js +14 -114
  197. package/dist/components/forms/slider/slider.styles.js +0 -55
  198. package/dist/components/forms/swatch-picker/swatch-picker.class.d.ts +0 -11
  199. package/dist/components/forms/swatch-picker/swatch-picker.class.js +2 -2
  200. package/dist/components/forms/swatch-picker/swatch-picker.styles.js +0 -77
  201. package/dist/components/forms/switch/switch.class.d.ts +3 -0
  202. package/dist/components/forms/switch/switch.class.js +1 -1
  203. package/dist/components/forms/switch/switch.styles.js +0 -37
  204. package/dist/components/forms/textarea/textarea.styles.js +0 -28
  205. package/dist/components/forms/time-range/time-range.styles.js +12 -84
  206. package/dist/components/forms/token-input/token-input.class.d.ts +23 -9
  207. package/dist/components/forms/token-input/token-input.class.js +1 -1
  208. package/dist/components/forms/token-input/token-input.styles.js +1 -54
  209. package/dist/components/layout/app-rail/app-rail-item.class.js +2 -2
  210. package/dist/components/layout/app-rail/app-rail-item.styles.js +0 -13
  211. package/dist/components/layout/app-rail/app-rail.class.d.ts +5 -0
  212. package/dist/components/layout/app-rail/app-rail.class.js +1 -1
  213. package/dist/components/layout/app-rail/app-rail.styles.js +0 -46
  214. package/dist/components/layout/button-group/button-group.styles.js +0 -6
  215. package/dist/components/layout/card/card.class.d.ts +12 -0
  216. package/dist/components/layout/card/card.styles.js +3 -11
  217. package/dist/components/layout/carousel/carousel.styles.js +0 -1
  218. package/dist/components/layout/command-palette/command-palette.class.d.ts +8 -0
  219. package/dist/components/layout/command-palette/command-palette.class.js +3 -1
  220. package/dist/components/layout/command-palette/command-palette.styles.js +1 -13
  221. package/dist/components/layout/control-group/control-group.styles.js +0 -7
  222. package/dist/components/layout/dashboard-grid/dashboard-grid.styles.js +6 -25
  223. package/dist/components/layout/details/accordion.class.d.ts +13 -0
  224. package/dist/components/layout/details/accordion.class.js +1 -1
  225. package/dist/components/layout/details/details.class.js +1 -1
  226. package/dist/components/layout/details/details.styles.js +0 -12
  227. package/dist/components/layout/dock-panel/dock-panel.styles.js +0 -45
  228. package/dist/components/layout/drilldown-panel/drilldown-panel.class.d.ts +2 -0
  229. package/dist/components/layout/drilldown-panel/drilldown-panel.class.js +2 -2
  230. package/dist/components/layout/drilldown-panel/drilldown-panel.styles.js +0 -4
  231. package/dist/components/layout/filter-bar/filter-bar.class.js +1 -1
  232. package/dist/components/layout/filter-bar/filter-bar.styles.js +0 -9
  233. package/dist/components/layout/menu/menu-item.class.d.ts +5 -0
  234. package/dist/components/layout/menu/menu-item.class.js +1 -1
  235. package/dist/components/layout/menu/menu-item.styles.js +0 -49
  236. package/dist/components/layout/menu/menu-label.styles.js +0 -2
  237. package/dist/components/layout/menu/menu.styles.js +0 -18
  238. package/dist/components/layout/multi-split/multi-split.styles.js +0 -63
  239. package/dist/components/layout/page/page.class.d.ts +4 -0
  240. package/dist/components/layout/page/page.class.js +1 -1
  241. package/dist/components/layout/reorder-list/reorder-item.styles.js +0 -4
  242. package/dist/components/layout/responsive-panel/responsive-panel.styles.js +0 -27
  243. package/dist/components/layout/scroller/scroller.styles.js +0 -20
  244. package/dist/components/layout/segmented/segmented.class.d.ts +7 -1
  245. package/dist/components/layout/segmented/segmented.class.js +1 -1
  246. package/dist/components/layout/segmented/segmented.styles.js +69 -37
  247. package/dist/components/layout/split-panel/split-panel.styles.js +1 -7
  248. package/dist/components/layout/stepper/stepper.class.d.ts +8 -1
  249. package/dist/components/layout/stepper/stepper.class.js +1 -1
  250. package/dist/components/layout/stepper/stepper.styles.js +140 -41
  251. package/dist/components/layout/tab-group/tab-group.class.d.ts +4 -1
  252. package/dist/components/layout/tab-group/tab-group.styles.js +9 -75
  253. package/dist/components/layout/tab-group/tab.styles.js +0 -2
  254. package/dist/components/layout/virtual-list/virtual-list.class.d.ts +4 -4
  255. package/dist/components/layout/virtual-list/virtual-list.class.js +1 -1
  256. package/dist/components/layout/virtual-list/virtual-list.styles.js +0 -68
  257. package/dist/components/layout/widget/widget.class.d.ts +5 -1
  258. package/dist/components/layout/widget/widget.class.js +1 -1
  259. package/dist/components/layout/widget/widget.styles.js +97 -40
  260. package/dist/components/media/animated-image/animated-image.class.d.ts +3 -0
  261. package/dist/components/media/animated-image/animated-image.class.js +1 -1
  262. package/dist/components/media/animated-image/animated-image.styles.js +0 -28
  263. package/dist/components/media/attachment-chip/attachment-chip.class.d.ts +1 -1
  264. package/dist/components/media/attachment-chip/attachment-chip.class.js +1 -1
  265. package/dist/components/media/attachment-chip/attachment-chip.styles.js +0 -31
  266. package/dist/components/media/attachment-trigger/attachment-trigger.class.js +3 -3
  267. package/dist/components/media/attachment-trigger/attachment-trigger.styles.js +0 -40
  268. package/dist/components/media/av-player/av-player.class.d.ts +5 -6
  269. package/dist/components/media/av-player/av-player.class.js +1 -1
  270. package/dist/components/media/av-player/av-player.styles.js +0 -45
  271. package/dist/components/media/avatar/avatar.styles.js +3 -16
  272. package/dist/components/media/file-icon/file-icon.class.d.ts +1 -2
  273. package/dist/components/media/file-icon/file-icon.class.js +1 -1
  274. package/dist/components/media/file-input/file-input.class.d.ts +12 -0
  275. package/dist/components/media/file-input/file-input.styles.js +3 -24
  276. package/dist/components/media/flag/flag.class.d.ts +20 -0
  277. package/dist/components/media/flag/flag.class.js +4 -2
  278. package/dist/components/media/flag/flag.styles.js +7 -1
  279. package/dist/components/media/flag/language-map.d.ts +10 -0
  280. package/dist/components/media/flag/language-map.js +1 -1
  281. package/dist/components/media/image-comparer/image-comparer.styles.js +4 -33
  282. package/dist/components/media/image-viewer/image-viewer.class.js +0 -2
  283. package/dist/components/media/image-viewer/image-viewer.styles.js +7 -27
  284. package/dist/components/media/lightbox/lightbox.class.js +0 -2
  285. package/dist/components/media/lightbox/lightbox.styles.js +0 -21
  286. package/dist/components/media/map/map-loader.d.ts +19 -1
  287. package/dist/components/media/map/map-loader.js +1 -1
  288. package/dist/components/media/map/map.class.d.ts +141 -1
  289. package/dist/components/media/map/map.class.js +15 -3
  290. package/dist/components/media/map/map.styles.js +20 -17
  291. package/dist/components/media/media-card/media-card.class.d.ts +14 -3
  292. package/dist/components/media/media-card/media-card.class.js +1 -1
  293. package/dist/components/media/media-card/media-card.styles.js +2 -28
  294. package/dist/components/media/pan-zoom/pan-zoom.styles.js +0 -3
  295. package/dist/components/media/qr-code/qr-code.class.d.ts +3 -2
  296. package/dist/components/media/qr-code/qr-code.class.js +2 -2
  297. package/dist/components/media/qr-code/qr-code.styles.js +0 -3
  298. package/dist/components/media/sequence-playback/sequence-playback.class.d.ts +2 -0
  299. package/dist/components/media/sequence-playback/sequence-playback.class.js +2 -1
  300. package/dist/components/media/sequence-playback/sequence-playback.styles.js +0 -19
  301. package/dist/components/media/video/video.class.d.ts +23 -2
  302. package/dist/components/media/video/video.class.js +3 -3
  303. package/dist/components/media/video/video.styles.js +4 -2
  304. package/dist/components/media/zoomable-frame/zoomable-frame.class.d.ts +3 -2
  305. package/dist/components/media/zoomable-frame/zoomable-frame.class.js +2 -2
  306. package/dist/components/media/zoomable-frame/zoomable-frame.styles.js +0 -5
  307. package/dist/components/overlays/alert/alert.styles.js +4 -2
  308. package/dist/components/overlays/badge/badge.styles.js +4 -48
  309. package/dist/components/overlays/badge/tag.styles.js +0 -14
  310. package/dist/components/overlays/callout/callout.styles.js +0 -11
  311. package/dist/components/overlays/chip/chip-group.styles.js +0 -18
  312. package/dist/components/overlays/chip/chip.styles.js +6 -69
  313. package/dist/components/overlays/dialog/confirm.d.ts +1 -4
  314. package/dist/components/overlays/dialog/confirm.js +1 -1
  315. package/dist/components/overlays/dialog/dialog.class.d.ts +12 -9
  316. package/dist/components/overlays/dialog/dialog.class.js +1 -1
  317. package/dist/components/overlays/dialog/dialog.styles.js +0 -43
  318. package/dist/components/overlays/drawer/drawer.class.d.ts +2 -2
  319. package/dist/components/overlays/drawer/drawer.styles.js +0 -9
  320. package/dist/components/overlays/empty/empty.styles.js +0 -12
  321. package/dist/components/overlays/kbd/kbd.styles.js +0 -8
  322. package/dist/components/overlays/overlay/dropdown.class.d.ts +1 -6
  323. package/dist/components/overlays/overlay/dropdown.class.js +2 -2
  324. package/dist/components/overlays/overlay/overlay.styles.js +0 -28
  325. package/dist/components/overlays/overlay/popover.class.d.ts +9 -1
  326. package/dist/components/overlays/overlay/popover.class.js +2 -2
  327. package/dist/components/overlays/overlay/tooltip.class.d.ts +10 -0
  328. package/dist/components/overlays/overlay/tooltip.class.js +1 -1
  329. package/dist/components/overlays/popup/popup.class.d.ts +1 -0
  330. package/dist/components/overlays/popup/popup.class.js +1 -1
  331. package/dist/components/overlays/popup/popup.styles.js +0 -15
  332. package/dist/components/overlays/progress/progress-ring.class.d.ts +9 -1
  333. package/dist/components/overlays/progress/progress-ring.class.js +3 -3
  334. package/dist/components/overlays/progress/progress.styles.js +0 -21
  335. package/dist/components/overlays/rating/rating.styles.js +0 -25
  336. package/dist/components/overlays/skeleton/skeleton.styles.js +0 -4
  337. package/dist/components/overlays/spinner/spinner.styles.js +0 -3
  338. package/dist/components/overlays/toast/toast-item.styles.js +3 -45
  339. package/dist/components/retrieval/chunk-inspector/chunk-inspector.styles.js +0 -35
  340. package/dist/components/retrieval/citation-badge/citation-badge.class.d.ts +2 -2
  341. package/dist/components/retrieval/citation-badge/citation-badge.class.js +3 -3
  342. package/dist/components/retrieval/citation-badge/citation-badge.styles.js +0 -20
  343. package/dist/components/retrieval/claim-evidence/claim-evidence.styles.js +0 -8
  344. package/dist/components/retrieval/community-card/community-card.class.d.ts +1 -0
  345. package/dist/components/retrieval/community-card/community-card.styles.js +0 -6
  346. package/dist/components/retrieval/embedding-explorer/embedding-explorer.styles.js +8 -12
  347. package/dist/components/retrieval/entity-card/entity-card.class.d.ts +4 -3
  348. package/dist/components/retrieval/entity-card/entity-card.class.js +1 -1
  349. package/dist/components/retrieval/entity-card/entity-card.styles.js +0 -12
  350. package/dist/components/retrieval/entity-chip/entity-chip.class.d.ts +10 -4
  351. package/dist/components/retrieval/entity-chip/entity-chip.class.js +3 -3
  352. package/dist/components/retrieval/entity-chip/entity-chip.styles.js +6 -9
  353. package/dist/components/retrieval/entity-dossier/entity-dossier.class.d.ts +19 -5
  354. package/dist/components/retrieval/graph/graph.class.d.ts +5 -0
  355. package/dist/components/retrieval/graph/graph.class.js +1 -1
  356. package/dist/components/retrieval/graph/graph.styles.js +0 -30
  357. package/dist/components/retrieval/graph-legend/graph-legend.styles.js +0 -3
  358. package/dist/components/retrieval/ingestion-queue/ingestion-queue.styles.js +0 -25
  359. package/dist/components/retrieval/knowledge-base-admin/knowledge-base-admin.class.d.ts +2 -0
  360. package/dist/components/retrieval/knowledge-base-admin/knowledge-base-admin.styles.js +0 -7
  361. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.d.ts +20 -6
  362. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.js +2 -2
  363. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.styles.js +0 -16
  364. package/dist/components/retrieval/mind-map/mind-map.class.d.ts +5 -3
  365. package/dist/components/retrieval/mind-map/mind-map.class.js +1 -1
  366. package/dist/components/retrieval/mind-map/mind-map.styles.js +0 -2
  367. package/dist/components/retrieval/neighbor-list/neighbor-list.class.d.ts +3 -2
  368. package/dist/components/retrieval/neighbor-list/neighbor-list.class.js +1 -1
  369. package/dist/components/retrieval/neighbor-list/neighbor-list.styles.js +0 -30
  370. package/dist/components/retrieval/node-palette/node-palette.styles.js +0 -11
  371. package/dist/components/retrieval/path-strip/path-strip.styles.js +0 -10
  372. package/dist/components/retrieval/provenance-panel/provenance-panel.class.d.ts +12 -3
  373. package/dist/components/retrieval/provenance-panel/provenance-panel.styles.js +0 -2
  374. package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.class.d.ts +3 -2
  375. package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.class.js +2 -2
  376. package/dist/components/retrieval/retrieval-results/retrieval-results.styles.js +0 -28
  377. package/dist/components/retrieval/retrieval-search/retrieval-search.styles.js +0 -4
  378. package/dist/components/retrieval/retrieval-trace/retrieval-trace.styles.js +0 -2
  379. package/dist/components/retrieval/source-card/source-card.styles.js +0 -13
  380. package/dist/components/retrieval/source-list/source-list.styles.js +0 -7
  381. package/dist/components/retrieval/source-picker/source-picker.styles.js +0 -7
  382. package/dist/components/utility/copy-button/copy-button.styles.js +0 -10
  383. package/dist/components/utility/diff-view/diff-view.styles.js +0 -14
  384. package/dist/components/utility/export-button/export-button.styles.js +0 -22
  385. package/dist/components/utility/icon/icon.styles.js +0 -6
  386. package/dist/components/utility/json-viewer/json-viewer.styles.js +2 -48
  387. package/dist/components/utility/known-date/known-date.class.d.ts +7 -3
  388. package/dist/components/utility/known-date/known-date.styles.js +10 -51
  389. package/dist/components/utility/live-region/live-region.styles.js +0 -4
  390. package/dist/components/utility/mention-popover/mention-popover.styles.js +0 -25
  391. package/dist/components/utility/poll-status/poll-status.styles.js +0 -4
  392. package/dist/components/utility/random-content/random-content.class.d.ts +22 -0
  393. package/dist/components/utility/random-content/random-content.class.js +3 -2
  394. package/dist/components/utility/random-content/random-content.styles.js +6 -13
  395. package/dist/components/utility/tour/tour.class.d.ts +4 -2
  396. package/dist/components/utility/tour/tour.class.js +3 -3
  397. package/dist/components/utility/tour/tour.styles.js +0 -13
  398. package/dist/components/utility/visually-hidden/visually-hidden.styles.js +0 -5
  399. package/dist/components/viewers/archive-viewer/archive-viewer.class.js +1 -1
  400. package/dist/components/viewers/archive-viewer/archive-viewer.styles.d.ts +2 -2
  401. package/dist/components/viewers/archive-viewer/archive-viewer.styles.js +0 -10
  402. package/dist/components/viewers/csv-viewer/csv-viewer.class.js +1 -1
  403. package/dist/components/viewers/csv-viewer/csv-viewer.styles.js +0 -19
  404. package/dist/components/viewers/dataset-viewer/dataset-viewer.class.js +1 -1
  405. package/dist/components/viewers/dataset-viewer/dataset-viewer.styles.js +0 -15
  406. package/dist/components/viewers/document-compare/document-compare.styles.js +0 -3
  407. package/dist/components/viewers/document-preview/document-preview.styles.js +0 -25
  408. package/dist/components/viewers/document-viewer/document-viewer.class.d.ts +2 -1
  409. package/dist/components/viewers/document-viewer/document-viewer.class.js +1 -1
  410. package/dist/components/viewers/document-viewer/document-viewer.styles.js +0 -5
  411. package/dist/components/viewers/docx-viewer/docx-viewer.styles.js +0 -17
  412. package/dist/components/viewers/ebook-viewer/ebook-viewer.styles.js +0 -4
  413. package/dist/components/viewers/email-viewer/email-viewer.styles.js +0 -7
  414. package/dist/components/viewers/geojson-view/geojson-view.styles.js +0 -5
  415. package/dist/components/viewers/highlight-layer/highlight-layer.styles.js +0 -3
  416. package/dist/components/viewers/notebook-viewer/notebook-viewer.class.js +1 -1
  417. package/dist/components/viewers/notebook-viewer/notebook-viewer.styles.js +0 -38
  418. package/dist/components/viewers/page-rail/page-rail.class.js +1 -1
  419. package/dist/components/viewers/page-rail/page-rail.styles.js +0 -13
  420. package/dist/components/viewers/pdf-viewer/pdf-loader.d.ts +13 -2
  421. package/dist/components/viewers/pdf-viewer/pdf-loader.js +1 -1
  422. package/dist/components/viewers/pdf-viewer/pdf-viewer.class.d.ts +32 -2
  423. package/dist/components/viewers/pdf-viewer/pdf-viewer.class.js +4 -4
  424. package/dist/components/viewers/pdf-viewer/pdf-viewer.styles.js +1 -27
  425. package/dist/components/viewers/pptx-viewer/pptx-viewer.styles.js +0 -3
  426. package/dist/components/viewers/spreadsheet-viewer/spreadsheet-viewer.class.js +1 -1
  427. package/dist/components/viewers/spreadsheet-viewer/spreadsheet-viewer.styles.js +0 -14
  428. package/dist/components/viewers/svg-viewer/svg-viewer.styles.js +0 -7
  429. package/dist/components/viewers/xml-viewer/xml-viewer.styles.js +2 -24
  430. package/dist/custom-elements-jsx.d.ts +56 -37
  431. package/dist/events.d.ts +43 -33
  432. package/dist/internal/agent-status-variants.d.ts +18 -0
  433. package/dist/internal/agent-status-variants.js +1 -0
  434. package/dist/internal/announcer.d.ts +8 -3
  435. package/dist/internal/announcer.js +1 -1
  436. package/dist/internal/autoloader-manifest.js +1 -1
  437. package/dist/internal/canvas-color.d.ts +16 -0
  438. package/dist/internal/canvas-color.js +1 -1
  439. package/dist/internal/catalog-picker.d.ts +0 -1
  440. package/dist/internal/catalog-picker.js +1 -1
  441. package/dist/internal/default-strings.generated.d.ts +1 -0
  442. package/dist/internal/default-strings.generated.js +1 -1
  443. package/dist/internal/dev-mode-attribute-warning.d.ts +27 -4
  444. package/dist/internal/dev-mode-attribute-warning.js +1 -1
  445. package/dist/internal/localization-runtime.js +1 -1
  446. package/dist/internal/localization-types.d.ts +1 -1
  447. package/dist/internal/localization.js +1 -1
  448. package/dist/internal/lyra-element.d.ts +13 -0
  449. package/dist/internal/lyra-element.js +1 -1
  450. package/dist/internal/media-controller.js +1 -1
  451. package/dist/internal/package-metadata.d.ts +1 -1
  452. package/dist/internal/package-metadata.js +1 -1
  453. package/dist/internal/scroll-overflow.d.ts +35 -13
  454. package/dist/internal/scroll-overflow.js +1 -1
  455. package/dist/internal/sizes.styles.js +0 -2
  456. package/dist/internal/specialist-tokens.styles.js +6 -11
  457. package/dist/internal/text-highlights.d.ts +4 -1
  458. package/dist/internal/text-highlights.js +1 -1
  459. package/dist/internal/tokens/palette.styles.js +0 -15
  460. package/dist/internal/tokens.styles.js +19 -113
  461. package/dist/lyra.d.ts +8 -5
  462. package/dist/styles/reservations.css +82 -0
  463. package/dist/svelte.d.ts +56 -37
  464. package/dist/translations/ar.js +1 -1
  465. package/dist/translations/de.js +1 -1
  466. package/dist/translations/es.js +1 -1
  467. package/dist/translations/fa.js +1 -1
  468. package/dist/translations/fr.js +1 -1
  469. package/dist/translations/he.js +1 -1
  470. package/dist/translations/ja.js +1 -1
  471. package/dist/translations/pt-BR.js +1 -1
  472. package/dist/translations/ru.js +1 -1
  473. package/dist/translations/zh-CN.js +1 -1
  474. package/dist/vue.d.ts +56 -37
  475. package/llms/components/lr-accordion-item.md +12 -3
  476. package/llms/components/lr-accordion.md +11 -2
  477. package/llms/components/lr-agent-eval-dashboard.md +1 -1
  478. package/llms/components/lr-agent-trace.md +3 -1
  479. package/llms/components/lr-agent-workspace.md +20 -0
  480. package/llms/components/lr-artifact-panel.md +10 -4
  481. package/llms/components/lr-attachment-chip.md +7 -4
  482. package/llms/components/lr-attachment-trigger.md +7 -4
  483. package/llms/components/lr-av-player.md +3 -1
  484. package/llms/components/lr-avatar.md +6 -6
  485. package/llms/components/lr-bar-chart.md +4 -3
  486. package/llms/components/lr-box-plot.md +1 -1
  487. package/llms/components/lr-browser-frame.md +7 -3
  488. package/llms/components/lr-bubble-chart.md +4 -3
  489. package/llms/components/lr-calendar.md +9 -2
  490. package/llms/components/lr-card.md +24 -0
  491. package/llms/components/lr-chart.md +32 -8
  492. package/llms/components/lr-chat-viewport.md +7 -2
  493. package/llms/components/lr-checkbox-group.md +13 -5
  494. package/llms/components/lr-checkbox.md +5 -2
  495. package/llms/components/lr-checkpoint.md +6 -2
  496. package/llms/components/lr-combobox.md +5 -2
  497. package/llms/components/lr-command-palette.md +4 -1
  498. package/llms/components/lr-confirm-bar.md +7 -3
  499. package/llms/components/lr-context-meter.md +12 -11
  500. package/llms/components/lr-conversation-item.md +7 -4
  501. package/llms/components/lr-details.md +11 -2
  502. package/llms/components/lr-dialog.md +15 -10
  503. package/llms/components/lr-dock-panel.md +7 -10
  504. package/llms/components/lr-document-preview.md +6 -1
  505. package/llms/components/lr-document-viewer.md +3 -2
  506. package/llms/components/lr-doughnut-chart.md +4 -3
  507. package/llms/components/lr-drawer.md +3 -3
  508. package/llms/components/lr-entity-card.md +3 -3
  509. package/llms/components/lr-entity-chip.md +1 -1
  510. package/llms/components/lr-entity-dossier.md +4 -1
  511. package/llms/components/lr-file-input.md +2 -2
  512. package/llms/components/lr-flag.md +20 -5
  513. package/llms/components/lr-heatmap.md +28 -0
  514. package/llms/components/lr-histogram.md +3 -1
  515. package/llms/components/lr-icon.md +1 -1
  516. package/llms/components/lr-json-schema-viewer.md +2 -1
  517. package/llms/components/lr-knowledge-graph-explorer.md +8 -3
  518. package/llms/components/lr-known-date.md +4 -2
  519. package/llms/components/lr-line-chart.md +4 -3
  520. package/llms/components/lr-lite-chart.md +16 -6
  521. package/llms/components/lr-map.md +72 -8
  522. package/llms/components/lr-markdown-core.md +3 -2
  523. package/llms/components/lr-media-card.md +28 -12
  524. package/llms/components/lr-message-parts.md +2 -1
  525. package/llms/components/lr-model-select.md +9 -10
  526. package/llms/components/lr-model-settings-panel.md +9 -9
  527. package/llms/components/lr-neighbor-list.md +1 -1
  528. package/llms/components/lr-notebook-viewer.md +6 -3
  529. package/llms/components/lr-option.md +5 -2
  530. package/llms/components/lr-pdf-viewer.md +62 -2
  531. package/llms/components/lr-pie-chart.md +4 -3
  532. package/llms/components/lr-polar-area-chart.md +4 -3
  533. package/llms/components/lr-popover.md +5 -0
  534. package/llms/components/lr-progress-ring.md +8 -1
  535. package/llms/components/lr-prompt-studio.md +1 -1
  536. package/llms/components/lr-provenance-panel.md +4 -2
  537. package/llms/components/lr-qr-code.md +1 -1
  538. package/llms/components/lr-radar-chart.md +4 -3
  539. package/llms/components/lr-rag-eval-dashboard.md +2 -2
  540. package/llms/components/lr-random-content.md +13 -0
  541. package/llms/components/lr-reorder-item.md +6 -1
  542. package/llms/components/lr-reorder-list.md +6 -1
  543. package/llms/components/lr-responsive-panel.md +11 -7
  544. package/llms/components/lr-scatter-chart.md +4 -3
  545. package/llms/components/lr-sequence-strip.md +16 -2
  546. package/llms/components/lr-slider.md +12 -5
  547. package/llms/components/lr-sparkline.md +1 -1
  548. package/llms/components/lr-suggestion-chips.md +7 -2
  549. package/llms/components/lr-swatch-picker.md +5 -5
  550. package/llms/components/lr-switch.md +5 -2
  551. package/llms/components/lr-table.md +30 -4
  552. package/llms/components/lr-terminal.md +3 -1
  553. package/llms/components/lr-thread-list.md +8 -8
  554. package/llms/components/lr-time-input.md +6 -1
  555. package/llms/components/lr-timeline-item.md +24 -0
  556. package/llms/components/lr-timeline.md +25 -1
  557. package/llms/components/lr-token-input.md +7 -2
  558. package/llms/components/lr-tool-approval-dialog.md +7 -8
  559. package/llms/components/lr-tool-call-chip.md +5 -1
  560. package/llms/components/lr-tool-param-form.md +14 -12
  561. package/llms/components/lr-tool-result-dialog.md +11 -9
  562. package/llms/components/lr-tool-result-view.md +7 -6
  563. package/llms/components/lr-tool-select-dialog.md +18 -16
  564. package/llms/components/lr-trace-tree.md +3 -1
  565. package/llms/components/lr-usage-badge.md +4 -1
  566. package/llms/components/lr-video-playlist.md +1 -1
  567. package/llms/components/lr-virtual-list.md +22 -14
  568. package/llms/components/lr-voice-picker.md +8 -5
  569. package/llms/components/lr-widget-renderer.md +3 -3
  570. package/llms/components/lr-widget.md +1 -1
  571. package/llms/components/lr-word-cloud.md +6 -2
  572. package/llms/peers.md +12 -2
  573. package/llms/shared.md +70 -2
  574. package/llms-full.txt +1143 -285
  575. package/package.json +17 -5
  576. package/vscode-css-data.json +37 -2
  577. package/vscode-html-data.json +401 -44
  578. package/web-types.json +299 -55
@@ -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{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&&!this.readonly&&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(" ");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{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&&!this.readonly&&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>
@@ -20,8 +20,8 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
20
20
  ?disabled=${this.effectiveDisabled}
21
21
  ?readonly=${this.readonly}
22
22
  ?required=${this.required}
23
- aria-label=${this.getAttribute("aria-label")||(hasLabel?nothing:this.localize("otpInputLabel"))}
24
- aria-labelledby=${hasLabel&&!this.getAttribute("aria-label")?this.labelId:nothing}
23
+ aria-label=${hostAriaLabel(this)??(hasLabel?nothing:this.localize("otpInputLabel"))}
24
+ aria-labelledby=${labelledBy}
25
25
  aria-describedby=${describedBy||nothing}
26
26
  aria-invalid=${ariaInvalid?"true":"false"}
27
27
  @input=${this.onInput}
@@ -42,10 +42,6 @@ import{css}from"lit";import{formControlRequiredMarker}from"../../../internal/for
42
42
  }
43
43
  ${formControlRequiredMarker}
44
44
 
45
- /* One real <input> stretched invisibly across the presentational segments. It remains the native
46
- integration point for SMS autofill, IME composition, mobile keyboards and selection, while the
47
- fixed-cell key/paste handlers map editing intents into the visual model. One field also keeps
48
- the control to one tab stop, which is what the WAI-ARIA text-input pattern expects. */
49
45
  [part~='segments'] {
50
46
  position: relative;
51
47
  display: flex;
@@ -74,8 +70,6 @@ import{css}from"lit";import{formControlRequiredMarker}from"../../../internal/for
74
70
  padding: 0;
75
71
  border: none;
76
72
  background: none;
77
- /* Transparent rather than hidden: a hidden input cannot receive focus or show a native
78
- autofill affordance, and opacity: 0 keeps it a real, focusable text field. */
79
73
  color: transparent;
80
74
  caret-color: transparent;
81
75
  font: inherit;
@@ -83,8 +77,6 @@ import{css}from"lit";import{formControlRequiredMarker}from"../../../internal/for
83
77
  opacity: 0;
84
78
  cursor: text;
85
79
  }
86
- /* :disabled, not [disabled] -- only the native pseudo-class tracks disablement cascaded from an
87
- ancestor <fieldset disabled>, which never touches this element's own attribute. */
88
80
  :host(:disabled) [part='control'] {
89
81
  cursor: not-allowed;
90
82
  }
@@ -107,7 +99,6 @@ import{css}from"lit";import{formControlRequiredMarker}from"../../../internal/for
107
99
  line-height: var(--lr-line-height-snug);
108
100
  transition: border-color var(--lr-transition-fast), box-shadow var(--lr-transition-fast);
109
101
  }
110
- /* State in the part name -- ::part(segment)[data-active] never matches. */
111
102
  [part~='active'] {
112
103
  border-color: var(--lr-otp-input-active-border-color, var(--lr-focus-ring-color));
113
104
  box-shadow: 0 0 0 var(--lr-focus-ring-width) var(--lr-otp-input-active-ring-color, var(--lr-focus-ring-color));
@@ -125,17 +116,10 @@ import{css}from"lit";import{formControlRequiredMarker}from"../../../internal/for
125
116
  user-select: none;
126
117
  }
127
118
 
128
- /* Masking is display-only: the real characters stay in value and in the input the screen
129
- reader reads, exactly like a password field's dots. Generated content rather than rendered
130
- text, so the glyph can never reach an accessible name -- the segment boxes are aria-hidden
131
- and ::after content is not exposed to assistive technology in the first place.
132
- The placeholder-mask token is the same glyph in a segment that holds nothing yet, so the
133
- field reads as a fixed-length code before any entry. */
134
119
  [part~='masked']::after,
135
120
  [part~='placeholder-mask']::after {
136
121
  content: var(--mask-char, var(--lr-otp-input-mask-char, var(--_lr-otp-input-mask-char-default)));
137
122
  }
138
- /* An unentered glyph is a placeholder, so it sits quieter than an entered character. */
139
123
  [part~='placeholder-mask'] {
140
124
  color: var(--lr-color-text-quiet);
141
125
  }
@@ -57,10 +57,18 @@ export interface LibphonenumberModuleLike<CountryCode extends string = string> {
57
57
  * Keeping the loader consumer-supplied avoids a static import, so neither the
58
58
  * dependency nor its numbering metadata enters Lyra's base bundle.
59
59
  *
60
+ * Accepts either the module namespace directly (named exports, as `libphonenumber-js`'s own type
61
+ * declarations describe it) or a `{ default: {...} }`-wrapped namespace, since some bundler/CJS
62
+ * interop configurations resolve it that way -- the same normalization `map-loader.ts` and
63
+ * `spreadsheet-loader.ts` apply to their own optional peers. Rejects (with a descriptive `TypeError`
64
+ * naming the missing capability, not an incidental "not a function" deep inside this function) a
65
+ * resolved value that has neither shape, or is missing a required method, rather than silently
66
+ * calling into `undefined`.
67
+ *
60
68
  * @example
61
69
  * `el.adapter = await loadLibphonenumberAdapter(() => import('libphonenumber-js/min'))`
62
70
  */
63
- export declare function loadLibphonenumberAdapter<CountryCode extends string>(loader: () => Promise<LibphonenumberModuleLike<CountryCode>>): Promise<LyraPhoneNumberAdapter>;
71
+ export declare function loadLibphonenumberAdapter<CountryCode extends string = string>(loader: () => Promise<unknown>): Promise<LyraPhoneNumberAdapter>;
64
72
  export interface LyraPhoneInputEventDetail {
65
73
  /** Canonical E.164 value, or an empty string until the current input is valid. */
66
74
  value: string;
@@ -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{LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_phoneInputIncomplete,LYRA_DEFAULT_phoneInputLabel,LYRA_DEFAULT_select,LYRA_DEFAULT_valueInvalid}from"../../../internal/default-strings.generated.js";async function loadLibphonenumberAdapter(loader){const module=await loader();return{countries:Object.freeze(module.getCountries().map(code=>Object.freeze({code:normalizeCountry(code),callingCode:module.getCountryCallingCode(code)}))),parse(input,country){const raw=input.trim();if(!raw)return{status:"empty"};const normalizedCountry=country?normalizeCountry(country):void 0,phone=module.parsePhoneNumberFromString(raw,normalizedCountry);if(!phone)return{status:module.validatePhoneNumberLength?.(raw,normalizedCountry)==="TOO_SHORT"||isDialLike(raw)?"incomplete":"invalid",formatted:raw};const formatted=raw.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?.(raw,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)}get effectivePhoneLabel(){return this.accessibleLabel!==null?this.accessibleLabel:this.phoneLabel||this.label||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{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)}get effectivePhoneLabel(){return this.accessibleLabel!==null?this.accessibleLabel:this.phoneLabel||this.label||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`
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>
@@ -12,7 +12,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
12
12
  part="country-select"
13
13
  aria-label=${this.effectiveCountryLabel}
14
14
  .value=${this.country}
15
- aria-readonly=${this.readonly?"true":nothing}
15
+ aria-readonly=${this.readonly?"true":"false"}
16
16
  ?disabled=${this.effectiveDisabled||this.readonly||rows.length===0}
17
17
  @change=${this.onCountryChange}
18
18
  >
@@ -8,23 +8,11 @@ import{css}from"lit";import{formControlRequiredMarker}from"../../../internal/for
8
8
  --_lr-phone-input-glyph-size-default: var(--lr-font-size-md-sm);
9
9
  --_lr-phone-input-gap-default: var(--lr-space-xs);
10
10
  --_lr-phone-input-radius-default: var(--lr-radius);
11
- /* The floor's six values come from the ONE shared form-control ladder
12
- (internal/sizes.styles.ts) rather than a private copy, so retuning
13
- --lr-theme-form-control-height-* moves this control and every sibling field together. That
14
- ladder matches both spellings of every tier, which is what makes size="small" resolve here
15
- without a per-component alias rule. */
16
11
  --_lr-phone-input-control-min-height-default: var(--lr-form-control-height);
17
- /* --lr-phone-input-control-height is intentionally NOT declared here -- same convention as
18
- lr-input/lr-select/lr-combobox/lr-date-input: a consumer-facing exact-height escape hatch
19
- consumed only through the var() fallback on [part='input-wrapper'] below; declaring any
20
- value for it here would make that fallback arm unreachable. */
21
12
  }
22
13
  :host([pill]) {
23
14
  --_lr-phone-input-radius-default: var(--lr-radius-pill);
24
15
  }
25
- /* What remains per tier is this component's own glyph geometry. Padding follows the shared
26
- form-control ladder above so the country-selector action and sibling fields resolve to one
27
- outer height; both spellings of a tier still match for the component-specific glyph values. */
28
16
  :host([size='2xs']) {
29
17
  --_lr-phone-input-font-size-default: var(--lr-font-size-2xs);
30
18
  --_lr-phone-input-flag-size-default: var(--lr-font-size-sm);
@@ -99,16 +87,6 @@ import{css}from"lit";import{formControlRequiredMarker}from"../../../internal/for
99
87
  border-color: var(--lr-phone-input-invalid-border-color, var(--lr-color-danger));
100
88
  }
101
89
 
102
- /* :host(:disabled), not :host([disabled]) -- this is a form-associated
103
- custom element (FormAssociated mixin -> static formAssociated = true),
104
- so the UA computes its disabled state (and therefore :disabled/:enabled
105
- matching) the same way it does for a native form control: from its own
106
- disabled content attribute *or* an ancestor <fieldset disabled>'s
107
- cascade. Keying this off the attribute selector only ever matched the
108
- first case -- a field disabled purely via an ancestor fieldset had
109
- effectiveDisabled correctly gating the country select/telephone input
110
- underneath, but the wrapper around them still rendered at full opacity
111
- with a normal cursor. */
112
90
  :host(:disabled) [part='input-wrapper'] {
113
91
  cursor: not-allowed;
114
92
  opacity: var(--lr-opacity-disabled);
@@ -121,10 +99,6 @@ import{css}from"lit";import{formControlRequiredMarker}from"../../../internal/for
121
99
  padding-inline-start: var(--lr-space-s);
122
100
  }
123
101
 
124
- /* The country selector keeps the real native <select> (its popup, keyboard type-ahead, and
125
- mobile pickers are irreplaceable) but stretches it invisibly over a compact decorative
126
- trigger, so the closed control never clips a long localized country name and never repeats
127
- the calling code shown right next to it. */
128
102
  [part='country'] {
129
103
  position: relative;
130
104
  display: inline-flex;
@@ -154,8 +128,6 @@ import{css}from"lit";import{formControlRequiredMarker}from"../../../internal/for
154
128
  cursor: not-allowed;
155
129
  }
156
130
 
157
- /* The invisible select's popup list is still painted by the browser from these options; without
158
- an explicit surface/text pairing it falls back to UA colors (a white panel in dark themes). */
159
131
  [part='country-select'] option {
160
132
  background: var(--lr-color-surface);
161
133
  color: var(--lr-color-text);
@@ -175,11 +147,6 @@ import{css}from"lit";import{formControlRequiredMarker}from"../../../internal/for
175
147
  background: var(--lr-phone-input-country-hover-bg, var(--lr-color-brand-quiet));
176
148
  }
177
149
 
178
- /* The press lands on the invisible <select> stretched over the trigger, so the pressed tint is
179
- driven from the same sibling combinator as the hover above -- styling [part='country-trigger']
180
- itself with :active would never match, since it is not the element being pressed. Mixing the
181
- hover tint one shared step further toward the text colour keeps a consumer's
182
- --lr-phone-input-country-hover-bg override in charge of both states. */
183
150
  [part='country-select']:not(:disabled):active + [part='country-trigger'] {
184
151
  background: color-mix(
185
152
  in oklab,
@@ -188,8 +155,6 @@ import{css}from"lit";import{formControlRequiredMarker}from"../../../internal/for
188
155
  );
189
156
  }
190
157
 
191
- /* The wrapper's focus-within ring marks the whole field; this inner ring additionally marks
192
- that keyboard focus sits on the (invisible) country select rather than the telephone input. */
193
158
  [part='country-select']:focus-visible + [part='country-trigger'] {
194
159
  outline: var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);
195
160
  outline-offset: calc(-1 * var(--lr-focus-ring-width));
@@ -267,8 +232,6 @@ import{css}from"lit";import{formControlRequiredMarker}from"../../../internal/for
267
232
  }
268
233
 
269
234
  @media (forced-colors: active) {
270
- /* Background tint is flattened to Canvas in forced-colors mode. Keep the invisible select's
271
- hover/press target distinguishable with a geometry cue and system color. */
272
235
  [part='country-select']:not(:disabled):hover + [part='country-trigger'] {
273
236
  outline-color: Highlight;
274
237
  outline-style: dashed;
@@ -14,8 +14,6 @@ import{css}from"lit";const buttonChromeStyles=css`
14
14
  gap: var(--lr-radio-button-gap, var(--lr-space-xs));
15
15
  min-inline-size: var(--lr-size-1-5rem);
16
16
  max-inline-size: 100%;
17
- /* WCAG 2.5.8: the whole button is the target. Both axes retain a 1.5rem/24px floor, so even
18
- an empty 2xs tier remains a conformant target. */
19
17
  min-block-size: max(var(--lr-form-control-height), var(--lr-size-1-5rem));
20
18
  padding-inline: var(--lr-form-control-padding-inline);
21
19
  border: var(--lr-border-width-thin) solid var(--lr-color-border);
@@ -28,9 +26,6 @@ import{css}from"lit";const buttonChromeStyles=css`
28
26
  transition: background var(--lr-transition-fast),
29
27
  border-color var(--lr-transition-fast);
30
28
 
31
- /* Standalone is the safe default. The owning group projects data-run only after measuring
32
- real adjacency; separated, vertical, mixed, and wrapped controls therefore keep all four
33
- corners instead of guessing from DOM sibling order. */
34
29
  border-radius: var(--lr-radio-radius, var(--_lr-radio-radius));
35
30
  }
36
31
  [part="label"] {
@@ -44,9 +39,8 @@ import{css}from"lit";const buttonChromeStyles=css`
44
39
  max-inline-size: 40%;
45
40
  overflow: hidden;
46
41
  text-overflow: ellipsis;
42
+ white-space: nowrap;
47
43
  }
48
- /* A slot is itself an element child, so :empty can never identify an unassigned wrapper. The
49
- shared renderer tracks assigned content and reflects real emptiness through hidden. */
50
44
  [part~="start"][hidden],
51
45
  [part="label"][hidden],
52
46
  [part~="end"][hidden] {
@@ -76,14 +70,6 @@ import{css}from"lit";const buttonChromeStyles=css`
76
70
  margin-inline-start: calc(-1 * var(--lr-border-width-thin));
77
71
  }
78
72
 
79
- /* :host(:not(:disabled)), not a bare selector -- the interactive element is a plain
80
- <span role="radio"> that can never match :disabled itself, so without this guard a
81
- disabled segment still visibly tinted on hover/press, contradicting its own
82
- not-allowed cursor and reduced opacity. This is a form-associated custom element
83
- (static formAssociated = true, inherited from LyraRadio), so the UA computes :disabled
84
- the same way it does for a native control -- from the host's own disabled attribute or
85
- an ancestor <fieldset disabled>'s cascade -- matching [part~='circle']'s guard in the
86
- sibling radio.styles.ts exactly. */
87
73
  [part~="button"]:not([part~="disabled"]):hover {
88
74
  background: var(--lr-radio-button-hover-bg, var(--lr-color-brand-quiet));
89
75
  border-color: var(
@@ -91,10 +77,6 @@ import{css}from"lit";const buttonChromeStyles=css`
91
77
  var(--lr-color-brand)
92
78
  );
93
79
  }
94
- /* Pressed: the hover's tint carried further toward --lr-color-mix-partner (which follows the text
95
- colour). This rule used to be byte-identical to the :hover above, which is a pressed state only
96
- on paper -- a segment that looks exactly the same held down as hovered tells the user nothing
97
- about whether their click landed. */
98
80
  [part~="button"]:not([part~="disabled"]):active {
99
81
  background: var(
100
82
  --lr-radio-button-active-bg,
@@ -113,13 +95,10 @@ import{css}from"lit";const buttonChromeStyles=css`
113
95
  [part~="button"]:focus-visible {
114
96
  outline: var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);
115
97
  outline-offset: var(--lr-focus-ring-offset);
116
- /* The ring must not be painted under the overlapping neighbour's border. */
117
98
  position: relative;
118
99
  z-index: var(--lr-layer-content);
119
100
  }
120
101
 
121
- /* State lives in the part name, never as ::part(base)[aria-checked] -- an attribute selector
122
- after ::part() never matches. */
123
102
  [part~="checked"] {
124
103
  background: var(--lr-radio-button-checked-bg, var(--lr-color-brand));
125
104
  border-color: var(
@@ -131,10 +110,6 @@ import{css}from"lit";const buttonChromeStyles=css`
131
110
  [part~="checked"] [part="label"] {
132
111
  color: inherit;
133
112
  }
134
- /* The checked segment keeps its loud brand fill under the pointer -- the quiet tint the unchecked
135
- rules land on would read as a DESELECTION -- but it still has to move, and the press still has
136
- to out-read the hover. Both mix the loud fill toward --lr-color-mix-partner, which follows the
137
- text colour, so the on-brand label stays legible at either share. */
138
113
  [part~="checked"]:not([part~="disabled"]):hover {
139
114
  background: var(
140
115
  --lr-radio-button-checked-hover-bg,
@@ -172,10 +147,6 @@ import{css}from"lit";const buttonChromeStyles=css`
172
147
  }
173
148
  `,styles=css`
174
149
  :host {
175
- /* Rectangular chrome, so unlike <lr-radio>'s circular indicator this re-points the inherited
176
- radius knob at the shared control radius -- and swaps it for a pill when the pill property
177
- is set. Same one name on both tags, so a consumer overriding it does not have to know which
178
- of the two they are looking at. */
179
150
  --_lr-radio-radius: var(--lr-form-control-radius);
180
151
  display: inline-flex;
181
152
  min-inline-size: 0;
@@ -1,9 +1,5 @@
1
1
  import{css}from"lit";import{formControlRequiredMarker}from"../../../internal/form-control.styles.js";const groupStyles=css`
2
2
  :host {
3
- /* The group's own chrome rides the shared size ladder (internal/sizes.styles.ts): the row gap is
4
- a fraction of the tier's control height rather than a fixed space token, so it stays in
5
- proportion to the options beside it. At the default "m" tier it resolves to exactly the
6
- --lr-space-s the group shipped with before it had a size at all. */
7
3
  --_lr-radio-group-row-gap: calc(var(--lr-form-control-height) * 0.2);
8
4
  display: block;
9
5
  }
@@ -1,42 +1,22 @@
1
1
  import{css}from"lit";const styles=css`
2
2
  :host {
3
- /* The indicator tracks the shared size ladder (internal/sizes.styles.ts): 70% of the tier's
4
- control height, so a radio lines up with an lr-input/lr-select/lr-button of the same size
5
- rather than carrying a scale of its own. At the default "m" tier this resolves to exactly the
6
- 1.75rem the control shipped with before it had a size at all, and the --lr-icon-button-size
7
- cap is kept so a consumer compacting that theme token still compacts this control with it. */
8
3
  --_lr-radio-circle-size: min(
9
4
  var(--lr-icon-button-size),
10
5
  calc(var(--lr-form-control-height) * 0.7)
11
6
  );
12
- /* Capped at half the circle so the dot can never outgrow the ring it sits in, whatever a
13
- consumer does to either the ladder or the --lr-icon-button-size cap above. Resolves to
14
- 0.75rem at "m", the size the dot shipped with. */
15
7
  --_lr-radio-dot-size: min(
16
8
  calc(var(--lr-radio-circle-size, var(--_lr-radio-circle-size)) * 0.5),
17
9
  calc(var(--lr-form-control-height) * 0.3)
18
10
  );
19
- /* The corner radius of the control's own chrome. A circular indicator is fully round at every
20
- setting; the knob exists so <lr-radio-button>'s rectangular chrome -- which inherits this
21
- class, and with it the pill property -- has one name to override. */
22
11
  --_lr-radio-radius: var(--lr-radius-pill);
23
12
  display: inline-block;
24
13
  min-inline-size: 0;
25
14
  max-inline-size: 100%;
26
- /* Private default for the public label-indent hook. It uses the same two terms as the layout
27
- below: the circle's floor plus the label gap. A consumer can override the public hook on an
28
- ancestor or directly on the radio. It does not reach a sibling node in the consumer's tree,
29
- because custom properties inherit down, not sideways; a sibling <p> can compute the same
30
- formula from --lr-theme-icon-button-size and --lr-theme-space-s. */
31
15
  --_lr-radio-label-indent: calc(
32
16
  var(--lr-radio-circle-size, var(--_lr-radio-circle-size)) +
33
17
  var(--lr-space-s)
34
18
  );
35
19
  }
36
- /* A group projects its effective tier without rewriting the option's authored size property.
37
- Explicit inherit wins over sizes.styles.ts's local default and reads the group host's already
38
- resolved ladder variables. Removing/reparenting clears the private marker and restores the
39
- option's own tier immediately. */
40
20
  :host([data-lr-group-size]) {
41
21
  --lr-form-control-height: inherit;
42
22
  --lr-form-control-font-size: inherit;
@@ -52,9 +32,6 @@ import{css}from"lit";const styles=css`
52
32
  min-inline-size: var(--lr-icon-button-size);
53
33
  min-block-size: var(--lr-icon-button-size);
54
34
  max-inline-size: 100%;
55
- /* Derived from the published indent rather than repeating --lr-space-s, so the advertised
56
- value and the rendered label offset cannot drift: the label always starts exactly
57
- --lr-radio-label-indent from the base's inline start. Resolves to --lr-space-s by default. */
58
35
  gap: calc(
59
36
  var(--lr-radio-label-indent, var(--_lr-radio-label-indent)) -
60
37
  var(--lr-radio-circle-size, var(--_lr-radio-circle-size))
@@ -66,15 +43,6 @@ import{css}from"lit";const styles=css`
66
43
  outline: var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);
67
44
  outline-offset: var(--lr-focus-ring-offset);
68
45
  }
69
- /* :host(:disabled), not :host([disabled]) -- this is a form-associated
70
- custom element (static formAssociated = true), so the UA computes its
71
- disabled state (and therefore :disabled/:enabled matching) the same way
72
- it does for a native form control: from its own disabled content
73
- attribute *or* an ancestor <fieldset disabled>'s cascade. Keying this
74
- off the attribute selector only ever matched the first case -- a radio
75
- disabled purely via an ancestor fieldset had effectiveDisabled correctly
76
- gating tabindex/aria-disabled, but the base still rendered at full
77
- opacity with a normal cursor. */
78
46
  [part~="base"][part~="disabled"] {
79
47
  cursor: not-allowed;
80
48
  opacity: var(--lr-opacity-disabled);
@@ -85,11 +53,6 @@ import{css}from"lit";const styles=css`
85
53
  justify-content: center;
86
54
  flex: 0 0 auto;
87
55
  box-sizing: border-box;
88
- /* A floor, never a hard size -- matching <lr-checkbox>'s [part='box'] exactly. A label-less
89
- radio keeps this compact indicator centered in its base's shared target floor, while a hard
90
- inline-size/block-size would let an enlarged indicator overflow its content box. Same inline
91
- icon-affordance convention as lr-combobox's clear-button / lr-select's toggle:
92
- --lr-icon-button-size capped at the tier's own share of the control height. */
93
56
  min-inline-size: var(--lr-radio-circle-size, var(--_lr-radio-circle-size));
94
57
  min-block-size: var(--lr-radio-circle-size, var(--_lr-radio-circle-size));
95
58
  border: var(--lr-border-width-thin) solid var(--lr-color-border);
@@ -101,10 +64,6 @@ import{css}from"lit";const styles=css`
101
64
  [part~="base"]:not([part~="disabled"]):hover [part~="circle"] {
102
65
  border-color: var(--lr-radio-hover-border-color, var(--lr-color-brand));
103
66
  }
104
- /* Pressed. A ring rather than a fill, for the same reason <lr-checkbox>'s [part='box'] takes one:
105
- the circle's fill IS the state readout (surface unchecked, the dot inside it once checked), so
106
- tinting it under the thumb would read as a half-selected radio. Visibly more than the hover's
107
- border-colour step, and the same soft-ring vocabulary <lr-slider>'s thumb uses. */
108
67
  [part~="base"]:not([part~="disabled"]):active [part~="circle"] {
109
68
  border-color: var(
110
69
  --lr-radio-active-border-color,
@@ -114,9 +73,6 @@ import{css}from"lit";const styles=css`
114
73
  var(--lr-radio-active-ring-color, var(--lr-color-brand-quiet));
115
74
  }
116
75
  [part~="circle"][part~="checked"] {
117
- /* Component-scoped indirection (mirrors lr-checkbox's identical --lr-checkbox-checked-bg/
118
- -border pair) so a consumer can retint just this control's checked ring without hijacking
119
- the shared --lr-color-brand token used across the rest of the library. */
120
76
  border-color: var(--lr-radio-checked-border-color, var(--lr-color-brand));
121
77
  }
122
78
  [part~="dot"] {
@@ -98,11 +98,6 @@ import{css}from"lit";import{formControlRequiredMarker}from"../../../internal/for
98
98
  border-color: var(--lr-rubric-form-skip-border-color, var(--lr-color-border));
99
99
  color: var(--lr-rubric-form-skip-color, var(--lr-color-text));
100
100
  }
101
- /* A colour mix, not filter: brightness(). The filter multiplied every channel, so it moved a
102
- mid-brand fill but did nothing at all to a pure white or pure black one, and -- because a
103
- filter applies to the whole subtree -- it dragged the button's own label along with its
104
- background. Mixing the fill toward --lr-color-mix-partner (which follows the text colour)
105
- always moves, always in the direction the surface needs, and leaves the label alone. */
106
101
  [part='submit']:not(:disabled):hover {
107
102
  background: var(--lr-rubric-form-submit-hover-bg, color-mix(in oklab, var(--lr-rubric-form-submit-bg, var(--lr-color-brand)), var(--lr-color-mix-partner) var(--lr-color-mix-hover)));
108
103
  border-color: var(--lr-rubric-form-submit-hover-border-color, color-mix(in oklab, var(--lr-rubric-form-submit-border-color, var(--lr-color-brand)), var(--lr-color-mix-partner) var(--lr-color-mix-hover)));