@editora/ui-core 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (365) hide show
  1. package/dist/{ElementBase-DxbvhLJs.js → ElementBase-CbUsP3D6.js} +1 -1
  2. package/dist/{ElementBase-BeZT54Hj.mjs → ElementBase-D5QsC5Vw.mjs} +10 -1
  3. package/dist/ElementBase.d.ts +7 -0
  4. package/dist/ElementBase.d.ts.map +1 -1
  5. package/dist/accordion.cjs.js +1 -1
  6. package/dist/accordion.esm.js +1 -1
  7. package/dist/add-icons-CVeHOsWl.js +1 -0
  8. package/dist/add-icons-DBUZJ0g7.mjs +14 -0
  9. package/dist/add-icons.cjs.js +1 -0
  10. package/dist/add-icons.d.ts +16 -0
  11. package/dist/add-icons.d.ts.map +1 -0
  12. package/dist/add-icons.esm.js +4 -0
  13. package/dist/alert-dialog.cjs.js +24 -24
  14. package/dist/alert-dialog.esm.js +112 -107
  15. package/dist/alert.cjs.js +8 -8
  16. package/dist/alert.esm.js +22 -22
  17. package/dist/animated-beam.cjs.js +1 -1
  18. package/dist/animated-beam.esm.js +1 -1
  19. package/dist/animated-list.cjs.js +1 -1
  20. package/dist/animated-list.esm.js +1 -1
  21. package/dist/animated-text.cjs.js +1 -1
  22. package/dist/animated-text.esm.js +1 -1
  23. package/dist/app-header.cjs.js +15 -3
  24. package/dist/app-header.esm.js +31 -4
  25. package/dist/aspect-ratio.cjs.js +1 -1
  26. package/dist/aspect-ratio.esm.js +1 -1
  27. package/dist/avatar.cjs.js +1 -1
  28. package/dist/avatar.esm.js +1 -1
  29. package/dist/badge.cjs.js +1 -1
  30. package/dist/badge.esm.js +1 -1
  31. package/dist/block-controls.cjs.js +1 -1
  32. package/dist/block-controls.esm.js +1 -1
  33. package/dist/box.cjs.js +1 -1
  34. package/dist/box.esm.js +1 -1
  35. package/dist/breadcrumb.cjs.js +4 -4
  36. package/dist/breadcrumb.esm.js +93 -84
  37. package/dist/button.cjs.js +520 -1
  38. package/dist/button.esm.js +682 -2
  39. package/dist/{calendar-CzpWDxLc.js → calendar-BsVqtpjM.js} +6 -6
  40. package/dist/{calendar-DkSDFg33.mjs → calendar-CFafqZVA.mjs} +6 -6
  41. package/dist/calendar.cjs.js +1 -1
  42. package/dist/calendar.esm.js +1 -1
  43. package/dist/card.cjs.js +6 -5
  44. package/dist/card.esm.js +52 -39
  45. package/dist/chart.cjs.js +2 -2
  46. package/dist/chart.esm.js +2 -2
  47. package/dist/checkbox.cjs.js +4 -4
  48. package/dist/checkbox.esm.js +36 -15
  49. package/dist/clone-source-BxK2pEVw.mjs +11 -0
  50. package/dist/clone-source-C7E_ri5f.js +1 -0
  51. package/dist/collapsible.cjs.js +1 -1
  52. package/dist/collapsible.esm.js +1 -1
  53. package/dist/color-picker.cjs.js +2 -2
  54. package/dist/color-picker.esm.js +3 -3
  55. package/dist/combobox.cjs.js +4 -4
  56. package/dist/combobox.esm.js +22 -19
  57. package/dist/command-palette.cjs.js +1 -1
  58. package/dist/command-palette.esm.js +1 -1
  59. package/dist/command.cjs.js +1 -1
  60. package/dist/command.esm.js +1 -1
  61. package/dist/components/ui-alert-dialog.d.ts.map +1 -1
  62. package/dist/components/ui-alert.d.ts.map +1 -1
  63. package/dist/components/ui-app-header.d.ts +1 -0
  64. package/dist/components/ui-app-header.d.ts.map +1 -1
  65. package/dist/components/ui-breadcrumb.d.ts.map +1 -1
  66. package/dist/components/ui-card.d.ts +7 -0
  67. package/dist/components/ui-card.d.ts.map +1 -1
  68. package/dist/components/ui-checkbox.d.ts +6 -0
  69. package/dist/components/ui-checkbox.d.ts.map +1 -1
  70. package/dist/components/ui-combobox.d.ts.map +1 -1
  71. package/dist/components/ui-date-time-picker.d.ts.map +1 -1
  72. package/dist/components/ui-dialog.d.ts +1 -0
  73. package/dist/components/ui-dialog.d.ts.map +1 -1
  74. package/dist/components/ui-drawer.d.ts.map +1 -1
  75. package/dist/components/ui-dropdown.d.ts.map +1 -1
  76. package/dist/components/ui-empty-state.d.ts.map +1 -1
  77. package/dist/components/ui-hover-card.d.ts.map +1 -1
  78. package/dist/components/ui-icon.d.ts +1 -0
  79. package/dist/components/ui-icon.d.ts.map +1 -1
  80. package/dist/components/ui-input.d.ts +16 -0
  81. package/dist/components/ui-input.d.ts.map +1 -1
  82. package/dist/components/ui-layout.d.ts +20 -0
  83. package/dist/components/ui-layout.d.ts.map +1 -1
  84. package/dist/components/ui-menu.d.ts +1 -0
  85. package/dist/components/ui-menu.d.ts.map +1 -1
  86. package/dist/components/ui-menubar.d.ts.map +1 -1
  87. package/dist/components/ui-multi-select.d.ts +6 -0
  88. package/dist/components/ui-multi-select.d.ts.map +1 -1
  89. package/dist/components/ui-number-field.d.ts +6 -0
  90. package/dist/components/ui-number-field.d.ts.map +1 -1
  91. package/dist/components/ui-pagination.d.ts.map +1 -1
  92. package/dist/components/ui-password-field.d.ts +11 -0
  93. package/dist/components/ui-password-field.d.ts.map +1 -1
  94. package/dist/components/ui-popover.d.ts.map +1 -1
  95. package/dist/components/ui-positioner.d.ts.map +1 -1
  96. package/dist/components/ui-radio-group.d.ts +6 -0
  97. package/dist/components/ui-radio-group.d.ts.map +1 -1
  98. package/dist/components/ui-rating.d.ts +1 -0
  99. package/dist/components/ui-rating.d.ts.map +1 -1
  100. package/dist/components/ui-select.d.ts +7 -0
  101. package/dist/components/ui-select.d.ts.map +1 -1
  102. package/dist/components/ui-sidebar.d.ts +1 -0
  103. package/dist/components/ui-sidebar.d.ts.map +1 -1
  104. package/dist/components/ui-slider.d.ts +6 -0
  105. package/dist/components/ui-slider.d.ts.map +1 -1
  106. package/dist/components/ui-sortable.d.ts +1 -0
  107. package/dist/components/ui-sortable.d.ts.map +1 -1
  108. package/dist/components/ui-switch.d.ts +6 -0
  109. package/dist/components/ui-switch.d.ts.map +1 -1
  110. package/dist/components/ui-tabs.d.ts +2 -0
  111. package/dist/components/ui-tabs.d.ts.map +1 -1
  112. package/dist/components/ui-textarea.d.ts +6 -0
  113. package/dist/components/ui-textarea.d.ts.map +1 -1
  114. package/dist/components/ui-toast.d.ts.map +1 -1
  115. package/dist/components/ui-tooltip.d.ts.map +1 -1
  116. package/dist/container.cjs.js +1 -1
  117. package/dist/container.esm.js +1 -1
  118. package/dist/context-menu.cjs.js +2 -2
  119. package/dist/context-menu.esm.js +2 -2
  120. package/dist/control-group.cjs.js +1 -1
  121. package/dist/control-group.esm.js +1 -1
  122. package/dist/data-table.cjs.js +5 -5
  123. package/dist/data-table.esm.js +7 -7
  124. package/dist/date-field.cjs.js +1 -1
  125. package/dist/date-field.esm.js +3 -3
  126. package/dist/date-picker.cjs.js +2 -2
  127. package/dist/date-picker.esm.js +17 -17
  128. package/dist/date-range-picker.cjs.js +2 -2
  129. package/dist/date-range-picker.esm.js +4 -4
  130. package/dist/date-range-time-picker.cjs.js +3 -3
  131. package/dist/date-range-time-picker.esm.js +16 -16
  132. package/dist/date-time-picker.cjs.js +26 -23
  133. package/dist/date-time-picker.esm.js +49 -46
  134. package/dist/{date-time-utils-zAx4ghvC.mjs → date-time-utils-CJUksWj3.mjs} +1 -1
  135. package/dist/{date-time-utils-C-4eHTyy.js → date-time-utils-D3hQQ5Om.js} +1 -1
  136. package/dist/description.cjs.js +1 -1
  137. package/dist/description.esm.js +1 -1
  138. package/dist/dialog.cjs.js +7 -7
  139. package/dist/dialog.esm.js +51 -47
  140. package/dist/direction-provider.cjs.js +1 -1
  141. package/dist/direction-provider.esm.js +1 -1
  142. package/dist/dismissable-layer.cjs.js +1 -1
  143. package/dist/dismissable-layer.esm.js +1 -1
  144. package/dist/dock.cjs.js +1 -1
  145. package/dist/dock.esm.js +1 -1
  146. package/dist/drawer.cjs.js +5 -5
  147. package/dist/drawer.esm.js +18 -17
  148. package/dist/dropdown.cjs.js +7 -7
  149. package/dist/dropdown.esm.js +39 -38
  150. package/dist/empty-state.cjs.js +12 -2
  151. package/dist/empty-state.esm.js +17 -7
  152. package/dist/field-error.cjs.js +1 -1
  153. package/dist/field-error.esm.js +1 -1
  154. package/dist/field.cjs.js +2 -2
  155. package/dist/field.esm.js +2 -2
  156. package/dist/fieldset.cjs.js +1 -1
  157. package/dist/fieldset.esm.js +1 -1
  158. package/dist/file-upload.cjs.js +1 -1
  159. package/dist/file-upload.esm.js +1 -1
  160. package/dist/flex.cjs.js +1 -1
  161. package/dist/flex.esm.js +1 -1
  162. package/dist/floating-toolbar.cjs.js +2 -2
  163. package/dist/floating-toolbar.esm.js +2 -2
  164. package/dist/focus-scope-Dl0qk5GP.mjs +177 -0
  165. package/dist/focus-scope-Doz0bnE1.js +1 -0
  166. package/dist/focus-scope.cjs.js +1 -1
  167. package/dist/focus-scope.esm.js +2 -2
  168. package/dist/form-control-B90_3kYN.js +1 -0
  169. package/dist/form-control-D9wWUMBl.mjs +86 -0
  170. package/dist/form.cjs.js +2 -2
  171. package/dist/form.esm.js +2 -2
  172. package/dist/gantt.cjs.js +2 -2
  173. package/dist/gantt.esm.js +2 -2
  174. package/dist/grid.cjs.js +1 -1
  175. package/dist/grid.esm.js +1 -1
  176. package/dist/hover-card.cjs.js +5 -5
  177. package/dist/hover-card.esm.js +19 -18
  178. package/dist/icon-cloud.cjs.js +1 -1
  179. package/dist/icon-cloud.esm.js +1 -1
  180. package/dist/icon.cjs.js +207 -1
  181. package/dist/icon.esm.js +294 -2
  182. package/dist/icons-CpCpPXV5.js +1 -0
  183. package/dist/icons-DWYbbhb0.mjs +115 -0
  184. package/dist/icons.d.ts +11 -1
  185. package/dist/icons.d.ts.map +1 -1
  186. package/dist/implicit-submit-B6M5Uc56.js +1 -0
  187. package/dist/implicit-submit-Lr0-q2LR.mjs +44 -0
  188. package/dist/index.cjs.js +1 -1
  189. package/dist/index.d.ts +1 -0
  190. package/dist/index.d.ts.map +1 -1
  191. package/dist/index.esm.js +309 -299
  192. package/dist/inline-edit.cjs.js +1 -1
  193. package/dist/inline-edit.esm.js +1 -1
  194. package/dist/input.cjs.js +62 -20
  195. package/dist/input.esm.js +164 -58
  196. package/dist/label.cjs.js +1 -1
  197. package/dist/label.esm.js +1 -1
  198. package/dist/layout.cjs.js +145 -4
  199. package/dist/layout.esm.js +278 -40
  200. package/dist/marquee.cjs.js +1 -1
  201. package/dist/marquee.esm.js +1 -1
  202. package/dist/masonry-grid.cjs.js +1 -1
  203. package/dist/masonry-grid.esm.js +1 -1
  204. package/dist/menu.cjs.js +8 -8
  205. package/dist/menu.esm.js +51 -47
  206. package/dist/menubar.cjs.js +9 -9
  207. package/dist/menubar.esm.js +41 -40
  208. package/dist/meter.cjs.js +1 -1
  209. package/dist/meter.esm.js +1 -1
  210. package/dist/multi-select.cjs.js +7 -7
  211. package/dist/multi-select.esm.js +55 -34
  212. package/dist/navigate-CXebafwF.mjs +18 -0
  213. package/dist/navigate-ChJVIIuS.js +1 -0
  214. package/dist/navigation-menu.cjs.js +1 -1
  215. package/dist/navigation-menu.esm.js +1 -1
  216. package/dist/number-attribute-BAF07JrU.mjs +8 -0
  217. package/dist/number-attribute-C4Rrl7d3.js +1 -0
  218. package/dist/number-field.cjs.js +8 -8
  219. package/dist/number-field.esm.js +90 -69
  220. package/dist/number-ticker.cjs.js +1 -1
  221. package/dist/number-ticker.esm.js +1 -1
  222. package/dist/odometer.cjs.js +1 -1
  223. package/dist/odometer.esm.js +1 -1
  224. package/dist/orbiter.cjs.js +1 -1
  225. package/dist/orbiter.esm.js +1 -1
  226. package/dist/pagination.cjs.js +24 -23
  227. package/dist/pagination.esm.js +61 -46
  228. package/dist/{panel-group-BVHJEdfx.js → panel-group-BIzzpQ5i.js} +1 -1
  229. package/dist/{panel-group-BxO_eNW6.mjs → panel-group-CFLjzRWI.mjs} +1 -1
  230. package/dist/panel-group.cjs.js +1 -1
  231. package/dist/panel-group.esm.js +1 -1
  232. package/dist/panel.cjs.js +1 -1
  233. package/dist/panel.esm.js +1 -1
  234. package/dist/password-field.cjs.js +36 -16
  235. package/dist/password-field.esm.js +113 -44
  236. package/dist/pin-input.cjs.js +1 -1
  237. package/dist/pin-input.esm.js +1 -1
  238. package/dist/placement-grid.cjs.js +1 -1
  239. package/dist/placement-grid.esm.js +1 -1
  240. package/dist/plugin-panel.cjs.js +1 -1
  241. package/dist/plugin-panel.esm.js +1 -1
  242. package/dist/popover.cjs.js +2 -2
  243. package/dist/popover.esm.js +28 -26
  244. package/dist/portal.cjs.js +1 -1
  245. package/dist/portal.esm.js +1 -1
  246. package/dist/positioner.cjs.js +2 -2
  247. package/dist/positioner.esm.js +35 -38
  248. package/dist/preload.cjs.js +221 -0
  249. package/dist/preload.css +220 -0
  250. package/dist/preload.d.ts +17 -0
  251. package/dist/preload.d.ts.map +1 -0
  252. package/dist/preload.esm.js +224 -0
  253. package/dist/presence.cjs.js +1 -1
  254. package/dist/presence.esm.js +1 -1
  255. package/dist/primitives/clone-source.d.ts +3 -0
  256. package/dist/primitives/clone-source.d.ts.map +1 -0
  257. package/dist/primitives/focus-scope.d.ts +6 -0
  258. package/dist/primitives/focus-scope.d.ts.map +1 -1
  259. package/dist/primitives/form-control.d.ts +68 -0
  260. package/dist/primitives/form-control.d.ts.map +1 -0
  261. package/dist/primitives/implicit-submit.d.ts +17 -0
  262. package/dist/primitives/implicit-submit.d.ts.map +1 -0
  263. package/dist/primitives/navigate.d.ts +27 -0
  264. package/dist/primitives/navigate.d.ts.map +1 -0
  265. package/dist/primitives/number-attribute.d.ts +7 -0
  266. package/dist/primitives/number-attribute.d.ts.map +1 -0
  267. package/dist/primitives/slotted-input.d.ts +19 -0
  268. package/dist/primitives/slotted-input.d.ts.map +1 -0
  269. package/dist/progress.cjs.js +3 -3
  270. package/dist/progress.esm.js +3 -3
  271. package/dist/quick-actions.cjs.js +5 -5
  272. package/dist/quick-actions.esm.js +3 -3
  273. package/dist/radio-group.cjs.js +9 -9
  274. package/dist/radio-group.esm.js +47 -24
  275. package/dist/radio.cjs.js +1 -1
  276. package/dist/radio.esm.js +1 -1
  277. package/dist/rating.cjs.js +6 -6
  278. package/dist/rating.esm.js +21 -10
  279. package/dist/{runtime-BRT7E4A8.mjs → runtime-CORXjP7e.mjs} +379 -357
  280. package/dist/runtime-uCly3ECd.js +5 -0
  281. package/dist/runtime.cjs.js +1 -1
  282. package/dist/runtime.esm.js +1 -1
  283. package/dist/scroll-area.cjs.js +1 -1
  284. package/dist/scroll-area.esm.js +1 -1
  285. package/dist/section.cjs.js +1 -1
  286. package/dist/section.esm.js +1 -1
  287. package/dist/select.cjs.js +21 -21
  288. package/dist/select.esm.js +111 -71
  289. package/dist/selection-popup.cjs.js +2 -2
  290. package/dist/selection-popup.esm.js +2 -2
  291. package/dist/semantic-tokens.d.ts.map +1 -1
  292. package/dist/separator.cjs.js +1 -1
  293. package/dist/separator.esm.js +1 -1
  294. package/dist/sidebar.cjs.js +15 -15
  295. package/dist/sidebar.esm.js +48 -42
  296. package/dist/skeleton.cjs.js +1 -1
  297. package/dist/skeleton.esm.js +1 -1
  298. package/dist/slider.cjs.js +11 -11
  299. package/dist/slider.esm.js +40 -23
  300. package/dist/slot.cjs.js +1 -1
  301. package/dist/slot.esm.js +1 -1
  302. package/dist/slotted-input-BVq2QQg2.js +1 -0
  303. package/dist/slotted-input-atWznLfm.mjs +13 -0
  304. package/dist/sortable.cjs.js +25 -25
  305. package/dist/sortable.esm.js +29 -21
  306. package/dist/spinning-text.cjs.js +1 -1
  307. package/dist/spinning-text.esm.js +1 -1
  308. package/dist/split-button.cjs.js +1 -1
  309. package/dist/split-button.esm.js +1 -1
  310. package/dist/splitter.cjs.js +1 -1
  311. package/dist/splitter.esm.js +1 -1
  312. package/dist/standalone/add-icons.d.ts +2 -0
  313. package/dist/standalone/add-icons.d.ts.map +1 -0
  314. package/dist/standalone/preload.d.ts +2 -0
  315. package/dist/standalone/preload.d.ts.map +1 -0
  316. package/dist/stepper.cjs.js +3 -3
  317. package/dist/stepper.esm.js +3 -3
  318. package/dist/switch.cjs.js +9 -9
  319. package/dist/switch.esm.js +56 -35
  320. package/dist/table.cjs.js +1 -1
  321. package/dist/table.esm.js +1 -1
  322. package/dist/tabs.cjs.js +14 -14
  323. package/dist/tabs.esm.js +129 -115
  324. package/dist/tags-input.cjs.js +1 -1
  325. package/dist/tags-input.esm.js +1 -1
  326. package/dist/textarea.cjs.js +33 -11
  327. package/dist/textarea.esm.js +74 -35
  328. package/dist/theme.d.ts +6 -0
  329. package/dist/theme.d.ts.map +1 -1
  330. package/dist/time-field.cjs.js +1 -1
  331. package/dist/time-field.esm.js +2 -2
  332. package/dist/time-picker.cjs.js +1 -1
  333. package/dist/time-picker.esm.js +3 -3
  334. package/dist/timeline.cjs.js +2 -2
  335. package/dist/timeline.esm.js +2 -2
  336. package/dist/toast.cjs.js +4 -4
  337. package/dist/toast.esm.js +17 -16
  338. package/dist/toggle-group.cjs.js +1 -1
  339. package/dist/toggle-group.esm.js +1 -1
  340. package/dist/toggle.cjs.js +3 -3
  341. package/dist/toggle.esm.js +9 -9
  342. package/dist/toolbar.cjs.js +1 -1
  343. package/dist/toolbar.esm.js +1 -1
  344. package/dist/tooltip.cjs.js +2 -2
  345. package/dist/tooltip.esm.js +12 -14
  346. package/dist/transfer-list.cjs.js +1 -1
  347. package/dist/transfer-list.esm.js +1 -1
  348. package/dist/{tree-33fVNnaf.mjs → tree-CD2k2lIC.mjs} +1 -1
  349. package/dist/{tree-Dc02MChE.js → tree-ChQfhxya.js} +1 -1
  350. package/dist/tree-item.cjs.js +1 -1
  351. package/dist/tree-item.esm.js +1 -1
  352. package/dist/tree.cjs.js +1 -1
  353. package/dist/tree.esm.js +1 -1
  354. package/dist/visually-hidden.cjs.js +1 -1
  355. package/dist/visually-hidden.esm.js +1 -1
  356. package/dist/wizard.cjs.js +4 -4
  357. package/dist/wizard.esm.js +4 -4
  358. package/package.json +3 -2
  359. package/dist/focus-scope-Bwug2gDv.js +0 -1
  360. package/dist/focus-scope-CmEsG5UZ.mjs +0 -138
  361. package/dist/runtime-CXw4SGV9.js +0 -5
  362. package/dist/ui-button-C3OmI7Sn.mjs +0 -684
  363. package/dist/ui-button-CnLwXBnx.js +0 -520
  364. package/dist/ui-icon-D3avtxX_.js +0 -207
  365. package/dist/ui-icon-DLhB08Fo.mjs +0 -361
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("./ElementBase-DxbvhLJs.js"),v=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("./ElementBase-CbUsP3D6.js"),v=`
2
2
  :host {
3
3
  --ui-inline-edit-bg: transparent;
4
4
  --ui-inline-edit-border: 1px dashed transparent;
@@ -1,4 +1,4 @@
1
- import { E as h } from "./ElementBase-BeZT54Hj.mjs";
1
+ import { E as h } from "./ElementBase-D5QsC5Vw.mjs";
2
2
  const b = `
3
3
  :host {
4
4
  --ui-inline-edit-bg: transparent;
package/dist/input.cjs.js CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const $=require("./ElementBase-DxbvhLJs.js"),S=require("./control-name-BmoI1m3a.js"),q=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const L=require("./ElementBase-CbUsP3D6.js"),q=require("./slotted-input-BVq2QQg2.js"),T=require("./implicit-submit-B6M5Uc56.js"),I=require("./control-name-BmoI1m3a.js"),V=`
2
2
  <svg viewBox="0 0 20 20" aria-hidden="true" focusable="false">
3
3
  <path d="m6 6 8 8M14 6l-8 8" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
4
4
  </svg>
5
- `,N=`
5
+ `,D=`
6
6
  :host {
7
7
  --ui-input-action-size: 24px;
8
8
  --ui-input-padding: var(--ui-padding, 0);
@@ -69,6 +69,28 @@
69
69
  transform: translateY(-0.5px);
70
70
  }
71
71
 
72
+ /* description-position="below": the hint goes under the field (DOM order, and so what a
73
+ screen reader reads, stays label, description, field). */
74
+ :host([description-position="below"]) .meta:not([hidden]) {
75
+ display: contents;
76
+ }
77
+
78
+ :host([description-position="below"]) .label {
79
+ order: 0;
80
+ }
81
+
82
+ :host([description-position="below"]) .shell {
83
+ order: 1;
84
+ }
85
+
86
+ :host([description-position="below"]) .description {
87
+ order: 2;
88
+ }
89
+
90
+ :host([description-position="below"]) .footer {
91
+ order: 3;
92
+ }
93
+
72
94
  .description {
73
95
  margin: 0;
74
96
  color: var(--ui-description-color);
@@ -197,6 +219,25 @@
197
219
  color: var(--ui-input-placeholder);
198
220
  }
199
221
 
222
+ /* <input slot="input">: the author's own input (password managers, autofill), styled the same. */
223
+ ::slotted(input[slot="input"]) {
224
+ inline-size: 100%;
225
+ min-inline-size: 0;
226
+ box-sizing: border-box;
227
+ border: none;
228
+ background: transparent;
229
+ color: inherit;
230
+ font: 500 var(--ui-input-font-size)/var(--ui-default-line-height, var(--line-height-2, 20px)) var(--ui-font-family, var(--default-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif));
231
+ padding: var(--ui-input-padding);
232
+ min-block-size: calc(var(--ui-input-min-height) - 2px);
233
+ margin: 0;
234
+ outline: none;
235
+ }
236
+
237
+ .control[data-slotted-input] > input {
238
+ display: none;
239
+ }
240
+
200
241
  input::-webkit-search-cancel-button {
201
242
  display: none;
202
243
  }
@@ -354,7 +395,7 @@
354
395
  --ui-label-color: #cbd5e1;
355
396
  --ui-description-color: #93a4bd;
356
397
  --ui-input-border-color: #334155;
357
- --ui-input-focus-ring: #93c5fd;
398
+ --ui-input-focus-ring: var(--ui-color-accent-on-dark, #93c5fd);
358
399
  --ui-input-placeholder: color-mix(in srgb, #e2e8f0 46%, transparent);
359
400
  --ui-input-shadow: 0 2px 8px rgba(2, 6, 23, 0.24);
360
401
  }
@@ -488,16 +529,16 @@
488
529
  box-shadow: none;
489
530
  }
490
531
  }
491
- `;function r(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function w(a){if(!a)return!1;const t=a.assignedNodes({flatten:!0});return t.length?t.some(e=>e.nodeType===Node.TEXT_NODE?!!e.textContent?.trim():e.nodeType===Node.ELEMENT_NODE):!1}function A(a,t){const e=a.getAttribute(t);if(e==null)return!1;const i=String(e).trim().toLowerCase();return i!=="false"&&i!=="0"}function T(a){return a==="none"||a==="large"||a==="full"}class E extends $.ElementBase{constructor(){super(),this._input=null,this._clearBtn=null,this._debounceTimer=null,this._formUnregister=null,this._uid=Math.random().toString(36).slice(2,9),this._autofocusApplied=!1,this._onNativeInput=this._onNativeInput.bind(this),this._onNativeChange=this._onNativeChange.bind(this),this._onClearClick=this._onClearClick.bind(this),this._onSlotChange=this._onSlotChange.bind(this)}static get observedAttributes(){return["value","placeholder","disabled","clearable","size","validation","debounce","maxlength","minlength","readonly","autofocus","counter","floating-label","headless","type","name","required","pattern","inputmode","autocomplete","min","max","step","spellcheck","variant","tone","density","shape","color","radius","label","aria-label","aria-description","aria-describedby","description","data-error"]}connectedCallback(){super.connectedCallback(),this.root.addEventListener("slotchange",this._onSlotChange),this._registerWithForm()}disconnectedCallback(){this.root.removeEventListener("slotchange",this._onSlotChange),this._detachListeners(),this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=null),this._formUnregister&&(this._formUnregister(),this._formUnregister=null),this._autofocusApplied=!1,super.disconnectedCallback()}_syncHostTokens(){const t=this.getAttribute("color");t?this.style.setProperty("--ui-input-accent",t):this.style.removeProperty("--ui-input-accent");const e=this.getAttribute("radius")||"";e&&!T(e)?this.style.setProperty("--ui-input-border-radius",e):this.style.removeProperty("--ui-input-border-radius")}_syncControlAttrs(){if(this._syncHostTokens(),!this._input)return;const t=this._input,e=this.getAttribute("type")||"text",i=this.getAttribute("placeholder")||"",n=this.getAttribute("name")||"",s=this.getAttribute("pattern")||"",o=this.getAttribute("inputmode")||"",g=this.getAttribute("autocomplete")||"",p=this.getAttribute("min")||"",u=this.getAttribute("max")||"",l=this.getAttribute("step")||"",c=this.getAttribute("spellcheck")||"",d=this.getAttribute("maxlength")||"",h=this.getAttribute("minlength")||"",b=A(this,"disabled"),f=this.hasAttribute("required"),v=this.hasAttribute("readonly");try{t.type=e}catch{t.type="text"}t.placeholder=i,t.disabled=b,t.required=f,t.readOnly=v,t.name=n,s?t.setAttribute("pattern",s):t.removeAttribute("pattern"),o?t.setAttribute("inputmode",o):t.removeAttribute("inputmode"),g?t.setAttribute("autocomplete",g):t.removeAttribute("autocomplete"),p?t.setAttribute("min",p):t.removeAttribute("min"),u?t.setAttribute("max",u):t.removeAttribute("max"),l?t.setAttribute("step",l):t.removeAttribute("step"),c?t.setAttribute("spellcheck",c):t.removeAttribute("spellcheck"),d&&Number.isFinite(Number(d))?t.setAttribute("maxlength",d):t.removeAttribute("maxlength"),h&&Number.isFinite(Number(h))?t.setAttribute("minlength",h):t.removeAttribute("minlength")}attributeChangedCallback(t,e,i){if(e===i)return;if(t==="value"){this._syncInputValue(i||"");return}if(t==="name"&&this._registerWithForm(),t==="autofocus"&&!this.hasAttribute("autofocus")&&(this._autofocusApplied=!1),new Set(["placeholder","disabled","clearable","size","validation","debounce","maxlength","minlength","readonly","autofocus","counter","headless","type","name","required","pattern","inputmode","autocomplete","min","max","step","spellcheck","variant","tone","density","shape","color","radius","aria-label","aria-description","aria-describedby"]).has(t)){this._syncControlAttrs(),this._syncInputValue(this.value),this._syncDerivedState(),t==="autofocus"&&this.hasAttribute("autofocus")&&!this._autofocusApplied&&(this._autofocusApplied=!0,queueMicrotask(()=>{if(this.isConnected)try{this._input?.focus({preventScroll:!0})}catch{this._input?.focus()}}));return}this.isConnected&&this.requestRender()}get value(){return this.getAttribute("value")||""}set value(t){this.setAttribute("value",t||"")}focus(t){if(this._input){this._input.focus(t);return}super.focus(t)}blur(){this._input?.blur()}select(){this._input?.select()}_emitValueEvent(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e},bubbles:!0,composed:!0}))}_registerWithForm(){this._formUnregister&&(this._formUnregister(),this._formUnregister=null);try{const n=this.getRootNode().host?.closest?.("ui-form")||null||this.closest("ui-form"),s=this.getAttribute("name");n&&typeof n.registerField=="function"&&s&&(this._formUnregister=n.registerField(s,{name:s,getValue:()=>this.value,setValue:o=>{this.value=String(o??"")},validate:async()=>this._input?{valid:this._input.checkValidity(),message:this._input.validationMessage||void 0}:{valid:!0},setError:o=>{o?(this.setAttribute("validation","error"),this.setAttribute("data-error",o)):(this.removeAttribute("validation"),this.removeAttribute("data-error"))}}))}catch{}}_detachListeners(){this._input&&(this._input.removeEventListener("input",this._onNativeInput),this._input.removeEventListener("change",this._onNativeChange)),this._clearBtn&&this._clearBtn.removeEventListener("click",this._onClearClick),this._clearBtn=null}_syncInputValue(t){this._input&&this._input.value!==t&&(this._input.value=t),this._clearBtn&&(A(this,"clearable")&&t.length>0&&!A(this,"disabled")&&!this.hasAttribute("readonly")?this._clearBtn.removeAttribute("hidden"):this._clearBtn.setAttribute("hidden",""));const e=this.root.querySelector(".counter");if(e&&this.hasAttribute("counter")){const n=this.getAttribute("maxlength"),s=n?`${t.length}/${n}`:String(t.length);e.textContent=s}const i=this.root.querySelector(".shell");i&&i.setAttribute("data-has-value",t?"true":"false")}_onSlotChange(){this._syncDerivedState()}_syncDerivedState(){const t=this.root.querySelector('slot[name="label"]'),e=this.root.querySelector('slot[name="description"]'),i=this.root.querySelector('slot[name="error"]'),n=this.root.querySelector('slot[name="prefix"]'),s=this.root.querySelector('slot[name="suffix"]'),o=(this.getAttribute("label")||"").trim(),g=(this.getAttribute("description")||"").trim(),p=(this.getAttribute("data-error")||"").trim(),u=!!o||w(t),l=!!g||w(e),c=!!p||w(i),d=w(n),h=w(s),b=this.root.querySelector(".label"),f=this.root.querySelector(".description"),v=this.root.querySelector(".prefix"),m=this.root.querySelector(".suffix"),x=this.root.querySelector(".meta"),y=this.root.querySelector(".footer"),_=this.root.querySelector(".error"),C=this.root.querySelector(".counter");b&&(u?b.removeAttribute("hidden"):b.setAttribute("hidden","")),f&&(l?f.removeAttribute("hidden"):f.setAttribute("hidden","")),v&&(d?v.removeAttribute("hidden"):v.setAttribute("hidden","")),m&&(h?m.removeAttribute("hidden"):m.setAttribute("hidden","")),x&&(u||l?x.removeAttribute("hidden"):x.setAttribute("hidden",""));const k=this.hasAttribute("counter");if(C&&(k?C.removeAttribute("hidden"):C.setAttribute("hidden","")),_&&(c?_.removeAttribute("hidden"):_.setAttribute("hidden","")),y&&(c||k?y.removeAttribute("hidden"):y.setAttribute("hidden","")),this._input){S.syncControlName(this._input,this,u?`${this._uid}-label`:null);const z=[];l&&z.push(`${this._uid}-description`),c&&z.push(`${this._uid}-error`),S.syncControlDescription(this._input,this,this._uid,z),this.getAttribute("validation")==="error"||!!p?this._input.setAttribute("aria-invalid","true"):this._input.removeAttribute("aria-invalid"),this.hasAttribute("required")?this._input.setAttribute("aria-required","true"):this._input.removeAttribute("aria-required")}}_onNativeInput(t){const e=t.target.value;this.getAttribute("value")!==e?this.setAttribute("value",e):this._syncInputValue(e),this._emitValueEvent("input",e);const i=Number(this.getAttribute("debounce")||0);i>0?(this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>{this._emitValueEvent("debounced-input",e),this._debounceTimer=null},i)):this._emitValueEvent("debounced-input",e)}_onNativeChange(t){const e=t.target.value;this._emitValueEvent("change",e)}_onClearClick(t){if(t.preventDefault(),!(A(this,"disabled")||this.hasAttribute("readonly"))&&this._input){this.value="",this._input.value="",this._input.dispatchEvent(new Event("input",{bubbles:!0})),this._input.dispatchEvent(new Event("change",{bubbles:!0})),this.dispatchEvent(new CustomEvent("clear",{bubbles:!0,composed:!0}));try{this._input.focus({preventScroll:!0})}catch{this._input.focus()}}}render(){const t=this.getAttribute("value")||"",e=this.getAttribute("placeholder")||"",i=A(this,"disabled"),n=A(this,"clearable"),s=this.getAttribute("type")||"text",o=this.getAttribute("name")||"",g=this.hasAttribute("required"),p=this.getAttribute("pattern")||"",u=this.getAttribute("inputmode")||"",l=this.getAttribute("autocomplete")||"",c=this.getAttribute("min")||"",d=this.getAttribute("max")||"",h=this.getAttribute("step")||"",b=this.getAttribute("spellcheck")||"",f=this.getAttribute("maxlength")||"",v=this.getAttribute("minlength")||"",m=this.hasAttribute("readonly"),x=this.getAttribute("label")||"",y=this.getAttribute("description")||"",_=this.getAttribute("data-error")||"",C=this.getAttribute("validation")||"",k=this.hasAttribute("floating-label"),z=g?'<span class="required" aria-hidden="true">*</span>':"";this._syncHostTokens(),this.setContent(`
492
- <style>${N}</style>
532
+ `;function r(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function k(a){if(!a)return!1;const t=a.assignedNodes({flatten:!0});return t.length?t.some(e=>e.nodeType===Node.TEXT_NODE?!!e.textContent?.trim():e.nodeType===Node.ELEMENT_NODE):!1}function m(a,t){const e=a.getAttribute(t);if(e==null)return!1;const i=String(e).trim().toLowerCase();return i!=="false"&&i!=="0"}function M(a){return a==="none"||a==="large"||a==="full"}const E=class E extends L.ElementBase{constructor(){super(),this._input=null,this._clearBtn=null,this._debounceTimer=null,this._formUnregister=null,this._uid=Math.random().toString(36).slice(2,9),this._autofocusApplied=!1,this._internals=null,this._defaultValue=null,this._formDisabled=!1,this._slottedInput=null,this._dirty=!1,this._onLabelClick=t=>{t.target?.closest?.(".label")&&this._input?.focus()};try{this._internals=typeof this.attachInternals=="function"?this.attachInternals():null}catch{this._internals=null}this._onNativeKeyDown=this._onNativeKeyDown.bind(this),this._onNativeInput=this._onNativeInput.bind(this),this._onNativeChange=this._onNativeChange.bind(this),this._onClearClick=this._onClearClick.bind(this),this._onSlotChange=this._onSlotChange.bind(this)}static get observedAttributes(){return["value","placeholder","disabled","clearable","size","validation","debounce","maxlength","minlength","readonly","autofocus","counter","floating-label","headless","type","name","required","pattern","inputmode","autocomplete","min","max","step","spellcheck","variant","tone","density","shape","color","radius","label","aria-label","aria-description","aria-describedby","description","data-error"]}connectedCallback(){this._dirty||(this._defaultValue=this.getAttribute("value")||""),super.connectedCallback(),this.root.addEventListener("slotchange",this._onSlotChange),this.root.addEventListener("click",this._onLabelClick),this._registerWithForm()}get form(){try{return this._internals?.form??null}catch{return null}}formResetCallback(){this._dirty=!1,this.value=this._defaultValue||""}formDisabledCallback(t){this._formDisabled=t,this._input&&(this._input.disabled=t||m(this,"disabled"))}_syncFormState(){const t=this._internals;if(t)try{if(this._slottedInput){t.setFormValue?.(null),t.setValidity?.({});return}t.setFormValue?.(this.value);const e=this._input;e&&typeof t.setValidity=="function"&&(e.validity&&!e.validity.valid?t.setValidity(e.validity,e.validationMessage,e):t.setValidity({}))}catch{}}_onNativeKeyDown(t){T.scheduleImplicitSubmit(t,this,()=>this.form)}disconnectedCallback(){this.root.removeEventListener("slotchange",this._onSlotChange),this.root.removeEventListener("click",this._onLabelClick),this._detachListeners(),this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=null),this._formUnregister&&(this._formUnregister(),this._formUnregister=null),this._autofocusApplied=!1,super.disconnectedCallback()}_syncHostTokens(){const t=this.getAttribute("color");t?this.style.setProperty("--ui-input-accent",t):this.style.removeProperty("--ui-input-accent");const e=this.getAttribute("radius")||"";e&&!M(e)?this.style.setProperty("--ui-input-border-radius",e):this.style.removeProperty("--ui-input-border-radius")}_bindInput(){this._input&&(this._input.removeEventListener("input",this._onNativeInput),this._input.removeEventListener("change",this._onNativeChange),this._input.removeEventListener("keydown",this._onNativeKeyDown));const t=q.findSlottedInput(this);this._slottedInput=t;const e=this.root.querySelector(".control");t?e?.setAttribute("data-slotted-input",""):e?.removeAttribute("data-slotted-input"),this._input=t||this.root.querySelector(".control > input"),t&&!this.hasAttribute("value")&&t.value&&this.setAttribute("value",t.value),this._input&&(this._input.addEventListener("input",this._onNativeInput),this._input.addEventListener("change",this._onNativeChange),t||this._input.addEventListener("keydown",this._onNativeKeyDown))}_syncSlottedInputAttrs(t){const e=m(this,"disabled")||this._formDisabled;(this.hasAttribute("disabled")||this._formDisabled)&&(t.disabled=e),this.hasAttribute("required")&&(t.required=!0),this.hasAttribute("readonly")&&(t.readOnly=!0)}_syncControlAttrs(){if(this._syncHostTokens(),!this._input)return;if(this._slottedInput){this._syncSlottedInputAttrs(this._slottedInput);return}const t=this._input,e=this.getAttribute("type")||"text",i=this.getAttribute("placeholder")||"",n=this.getAttribute("name")||"",o=this.getAttribute("pattern")||"",s=this.getAttribute("inputmode")||"",g=this.getAttribute("autocomplete")||"",u=this.getAttribute("min")||"",l=this.getAttribute("max")||"",c=this.getAttribute("step")||"",d=this.getAttribute("spellcheck")||"",p=this.getAttribute("maxlength")||"",h=this.getAttribute("minlength")||"",b=m(this,"disabled"),f=this.hasAttribute("required"),v=this.hasAttribute("readonly");try{t.type=e}catch{t.type="text"}t.placeholder=i,t.disabled=b||this._formDisabled,t.required=f,t.readOnly=v,t.name=n,o?t.setAttribute("pattern",o):t.removeAttribute("pattern"),s?t.setAttribute("inputmode",s):t.removeAttribute("inputmode"),g?t.setAttribute("autocomplete",g):t.removeAttribute("autocomplete"),u?t.setAttribute("min",u):t.removeAttribute("min"),l?t.setAttribute("max",l):t.removeAttribute("max"),c?t.setAttribute("step",c):t.removeAttribute("step"),d?t.setAttribute("spellcheck",d):t.removeAttribute("spellcheck"),p&&Number.isFinite(Number(p))?t.setAttribute("maxlength",p):t.removeAttribute("maxlength"),h&&Number.isFinite(Number(h))?t.setAttribute("minlength",h):t.removeAttribute("minlength")}attributeChangedCallback(t,e,i){if(e===i)return;if(t==="value"){this._dirty||(this._defaultValue=i||""),this._syncInputValue(i||"");return}if(t==="name"&&this._registerWithForm(),t==="autofocus"&&!this.hasAttribute("autofocus")&&(this._autofocusApplied=!1),new Set(["placeholder","disabled","clearable","size","validation","debounce","maxlength","minlength","readonly","autofocus","counter","headless","type","name","required","pattern","inputmode","autocomplete","min","max","step","spellcheck","variant","tone","density","shape","color","radius","aria-label","aria-description","aria-describedby"]).has(t)){this._syncControlAttrs(),this._syncInputValue(this.value),this._syncDerivedState(),t==="autofocus"&&this.hasAttribute("autofocus")&&!this._autofocusApplied&&(this._autofocusApplied=!0,queueMicrotask(()=>{if(this.isConnected)try{this._input?.focus({preventScroll:!0})}catch{this._input?.focus()}}));return}this.isConnected&&this.requestRender()}get value(){return this.getAttribute("value")||""}set value(t){this.setAttribute("value",t||"")}focus(t){if(this._input){this._input.focus(t);return}super.focus(t)}blur(){this._input?.blur()}select(){this._input?.select()}_emitValueEvent(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e},bubbles:!0,composed:!0}))}_registerWithForm(){this._formUnregister&&(this._formUnregister(),this._formUnregister=null);try{const n=this.getRootNode().host?.closest?.("ui-form")||null||this.closest("ui-form"),o=this.getAttribute("name");n&&typeof n.registerField=="function"&&o&&(this._formUnregister=n.registerField(o,{name:o,getValue:()=>this.value,setValue:s=>{this.value=String(s??"")},validate:async()=>this._input?{valid:this._input.checkValidity(),message:this._input.validationMessage||void 0}:{valid:!0},setError:s=>{s?(this.setAttribute("validation","error"),this.setAttribute("data-error",s)):(this.removeAttribute("validation"),this.removeAttribute("data-error"))}}))}catch{}}_detachListeners(){this._input&&(this._input.removeEventListener("input",this._onNativeInput),this._input.removeEventListener("change",this._onNativeChange),this._input.removeEventListener("keydown",this._onNativeKeyDown)),this._clearBtn&&this._clearBtn.removeEventListener("click",this._onClearClick),this._clearBtn=null}_syncInputValue(t){this._input&&this._input.value!==t&&(this._input.value=t),this._syncFormState(),this._clearBtn&&(m(this,"clearable")&&t.length>0&&!m(this,"disabled")&&!this.hasAttribute("readonly")?this._clearBtn.removeAttribute("hidden"):this._clearBtn.setAttribute("hidden",""));const e=this.root.querySelector(".counter");if(e&&this.hasAttribute("counter")){const n=this.getAttribute("maxlength"),o=n?`${t.length}/${n}`:String(t.length);e.textContent=o}const i=this.root.querySelector(".shell");i&&i.setAttribute("data-has-value",t?"true":"false")}_onSlotChange(t){t?.target?.name==="input"&&(this._bindInput(),this._syncControlAttrs(),this._syncInputValue(this.value)),this._syncDerivedState()}_syncDerivedState(){const t=this.root.querySelector('slot[name="label"]'),e=this.root.querySelector('slot[name="description"]'),i=this.root.querySelector('slot[name="error"]'),n=this.root.querySelector('slot[name="prefix"]'),o=this.root.querySelector('slot[name="suffix"]'),s=(this.getAttribute("label")||"").trim(),g=(this.getAttribute("description")||"").trim(),u=(this.getAttribute("data-error")||"").trim(),l=!!s||k(t),c=!!g||k(e),d=!!u||k(i),p=k(n),h=k(o),b=this.root.querySelector(".label"),f=this.root.querySelector(".description"),v=this.root.querySelector(".prefix"),_=this.root.querySelector(".suffix"),y=this.root.querySelector(".meta"),w=this.root.querySelector(".footer"),A=this.root.querySelector(".error"),C=this.root.querySelector(".counter");b&&(l?b.removeAttribute("hidden"):b.setAttribute("hidden","")),f&&(c?f.removeAttribute("hidden"):f.setAttribute("hidden","")),v&&(p?v.removeAttribute("hidden"):v.setAttribute("hidden","")),_&&(h?_.removeAttribute("hidden"):_.setAttribute("hidden","")),y&&(l||c?y.removeAttribute("hidden"):y.setAttribute("hidden",""));const z=this.hasAttribute("counter");if(C&&(z?C.removeAttribute("hidden"):C.setAttribute("hidden","")),A&&(d?A.removeAttribute("hidden"):A.setAttribute("hidden","")),w&&(d||z?w.removeAttribute("hidden"):w.setAttribute("hidden","")),this._slottedInput){const x=(this.getAttribute("label")||t?.assignedNodes({flatten:!0}).map(N=>N.textContent||"").join(" ")||this.getAttribute("aria-label")||"").trim(),$=(this.getAttribute("description")||"").trim();q.nameSlottedInput(this._slottedInput,x,$),this.getAttribute("validation")==="error"||!!u?this._slottedInput.setAttribute("aria-invalid","true"):this._slottedInput.removeAttribute("aria-invalid")}else if(this._input){I.syncControlName(this._input,this,l?`${this._uid}-label`:null);const x=[];c&&x.push(`${this._uid}-description`),d&&x.push(`${this._uid}-error`),I.syncControlDescription(this._input,this,this._uid,x),this.getAttribute("validation")==="error"||!!u?this._input.setAttribute("aria-invalid","true"):this._input.removeAttribute("aria-invalid"),this.hasAttribute("required")?this._input.setAttribute("aria-required","true"):this._input.removeAttribute("aria-required")}}_onNativeInput(t){const e=t.target.value;this._dirty=!0,this.getAttribute("value")!==e?this.setAttribute("value",e):this._syncInputValue(e),this._emitValueEvent("input",e);const i=Number(this.getAttribute("debounce")||0);i>0?(this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>{this._emitValueEvent("debounced-input",e),this._debounceTimer=null},i)):this._emitValueEvent("debounced-input",e)}_onNativeChange(t){const e=t.target.value;this._emitValueEvent("change",e)}_onClearClick(t){if(t.preventDefault(),!(m(this,"disabled")||this.hasAttribute("readonly"))&&this._input){this.value="",this._input.value="",this._input.dispatchEvent(new Event("input",{bubbles:!0})),this._input.dispatchEvent(new Event("change",{bubbles:!0})),this.dispatchEvent(new CustomEvent("clear",{bubbles:!0,composed:!0}));try{this._input.focus({preventScroll:!0})}catch{this._input.focus()}}}render(){const t=this.getAttribute("value")||"",e=this.getAttribute("placeholder")||"",i=m(this,"disabled"),n=m(this,"clearable"),o=this.getAttribute("type")||"text",s=this.getAttribute("name")||"",g=this.hasAttribute("required"),u=this.getAttribute("pattern")||"",l=this.getAttribute("inputmode")||"",c=this.getAttribute("autocomplete")||"",d=this.getAttribute("min")||"",p=this.getAttribute("max")||"",h=this.getAttribute("step")||"",b=this.getAttribute("spellcheck")||"",f=this.getAttribute("maxlength")||"",v=this.getAttribute("minlength")||"",_=this.hasAttribute("readonly"),y=this.getAttribute("label")||"",w=this.getAttribute("description")||"",A=this.getAttribute("data-error")||"",C=this.getAttribute("validation")||"",z=this.hasAttribute("floating-label"),x=g?'<span class="required" aria-hidden="true">*</span>':"";this._syncHostTokens(),this.setContent(`
533
+ <style>${D}</style>
493
534
  <div class="root" part="root">
494
535
  <div class="meta" part="meta">
495
536
  <label class="label" id="${this._uid}-label" part="label">
496
- <slot name="label">${r(x)}</slot>
497
- ${z}
537
+ <slot name="label">${r(y)}</slot>
538
+ ${x}
498
539
  </label>
499
540
  <p class="description" id="${this._uid}-description" part="description">
500
- <slot name="description">${r(y)}</slot>
541
+ <slot name="description">${r(w)}</slot>
501
542
  </p>
502
543
  </div>
503
544
 
@@ -505,38 +546,39 @@
505
546
  <span class="prefix" part="prefix"><slot name="prefix"></slot></span>
506
547
 
507
548
  <div class="control" part="control">
549
+ <slot name="input"></slot>
508
550
  <input
509
551
  part="input"
510
- type="${r(s)}"
511
- name="${r(o)}"
552
+ type="${r(o)}"
553
+ name="${r(s)}"
512
554
  value="${r(t)}"
513
555
  placeholder="${r(e)}"
514
556
  ${g?"required":""}
515
- ${p?`pattern="${r(p)}"`:""}
516
- ${u?`inputmode="${r(u)}"`:""}
517
- ${l?`autocomplete="${r(l)}"`:""}
518
- ${c?`min="${r(c)}"`:""}
519
- ${d?`max="${r(d)}"`:""}
557
+ ${u?`pattern="${r(u)}"`:""}
558
+ ${l?`inputmode="${r(l)}"`:""}
559
+ ${c?`autocomplete="${r(c)}"`:""}
560
+ ${d?`min="${r(d)}"`:""}
561
+ ${p?`max="${r(p)}"`:""}
520
562
  ${h?`step="${r(h)}"`:""}
521
563
  ${b?`spellcheck="${r(b)}"`:""}
522
564
  ${f?`maxlength="${r(f)}"`:""}
523
565
  ${v?`minlength="${r(v)}"`:""}
524
566
  ${i?"disabled":""}
525
- ${m?"readonly":""}
567
+ ${_?"readonly":""}
526
568
  />
527
- ${k?`<span class="floating-label" part="floating-label">${r(x||e||o||"Input")}</span>`:""}
569
+ ${z?`<span class="floating-label" part="floating-label">${r(y||e||s||"Input")}</span>`:""}
528
570
  </div>
529
571
 
530
- <button class="clear-btn" part="clear" aria-label="Clear" ${n&&t&&!i&&!m?"":"hidden"}>${q}</button>
572
+ <button class="clear-btn" part="clear" aria-label="Clear" ${n&&t&&!i&&!_?"":"hidden"}>${V}</button>
531
573
 
532
574
  <span class="suffix" part="suffix"><slot name="suffix"></slot></span>
533
575
  </div>
534
576
 
535
577
  <div class="footer" part="footer">
536
578
  <p class="error" id="${this._uid}-error" part="error" aria-live="polite">
537
- ${_?r(_):'<slot name="error"></slot>'}
579
+ ${A?r(A):'<slot name="error"></slot>'}
538
580
  </p>
539
581
  <p class="counter" part="counter"></p>
540
582
  </div>
541
583
  </div>
542
- `),this._detachListeners(),this._input=this.root.querySelector("input"),this._clearBtn=this.root.querySelector("button.clear-btn"),this._input&&(this._input.addEventListener("input",this._onNativeInput),this._input.addEventListener("change",this._onNativeChange)),this._clearBtn?.addEventListener("click",this._onClearClick),this._syncControlAttrs(),this._syncInputValue(t),this._syncDerivedState(),this.hasAttribute("autofocus")&&!this._autofocusApplied&&(this._autofocusApplied=!0,queueMicrotask(()=>{if(this.isConnected)try{this._input?.focus({preventScroll:!0})}catch{this._input?.focus()}}))}shouldRenderOnAttributeChange(t,e,i){return t==="label"||t==="description"||t==="data-error"||t==="floating-label"}}typeof customElements<"u"&&!customElements.get("ui-input")&&customElements.define("ui-input",E);exports.UIInput=E;
584
+ `),this._detachListeners(),this._bindInput(),this._clearBtn=this.root.querySelector("button.clear-btn"),this._clearBtn?.addEventListener("click",this._onClearClick),this._syncControlAttrs(),this._syncInputValue(this._slottedInput?this.value:t),this._syncDerivedState(),this.hasAttribute("autofocus")&&!this._autofocusApplied&&(this._autofocusApplied=!0,queueMicrotask(()=>{if(this.isConnected)try{this._input?.focus({preventScroll:!0})}catch{this._input?.focus()}}))}shouldRenderOnAttributeChange(t,e,i){return t==="label"||t==="description"||t==="data-error"||t==="floating-label"}};E.formAssociated=!0;let S=E;typeof customElements<"u"&&!customElements.get("ui-input")&&customElements.define("ui-input",S);exports.UIInput=S;
package/dist/input.esm.js CHANGED
@@ -1,10 +1,12 @@
1
- import { E as S } from "./ElementBase-BeZT54Hj.mjs";
2
- import { s as E, a as $ } from "./control-name-Bpj7F34X.mjs";
3
- const q = `
1
+ import { E as N } from "./ElementBase-D5QsC5Vw.mjs";
2
+ import { f as I, n as L } from "./slotted-input-atWznLfm.mjs";
3
+ import { s as T } from "./implicit-submit-Lr0-q2LR.mjs";
4
+ import { s as V, a as D } from "./control-name-Bpj7F34X.mjs";
5
+ const F = `
4
6
  <svg viewBox="0 0 20 20" aria-hidden="true" focusable="false">
5
7
  <path d="m6 6 8 8M14 6l-8 8" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
6
8
  </svg>
7
- `, N = `
9
+ `, B = `
8
10
  :host {
9
11
  --ui-input-action-size: 24px;
10
12
  --ui-input-padding: var(--ui-padding, 0);
@@ -71,6 +73,28 @@ const q = `
71
73
  transform: translateY(-0.5px);
72
74
  }
73
75
 
76
+ /* description-position="below": the hint goes under the field (DOM order, and so what a
77
+ screen reader reads, stays label, description, field). */
78
+ :host([description-position="below"]) .meta:not([hidden]) {
79
+ display: contents;
80
+ }
81
+
82
+ :host([description-position="below"]) .label {
83
+ order: 0;
84
+ }
85
+
86
+ :host([description-position="below"]) .shell {
87
+ order: 1;
88
+ }
89
+
90
+ :host([description-position="below"]) .description {
91
+ order: 2;
92
+ }
93
+
94
+ :host([description-position="below"]) .footer {
95
+ order: 3;
96
+ }
97
+
74
98
  .description {
75
99
  margin: 0;
76
100
  color: var(--ui-description-color);
@@ -199,6 +223,25 @@ const q = `
199
223
  color: var(--ui-input-placeholder);
200
224
  }
201
225
 
226
+ /* <input slot="input">: the author's own input (password managers, autofill), styled the same. */
227
+ ::slotted(input[slot="input"]) {
228
+ inline-size: 100%;
229
+ min-inline-size: 0;
230
+ box-sizing: border-box;
231
+ border: none;
232
+ background: transparent;
233
+ color: inherit;
234
+ font: 500 var(--ui-input-font-size)/var(--ui-default-line-height, var(--line-height-2, 20px)) var(--ui-font-family, var(--default-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif));
235
+ padding: var(--ui-input-padding);
236
+ min-block-size: calc(var(--ui-input-min-height) - 2px);
237
+ margin: 0;
238
+ outline: none;
239
+ }
240
+
241
+ .control[data-slotted-input] > input {
242
+ display: none;
243
+ }
244
+
202
245
  input::-webkit-search-cancel-button {
203
246
  display: none;
204
247
  }
@@ -356,7 +399,7 @@ const q = `
356
399
  --ui-label-color: #cbd5e1;
357
400
  --ui-description-color: #93a4bd;
358
401
  --ui-input-border-color: #334155;
359
- --ui-input-focus-ring: #93c5fd;
402
+ --ui-input-focus-ring: var(--ui-color-accent-on-dark, #93c5fd);
360
403
  --ui-input-placeholder: color-mix(in srgb, #e2e8f0 46%, transparent);
361
404
  --ui-input-shadow: 0 2px 8px rgba(2, 6, 23, 0.24);
362
405
  }
@@ -494,23 +537,31 @@ const q = `
494
537
  function r(a) {
495
538
  return a.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
496
539
  }
497
- function w(a) {
540
+ function k(a) {
498
541
  if (!a) return !1;
499
542
  const t = a.assignedNodes({ flatten: !0 });
500
543
  return t.length ? t.some((e) => e.nodeType === Node.TEXT_NODE ? !!e.textContent?.trim() : e.nodeType === Node.ELEMENT_NODE) : !1;
501
544
  }
502
- function A(a, t) {
545
+ function m(a, t) {
503
546
  const e = a.getAttribute(t);
504
547
  if (e == null) return !1;
505
548
  const i = String(e).trim().toLowerCase();
506
549
  return i !== "false" && i !== "0";
507
550
  }
508
- function T(a) {
551
+ function M(a) {
509
552
  return a === "none" || a === "large" || a === "full";
510
553
  }
511
- class L extends S {
554
+ const E = class E extends N {
512
555
  constructor() {
513
- super(), this._input = null, this._clearBtn = null, this._debounceTimer = null, this._formUnregister = null, this._uid = Math.random().toString(36).slice(2, 9), this._autofocusApplied = !1, this._onNativeInput = this._onNativeInput.bind(this), this._onNativeChange = this._onNativeChange.bind(this), this._onClearClick = this._onClearClick.bind(this), this._onSlotChange = this._onSlotChange.bind(this);
556
+ super(), this._input = null, this._clearBtn = null, this._debounceTimer = null, this._formUnregister = null, this._uid = Math.random().toString(36).slice(2, 9), this._autofocusApplied = !1, this._internals = null, this._defaultValue = null, this._formDisabled = !1, this._slottedInput = null, this._dirty = !1, this._onLabelClick = (t) => {
557
+ t.target?.closest?.(".label") && this._input?.focus();
558
+ };
559
+ try {
560
+ this._internals = typeof this.attachInternals == "function" ? this.attachInternals() : null;
561
+ } catch {
562
+ this._internals = null;
563
+ }
564
+ this._onNativeKeyDown = this._onNativeKeyDown.bind(this), this._onNativeInput = this._onNativeInput.bind(this), this._onNativeChange = this._onNativeChange.bind(this), this._onClearClick = this._onClearClick.bind(this), this._onSlotChange = this._onSlotChange.bind(this);
514
565
  }
515
566
  static get observedAttributes() {
516
567
  return [
@@ -553,31 +604,80 @@ class L extends S {
553
604
  ];
554
605
  }
555
606
  connectedCallback() {
556
- super.connectedCallback(), this.root.addEventListener("slotchange", this._onSlotChange), this._registerWithForm();
607
+ this._dirty || (this._defaultValue = this.getAttribute("value") || ""), super.connectedCallback(), this.root.addEventListener("slotchange", this._onSlotChange), this.root.addEventListener("click", this._onLabelClick), this._registerWithForm();
608
+ }
609
+ /** The `<form>` this field belongs to, if any. */
610
+ get form() {
611
+ try {
612
+ return this._internals?.form ?? null;
613
+ } catch {
614
+ return null;
615
+ }
616
+ }
617
+ formResetCallback() {
618
+ this._dirty = !1, this.value = this._defaultValue || "";
619
+ }
620
+ formDisabledCallback(t) {
621
+ this._formDisabled = t, this._input && (this._input.disabled = t || m(this, "disabled"));
622
+ }
623
+ _syncFormState() {
624
+ const t = this._internals;
625
+ if (t)
626
+ try {
627
+ if (this._slottedInput) {
628
+ t.setFormValue?.(null), t.setValidity?.({});
629
+ return;
630
+ }
631
+ t.setFormValue?.(this.value);
632
+ const e = this._input;
633
+ e && typeof t.setValidity == "function" && (e.validity && !e.validity.valid ? t.setValidity(e.validity, e.validationMessage, e) : t.setValidity({}));
634
+ } catch {
635
+ }
636
+ }
637
+ _onNativeKeyDown(t) {
638
+ T(t, this, () => this.form);
557
639
  }
558
640
  disconnectedCallback() {
559
- this.root.removeEventListener("slotchange", this._onSlotChange), this._detachListeners(), this._debounceTimer && (clearTimeout(this._debounceTimer), this._debounceTimer = null), this._formUnregister && (this._formUnregister(), this._formUnregister = null), this._autofocusApplied = !1, super.disconnectedCallback();
641
+ this.root.removeEventListener("slotchange", this._onSlotChange), this.root.removeEventListener("click", this._onLabelClick), this._detachListeners(), this._debounceTimer && (clearTimeout(this._debounceTimer), this._debounceTimer = null), this._formUnregister && (this._formUnregister(), this._formUnregister = null), this._autofocusApplied = !1, super.disconnectedCallback();
560
642
  }
561
643
  _syncHostTokens() {
562
644
  const t = this.getAttribute("color");
563
645
  t ? this.style.setProperty("--ui-input-accent", t) : this.style.removeProperty("--ui-input-accent");
564
646
  const e = this.getAttribute("radius") || "";
565
- e && !T(e) ? this.style.setProperty("--ui-input-border-radius", e) : this.style.removeProperty("--ui-input-border-radius");
647
+ e && !M(e) ? this.style.setProperty("--ui-input-border-radius", e) : this.style.removeProperty("--ui-input-border-radius");
648
+ }
649
+ /** The control: the author's <input slot="input"> when there is one, else the inner input. */
650
+ _bindInput() {
651
+ this._input && (this._input.removeEventListener("input", this._onNativeInput), this._input.removeEventListener("change", this._onNativeChange), this._input.removeEventListener("keydown", this._onNativeKeyDown));
652
+ const t = I(this);
653
+ this._slottedInput = t;
654
+ const e = this.root.querySelector(".control");
655
+ t ? e?.setAttribute("data-slotted-input", "") : e?.removeAttribute("data-slotted-input"), this._input = t || this.root.querySelector(".control > input"), t && !this.hasAttribute("value") && t.value && this.setAttribute("value", t.value), this._input && (this._input.addEventListener("input", this._onNativeInput), this._input.addEventListener("change", this._onNativeChange), t || this._input.addEventListener("keydown", this._onNativeKeyDown));
656
+ }
657
+ // The author's input keeps its own type, name, autocomplete, placeholder...: only the states the
658
+ // host was given are passed on, so the component never undoes what password managers rely on.
659
+ _syncSlottedInputAttrs(t) {
660
+ const e = m(this, "disabled") || this._formDisabled;
661
+ (this.hasAttribute("disabled") || this._formDisabled) && (t.disabled = e), this.hasAttribute("required") && (t.required = !0), this.hasAttribute("readonly") && (t.readOnly = !0);
566
662
  }
567
663
  _syncControlAttrs() {
568
664
  if (this._syncHostTokens(), !this._input) return;
569
- const t = this._input, e = this.getAttribute("type") || "text", i = this.getAttribute("placeholder") || "", n = this.getAttribute("name") || "", s = this.getAttribute("pattern") || "", o = this.getAttribute("inputmode") || "", g = this.getAttribute("autocomplete") || "", p = this.getAttribute("min") || "", u = this.getAttribute("max") || "", l = this.getAttribute("step") || "", c = this.getAttribute("spellcheck") || "", d = this.getAttribute("maxlength") || "", h = this.getAttribute("minlength") || "", b = A(this, "disabled"), f = this.hasAttribute("required"), v = this.hasAttribute("readonly");
665
+ if (this._slottedInput) {
666
+ this._syncSlottedInputAttrs(this._slottedInput);
667
+ return;
668
+ }
669
+ const t = this._input, e = this.getAttribute("type") || "text", i = this.getAttribute("placeholder") || "", n = this.getAttribute("name") || "", o = this.getAttribute("pattern") || "", s = this.getAttribute("inputmode") || "", g = this.getAttribute("autocomplete") || "", u = this.getAttribute("min") || "", l = this.getAttribute("max") || "", c = this.getAttribute("step") || "", d = this.getAttribute("spellcheck") || "", p = this.getAttribute("maxlength") || "", h = this.getAttribute("minlength") || "", b = m(this, "disabled"), f = this.hasAttribute("required"), v = this.hasAttribute("readonly");
570
670
  try {
571
671
  t.type = e;
572
672
  } catch {
573
673
  t.type = "text";
574
674
  }
575
- t.placeholder = i, t.disabled = b, t.required = f, t.readOnly = v, t.name = n, s ? t.setAttribute("pattern", s) : t.removeAttribute("pattern"), o ? t.setAttribute("inputmode", o) : t.removeAttribute("inputmode"), g ? t.setAttribute("autocomplete", g) : t.removeAttribute("autocomplete"), p ? t.setAttribute("min", p) : t.removeAttribute("min"), u ? t.setAttribute("max", u) : t.removeAttribute("max"), l ? t.setAttribute("step", l) : t.removeAttribute("step"), c ? t.setAttribute("spellcheck", c) : t.removeAttribute("spellcheck"), d && Number.isFinite(Number(d)) ? t.setAttribute("maxlength", d) : t.removeAttribute("maxlength"), h && Number.isFinite(Number(h)) ? t.setAttribute("minlength", h) : t.removeAttribute("minlength");
675
+ t.placeholder = i, t.disabled = b || this._formDisabled, t.required = f, t.readOnly = v, t.name = n, o ? t.setAttribute("pattern", o) : t.removeAttribute("pattern"), s ? t.setAttribute("inputmode", s) : t.removeAttribute("inputmode"), g ? t.setAttribute("autocomplete", g) : t.removeAttribute("autocomplete"), u ? t.setAttribute("min", u) : t.removeAttribute("min"), l ? t.setAttribute("max", l) : t.removeAttribute("max"), c ? t.setAttribute("step", c) : t.removeAttribute("step"), d ? t.setAttribute("spellcheck", d) : t.removeAttribute("spellcheck"), p && Number.isFinite(Number(p)) ? t.setAttribute("maxlength", p) : t.removeAttribute("maxlength"), h && Number.isFinite(Number(h)) ? t.setAttribute("minlength", h) : t.removeAttribute("minlength");
576
676
  }
577
677
  attributeChangedCallback(t, e, i) {
578
678
  if (e === i) return;
579
679
  if (t === "value") {
580
- this._syncInputValue(i || "");
680
+ this._dirty || (this._defaultValue = i || ""), this._syncInputValue(i || "");
581
681
  return;
582
682
  }
583
683
  if (t === "name" && this._registerWithForm(), t === "autofocus" && !this.hasAttribute("autofocus") && (this._autofocusApplied = !1), (/* @__PURE__ */ new Set([
@@ -656,50 +756,53 @@ class L extends S {
656
756
  _registerWithForm() {
657
757
  this._formUnregister && (this._formUnregister(), this._formUnregister = null);
658
758
  try {
659
- const n = this.getRootNode().host?.closest?.("ui-form") || null || this.closest("ui-form"), s = this.getAttribute("name");
660
- n && typeof n.registerField == "function" && s && (this._formUnregister = n.registerField(s, {
661
- name: s,
759
+ const n = this.getRootNode().host?.closest?.("ui-form") || null || this.closest("ui-form"), o = this.getAttribute("name");
760
+ n && typeof n.registerField == "function" && o && (this._formUnregister = n.registerField(o, {
761
+ name: o,
662
762
  getValue: () => this.value,
663
- setValue: (o) => {
664
- this.value = String(o ?? "");
763
+ setValue: (s) => {
764
+ this.value = String(s ?? "");
665
765
  },
666
766
  validate: async () => this._input ? { valid: this._input.checkValidity(), message: this._input.validationMessage || void 0 } : { valid: !0 },
667
- setError: (o) => {
668
- o ? (this.setAttribute("validation", "error"), this.setAttribute("data-error", o)) : (this.removeAttribute("validation"), this.removeAttribute("data-error"));
767
+ setError: (s) => {
768
+ s ? (this.setAttribute("validation", "error"), this.setAttribute("data-error", s)) : (this.removeAttribute("validation"), this.removeAttribute("data-error"));
669
769
  }
670
770
  }));
671
771
  } catch {
672
772
  }
673
773
  }
674
774
  _detachListeners() {
675
- this._input && (this._input.removeEventListener("input", this._onNativeInput), this._input.removeEventListener("change", this._onNativeChange)), this._clearBtn && this._clearBtn.removeEventListener("click", this._onClearClick), this._clearBtn = null;
775
+ this._input && (this._input.removeEventListener("input", this._onNativeInput), this._input.removeEventListener("change", this._onNativeChange), this._input.removeEventListener("keydown", this._onNativeKeyDown)), this._clearBtn && this._clearBtn.removeEventListener("click", this._onClearClick), this._clearBtn = null;
676
776
  }
677
777
  _syncInputValue(t) {
678
- this._input && this._input.value !== t && (this._input.value = t), this._clearBtn && (A(this, "clearable") && t.length > 0 && !A(this, "disabled") && !this.hasAttribute("readonly") ? this._clearBtn.removeAttribute("hidden") : this._clearBtn.setAttribute("hidden", ""));
778
+ this._input && this._input.value !== t && (this._input.value = t), this._syncFormState(), this._clearBtn && (m(this, "clearable") && t.length > 0 && !m(this, "disabled") && !this.hasAttribute("readonly") ? this._clearBtn.removeAttribute("hidden") : this._clearBtn.setAttribute("hidden", ""));
679
779
  const e = this.root.querySelector(".counter");
680
780
  if (e && this.hasAttribute("counter")) {
681
- const n = this.getAttribute("maxlength"), s = n ? `${t.length}/${n}` : String(t.length);
682
- e.textContent = s;
781
+ const n = this.getAttribute("maxlength"), o = n ? `${t.length}/${n}` : String(t.length);
782
+ e.textContent = o;
683
783
  }
684
784
  const i = this.root.querySelector(".shell");
685
785
  i && i.setAttribute("data-has-value", t ? "true" : "false");
686
786
  }
687
- _onSlotChange() {
688
- this._syncDerivedState();
787
+ _onSlotChange(t) {
788
+ t?.target?.name === "input" && (this._bindInput(), this._syncControlAttrs(), this._syncInputValue(this.value)), this._syncDerivedState();
689
789
  }
690
790
  _syncDerivedState() {
691
- const t = this.root.querySelector('slot[name="label"]'), e = this.root.querySelector('slot[name="description"]'), i = this.root.querySelector('slot[name="error"]'), n = this.root.querySelector('slot[name="prefix"]'), s = this.root.querySelector('slot[name="suffix"]'), o = (this.getAttribute("label") || "").trim(), g = (this.getAttribute("description") || "").trim(), p = (this.getAttribute("data-error") || "").trim(), u = !!o || w(t), l = !!g || w(e), c = !!p || w(i), d = w(n), h = w(s), b = this.root.querySelector(".label"), f = this.root.querySelector(".description"), v = this.root.querySelector(".prefix"), m = this.root.querySelector(".suffix"), x = this.root.querySelector(".meta"), y = this.root.querySelector(".footer"), _ = this.root.querySelector(".error"), C = this.root.querySelector(".counter");
692
- b && (u ? b.removeAttribute("hidden") : b.setAttribute("hidden", "")), f && (l ? f.removeAttribute("hidden") : f.setAttribute("hidden", "")), v && (d ? v.removeAttribute("hidden") : v.setAttribute("hidden", "")), m && (h ? m.removeAttribute("hidden") : m.setAttribute("hidden", "")), x && (u || l ? x.removeAttribute("hidden") : x.setAttribute("hidden", ""));
693
- const k = this.hasAttribute("counter");
694
- if (C && (k ? C.removeAttribute("hidden") : C.setAttribute("hidden", "")), _ && (c ? _.removeAttribute("hidden") : _.setAttribute("hidden", "")), y && (c || k ? y.removeAttribute("hidden") : y.setAttribute("hidden", "")), this._input) {
695
- E(this._input, this, u ? `${this._uid}-label` : null);
696
- const z = [];
697
- l && z.push(`${this._uid}-description`), c && z.push(`${this._uid}-error`), $(this._input, this, this._uid, z), this.getAttribute("validation") === "error" || !!p ? this._input.setAttribute("aria-invalid", "true") : this._input.removeAttribute("aria-invalid"), this.hasAttribute("required") ? this._input.setAttribute("aria-required", "true") : this._input.removeAttribute("aria-required");
791
+ const t = this.root.querySelector('slot[name="label"]'), e = this.root.querySelector('slot[name="description"]'), i = this.root.querySelector('slot[name="error"]'), n = this.root.querySelector('slot[name="prefix"]'), o = this.root.querySelector('slot[name="suffix"]'), s = (this.getAttribute("label") || "").trim(), g = (this.getAttribute("description") || "").trim(), u = (this.getAttribute("data-error") || "").trim(), l = !!s || k(t), c = !!g || k(e), d = !!u || k(i), p = k(n), h = k(o), b = this.root.querySelector(".label"), f = this.root.querySelector(".description"), v = this.root.querySelector(".prefix"), _ = this.root.querySelector(".suffix"), y = this.root.querySelector(".meta"), w = this.root.querySelector(".footer"), A = this.root.querySelector(".error"), C = this.root.querySelector(".counter");
792
+ b && (l ? b.removeAttribute("hidden") : b.setAttribute("hidden", "")), f && (c ? f.removeAttribute("hidden") : f.setAttribute("hidden", "")), v && (p ? v.removeAttribute("hidden") : v.setAttribute("hidden", "")), _ && (h ? _.removeAttribute("hidden") : _.setAttribute("hidden", "")), y && (l || c ? y.removeAttribute("hidden") : y.setAttribute("hidden", ""));
793
+ const z = this.hasAttribute("counter");
794
+ if (C && (z ? C.removeAttribute("hidden") : C.setAttribute("hidden", "")), A && (d ? A.removeAttribute("hidden") : A.setAttribute("hidden", "")), w && (d || z ? w.removeAttribute("hidden") : w.setAttribute("hidden", "")), this._slottedInput) {
795
+ const x = (this.getAttribute("label") || t?.assignedNodes({ flatten: !0 }).map((q) => q.textContent || "").join(" ") || this.getAttribute("aria-label") || "").trim(), $ = (this.getAttribute("description") || "").trim();
796
+ L(this._slottedInput, x, $), this.getAttribute("validation") === "error" || !!u ? this._slottedInput.setAttribute("aria-invalid", "true") : this._slottedInput.removeAttribute("aria-invalid");
797
+ } else if (this._input) {
798
+ V(this._input, this, l ? `${this._uid}-label` : null);
799
+ const x = [];
800
+ c && x.push(`${this._uid}-description`), d && x.push(`${this._uid}-error`), D(this._input, this, this._uid, x), this.getAttribute("validation") === "error" || !!u ? this._input.setAttribute("aria-invalid", "true") : this._input.removeAttribute("aria-invalid"), this.hasAttribute("required") ? this._input.setAttribute("aria-required", "true") : this._input.removeAttribute("aria-required");
698
801
  }
699
802
  }
700
803
  _onNativeInput(t) {
701
804
  const e = t.target.value;
702
- this.getAttribute("value") !== e ? this.setAttribute("value", e) : this._syncInputValue(e), this._emitValueEvent("input", e);
805
+ this._dirty = !0, this.getAttribute("value") !== e ? this.setAttribute("value", e) : this._syncInputValue(e), this._emitValueEvent("input", e);
703
806
  const i = Number(this.getAttribute("debounce") || 0);
704
807
  i > 0 ? (this._debounceTimer && clearTimeout(this._debounceTimer), this._debounceTimer = setTimeout(() => {
705
808
  this._emitValueEvent("debounced-input", e), this._debounceTimer = null;
@@ -710,7 +813,7 @@ class L extends S {
710
813
  this._emitValueEvent("change", e);
711
814
  }
712
815
  _onClearClick(t) {
713
- if (t.preventDefault(), !(A(this, "disabled") || this.hasAttribute("readonly")) && this._input) {
816
+ if (t.preventDefault(), !(m(this, "disabled") || this.hasAttribute("readonly")) && this._input) {
714
817
  this.value = "", this._input.value = "", this._input.dispatchEvent(new Event("input", { bubbles: !0 })), this._input.dispatchEvent(new Event("change", { bubbles: !0 })), this.dispatchEvent(new CustomEvent("clear", { bubbles: !0, composed: !0 }));
715
818
  try {
716
819
  this._input.focus({ preventScroll: !0 });
@@ -720,17 +823,17 @@ class L extends S {
720
823
  }
721
824
  }
722
825
  render() {
723
- const t = this.getAttribute("value") || "", e = this.getAttribute("placeholder") || "", i = A(this, "disabled"), n = A(this, "clearable"), s = this.getAttribute("type") || "text", o = this.getAttribute("name") || "", g = this.hasAttribute("required"), p = this.getAttribute("pattern") || "", u = this.getAttribute("inputmode") || "", l = this.getAttribute("autocomplete") || "", c = this.getAttribute("min") || "", d = this.getAttribute("max") || "", h = this.getAttribute("step") || "", b = this.getAttribute("spellcheck") || "", f = this.getAttribute("maxlength") || "", v = this.getAttribute("minlength") || "", m = this.hasAttribute("readonly"), x = this.getAttribute("label") || "", y = this.getAttribute("description") || "", _ = this.getAttribute("data-error") || "", C = this.getAttribute("validation") || "", k = this.hasAttribute("floating-label"), z = g ? '<span class="required" aria-hidden="true">*</span>' : "";
826
+ const t = this.getAttribute("value") || "", e = this.getAttribute("placeholder") || "", i = m(this, "disabled"), n = m(this, "clearable"), o = this.getAttribute("type") || "text", s = this.getAttribute("name") || "", g = this.hasAttribute("required"), u = this.getAttribute("pattern") || "", l = this.getAttribute("inputmode") || "", c = this.getAttribute("autocomplete") || "", d = this.getAttribute("min") || "", p = this.getAttribute("max") || "", h = this.getAttribute("step") || "", b = this.getAttribute("spellcheck") || "", f = this.getAttribute("maxlength") || "", v = this.getAttribute("minlength") || "", _ = this.hasAttribute("readonly"), y = this.getAttribute("label") || "", w = this.getAttribute("description") || "", A = this.getAttribute("data-error") || "", C = this.getAttribute("validation") || "", z = this.hasAttribute("floating-label"), x = g ? '<span class="required" aria-hidden="true">*</span>' : "";
724
827
  this._syncHostTokens(), this.setContent(`
725
- <style>${N}</style>
828
+ <style>${B}</style>
726
829
  <div class="root" part="root">
727
830
  <div class="meta" part="meta">
728
831
  <label class="label" id="${this._uid}-label" part="label">
729
- <slot name="label">${r(x)}</slot>
730
- ${z}
832
+ <slot name="label">${r(y)}</slot>
833
+ ${x}
731
834
  </label>
732
835
  <p class="description" id="${this._uid}-description" part="description">
733
- <slot name="description">${r(y)}</slot>
836
+ <slot name="description">${r(w)}</slot>
734
837
  </p>
735
838
  </div>
736
839
 
@@ -738,41 +841,42 @@ class L extends S {
738
841
  <span class="prefix" part="prefix"><slot name="prefix"></slot></span>
739
842
 
740
843
  <div class="control" part="control">
844
+ <slot name="input"></slot>
741
845
  <input
742
846
  part="input"
743
- type="${r(s)}"
744
- name="${r(o)}"
847
+ type="${r(o)}"
848
+ name="${r(s)}"
745
849
  value="${r(t)}"
746
850
  placeholder="${r(e)}"
747
851
  ${g ? "required" : ""}
748
- ${p ? `pattern="${r(p)}"` : ""}
749
- ${u ? `inputmode="${r(u)}"` : ""}
750
- ${l ? `autocomplete="${r(l)}"` : ""}
751
- ${c ? `min="${r(c)}"` : ""}
752
- ${d ? `max="${r(d)}"` : ""}
852
+ ${u ? `pattern="${r(u)}"` : ""}
853
+ ${l ? `inputmode="${r(l)}"` : ""}
854
+ ${c ? `autocomplete="${r(c)}"` : ""}
855
+ ${d ? `min="${r(d)}"` : ""}
856
+ ${p ? `max="${r(p)}"` : ""}
753
857
  ${h ? `step="${r(h)}"` : ""}
754
858
  ${b ? `spellcheck="${r(b)}"` : ""}
755
859
  ${f ? `maxlength="${r(f)}"` : ""}
756
860
  ${v ? `minlength="${r(v)}"` : ""}
757
861
  ${i ? "disabled" : ""}
758
- ${m ? "readonly" : ""}
862
+ ${_ ? "readonly" : ""}
759
863
  />
760
- ${k ? `<span class="floating-label" part="floating-label">${r(x || e || o || "Input")}</span>` : ""}
864
+ ${z ? `<span class="floating-label" part="floating-label">${r(y || e || s || "Input")}</span>` : ""}
761
865
  </div>
762
866
 
763
- <button class="clear-btn" part="clear" aria-label="Clear" ${n && t && !i && !m ? "" : "hidden"}>${q}</button>
867
+ <button class="clear-btn" part="clear" aria-label="Clear" ${n && t && !i && !_ ? "" : "hidden"}>${F}</button>
764
868
 
765
869
  <span class="suffix" part="suffix"><slot name="suffix"></slot></span>
766
870
  </div>
767
871
 
768
872
  <div class="footer" part="footer">
769
873
  <p class="error" id="${this._uid}-error" part="error" aria-live="polite">
770
- ${_ ? r(_) : '<slot name="error"></slot>'}
874
+ ${A ? r(A) : '<slot name="error"></slot>'}
771
875
  </p>
772
876
  <p class="counter" part="counter"></p>
773
877
  </div>
774
878
  </div>
775
- `), this._detachListeners(), this._input = this.root.querySelector("input"), this._clearBtn = this.root.querySelector("button.clear-btn"), this._input && (this._input.addEventListener("input", this._onNativeInput), this._input.addEventListener("change", this._onNativeChange)), this._clearBtn?.addEventListener("click", this._onClearClick), this._syncControlAttrs(), this._syncInputValue(t), this._syncDerivedState(), this.hasAttribute("autofocus") && !this._autofocusApplied && (this._autofocusApplied = !0, queueMicrotask(() => {
879
+ `), this._detachListeners(), this._bindInput(), this._clearBtn = this.root.querySelector("button.clear-btn"), this._clearBtn?.addEventListener("click", this._onClearClick), this._syncControlAttrs(), this._syncInputValue(this._slottedInput ? this.value : t), this._syncDerivedState(), this.hasAttribute("autofocus") && !this._autofocusApplied && (this._autofocusApplied = !0, queueMicrotask(() => {
776
880
  if (this.isConnected)
777
881
  try {
778
882
  this._input?.focus({ preventScroll: !0 });
@@ -784,8 +888,10 @@ class L extends S {
784
888
  shouldRenderOnAttributeChange(t, e, i) {
785
889
  return t === "label" || t === "description" || t === "data-error" || t === "floating-label";
786
890
  }
787
- }
788
- typeof customElements < "u" && !customElements.get("ui-input") && customElements.define("ui-input", L);
891
+ };
892
+ E.formAssociated = !0;
893
+ let S = E;
894
+ typeof customElements < "u" && !customElements.get("ui-input") && customElements.define("ui-input", S);
789
895
  export {
790
- L as UIInput
896
+ S as UIInput
791
897
  };